ConstantRestitutionSelfTest.cpp File Reference

Classes

struct  ConstantRestitutionSelfTest
 

Functions

int main ()
 

Function Documentation

◆ main()

int main ( )
42 {
44  dpm.setName("ConstantRestitutionSelfTest");
45  dpm.setSaveCount(2);
46 
48  species->setDensity(1000);
49  species->setConstantRestitution(true);
50  Mdouble radius = 2.5e-3;
51  const Mdouble stiffness = 24067/species->getMassFromRadius(radius);
52  //species->setPlasticParameters(0.2*stiffness, stiffness, 0.873*stiffness, 0.05);
53  species->setPlasticParameters(stiffness, stiffness, 0.0, 0.05);
54  species->setRestitutionCoefficient(0.45, 1.0);
55  dpm.setTimeStep(0.02*species->getCollisionTime(1.0));
56  dpm.setTimeMax(60.0*dpm.getTimeStep());
57 
58  radius = 1e-4;
59  Mdouble relativeVelocity = 1;
60 
61  SphericalParticle particle;
62  particle.setSpecies(species);
63  particle.setRadius(radius);
64  particle.setPosition(Vec3D(-radius,0,0));
65  particle.setVelocity(Vec3D(0.5*relativeVelocity,0,0));
66  auto particle1 = dpm.particleHandler.copyAndAddObject(particle);
67 
68  particle.setPosition(-particle.getPosition());
69  particle.setVelocity(-particle.getVelocity());
70  auto particle2 = dpm.particleHandler.copyAndAddObject(particle);
71 
72  dpm.setDomain(radius*Vec3D(-2,-1,-1),radius*Vec3D(2,1,1));
73 
74  dpm.solve();
75 
76  //Values that are now independent of the particle radius
77  logger(INFO,"Max. Overlap %",dpm.maxOverlap);
78  logger(INFO,"Collision time %",dpm.collisionTime);
79  logger(INFO,"Restitution %",particle2->getVelocity().X/relativeVelocity);
80  return 0;
81 }
double Mdouble
Definition: GeneralDefine.h:34
Species< LinearPlasticViscoelasticNormalSpecies > LinearPlasticViscoelasticSpecies
Definition: LinearPlasticViscoelasticSpecies.h:33
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.
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
virtual const Vec3D & getVelocity() const
Returns the velocity of this interactable.
Definition: BaseInteractable.cc:329
void setVelocity(const Vec3D &velocity)
set the velocity of the BaseInteractable.
Definition: BaseInteractable.cc:350
virtual void setPosition(const Vec3D &position)
Sets the position of this BaseInteractable.
Definition: BaseInteractable.h:239
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
Definition: BaseInteractable.h:218
virtual void setRadius(Mdouble radius)
Sets the particle's radius_ (and adjusts the mass_ accordingly, based on the particle's species)
Definition: BaseParticle.cc:553
void setSpecies(const ParticleSpecies *species)
Definition: BaseParticle.cc:818
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_ for all files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:408
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. LinearViscoelasticSpecies, etc.
Definition: DPMBase.h:1427
void setDomain(const Vec3D &min, const Vec3D &max)
Sets the minimum coordinates of the problem domain.
Definition: DPMBase.cc:1098
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:422
Mdouble getTimeStep() const
Returns the simulation time step.
Definition: DPMBase.cc:1250
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created.
Definition: DPMBase.h:1437
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
A spherical particle is the most simple particle used in MercuryDPM.
Definition: SphericalParticle.h:37
Definition: Vector.h:51
Definition: ConstantRestitutionSelfTest.cpp:30
Mdouble maxOverlap
Definition: ConstantRestitutionSelfTest.cpp:38
Mdouble collisionTime
Definition: ConstantRestitutionSelfTest.cpp:37

References ConstantRestitutionSelfTest::collisionTime, BaseHandler< T >::copyAndAddObject(), BaseInteractable::getPosition(), DPMBase::getTimeStep(), BaseInteractable::getVelocity(), INFO, logger, ConstantRestitutionSelfTest::maxOverlap, DPMBase::particleHandler, DPMBase::setDomain(), DPMBase::setName(), BaseInteractable::setPosition(), BaseParticle::setRadius(), DPMBase::setSaveCount(), BaseParticle::setSpecies(), DPMBase::setTimeMax(), DPMBase::setTimeStep(), BaseInteractable::setVelocity(), DPMBase::solve(), and DPMBase::speciesHandler.