HourGlass3DDemo.cpp File Reference

Classes

class  HourGlass
 

Functions

int main (int argc, char *argv[])
 

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)
104 {
105  logger(INFO, "Hourglass Simulation");
106  // note: the scaling of the hourglass is based on Stefan Luding's demo code MDCLR/DEMO/W7
107 
108  //all parameters should be set in the main file
109  //here, we use SI units (generally, other, scaled units are possible)
110 
111  //create an instance of the class and name it
112  HourGlass HG;
113  HG.setName("HourGlass3DDemo");
114 
115 
116  //these parameters are needed in setupInitialConditions()
117 
118  //specify geometry
119  //specify dimensions of the hourglass
120  const Mdouble width = 10e-2; // 10cm
121  const Mdouble height = 60e-2; // 60cm
122  //set domain accordingly (domain boundaries are not walls!)
123  HG.setXMin(0.0);
124  HG.setXMax(width);
125  HG.setYMin(0.0);
126  HG.setYMax(width);
127  HG.setZMin(0.0);
128  HG.setZMax(height);
129 
130  //specify how big the wedge of the contraction should be
131  const Mdouble contractionWidth = 2.5e-2; //2.5cm
132  const Mdouble contractionHeight = 5e-2; //5cm
133  HG.contractionWidth = contractionWidth;
134  HG.contractionHeight = contractionHeight;
135 
136  //specify particle properties
137 
138  //these parameters are needed in setupInitialConditions()
139  HG.minParticleRadius = 6e-3; // 6mm
140  HG.maxParticleRadius = 10e-3; //10mm
141 
142  //specify body forces
143  HG.setGravity(Vec3D(0.0, 0.0, -9.8));
144 
145  //make the species of the particle and wall
147  species.setDensity(2000);
148  //specify contact properties
149  //normal forces
150  species.setStiffness(1e5);
151  species.setDissipation(0.63);
152  //tangential (sliding) forces
153  species.setSlidingFrictionCoefficient(0.5);
154  species.setSlidingStiffness(1.2e4);
155  species.setSlidingDissipation(0.16);
156  //tangential (rolling) torques
157  species.setRollingFrictionCoefficient(0.2);
158  species.setRollingStiffness(1.2e4);
159  species.setRollingDissipation(6.3e-2);
160  //normal (torsion/spin) torques
161  species.setTorsionFrictionCoefficient(0.1);
162  species.setTorsionStiffness(1.2e4);
163  species.setSlidingDissipation(6.3e-2);
164  HG.speciesHandler.copyAndAddObject(species);
165 
166  //test normal forces
167  const Mdouble minParticleMass = species.getDensity() * 4.0 / 3.0 * constants::pi * mathsFunc::cubic(HG.minParticleRadius);
168  //Calculates collision time for two copies of a particle of given dissipation_, k, effective mass
169  logger(INFO, "minParticleMass = %", minParticleMass);
170  //Calculates collision time for two copies of a particle of given dissipation_, k, effective mass
171  const Mdouble tc = species.getCollisionTime(minParticleMass);
172  logger(INFO, "tc = %", tc);
173  //Calculates restitution coefficient for two copies of given dissipation_, k, effective mass
174  const Mdouble r = species.getRestitutionCoefficient(minParticleMass);
175  logger(INFO, "restitution coefficient = %", r);
176 
177  //set other simulation parameters
178  HG.setTimeStep(tc / 50.0);
179  HG.setTimeMax(10.0);
180  HG.setSaveCount(500);
181  HG.setXBallsAdditionalArguments("-v0 -solidf");
182  HG.N = 600; //number of particles
183  //uncomment next two line 2 to create paraview files
184  HG.setParticlesWriteVTK(true);
186 
187  HG.solve(argc, argv);
188  return 0;
189 }
Array< double, 1, 3 > e(1./3., 0.5, 2.)
@ ONE_FILE
all data will be written into/ read from a single file called name_
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
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
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 setYMin(Mdouble newYMin)
Sets the value of YMin, the lower bound of the problem domain in the y-direction.
Definition: DPMBase.cc:1025
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:400
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
Definition: DPMBase.h:1453
void setYMax(Mdouble newYMax)
Sets the value of YMax, the upper bound of the problem domain in the y-direction.
Definition: DPMBase.cc:1182
void setZMin(Mdouble newZMin)
Sets the value of ZMin, the lower bound of the problem domain in the z-direction.
Definition: DPMBase.cc:1049
void setXBallsAdditionalArguments(std::string newXBArgs)
Set the additional arguments for xballs.
Definition: DPMBase.cc:1338
void setXMax(Mdouble newXMax)
Sets the value of XMax, the upper bound of the problem domain in the x-direction.
Definition: DPMBase.cc:1156
void setZMax(Mdouble newZMax)
Sets the value of ZMax, the upper bound of the problem domain in the z-direction.
Definition: DPMBase.cc:1208
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 solve()
The work horse of the code.
Definition: DPMBase.cc:4334
void setXMin(Mdouble newXMin)
Sets the value of XMin, the lower bound of the problem domain in the x-direction.
Definition: DPMBase.cc:1001
void setGravity(Vec3D newGravity)
Sets a new value for the gravitational acceleration.
Definition: DPMBase.cc:1374
void setRollingFrictionCoefficient(Mdouble new_mu)
Allows the (dynamic) Coulomb friction coefficient to be changed; also sets mu_s by default.
Definition: FrictionSpecies.cc:165
void setTorsionStiffness(Mdouble new_kt)
Allows the torsion stiffness to be changed.
Definition: FrictionSpecies.cc:201
void setRollingDissipation(Mdouble new_dispt)
Allows the tangential viscosity to be changed.
Definition: FrictionSpecies.cc:147
void setTorsionFrictionCoefficient(Mdouble new_mu)
Allows the (dynamic) Coulomb torsion friction coefficient to be changed; also sets mu_s by default.
Definition: FrictionSpecies.cc:238
void setRollingStiffness(Mdouble new_kt)
Allows the spring constant to be changed.
Definition: FrictionSpecies.cc:128
Definition: HourGlass3DDemo.cpp:19
unsigned int N
Definition: HourGlass3DDemo.cpp:100
Mdouble contractionHeight
Definition: HourGlass3DDemo.cpp:97
Mdouble maxParticleRadius
Definition: HourGlass3DDemo.cpp:99
Mdouble minParticleRadius
Definition: HourGlass3DDemo.cpp:98
Mdouble contractionWidth
Definition: HourGlass3DDemo.cpp:96
Mdouble getCollisionTime(Mdouble mass) const
Calculates collision time for two copies of a particle of given disp, k, mass.
Definition: LinearViscoelasticNormalSpecies.cc:116
void setDissipation(Mdouble dissipation)
Allows the normal dissipation to be changed.
Definition: LinearViscoelasticNormalSpecies.cc:96
void setStiffness(Mdouble new_k)
Allows the spring constant to be changed.
Definition: LinearViscoelasticNormalSpecies.cc:72
Mdouble getRestitutionCoefficient(Mdouble mass) const
Calculates restitution coefficient for two copies of given disp, k, mass.
Definition: LinearViscoelasticNormalSpecies.cc:147
void setDensity(Mdouble density)
Definition: ParticleSpecies.cc:88
Mdouble getDensity() const
Allows density_ to be accessed.
Definition: ParticleSpecies.cc:98
void setSlidingStiffness(Mdouble new_kt)
Allows the spring constant to be changed.
Definition: SlidingFrictionSpecies.cc:83
void setSlidingDissipation(Mdouble new_dispt)
Allows the tangential viscosity to be changed.
Definition: SlidingFrictionSpecies.cc:102
void setSlidingFrictionCoefficient(Mdouble new_mu)
Allows the (dynamic) Coulomb friction coefficient to be changed; also sets mu_s by default.
Definition: SlidingFrictionSpecies.cc:120
Definition: Kernel/Math/Vector.h:30
void setWriteVTK(FileType)
Sets whether walls are written into a VTK file.
Definition: WallHandler.cc:445
#define INFO(i)
Definition: mumps_solver.h:54
double height(const double &x)
Height of domain.
Definition: simple_spine_channel.cc:429
r
Definition: UniformPSDSelfTest.py:20
const Mdouble pi
Definition: ExtendedMath.h:23
T cubic(const T val)
calculates the cube of a number
Definition: ExtendedMath.h:95

References HourGlass::contractionHeight, HourGlass::contractionWidth, BaseHandler< T >::copyAndAddObject(), mathsFunc::cubic(), e(), LinearViscoelasticNormalSpecies::getCollisionTime(), ParticleSpecies::getDensity(), LinearViscoelasticNormalSpecies::getRestitutionCoefficient(), Global_Physical_Variables::height(), INFO, logger, HourGlass::maxParticleRadius, HourGlass::minParticleRadius, HourGlass::N, ONE_FILE, constants::pi, UniformPSDSelfTest::r, ParticleSpecies::setDensity(), LinearViscoelasticNormalSpecies::setDissipation(), DPMBase::setGravity(), DPMBase::setName(), DPMBase::setParticlesWriteVTK(), FrictionSpecies::setRollingDissipation(), FrictionSpecies::setRollingFrictionCoefficient(), FrictionSpecies::setRollingStiffness(), DPMBase::setSaveCount(), SlidingFrictionSpecies::setSlidingDissipation(), SlidingFrictionSpecies::setSlidingFrictionCoefficient(), SlidingFrictionSpecies::setSlidingStiffness(), LinearViscoelasticNormalSpecies::setStiffness(), DPMBase::setTimeMax(), DPMBase::setTimeStep(), FrictionSpecies::setTorsionFrictionCoefficient(), FrictionSpecies::setTorsionStiffness(), WallHandler::setWriteVTK(), DPMBase::setXBallsAdditionalArguments(), DPMBase::setXMax(), DPMBase::setXMin(), DPMBase::setYMax(), DPMBase::setYMin(), DPMBase::setZMax(), DPMBase::setZMin(), DPMBase::solve(), DPMBase::speciesHandler, and DPMBase::wallHandler.