ChargedBondedParticleUnitTest.cpp File Reference

Classes

class  ChargedBondedParticleUnitTest
 In this file, the rolling behaviour of the tangential spring is tested. This is done by placing one normal partilce on top of a fixed partilce and letting graviry roll it over the other particle until it loses contact. More...
 

Functions

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

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)
46 {
47  logger(INFO, "Species is neither Sinter nor LinearPlasticViscoelastic");
48 
49  //Putting details in more user-friendly terms
50  //the maximum force exerted, i.e. when particles are in contact
51  double maximumForce = 3;
52  //the range of the force.
53  //Note that the range is measured from the EDGE of the particle!
54  double forceRange = 3;
55  //based on user inputs, calculated the necessary adhesion stiffness
56  double adStiffness = maximumForce / forceRange;
57  //the strength of the force holding particles together
58  double bondStrength = 100.0;
59 
61 
62  //setting the species of particles
64 
65  //setting the material properties of the particles
66  species->setDensity(6. / constants::pi);
67  species->setEffectiveElasticModulus(1000.0);
68  species->setSlidingFrictionCoefficient(0.0);
69  species->setAdhesionForceMax(maximumForce);
70  species->setAdhesionStiffness(adStiffness);
71  species->setBondForceMax(bondStrength);
72  species->setBondDissipation(0.2);
73  species->setVanDerWaalsForceMax(1);
74  species->setVanDerWaalsStiffness(10);
75  species->setCharge(-1);
76 
77  //setting a second species of particles
78  auto species2 = dpm.speciesHandler.copyAndAddObject(species);
79  species2->setCharge(1);
80 
81  //Giving a name for the output file
82  dpm.setName("ChargedBondedParticleUnitTest");
83  //setting the time step of the problem
84  dpm.setTimeStep(3e-3);
85  dpm.setSaveCount(30);
86  //setting gravity to zero to ensure only forces acting are inter-particle forces!
87  dpm.setGravity(Vec3D(0, 0, 0));
88  //setting the duration of the simulation in "simulation seconds" (determined by
89  //the dimensions used in setup)
90  dpm.setTimeMax(3.);
91  //solving the problem!
92  dpm.solve(argc, argv);
93 
94  helpers::writeToFile("ChargedBondedParticleUnitTest.gnu",
95  "set xlabel 'time [s]'\n"
96  "set ylabel 'total Energy [J]'\n"
97  "p 'ChargedBondedParticleUnitTest.ene' u 1:($2+$3+$4+$5) w l\n"
98  );
99 
100  Mdouble eneElastic = dpm.getElasticEnergy();
101  Mdouble eneKinetic = dpm.getKineticEnergy();
102  if (fabs(eneElastic + eneKinetic - (4.03257e-05)) >= 1e-6)
103  {
104  logger(FATAL, "Particles have the wrong total energy. It is % and should be %", eneElastic+eneKinetic,
105  5.33881e-6);
106  }
107 }
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Species< HertzianViscoelasticNormalSpecies, FrictionSpecies, ChargedBondedSpecies > HertzianViscoelasticFrictionChargedBondedSpecies
Definition: HertzianViscoelasticFrictionChargedBondedSpecies.h:13
LL< Log::FATAL > FATAL
Definition of the different loglevels by its wrapper class LL. These are used as tags in template met...
Definition: Logger.cc:31
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:360
In this file, the rolling behaviour of the tangential spring is tested. This is done by placing one n...
Definition: ClayParticles.cpp:13
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 setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:400
Mdouble getKineticEnergy() const
Returns the global kinetic energy stored in the system.
Definition: DPMBase.cc:1535
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
Mdouble getElasticEnergy() const
Returns the global elastic energy within the system.
Definition: DPMBase.cc:1521
Definition: Kernel/Math/Vector.h:30
#define INFO(i)
Definition: mumps_solver.h:54
Real fabs(const Real &a)
Definition: boostmultiprec.cpp:117
const Mdouble pi
Definition: ExtendedMath.h:23
bool writeToFile(const std::string &filename, const std::string &filecontent)
Writes a string to a file.
Definition: FileIOHelpers.cc:29

References BaseHandler< T >::copyAndAddObject(), e(), boost::multiprecision::fabs(), FATAL, DPMBase::getElasticEnergy(), DPMBase::getKineticEnergy(), INFO, logger, constants::pi, DPMBase::setGravity(), DPMBase::setName(), DPMBase::setSaveCount(), DPMBase::setTimeMax(), DPMBase::setTimeStep(), DPMBase::solve(), DPMBase::speciesHandler, and helpers::writeToFile().