mbsimflexiblebody  4.0.0
finite_element_1s_21_rcm.h
00001 /* Copyright (C) 2004-2014 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_21_RCM_H_
00021 #define _FINITE_ELEMENT_1S_21_RCM_H_
00022 
00023 #include "mbsim/discretization_interface.h"
00024 #include "mbsim/contour_pdata.h"
00025 #include "mbsim/mbsim_event.h"
00026 #include "fmatvec/fmatvec.h"
00027 
00028 namespace MBSimFlexibleBody {
00029 
00045   class FiniteElement1s21RCM : public MBSim::DiscretizationInterface {
00046     public:
00055       FiniteElement1s21RCM(double l0_, double  Arho_, double EA_, double EI_, fmatvec::Vec g_);
00056 
00060       virtual ~FiniteElement1s21RCM() {}
00061 
00062       /* INHERITED INTERFACE */
00063       virtual const fmatvec::SymMat& getM() const { return M; }
00064       virtual const fmatvec::Vec& geth() const { return h; }
00065       virtual const fmatvec::SqrMat& getdhdq() const { return Dhq; }    
00066       virtual const fmatvec::SqrMat& getdhdu() const { return Dhqp; }
00067       virtual int getqSize() const { return 8; }
00068       virtual int getuSize() const { return 8; }
00069       virtual void computeM(const fmatvec::Vec& qElement);
00070       virtual void computeh(const fmatvec::Vec& qElement, const fmatvec::Vec& qpElement);
00071       virtual void computedhdz(const fmatvec::Vec& qElement, const fmatvec::Vec& qpElement);
00072       virtual double computeKineticEnergy(const fmatvec::Vec& qElement, const fmatvec::Vec& qpElement);
00073       virtual double computeGravitationalEnergy(const fmatvec::Vec& qElement);
00074       virtual double computePhysicalStrain(const fmatvec::Vec& qElement);
00075       virtual double computeElasticEnergy(const fmatvec::Vec& qElement);
00076       virtual fmatvec::Vec computePosition(const fmatvec::Vec& qElement, const MBSim::ContourPointData& cp) { throw MBSim::MBSimError("(FiniteElement1s21RCM::computePosition): not implemented!"); }
00077       virtual fmatvec::SqrMat computeOrientation(const fmatvec::Vec& qElement, const MBSim::ContourPointData& cp) { throw MBSim::MBSimError("(FiniteElement1s21RCM::computeOrientation): not implemented!"); }
00078       virtual fmatvec::Vec computeVelocity (const fmatvec::Vec& qElement, const fmatvec::Vec& qpElement, const MBSim::ContourPointData& cp) { throw MBSim::MBSimError("(FiniteElement1s21RCM::computeVelocity): not implemented!"); }
00079       virtual fmatvec::Vec computeAngularVelocity(const fmatvec::Vec& qElement, const fmatvec::Vec& qpElement, const MBSim::ContourPointData& cp) { throw MBSim::MBSimError("(FiniteElement1s21RCM::computeAngularVelocity): not implemented!"); }
00080       virtual fmatvec::Mat computeJacobianOfMotion(const fmatvec::Vec& qElement, const MBSim::ContourPointData& cp) { return JGeneralized(qElement,cp.getLagrangeParameterPosition()(0)); }
00081       /***************************************************/
00085       fmatvec::Vec computeAdditionalElementData(fmatvec::Vec &qElement, fmatvec::Vec &qpElement);
00086 
00087       /* GETTER / SETTER */
00088       void setCurlRadius(double R);
00089       void setMaterialDamping(double depsilons);
00090       void setLehrDamping(double D);
00091       /***************************************************/
00092 
00099       fmatvec::Vec LocateBeam(const fmatvec::Vec&q, const double &s);
00100 
00108       fmatvec::Vec StateBeam(const fmatvec::Vec& qElement, const fmatvec::Vec& qpElement, const double &s);
00109 
00116       fmatvec::Mat JGeneralizedInternal(const fmatvec::Vec& qElement, const double& s);
00117 
00124       fmatvec::Mat JGeneralized (const fmatvec::Vec& qElement, const double& s);
00125 
00134       fmatvec::Mat JpGeneralized(const fmatvec::Vec& qElement, const fmatvec::Vec& qpElement, const double& s,const double& sp);
00135 
00142       fmatvec::Vec ElementData(fmatvec::Vec qElement, fmatvec::Vec qpElement);
00143 
00144     protected:
00148       double l0, Arho, EA, EI;
00149 
00153       double wss0;
00154 
00158       double depsilon;
00159 
00163       fmatvec::Vec g;
00164 
00168       fmatvec::SymMat M;
00169 
00173       fmatvec::Vec h;
00174 
00178       fmatvec::SqrMat Dhq, Dhqp;
00179 
00183       fmatvec::SqrMat Damp;
00184 
00188       fmatvec::Vec qLocal, qpLocal, hIntermediate;
00189 
00193       fmatvec::SymMat MLocal;
00194 
00198       fmatvec::SqrMat Jeg, Jegp;
00199 
00203       fmatvec::Vec qElement_Old, qpElement_Old;
00204 
00208       double tol_comp;
00209 
00210     private:
00216       void BuildqLocal(const fmatvec::Vec& qGlobal, fmatvec::Vec& qLocal);
00217 
00223       void BuildJacobi(const fmatvec::Vec& qLocal, fmatvec::SqrMat& Jeg);
00224 
00232       void BuildJacobi(const fmatvec::Vec& qLocal, const fmatvec::Vec& qpIntern, fmatvec::SqrMat& Jeg, fmatvec::SqrMat& Jegp);
00233 
00242       fmatvec::Vec LocateLocalBeam(const fmatvec::Vec& qLocal, const fmatvec::Vec& qpLocal, const double& s, const bool calcAll=true);
00243 
00256       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);
00257 
00261       double l0h2, l0h3, l0h4, l0h5, l0h7, l0h8;
00262       
00266       FiniteElement1s21RCM() {};
00267   };
00268 
00269   inline double Sec(const double& alpha) { return 1.0/cos(alpha); }
00270   inline double Power(double base, int exponent) { return pow(base,exponent); }
00271 }
00272 
00273 #endif /* _FINITE_ELEMENT_1S_21_RCM_H_ */
00274