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[] 
)
68 {
69  logger(INFO, "Species is neither Sinter nor LinearPlasticViscoelastic");
70 
71  //Putting details in more user-friendly terms
72  //the maximum force exerted, i.e. when particles are in contact
73  double maximumForce = 3;
74  //the range of the force.
75  //Note that the range is measured from the EDGE of the particle!
76  double forceRange = 3;
77  //based on user inputs, calculated the necessary adhesion stiffness
78  double adStiffness = maximumForce / forceRange;
79  //the strength of the force holding particles together
80  double bondStrength = 100.0;
81 
83 
84  //setting the species of particles
86 
87  //setting the material properties of the particles
88  species->setDensity(6. / constants::pi);
89  species->setEffectiveElasticModulus(1000.0);
90  species->setSlidingFrictionCoefficient(0.0);
91  species->setAdhesionForceMax(maximumForce);
92  species->setAdhesionStiffness(adStiffness);
93  species->setBondForceMax(bondStrength);
94  species->setBondDissipation(0.2);
95  species->setVanDerWaalsForceMax(1);
96  species->setVanDerWaalsStiffness(10);
97  species->setCharge(-1);
98 
99  //setting a second species of particles
100  auto species2 = dpm.speciesHandler.copyAndAddObject(species);
101  species2->setCharge(1);
102 
103  //Giving a name for the output file
104  dpm.setName("ChargedBondedParticleUnitTest");
105  //setting the time step of the problem
106  dpm.setTimeStep(3e-3);
107  dpm.setSaveCount(30);
108  //setting gravity to zero to ensure only forces acting are inter-particle forces!
109  dpm.setGravity(Vec3D(0, 0, 0));
110  //setting the duration of the simulation in "simulation seconds" (determined by
111  //the dimensions used in setup)
112  dpm.setTimeMax(3.);
113  //solving the problem!
114  dpm.solve(argc, argv);
115 
116  helpers::writeToFile("ChargedBondedParticleUnitTest.gnu",
117  "set xlabel 'time [s]'\n"
118  "set ylabel 'total Energy [J]'\n"
119  "p 'ChargedBondedParticleUnitTest.ene' u 1:($2+$3+$4+$5) w l\n"
120  );
121 
122  Mdouble eneElastic = dpm.getElasticEnergy();
123  Mdouble eneKinetic = dpm.getKineticEnergy();
124  if (fabs(eneElastic + eneKinetic - (4.03257e-05)) >= 1e-6)
125  {
126  logger(FATAL, "Particles have the wrong total energy. It is % and should be %", eneElastic+eneKinetic,
127  5.33881e-6);
128  }
129 }
double Mdouble
Definition: GeneralDefine.h:34
Species< HertzianViscoelasticNormalSpecies, FrictionSpecies, ChargedBondedSpecies > HertzianViscoelasticFrictionChargedBondedSpecies
Definition: HertzianViscoelasticFrictionChargedBondedSpecies.h:35
LL< Log::INFO > INFO
Info log level.
Definition: Logger.cc:55
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:52
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
In this file, the rolling behaviour of the tangential spring is tested. This is done by placing one n...
Definition: ClayParticles.cpp:35
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
Mdouble getKineticEnergy() const
Returns the global kinetic energy stored in the system.
Definition: DPMBase.cc:1544
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
Mdouble getElasticEnergy() const
Returns the global elastic energy within the system.
Definition: DPMBase.cc:1530
Definition: Vector.h:51
const Mdouble pi
Definition: ExtendedMath.h:45
bool writeToFile(std::string filename, std::string filecontent)
Writes a string to a file.
Definition: FileIOHelpers.cc:58

References BaseHandler< T >::copyAndAddObject(), 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().