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.

20 {
21  //define quarter circle as nurbs surface
22  std::vector<double> knotsU = {0,0,0,1,1,1};
23  std::vector<double> knotsV = {0,0,1,1};
24  std::vector<std::vector<Vec3D>> controlPoints = {{{1,0,0},{1,0,2}},{{1,1,0},{1,1,2}},{{0,1,0},{0,1,2}}};
25  std::vector<std::vector<Mdouble>> weights = {{1,1},{1,1},{2,2}};
26  NurbsSurface nurbsSurface(knotsU,knotsV,controlPoints,weights);
27  //nurbsSurface.flipOrientation();
28 
29  //create a basic dpm class
30  DPMBase dpm;
31  dpm.setName("NurbsWallSelfTest");
32  dpm.setGravity({0,0,-1});
34  s->setCollisionTimeAndRestitutionCoefficient(.05,.1,s->getMassFromRadius(0.1));
35 
36  //define nurbs wall and add to dpm class
37  NurbsWall nurbsWall;
38  nurbsWall.setSpecies(s);
39  nurbsWall.set(nurbsSurface);
40  nurbsWall.setOrientationViaNormal({0,0,1});
41  nurbsWall.setPosition({1,0,0});
42  dpm.wallHandler.copyAndAddObject(nurbsWall);
43 
44  InfiniteWall infiniteWall;
45  infiniteWall.setSpecies(s);
46  infiniteWall.set({0,1,0},{1,1,1});
47  dpm.wallHandler.copyAndAddObject(infiniteWall);
48 
49  SphericalParticle particle;
50  particle.setSpecies(s);
51  particle.setRadius(.1);
52  for (double x=0; x<=0; x+=.2) {
53  for (double y = .1; y <= .9; y += .2) {
54  for (double z = 1.1; z <= 1.1; z += .2) {
55  particle.setPosition({x, y, z});
56  dpm.particleHandler.copyAndAddObject(particle);
57  }
58  }
59  }
60 
62  dpm.setParticlesWriteVTK(true);
63  dpm.setTimeStep(0.001);
64  dpm.setTimeMax(2.0);
65  dpm.setSaveCount(100);
66  dpm.setDomain({-1,0,0},{1,1,1});
67  dpm.solve();
68 
69  return 0;
70 }
@ ONE_FILE
all data will be written into/ read from a single file called name_
Species< LinearViscoelasticNormalSpecies > LinearViscoelasticSpecies
Definition: LinearViscoelasticSpecies.h:11
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
void setOrientationViaNormal(Vec3D normal)
Sets the orientation of this BaseInteractable by defining the vector that results from the rotation o...
Definition: BaseInteractable.cc:177
virtual void setPosition(const Vec3D &position)
Sets 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:548
virtual void setSpecies(const ParticleSpecies *species)
Definition: BaseParticle.cc:798
void setSpecies(const ParticleSpecies *species)
Defines the species of the current wall.
Definition: BaseWall.cc:148
The DPMBase header includes quite a few header files, defining all the handlers, which are essential....
Definition: DPMBase.h:56
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_ for all files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:386
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
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
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:97
Definition: NurbsSurface.h:13
This function defines a wall via a NurbsSurface.
Definition: NurbsWall.h:16
void set(const NurbsSurface &nurbsSurface)
Defines a wall, given a NurbsSurface.
Definition: NurbsWall.cc:48
A spherical particle is the most simple particle used in MercuryDPM.
Definition: SphericalParticle.h:16
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
list weights
Definition: calibrate.py:94
list x
Definition: plotDoE.py:28

References BaseHandler< T >::copyAndAddObject(), ONE_FILE, DPMBase::particleHandler, s, 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, DPMBase::wallHandler, calibrate::weights, plotDoE::x, and y.