mbsimflexiblebody  4.0.0
finite_element_1s_33_rcm.h
00001 /* Copyright (C) 2004-2011 MBSim Development Team
00002  *
00003  * This library is free software; you can redistribute it and/or 
00004  * modify it under the terms of the GNU Lesser General Public 
00005  * License as published by the Free Software Foundation; either 
00006  * version 2.1 of the License, or (at your option) any later version. 
00007  *  
00008  * This library is distributed in the hope that it will be useful, 
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of 
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
00011  * Lesser General Public License for more details. 
00012  *  
00013  * You should have received a copy of the GNU Lesser General Public 
00014  * License along with this library; if not, write to the Free Software 
00015  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
00016  *
00017  * Contact: thorsten.schindler@mytum.de
00018  */
00019 
00020 #ifndef _FINITE_ELEMENT_1S_33_RCM_H_
00021 #define _FINITE_ELEMENT_1S_33_RCM_H_
00022 
00023 #include "mbsim/discretization_interface.h"
00024 #include "mbsim/mbsim_event.h"
00025 #include "mbsim/contour_pdata.h"
00026 #include "mbsimFlexibleBody/pointer.h"
00027 #include "mbsimFlexibleBody/flexible_body/finite_elements/finite_element_1s_33_rcm/weight33RCM.h"
00028 #include "fmatvec/fmatvec.h"
00029 
00030 namespace MBSimFlexibleBody {
00031 
00041   class FiniteElement1s33RCM : public MBSim::DiscretizationInterface {
00042     public:
00056       FiniteElement1s33RCM(double l0_,double rho_,double A_,double E_,double G_,double I1_,double I2_,double I0_,const fmatvec::Vec& g_,RevCardanPtr ag_);              
00057 
00061       virtual ~FiniteElement1s33RCM() {}                
00062 
00063       /* INHERITED INTERFACE OF DISCRETIZATIONINTERFACE */
00064       virtual const fmatvec::SymMat& getM() const;              
00065       virtual const fmatvec::Vec& geth() const;
00066       virtual const fmatvec::SqrMat& getdhdq() const;
00067       virtual const fmatvec::SqrMat& getdhdu() const;
00068       virtual int getqSize() const;
00069       virtual int getuSize() const;
00070 
00071       virtual void computeM(const fmatvec::Vec& qG);
00072       virtual void computeh(const fmatvec::Vec& qG,const fmatvec::Vec& qGt);
00073       virtual void computedhdz(const fmatvec::Vec& qG, const fmatvec::Vec& qGt);
00074       virtual double computeKineticEnergy(const fmatvec::Vec& qG,const fmatvec::Vec& qGt);              
00075       virtual double computeGravitationalEnergy(const fmatvec::Vec& qG);                
00076       virtual double computeElasticEnergy(const fmatvec::Vec& qG);
00077 
00078       virtual fmatvec::Vec computePosition(const fmatvec::Vec& q, const MBSim::ContourPointData &data);
00079       virtual fmatvec::SqrMat computeOrientation(const fmatvec::Vec& q, const MBSim::ContourPointData &data);
00080       virtual fmatvec::Vec computeVelocity(const fmatvec::Vec& q, const fmatvec::Vec& u, const MBSim::ContourPointData &data);
00081       virtual fmatvec::Vec computeAngularVelocity(const fmatvec::Vec& q, const fmatvec::Vec& u, const MBSim::ContourPointData &data);
00082       virtual fmatvec::Mat computeJacobianOfMotion(const fmatvec::Vec& qG,const MBSim::ContourPointData& data);
00083       /*****************************************************/ 
00084 
00085       /* GETTER / SETTER */
00086       void setGauss(int nGauss);
00087       void setCurlRadius(double R1,double R2);          
00088       void setMaterialDamping(double epstD_,double k0D_);               
00089       void setLehrDamping(double epstL,double k0L);             
00090       double getl0() const;             
00091       /*****************************************************/ 
00092 
00099       const fmatvec::Vec& computeState(const fmatvec::Vec& qG,const fmatvec::Vec& qGt,double x);
00100 
00106       fmatvec::Mat computeJXqG(const fmatvec::Vec& qG,double x);
00107 
00113       fmatvec::Vec computeData(const fmatvec::Vec& qG,const fmatvec::Vec& qGt);
00114 
00120       double computePhysicalStrain(const fmatvec::Vec& qG,const fmatvec::Vec& qGt);
00121 
00122     private:
00126       double l0;
00127 
00131       double rho;
00132 
00136       double A;
00137 
00141       double E;
00142 
00146       double G;
00147 
00151       double I1, I2, I0;
00152 
00156       fmatvec::Vec g;
00157 
00161       double k10, k20;
00162 
00166       double epstD, k0D;
00167 
00171       fmatvec::SymMat M;
00172       fmatvec::Vec h;
00173 
00177       fmatvec::SqrMat dhdq, dhdu;
00178 
00182       fmatvec::SymMat MI;
00183 
00187       fmatvec::SqrMat Damp;
00188 
00192       double l0h2, l0h3;
00193 
00197       double x_Old;
00198 
00202       fmatvec::Vec X;
00203 
00207       fmatvec::Vec qG_Old, qGt_Old;
00208 
00212       double tol_comp;
00213 
00217       fmatvec::Mat drS, drSH;
00218       fmatvec::RowVec depstil, dk0;
00219 
00223       RevCardanPtr ag;
00224 
00228       Trafo33RCMPtr tf;
00229 
00233       Weight33RCMPtr wt;
00234 
00238       void computedrS();
00239 
00243       void computedepstil();
00244       
00248       void computedk0();        
00249   };
00250 
00251   inline void FiniteElement1s33RCM::setGauss(int nGauss) { wt->setGauss(nGauss); }
00252   inline double FiniteElement1s33RCM::getl0() const { return l0; }
00253   inline const fmatvec::SymMat& FiniteElement1s33RCM::getM() const { return M; }
00254   inline const fmatvec::Vec& FiniteElement1s33RCM::geth() const { return h; }
00255   inline const fmatvec::SqrMat& FiniteElement1s33RCM::getdhdq() const { return dhdq; }
00256   inline const fmatvec::SqrMat& FiniteElement1s33RCM::getdhdu() const { return dhdu; }
00257   inline int FiniteElement1s33RCM::getqSize() const { return 16; }
00258   inline int FiniteElement1s33RCM::getuSize() const { return 16; }
00259   inline fmatvec::Vec FiniteElement1s33RCM::computePosition(const fmatvec::Vec& q, const MBSim::ContourPointData &data) { throw MBSim::MBSimError("(FiniteElement1s33RCM::computePosition): Not implemented!"); }
00260   inline fmatvec::SqrMat FiniteElement1s33RCM::computeOrientation(const fmatvec::Vec& q, const MBSim::ContourPointData &data) { throw MBSim::MBSimError("(FiniteElement1s33RCM::computeOrientation): Not implemented!"); }
00261   inline fmatvec::Vec FiniteElement1s33RCM::computeVelocity(const fmatvec::Vec& q, const fmatvec::Vec& u, const MBSim::ContourPointData &data) { throw MBSim::MBSimError("(FiniteElement1s33RCM::computeVelocity): Not implemented!"); }
00262   inline fmatvec::Vec FiniteElement1s33RCM::computeAngularVelocity(const fmatvec::Vec& q, const fmatvec::Vec& u, const MBSim::ContourPointData &data) { throw MBSim::MBSimError("(FiniteElement1s33RCM::computeAngularVelocity): Not implemented!"); }
00263   inline fmatvec::Mat FiniteElement1s33RCM::computeJacobianOfMotion(const fmatvec::Vec& qG,const MBSim::ContourPointData& data) { return computeJXqG(qG,data.getLagrangeParameterPosition()(0)); }
00264 
00265 }
00266 
00267 #endif /* _FINITE_ELEMENT_1S_33_RCM_H_ */
00268