LevelSetUnitTest.cpp File Reference

Functions

int main ()
 

Function Documentation

◆ main()

int main ( )
30  {
31 
32  DPMBase dpm;
33  dpm.setName("LevelSetUnitTest");
34  dpm.removeOldFiles();
36  Mdouble r = 0.04;
38  logger(INFO,"k % gam %",s->getStiffness(),s->getDissipation());
40  //w->setPosition({0,0,0}); //change this to check the transation properties
41  w->setVelocity(Vec3D(-1,-1,0)*0.01);
42  w->setAngularVelocity(Vec3D(0,0,1)*-0.05);
43  dpm.wallHandler.copyAndAddObject(InfiniteWall({-1,0,0},{-1,0,0},s));
44  dpm.wallHandler.copyAndAddObject(InfiniteWall({ 1,0,0},{ 0,0,0},s));
45  dpm.wallHandler.copyAndAddObject(InfiniteWall({0,-1,0},{0,-1,0},s));
46  dpm.wallHandler.copyAndAddObject(InfiniteWall({0, 1,0},{0, 0,0},s));
47  dpm.wallHandler.copyAndAddObject(InfiniteWall({0,0,-1},{0,0,-r},s));
48  dpm.wallHandler.copyAndAddObject(InfiniteWall({0,0, 1},{0,0, r},s));
49  for (unsigned i=1; i<dpm.wallHandler.getNumberOfObjects(); ++i) {
51  }
52  dpm.setTimeMax(20);
53  dpm.setTimeStep(0.01);
54  dpm.setDomain({-1,-1,-1},{1,1,1});
55  dpm.setGravity(Vec3D(1,1,0)*0.5*s->getStiffness());
56  SphericalParticle p(s);
57  Mdouble d;
58  Vec3D n;
59  p.setRadius(r);
60  for (Mdouble x=-1+r; x<=0; x+=2*r)
61  for (Mdouble y=-1+r; y<=0; y+=2*r)
62  for (Mdouble z=0; z<=0; z+=2*r) {
63  p.setPosition({x,y,z});
64  if (!w->getDistanceAndNormal(p,d,n)) {
66  }
67  }
68  logger(INFO,"#particles %",dpm.particleHandler.getNumberOfObjects());
70  dpm.setParticlesWriteVTK(true);
71  dpm.solve();
72  w->writeToFile(10,0.0);
73  return 0;
74 }
const unsigned n
Definition: CG3DPackingUnitTest.cpp:32
@ MULTIPLE_FILES
each time-step will be written into/read from separate files numbered consecutively: name_....
double Mdouble
Definition: GeneralDefine.h:34
Species< LinearViscoelasticNormalSpecies > LinearViscoelasticSpecies
Definition: LinearViscoelasticSpecies.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.
virtual unsigned int getNumberOfObjects() const
Gets the number of real Object in this BaseHandler. (i.e. no mpi or periodic particles)
Definition: BaseHandler.h:648
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
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:613
void setAngularVelocity(const Vec3D &angularVelocity)
set the angular velocity of the BaseInteractble.
Definition: BaseInteractable.cc:360
void setVelocity(const Vec3D &velocity)
set the velocity of the BaseInteractable.
Definition: BaseInteractable.cc:350
void setVTKVisibility(bool vtkVisibility)
Definition: BaseWall.cc:548
The DPMBase header includes quite a few header files, defining all the handlers, which are essential....
Definition: DPMBase.h:77
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. LinearViscoelasticSpecies, etc.
Definition: DPMBase.h:1427
void removeOldFiles() const
Definition: DPMBase.cc:4422
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
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
Definition: DPMBase.h:1447
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created.
Definition: DPMBase.h:1437
void setParticlesWriteVTK(bool writeParticlesVTK)
Sets whether particles are written in a VTK file.
Definition: DPMBase.cc:942
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
void setGravity(Vec3D newGravity)
Sets a new value for the gravitational acceleration.
Definition: DPMBase.cc:1383
A infinite wall fills the half-space {point: (position_-point)*normal_<=0}.
Definition: InfiniteWall.h:48
A infinite wall fills the half-space {point: (position_-point)*normal_<=0}.
Definition: LevelSetWall.h:48
bool getDistanceAndNormal(const BaseParticle &p, Mdouble &distance, Vec3D &normal_return) const override
Definition: LevelSetWall.cc:104
void writeToFile(int n, double radiusContact) const
Definition: LevelSetWall.cc:261
Mdouble getStiffness() const
Allows the spring constant to be accessed.
Definition: LinearViscoelasticNormalSpecies.cc:104
void setCollisionTimeAndRestitutionCoefficient(Mdouble tc, Mdouble eps, BaseParticle *p)
Sets k, disp such that it matches a given tc and eps for a collision of two copies of particle p.
Definition: LinearViscoelasticNormalSpecies.cc:212
Mdouble getDissipation() const
Allows the normal dissipation to be accessed.
Definition: LinearViscoelasticNormalSpecies.cc:130
unsigned int getNumberOfObjects() const override
Returns the number of objects in the container. In parallel code this practice is forbidden to avoid ...
Definition: ParticleHandler.cc:1325
Mdouble getMassFromRadius(Mdouble radius) const
Definition: ParticleSpecies.cc:123
A spherical particle is the most simple particle used in MercuryDPM.
Definition: SphericalParticle.h:37
Definition: Vector.h:51
void setWriteVTK(FileType)
Sets whether walls are written into a VTK file.
Definition: WallHandler.cc:467
const std::complex< Mdouble > i
Definition: ExtendedMath.h:51

References BaseHandler< T >::copyAndAddObject(), LevelSetWall::Diamond, LinearViscoelasticNormalSpecies::getDissipation(), LevelSetWall::getDistanceAndNormal(), ParticleSpecies::getMassFromRadius(), BaseHandler< T >::getNumberOfObjects(), ParticleHandler::getNumberOfObjects(), BaseHandler< T >::getObject(), LinearViscoelasticNormalSpecies::getStiffness(), constants::i, INFO, logger, MULTIPLE_FILES, n, DPMBase::particleHandler, DPMBase::removeOldFiles(), BaseInteractable::setAngularVelocity(), LinearViscoelasticNormalSpecies::setCollisionTimeAndRestitutionCoefficient(), DPMBase::setDomain(), DPMBase::setGravity(), DPMBase::setName(), DPMBase::setParticlesWriteVTK(), BaseInteractable::setPosition(), BaseParticle::setRadius(), DPMBase::setTimeMax(), DPMBase::setTimeStep(), BaseInteractable::setVelocity(), BaseWall::setVTKVisibility(), WallHandler::setWriteVTK(), DPMBase::solve(), DPMBase::speciesHandler, DPMBase::wallHandler, and LevelSetWall::writeToFile().