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

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

Variable Documentation

◆ testLogger

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