ESyS-Particle  4.0.1
FrictionInteraction.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 __FRICTIONINTERACTION_H
14 #define __FRICTIONINTERACTION_H
15 
16 #include "Model/IGParam.h"
17 #include "Model/Interaction.h"
18 #include "Model/Particle.h"
19 #include "Foundation/vec3.h"
20 
21 #include <iostream>
22 #include <utility>
23 
27 class CFrictionIGP : public AIGParam
28 {
29 public:
30  CFrictionIGP();
31 
32  CFrictionIGP(const std::string &name, double normalK, double fricCoef, double shearK, double dT,bool scaling=true);
33 
34  virtual std::string getTypeString() const {return "Friction";}
35 
36  void setTimeStepSize(double dt);
37 
38  double k;
39  double mu;
40  double k_s;
41  double dt;
42  bool m_scaling;
43 };
44 
53 {
54  public: // types
56 
57  typedef double (CFrictionInteraction::* ScalarFieldFunction)() const;
58  typedef std::pair<bool,double> (CFrictionInteraction::* CheckedScalarFieldFunction)() const;
59  typedef Vec3 (CFrictionInteraction::* VectorFieldFunction)() const;
60 
61  static ScalarFieldFunction getScalarFieldFunction(const string&);
62  static CheckedScalarFieldFunction getCheckedScalarFieldFunction(const string&);
63  static VectorFieldFunction getVectorFieldFunction(const string&);
64 
65  protected:
66  double m_k;
67  double m_r0;
68  double m_mu;
69  double m_ks;
70  double m_dt;
77  double m_E_diss;
78  bool m_scaling;
79 
80  public:
84  virtual ~CFrictionInteraction();
85 
86  static string getType() {return "Friction";};
87 
88  virtual void calcForces();
89  virtual bool isPersistent();
90 
91  void setTimeStepSize(double dt);
92 
93  std::pair<bool,double> getAbsFrictionalForce() const;
94  std::pair<bool,double> getAbsFN() const;
95  std::pair<bool,double> getAbsMuFN() const;
96  std::pair<bool,double> getSlipVelocity() const;
97  std::pair<bool,double> getNormalStress() const;
98  std::pair<bool,double> getMaxFricStress() const;
99  std::pair<bool,double> getAbsFrictionalStress() const;
100 
101  double getAbsForceDeficit() const;
102  double getPotentialEnergy() const;
103  double getSlipping()const;
104  double getSticking()const;
105  double getDissipatedEnergy() const;
106  virtual double Count() const;
107  Vec3 getForce() const;
108  Vec3 getNormalForce() const;
109  virtual Vec3 getPos() const {return m_cpos;};
110 
111  std::pair<bool,double> getMuEff(const Vec3&,const Vec3&) const;
112  std::pair<bool,double> getMuEffXY() const {return getMuEff(Vec3(1.0,0.0,0.0),Vec3(0.0,1.0,0.0));};
113  std::pair<bool,double> getMuEffXZ() const {return getMuEff(Vec3(1.0,0.0,0.0),Vec3(0.0,0.0,1.0));};
114 
115  friend std::ostream& operator<<(std::ostream&,const CFrictionInteraction&);
116  friend class TML_PackedMessageInterface;
117 
118  // save/load of restart parameters
119  virtual void saveRestartData(std::ostream &oStream);
120  virtual void loadRestartData(std::istream &iStream);
121 };
122 
123 #endif //__FRICTIONINTERACTION_H