revision: v0.14
HourGlass3DDemo.cpp File Reference

Classes

class  HourGlass
 

Functions

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

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)
118 {
119  logger(INFO, "Hourglass Simulation");
120  // note: the scaling of the hourglass is based on Stefan Luding's demo code MDCLR/DEMO/W7
121 
122  //all parameters should be set in the main file
123  //here, we use SI units (generally, other, scaled units are possible)
124 
125  //create an instance of the class and name it
126  HourGlass HG;
127  HG.setName("HourGlass3DDemo");
128 
129 
130  //these parameters are needed in setupInitialConditions()
131 
132  //specify geometry
133  //specify dimensions of the hourglass
134  const Mdouble width = 10e-2; // 10cm
135  const Mdouble height = 60e-2; // 60cm
136  //set domain accordingly (domain boundaries are not walls!)
137  HG.setXMin(0.0);
138  HG.setXMax(width);
139  HG.setYMin(0.0);
140  HG.setYMax(width);
141  HG.setZMin(0.0);
142  HG.setZMax(height);
143 
144  //specify how big the wedge of the contraction should be
145  const Mdouble contractionWidth = 2.5e-2; //2.5cm
146  const Mdouble contractionHeight = 5e-2; //5cm
147  HG.contractionWidth = contractionWidth;
148  HG.contractionHeight = contractionHeight;
149 
150  //specify particle properties
151 
152  //these parameters are needed in setupInitialConditions()
153  HG.minParticleRadius = 6e-3; // 6mm
154  HG.maxParticleRadius = 10e-3; //10mm
155 
156  //specify body forces
157  HG.setGravity(Vec3D(0.0, 0.0, -9.8));
158 
159  //make the species of the particle and wall
161  species.setDensity(2000);
162  //specify contact properties
163  //normal forces
164  species.setStiffness(1e5);
165  species.setDissipation(0.63);
166  //tangential (sliding) forces
167  species.setSlidingFrictionCoefficient(0.5);
168  species.setSlidingStiffness(1.2e4);
169  species.setSlidingDissipation(0.16);
170  //tangential (rolling) torques
171  species.setRollingFrictionCoefficient(0.2);
172  species.setRollingStiffness(1.2e4);
173  species.setRollingDissipation(6.3e-2);
174  //normal (torsion/spin) torques
175  species.setTorsionFrictionCoefficient(0.1);
176  species.setTorsionStiffness(1.2e4);
177  species.setSlidingDissipation(6.3e-2);
178  HG.speciesHandler.copyAndAddObject(species);
179 
180  //test normal forces
181  const Mdouble minParticleMass = species.getDensity() * 4.0 / 3.0 * constants::pi * mathsFunc::cubic(HG.minParticleRadius);
182  //Calculates collision time for two copies of a particle of given dissipation_, k, effective mass
183  logger(INFO, "minParticleMass = %", minParticleMass);
184  //Calculates collision time for two copies of a particle of given dissipation_, k, effective mass
185  const Mdouble tc = species.getCollisionTime(minParticleMass);
186  logger(INFO, "tc = %", tc);
187  //Calculates restitution coefficient for two copies of given dissipation_, k, effective mass
188  const Mdouble r = species.getRestitutionCoefficient(minParticleMass);
189  logger(INFO, "restitution coefficient = %", r);
190 
191  //set other simulation parameters
192  HG.setTimeStep(tc / 50.0);
193  HG.setTimeMax(10.0);
194  HG.setSaveCount(500);
195  HG.setXBallsAdditionalArguments("-v0 -solidf");
196  HG.N = 600; //number of particles
197  //uncomment next two line 2 to create paraview files
198  HG.setParticlesWriteVTK(true);
199  HG.setWallsWriteVTK(FileType::ONE_FILE);
200 
201  HG.solve(argc, argv);
202  return 0;
203 }

References HourGlass::contractionHeight, HourGlass::contractionWidth, BaseHandler< T >::copyAndAddObject(), mathsFunc::cubic(), INFO, logger, HourGlass::maxParticleRadius, HourGlass::minParticleRadius, HourGlass::N, constants::pi, DPMBase::setGravity(), DPMBase::setName(), DPMBase::setParticlesWriteVTK(), DPMBase::setSaveCount(), DPMBase::setTimeMax(), DPMBase::setTimeStep(), DPMBase::setWallsWriteVTK(), DPMBase::setXBallsAdditionalArguments(), DPMBase::setXMax(), DPMBase::setXMin(), DPMBase::setYMax(), DPMBase::setYMin(), DPMBase::setZMax(), DPMBase::setZMin(), DPMBase::solve(), and DPMBase::speciesHandler.

HourGlass::contractionHeight
Mdouble contractionHeight
Definition: HourGlass3DDemo.cpp:111
HourGlass::minParticleRadius
Mdouble minParticleRadius
Definition: HourGlass3DDemo.cpp:112
DPMBase::setName
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:420
DPMBase::setTimeStep
void setTimeStep(Mdouble newDt)
Sets a new value for the simulation time step.
Definition: DPMBase.cc:1225
constants::pi
const Mdouble pi
Definition: ExtendedMath.h:45
DPMBase::setParticlesWriteVTK
void setParticlesWriteVTK(bool writeParticlesVTK)
Sets whether particles are written in a VTK file.
Definition: DPMBase.cc:934
logger
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
DPMBase::setYMax
void setYMax(Mdouble newYMax)
Sets the value of YMax, the upper bound of the problem domain in the y-direction.
Definition: DPMBase.cc:1182
INFO
LL< Log::INFO > INFO
Info log level.
Definition: Logger.cc:55
DPMBase::setWallsWriteVTK
void setWallsWriteVTK(FileType writeWallsVTK)
Sets whether walls are written into a VTK file.
Definition: DPMBase.cc:908
Vec3D
Definition: Vector.h:50
DPMBase::solve
void solve()
The work horse of the code.
Definition: DPMBase.cc:4003
DPMBase::setZMax
void setZMax(Mdouble newZMax)
Sets the value of ZMax, the upper bound of the problem domain in the z-direction.
Definition: DPMBase.cc:1208
Mdouble
double Mdouble
Definition: GeneralDefine.h:34
Species
Contains material and contact force properties.
Definition: Species.h:35
DPMBase::setXMax
void setXMax(Mdouble newXMax)
Sets the value of XMax, the upper bound of the problem domain in the x-direction.
Definition: DPMBase.cc:1156
DPMBase::speciesHandler
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. LinearViscoelasticSpecies, etc.
Definition: DPMBase.h:1385
HourGlass::N
unsigned int N
Definition: HourGlass3DDemo.cpp:114
DPMBase::setTimeMax
void setTimeMax(Mdouble newTMax)
Sets a new value for the maximum simulation duration.
Definition: DPMBase.cc:870
DPMBase::setGravity
void setGravity(Vec3D newGravity)
Sets a new value for the gravitational acceleration.
Definition: DPMBase.cc:1374
HourGlass::maxParticleRadius
Mdouble maxParticleRadius
Definition: HourGlass3DDemo.cpp:113
DPMBase::setYMin
void setYMin(Mdouble newYMin)
Sets the value of YMin, the lower bound of the problem domain in the y-direction.
Definition: DPMBase.cc:1025
BaseHandler::copyAndAddObject
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:379
DPMBase::setXBallsAdditionalArguments
void setXBallsAdditionalArguments(std::string newXBArgs)
Set the additional arguments for xballs.
Definition: DPMBase.cc:1338
DPMBase::setXMin
void setXMin(Mdouble newXMin)
Sets the value of XMin, the lower bound of the problem domain in the x-direction.
Definition: DPMBase.cc:1001
DPMBase::setSaveCount
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_ for all files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:406
HourGlass::contractionWidth
Mdouble contractionWidth
Definition: HourGlass3DDemo.cpp:110
mathsFunc::cubic
T cubic(const T val)
calculates the cube of a number
Definition: ExtendedMath.h:115
HourGlass
Definition: HourGlass3DDemo.cpp:39
DPMBase::setZMin
void setZMin(Mdouble newZMin)
Sets the value of ZMin, the lower bound of the problem domain in the z-direction.
Definition: DPMBase.cc:1049