GranularCollapseDemo.cpp File Reference
#include <iostream>
#include "Mercury3D.h"
#include "Species/HertzianViscoelasticMindlinSpecies.h"
#include "Walls/InfiniteWall.h"

Classes

class  GranularCollapse
 

Functions

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

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)
133 {
134  GranularCollapse problem;
135  problem.setName("granular_collapse_sqellipsoids");
136  logger(INFO, "Modified from 'MercurySimpleDemos/InsertionBoundarySelfTest.cpp'");
137 
138  // [GranularCollapse : particle properties]
139  problem.species->setDensity(950); // 2000;
140 
141  double input1 = 50; //1000; // 500; 1000; 15500;
142  double input2 = 1.5; // magnifying scale (geq 1)
143  if (argc > 1)
144  {
145  input1 = atof(argv[1]);
146  input2 = atof(argv[2]);
147  }
148  problem.nMax = input1;
149  problem.radScale = input2;
150  logger(INFO, "Number of particles = %\n"
151  "Half-length scale = %", problem.nMax, problem.radScale);
152 
153  problem.radMax = 5.e-3; //1.e-3; 4.5e-3; 4.e-3
154  problem.radMin = problem.radMax / problem.radScale / std::sqrt(problem.radScale);
155  // [GranularCollapse : particle properties]
156 
157  // [GranularCollapse : contact properties]
158  problem.species->setEffectiveElasticModulusAndRestitutionCoefficient(1.e7, 0.7); //1.e5
159 // //normal forces
160 // problem.species->setStiffness(2e4); //1e5; 2e4; 8e3; 1e4
161 // problem.species->setDissipation(0.5); //0.5; 0.25; 0.3; dissipation <= sqrt(2*stiffness*MinParticleMass) to avoid overdamping
162 // //tangential forces : sliding
163 // problem.species->setSlidingFrictionCoefficient(0.5);
164 // problem.species->setSlidingStiffness(problem.species->getStiffness()*0.2);
165 // problem.species->setSlidingDissipation(problem.species->getDissipation()*0.2);
166 // //normal torques : spin
167 // problem.species->setTorsionFrictionCoefficient(problem.species->getSlidingFrictionCoefficient()*0.05);
168 // problem.species->setTorsionStiffness(problem.species->getStiffness()*0.1);
169 // problem.species->setTorsionDissipation(problem.species->getDissipation()*0.05);
170 // //tangential torques : rolling
171 // problem.species->setRollingFrictionCoefficient(problem.species->getSlidingFrictionCoefficient()*0.05);
172 // problem.species->setRollingStiffness(problem.species->getStiffness()*0.1);
173 // problem.species->setRollingDissipation(problem.species->getDissipation()*0.05);
174  // [GranularCollapse : contact properties]
175 
176  // [GranularCollapse : test normal forces]
177  //(from 'MercurySimpleDemos/HourGlass3DDemo.cpp')
178  //Calculates collision time for two copies of a particle of given dissipation_, k, effective mass
179  double MinParticleMass = problem.species->getDensity() * 4. / 3. * constants::pi * mathsFunc::cubic(problem.radMin);
180  logger(INFO, "MinParticleMass = %%3\n", std::scientific, MinParticleMass, Flusher::NO_FLUSH);
181  //Calculates collision time for two copies of a particle of given dissipation_, k, effective mass
182  double tc = problem.species->getCollisionTime(2 * problem.radMin, problem.species->getDensity(), 1.0);
183  logger(INFO, "tc = %%", tc, std::defaultfloat);
184 // //Calculates restitution coefficient for two copies of given dissipation_, k, effective mass
185 // double r = problem.species->getRestitutionCoefficient(MinParticleMass);
186 // std::cout << "r = " << r << std::endl;
187  //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)
188  //std::cout << "vmax=" << helpers::getMaximumVelocity(species->getStiffness(), HGgetSpecies(0)->getDissipation(), HG.MinParticleRadius, MinParticleMass) << std::endl;
189  // [GranularCollapse : test normal forces]
190 
191  // [GranularCollapse : time parameters]
192  problem.setTimeStep(tc / 50); // 1e-4; // (tc / 50);
193  problem.setTimeMax(2.5); //5; //15;
194  problem.openGate = .7 * problem.getTimeMax();
195  problem.setSaveCount(500);
196  // [GranularCollapse : time parameters]
197 
198  // [GranularCollapse : contact detection]
199  problem.setHGridMaxLevels(2);
200  // [GranularCollapse : contact detection]
201 
202  problem.setSuperquadricParticlesWriteVTK(true);
204  problem.solve(); //argc,argv
205  return 0;
206 } // [GranularCollapse : main]
@ ONE_FILE
all data will be written into/ read from a single file called name_
LL< Log::INFO > INFO
Info log level.
Definition: Logger.cc:55
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_ for all files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:408
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:422
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
Definition: DPMBase.h:1447
void setSuperquadricParticlesWriteVTK(bool writeSuperquadricParticlesVTK)
Definition: DPMBase.cc:956
void setTimeStep(Mdouble newDt)
Sets a new value for the simulation time step.
Definition: DPMBase.cc:1234
void setTimeMax(Mdouble newTMax)
Sets a new value for the maximum simulation duration.
Definition: DPMBase.cc:873
void solve()
The work horse of the code.
Definition: DPMBase.cc:4270
Mdouble getTimeMax() const
Returns the maximum simulation duration.
Definition: DPMBase.cc:888
Definition: GranularCollapseDemo.cpp:36
double radScale
Definition: GranularCollapseDemo.cpp:127
double openGate
Definition: GranularCollapseDemo.cpp:127
double radMax
Definition: GranularCollapseDemo.cpp:127
HertzianViscoelasticMindlinSpecies * species
Definition: GranularCollapseDemo.cpp:125
int nMax
Definition: GranularCollapseDemo.cpp:126
double radMin
Definition: GranularCollapseDemo.cpp:127
void setHGridMaxLevels(unsigned int HGridMaxLevels)
Sets the maximum number of levels of the HGrid in this MercuryBase.
Definition: MercuryBase.cc:476
void setDensity(Mdouble density)
Definition: ParticleSpecies.cc:108
Mdouble getDensity() const
Allows density_ to be accessed.
Definition: ParticleSpecies.cc:118
void setWriteVTK(FileType)
Sets whether walls are written into a VTK file.
Definition: WallHandler.cc:467
const Mdouble pi
Definition: ExtendedMath.h:45
T cubic(const T val)
calculates the cube of a number
Definition: ExtendedMath.h:115

References mathsFunc::cubic(), ParticleSpecies::getDensity(), DPMBase::getTimeMax(), INFO, logger, GranularCollapse::nMax, NO_FLUSH, ONE_FILE, GranularCollapse::openGate, constants::pi, GranularCollapse::radMax, GranularCollapse::radMin, GranularCollapse::radScale, ParticleSpecies::setDensity(), MercuryBase::setHGridMaxLevels(), DPMBase::setName(), DPMBase::setSaveCount(), DPMBase::setSuperquadricParticlesWriteVTK(), DPMBase::setTimeMax(), DPMBase::setTimeStep(), WallHandler::setWriteVTK(), DPMBase::solve(), GranularCollapse::species, and DPMBase::wallHandler.