MechSys  1.0
Computing library for simulations in continuum and discrete mechanics
/home/dorival/mechsys/lib/models/neohookean.h
Go to the documentation of this file.
00001 /************************************************************************
00002  * MechSys - Open Library for Mechanical Systems                        *
00003  * Copyright (C) 2005 Dorival M. Pedroso, Raul Durand                   *
00004  * Copyright (C) 2009 Sergio Galindo                                    *
00005  *                                                                      *
00006  * This program is free software: you can redistribute it and/or modify *
00007  * it under the terms of the GNU General Public License as published by *
00008  * the Free Software Foundation, either version 3 of the License, or    *
00009  * any later version.                                                   *
00010  *                                                                      *
00011  * This program is distributed in the hope that it will be useful,      *
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the         *
00014  * GNU General Public License for more details.                         *
00015  *                                                                      *
00016  * You should have received a copy of the GNU General Public License    *
00017  * along with this program. If not, see <http://www.gnu.org/licenses/>  *
00018  ************************************************************************/
00019 
00020 #ifndef MECHSYS_NEOHOOKEAN_H
00021 #define MECHSYS_NEOHOOKEAN_H
00022 
00023 // MechSys
00024 #include <mechsys/models/model.h>
00025 #include <mechsys/models/equilibstate.h>
00026 
00027 class NeoHookean : public Model
00028 {
00029 public:
00030     // Constructor
00031     NeoHookean (int NDim, SDPair const & Prms);
00032 
00033     // Methods
00034     void InitIvs   (SDPair const & Ini, State * Sta) const;
00035     void UpdateSta (ATensor2 const & F, State * Sta) const;
00036 
00037     // Data
00038     double  lam;     
00039     double  G;       
00040     mutable Vec_t b; 
00041 };
00042 
00043 
00045 
00046 
00047 inline NeoHookean::NeoHookean (int NDim, SDPair const & Prms)
00048     : Model (NDim,Prms,/*niv*/0,"NeoHookean")
00049 {
00050     // parameters
00051     double E  = Prms("E");
00052     double nu = Prms("nu");
00053     lam = Calc_lam (E, nu);
00054     G   = Calc_G   (E, nu);
00055     b.change_dim (NCps);
00056 
00057     // set UseUpdateSta
00058     UseUpdateSta = true;
00059 }
00060 
00061 inline void NeoHookean::InitIvs (SDPair const & Ini, State * Sta) const
00062 {
00063     EquilibState * sta = static_cast<EquilibState*>(Sta);
00064     sta->Init (Ini);
00065 }
00066 
00067 inline void NeoHookean::UpdateSta (ATensor2 const & F, State * Sta) const
00068 {
00069     EquilibState * sta = static_cast<EquilibState*>(Sta);
00070     CalcLCauchyGreen (F, NCps, b); // b = F*Ft
00071     b -= I; // b = F*Ft - I
00072     double J = Det (F);
00073     sta->Sig = (lam*log(J)/J)*I + (G/J)*b;
00074 }
00075 
00076 
00078 
00079 
00080 Model * NeoHookeanMaker(int NDim, SDPair const & Prms, Model const * O) { return new NeoHookean(NDim,Prms); }
00081 
00082 int NeoHookeanRegister()
00083 {
00084     ModelFactory   ["NeoHookean"] = NeoHookeanMaker;
00085     MODEL.Set      ("NeoHookean", (double)MODEL.Keys.Size());
00086     MODEL_PRM_NAMES["NeoHookean"].Resize(2);
00087     MODEL_PRM_NAMES["NeoHookean"] = "E", "nu";
00088     MODEL_IVS_NAMES["NeoHookean"].Resize(0);
00089     return 0;
00090 }
00091 
00092 int __NeoHookean_dummy_int = NeoHookeanRegister();
00093 
00094 
00095 #endif // MECHSYS_NEOHOOKEAN_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines