ESyS-Particle  4.0.1
RotFricInteraction.h
1 
2 // //
3 // Copyright (c) 2003-2011 by The University of Queensland //
4 // Earth Systems Science Computational Centre (ESSCC) //
5 // http://www.uq.edu.au/esscc //
6 // //
7 // Primary Business: Brisbane, Queensland, Australia //
8 // Licensed under the Open Software License version 3.0 //
9 // http://www.opensource.org/licenses/osl-3.0.php //
10 // //
12 
13 #ifndef __ROTFRICTIONINTERACTION_H
14 #define __ROTFRICTIONINTERACTION_H
15 
16 // -- project includes --
17 #include "Model/RotPairInteraction.h"
18 #include "Model/RotParticle.h"
19 #include "Model/IGParam.h"
20 #include "Foundation/vec3.h"
21 
22 // -- I/O includes --
23 #include <iostream>
24 using std::ostream;
25 
26 
27 //double calc_angle( double , double ) ;
28 
29 
37 class CRotFrictionIGP : public AIGParam
38 {
39 public:
41 
43  const std::string &name,
44  double k,
45  double mu_d,
46  double mu_s,
47  double k_s,
48  double dt,
49  bool scaling,
50  bool rigid
51  );
52 
54  const std::string &name,
55  double youngsModulus,
56  double poissonsRatio,
57  double mu_d,
58  double mu_s,
59  double dt,
60  bool rigid
61  );
62 
63  virtual std::string getTypeString() const
64  {
65  return "RotFriction";
66  }
67 
68  void setTimeStepSize(double dt);
69 
70  double k;
71  double mu_d; // sliding frictional coefficient
72  double mu_s; // max static frictional coefficient
73  double k_s;
74  double dt;
75  bool scaling;
76  bool rigid;
77 };
78 
87 {
88  public: // types
90 
91  typedef double (CRotFrictionInteraction::* ScalarFieldFunction)() const;
92  typedef pair<bool,double> (CRotFrictionInteraction::* CheckedScalarFieldFunction)() const;
93  typedef Vec3 (CRotFrictionInteraction::* VectorFieldFunction)() const;
94 
95  static CheckedScalarFieldFunction getCheckedScalarFieldFunction(const string&);
96  static ScalarFieldFunction getScalarFieldFunction(const string&);
97  static VectorFieldFunction getVectorFieldFunction(const string&);
98 
99 // protected:
100  private:
101 
102  double m_k;
103  double m_r0;
104  double m_mu_d;
105  double m_mu_s;
106  double m_ks;
107  double m_dt;
108  Vec3 m_Ffric;
109  Vec3 m_force_deficit;
110  Vec3 m_cpos;
111  Vec3 m_normal_force;
112  bool m_is_slipping;
113  bool m_is_touching;
114  double m_E_diss;
115  bool m_scaling;
116  bool m_rigid;
117 
118  //Quaternion m_init_q1, m_init_q2;
119  //Vec3 m_init_pos1 , m_init_pos2;
120 
121  public:
124  virtual ~CRotFrictionInteraction();
125 
126  static string getType() {return "RotFriction";};
127 
128  virtual void calcForces();
129  virtual void calcSimpleForces();
130  virtual void calcRigidBodyForces();
131  virtual bool isPersistent();
132 
133  void setTimeStepSize(double dt);
134 
135  void calcNormalForce();
136  double getAbsForceDeficit()const;
137  double getPotentialEnergy()const;
138  double getSlipping()const;
139  double getSticking()const;
140  double getDissipatedEnergy() const;
141  virtual double Count() const;
142  virtual Vec3 getPos() const {return m_cpos;};
143  Vec3 getForce() const;
144  Vec3 getNormalForce() const;
145 
146  friend ostream& operator<<(ostream&,const CRotFrictionInteraction&);
147  friend class TML_PackedMessageInterface;
148 
149  // checkpointing
150  virtual void saveRestartData(std::ostream &oStream);
151  virtual void loadRestartData(std::istream &iStream);
152 };
153 
154 #endif //__ROTFRICTIONINTERACTION_H