QuaternionWallUnitTest.cpp File Reference

Classes

class  QuaternionWallUnitTest
 

Functions

int main ()
 

Function Documentation

◆ main()

int main ( )
Todo:
why do we need to set the position?
64  {
65 
66  //setup problem
68  q.setName("QuaternionWallUnitTest");
69  q.setMin(-6,-6,-6);
70  q.setMax(6,6,6);
71  q.setDimension(3);
72  q.setGravity(Vec3D(0,0,0));
73 
74  //set time parameters
75  q.setTimeStep(0.01);
76  q.setTimeMax(20*pi);
77  q.setSaveCount(100);
78 
79  //set species
81  s->setDensity(6/pi);
82  s->setCollisionTimeAndNormalAndTangentialRestitutionCoefficient(1,0.5,0.5,1);
83  s->setBondForceMax(.5);
84  s->setSlidingFrictionCoefficient(0.5);
85  s->setRollingStiffness(.2*s->getStiffness());
86  s->setRollingDissipation(.2*s->getDissipation());
87  s->setRollingFrictionCoefficient(0.2);
88 
89  Mdouble angularVelocity = 0.025;
90 
91  logger(INFO, "Create cylindrical wall rotating around its axis");
92  {
93  Vec3D position = Vec3D(1.5, 0, 1.5); //position in top right corner
94 
95  //Create wall
97  w.setSpecies(s);
98  w.setPosition(position);
99  w.setAxis(Vec3D(0, 1, 0));
100  w.addObject(Vec3D(-1, 0, 0), Vec3D(.5, 0, 0));
101  w.addObject(Vec3D(0, 0, 1), Vec3D(0, 0, -1));
102  w.addObject(Vec3D(0, 0, -1), Vec3D(0, 0, 1));
103  w.setAngularVelocity(angularVelocity*Vec3D(0, 1, 0));
105 
106  //Create particle
107  SphericalParticle p(s);
108  p.setRadius(0.50001);
109  p.setVelocity(Vec3D(0, 0, 0));
110  p.setPosition(position + Vec3D(0, 0, 1));
112  p.setPosition(position + Vec3D(0, 0, -1));
114  p.setPosition(position + Vec3D(1, 0, 0));
116  p.setPosition(position + Vec3D(-1, 0, 0));
118  }
119 
120  logger(INFO, "Create cubic wall rotating around its axis");
121  {
122  Vec3D position = Vec3D(-1.5, 0, -1.5); //bottom left corner
123 
124  //Create wall
126  w.setSpecies(s);
127  w.setPosition(position);
128  w.addObject(Vec3D( 1, 0, 0), Vec3D(-.5, 0, 0));
129  w.addObject(Vec3D(-1, 0, 0), Vec3D( .5, 0, 0));
130  w.addObject(Vec3D( 0, 1, 0), Vec3D( 0,-.5, 0));
131  w.addObject(Vec3D( 0,-1, 0), Vec3D( 0, .5, 0));
132  w.addObject(Vec3D( 0, 0, 1), Vec3D( 0, 0,-.5));
133  w.addObject(Vec3D( 0, 0,-1), Vec3D( 0, 0, .5));
134  w.setAngularVelocity(angularVelocity*Vec3D(0, 1, 0));
136 
137  //Create particle
138  SphericalParticle p(s);
139  p.setRadius(0.50001);
140  p.setVelocity(Vec3D(0, 0, 0));
141  p.setPosition(position + Vec3D(0, 0, 1));
143  p.setPosition(position + Vec3D(0, 0, -1));
145  p.setPosition(position + Vec3D(1, 0, 0));
147  p.setPosition(position + Vec3D(-1, 0, 0));
149  }
150 
151  logger(INFO, "Create square outer wall rotating around the other walls");
152  {
153  //Create Wall
154  InfiniteWall w;
155  w.setSpecies(s);
156  w.setPosition(Vec3D(0,0,5));
157  w.setAngularVelocity(angularVelocity*Vec3D(0, 1, 0));
158  w.setNormal(Vec3D(0,0,1));
160  [angularVelocity] (Mdouble time)
161  { return 5.0*Vec3D(sin(angularVelocity*time),0.0,cos(angularVelocity*time)); });
163 
165  w.setPosition(Vec3D(5,0,0));
166  w.setNormal(Vec3D(1,0,0));
168  [angularVelocity] (Mdouble time)
169  { return 5.0*Vec3D(sin(angularVelocity*time+0.5*pi),0.0,cos(angularVelocity*time+0.5*pi)); });
171 
172  w.setPosition(Vec3D(0,0,-5));
173  w.setNormal(Vec3D(0,0,-1));
175  [angularVelocity] (Mdouble time)
176  { return 5.0*Vec3D(sin(angularVelocity*time+pi),0.0,cos(angularVelocity*time+pi)); });
178 
179  w.setPosition(Vec3D(-5,0,0));
180  w.setNormal(Vec3D(-1,0,0));
182  [angularVelocity] (Mdouble time)
183  { return 5.0*Vec3D(sin(angularVelocity*time+1.5*pi),0.0,cos(angularVelocity*time+1.5*pi)); });
185 
186  //Create particle
187  SphericalParticle p(s);
188  p.setRadius(0.50001);
189  p.setVelocity(Vec3D(0, 0, 0));
190  p.setPosition(Vec3D( 0, 0,-4.5));
192  p.setPosition(Vec3D(-4.5, 0, 0));
194  p.setPosition(Vec3D( 0, 0, 4.5));
196  p.setPosition(Vec3D( 4.5, 0, 0));
198  }
199 
200 
201  //q.wallHandler.setWriteVTK(FileType::MULTIPLE_FILES);
202  //q.setParticlesWriteVTK(true);
203 
204  //solve
205  q.solve();
206 
207  return 0;
208 }
Species< LinearViscoelasticNormalSpecies, FrictionSpecies, BondedSpecies > LinearViscoelasticFrictionBondedSpecies
Definition: LinearViscoelasticFrictionBondedSpecies.h:35
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.
Use AxisymmetricIntersectionOfWalls to Screw Screw::read Screw::read Screw::read define axisymmetric ...
Definition: AxisymmetricIntersectionOfWalls.h:126
void setAxis(Vec3D a)
Definition: AxisymmetricIntersectionOfWalls.cc:152
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 setAngularVelocity(const Vec3D &angularVelocity)
set the angular velocity of the BaseInteractble.
Definition: BaseInteractable.cc:360
virtual void setPosition(const Vec3D &position)
Sets the position of this BaseInteractable.
Definition: BaseInteractable.h:239
void setPrescribedPosition(const std::function< Vec3D(double)> &prescribedPosition)
Allows the position of an infinite mass interactable to be prescribed.
Definition: BaseInteractable.cc:413
void setSpecies(const ParticleSpecies *species)
Defines the species of the current wall.
Definition: BaseWall.cc:169
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 setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:422
void setDimension(unsigned int newDim)
Sets both the system dimensions and the particle dimensionality.
Definition: DPMBase.cc:1403
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
Definition: DPMBase.h:1447
void setMin(const Vec3D &min)
Sets the minimum coordinates of the problem domain.
Definition: DPMBase.cc:1118
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created.
Definition: DPMBase.h:1437
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 setMax(const Vec3D &max)
Sets the maximum coordinates of the problem domain.
Definition: DPMBase.cc:1082
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 setNormal(Vec3D normal)
Changes the normal of the InfiniteWall.
Definition: InfiniteWall.cc:127
A IntersectionOfWalls is convex polygon defined as an intersection of InfiniteWall's.
Definition: IntersectionOfWalls.h:59
void addObject(Vec3D normal, Vec3D point)
Adds a wall to the set of infinite walls, given a normal vector pointing into the wall (i....
Definition: IntersectionOfWalls.cc:138
void setSpecies(const ParticleSpecies *species)
sets species of subwalls as well
Definition: IntersectionOfWalls.cc:72
Definition: QuaternionWallUnitTest.cpp:40
A spherical particle is the most simple particle used in MercuryDPM.
Definition: SphericalParticle.h:37
Definition: Vector.h:51
const Mdouble pi
Definition: ExtendedMath.h:45
Mdouble cos(Mdouble x)
Definition: ExtendedMath.cc:64
Mdouble sin(Mdouble x)
Definition: ExtendedMath.cc:44

References IntersectionOfWalls::addObject(), BaseHandler< T >::copyAndAddObject(), mathsFunc::cos(), INFO, logger, DPMBase::particleHandler, constants::pi, BaseInteractable::setAngularVelocity(), AxisymmetricIntersectionOfWalls::setAxis(), DPMBase::setDimension(), DPMBase::setGravity(), DPMBase::setMax(), DPMBase::setMin(), DPMBase::setName(), InfiniteWall::setNormal(), BaseInteractable::setPosition(), BaseInteractable::setPrescribedPosition(), BaseParticle::setRadius(), DPMBase::setSaveCount(), BaseWall::setSpecies(), IntersectionOfWalls::setSpecies(), DPMBase::setTimeMax(), DPMBase::setTimeStep(), BaseInteractable::setVelocity(), mathsFunc::sin(), DPMBase::solve(), DPMBase::speciesHandler, and DPMBase::wallHandler.