00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef MECHSYS_GENERICC_H
00023 #define MECHSYS_GENERICC_H
00024
00025 #include "models/coupled/coupledmodel.h"
00026
00027 using Tensors::Tensor1;
00028 using Tensors::Tensor2;
00029
00030 template<class tEquilibModel, class tFlowModel>
00031 class GenericC: public CoupledModel
00032 {
00033 public:
00034
00035 GenericC() : _equilib_model(NULL), _flow_model(NULL) {}
00036
00037
00038 ~GenericC();
00039
00040
00041 String Name () const=0;
00042 void TgStiffness (Tensor4 & D, Tensor2 & d) const;
00043 REAL Sr () const { return 1.0;};
00044 REAL phi () const { return 1.0;};
00045 REAL n_times_dSr_dPp () const { return 0.0;};
00046 void TgPermeability (Tensor2 & K) const;
00047 void FlowVelocity (Tensor1 const & Grad, Tensor1 & Vel) const;
00048 void Actualize (Tensor2 const & DSig, REAL const & DPp, Tensor2 & DEps, REAL & DnSr) {}
00049 void StressUpdate (Tensor2 const & DEps, REAL const & DPp, Tensor2 & DSig, REAL & DnSr);
00050 void FlowUpdate (REAL const & DPp);
00051 void BackupState ();
00052 void RestoreState ();
00053
00054
00055 Tensor2 const & Sig() const { return _equilib_model->Sig(); }
00056 Tensor2 const & Eps() const { return _equilib_model->Eps(); }
00057 REAL Pp () const { return _flow_model->Pp(); }
00058 REAL GammaW () const { return _flow_model->GammaW();}
00059 int nInternalStateValues () const;
00060 void InternalStateValues (Array<REAL> & IntStateVals ) const;
00061 void InternalStateNames (Array<String> & IntStateNames) const;
00062
00063 protected:
00064
00065 void AllocateSubModels(Array<REAL> const & EquilibPrms ,
00066 Array<REAL> const & EquilibIniData ,
00067 Array<REAL> const & FlowPrms ,
00068 Array<REAL> const & FlowIniData );
00069
00070 private:
00071
00072 tEquilibModel * _equilib_model;
00073 tFlowModel * _flow_model;
00074
00075 };
00076
00077
00079
00080
00081 template<class tEquilibModel, class tFlowModel>
00082 inline GenericC<tEquilibModel,tFlowModel>::~GenericC()
00083 {
00084 if (_equilib_model != NULL) delete _equilib_model;
00085 if (_flow_model != NULL) delete _flow_model;
00086 }
00087
00088 template<class tEquilibModel, class tFlowModel>
00089 inline void GenericC<tEquilibModel,tFlowModel>::TgStiffness (Tensor4 & D, Tensor2 & d) const
00090 {
00091 _equilib_model->TgStiffness(D);
00092 d = 0.0*Tensors::I;
00093 }
00094
00095 template<class tEquilibModel, class tFlowModel>
00096 inline void GenericC<tEquilibModel,tFlowModel>::TgPermeability(Tensor2 & K) const
00097 {
00098 _flow_model->TgPermeability(K);
00099 }
00100
00101 template<class tEquilibModel, class tFlowModel>
00102 inline void GenericC<tEquilibModel,tFlowModel>::FlowVelocity(Tensor1 const & Grad, Tensor1 & Vel) const
00103 {
00104 _flow_model->FlowVelocity(Grad, Vel);
00105 }
00106
00107 template<class tEquilibModel, class tFlowModel>
00108 inline void GenericC<tEquilibModel,tFlowModel>::StressUpdate(Tensor2 const & DEps, REAL const & DPp, Tensor2 & DSig, REAL & DnSr)
00109 {
00110 _equilib_model->StressUpdate(DEps, DSig);
00111 DnSr = -(DEps(0)+DEps(1)+DEps(2))*1.0;
00112 }
00113
00114 template<class tEquilibModel, class tFlowModel>
00115 inline void GenericC<tEquilibModel,tFlowModel>::FlowUpdate(REAL const & DPp)
00116 {
00117 _flow_model->FlowUpdate(DPp);
00118 }
00119
00120 template<class tEquilibModel, class tFlowModel>
00121 inline void GenericC<tEquilibModel,tFlowModel>::BackupState()
00122 {
00123 _equilib_model->BackupState();
00124 _flow_model->BackupState();
00125 }
00126
00127 template<class tEquilibModel, class tFlowModel>
00128 inline void GenericC<tEquilibModel,tFlowModel>::RestoreState()
00129 {
00130 _equilib_model->RestoreState();
00131 _flow_model->RestoreState();
00132 }
00133
00134 template<class tEquilibModel, class tFlowModel>
00135 inline int GenericC<tEquilibModel,tFlowModel>::nInternalStateValues() const
00136 {
00137 return _equilib_model->nInternalStateValues() + _flow_model->nInternalStateValues();
00138 }
00139
00140 template<class tEquilibModel, class tFlowModel>
00141 inline void GenericC<tEquilibModel,tFlowModel>::InternalStateValues(Array<REAL> & IntStateVals ) const
00142 {
00143 Array<REAL> FlowIntStateVals;
00144 _equilib_model->InternalStateValues(IntStateVals);
00145 _flow_model->InternalStateValues(FlowIntStateVals);
00146 for (size_t i=0; i<FlowIntStateVals.size(); i++)
00147 IntStateVals.push_back(FlowIntStateVals[i]);
00148 }
00149
00150 template<class tEquilibModel, class tFlowModel>
00151 inline void GenericC<tEquilibModel,tFlowModel>::InternalStateNames (Array<String> & IntStateNames) const
00152 {
00153 _equilib_model->InternalStateNames(IntStateNames);
00154 }
00155
00156 template<class tEquilibModel, class tFlowModel>
00157 inline void GenericC<tEquilibModel,tFlowModel>::AllocateSubModels(Array<REAL> const & EquilibPrms,
00158 Array<REAL> const & EquilibIniData,
00159 Array<REAL> const & FlowPrms,
00160 Array<REAL> const & FlowIniData)
00161 {
00162 _equilib_model = new tEquilibModel(EquilibPrms, EquilibIniData);
00163 _flow_model = new tFlowModel (FlowPrms, FlowIniData);
00164 }
00165
00166 #endif // MECHSYS_GENERICC_H
00167
00168