NurbsWallSelfTest.cpp File Reference

Functions

int main ()
 

Function Documentation

◆ main()

int main ( )

Tests if contact with nurbs surface is correctly implemented. The setup consists of five particles and two walls, on of which is a NurbsWall. The particles fall downwards by gravity, filling the space between the two walls.

41 {
42  //define quarter circle as nurbs surface
43  std::vector<double> knotsU = {0,0,0,1,1,1};
44  std::vector<double> knotsV = {0,0,1,1};
45  std::vector<std::vector<Vec3D>> controlPoints = {{{1,0,0},{1,0,2}},{{1,1,0},{1,1,2}},{{0,1,0},{0,1,2}}};
46  std::vector<std::vector<Mdouble>> weights = {{1,1},{1,1},{2,2}};
47  NurbsSurface nurbsSurface(knotsU,knotsV,controlPoints,weights);
48  //nurbsSurface.flipOrientation();
49 
50  //create a basic dpm class
51  DPMBase dpm;
52  dpm.setName("NurbsWallSelfTest");
53  dpm.setGravity({0,0,-1});
55  s->setCollisionTimeAndRestitutionCoefficient(.05,.1,s->getMassFromRadius(0.1));
56 
57  //define nurbs wall and add to dpm class
58  NurbsWall nurbsWall;
59  nurbsWall.setSpecies(s);
60  nurbsWall.set(nurbsSurface);
61  nurbsWall.setOrientationViaNormal({0,0,1});
62  nurbsWall.setPosition({1,0,0});
63  dpm.wallHandler.copyAndAddObject(nurbsWall);
64 
65  InfiniteWall infiniteWall;
66  infiniteWall.setSpecies(s);
67  infiniteWall.set({0,1,0},{1,1,1});
68  dpm.wallHandler.copyAndAddObject(infiniteWall);
69 
70  SphericalParticle particle;
71  particle.setSpecies(s);
72  particle.setRadius(.1);
73  for (double x=0; x<=0; x+=.2) {
74  for (double y = .1; y <= .9; y += .2) {
75  for (double z = 1.1; z <= 1.1; z += .2) {
76  particle.setPosition({x, y, z});
77  dpm.particleHandler.copyAndAddObject(particle);
78  }
79  }
80  }
81 
83  dpm.setParticlesWriteVTK(true);
84  dpm.setTimeStep(0.001);
85  dpm.setTimeMax(2.0);
86  dpm.setSaveCount(100);
87  dpm.setDomain({-1,0,0},{1,1,1});
88  dpm.solve();
89 
90  return 0;
91 }
@ ONE_FILE
all data will be written into/ read from a single file called name_
Species< LinearViscoelasticNormalSpecies > LinearViscoelasticSpecies
Definition: LinearViscoelasticSpecies.h:33
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
void setOrientationViaNormal(Vec3D normal)
Sets the orientation of this BaseInteractable by defining the vector that results from the rotation o...
Definition: BaseInteractable.cc:199
virtual void setPosition(const Vec3D &position)
Sets the position of this BaseInteractable.
Definition: BaseInteractable.h:239
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 setSpecies(const ParticleSpecies *species)
Defines the species of the current wall.
Definition: BaseWall.cc:169
The DPMBase header includes quite a few header files, defining all the handlers, which are essential....
Definition: DPMBase.h:77
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
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
void set(Vec3D normal, Vec3D point)
Defines a standard wall, given an outward normal vector s.t. normal*x=normal*point for all x of the w...
Definition: InfiniteWall.cc:118
Definition: NurbsSurface.h:34
This function defines a wall via a NurbsSurface.
Definition: NurbsWall.h:37
void set(const NurbsSurface &nurbsSurface)
Defines a wall, given a NurbsSurface.
Definition: NurbsWall.cc:69
A spherical particle is the most simple particle used in MercuryDPM.
Definition: SphericalParticle.h:37
void setWriteVTK(FileType)
Sets whether walls are written into a VTK file.
Definition: WallHandler.cc:467

References BaseHandler< T >::copyAndAddObject(), ONE_FILE, DPMBase::particleHandler, NurbsWall::set(), InfiniteWall::set(), DPMBase::setDomain(), DPMBase::setGravity(), DPMBase::setName(), BaseInteractable::setOrientationViaNormal(), DPMBase::setParticlesWriteVTK(), BaseInteractable::setPosition(), BaseParticle::setRadius(), DPMBase::setSaveCount(), BaseParticle::setSpecies(), BaseWall::setSpecies(), DPMBase::setTimeMax(), DPMBase::setTimeStep(), WallHandler::setWriteVTK(), DPMBase::solve(), DPMBase::speciesHandler, and DPMBase::wallHandler.