MercuryDPM  0.11
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HourGlass2DDemo.cpp File Reference

Go to the source code of this file.

Classes

class  HourGlass2D
 

Functions

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

Function Documentation

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

Definition at line 106 of file HourGlass2DDemo.cpp.

References HourGlass2D::ContractionHeight, HourGlass2D::ContractionWidth, BaseHandler< T >::copyAndAddObject(), mathsFunc::cubic(), ParticleSpecies::getDensity(), HourGlass2D::MaxParticleRadius, HourGlass2D::MinParticleRadius, HourGlass2D::N, constants::pi, ParticleSpecies::setDensity(), DPMBase::setGravity(), Files::setName(), Files::setSaveCount(), DPMBase::setTimeMax(), DPMBase::setTimeStep(), DPMBase::setXBallsAdditionalArguments(), DPMBase::setXMax(), DPMBase::setXMin(), DPMBase::setYMax(), DPMBase::setYMin(), DPMBase::setZMax(), DPMBase::setZMin(), DPMBase::solve(), and DPMBase::speciesHandler.

107 {
108  std::cout<< "Hourglass Simulation" <<std::endl;
109  // note: this code is based on stefan's implementation, see
110  // /storage2/usr/people/sluding/COMPUTERS/hpc01/sluding/MDCC/MDCLR/DEMO/W7
111  // however, it is scaled to SI units by the scaling factors
112  // d=1e-3, m=1e-6, g=1
113 
114  //all parameters should be set in the main file
115  //here, we use SI units (generally, other, scaled units are possible)
116 
117  //create an instance of the class and name it
118  HourGlass2D HG;
119  HG.setName("HourGlass2D");
121  species->setDensity(2000);
122 
123  //specify geometry
124  //specify dimensions of the hourglass
125  Mdouble Width = 10e-2; // 10cm
126  Mdouble Height = 60e-2; // 60cm
127  //specify how big the wedge of the contraction should be
128  Mdouble ContractionWidth = 2.5e-2; //2.5cm
129  Mdouble ContractionHeight = 5e-2; //5cm
130  //set domain accordingly (domain boundaries are not walls!)
131  HG.setXMin(0.0);
132  HG.setXMax(Width);
133  HG.setYMin(0.0);
134  HG.setYMax(Width);
135  HG.setZMin(0.0);
136  HG.setZMax(Height);
137  //these parameters are needed in setupInitialConditions()
138  HG.ContractionWidth = ContractionWidth;
139  HG.ContractionHeight = ContractionHeight;
140 
141  //specify particle properties
142  species->setDensity(2000.0);
143  //these parameters are needed in setupInitialConditions()
144  HG.MinParticleRadius = 6e-3; // 6mm
145  HG.MaxParticleRadius = 10e-3; //10mm
146 
147  //specify body forces
148  HG.setGravity( Vec3D(0.0, 0.0, -9.8) );
149 
150  //specify contact properties
151  //normal forces
152  species->setStiffness(1e5);
153  species->setDissipation(0.63);
154  //tangential (sliding) forces
155  species->setSlidingFrictionCoefficient(0.5);
156  species->setSlidingStiffness(1.2e4);
157  species->setSlidingDissipation(0.16);
158  //tangential (rolling) torques
159  species->setRollingFrictionCoefficient(0.2);
160  species->setRollingStiffness(1.2e4);
161  species->setRollingDissipation(6.3e-2);
162  //normal (torsion/spin) torques
163  species->setTorsionFrictionCoefficient(0.1);
164  species->setTorsionStiffness(1.2e4);
165  species->setSlidingDissipation(6.3e-2);
166 
167  //test normal forces
168  Mdouble MinParticleMass = species->getDensity()*4.0/3.0*constants::pi*mathsFunc::cubic(HG.MinParticleRadius);
169  //Calculates collision time for two copies of a particle of given dissipation_, k, effective mass
170  std::cout << "MinParticleMass =" << MinParticleMass << std::endl;
171  //Calculates collision time for two copies of a particle of given dissipation_, k, effective mass
172  Mdouble tc = species->getCollisionTime(MinParticleMass);
173  std::cout << "tc =" << tc << std::endl;
174  //Calculates restitution coefficient for two copies of given dissipation_, k, effective mass
175  Mdouble r = species->getRestitutionCoefficient(MinParticleMass);
176  std::cout << "r =" << r << std::endl;
177  //Calculates the maximum relative velocity allowed for a normal collision of two particles of radius r and particle mass m (for higher velocities particles could pass through each other)
178  //std::cout << "vmax=" << helpers::getMaximumVelocity(species->getStiffness(), HGgetSpecies(0)->getDissipation(), HG.MinParticleRadius, MinParticleMass) << std::endl;
179 
180  //set other simulation parameters
181  HG.setTimeStep(tc / 50.0);
182  HG.setTimeMax(3.0);
183  HG.setSaveCount(500);
184  HG.setXBallsAdditionalArguments("-v0 -solidf");
185  HG.N=100; //number of particles
186  std::cout << "N =" << HG.N << std::endl;
187 
188  HG.solve(argc, argv);
189  return 0;
190 }
void setXMax(Mdouble newXMax)
If the length of the problem domain in x-direction is XMax - XMin, this method sets XMax...
Definition: DPMBase.cc:309
unsigned int N
void solve()
The work horse of the code.
Definition: DPMBase.cc:1895
void setTimeMax(Mdouble newTMax)
Allows the upper time limit to be changed.
Definition: DPMBase.cc:179
Mdouble MinParticleRadius
void setYMin(Mdouble newYMin)
If the length of the problem domain in y-direction is YMax - YMin, this method sets YMin...
Definition: DPMBase.cc:280
double Mdouble
void setZMax(Mdouble newZMax)
If the length of the problem domain in z-direction is XMax - XMin, this method sets ZMax...
Definition: DPMBase.cc:338
Species< LinearViscoelasticNormalSpecies, FrictionSpecies > LinearViscoelasticFrictionSpecies
void setGravity(Vec3D newGravity)
Allows to modify the gravity vector.
Definition: DPMBase.cc:431
void setYMax(Mdouble newYMax)
If the length of the problem domain in y-direction is YMax - YMin, this method sets YMax...
Definition: DPMBase.cc:324
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: Files.cc:149
U * copyAndAddObject(const U &O)
Creates a copy of a Object and adds it to the BaseHandler.
Definition: BaseHandler.h:268
const Mdouble pi
Definition: ExtendedMath.h:42
void setXMin(Mdouble newXMin)
If the length of the problem domain in x-direction is XMax - XMin, this method sets XMin...
Definition: DPMBase.cc:266
void setDensity(Mdouble density)
Allows the density to be changed.
T cubic(T val)
calculates the cube of a number
Definition: ExtendedMath.h:99
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_ for all files (ene, data, fstat, restart, stat)
Definition: Files.cc:138
void setZMin(Mdouble newZMin)
If the length of the problem domain in z-direction is ZMax - ZMin, this method sets ZMin...
Definition: DPMBase.cc:295
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. elastic, linear visco-elastic... et cetera...
Definition: DPMBase.h:868
Mdouble ContractionWidth
void setXBallsAdditionalArguments(std::string newXBArgs)
Set the additional arguments for xballs.
Definition: DPMBase.cc:403
void setTimeStep(Mdouble newDt)
Allows the time step dt to be changed.
Definition: DPMBase.cc:353
Mdouble MaxParticleRadius
Mdouble getDensity() const
Allows the density to be accessed.
Contains material and contact force properties.
Definition: Interaction.h:35
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:45
Mdouble ContractionHeight