SingleParticleSegregation.h
Go to the documentation of this file.
1 // This file is part of the MercuryDPM project (https://www.mercurydpm.org).
2 // Copyright (c), The MercuryDPM Developers Team. All rights reserved.
3 // License: BSD 3-Clause License; see the LICENSE file in the root directory.
4 
5 #ifndef MERCURYDPM_SINGLEPARTICLESEGREGATION_H
6 #define MERCURYDPM_SINGLEPARTICLESEGREGATION_H
7 
9 #include "Chute.h"
12 #include "CG/TimeAveragedCG.h"
13 using constants::pi;
14 
15 /*
16  * Simulate a single intruder particle in a chute flow
17  *
18  * The simulation is non-dimensionalised such that diameter and mass of the flowing particle and gravity equals unity.
19  *
20  * To create some default statistics, use MercuryCG:
21  * ../MercuryCG/MercuryCG SingleParticleSegregation -coordinates XZ -n 100 -timeaverage -tmin 500 -z 0 22.5 -w 0.5
22  */
23 
25 {
26 public:
27  // Set simulation parameters
29 
30  // Chute properties
31  setGravity(Vec3D(0,0,1)); // Apply unit gravity
32  setChuteAngle(30.); // Inclination angle of the chute (degrees)
33  setChuteLength(15.); // Length of chute in x-direction
34  setChuteWidth(6.); // Width of chute in y-direction
35  setInflowHeight(20.); // Height of inflow region
36  setInflowParticleRadius(0.5); // Radius of flowing particles
37  setFixedParticleRadius(0.425); // Radius of fixed bottom particles
38  setRoughBottomType(MULTILAYER); // type of bottom used (change to MULTILAYER for a good demo)
39 
40  // Material properties
42  species.setDensity(6. / constants::pi); // Normalised density so that bulk particle has mass 1
43  double collisionTime = 0.005; // Collision time scale and coefficient of restitution
44  species.setCollisionTimeAndRestitutionCoefficient(collisionTime, 0.1, 1);
45  species.setSlidingFrictionCoefficient(0.5); // Sliding friction coefficient
46  species.setSlidingDissipation(2./7.*species.getDissipation()); //Tangential dissipation
47  species.setSlidingStiffness(2./7.*species.getStiffness()); //Tangential stiffness
49 
50  // intruder properties
51  intruderRadius = 0.85; // Diameter of the large intruder particle
52  intruderHeight = 0.5*getInflowHeight(); // Initial height of intruder above chute bottom
53  springStiffness = 20; // Spring stiffness (used in contact model)
54 
55  // time stepping properties
56  setTimeStep(0.05*collisionTime); // Time step (should be 1/50 of collision time for publication!)
57  setTimeMax(10); // Maximum simulation time
58  setSaveCount((unsigned)(0.2/getTimeStep())); // Store one snapshot every 0.2 seconds
59 
60  // set name
61  setName("SingleParticleSegregation");
62  }
63 
64  void setupInitialConditions() override
65  {
66  // remove existing putput files
68 
69  // Make chute periodic in y-direction (spanwise)
71 
72  // Add periodic boundary in x-direction (streamwise)
74  b0.set(Vec3D(1.0, 0.0, 0.0), getXMin(), getXMax());
76 
80  addFlowParticlesCompactly(); // Fill the chute with particles at inflow
81  setParticlesWriteVTK(true); // Enable VTK output for visualisation
82  boundaryHandler.removeLastObject(); // Remove last boundary (cleanup, optional)
83  }
84 
88  p.setSpecies(speciesHandler.getObject(0));
89  p.setRadius(intruderRadius);
90  p.setPosition(Vec3D(0.5*getChuteLength(), 0.5*getChuteWidth(), intruderHeight));
92  }
93 
94  // add spring force to the intruder particle to force it to remain near a given z-position.
95  void computeAdditionalForces() override {
97  }
98 
99  // move all particles to keep intruder centred
100  void actionsAfterTimeStep() override {
102  for (BaseParticle* p : particleHandler) {
103  p->move(shift);
104  }
105  // record time and shift, so original positions can be reconstructed
106  static std::ofstream shiftRecorder (getName()+".shift");
107  static Vec3D totalShift {0,0,0};
108  totalShift += shift;
109  shiftRecorder << getTime() << " " << totalShift << std::endl;
110  }
111 
113  void printTime() const override {
115  }
116 
117 private:
118 
119  // simulation parameters
120  double intruderRadius; // Diameter of the large intruder particle
121  double intruderHeight; // Initial height of intruder above chute bottom
122  double springStiffness; // Spring stiffness (used in contact model)
123 
124  // pointers
126 };
127 
128 
129 #endif //MERCURYDPM_SINGLEPARTICLESEGREGATION_H
@ MULTILAYER
Definition: Chute.h:32
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
@ INFO
float * p
Definition: Tutorial_Map_using.cpp:9
std::enable_if<!std::is_pointer< U >::value, U * >::type copyAndAddObject(const U &object)
Creates a copy of a Object and adds it to the BaseHandler.
Definition: BaseHandler.h:360
unsigned int getSize() const
Gets the size of the particleHandler (including mpi and periodic particles)
Definition: BaseHandler.h:663
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:621
void removeLastObject()
Removes the last Object from the BaseHandler.
Definition: BaseHandler.h:519
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
Definition: BaseInteractable.h:197
void addForce(const Vec3D &addForce)
Adds an amount to the force on this BaseInteractable.
Definition: BaseInteractable.cc:94
Definition: BaseParticle.h:33
Creates chutes with different bottoms. Inherits from Mercury3D (-> MercuryBase -> DPMBase).
Definition: Chute.h:44
void setChuteWidth(Mdouble chuteWidth)
Sets the chute width (Y-direction)
Definition: Chute.cc:1018
void setInflowParticleRadius(Mdouble inflowParticleRadius)
Sets the radius of the inflow particles to a single one (i.e. ensures a monodisperse inflow).
Definition: Chute.cc:827
void setRoughBottomType(RoughBottomType roughBottomType)
Sets the type of rough bottom of the chute.
Definition: Chute.cc:693
virtual void setChuteLength(Mdouble chuteLength)
Sets the chute length (X-direction)
Definition: Chute.cc:1038
void setupInitialConditions() override
Creates bottom, side walls and a particle insertion boundary.
Definition: Chute.cc:221
Mdouble getInflowHeight() const
Returns the maximum inflow height (Z-direction)
Definition: Chute.cc:953
Mdouble getChuteLength() const
Returns the chute length (X-direction)
Definition: Chute.cc:1048
Mdouble getChuteWidth() const
Returns the chute width (Y-direction)
Definition: Chute.cc:1028
virtual void addFlowParticlesCompactly()
Add initial flow particles in a dense packing.
Definition: Chute.cc:1062
void setChuteAngle(Mdouble chuteAngle)
Sets gravity vector according to chute angle (in degrees)
Definition: Chute.cc:747
void setInflowHeight(Mdouble inflowHeight)
Sets maximum inflow height (Z-direction)
Definition: Chute.cc:936
void makeChutePeriodic()
This makes the chute periodic in Y.
Definition: Chute.cc:611
void setFixedParticleRadius(Mdouble fixedParticleRadius)
Sets the particle radius of the fixed particles which constitute the (rough) chute bottom.
Definition: Chute.cc:632
Mdouble getXMin() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMin() returns XMin.
Definition: DPMBase.h:603
Mdouble getXMax() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMax() returns XMax.
Definition: DPMBase.h:610
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_ for all files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:386
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. LinearViscoelasticSpecies, etc.
Definition: DPMBase.h:1433
void removeOldFiles() const
Definition: DPMBase.cc:4492
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:400
Mdouble getTimeStep() const
Returns the simulation time step.
Definition: DPMBase.cc:1241
const std::string & getName() const
Returns the name of the file. Does not allow to change it though.
Definition: DPMBase.cc:377
Mdouble getTime() const
Returns the current simulation time.
Definition: DPMBase.cc:799
Mdouble getKineticEnergy() const
Returns the global kinetic energy stored in the system.
Definition: DPMBase.cc:1535
BoundaryHandler boundaryHandler
An object of the class BoundaryHandler which concerns insertion and deletion of particles into or fro...
Definition: DPMBase.h:1458
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created.
Definition: DPMBase.h:1443
void setParticlesWriteVTK(bool writeParticlesVTK)
Sets whether particles are written in a VTK file.
Definition: DPMBase.cc:933
void setTimeStep(Mdouble newDt)
Sets a new value for the simulation time step.
Definition: DPMBase.cc:1225
void setTimeMax(Mdouble newTMax)
Sets a new value for the maximum simulation duration.
Definition: DPMBase.cc:864
void setGravity(Vec3D newGravity)
Sets a new value for the gravitational acceleration.
Definition: DPMBase.cc:1374
Mdouble getElasticEnergy() const
Returns the global elastic energy within the system.
Definition: DPMBase.cc:1521
void setDensity(Mdouble density)
Definition: ParticleSpecies.cc:88
Defines a pair of periodic walls. Inherits from BaseBoundary.
Definition: PeriodicBoundary.h:20
void set(Vec3D normal, Mdouble distanceLeft, Mdouble distanceRight)
Defines a PeriodicBoundary by its normal and positions.
Definition: PeriodicBoundary.cc:63
Definition: SingleParticleSegregation.h:25
void setupInitialConditions() override
This function allows to set the initial conditions for our problem to be solved, by default particle ...
Definition: SingleParticleSegregation.h:64
void actionsAfterTimeStep() override
A virtual function which allows to define operations to be executed after time step.
Definition: SingleParticleSegregation.h:100
void addIntruderParticle()
add a single intruder particle
Definition: SingleParticleSegregation.h:86
double intruderRadius
Definition: SingleParticleSegregation.h:120
double springStiffness
Definition: SingleParticleSegregation.h:122
void printTime() const override
Customised logging of simulation state.
Definition: SingleParticleSegregation.h:113
SphericalParticle * intruderParticle
Definition: SingleParticleSegregation.h:125
double intruderHeight
Definition: SingleParticleSegregation.h:121
SingleParticleSegregation()
Definition: SingleParticleSegregation.h:28
void computeAdditionalForces() override
A virtual function which allows to define operations to be executed prior to the OMP force collect.
Definition: SingleParticleSegregation.h:95
Contains material and contact force properties.
Definition: Species.h:14
A spherical particle is the most simple particle used in MercuryDPM.
Definition: SphericalParticle.h:16
Definition: Kernel/Math/Vector.h:30
Mdouble Y
Definition: Kernel/Math/Vector.h:45
Mdouble X
the vector components
Definition: Kernel/Math/Vector.h:45
#define Z
Definition: icosphere.cpp:21
const Mdouble pi
Definition: ExtendedMath.h:23