00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef MECHSYS_LINEARFLOWMODEL_H
00023 #define MECHSYS_LINEARFLOWMODEL_H
00024
00025 #include "models/flow/flowmodel.h"
00026
00027 using Tensors::Tensor1;
00028 using Tensors::Tensor2;
00029
00030 class LinearFlow: public FlowModel
00031 {
00032 public:
00033
00034 LinearFlow(Array<REAL> const & Prms, Array<REAL> const & IniData);
00035
00036
00037 virtual ~LinearFlow() {}
00038
00039
00040 static const size_t NPRMS = 2;
00041 static const size_t NIDAT = 1;
00042
00043
00044 String Name() const { return "LinearFlow"; };
00045 void TgPermeability (Tensor2 & K) const;
00046 void FlowVelocity (Tensor1 const & Grad, Tensor1 & Vel) const;
00047 void FlowUpdate (REAL const & DPp);
00048 void BackupState ();
00049 void RestoreState ();
00050 int nInternalStateValues () const { return 0; };
00051 void InternalStateValues (Array<REAL> & IntStateVals ) const {}
00052 void InternalStateNames (Array<String> & IntStateNames) const {}
00053 REAL Pp () const { return _ppr; };
00054 REAL GammaW () const { return _gammaW; }
00055
00056 protected:
00057
00058 REAL _k;
00059 REAL _gammaW;
00060 REAL _ppr;
00061 REAL _ppr_bkp;
00062
00063 };
00064
00065
00067
00068
00069 inline LinearFlow::LinearFlow(Array<REAL> const & Prms, Array<REAL> const & IniData)
00070 {
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082 if (Prms.size()!=NPRMS)
00083 throw new Fatal(_("LinearFlow::Constructor: The number of parameters is incorrect (it must be %d)"),NPRMS);
00084
00085
00086 _k = Prms[0];
00087 _gammaW = Prms[1];
00088
00089
00090 if (IniData.size()!=NIDAT)
00091 throw new Fatal(_("LinearFlow::Constructor: The number of initial (%d) data is incorrect { Pp }"),NIDAT);
00092
00093
00094 _ppr = IniData[0];
00095
00096 }
00097
00098 inline void LinearFlow::TgPermeability(Tensor2 & K) const
00099 {
00100
00101 K = _k, _k, _k, 0,0,0;
00102 }
00103
00104 inline void LinearFlow::FlowVelocity(Tensor1 const & Grad, Tensor1 & Vel) const
00105 {
00106 Tensor2 K;
00107 TgPermeability(K);
00108 Tensors::Dot(-K,Grad, Vel);
00109 }
00110
00111 inline void LinearFlow::FlowUpdate(REAL const & DPp)
00112 {
00113
00114 _ppr += DPp;
00115 }
00116
00117 inline void LinearFlow::BackupState()
00118 {
00119 _ppr_bkp = _ppr;
00120 }
00121
00122 inline void LinearFlow::RestoreState()
00123 {
00124 _ppr = _ppr_bkp;
00125 }
00126
00127
00129
00130
00131 FlowModel * LinearFlowMaker(Array<REAL> const & Prms, Array<REAL> const & IniData)
00132 {
00133 return new LinearFlow(Prms, IniData);
00134 }
00135
00136
00137 int LinearFlowRegister()
00138 {
00139 FlowModelFactory["LinearFlow"] = LinearFlowMaker;
00140 return 0;
00141 }
00142
00143
00144 int __LinearFlow_dummy_int = LinearFlowRegister();
00145
00146
00147
00148 #endif // MECHSYS_LINEARFLOWMODEL_H
00149
00150