44 static int count = -1;
53 unsigned int nParticle = 2;
58 for (
unsigned int j=0; j< nParticle; j++){
102 normalRelativeVelocity = relativeVelocity.
X /
normal.
X;
103 tangentialRelativeVelocity = relativeVelocity.
Y /
tangent.
Y;
108 return species->getCollisionTime(mass);
124 static int count = -1;
158 species->setCollisionTimeAndRestitutionCoefficient(
tc,
en,2.0*
m12);
177 normalRelativeVelocity = relativeVelocity.
X /
normal.
X;
178 tangentialRelativeVelocity = relativeVelocity.
Y /
tangent.
Y;
185 std::cout << std::endl <<
"testing particle-particle collisions ..." << std::endl << std::endl;
192 Mdouble normalRelativeVelocity, tangentialRelativeVelocity, analyticTangentialRelativeVelocity;
194 std::cout <<
"5: without tangential forces" << std::endl;
195 problem.
setName(
"force_test5");
199 std::cout <<
"normalRelativeVelocity: analytic:" << -problem.
en*problem.
initialNormalRelativeVelocity <<
", simulation=" << normalRelativeVelocity << std::endl;
203 std::cout <<
"6: with Coulomb friction" << std::endl;
205 problem.
species->setSlidingFrictionCoefficient(mu);
206 problem.
species->setSlidingDissipation(1e20);
208 problem.
setName(
"force_test6");
212 std::cout <<
"tangentialRelativeVelocity: analytic=" << analyticTangentialRelativeVelocity <<
", simulation=" << tangentialRelativeVelocity << std::endl;
213 std::cout <<
"normalRelativeVelocity: analytic:" << -problem.
en*problem.
initialNormalRelativeVelocity <<
", simulation=" << normalRelativeVelocity << std::endl;
215 std::cout <<
"7: with Coulomb friction, spring activated" << std::endl;
216 problem.
species->setSlidingStiffness(1.0);
218 problem.
setName(
"force_test7");
220 std::cout <<
"tangentialRelativeVelocity: analytic=" << analyticTangentialRelativeVelocity <<
", simulation=" << tangentialRelativeVelocity << std::endl;
221 std::cout <<
"normalRelativeVelocity: analytic:" << -problem.
en*problem.
initialNormalRelativeVelocity <<
", simulation=" << normalRelativeVelocity << std::endl;
223 std::cout <<
"8: with tangential viscous force" << std::endl;
225 problem.
species->setSlidingFrictionCoefficient(1e20);
226 problem.
species->setSlidingDissipation(-log(-et)/(2.0*problem.
tc) /3.5 * 2.0 * problem.
m12);
227 problem.
species->setSlidingStiffness(0.0);
228 problem.
setName(
"force_test8");
232 std::cout <<
"tangentialRelativeVelocity: analytic=" << analyticTangentialRelativeVelocity <<
", simulation=" << tangentialRelativeVelocity << std::endl;
233 std::cout <<
"normalRelativeVelocity: analytic:" << -problem.
en*problem.
initialNormalRelativeVelocity <<
", simulation=" << normalRelativeVelocity << std::endl;
235 std::cout <<
"9: with tangential elastic force" << std::endl;
237 problem.
species->setSlidingFrictionCoefficient(1e20);
238 problem.
species->setSlidingDissipation(0.0);
240 problem.
setName(
"force_test9");
244 std::cout <<
"tangentialRelativeVelocity: analytic=" << analyticTangentialRelativeVelocity <<
", simulation=" << tangentialRelativeVelocity << std::endl;
245 std::cout <<
"normalRelativeVelocity: analytic:" << -problem.
en*problem.
initialNormalRelativeVelocity <<
", simulation=" << normalRelativeVelocity << std::endl;
251 std::cout << std::endl <<
"testing wall-particle collisions ..." << std::endl << std::endl;
258 Mdouble normalRelativeVelocity, tangentialRelativeVelocity, analyticTangentialRelativeVelocity;
262 std::cout <<
"0: without tangential forces" << std::endl;
263 problem.
setName(
"force_test0");
268 std::cout <<
"normalRelativeVelocity: analytic:" << -problem.
en*problem.
initialNormalRelativeVelocity <<
", simulation=" << normalRelativeVelocity << std::endl;
270 std::cout <<
"1: with Coulomb friction" << std::endl;
272 problem.
species->setSlidingFrictionCoefficient(mu);
273 problem.
species->setSlidingDissipation(1e20);
274 problem.
species->setSlidingStiffness(0.0);
275 problem.
setName(
"force_test1");
279 std::cout <<
"tangentialRelativeVelocity: analytic=" << analyticTangentialRelativeVelocity <<
", simulation=" << tangentialRelativeVelocity << std::endl;
280 std::cout <<
"normalRelativeVelocity: analytic:" << -problem.
en*problem.
initialNormalRelativeVelocity <<
", simulation=" << normalRelativeVelocity << std::endl;
282 std::cout <<
"2: with Coulomb friction, spring activated" << std::endl;
283 problem.
species->setSlidingStiffness(1.0);
284 problem.
setName(
"force_test2");
286 std::cout <<
"tangentialRelativeVelocity: analytic=" << analyticTangentialRelativeVelocity <<
", simulation=" << tangentialRelativeVelocity << std::endl;
287 std::cout <<
"normalRelativeVelocity: analytic:" << -problem.
en*problem.
initialNormalRelativeVelocity <<
", simulation=" << normalRelativeVelocity << std::endl;
289 std::cout <<
"3: with tangential viscous force" << std::endl;
291 problem.
species->setSlidingFrictionCoefficient(1e20);
292 problem.
species->setSlidingDissipation(-log(-et)/(2.0*problem.
tc) /3.5 * 2.0 * problem.
m12);
293 problem.
species->setSlidingStiffness(0.0);
294 problem.
setName(
"force_test3");
298 std::cout <<
"tangentialRelativeVelocity: analytic=" << analyticTangentialRelativeVelocity <<
", simulation=" << tangentialRelativeVelocity << std::endl;
299 std::cout <<
"normalRelativeVelocity: analytic:" << -problem.
en*problem.
initialNormalRelativeVelocity <<
", simulation=" << normalRelativeVelocity << std::endl;
301 std::cout <<
"4: with tangential elastic force" << std::endl;
303 problem.
species->setSlidingFrictionCoefficient(1e20);
304 problem.
species->setSlidingDissipation(0.0);
306 problem.
setName(
"force_test4");
310 std::cout <<
"tangentialRelativeVelocity: analytic=" << analyticTangentialRelativeVelocity <<
", simulation=" << tangentialRelativeVelocity << std::endl;
311 std::cout <<
"normalRelativeVelocity: analytic:" << -problem.
en*problem.
initialNormalRelativeVelocity <<
", simulation=" << normalRelativeVelocity << std::endl;
318 std::cout << std::endl <<
"note: analytic values are only asymptotically correct as delta->0" << std::endl;
void particle_particle_test()
void setXMax(Mdouble newXMax)
If the length of the problem domain in x-direction is XMax - XMin, this method sets XMax...
void solve()
The work horse of the code.
The DPMBase header includes quite a few header files, defining all the handlers, which are essential...
Mdouble X
the vector components
void setVelocity(const Vec3D &velocity)
set the velocity of the BaseInteractable.
void setTimeMax(Mdouble newTMax)
Allows the upper time limit to be changed.
void setOrientation(const Vec3D &orientation)
Sets the orientation of this BaseInteractable.
const ParticleSpecies * getSpecies() const
Returns a pointer to the species of this BaseInteractable.
void getRelativeVelocityComponents(Mdouble &normalRelativeVelocity, Mdouble &tangentialRelativeVelocity)
void setParticleDimensions(unsigned int particleDimensions)
Allows the dimension of the particle (f.e. for mass) to be changed. e.g. discs or spheres...
virtual void computeMass(BaseParticle *p) const
Compute Particle mass function, which required a reference to the Species vector. It computes the Par...
void setZMax(Mdouble newZMax)
If the length of the problem domain in z-direction is XMax - XMin, this method sets ZMax...
virtual const Vec3D & getAngularVelocity() const
Returns the angular velocity of this interactable.
void setSystemDimensions(unsigned int newDim)
Allows for the dimension of the simulation to be changed.
Species< LinearViscoelasticNormalSpecies, SlidingFrictionSpecies > LinearViscoelasticSlidingFrictionSpecies
T square(T val)
squares a number
void setRadius(const Mdouble radius)
Sets the particle's radius_ (and adjusts the mass_ accordingly, based on the particle's species) ...
void setYMax(Mdouble newYMax)
If the length of the problem domain in y-direction is YMax - YMin, this method sets YMax...
void wall_particle_test()
Vec3D getRelativeVelocity()
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
U * copyAndAddObject(const U &O)
Creates a copy of a Object and adds it to the BaseHandler.
Mdouble getMass() const
Returns the particle's mass_.
Vec3D getRelativeVelocity()
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
int main(int argc UNUSED, char *argv[] UNUSED)
void setDensity(Mdouble density)
Allows the density to be changed.
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_ for all files (ene, data, fstat, restart, stat)
static Vec3D cross(const Vec3D &a, const Vec3D &b)
Calculates the cross product of two Vec3D: .
Mdouble getRadius() const
Returns the particle's radius_.
void getRelativeVelocityComponents(Mdouble &normalRelativeVelocity, Mdouble &tangentialRelativeVelocity)
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. elastic, linear visco-elastic... et cetera...
virtual void setupInitialConditions()
This function allows to set the initial conditions for our problem to be solved, by default particle ...
void setRandomSeed(unsigned long int new_seed)
This is the seed for the random number generator. (note the call to seed_LFG is only required really ...
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
RNG random
This is a random generator, often used for setting up the initial conditions etc...
Mdouble initialNormalRelativeVelocity
void setPosition(const Vec3D &position)
Sets the position of this BaseInteractable.
void set(Vec3D normal, Vec3D point)
Defines a standard wall, given an outward normal vector s.t. normal*x=normal*point for all x of the w...
void setTimeStep(Mdouble newDt)
Allows the time step dt to be changed.
This is a class defining walls.
LinearViscoelasticSlidingFrictionSpecies * species
Contains material and contact force properties.
virtual const Vec3D & getVelocity() const
Returns the velocity of this interactable.
void setupInitialConditions()
This function allows to set the initial conditions for our problem to be solved, by default particle ...
Mdouble getCollisionTime(Mdouble mass)
Calculates collision time for two copies of a particle of species 0.
Implementation of a 3D vector (by Vitaliy).
void setAngularVelocity(const Vec3D &angularVelocity)
set the angular velocity of the BaseInteractble.
Mdouble initialTangentialRelativeVelocity
Mdouble getRandomNumber(Mdouble min, Mdouble max)
This is a random generating routine can be used for initial positions.
particle_particle_collision()