mbsimflexiblebody  3.2.0
finite_element_1s_21_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  *          rzander@users.berlios.de
00019  */
00020 
00021 #ifndef _FINITE_ELEMENT_1S_21_RCM_H_
00022 #define _FINITE_ELEMENT_1S_21_RCM_H_
00023 
00024 #include "mbsim/discretization_interface.h"
00025 #include "mbsim/contour_pdata.h"
00026 #include "mbsim/mbsim_event.h"
00027 #include "fmatvec/fmatvec.h"
00028 
00029 namespace MBSimFlexibleBody {
00030 
00046   class FiniteElement1s21RCM : public MBSim::DiscretizationInterface {
00047     public:
00051       FiniteElement1s21RCM() {};
00052 
00061       FiniteElement1s21RCM(double l0_, double  Arho_, double EA_, double EI_, fmatvec::Vec g_);
00062 
00066       virtual ~FiniteElement1s21RCM() {}
00067 
00068       /* INHERITED INTERFACE */
00069       virtual const fmatvec::SymMat& getM() const { return M; }
00070       virtual const fmatvec::Vec& geth() const { return h; }
00071       virtual const fmatvec::SqrMat& getdhdq() const { return Dhq; }    
00072       virtual const fmatvec::SqrMat& getdhdu() const { return Dhqp; }
00073       virtual int getqSize() const { return 8; }
00074       virtual int getuSize() const { return 8; }
00075       virtual void computeM(const fmatvec::Vec& qElement);
00076       virtual void computeh(const fmatvec::Vec& qElement, const fmatvec::Vec& qpElement);
00077       virtual void computedhdz(const fmatvec::Vec& qElement, const fmatvec::Vec& qpElement);
00078       virtual double computeKineticEnergy(const fmatvec::Vec& qElement, const fmatvec::Vec& qpElement);
00079       virtual double computeGravitationalEnergy(const fmatvec::Vec& qElement);
00080       virtual double computeElasticEnergy(const fmatvec::Vec& qElement);
00081       virtual fmatvec::Vec computePosition(const fmatvec::Vec&q, const MBSim::ContourPointData& cp) { throw MBSim::MBSimError("ERROR (FiniteElement1s21RCM::computePosition): not implemented!"); }
00082       virtual fmatvec::SqrMat computeOrientation(const fmatvec::Vec&q, const MBSim::ContourPointData& cp) { throw MBSim::MBSimError("ERROR (FiniteElement1s21RCM::computeOrientation): not implemented!"); }
00083       virtual fmatvec::Vec computeVelocity (const fmatvec::Vec&q, const fmatvec::Vec&u, const MBSim::ContourPointData& cp) { throw MBSim::MBSimError("ERROR (FiniteElement1s21RCM::computeVelocity): not implemented!"); }
00084       virtual fmatvec::Vec computeAngularVelocity(const fmatvec::Vec&q, const fmatvec::Vec&u, const MBSim::ContourPointData& cp) { throw MBSim::MBSimError("ERROR (FiniteElement1s21RCM::computeAngularVelocity): not implemented!"); }
00085       virtual fmatvec::Mat computeJacobianOfMotion(const fmatvec::Vec&q, const MBSim::ContourPointData& cp) { return JGeneralized(q,cp.getLagrangeParameterPosition()(0)); }
00086       /***************************************************/
00090       fmatvec::Vec computeAdditionalElementData(fmatvec::Vec &qElement, fmatvec::Vec &qpElement);
00091 
00092       /* GETTER / SETTER */
00093       void setCurlRadius(double);
00094       void setMaterialDamping(double);
00095       void setLehrDamping(double);
00096       /***************************************************/
00097 
00103       fmatvec::Vec LocateBeam(const fmatvec::Vec&q, const double &s);
00104 
00111       fmatvec::Vec StateBeam(const fmatvec::Vec&q, const fmatvec::Vec&u, const double &s);
00112 
00118       fmatvec::Mat JGeneralizedInternal(const fmatvec::Vec& qElement, const double& s);
00119 
00125       fmatvec::Mat JGeneralized (const fmatvec::Vec& qElement, const double& s);
00126 
00134       fmatvec::Mat JpGeneralized(const fmatvec::Vec& qElement, const fmatvec::Vec& qpElement, const double& s,const double& sp);
00135 
00141       fmatvec::Vec ElementData(fmatvec::Vec qElement, fmatvec::Vec qpElement);
00142 
00143     protected:
00147       double l0, Arho, EA, EI;
00148 
00152       double wss0;
00153 
00157       double depsilon;
00158 
00162       fmatvec::Vec g;
00163 
00167       fmatvec::SymMat M;
00168 
00172       fmatvec::Vec h;
00173 
00177       fmatvec::SqrMat Dhq, Dhqp;
00178 
00182       fmatvec::SqrMat Damp;
00183 
00187       fmatvec::Vec qLocal, qpLocal, hIntermediate;
00188 
00192       fmatvec::SymMat MLocal;
00193 
00197       fmatvec::SqrMat Jeg, Jegp;
00198 
00202       fmatvec::Vec qElement_Old, qpElement_Old;
00203 
00207       double tol_comp;
00208 
00209     private:
00215       void BuildqLocal(const fmatvec::Vec& qGlobal, fmatvec::Vec& qLocal);
00216 
00222       void BuildJacobi(const fmatvec::Vec& qLocal, fmatvec::SqrMat& Jeg);
00223 
00231       void BuildJacobi(const fmatvec::Vec& qLocal, const fmatvec::Vec& qpIntern, fmatvec::SqrMat& Jeg, fmatvec::SqrMat& Jegp);
00232 
00240       fmatvec::Vec LocateLocalBeam(const fmatvec::Vec& qLocal, const fmatvec::Vec& qpLocal, const double& s, const bool calcAll=true);
00241 
00253       fmatvec::Mat hFullJacobi(const fmatvec::Vec& qElement, const fmatvec::Vec& qpElement, const fmatvec::Vec& qLocal, const fmatvec::Vec& qpLocal, const fmatvec::SqrMat& Jeg, const fmatvec::SqrMat& Jegp, const fmatvec::SymMat& MLocal, const fmatvec::Vec& hIntermediate);
00254 
00258       double l0h2, l0h3, l0h4, l0h5, l0h7, l0h8;
00259   };
00260 
00261   inline double Sec(const double& alpha) { return 1.0/cos(alpha); }
00262   inline double Power(double base, int exponent) { return pow(base,exponent); }
00263 
00264 }
00265 
00266 #endif /* _FINITE_ELEMENT_1S_21_RCM_H_ */
00267