LevelSetUnitTest.cpp File Reference

Functions

int main ()
 

Function Documentation

◆ main()

int main ( )
10  {
11 
12  DPMBase dpm;
13  dpm.setName("LevelSetUnitTest");
14  dpm.removeOldFiles();
16  Mdouble r = 0.04;
17  s->setCollisionTimeAndRestitutionCoefficient(0.5,0.5,s->getMassFromRadius(r));
18  logger(INFO,"k % gam %",s->getStiffness(),s->getDissipation());
20  //w->setPosition({0,0,0}); //change this to check the transation properties
21  w->setVelocity(Vec3D(-1,-1,0)*0.01);
22  w->setAngularVelocity(Vec3D(0,0,1)*-0.05);
23  dpm.wallHandler.copyAndAddObject(InfiniteWall({-1,0,0},{-1,0,0},s));
24  dpm.wallHandler.copyAndAddObject(InfiniteWall({ 1,0,0},{ 0,0,0},s));
25  dpm.wallHandler.copyAndAddObject(InfiniteWall({0,-1,0},{0,-1,0},s));
26  dpm.wallHandler.copyAndAddObject(InfiniteWall({0, 1,0},{0, 0,0},s));
27  dpm.wallHandler.copyAndAddObject(InfiniteWall({0,0,-1},{0,0,-r},s));
28  dpm.wallHandler.copyAndAddObject(InfiniteWall({0,0, 1},{0,0, r},s));
29  for (unsigned i=1; i<dpm.wallHandler.getNumberOfObjects(); ++i) {
31  }
32  dpm.setTimeMax(20);
33  dpm.setTimeStep(0.01);
34  dpm.setDomain({-1,-1,-1},{1,1,1});
35  dpm.setGravity(Vec3D(1,1,0)*0.5*s->getStiffness());
37  Mdouble d;
38  Vec3D n;
39  p.setRadius(r);
40  for (Mdouble x=-1+r; x<=0; x+=2*r)
41  for (Mdouble y=-1+r; y<=0; y+=2*r)
42  for (Mdouble z=0; z<=0; z+=2*r) {
43  p.setPosition({x,y,z});
44  if (!w->getDistanceAndNormal(p,d,n)) {
46  }
47  }
48  logger(INFO,"#particles %",dpm.particleHandler.getNumberOfObjects());
50  dpm.setParticlesWriteVTK(true);
51  dpm.solve();
52  w->writeToFile(10,0.0);
53  return 0;
54 }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
@ MULTIPLE_FILES
each time-step will be written into/read from separate files numbered consecutively: name_....
Species< LinearViscoelasticNormalSpecies > LinearViscoelasticSpecies
Definition: LinearViscoelasticSpecies.h:11
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
RowVector3d w
Definition: Matrix_resize_int.cpp:3
float * p
Definition: Tutorial_Map_using.cpp:9
virtual unsigned int getNumberOfObjects() const
Gets the number of real Object in this BaseHandler. (i.e. no mpi or periodic particles)
Definition: BaseHandler.h:656
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:360
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:621
void setVTKVisibility(bool vtkVisibility)
Definition: BaseWall.cc:500
The DPMBase header includes quite a few header files, defining all the handlers, which are essential....
Definition: DPMBase.h:56
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. LinearViscoelasticSpecies, etc.
Definition: DPMBase.h:1433
void removeOldFiles() const
Definition: DPMBase.cc:4492
void setDomain(const Vec3D &min, const Vec3D &max)
Sets the minimum coordinates of the problem domain.
Definition: DPMBase.cc:1089
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:400
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
Definition: DPMBase.h:1453
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created.
Definition: DPMBase.h:1443
void setParticlesWriteVTK(bool writeParticlesVTK)
Sets whether particles are written in a VTK file.
Definition: DPMBase.cc:933
void setTimeStep(Mdouble newDt)
Sets a new value for the simulation time step.
Definition: DPMBase.cc:1225
void setTimeMax(Mdouble newTMax)
Sets a new value for the maximum simulation duration.
Definition: DPMBase.cc:864
void solve()
The work horse of the code.
Definition: DPMBase.cc:4334
void setGravity(Vec3D newGravity)
Sets a new value for the gravitational acceleration.
Definition: DPMBase.cc:1374
A infinite wall fills the half-space {point: (position_-point)*normal_<=0}.
Definition: InfiniteWall.h:27
A infinite wall fills the half-space {point: (position_-point)*normal_<=0}.
Definition: LevelSetWall.h:27
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:1323
A spherical particle is the most simple particle used in MercuryDPM.
Definition: SphericalParticle.h:16
Definition: Kernel/Math/Vector.h:30
void setWriteVTK(FileType)
Sets whether walls are written into a VTK file.
Definition: WallHandler.cc:445
Scalar * y
Definition: level1_cplx_impl.h:128
RealScalar s
Definition: level1_cplx_impl.h:130
#define INFO(i)
Definition: mumps_solver.h:54
r
Definition: UniformPSDSelfTest.py:20
list x
Definition: plotDoE.py:28

References BaseHandler< T >::copyAndAddObject(), LevelSetWall::Diamond, BaseHandler< T >::getNumberOfObjects(), ParticleHandler::getNumberOfObjects(), BaseHandler< T >::getObject(), i, INFO, logger, MULTIPLE_FILES, n, p, DPMBase::particleHandler, UniformPSDSelfTest::r, DPMBase::removeOldFiles(), s, DPMBase::setDomain(), DPMBase::setGravity(), DPMBase::setName(), DPMBase::setParticlesWriteVTK(), DPMBase::setTimeMax(), DPMBase::setTimeStep(), BaseWall::setVTKVisibility(), WallHandler::setWriteVTK(), DPMBase::solve(), DPMBase::speciesHandler, w, DPMBase::wallHandler, plotDoE::x, and y.