SlidingFrictionUnitTest.cpp File Reference


class  SlidingFrictionUnitTest


int main (int argc UNUSED, char *argv[] UNUSED)

Function Documentation

◆ main()

int main ( int argc  UNUSED,
char *argv[]  UNUSED 
45 {
46  //Unit diameter
47  Mdouble radius = 0.5;
48  //Equilibrium overlap
49  Mdouble overlap = 0.1*radius;
50  //Collision time (determines time step)
51  Mdouble tc = 50e-3;
52  //rotation velocity
53  Mdouble velocity = 1.0;
56  sf.setGravity({0,0,0});
57  sf.setTimeStep(0.02*tc);
58  sf.setName("SlidingFrictionUnitTest");
59  sf.setMin(-radius*Vec3D(2,2,2));
60  sf.setMax( radius*Vec3D(2,2,2));
61  sf.setDimension(3);
62  sf.setTimeMax(2.0);
63  sf.eneFile.setSaveCount(1);
65  //Add species
67  //Set unit density
68  s->setDensity(1.0);
69  //Make particles relatively soft and dissipative
70  Mdouble mass = s->getMassFromRadius(radius);
71  s->setCollisionTimeAndNormalAndTangentialRestitutionCoefficient(tc,0.5,1.0,mass);
72  //Set a high friction, so sliding movement is mostly elastic
73  s->setSlidingFrictionCoefficient(1e20);
74  //10% overlap in equilibrium position
75  s->setBondForceMax(overlap*s->getStiffness());
76  // check that stiffness is not too small
77  logger(INFO,"Stiffness k=%",s->getStiffness());
79  //Add particles
81  p.setSpecies(s);
82  p.setRadius(radius);
83  p.setPosition({ radius-0.5*overlap,0,0});
84  p.setVelocity(velocity*Vec3D(0,0,1));
85  auto p0 = sf.particleHandler.copyAndAddObject(p);
86  p.setPosition({-radius+0.5*overlap,0,0});
87  p.setVelocity(velocity*Vec3D(0,0,-1));
88  auto p1 = sf.particleHandler.copyAndAddObject(p);
90  //Add bonded interaction
92  i->bond();
93  i->setSlidingSpring({0,0,overlap});
94  sf.solve();
96  helpers::writeToFile("SlidingFrictionUnitTest.gnu","set size ratio -1; p 'SlidingFrictionUnitTest.ene' u 2:4 w lp");
97 }
double Mdouble
Definition: GeneralDefine.h:34
Species< LinearViscoelasticNormalSpecies, SlidingFrictionSpecies, BondedSpecies > LinearViscoelasticSlidingFrictionBondedSpecies
Definition: LinearViscoelasticSlidingFrictionBondedSpecies.h:35
Info log level.
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
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 setVelocity(const Vec3D &velocity)
set the velocity of the BaseInteractable.
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)
void setSpecies(const ParticleSpecies *species)
File eneFile
An instance of class File to handle in- and output into a .ene file.
Definition: DPMBase.h:1488
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)
void setDimension(unsigned int newDim)
Sets both the system dimensions and the particle dimensionality.
void setMin(const Vec3D &min)
Sets the minimum coordinates of the problem domain.
InteractionHandler interactionHandler
An object of the class InteractionHandler.
Definition: DPMBase.h:1467
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.
void setTimeMax(Mdouble newTMax)
Sets a new value for the maximum simulation duration.
void solve()
The work horse of the code.
void setMax(const Vec3D &max)
Sets the maximum coordinates of the problem domain.
void setGravity(Vec3D newGravity)
Sets a new value for the gravitational acceleration.
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_.
BaseInteraction * getInteraction(BaseInteractable *P, BaseInteractable *I, unsigned timeStamp)
Returns the Interaction between the BaseInteractable's P and I.
Contains information about the contact between two interactables, BaseInteraction::P_ and BaseInterac...
Definition: Interaction.h:116
Definition: SlidingFrictionUnitTest.cpp:29
A spherical particle is the most simple particle used in MercuryDPM.
Definition: SphericalParticle.h:37
Definition: Vector.h:51
const std::complex< Mdouble > i
Definition: ExtendedMath.h:51
bool writeToFile(std::string filename, std::string filecontent)
Writes a string to a file.

References BaseHandler< T >::copyAndAddObject(), DPMBase::eneFile, InteractionHandler::getInteraction(), constants::i, INFO, DPMBase::interactionHandler, logger, DPMBase::particleHandler, DPMBase::setDimension(), DPMBase::setGravity(), DPMBase::setMax(), DPMBase::setMin(), DPMBase::setName(), BaseInteractable::setPosition(), BaseParticle::setRadius(), File::setSaveCount(), BaseParticle::setSpecies(), DPMBase::setTimeMax(), DPMBase::setTimeStep(), BaseInteractable::setVelocity(), DPMBase::solve(), DPMBase::speciesHandler, and helpers::writeToFile().