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 computeElasticEnergy(const fmatvec::Vec& qElement);
00075       virtual fmatvec::Vec computePosition(const fmatvec::Vec& qElement, const MBSim::ContourPointData& cp) { throw MBSim::MBSimError("ERROR (FiniteElement1s21RCM::computePosition): not implemented!"); }
00076       virtual fmatvec::SqrMat computeOrientation(const fmatvec::Vec& qElement, const MBSim::ContourPointData& cp) { throw MBSim::MBSimError("ERROR (FiniteElement1s21RCM::computeOrientation): not implemented!"); }
00077       virtual fmatvec::Vec computeVelocity (const fmatvec::Vec& qElement, const fmatvec::Vec& qpElement, const MBSim::ContourPointData& cp) { throw MBSim::MBSimError("ERROR (FiniteElement1s21RCM::computeVelocity): not implemented!"); }
00078       virtual fmatvec::Vec computeAngularVelocity(const fmatvec::Vec& qElement, const fmatvec::Vec& qpElement, const MBSim::ContourPointData& cp) { throw MBSim::MBSimError("ERROR (FiniteElement1s21RCM::computeAngularVelocity): not implemented!"); }
00079       virtual fmatvec::Mat computeJacobianOfMotion(const fmatvec::Vec& qElement, const MBSim::ContourPointData& cp) { return JGeneralized(qElement,cp.getLagrangeParameterPosition()(0)); }
00080       /***************************************************/
00084       fmatvec::Vec computeAdditionalElementData(fmatvec::Vec &qElement, fmatvec::Vec &qpElement);
00085 
00086       /* GETTER / SETTER */
00087       void setCurlRadius(double R);
00088       void setMaterialDamping(double depsilons);
00089       void setLehrDamping(double D);
00090       /***************************************************/
00091 
00098       fmatvec::Vec LocateBeam(const fmatvec::Vec&q, const double &s);
00099 
00107       fmatvec::Vec StateBeam(const fmatvec::Vec& qElement, const fmatvec::Vec& qpElement, const double &s);
00108 
00115       fmatvec::Mat JGeneralizedInternal(const fmatvec::Vec& qElement, const double& s);
00116 
00123       fmatvec::Mat JGeneralized (const fmatvec::Vec& qElement, const double& s);
00124 
00133       fmatvec::Mat JpGeneralized(const fmatvec::Vec& qElement, const fmatvec::Vec& qpElement, const double& s,const double& sp);
00134 
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 
00241       fmatvec::Vec LocateLocalBeam(const fmatvec::Vec& qLocal, const fmatvec::Vec& qpLocal, const double& s, const bool calcAll=true);
00242 
00255       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);
00256 
00260       double l0h2, l0h3, l0h4, l0h5, l0h7, l0h8;
00261       
00265       FiniteElement1s21RCM() {};
00266   };
00267 
00268   inline double Sec(const double& alpha) { return 1.0/cos(alpha); }
00269   inline double Power(double base, int exponent) { return pow(base,exponent); }
00270 }
00271 
00272 #endif /* _FINITE_ELEMENT_1S_21_RCM_H_ */
00273