ESyS-Particle  4.0.1
FrictionInteraction.h
00001 
00002 //                                                         //
00003 // Copyright (c) 2003-2011 by The University of Queensland //
00004 // Earth Systems Science Computational Centre (ESSCC)      //
00005 // http://www.uq.edu.au/esscc                              //
00006 //                                                         //
00007 // Primary Business: Brisbane, Queensland, Australia       //
00008 // Licensed under the Open Software License version 3.0    //
00009 // http://www.opensource.org/licenses/osl-3.0.php          //
00010 //                                                         //
00012 
00013 #ifndef __FRICTIONINTERACTION_H
00014 #define __FRICTIONINTERACTION_H
00015 
00016 #include "Model/IGParam.h"
00017 #include "Model/Interaction.h"
00018 #include "Model/Particle.h"
00019 #include "Foundation/vec3.h"
00020 
00021 #include <iostream>
00022 #include <utility>
00023 
00027 class CFrictionIGP : public AIGParam
00028 {
00029 public:
00030   CFrictionIGP();
00031 
00032   CFrictionIGP(const std::string &name, double normalK, double fricCoef, double shearK, double dT,bool scaling=true);
00033 
00034   virtual std::string getTypeString() const {return "Friction";}
00035 
00036   void setTimeStepSize(double dt);
00037 
00038   double k;
00039   double mu;
00040   double k_s;
00041   double dt;
00042   bool m_scaling;
00043 };
00044 
00052 class CFrictionInteraction : public APairInteraction
00053 {
00054  public: // types
00055   typedef CFrictionIGP ParameterType;
00056 
00057   typedef double (CFrictionInteraction::* ScalarFieldFunction)() const;
00058   typedef std::pair<bool,double> (CFrictionInteraction::* CheckedScalarFieldFunction)() const;
00059   typedef Vec3 (CFrictionInteraction::* VectorFieldFunction)() const;
00060 
00061   static ScalarFieldFunction getScalarFieldFunction(const string&);
00062   static CheckedScalarFieldFunction getCheckedScalarFieldFunction(const string&);
00063   static VectorFieldFunction getVectorFieldFunction(const string&);
00064 
00065  protected:
00066   double m_k;     
00067   double m_r0;    
00068   double m_mu;    
00069   double m_ks;    
00070   double m_dt;    
00071   Vec3 m_Ffric;   
00072   Vec3 m_force_deficit; 
00073   Vec3 m_cpos; 
00074   Vec3 m_normal_force; 
00075   bool m_is_slipping; 
00076   bool m_is_touching; 
00077   double m_E_diss; 
00078   bool m_scaling; 
00079 
00080  public:
00081   CFrictionInteraction();
00082   CFrictionInteraction(CParticle*,CParticle*);
00083   CFrictionInteraction(CParticle*,CParticle*,const CFrictionIGP&);
00084   virtual ~CFrictionInteraction();
00085 
00086   static string getType() {return "Friction";};
00087   
00088   virtual void calcForces();
00089   virtual bool isPersistent();
00090 
00091   void setTimeStepSize(double dt);
00092 
00093   std::pair<bool,double> getAbsFrictionalForce() const;
00094   std::pair<bool,double> getAbsFN() const;
00095   std::pair<bool,double> getAbsMuFN() const;
00096   std::pair<bool,double> getSlipVelocity() const;
00097   std::pair<bool,double> getNormalStress() const;
00098   std::pair<bool,double> getMaxFricStress() const;
00099   std::pair<bool,double>  getAbsFrictionalStress() const;
00100 
00101   double getAbsForceDeficit() const;
00102   double getPotentialEnergy() const;
00103   double getSlipping()const;
00104   double getSticking()const;
00105   double getDissipatedEnergy() const;
00106   virtual double Count() const;
00107   Vec3 getForce() const;
00108   Vec3 getNormalForce() const;
00109   virtual Vec3 getPos() const {return m_cpos;};
00110 
00111   std::pair<bool,double> getMuEff(const Vec3&,const Vec3&) const;
00112   std::pair<bool,double> getMuEffXY() const {return getMuEff(Vec3(1.0,0.0,0.0),Vec3(0.0,1.0,0.0));};
00113   std::pair<bool,double> getMuEffXZ() const {return getMuEff(Vec3(1.0,0.0,0.0),Vec3(0.0,0.0,1.0));};
00114 
00115   friend std::ostream& operator<<(std::ostream&,const CFrictionInteraction&);
00116   friend class TML_PackedMessageInterface;
00117   
00118   // save/load of restart parameters
00119   virtual void saveRestartData(std::ostream &oStream);
00120   virtual void loadRestartData(std::istream &iStream);
00121 };
00122 
00123 #endif //__FRICTIONINTERACTION_H