MercuryDPM  0.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
helperFunc Namespace Reference

Classes

class  KAndDisp
 return type specifically for fuctions returning k and disp at once More...
 
class  KAndDispAndKtAndDispt
 return type specifically for fuctions returning k, disp, kt, dispt at once More...
 

Functions

KAndDisp computeKAndDispFromCollisionTimeAndRestitutionCoefficientAndEffectiveMass (Mdouble tc, Mdouble r, Mdouble mass)
 Set disp and k such that is matches a given collision time tc and restitution coefficient r for a collision of effective/reduced mass m. More...
 
KAndDispAndKtAndDispt computeDisptFromCollisionTimeAndRestitutionCoefficientAndTangentialRestitutionCoefficientAndEffectiveMass (Mdouble tc, Mdouble r, Mdouble beta, Mdouble mass)
 Set disp, k, dispt and kt such that is matches a given collision time tc and a normal andtangential restitution coefficient r, beta for a collision of effective/reduced mass m. More...
 
Mdouble getCollisionTime (Mdouble k, Mdouble disp, Mdouble mass)
 Calculates collision time for two copies of a particle of given disp, k, effective mass. More...
 
Mdouble getRestitutionCoefficient (Mdouble k, Mdouble disp, Mdouble mass)
 Calculates restitution coefficient for two copies of given disp, k, effective mass. More...
 
Mdouble getMaximumVelocity (Mdouble k, Mdouble disp, Mdouble radius, Mdouble mass)
 Calculates the maximum relative velocity allowed for a normal collision of two particles of radius r and particle mass m (for higher velocities particles could pass through each other) More...
 

Function Documentation

helperFunc::KAndDispAndKtAndDispt helperFunc::computeDisptFromCollisionTimeAndRestitutionCoefficientAndTangentialRestitutionCoefficientAndEffectiveMass ( Mdouble  tc,
Mdouble  r,
Mdouble  beta,
Mdouble  mass 
)

Set disp, k, dispt and kt such that is matches a given collision time tc and a normal andtangential restitution coefficient r, beta for a collision of effective/reduced mass m.

from Deen...Kuipers2006, eq. 43 and 30

From Deen...Kuipers2006, eq. 43 and 30

Definition at line 221 of file ExtendedMath.cc.

References helperFunc::KAndDispAndKtAndDispt::disp, helperFunc::KAndDispAndKtAndDispt::dispt, helperFunc::KAndDispAndKtAndDispt::k, helperFunc::KAndDispAndKtAndDispt::kt, constants::pi, and sqr.

222 {
224  ans.disp = - 2.0 * mass * log(r) / tc;
225  ans.k = mass * (sqr(constants::pi/tc) + sqr(ans.disp/(2.0*mass)));
226  ans.kt = 2.0/7.0*ans.k*(sqr(constants::pi)+sqr(log(beta)))/(sqr(constants::pi)+sqr(log(r)));
227  if (beta!=0.0) ans.dispt = -2*log(beta)*sqrt(1.0/7.0*mass*ans.kt/(sqr(constants::pi)+sqr(log(beta))));
228  else ans.dispt = 2.*sqrt(1.0/7.0*mass*ans.kt);
229  return ans;
230 }
#define sqr(a)
Definition: ExtendedMath.h:36
const Mdouble pi
Definition: ExtendedMath.h:54
return type specifically for fuctions returning k, disp, kt, dispt at once
Definition: ExtendedMath.h:110
helperFunc::KAndDisp helperFunc::computeKAndDispFromCollisionTimeAndRestitutionCoefficientAndEffectiveMass ( Mdouble  tc,
Mdouble  r,
Mdouble  mass 
)

Set disp and k such that is matches a given collision time tc and restitution coefficient r for a collision of effective/reduced mass m.

Definition at line 212 of file ExtendedMath.cc.

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

213 {
215  ans.disp = - 2.0 * mass * std::log(r) / tc;
216  ans.k = mass * (sqr(constants::pi/tc) + sqr(ans.disp/(2.0*mass)));
217  return ans;
218 }
return type specifically for fuctions returning k and disp at once
Definition: ExtendedMath.h:98
#define sqr(a)
Definition: ExtendedMath.h:36
const Mdouble pi
Definition: ExtendedMath.h:54
Mdouble helperFunc::getCollisionTime ( Mdouble  k,
Mdouble  disp,
Mdouble  mass 
)

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

Definition at line 232 of file ExtendedMath.cc.

References constants::pi, and sqr.

Referenced by getRestitutionCoefficient().

233 {
234 
235  //check for errors in input
236  if(mass<=0)
237  {
238  std::cerr << "Error in get_collision_time(Mdouble mass) mass is not set or has an unexpected value, (get_collision_time("<<mass<<"))"<< std::endl;
239  exit(-1);
240  }
241  if(k<=0)
242  {
243  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;
244  exit(-1);
245  }
246  if(disp<0)
247  {
248  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;
249  exit(-1);
250  }
251 
252  //calculate square of oscillation frequency
253  Mdouble w2=k/mass - sqr(disp/(2.0*mass));
254 
255  if (w2<=0)
256  {
257  std::cerr << "Error in get_collision_time(Mdouble mass) values for mass, stiffness and dissipation lead to an over-damped system, (get_collision_time("<<mass<<"), with stiffness="<<k<<" and dissipation="<<disp<<")"<< std::endl;
258  exit(-1);
259  }
260 
261  return constants::pi / sqrt( w2 );
262 }
#define sqr(a)
Definition: ExtendedMath.h:36
const Mdouble pi
Definition: ExtendedMath.h:54
double Mdouble
Definition: ExtendedMath.h:33
Mdouble helperFunc::getMaximumVelocity ( Mdouble  k,
Mdouble  disp,
Mdouble  radius,
Mdouble  mass 
)

Calculates the maximum relative velocity allowed for a normal collision of two particles of radius r and particle mass m (for higher velocities particles could pass through each other)

Definition at line 269 of file ExtendedMath.cc.

References sqr.

270 {
271  // note: underestimate based on energy argument,
272  // Ekin = 2*1/2*m*(v/2)^2 = 1/2*k*(2*r)^2, gives
273  // return radius * sqrt(8.0*k/mass);
274 
275  // with dissipation, see S. Luding, Collisions & Contacts between two particles, eq 34
276  Mdouble w = sqrt(k/mass - sqr(disp/(2.0*mass)));
277  Mdouble w0 = sqrt(k/mass);
278  Mdouble DispCorrection = exp(-disp/mass/w)*asin(w/w0);
279  //std::cout << "DispCorrection" << DispCorrection << std::endl;
280  return radius * sqrt(8.0*k/mass) / DispCorrection;
281 }
#define sqr(a)
Definition: ExtendedMath.h:36
double Mdouble
Definition: ExtendedMath.h:33
Mdouble helperFunc::getRestitutionCoefficient ( Mdouble  k,
Mdouble  disp,
Mdouble  mass 
)

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

Definition at line 264 of file ExtendedMath.cc.

References getCollisionTime().

265 {
266  return exp(-disp/(2.0*mass)*helperFunc::getCollisionTime(k, disp, mass));
267 }
Mdouble getCollisionTime(Mdouble k, Mdouble disp, Mdouble mass)
Calculates collision time for two copies of a particle of given disp, k, effective mass...