coupledmodel.h

00001 /*************************************************************************************
00002  * MechSys - A C++ library to simulate (Continuum) Mechanical Systems                *
00003  * Copyright (C) 2005 Dorival de Moraes Pedroso <dorival.pedroso at gmail.com>       *
00004  * Copyright (C) 2005 Raul Dario Durand Farfan  <raul.durand at gmail.com>           *
00005  *                                                                                   *
00006  * This file is part of MechSys.                                                     *
00007  *                                                                                   *
00008  * MechSys is free software; you can redistribute it and/or modify it under the      *
00009  * terms of the GNU General Public License as published by the Free Software         *
00010  * Foundation; either version 2 of the License, or (at your option) any later        *
00011  * version.                                                                          *
00012  *                                                                                   *
00013  * MechSys is distributed in the hope that it will be useful, but WITHOUT ANY        *
00014  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A   *
00015  * PARTICULAR PURPOSE. See the GNU General Public License for more details.          *
00016  *                                                                                   *
00017  * You should have received a copy of the GNU General Public License along with      *
00018  * MechSys; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, *
00019  * Fifth Floor, Boston, MA 02110-1301, USA                                           *
00020  *************************************************************************************/
00021 
00022 #ifndef MECHSYS_COUPLEDMODEL_H
00023 #define MECHSYS_COUPLEDMODEL_H
00024 
00025 #ifdef HAVE_CONFIG_H
00026   #include "config.h"
00027 #else
00028   #ifndef REAL
00029     #define REAL double
00030   #endif
00031 #endif
00032 
00033 // STL
00034 #include <map>
00035 #include <string>
00036 
00037 // MechSys
00038 #include "tensors/tensors.h"
00039 #include "util/string.h"
00040 #include "util/array.h"
00041 #include "numerical/integschemesctes.h"
00042 
00043 using Tensors::Tensor1;
00044 using Tensors::Tensor2;
00045 using Tensors::Tensor4;
00046 
00047 class CoupledModel
00048 {
00049 public:
00050 
00051     // Destructor
00052     virtual ~CoupledModel(){};
00053 
00054     // Methods
00055     virtual String Name            () const =0;
00056     virtual void   TgStiffness     (Tensor4 & D, Tensor2 & d) const =0; 
00057     virtual REAL   Sr              () const =0; // Degree of saturation
00058     virtual REAL   phi             () const =0; // Sig_net = Sig_tot - phi*Suc*I
00059     virtual REAL   n_times_dSr_dPp () const =0; // n:porosity times dSr_dPp (derivative of degree of sat. w.r.t. porepressure)
00060     virtual void   TgPermeability  (Tensor2 & k) const =0; 
00061     virtual void   FlowVelocity    (Tensor1 const & Grad, Tensor1 & Vel) const =0;
00062     virtual void   Actualize       (Tensor2 const & DSig, REAL const & DPp, Tensor2 & DEps, REAL & DnSr) =0;
00063     virtual void   StressUpdate    (Tensor2 const & DEps, REAL const & DPp, Tensor2 & DSig, REAL & DnSr) =0;
00064     virtual void   FlowUpdate      (REAL const & DPp) =0;
00065     virtual void   BackupState     () =0;
00066     virtual void   RestoreState    () =0;
00067 
00068     // Access methods
00069     virtual Tensor2 const & Sig() const =0;
00070     virtual Tensor2 const & Eps() const =0; 
00071     virtual REAL            Pp () const =0; 
00072     virtual REAL         GammaW() const =0;
00073     virtual int  nInternalStateValues()                              const =0;
00074     virtual void InternalStateValues (Array<REAL>   & IntStateVals ) const =0;
00075     virtual void InternalStateNames  (Array<String> & IntStateNames) const =0;
00076 
00077     // Static
00078     static void SetIntegSchemesCtes(IntegSchemesCtes const & ISC) { _isc=ISC; }
00079 
00080 protected:
00081     // Data (static)
00082     static IntegSchemesCtes _isc; 
00083 
00084 }; // class CoupledModel
00085 
00086 
00088 
00089 
00090 IntegSchemesCtes CoupledModel::_isc;
00091 
00092 
00094 
00095 // Define a pointer to a function that makes (allocate) a new equilibmodel
00096 typedef CoupledModel * (*CoupledModelMakerPtr)(Array<REAL> const & Prms, Array<REAL> const & IniData);
00097 
00098 // Typdef of the array map that contains all the pointers to the functions that makes equilibmodels
00099 typedef std::map<String, CoupledModelMakerPtr, std::less<String> > CoupledModelFactory_t;
00100 
00101 // Instantiate the array map that contains all the pointers to the functions that makes equilibmodels
00102 CoupledModelFactory_t CoupledModelFactory;
00103 
00104 // Allocate a new coupledmodel according to a string giving the name of the coupledmodel
00105 CoupledModel * AllocCoupledModel(String const & Name, Array<REAL> const & Prms, Array<REAL> const & IniData)
00106 {
00107     CoupledModelMakerPtr ptr=NULL;
00108     ptr = CoupledModelFactory[Name];
00109     if (ptr==NULL)
00110         throw new Fatal(_("FEM::AllocCoupledModel: There is no < %s >  implemented in this library\n"),Name.c_str());
00111     return (*ptr)(Prms, IniData);
00112 }
00113 
00114 // }}}
00115 
00116 #endif // MECHSYS_COUPLEDMODEL_H
00117 
00118 // vim:fdm=marker

Generated on Wed Jan 24 15:56:27 2007 for MechSys by  doxygen 1.4.7