MercuryDPM  0.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CSpecies Class Reference

Stores properties of the particles and the contact models such as the elastic modulus. More...

#include <CSpecies.h>

Public Member Functions

 CSpecies ()
 
void set_k0 (Mdouble new_k0)
 Allows the spring constant to be changed. More...
 
Mdouble get_k0 () const
 Allows the spring constant to be accessed. More...
 
void set_f0 (Mdouble new_f0)
 Allows the spring constant to be changed. More...
 
Mdouble get_f0 () const
 Allows the spring constant to be accessed. More...
 
Mdouble get_InteractionDistance ()
 
void set_k (Mdouble new_k)
 Allows the spring constant to be changed. More...
 
Mdouble get_k () const
 Allows the spring constant to be accessed. More...
 
void set_k_and_disp (helperFunc::KAndDisp new_)
 Allows the spring and dissipation constants to be changed simultaneously. More...
 
void set_k_and_disp_and_kt_and_dispt (helperFunc::KAndDispAndKtAndDispt new_)
 Allows the normal and tangential spring and dissipation constants to be changed simultaneously. More...
 
void set_kt (Mdouble new_kt)
 Allows the spring constant to be changed. More...
 
Mdouble get_kt () const
 Allows the spring constant to be accessed. More...
 
void set_krolling (Mdouble new_k)
 Allows the spring constant to be changed. More...
 
Mdouble get_krolling () const
 Allows the spring constant to be accessed. More...
 
void set_ktorsion (Mdouble new_k)
 Allows the spring constant to be changed. More...
 
Mdouble get_ktorsion () const
 Allows the spring constant to be accessed. More...
 
void set_rho (Mdouble new_rho)
 
Mdouble get_rho () const
 Allows the density to be accessed. More...
 
void set_dispt (Mdouble new_dispt)
 Allows the tangential viscosity to be changed. More...
 
Mdouble get_dispt () const
 Allows the tangential viscosity to be accessed. More...
 
void set_disprolling (Mdouble new_disprolling)
 Allows the tangential viscosity to be changed. More...
 
Mdouble get_disprolling () const
 Allows the tangential viscosity to be accessed. More...
 
void set_disptorsion (Mdouble new_disptorsion)
 Allows the tangential viscosity to be changed. More...
 
Mdouble get_disptorsion () const
 Allows the tangential viscosity to be accessed. More...
 
void set_dissipation (Mdouble new_disp)
 Allows the normal dissipation to be changed. More...
 
Mdouble get_dissipation () const
 Allows the normal dissipation to be accessed. More...
 
void set_disp (Mdouble new_disp)
 Allows the normal dissipation to be changed. More...
 
Mdouble get_disp () const
 Allows the normal dissipation to be accessed. More...
 
void set_restitution (Mdouble new_)
 Allows the normal dissipation to be changed. More...
 
Mdouble get_logRestitution () const
 Allows the normal dissipation to be accessed. More...
 
Mdouble get_useRestitution () const
 Allows the normal dissipation to be accessed. More...
 
void update_disp (Mdouble mass1, Mdouble mass2)
 
void set_mu (Mdouble new_mu)
 Allows the (dynamic) Coulomb friction coefficient to be changed; also sets mu_s by default. More...
 
Mdouble get_mu () const
 Allows the (dynamic) Coulomb friction coefficient to be accessed. More...
 
void set_mus (Mdouble new_mu)
 Allows the static Coulomb friction coefficient to be changed. More...
 
Mdouble get_mus () const
 Allows the static Coulomb friction coefficient to be accessed. More...
 
void set_murolling (Mdouble new_murolling)
 Allows the (dynamic) Coulomb friction coefficient to be changed; also sets murolling_s by default. More...
 
Mdouble get_murolling () const
 Allows the (dynamic) Coulomb friction coefficient to be accessed. More...
 
void set_musrolling (Mdouble new_mu)
 Allows the static Coulomb friction coefficient to be changed. More...
 
Mdouble get_musrolling () const
 Allows the static Coulomb friction coefficient to be accessed. More...
 
void set_mutorsion (Mdouble new_mu)
 Allows the (dynamic) Coulomb friction coefficient to be changed; also sets mu_s by default. More...
 
Mdouble get_mutorsion () const
 Allows the (dynamic) Coulomb friction coefficient to be accessed. More...
 
void set_mustorsion (Mdouble new_mu)
 Allows the static Coulomb friction coefficient to be changed. More...
 
Mdouble get_mustorsion () const
 Allows the static Coulomb friction coefficient to be accessed. More...
 
void set_dim_particle (int new_dim)
 Allows the dimension of the particle (f.e. for mass) to be changed. More...
 
int get_dim_particle () const
 Allows the dimension of the particle (f.e. for mass) to be accessed. More...
 
void read (std::istream &is)
 
void print (std::ostream &os)
 Outputs species. More...
 
Mdouble get_collision_time (Mdouble mass)
 Calculates collision time for two copies of a particle of given disp, k, mass. More...
 
Mdouble get_restitution_coefficient (Mdouble mass)
 Calculates restitution coefficient for two copies of given disp, k, mass. More...
 
Mdouble get_maximum_velocity (Mdouble radius, Mdouble mass)
 Calculates the maximum velocity allowed for a collision of two copies of P (for higher velocities particles could pass through each other) More...
 
void set_k_and_restitution_coefficient (Mdouble k_, Mdouble eps, Mdouble mass)
 Sets k, disp such that it matches a given tc and eps for a collision of two copies of P. More...
 
void set_collision_time_and_restitution_coefficient (Mdouble tc, Mdouble eps, Mdouble mass)
 Sets k, disp such that it matches a given tc and eps for a collision of two copies of equal mass m. More...
 
void set_collision_time_and_restitution_coefficient (Mdouble tc, Mdouble eps, Mdouble mass1, Mdouble mass2)
 Set k, disp such that is matches a given tc and eps for a collision of two different masses. More...
 
void set_collision_time_and_normal_and_tangential_restitution_coefficient (Mdouble tc, Mdouble eps, Mdouble beta, Mdouble mass)
 Sets k, disp, kt, dispt such that it matches a given tc and eps for a collision of two particles of masses m0,m1. More...
 
void set_collision_time_and_normal_and_tangential_restitution_coefficient_nodispt (Mdouble tc, Mdouble eps, Mdouble beta, Mdouble mass)
 Sets k, disp, kt, dispt such that it matches a given tc and eps for a collision of two particles of masses m0,m1. More...
 
void set_collision_time_and_normal_and_tangential_restitution_coefficient (Mdouble tc, Mdouble eps, Mdouble beta, Mdouble mass1, Mdouble mass2)
 Sets k, disp, kt, dispt such that it matches a given tc and eps for a collision of two particles of equal mass m. More...
 
void set_collision_time_and_normal_and_tangential_restitution_coefficient_nodispt (Mdouble tc, Mdouble eps, Mdouble beta, Mdouble mass1, Mdouble mass2)
 Sets k, disp, kt, dispt such that it matches a given tc and eps for a collision of two particles of equal mass m. More...
 
Mdouble get_average (Mdouble a, Mdouble b)
 
void mix (CSpecies &S0, CSpecies &S1)
 create values for mixed species More...
 
ForceTypes get_ForceType () const
 
void set_ForceType (ForceTypes new_)
 
AdhesionForceTypes get_AdhesionForceType () const
 
void set_AdhesionForceType (AdhesionForceTypes new_)
 
void set_AdhesionForceType (char new_[])
 
void set_plastic_k1_k2max_kc_depth (Mdouble k1_, Mdouble k2max_, Mdouble kc_, Mdouble depth_)
 Acccess functions for the plastic model. More...
 
Mdouble get_k1 () const
 
Mdouble get_k2max () const
 
Mdouble get_kc () const
 
Mdouble get_depth () const
 
void set_k1 (Mdouble new_)
 
void set_k2max (Mdouble new_)
 
void set_kc (Mdouble new_)
 
void set_depth (Mdouble new_)
 
Mdouble get_plastic_dt (Mdouble mass)
 Calculates collision time for stiffest spring constant, divides by 50. More...
 

Public Attributes

Mdouble k
 
Mdouble kt
 
Mdouble krolling
 
Mdouble ktorsion
 
Mdouble disp
 
Mdouble dispt
 
Mdouble disprolling
 
Mdouble disptorsion
 
Mdouble mu
 
Mdouble mus
 
Mdouble murolling
 
Mdouble musrolling
 
Mdouble mutorsion
 
Mdouble mustorsion
 
Mdouble rho
 
int dim_particle
 
std::vector< CSpeciesMixedSpecies
 
Mdouble k2max
 
Mdouble kc
 
Mdouble depth
 
Mdouble logRestitution
 
bool useRestitution
 
ForceTypes ForceType
 
AdhesionForceTypes AdhesionForceType
 
Mdouble k0
 
Mdouble f0
 

Friends

std::ostream & operator<< (std::ostream &os, const CSpecies &s)
 Writes all species data. More...
 
std::istream & operator>> (std::istream &is, CSpecies &s)
 Reads all species data. More...
 

Detailed Description

Stores properties of the particles and the contact models such as the elastic modulus.

As particle species are distinguished by their species Particle::indSpecies. Based on this index, different particle and contact properties apply which are stored in MD::Species. The contact model for interspecies interactions are defined in CSpecies::MixedSpecies

Bug:
Segfault, caused by: In MD::add_Species(...) (MD.cc, line 1298), if the line Species.push_back(S); causes a reallocation of internal storage, then the existing elements of Species are copy-constructed into the new memory. However, the copy constructor of CSpecies (CSpecies.h, line 35), does not copy the MixedSpecies vector, so if we call add_Species more than once (meaning that for the second and subsequent calls, existing elements in the Species vector have non-empty MixedSpecies vectors) we are liable to lose this data. Fix: Copy the MixedSpecies member in the copy constructor (CSpecies.h, line 40-ish): MixedSpecies = S.MixedSpecies; However, it looks to me as though if this line is added, the copy constructor could be replaced by the default bitwise copy constructor, so perhaps the copying of MixedSpecies has been left out for a reason...

Definition at line 56 of file CSpecies.h.

Constructor & Destructor Documentation

CSpecies::CSpecies ( )
inline

Definition at line 58 of file CSpecies.h.

References AdhesionForceType, depth, dim_particle, disp, disprolling, dispt, disptorsion, f0, ForceType, k, k0, k2max, kc, krolling, kt, ktorsion, Linear, logRestitution, mu, murolling, mus, musrolling, mustorsion, mutorsion, None, rho, and useRestitution.

58  {
59  k = 0;
60  kt = 0;
61  krolling = 0;
62  ktorsion = 0;
63  disp = 0;
64  dispt = 0;
65  disprolling = 0;
66  disptorsion = 0;
67  mu = 0;
68  mus = 0;
69  mu = 0;
70  murolling = 0;
71  musrolling = 0;
72  mutorsion = 0;
73  mustorsion = 0;
74  k2max = 0;
75  kc = 0;
76  depth = 0;
77  rho = 0;
78  dim_particle = 0;
79  logRestitution = 0;
80  useRestitution=false;
81  ForceType = Linear;
83  k0 = 0;
84  f0 = 0;
85  }
Mdouble k0
Definition: CSpecies.h:508
Mdouble k2max
Definition: CSpecies.h:500
Mdouble depth
Definition: CSpecies.h:502
Mdouble disptorsion
Definition: CSpecies.h:416
Mdouble mus
Definition: CSpecies.h:418
Mdouble disp
Definition: CSpecies.h:413
bool useRestitution
Definition: CSpecies.h:504
AdhesionForceTypes AdhesionForceType
Definition: CSpecies.h:507
Mdouble kt
Definition: CSpecies.h:410
Mdouble mu
Definition: CSpecies.h:417
Definition: CSpecies.h:30
int dim_particle
Definition: CSpecies.h:424
ForceTypes ForceType
Definition: CSpecies.h:506
Mdouble mustorsion
Definition: CSpecies.h:422
Mdouble k
Definition: CSpecies.h:409
Mdouble f0
Definition: CSpecies.h:509
Mdouble mutorsion
Definition: CSpecies.h:421
Mdouble murolling
Definition: CSpecies.h:419
Mdouble kc
Definition: CSpecies.h:501
Mdouble krolling
Definition: CSpecies.h:411
Mdouble logRestitution
Definition: CSpecies.h:503
Mdouble musrolling
Definition: CSpecies.h:420
Mdouble disprolling
Definition: CSpecies.h:415
Mdouble rho
Definition: CSpecies.h:423
Mdouble ktorsion
Definition: CSpecies.h:412
Mdouble dispt
Definition: CSpecies.h:414

Member Function Documentation

AdhesionForceTypes CSpecies::get_AdhesionForceType ( ) const
inline

Definition at line 438 of file CSpecies.h.

References AdhesionForceType.

439  {
440  return AdhesionForceType;
441  }
AdhesionForceTypes AdhesionForceType
Definition: CSpecies.h:507
Mdouble CSpecies::get_average ( Mdouble  a,
Mdouble  b 
)
inline

Definition at line 381 of file CSpecies.h.

Referenced by mix().

381  {
382  return (a+b) ? (2.*(a*b)/(a+b)) : 0;
383  }
Mdouble CSpecies::get_collision_time ( Mdouble  mass)
inline

Calculates collision time for two copies of a particle of given disp, k, mass.

Definition at line 312 of file CSpecies.h.

References disp, k, constants::pi, and sqr.

Referenced by get_restitution_coefficient().

312  {
313  if(mass<=0) {std::cerr << "Error in get_collision_time(Mdouble mass) mass is not set or has an unexpected value, (get_collision_time("<<mass<<"))"<< std::endl; exit(-1);}
314  if(k<=0) {std::cerr << "Error in get_collision_time(Mdouble mass) stiffness is not set or has an unexpected value, (get_collision_time("<<mass<<"), with stiffness="<<k<<")"<< std::endl; exit(-1);}
315  if(disp<0) {std::cerr << "Error in get_collision_time(Mdouble mass) dissipation is not set or has an unexpected value, (get_collision_time("<<mass<<"), with dissipation="<<disp<<")"<< std::endl; exit(-1);}
316  Mdouble tosqrt=k/(.5*mass) - sqr(disp/mass);
317  //~ std::cout<<"tosqrt "<<tosqrt<<" 1e "<<k/(.5*mass)<<" 2e "<<sqr(disp/mass)<<std::endl;
318  if (tosqrt<=0) {std::cerr << "Error in get_collision_time(Mdouble mass) values for mass, stiffness and dissipation would leads to an over damped system, (get_collision_time("<<mass<<"), with stiffness="<<k<<" and dissipation="<<disp<<")"<< std::endl; exit(-1);}
319  return constants::pi / sqrt( tosqrt );
320  }
Mdouble disp
Definition: CSpecies.h:413
#define sqr(a)
Definition: ExtendedMath.h:36
const Mdouble pi
Definition: ExtendedMath.h:54
double Mdouble
Definition: ExtendedMath.h:33
Mdouble k
Definition: CSpecies.h:409
Mdouble CSpecies::get_depth ( ) const
inline

Definition at line 490 of file CSpecies.h.

References depth.

Referenced by mix().

490 {return depth;}
Mdouble depth
Definition: CSpecies.h:502
int CSpecies::get_dim_particle ( ) const
inline

Allows the dimension of the particle (f.e. for mass) to be accessed.

Definition at line 205 of file CSpecies.h.

References dim_particle.

205 {return dim_particle;}
int dim_particle
Definition: CSpecies.h:424
Mdouble CSpecies::get_disp ( ) const
inline

Allows the normal dissipation to be accessed.

Definition at line 153 of file CSpecies.h.

References get_dissipation().

153 {return get_dissipation();}
Mdouble get_dissipation() const
Allows the normal dissipation to be accessed.
Definition: CSpecies.h:149
Mdouble CSpecies::get_disprolling ( ) const
inline

Allows the tangential viscosity to be accessed.

Definition at line 140 of file CSpecies.h.

References disprolling.

Referenced by mix().

140 {return disprolling;}
Mdouble disprolling
Definition: CSpecies.h:415
Mdouble CSpecies::get_dispt ( ) const
inline

Allows the tangential viscosity to be accessed.

Definition at line 136 of file CSpecies.h.

References dispt.

Referenced by mix().

136 {return dispt;}
Mdouble dispt
Definition: CSpecies.h:414
Mdouble CSpecies::get_disptorsion ( ) const
inline

Allows the tangential viscosity to be accessed.

Definition at line 144 of file CSpecies.h.

References disptorsion.

Referenced by mix().

144 {return disptorsion;}
Mdouble disptorsion
Definition: CSpecies.h:416
Mdouble CSpecies::get_dissipation ( ) const
inline

Allows the normal dissipation to be accessed.

Definition at line 149 of file CSpecies.h.

References disp.

Referenced by get_disp(), and mix().

149 {return disp;}
Mdouble disp
Definition: CSpecies.h:413
Mdouble CSpecies::get_f0 ( ) const
inline

Allows the spring constant to be accessed.

Definition at line 95 of file CSpecies.h.

References f0.

95 {return f0;}
Mdouble f0
Definition: CSpecies.h:509
ForceTypes CSpecies::get_ForceType ( ) const
inline

Definition at line 430 of file CSpecies.h.

References ForceType.

Referenced by MD::compute_internal_forces(), MD::compute_plastic_internal_forces(), and MD::compute_walls().

430 {return ForceType;}
ForceTypes ForceType
Definition: CSpecies.h:506
Mdouble CSpecies::get_InteractionDistance ( )
inline

Definition at line 97 of file CSpecies.h.

References AdhesionForceType, f0, k0, and None.

Referenced by BaseParticle::get_InteractionRadius(), and BaseParticle::get_WallInteractionRadius().

97  {
98  if (AdhesionForceType==None)
99  return 0.0;
100  else
101  return f0/k0;
102  }
Mdouble k0
Definition: CSpecies.h:508
AdhesionForceTypes AdhesionForceType
Definition: CSpecies.h:507
Definition: CSpecies.h:30
Mdouble f0
Definition: CSpecies.h:509
Mdouble CSpecies::get_k ( ) const
inline

Allows the spring constant to be accessed.

Definition at line 107 of file CSpecies.h.

References k.

Referenced by mix(), set_collision_time_and_normal_and_tangential_restitution_coefficient(), and set_collision_time_and_normal_and_tangential_restitution_coefficient_nodispt().

107 {return k;}
Mdouble k
Definition: CSpecies.h:409
Mdouble CSpecies::get_k0 ( ) const
inline

Allows the spring constant to be accessed.

Definition at line 90 of file CSpecies.h.

References k.

90 {return k;}
Mdouble k
Definition: CSpecies.h:409
Mdouble CSpecies::get_k1 ( ) const
inline

Definition at line 487 of file CSpecies.h.

References k.

487 {return k;}
Mdouble k
Definition: CSpecies.h:409
Mdouble CSpecies::get_k2max ( ) const
inline

Definition at line 488 of file CSpecies.h.

References k2max.

Referenced by mix().

488 {return k2max;}
Mdouble k2max
Definition: CSpecies.h:500
Mdouble CSpecies::get_kc ( ) const
inline

Definition at line 489 of file CSpecies.h.

References kc.

Referenced by mix().

489 {return kc;}
Mdouble kc
Definition: CSpecies.h:501
Mdouble CSpecies::get_krolling ( ) const
inline

Allows the spring constant to be accessed.

Definition at line 121 of file CSpecies.h.

References krolling.

Referenced by mix().

121 {return krolling;}
Mdouble krolling
Definition: CSpecies.h:411
Mdouble CSpecies::get_kt ( ) const
inline

Allows the spring constant to be accessed.

Definition at line 117 of file CSpecies.h.

References kt.

Referenced by mix(), and set_collision_time_and_normal_and_tangential_restitution_coefficient().

117 {return kt;}
Mdouble kt
Definition: CSpecies.h:410
Mdouble CSpecies::get_ktorsion ( ) const
inline

Allows the spring constant to be accessed.

Definition at line 125 of file CSpecies.h.

References ktorsion.

Referenced by mix().

125 {return ktorsion;}
Mdouble ktorsion
Definition: CSpecies.h:412
Mdouble CSpecies::get_logRestitution ( ) const
inline

Allows the normal dissipation to be accessed.

Definition at line 161 of file CSpecies.h.

References logRestitution.

161 {return logRestitution;}
Mdouble logRestitution
Definition: CSpecies.h:503
Mdouble CSpecies::get_maximum_velocity ( Mdouble  radius,
Mdouble  mass 
)
inline

Calculates the maximum velocity allowed for a collision of two copies of P (for higher velocities particles could pass through each other)

Definition at line 326 of file CSpecies.h.

References k.

326 {return radius * sqrt(k/(.5*mass));}
Mdouble k
Definition: CSpecies.h:409
Mdouble CSpecies::get_mu ( ) const
inline

Allows the (dynamic) Coulomb friction coefficient to be accessed.

Definition at line 176 of file CSpecies.h.

References mu.

Referenced by mix().

176 {return mu;}
Mdouble mu
Definition: CSpecies.h:417
Mdouble CSpecies::get_murolling ( ) const
inline

Allows the (dynamic) Coulomb friction coefficient to be accessed.

Definition at line 186 of file CSpecies.h.

References murolling.

Referenced by mix().

186 {return murolling;}
Mdouble murolling
Definition: CSpecies.h:419
Mdouble CSpecies::get_mus ( ) const
inline

Allows the static Coulomb friction coefficient to be accessed.

Definition at line 180 of file CSpecies.h.

References mus.

Referenced by mix().

180 {return mus;}
Mdouble mus
Definition: CSpecies.h:418
Mdouble CSpecies::get_musrolling ( ) const
inline

Allows the static Coulomb friction coefficient to be accessed.

Definition at line 190 of file CSpecies.h.

References musrolling.

Referenced by mix().

190 {return musrolling;}
Mdouble musrolling
Definition: CSpecies.h:420
Mdouble CSpecies::get_mustorsion ( ) const
inline

Allows the static Coulomb friction coefficient to be accessed.

Definition at line 200 of file CSpecies.h.

References mustorsion.

Referenced by mix().

200 {return mustorsion;}
Mdouble mustorsion
Definition: CSpecies.h:422
Mdouble CSpecies::get_mutorsion ( ) const
inline

Allows the (dynamic) Coulomb friction coefficient to be accessed.

Definition at line 196 of file CSpecies.h.

References mutorsion.

Referenced by mix().

196 {return mutorsion;}
Mdouble mutorsion
Definition: CSpecies.h:421
Mdouble CSpecies::get_plastic_dt ( Mdouble  mass)
inline

Calculates collision time for stiffest spring constant, divides by 50.

Definition at line 496 of file CSpecies.h.

References disp, k2max, constants::pi, and sqr.

496  {
497  return 0.02 * constants::pi / sqrt( k2max/(.5*mass) - sqr(disp/mass) );
498  }
Mdouble k2max
Definition: CSpecies.h:500
Mdouble disp
Definition: CSpecies.h:413
#define sqr(a)
Definition: ExtendedMath.h:36
const Mdouble pi
Definition: ExtendedMath.h:54
Mdouble CSpecies::get_restitution_coefficient ( Mdouble  mass)
inline

Calculates restitution coefficient for two copies of given disp, k, mass.

Definition at line 323 of file CSpecies.h.

References disp, and get_collision_time().

323 {return exp(-disp/mass*get_collision_time(mass));}
Mdouble disp
Definition: CSpecies.h:413
Mdouble get_collision_time(Mdouble mass)
Calculates collision time for two copies of a particle of given disp, k, mass.
Definition: CSpecies.h:312
Mdouble CSpecies::get_rho ( ) const
inline

Allows the density to be accessed.

Definition at line 131 of file CSpecies.h.

References rho.

131 {return rho;}
Mdouble rho
Definition: CSpecies.h:423
Mdouble CSpecies::get_useRestitution ( ) const
inline

Allows the normal dissipation to be accessed.

Definition at line 163 of file CSpecies.h.

References useRestitution.

163 {return useRestitution;}
bool useRestitution
Definition: CSpecies.h:504
void CSpecies::mix ( CSpecies S0,
CSpecies S1 
)
inline

create values for mixed species

Definition at line 386 of file CSpecies.h.

References depth, dim_particle, disp, disprolling, dispt, disptorsion, get_average(), get_depth(), get_disprolling(), get_dispt(), get_disptorsion(), get_dissipation(), get_k(), get_k2max(), get_kc(), get_krolling(), get_kt(), get_ktorsion(), get_mu(), get_murolling(), get_mus(), get_musrolling(), get_mustorsion(), get_mutorsion(), k, k2max, kc, krolling, kt, ktorsion, mu, murolling, mus, musrolling, mustorsion, mutorsion, and rho.

386  {
387  k = get_average(S0.get_k(),S1.get_k());
388  kt = get_average(S0.get_kt(),S1.get_kt());
392  dispt = get_average(S0.get_dispt(),S1.get_dispt());
395  mu = get_average(S0.get_mu(),S1.get_mu());
396  mus = get_average(S0.get_mus(),S1.get_mus());
401  k2max = get_average(S0.get_k2max(),S1.get_k2max());
402  kc = get_average(S0.get_kc(),S1.get_kc());
403  depth = get_average(S0.get_depth(),S1.get_depth());
404  rho = 0;
405  dim_particle = 0; //this will be used to distinguish a mixed species
406  }
Mdouble k2max
Definition: CSpecies.h:500
Mdouble get_kc() const
Definition: CSpecies.h:489
Mdouble get_dissipation() const
Allows the normal dissipation to be accessed.
Definition: CSpecies.h:149
Mdouble depth
Definition: CSpecies.h:502
Mdouble disptorsion
Definition: CSpecies.h:416
Mdouble get_mutorsion() const
Allows the (dynamic) Coulomb friction coefficient to be accessed.
Definition: CSpecies.h:196
Mdouble get_disptorsion() const
Allows the tangential viscosity to be accessed.
Definition: CSpecies.h:144
Mdouble get_kt() const
Allows the spring constant to be accessed.
Definition: CSpecies.h:117
Mdouble mus
Definition: CSpecies.h:418
Mdouble get_k2max() const
Definition: CSpecies.h:488
Mdouble disp
Definition: CSpecies.h:413
Mdouble get_musrolling() const
Allows the static Coulomb friction coefficient to be accessed.
Definition: CSpecies.h:190
Mdouble kt
Definition: CSpecies.h:410
Mdouble mu
Definition: CSpecies.h:417
int dim_particle
Definition: CSpecies.h:424
Mdouble get_ktorsion() const
Allows the spring constant to be accessed.
Definition: CSpecies.h:125
Mdouble get_k() const
Allows the spring constant to be accessed.
Definition: CSpecies.h:107
Mdouble get_disprolling() const
Allows the tangential viscosity to be accessed.
Definition: CSpecies.h:140
Mdouble mustorsion
Definition: CSpecies.h:422
Mdouble k
Definition: CSpecies.h:409
Mdouble get_mu() const
Allows the (dynamic) Coulomb friction coefficient to be accessed.
Definition: CSpecies.h:176
Mdouble get_dispt() const
Allows the tangential viscosity to be accessed.
Definition: CSpecies.h:136
Mdouble mutorsion
Definition: CSpecies.h:421
Mdouble murolling
Definition: CSpecies.h:419
Mdouble kc
Definition: CSpecies.h:501
Mdouble krolling
Definition: CSpecies.h:411
Mdouble get_depth() const
Definition: CSpecies.h:490
Mdouble get_average(Mdouble a, Mdouble b)
Definition: CSpecies.h:381
Mdouble get_mustorsion() const
Allows the static Coulomb friction coefficient to be accessed.
Definition: CSpecies.h:200
Mdouble musrolling
Definition: CSpecies.h:420
Mdouble get_krolling() const
Allows the spring constant to be accessed.
Definition: CSpecies.h:121
Mdouble disprolling
Definition: CSpecies.h:415
Mdouble rho
Definition: CSpecies.h:423
Mdouble get_mus() const
Allows the static Coulomb friction coefficient to be accessed.
Definition: CSpecies.h:180
Mdouble ktorsion
Definition: CSpecies.h:412
Mdouble get_murolling() const
Allows the (dynamic) Coulomb friction coefficient to be accessed.
Definition: CSpecies.h:186
Mdouble dispt
Definition: CSpecies.h:414
void CSpecies::print ( std::ostream &  os)
inline

Outputs species.

Definition at line 285 of file CSpecies.h.

References depth, dim_particle, disp, disprolling, dispt, disptorsion, k, k2max, kc, krolling, kt, ktorsion, mu, murolling, mus, musrolling, mustorsion, mutorsion, and rho.

285  {
286  os << "k:" << k
287  << ", disp:" << disp
288  << ", kt:" << kt;
289  if (krolling) os << ", krolling: " << krolling;
290  if (ktorsion) os << ", ktorsion: " << ktorsion;
291  os << ", dispt: " << dispt;
292  if (disprolling) os << ", disprolling: " << disprolling;
293  if (disptorsion) os << ", disptorsion: " << disptorsion;
294  os << ", mu: " << mu;
295  if (mu!=mus) os << ", mus: " << mus;
296  if (murolling) os << ", murolling: " << murolling;
297  if (murolling!=musrolling) os << ", musrolling: " << musrolling;
298  if (mutorsion) os << ", mutorsion: " << mutorsion;
299  if (mutorsion!=mustorsion) os << ", mustorsion: " << mustorsion;
300  os << ", k2max:" << k2max
301  << ", kc:" << kc
302  << ", depth:" << depth;
303  if (dim_particle) {
304  os << ", rho:" << rho
305  << ", dim_particle:" << dim_particle;
306  } else {
307  os << " (mixed)";
308  }
309  }
Mdouble k2max
Definition: CSpecies.h:500
Mdouble depth
Definition: CSpecies.h:502
Mdouble disptorsion
Definition: CSpecies.h:416
Mdouble mus
Definition: CSpecies.h:418
Mdouble disp
Definition: CSpecies.h:413
Mdouble kt
Definition: CSpecies.h:410
Mdouble mu
Definition: CSpecies.h:417
int dim_particle
Definition: CSpecies.h:424
Mdouble mustorsion
Definition: CSpecies.h:422
Mdouble k
Definition: CSpecies.h:409
Mdouble mutorsion
Definition: CSpecies.h:421
Mdouble murolling
Definition: CSpecies.h:419
Mdouble kc
Definition: CSpecies.h:501
Mdouble krolling
Definition: CSpecies.h:411
Mdouble musrolling
Definition: CSpecies.h:420
Mdouble disprolling
Definition: CSpecies.h:415
Mdouble rho
Definition: CSpecies.h:423
Mdouble ktorsion
Definition: CSpecies.h:412
Mdouble dispt
Definition: CSpecies.h:414
void CSpecies::read ( std::istream &  is)
inline

Definition at line 246 of file CSpecies.h.

References AdhesionForceType, depth, dim_particle, disp, disprolling, dispt, disptorsion, f0, k, k0, k2max, kc, krolling, kt, ktorsion, mu, murolling, mus, musrolling, mustorsion, mutorsion, and rho.

246  {
247  std::string dummy;
248  is >> dummy >> k
249  >> dummy >> disp
250  >> dummy >> kt >> dummy;
251  if (!strcmp(dummy.c_str(),"krolling")) is >> krolling >> dummy; else krolling = 0;
252  if (!strcmp(dummy.c_str(),"ktorsion")) is >> ktorsion >> dummy; else ktorsion = 0;
253  is >> dispt >> dummy;
254  if (!strcmp(dummy.c_str(),"disprolling")) is >> disprolling >> dummy; else disprolling = 0;
255  if (!strcmp(dummy.c_str(),"disptorsion")) is >> disptorsion >> dummy; else disptorsion = 0;
256  is >> mu >> dummy;
257  if (!strcmp(dummy.c_str(),"mus")) is >> mus >> dummy; else mus=mu;
258  if (!strcmp(dummy.c_str(),"murolling")) is >> murolling >> dummy; else murolling = 0;
259  if (!strcmp(dummy.c_str(),"musrolling")) is >> musrolling >> dummy; else musrolling = murolling;
260  if (!strcmp(dummy.c_str(),"mutorsion")) is >> mutorsion >> dummy; else mutorsion = 0;
261  if (!strcmp(dummy.c_str(),"mustorsion")) is >> mustorsion >> dummy; else mustorsion = mutorsion;
262 
263  // checks if plastic model parameters are included (for backward compability)
264  if (!strcmp(dummy.c_str(),"k2max")) {
265  is >> k2max
266  >> dummy >> kc
267  >> dummy >> depth
268  >> dummy;
269  }
270  if (!strcmp(dummy.c_str(),"AdhesionForceType")) {
271  unsigned int AFT;
272  is >> AFT;
274  is >> dummy >> k0
275  >> dummy >> f0
276  >> dummy;
277  }
278  is >> rho
279  >> dummy >> dim_particle;
280  //read rest of line
281  getline(is,dummy);
282  }
Mdouble k0
Definition: CSpecies.h:508
Mdouble k2max
Definition: CSpecies.h:500
Mdouble depth
Definition: CSpecies.h:502
Mdouble disptorsion
Definition: CSpecies.h:416
Mdouble mus
Definition: CSpecies.h:418
Mdouble disp
Definition: CSpecies.h:413
AdhesionForceTypes AdhesionForceType
Definition: CSpecies.h:507
Mdouble kt
Definition: CSpecies.h:410
Mdouble mu
Definition: CSpecies.h:417
int dim_particle
Definition: CSpecies.h:424
AdhesionForceTypes
Definition: CSpecies.h:30
Mdouble mustorsion
Definition: CSpecies.h:422
Mdouble k
Definition: CSpecies.h:409
Mdouble f0
Definition: CSpecies.h:509
Mdouble mutorsion
Definition: CSpecies.h:421
Mdouble murolling
Definition: CSpecies.h:419
Mdouble kc
Definition: CSpecies.h:501
Mdouble krolling
Definition: CSpecies.h:411
Mdouble musrolling
Definition: CSpecies.h:420
Mdouble disprolling
Definition: CSpecies.h:415
Mdouble rho
Definition: CSpecies.h:423
Mdouble ktorsion
Definition: CSpecies.h:412
Mdouble dispt
Definition: CSpecies.h:414
void CSpecies::set_AdhesionForceType ( AdhesionForceTypes  new_)
inline

Definition at line 443 of file CSpecies.h.

References AdhesionForceType, LinearIrreversible, LinearReversible, and None.

Referenced by set_AdhesionForceType().

444  {
445  AdhesionForceType=new_;
446  if (AdhesionForceType==None)
447  std::cout << "No adhesion activated" << std::endl;
449  std::cout << "Linear reversible adhesion activated" << std::endl;
451  std::cout << "Linear irreversible adhesion activated" << std::endl;
452  else
453  {
454  std::cerr << "Error: AdhesionForceType unknown" << std::endl;
455  exit (-1);
456  }
457  }
AdhesionForceTypes AdhesionForceType
Definition: CSpecies.h:507
Definition: CSpecies.h:30
void CSpecies::set_AdhesionForceType ( char  new_[])
inline

Definition at line 459 of file CSpecies.h.

References LinearIrreversible, LinearReversible, None, and set_AdhesionForceType().

460  {
461  if (!strcmp(new_,"None"))
463  else if (!strcmp(new_,"LinearReversible"))
465  else if (!strcmp(new_,"LinearIrreversible"))
467  else
468  {
469  std::cerr << "Error: AdhesionForceType unknown" << std::endl;
470  exit (-1);
471  }
472  }
void set_AdhesionForceType(AdhesionForceTypes new_)
Definition: CSpecies.h:443
Definition: CSpecies.h:30
void CSpecies::set_collision_time_and_normal_and_tangential_restitution_coefficient ( Mdouble  tc,
Mdouble  eps,
Mdouble  beta,
Mdouble  mass 
)
inline

Sets k, disp, kt, dispt such that it matches a given tc and eps for a collision of two particles of masses m0,m1.

Definition at line 351 of file CSpecies.h.

References get_k(), get_kt(), constants::pi, set_collision_time_and_restitution_coefficient(), set_dispt(), set_kt(), and sqr.

Referenced by set_collision_time_and_normal_and_tangential_restitution_coefficient().

351  {
353  //from Deen...Kuipers2006, eq. 43 and 30
354  set_kt(2.0/7.0*get_k()*(sqr(constants::pi)+sqr(log(beta)))/(sqr(constants::pi)+sqr(log(eps))));
355  if (beta) set_dispt(-2*log(beta)*sqrt(1.0/7.0*mass*get_kt()/(sqr(constants::pi)+sqr(log(beta)))));
356  else set_dispt(2.*sqrt(1.0/7.0*mass*get_kt()));
357  }
Mdouble get_kt() const
Allows the spring constant to be accessed.
Definition: CSpecies.h:117
#define sqr(a)
Definition: ExtendedMath.h:36
void set_dispt(Mdouble new_dispt)
Allows the tangential viscosity to be changed.
Definition: CSpecies.h:134
void set_kt(Mdouble new_kt)
Allows the spring constant to be changed.
Definition: CSpecies.h:115
Mdouble get_k() const
Allows the spring constant to be accessed.
Definition: CSpecies.h:107
void set_collision_time_and_restitution_coefficient(Mdouble tc, Mdouble eps, Mdouble mass)
Sets k, disp such that it matches a given tc and eps for a collision of two copies of equal mass m...
Definition: CSpecies.h:336
const Mdouble pi
Definition: ExtendedMath.h:54
void CSpecies::set_collision_time_and_normal_and_tangential_restitution_coefficient ( Mdouble  tc,
Mdouble  eps,
Mdouble  beta,
Mdouble  mass1,
Mdouble  mass2 
)
inline

Sets k, disp, kt, dispt such that it matches a given tc and eps for a collision of two particles of equal mass m.

Definition at line 368 of file CSpecies.h.

References set_collision_time_and_normal_and_tangential_restitution_coefficient().

369  {
370  Mdouble reduced_mass = mass1*mass2/(mass1+mass2);
372  }
void set_collision_time_and_normal_and_tangential_restitution_coefficient(Mdouble tc, Mdouble eps, Mdouble beta, Mdouble mass)
Sets k, disp, kt, dispt such that it matches a given tc and eps for a collision of two particles of m...
Definition: CSpecies.h:351
double Mdouble
Definition: ExtendedMath.h:33
void CSpecies::set_collision_time_and_normal_and_tangential_restitution_coefficient_nodispt ( Mdouble  tc,
Mdouble  eps,
Mdouble  beta,
Mdouble  mass 
)
inline

Sets k, disp, kt, dispt such that it matches a given tc and eps for a collision of two particles of masses m0,m1.

Definition at line 360 of file CSpecies.h.

References get_k(), constants::pi, set_collision_time_and_restitution_coefficient(), set_dispt(), set_kt(), and sqr.

Referenced by set_collision_time_and_normal_and_tangential_restitution_coefficient_nodispt().

360  {
362  //from BeckerSchwagerPoeschel2008, eq. 56
363  set_kt(2.0/7.0*get_k()*sqr(acos(-beta)/constants::pi));
364  set_dispt(0);
365  }
#define sqr(a)
Definition: ExtendedMath.h:36
void set_dispt(Mdouble new_dispt)
Allows the tangential viscosity to be changed.
Definition: CSpecies.h:134
void set_kt(Mdouble new_kt)
Allows the spring constant to be changed.
Definition: CSpecies.h:115
Mdouble get_k() const
Allows the spring constant to be accessed.
Definition: CSpecies.h:107
void set_collision_time_and_restitution_coefficient(Mdouble tc, Mdouble eps, Mdouble mass)
Sets k, disp such that it matches a given tc and eps for a collision of two copies of equal mass m...
Definition: CSpecies.h:336
const Mdouble pi
Definition: ExtendedMath.h:54
void CSpecies::set_collision_time_and_normal_and_tangential_restitution_coefficient_nodispt ( Mdouble  tc,
Mdouble  eps,
Mdouble  beta,
Mdouble  mass1,
Mdouble  mass2 
)
inline

Sets k, disp, kt, dispt such that it matches a given tc and eps for a collision of two particles of equal mass m.

Definition at line 375 of file CSpecies.h.

References set_collision_time_and_normal_and_tangential_restitution_coefficient_nodispt().

376  {
377  Mdouble reduced_mass = mass1*mass2/(mass1+mass2);
379  }
void set_collision_time_and_normal_and_tangential_restitution_coefficient_nodispt(Mdouble tc, Mdouble eps, Mdouble beta, Mdouble mass)
Sets k, disp, kt, dispt such that it matches a given tc and eps for a collision of two particles of m...
Definition: CSpecies.h:360
double Mdouble
Definition: ExtendedMath.h:33
void CSpecies::set_collision_time_and_restitution_coefficient ( Mdouble  tc,
Mdouble  eps,
Mdouble  mass 
)
inline

Sets k, disp such that it matches a given tc and eps for a collision of two copies of equal mass m.

Definition at line 336 of file CSpecies.h.

References disp, k, constants::pi, and sqr.

Referenced by set_collision_time_and_normal_and_tangential_restitution_coefficient(), set_collision_time_and_normal_and_tangential_restitution_coefficient_nodispt(), and set_collision_time_and_restitution_coefficient().

336  {
337  disp = - mass / tc * log(eps);
338  k = .5 * mass * (sqr(constants::pi/tc) + sqr(disp/mass));
339  }
Mdouble disp
Definition: CSpecies.h:413
#define sqr(a)
Definition: ExtendedMath.h:36
const Mdouble pi
Definition: ExtendedMath.h:54
Mdouble k
Definition: CSpecies.h:409
void CSpecies::set_collision_time_and_restitution_coefficient ( Mdouble  tc,
Mdouble  eps,
Mdouble  mass1,
Mdouble  mass2 
)
inline

Set k, disp such that is matches a given tc and eps for a collision of two different masses.

Recall the resitution constant is a function of k, disp and the mass of each particle in the collision See also set_collision_time_and_restitution_coefficient(Mdouble tc, Mdouble eps, Mdouble mass)

Definition at line 344 of file CSpecies.h.

References set_collision_time_and_restitution_coefficient().

345  {
346  Mdouble reduced_mass = mass1*mass2/(mass1+mass2);
347  set_collision_time_and_restitution_coefficient(tc,eps,2.0*reduced_mass);
348  }
void set_collision_time_and_restitution_coefficient(Mdouble tc, Mdouble eps, Mdouble mass)
Sets k, disp such that it matches a given tc and eps for a collision of two copies of equal mass m...
Definition: CSpecies.h:336
double Mdouble
Definition: ExtendedMath.h:33
void CSpecies::set_depth ( Mdouble  new_)
inline

Definition at line 494 of file CSpecies.h.

References depth.

Referenced by set_plastic_k1_k2max_kc_depth().

494 {depth = new_;}
Mdouble depth
Definition: CSpecies.h:502
void CSpecies::set_dim_particle ( int  new_dim)
inline

Allows the dimension of the particle (f.e. for mass) to be changed.

Definition at line 203 of file CSpecies.h.

References dim_particle.

203 {if (new_dim>=1 && new_dim<=3) dim_particle = new_dim; else { std::cerr << "Error in set_dim_particle" << std::endl; exit(-1); }}
int dim_particle
Definition: CSpecies.h:424
void CSpecies::set_disp ( Mdouble  new_disp)
inline

Allows the normal dissipation to be changed.

Definition at line 151 of file CSpecies.h.

References set_dissipation().

Referenced by set_k_and_disp(), and set_k_and_disp_and_kt_and_dispt().

151 {set_dissipation(new_disp);}
void set_dissipation(Mdouble new_disp)
Allows the normal dissipation to be changed.
Definition: CSpecies.h:147
void CSpecies::set_disprolling ( Mdouble  new_disprolling)
inline

Allows the tangential viscosity to be changed.

Definition at line 138 of file CSpecies.h.

References disprolling.

138 {if (new_disprolling>=0) disprolling = new_disprolling; else { std::cerr << "Error in set_disprolling" << std::endl; exit(-1); }}
Mdouble disprolling
Definition: CSpecies.h:415
void CSpecies::set_dispt ( Mdouble  new_dispt)
inline

Allows the tangential viscosity to be changed.

Definition at line 134 of file CSpecies.h.

References dispt.

Referenced by set_collision_time_and_normal_and_tangential_restitution_coefficient(), set_collision_time_and_normal_and_tangential_restitution_coefficient_nodispt(), and set_k_and_disp_and_kt_and_dispt().

134 {if (new_dispt>=0) dispt = new_dispt; else { std::cerr << "Error in set_dispt" << std::endl; exit(-1); }}
Mdouble dispt
Definition: CSpecies.h:414
void CSpecies::set_disptorsion ( Mdouble  new_disptorsion)
inline

Allows the tangential viscosity to be changed.

Definition at line 142 of file CSpecies.h.

References disptorsion.

142 {if (new_disptorsion>=0) disptorsion = new_disptorsion; else { std::cerr << "Error in set_disptorsion" << std::endl; exit(-1); }}
Mdouble disptorsion
Definition: CSpecies.h:416
void CSpecies::set_dissipation ( Mdouble  new_disp)
inline

Allows the normal dissipation to be changed.

Definition at line 147 of file CSpecies.h.

References disp, and useRestitution.

Referenced by set_disp().

147 {if(new_disp>=0) {useRestitution=false; disp=new_disp;} else { std::cerr << "Error in set_dissipation(" << new_disp << ")" << std::endl; exit(-1); }}
Mdouble disp
Definition: CSpecies.h:413
bool useRestitution
Definition: CSpecies.h:504
void CSpecies::set_f0 ( Mdouble  new_f0)
inline

Allows the spring constant to be changed.

Definition at line 93 of file CSpecies.h.

References f0.

93 {if(new_f0>=0) f0=new_f0; else { std::cerr << "Error in set_f0" << std::endl; exit(-1); }}
Mdouble f0
Definition: CSpecies.h:509
void CSpecies::set_ForceType ( ForceTypes  new_)
inline

Definition at line 431 of file CSpecies.h.

References ForceType, Hertzian, HM, HMD, and Linear.

431  {ForceType=new_;
432  if (ForceType==Hertzian) std::cout << "Hertzian law activated" << std::endl;
433  else if (ForceType==HMD) std::cout << "Hertz-Mindlin-Deresiewicz law activated" << std::endl;
434  else if (ForceType==HM) std::cout << "Hertz-Mindlin law activated" << std::endl;
435  else if (ForceType==Linear) std::cout << "Linear law activated" << std::endl;
436  }
Definition: CSpecies.h:29
ForceTypes ForceType
Definition: CSpecies.h:506
Definition: CSpecies.h:29
void CSpecies::set_k ( Mdouble  new_k)
inline

Allows the spring constant to be changed.

Definition at line 105 of file CSpecies.h.

References k.

Referenced by set_k_and_disp(), and set_k_and_disp_and_kt_and_dispt().

105 {if(new_k>=0) k=new_k; else { std::cerr << "Error in set_k" << std::endl; exit(-1); }}
Mdouble k
Definition: CSpecies.h:409
void CSpecies::set_k0 ( Mdouble  new_k0)
inline

Allows the spring constant to be changed.

Definition at line 88 of file CSpecies.h.

References k0.

88 {if(new_k0>=0) k0=new_k0; else { std::cerr << "Error in set_k0" << std::endl; exit(-1); }}
Mdouble k0
Definition: CSpecies.h:508
void CSpecies::set_k1 ( Mdouble  new_)
inline

Definition at line 491 of file CSpecies.h.

References k.

Referenced by set_plastic_k1_k2max_kc_depth().

491 {k = new_;}
Mdouble k
Definition: CSpecies.h:409
void CSpecies::set_k2max ( Mdouble  new_)
inline

Definition at line 492 of file CSpecies.h.

References k2max.

Referenced by set_plastic_k1_k2max_kc_depth().

492 {k2max = new_;}
Mdouble k2max
Definition: CSpecies.h:500
void CSpecies::set_k_and_disp ( helperFunc::KAndDisp  new_)
inline

Allows the spring and dissipation constants to be changed simultaneously.

Definition at line 110 of file CSpecies.h.

References helperFunc::KAndDisp::disp, helperFunc::KAndDisp::k, set_disp(), and set_k().

110 {set_k(new_.k); set_disp(new_.disp); }
void set_k(Mdouble new_k)
Allows the spring constant to be changed.
Definition: CSpecies.h:105
void set_disp(Mdouble new_disp)
Allows the normal dissipation to be changed.
Definition: CSpecies.h:151
void CSpecies::set_k_and_disp_and_kt_and_dispt ( helperFunc::KAndDispAndKtAndDispt  new_)
inline

Allows the normal and tangential spring and dissipation constants to be changed simultaneously.

Definition at line 112 of file CSpecies.h.

References helperFunc::KAndDispAndKtAndDispt::disp, helperFunc::KAndDispAndKtAndDispt::dispt, helperFunc::KAndDispAndKtAndDispt::k, helperFunc::KAndDispAndKtAndDispt::kt, set_disp(), set_dispt(), set_k(), and set_kt().

112 {set_k(new_.k); set_disp(new_.disp); set_kt(new_.kt); set_dispt(new_.dispt); }
void set_k(Mdouble new_k)
Allows the spring constant to be changed.
Definition: CSpecies.h:105
void set_dispt(Mdouble new_dispt)
Allows the tangential viscosity to be changed.
Definition: CSpecies.h:134
void set_kt(Mdouble new_kt)
Allows the spring constant to be changed.
Definition: CSpecies.h:115
void set_disp(Mdouble new_disp)
Allows the normal dissipation to be changed.
Definition: CSpecies.h:151
void CSpecies::set_k_and_restitution_coefficient ( Mdouble  k_,
Mdouble  eps,
Mdouble  mass 
)
inline

Sets k, disp such that it matches a given tc and eps for a collision of two copies of P.

Todo:
check all instances of constants::sqrt_pi

Definition at line 329 of file CSpecies.h.

References disp, k, sqr, and constants::sqr_pi.

329  {
330  k = k_;
332  disp = - sqrt(2.0*mass*k/(constants::sqr_pi+sqr(log(eps)))) * log(eps);
333  }
Mdouble disp
Definition: CSpecies.h:413
#define sqr(a)
Definition: ExtendedMath.h:36
Mdouble k
Definition: CSpecies.h:409
const Mdouble sqr_pi
Definition: ExtendedMath.h:56
void CSpecies::set_kc ( Mdouble  new_)
inline

Definition at line 493 of file CSpecies.h.

References kc.

Referenced by set_plastic_k1_k2max_kc_depth().

493 {kc = new_;}
Mdouble kc
Definition: CSpecies.h:501
void CSpecies::set_krolling ( Mdouble  new_k)
inline

Allows the spring constant to be changed.

Definition at line 119 of file CSpecies.h.

References krolling.

119 {if(new_k>=0) {krolling=new_k;} else { std::cerr << "Error in set_krolling" << std::endl; exit(-1); }}
Mdouble krolling
Definition: CSpecies.h:411
void CSpecies::set_kt ( Mdouble  new_kt)
inline

Allows the spring constant to be changed.

Definition at line 115 of file CSpecies.h.

References kt.

Referenced by set_collision_time_and_normal_and_tangential_restitution_coefficient(), set_collision_time_and_normal_and_tangential_restitution_coefficient_nodispt(), and set_k_and_disp_and_kt_and_dispt().

115 {if(new_kt>=0) {kt=new_kt;} else { std::cerr << "Error in set_kt" << std::endl; exit(-1); }}
Mdouble kt
Definition: CSpecies.h:410
void CSpecies::set_ktorsion ( Mdouble  new_k)
inline

Allows the spring constant to be changed.

Definition at line 123 of file CSpecies.h.

References ktorsion.

123 {if(new_k>=0) {ktorsion=new_k;} else { std::cerr << "Error in set_ktorsion" << std::endl; exit(-1); }}
Mdouble ktorsion
Definition: CSpecies.h:412
void CSpecies::set_mu ( Mdouble  new_mu)
inline

Allows the (dynamic) Coulomb friction coefficient to be changed; also sets mu_s by default.

Definition at line 174 of file CSpecies.h.

References mu, and mus.

174 {if (new_mu>=0) {mu = new_mu; mus = mu;} else { std::cerr << "Error in set_mu" << std::endl; exit(-1); }}
Mdouble mus
Definition: CSpecies.h:418
Mdouble mu
Definition: CSpecies.h:417
void CSpecies::set_murolling ( Mdouble  new_murolling)
inline

Allows the (dynamic) Coulomb friction coefficient to be changed; also sets murolling_s by default.

Definition at line 184 of file CSpecies.h.

References murolling, and musrolling.

184 {if (new_murolling>=0) {murolling = new_murolling; musrolling = murolling;} else { std::cerr << "Error in set_murolling" << std::endl; exit(-1); }}
Mdouble murolling
Definition: CSpecies.h:419
Mdouble musrolling
Definition: CSpecies.h:420
void CSpecies::set_mus ( Mdouble  new_mu)
inline

Allows the static Coulomb friction coefficient to be changed.

Definition at line 178 of file CSpecies.h.

References mus.

178 {if (new_mu>=0) {mus = new_mu;} else { std::cerr << "Error in set_mus" << std::endl; exit(-1); }}
Mdouble mus
Definition: CSpecies.h:418
void CSpecies::set_musrolling ( Mdouble  new_mu)
inline

Allows the static Coulomb friction coefficient to be changed.

Definition at line 188 of file CSpecies.h.

References musrolling.

188 {if (new_mu>=0) {musrolling = new_mu;} else { std::cerr << "Error in set_musrolling" << std::endl; exit(-1); }}
Mdouble musrolling
Definition: CSpecies.h:420
void CSpecies::set_mustorsion ( Mdouble  new_mu)
inline

Allows the static Coulomb friction coefficient to be changed.

Definition at line 198 of file CSpecies.h.

References mustorsion.

198 {if (new_mu>=0) {mustorsion = new_mu;} else { std::cerr << "Error in set_mustorsion" << std::endl; exit(-1); }}
Mdouble mustorsion
Definition: CSpecies.h:422
void CSpecies::set_mutorsion ( Mdouble  new_mu)
inline

Allows the (dynamic) Coulomb friction coefficient to be changed; also sets mu_s by default.

Definition at line 194 of file CSpecies.h.

References mustorsion, and mutorsion.

194 {if (new_mu>=0) {mutorsion = new_mu; mustorsion = mutorsion;} else { std::cerr << "Error in set_mutorsion" << std::endl; exit(-1); }}
Mdouble mustorsion
Definition: CSpecies.h:422
Mdouble mutorsion
Definition: CSpecies.h:421
void CSpecies::set_plastic_k1_k2max_kc_depth ( Mdouble  k1_,
Mdouble  k2max_,
Mdouble  kc_,
Mdouble  depth_ 
)
inline

Acccess functions for the plastic model.

Definition at line 476 of file CSpecies.h.

References set_depth(), set_k1(), set_k2max(), and set_kc().

476  {
477  if (k1_<=0 || k2max_<k1_ || kc_<0 || depth_<0 || depth_>1) {
478  std::cerr << "Error: arguments of set_plastic_k1_k2max_kc_depth do not make sense" << std::endl;
479  exit(-1);
480  }
481  set_k1(k1_);
482  set_k2max(k2max_);
483  set_kc(kc_);
484  set_depth(depth_);
485  }
void set_k1(Mdouble new_)
Definition: CSpecies.h:491
void set_kc(Mdouble new_)
Definition: CSpecies.h:493
void set_k2max(Mdouble new_)
Definition: CSpecies.h:492
void set_depth(Mdouble new_)
Definition: CSpecies.h:494
void CSpecies::set_restitution ( Mdouble  new_)
inline

Allows the normal dissipation to be changed.

Definition at line 157 of file CSpecies.h.

References logRestitution, and useRestitution.

157  {if(new_>=0) {useRestitution=true; logRestitution=log(new_);} else { std::cerr << "Error in set_dissipation(" << new_ << ")" << std::endl; exit(-1); }
158  //std::cout << "restitution " << exp(logRestitution) << std::endl;
159 }
bool useRestitution
Definition: CSpecies.h:504
Mdouble logRestitution
Definition: CSpecies.h:503
void CSpecies::set_rho ( Mdouble  new_rho)
inline
Todo:
recalculate masses when setting dim_particle or rho Allows the density to be changed

Definition at line 129 of file CSpecies.h.

References rho.

129 {if(new_rho>=0) rho=new_rho; else { std::cerr << "Error in set_rho" << std::endl; exit(-1); }}
Mdouble rho
Definition: CSpecies.h:423
void CSpecies::update_disp ( Mdouble  mass1,
Mdouble  mass2 
)
inline
Todo:
check for rest. =0

Definition at line 165 of file CSpecies.h.

References disp, k, logRestitution, constants::pi, and sqr.

Referenced by MD::compute_internal_forces(), MD::compute_plastic_internal_forces(), and MD::compute_walls().

165  {
166  Mdouble reducedMass = mass1*mass2/(mass1+mass2);
168  disp = - sqrt( 4.0*reducedMass*k/(sqr(constants::pi)+sqr(logRestitution)) ) * logRestitution;
169  //std::cout << "disp " << disp << " reducedMass " << mass1 << " " << mass2 << std::endl;
170  }
Mdouble disp
Definition: CSpecies.h:413
#define sqr(a)
Definition: ExtendedMath.h:36
const Mdouble pi
Definition: ExtendedMath.h:54
double Mdouble
Definition: ExtendedMath.h:33
Mdouble k
Definition: CSpecies.h:409
Mdouble logRestitution
Definition: CSpecies.h:503

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const CSpecies s 
)
friend

Writes all species data.

Definition at line 208 of file CSpecies.h.

208  {
209  os << "k " << s.k
210  << " disp " << s.disp
211  << " kt " << s.kt;
212  if (s.krolling) os << " krolling " << s.krolling;
213  if (s.ktorsion) os << " ktorsion " << s.ktorsion;
214  os << " dispt " << s.dispt;
215  if (s.disprolling) os << " disprolling " << s.disprolling;
216  if (s.disptorsion) os << " disptorsion " << s.disptorsion;
217  os << " mu " << s.mu;
218  //optional output
219  if (s.mu!=s.mus) os << " mus " << s.mus;
220  if (s.murolling) os << " murolling " << s.murolling;
221  if (s.murolling!=s.musrolling) os << " musrolling " << s.musrolling;
222  if (s.mutorsion) os << " mutorsion " << s.mutorsion;
223  if (s.mutorsion!=s.mustorsion) os << " mustorsion " << s.mustorsion;
224  if (s.depth) {
225  os << " k2max " << s.k2max
226  << " kc " << s.kc
227  << " depth " << s.depth;
228  }
229  if (s.AdhesionForceType!=None) {
230  os << " AdhesionForceType " << (unsigned int)s.AdhesionForceType
231  << " k0 " << s.k0
232  << " f0 " << s.f0;
233  }
234  os << " rho " << s.rho
235  << " dim_particle " << s.dim_particle;
236  return os;
237  }
Mdouble k0
Definition: CSpecies.h:508
Mdouble k2max
Definition: CSpecies.h:500
Mdouble depth
Definition: CSpecies.h:502
Mdouble disptorsion
Definition: CSpecies.h:416
Mdouble mus
Definition: CSpecies.h:418
Mdouble disp
Definition: CSpecies.h:413
AdhesionForceTypes AdhesionForceType
Definition: CSpecies.h:507
Mdouble kt
Definition: CSpecies.h:410
Mdouble mu
Definition: CSpecies.h:417
Definition: CSpecies.h:30
int dim_particle
Definition: CSpecies.h:424
Mdouble mustorsion
Definition: CSpecies.h:422
Mdouble k
Definition: CSpecies.h:409
Mdouble f0
Definition: CSpecies.h:509
Mdouble mutorsion
Definition: CSpecies.h:421
Mdouble murolling
Definition: CSpecies.h:419
Mdouble kc
Definition: CSpecies.h:501
Mdouble krolling
Definition: CSpecies.h:411
Mdouble musrolling
Definition: CSpecies.h:420
Mdouble disprolling
Definition: CSpecies.h:415
Mdouble rho
Definition: CSpecies.h:423
Mdouble ktorsion
Definition: CSpecies.h:412
Mdouble dispt
Definition: CSpecies.h:414
std::istream& operator>> ( std::istream &  is,
CSpecies s 
)
friend

Reads all species data.

Definition at line 240 of file CSpecies.h.

240  {
241  is >> s.k >> s.disp >> s.kt >> s.krolling >> s.ktorsion >> s.dispt >> s.disprolling >> s.disptorsion >> s.mu >> s.mus >> s.murolling >> s.musrolling >> s.mutorsion >> s.mustorsion >> s.k2max >> s.kc >> s.depth >> s.rho >> s.dim_particle;
242  //s.mus=s.mu;
243  return is;
244  }
Mdouble k2max
Definition: CSpecies.h:500
Mdouble depth
Definition: CSpecies.h:502
Mdouble disptorsion
Definition: CSpecies.h:416
Mdouble mus
Definition: CSpecies.h:418
Mdouble disp
Definition: CSpecies.h:413
Mdouble kt
Definition: CSpecies.h:410
Mdouble mu
Definition: CSpecies.h:417
int dim_particle
Definition: CSpecies.h:424
Mdouble mustorsion
Definition: CSpecies.h:422
Mdouble k
Definition: CSpecies.h:409
Mdouble mutorsion
Definition: CSpecies.h:421
Mdouble murolling
Definition: CSpecies.h:419
Mdouble kc
Definition: CSpecies.h:501
Mdouble krolling
Definition: CSpecies.h:411
Mdouble musrolling
Definition: CSpecies.h:420
Mdouble disprolling
Definition: CSpecies.h:415
Mdouble rho
Definition: CSpecies.h:423
Mdouble ktorsion
Definition: CSpecies.h:412
Mdouble dispt
Definition: CSpecies.h:414

Member Data Documentation

Mdouble CSpecies::depth
int CSpecies::dim_particle

Definition at line 424 of file CSpecies.h.

Referenced by CSpecies(), get_dim_particle(), mix(), print(), read(), and set_dim_particle().

Mdouble CSpecies::disprolling
Mdouble CSpecies::disptorsion
ForceTypes CSpecies::ForceType

Definition at line 506 of file CSpecies.h.

Referenced by CSpecies(), get_ForceType(), and set_ForceType().

Mdouble CSpecies::k2max
Mdouble CSpecies::kc

Definition at line 501 of file CSpecies.h.

Referenced by MD::compute_plastic_internal_forces(), CSpecies(), get_kc(), mix(), print(), read(), and set_kc().

Mdouble CSpecies::krolling
Mdouble CSpecies::ktorsion
Mdouble CSpecies::logRestitution

Definition at line 503 of file CSpecies.h.

Referenced by CSpecies(), get_logRestitution(), set_restitution(), and update_disp().

std::vector<CSpecies> CSpecies::MixedSpecies

Definition at line 425 of file CSpecies.h.

Mdouble CSpecies::murolling
Mdouble CSpecies::mutorsion
Mdouble CSpecies::rho

Definition at line 423 of file CSpecies.h.

Referenced by CSpecies(), get_rho(), mix(), print(), read(), and set_rho().


The documentation for this class was generated from the following file: