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

Go to the source code of this file.

Classes

class  HourGlass
 

Functions

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

Function Documentation

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

Definition at line 93 of file HourGlass3DDemo.cpp.

References HourGlass::ContractionHeight, HourGlass::ContractionWidth, BaseHandler< T >::copyAndAddObject(), mathsFunc::cubic(), HourGlass::MaxParticleRadius, HourGlass::MinParticleRadius, HourGlass::N, constants::pi, 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.

94 {
95  std::cout<< "Hourglass Simulation" <<std::endl;
96  // note: this code is based on stefan's implementation, see
97  // /storage2/usr/people/sluding/COMPUTERS/hpc01/sluding/MDCC/MDCLR/DEMO/W7
98  // however, it is scaled to SI units by the scaling factors
99  // d=1e-3, m=1e-6, g=1
100 
101  //all parameters should be set in the main file
102  //here, we use SI units (generally, other, scaled units are possible)
103 
104  //create an instance of the class and name it
105  HourGlass HG;
106  HG.setName("HourGlass");
108  species->setDensity(2000);
109 
110  //specify geometry
111  //specify dimensions of the hourglass
112  Mdouble Width = 10e-2; // 10cm
113  Mdouble Height = 60e-2; // 60cm
114  //specify how big the wedge of the contraction should be
115  Mdouble ContractionWidth = 2.5e-2; //2.5cm
116  Mdouble ContractionHeight = 5e-2; //5cm
117  //set domain accordingly (domain boundaries are not walls!)
118  HG.setXMin(0.0);
119  HG.setXMax(Width);
120  HG.setYMin(0.0);
121  HG.setYMax(Width);
122  HG.setZMin(0.0);
123  HG.setZMax(Height);
124  //these parameters are needed in setupInitialConditions()
125  HG.ContractionWidth = ContractionWidth;
126  HG.ContractionHeight = ContractionHeight;
127 
128  //specify particle properties
129  species->setDensity(2000.0);
130  //these parameters are needed in setupInitialConditions()
131  HG.MinParticleRadius = 6e-3; // 6mm
132  HG.MaxParticleRadius = 10e-3; //10mm
133 
134  //specify body forces
135  HG.setGravity( Vec3D(0.0, 0.0, -9.8) );
136 
137  //specify contact properties
138  //normal forces
139  species->setStiffness(1e5);
140  species->setDissipation(0.63);
141  //tangential (sliding) forces
142  species->setSlidingFrictionCoefficient(0.5);
143  species->setSlidingStiffness(1.2e4);
144  species->setSlidingDissipation(0.16);
145  //tangential (rolling) torques
146  species->setRollingFrictionCoefficient(0.2);
147  species->setRollingStiffness(1.2e4);
148  species->setRollingDissipation(6.3e-2);
149  //normal (torsion/spin) torques
150  species->setTorsionFrictionCoefficient(0.1);
151  species->setTorsionStiffness(1.2e4);
152  species->setSlidingDissipation(6.3e-2);
153 
154  //test normal forces
155  Mdouble MinParticleMass = species->getDensity()*4.0/3.0*constants::pi*mathsFunc::cubic(HG.MinParticleRadius);
156  //Calculates collision time for two copies of a particle of given dissipation_, k, effective mass
157  std::cout << "MinParticleMass =" << MinParticleMass << std::endl;
158  //Calculates collision time for two copies of a particle of given dissipation_, k, effective mass
159  Mdouble tc = species->getCollisionTime(MinParticleMass);
160  std::cout << "tc =" << tc << std::endl;
161  //Calculates restitution coefficient for two copies of given dissipation_, k, effective mass
162  Mdouble r = species->getRestitutionCoefficient(MinParticleMass);
163  std::cout << "r =" << r << std::endl;
164  //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)
165  //std::cout << "vmax=" << helpers::getMaximumVelocity(species->getStiffness(), HGgetSpecies(0)->getDissipation(), HG.MinParticleRadius, MinParticleMass) << std::endl;
166 
167  //set other simulation parameters
168  HG.setTimeStep(tc / 50.0);
169  HG.setTimeMax(10.0);
170  HG.setSaveCount(500);
171  HG.setXBallsAdditionalArguments("-v0 -solidf");
172  HG.N=600; //number of particles
173 
174  HG.solve(argc, argv);
175  return 0;
176 }
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
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 ContractionWidth
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
Mdouble MinParticleRadius
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
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
void setXBallsAdditionalArguments(std::string newXBArgs)
Set the additional arguments for xballs.
Definition: DPMBase.cc:403
Mdouble MaxParticleRadius
void setTimeStep(Mdouble newDt)
Allows the time step dt to be changed.
Definition: DPMBase.cc:353
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:45
unsigned int N
Mdouble ContractionHeight