ScrewUnitTest.cpp File Reference

Functions

int main ()
 

Function Documentation

◆ main()

int main ( )

Testing if screw geometry is implemented well

12 {
13  Mercury3D dpm;
14 
16  species.setDensity(1);
17  species.setStiffness(1);
18  auto s = dpm.speciesHandler.copyAndAddObject(species);
19 
20  Screw screw({0,0,0}, 1, 1, 1, 0, .1, ScrewType::singleHelix);
21  screw.setSpecies(s);
22  auto w = dpm.wallHandler.copyAndAddObject(screw);
23 
24  dpm.setDomain({-0.2,-1,-1},{1.2,1,1});
25  dpm.setTimeStep(1e-12);
26  dpm.setTimeMax(dpm.getTimeStep());
27  dpm.setName("ScrewUnitTest");
28  dpm.setParticlesWriteVTK(true);
29  dpm.wallHandler.setWriteVTK(true);
30 
31  Mdouble h = 0.05;
32  Mdouble distance;
33  Vec3D normal;
34  SphericalParticle particle(s);
35  particle.setRadius(0.5*h);
36  for (Mdouble x = dpm.getXMin(); x<dpm.getXMax(); x+=h) {
37  for (Mdouble y = dpm.getYMin(); y<dpm.getYMax(); y+=h) {
38  for (Mdouble z = dpm.getZMin(); z<dpm.getZMax(); z+=h)
39  {
40  particle.setPosition({x, y, z});
41  if (w->getDistanceAndNormal(particle,distance,normal))
42  {
43  dpm.particleHandler.copyAndAddObject(particle);
44  //logger(INFO,"p %",particle.getPosition());
45  }
46  }
47  }
48  }
49  logger(INFO,"Inserted % particles",dpm.particleHandler.getSize());
50 
51  //dpm.solve();
52  helpers::check(dpm.particleHandler.getSize(),8213,0,"Screw surface was wrongly detected");
53 
54  return 0;
55 }
Array< double, 1, 3 > e(1./3., 0.5, 2.)
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
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
unsigned int getSize() const
Gets the size of the particleHandler (including mpi and periodic particles)
Definition: BaseHandler.h:663
void setSpecies(const ParticleSpecies *species)
Defines the species of the current wall.
Definition: BaseWall.cc:148
Mdouble getXMin() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMin() returns XMin.
Definition: DPMBase.h:603
Mdouble getXMax() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMax() returns XMax.
Definition: DPMBase.h:610
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. LinearViscoelasticSpecies, etc.
Definition: DPMBase.h:1433
void setDomain(const Vec3D &min, const Vec3D &max)
Sets the minimum coordinates of the problem domain.
Definition: DPMBase.cc:1089
Mdouble getYMin() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMin() returns YMin.
Definition: DPMBase.h:616
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:400
Mdouble getTimeStep() const
Returns the simulation time step.
Definition: DPMBase.cc:1241
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
Mdouble getYMax() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMax() returns XMax.
Definition: DPMBase.h:622
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
Mdouble getZMax() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMax() returns ZMax.
Definition: DPMBase.h:634
Mdouble getZMin() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMin() returns ZMin.
Definition: DPMBase.h:628
void setStiffness(Mdouble new_k)
Allows the spring constant to be changed.
Definition: LinearViscoelasticNormalSpecies.cc:72
This adds on the hierarchical grid code for 3D problems.
Definition: Mercury3D.h:16
void setDensity(Mdouble density)
Definition: ParticleSpecies.cc:88
This function defines an Archimedes' screw in the z-direction from a (constant) starting point,...
Definition: Screw.h:23
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
void normal(const Vector< double > &x, Vector< double > &normal)
Definition: free_surface_rotation.cc:65
void check(double real, double ideal, double error, std::string errorMessage)
Definition: TestHelpers.cc:16
list x
Definition: plotDoE.py:28

References helpers::check(), BaseHandler< T >::copyAndAddObject(), e(), BaseHandler< T >::getSize(), DPMBase::getTimeStep(), DPMBase::getXMax(), DPMBase::getXMin(), DPMBase::getYMax(), DPMBase::getYMin(), DPMBase::getZMax(), DPMBase::getZMin(), INFO, logger, WallFunction::normal(), DPMBase::particleHandler, s, ParticleSpecies::setDensity(), DPMBase::setDomain(), DPMBase::setName(), DPMBase::setParticlesWriteVTK(), BaseInteractable::setPosition(), BaseParticle::setRadius(), BaseWall::setSpecies(), LinearViscoelasticNormalSpecies::setStiffness(), DPMBase::setTimeMax(), DPMBase::setTimeStep(), WallHandler::setWriteVTK(), singleHelix, DPMBase::speciesHandler, w, DPMBase::wallHandler, plotDoE::x, and y.