ClayParticles.cpp File Reference
#include <iostream>
#include "Species/LinearViscoelasticFrictionChargedBondedSpecies.h"
#include "DPMBase.h"
#include "Walls/InfiniteWall.h"
#include "Logger.h"

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[])
 

Variables

Logger< Log::ERRORtestLogger ("chargedParticleForceUnitTest")
 

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)
195 {
196  //********************************************************Setting Interaction Details**********************************************************
197  //Putting details in more user-friendly terms
198  //the maximum force exerted, i.e. when particles are in contact
199  double maximumForce = 3;
200  //the range of the force.
201  //Note that the range is measured from the EDGE of the particle!
202  double forceRange = 3;
203  //based on user inputs, calculated the necessary adhesion stiffness
204  double adStiffness = maximumForce / forceRange;
205  //based on user inputs, calculated the necessary adhesion stiffness
206  double stiffness = 1600 * adStiffness;
207  //the strength of the force holding particles together
208  //(Affects separation of bonded particles)
209  double bondStrength = 333.0;
210 
211 
212  ChargedBondedParticleUnitTest chargedParticleForceUnitTestProblem;
213  //setting the species of particles
214  auto species1 = chargedParticleForceUnitTestProblem.speciesHandler.copyAndAddObject(LinearViscoelasticFrictionChargedBondedSpecies());
215  //adding second species to allow for attractive interactions
216  auto species2 = chargedParticleForceUnitTestProblem.speciesHandler.copyAndAddObject(LinearViscoelasticFrictionChargedBondedSpecies());
217 
218  //setting species for system walls
219  auto speciesW = chargedParticleForceUnitTestProblem.speciesHandler.copyAndAddObject(LinearViscoelasticFrictionChargedBondedSpecies());
220 
221  //*************************************ASSIGNING PROPERTIES TO PARTICLE SPECIES*****************************************
222  //SPECIES 1
223  //setting the material properties of the particles
224  species1->setDensity(6./constants::pi);
225  species1->setStiffness(stiffness);
226  species1->setSlidingFrictionCoefficient(1);
227  species1->setSlidingStiffness(2.0/7.0*stiffness);
228  species1->setRollingFrictionCoefficient(1);
229  species1->setRollingStiffness(2.0/5.0*stiffness);
230  //setting the interaction force properties
231  //setting adhesion stiffness and force max as required to give the
232  //user-requested force range.
233  species1->setAdhesionForceMax(maximumForce);
234  species1->setAdhesionStiffness(adStiffness);
235  //Setting the charge of a particle:
236  //Positive (1) negative (-1) or neutral (0)
237  species1->setCharge(1);
238  //Assigning bond properties:
239  //The maximum force exerted by the 'bond'
240  //(determines the size of the overlap)
241  species1->setBondForceMax(bondStrength);
242  //the dissipation of the interaction -
243  //used to damp out any unphysical oscillations in the contacting pair
244  species1->setBondDissipation(0.2);
245 
246  //SPECIES 2
247  //setting the material properties of the particles
248  species2->setDensity(6./constants::pi);
249  species2->setStiffness(stiffness);
250  species2->setSlidingFrictionCoefficient(1);
251  species2->setSlidingStiffness(2.0/7.0*stiffness);
252  species2->setRollingFrictionCoefficient(1);
253  species2->setRollingStiffness(2.0/5.0*stiffness);
254  //setting the interaction force properties
255  //setting adhesion stiffness and force max as required to give the
256  //user-requested force range
257  species2->setAdhesionForceMax(maximumForce);
258  species2->setAdhesionStiffness(adStiffness);
259  //Setting the charge of a particle:
260  //Positive (1) negative (-1) or neutral (0)
261  species2->setCharge(-1);
262  //Assigning bond properties:
263  //The maximum force exerted by the 'bond'
264  //(determines the size of the overlap)
265  species2->setBondForceMax(bondStrength);
266  //the dissipation of the interaction -
267  //used to damp out any unphysical oscillations in the contacting pair
268  species2->setBondDissipation(0.2);
269 
270 
271  //FOR MIXED (SPECIES1-SPECIES2) INTERACTIONS
272  //adding also the ability to alter the mixed-particle-interaction properties
273  auto species1_2 = dynamic_cast<LinearViscoelasticFrictionChargedBondedMixedSpecies*>(chargedParticleForceUnitTestProblem.speciesHandler.getMixedObject(species1->getIndex(),species2->getIndex()));
274  //for now, simply setting mixed object parameters equal to those of species 1
275  //setting the material properties to the average values of the 2 particle species undergoing interaction
276  species1_2->mixAll(species1,species2);
277  species1_2->setSlidingFrictionCoefficient(1);
278  species1_2->setSlidingStiffness(2.0/7.0*stiffness);
279  species1_2->setRollingFrictionCoefficient(1);
280  species1_2->setRollingStiffness(2.0/5.0*stiffness);
281 
282  //*************************************ASSIGNING PROPERTIES TO WALL SPECIES*********************************************
283  //SPECIES W
284  //setting the material properties of the particles
285  speciesW->setDensity(6./constants::pi);
286  speciesW->setStiffness(stiffness);
287  speciesW->setSlidingFrictionCoefficient(1);
288  speciesW->setSlidingStiffness(2.0/7.0*stiffness);
289  speciesW->setRollingFrictionCoefficient(1);
290  speciesW->setRollingStiffness(2.0/5.0*stiffness);
291  //setting the interaction force properties
292  //setting adhesion stiffness and force max as required to give the
293  //user-requested force range
294  speciesW->setAdhesionForceMax(maximumForce);
295  speciesW->setAdhesionStiffness(adStiffness);
296  //Setting the charge of a particle:
297  //Positive (1) negative (-1) or neutral (0)
298  //charge by default set to zero. However, can be changed, e.g. to induce
299  //a field throughout the system and encourage alignment
300  speciesW->setCharge(0);
301  //Assigning bond properties:
302  //The maximum force exerted by the 'bond'
303  //(determines the size of the overlap)
304  //For walls, setting to zero as no need for bonded interactions here.
305  speciesW->setBondForceMax(0);
306  //the dissipation of the interaction -
307  //used to damp out any unphysical oscillations in the contacting pair
308  speciesW->setBondDissipation(0.2);
309 
310 
311  //FOR MIXED (PARTICLE-WALL) INTERACTIONS
312  //walls and species 1 particles
313  auto speciesW_1 = dynamic_cast<LinearViscoelasticFrictionChargedBondedMixedSpecies*>(chargedParticleForceUnitTestProblem.speciesHandler.getMixedObject(speciesW->getIndex(),species1->getIndex()));
314  //setting the material properties to the average values of the 2 particle species undergoing interaction
315  speciesW_1->mixAll(speciesW,species1);
316  speciesW_1->setSlidingFrictionCoefficient(1);
317  speciesW_1->setSlidingStiffness(2.0/7.0*stiffness);
318  speciesW_1->setRollingFrictionCoefficient(1);
319  speciesW_1->setRollingStiffness(2.0/5.0*stiffness);
320 
321  //walls and species 1 particles
322  auto speciesW_2 = dynamic_cast<LinearViscoelasticFrictionChargedBondedMixedSpecies*>(chargedParticleForceUnitTestProblem.speciesHandler.getMixedObject(speciesW->getIndex(),species2->getIndex()));
323  //setting the material properties to the average values of the 2 particle species undergoing interaction
324  speciesW_2->mixAll(speciesW,species2);
325  speciesW_2->setSlidingFrictionCoefficient(1);
326  speciesW_2->setSlidingStiffness(2.0/7.0*stiffness);
327  speciesW_2->setRollingFrictionCoefficient(1);
328  speciesW_2->setRollingStiffness(2.0/5.0*stiffness);
329 
330  //*************************************ASSIGNING GENERAL SIMULATION PARAMETERS******************************************
331  //Giving a name for the output file
332  chargedParticleForceUnitTestProblem.setName("ClayParticles");
333  //setting the time step of the problem
334  double radius = 0.25;
335  double mass = species1->getMassFromRadius(radius);
336  double tc = species1->getCollisionTime(mass);
337  chargedParticleForceUnitTestProblem.setTimeStep(0.02*tc);
338  //setting gravity to zero to ensure only forces acting are inter-particle forces!
339  chargedParticleForceUnitTestProblem.setGravity(Vec3D(0,0,-0));
340  //setting the duration of the simulation in "simulation seconds" (determined by
341  //the dimensions used in setup)
342  chargedParticleForceUnitTestProblem.setTimeMax(30.);
343  //setting parameters for visualisation using the xballs software package
344  chargedParticleForceUnitTestProblem.setXBallsAdditionalArguments("-cmode 8 -solidf -v0");
345  //solving the problem!
346  chargedParticleForceUnitTestProblem.solve(argc,argv);
347 
348  std::vector<BaseParticle*>::iterator pIt = chargedParticleForceUnitTestProblem.particleHandler.begin();
349 
350 }
Species< LinearViscoelasticNormalSpecies, FrictionSpecies, ChargedBondedSpecies > LinearViscoelasticFrictionChargedBondedSpecies
Definition: LinearViscoelasticFrictionChargedBondedSpecies.h:35
const std::vector< T * >::const_iterator begin() const
Gets the begin of the const_iterator over all Object in this BaseHandler.
Definition: BaseHandler.h:690
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
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 setXBallsAdditionalArguments(std::string newXBArgs)
Set the additional arguments for xballs.
Definition: DPMBase.cc:1347
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 setGravity(Vec3D newGravity)
Sets a new value for the gravitational acceleration.
Definition: DPMBase.cc:1383
Contains contact force properties for contacts between particles with two different species.
Definition: MixedSpecies.h:43
void mixAll(BaseSpecies *const S, BaseSpecies *const T) final
sets the MixedSpecies properties by mixing the properties of two particle species
Definition: MixedSpecies.h:290
std::enable_if<!std::is_pointer< typename U::MixedSpeciesType >::value, typename U::MixedSpeciesType * >::type getMixedObject(const U *S, const U *T)
Definition: SpeciesHandler.h:74
Definition: Vector.h:51
const Mdouble pi
Definition: ExtendedMath.h:45

References BaseHandler< T >::begin(), BaseHandler< T >::copyAndAddObject(), SpeciesHandler::getMixedObject(), MixedSpecies< NormalForceSpecies, FrictionForceSpecies, AdhesiveForceSpecies >::mixAll(), DPMBase::particleHandler, constants::pi, DPMBase::setGravity(), DPMBase::setName(), DPMBase::setTimeMax(), DPMBase::setTimeStep(), DPMBase::setXBallsAdditionalArguments(), DPMBase::solve(), and DPMBase::speciesHandler.

Variable Documentation

◆ testLogger

Logger<Log::ERROR> testLogger("chargedParticleForceUnitTest") ( "chargedParticleForceUnitTest"  )