mbsimflexiblebody  3.2.0
finite_element_1s_23_bta.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_23_BTA_H_
00022 #define _FINITE_ELEMENT_1S_23_BTA_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 
00039   class FiniteElement1s23BTA : public MBSim::DiscretizationInterface {
00040     public:
00051       FiniteElement1s23BTA(double l0, double Arho, double EIyy, double EIzz, double Itrho, double GIt, fmatvec::Vec g);
00052 
00056       virtual ~FiniteElement1s23BTA() {}
00057 
00058       /* INHERITED INTERFACE OF DISCRETIZATIONINTERFACE */
00059       virtual const fmatvec::SymMat& getM() const;    
00060       virtual const fmatvec::Vec& geth() const;
00061       virtual const fmatvec::SqrMat& getdhdq() const;    
00062       virtual const fmatvec::SqrMat& getdhdu() const;
00063       virtual int getqSize() const;
00064       virtual int getuSize() const;
00065 
00066       virtual void computeM(const fmatvec::Vec& qG);
00067       virtual void computeh(const fmatvec::Vec& qG,const fmatvec::Vec& qGt);
00068       virtual void computedhdz(const fmatvec::Vec& qG, const fmatvec::Vec& qGt);
00069       virtual double computeKineticEnergy(const fmatvec::Vec& q,const fmatvec::Vec& u);
00070       virtual double computeGravitationalEnergy(const fmatvec::Vec& q);    
00071       virtual double computeElasticEnergy(const fmatvec::Vec& q);
00072 
00073       virtual fmatvec::Vec computePosition(const fmatvec::Vec& q, const MBSim::ContourPointData &data);
00074       virtual fmatvec::SqrMat computeOrientation(const fmatvec::Vec& q, const MBSim::ContourPointData& data);
00075       virtual fmatvec::Vec computeVelocity(const fmatvec::Vec& q, const fmatvec::Vec& u, const MBSim::ContourPointData &data);
00076       virtual fmatvec::Vec computeAngularVelocity(const fmatvec::Vec& q, const fmatvec::Vec& u, const MBSim::ContourPointData &data);
00077       virtual fmatvec::Mat computeJacobianOfMotion(const fmatvec::Vec& q,const MBSim::ContourPointData &data);
00078       /*****************************************************/ 
00079 
00080       /* GETTER / SETTER */
00081       void setMaterialDamping(double) { throw MBSim::MBSimError("ERROR (FiniteElement1s23BTA:setMaterialDamping): Not implemented!"); }
00082       void setLehrDamping(double) { throw MBSim::MBSimError("ERROR (FiniteElement1s23BTA:setLehrDamping): Not implemented!"); }
00083       void setTorsionalDamping(double dTorsional_) { dTorsional=dTorsional_; }
00084       /*****************************************************/ 
00085 
00091       fmatvec::Vec Tangent(const fmatvec::Vec& q, const double& s);
00092 
00098       fmatvec::SqrMat AWK(const fmatvec::Vec& q, const double& s);
00099 
00107       fmatvec::Vec StateAxis(const fmatvec::Vec& q, const fmatvec::Vec& v, const double& s); 
00108 
00115       fmatvec::Mat JGeneralized(const fmatvec::Vec& q, const double& s);
00116 
00117     private:
00121       double l0;
00122 
00126       double Arho;
00127 
00131       double EIyy, EIzz;
00132 
00136       double Itrho;
00137 
00141       double GIt;
00142 
00146       fmatvec::Vec g;
00147 
00151       double depsilon, dTorsional;
00152 
00156       fmatvec::SymMat M;
00157       fmatvec::Vec h;
00158 
00162       fmatvec::SqrMat Dhq, Dhqp;
00163 
00167       fmatvec::SqrMat Damp;
00168 
00172       double l0h2, l0h3;
00173   };
00174 
00175   inline const fmatvec::SymMat& FiniteElement1s23BTA::getM() const { return M; }    
00176   inline const fmatvec::Vec& FiniteElement1s23BTA::geth() const { return h; }
00177   inline const fmatvec::SqrMat& FiniteElement1s23BTA::getdhdq() const { return Dhq; }    
00178   inline const fmatvec::SqrMat& FiniteElement1s23BTA::getdhdu() const { return Dhqp; }
00179   inline int FiniteElement1s23BTA::getqSize() const { return 10; }
00180   inline int FiniteElement1s23BTA::getuSize() const { return 10; }
00181   inline double FiniteElement1s23BTA::computeKineticEnergy(const fmatvec::Vec& q,const fmatvec::Vec& u) { throw MBSim::MBSimError("ERROR (FiniteElement1s23BTA:computeKineticEnergy): Not implemented!"); }
00182   inline double FiniteElement1s23BTA::computeGravitationalEnergy(const fmatvec::Vec& q) { throw MBSim::MBSimError("ERROR WARNING (FiniteElement1s23BTA:computeGravitationalEnergy): Not implemented!"); }     
00183   inline double FiniteElement1s23BTA::computeElasticEnergy(const fmatvec::Vec& q) { throw MBSim::MBSimError("ERROR (FiniteElement1s23BTA:computeElasticEnergy): Not implemented!"); }
00184   inline fmatvec::Vec FiniteElement1s23BTA::computePosition(const fmatvec::Vec& q, const MBSim::ContourPointData &data) {throw MBSim::MBSimError("ERROR (FiniteElement1s23BTA::computePosition): Not implemented!"); }
00185   inline fmatvec::SqrMat FiniteElement1s23BTA::computeOrientation(const fmatvec::Vec& q, const MBSim::ContourPointData &data) { throw MBSim::MBSimError("ERROR (FiniteElement1s23BTA::computeOrientation): Not implemented!"); }
00186   inline fmatvec::Vec FiniteElement1s23BTA::computeVelocity(const fmatvec::Vec& q, const fmatvec::Vec& u, const MBSim::ContourPointData &data) { throw MBSim::MBSimError("ERROR (FiniteElement1s23BTA::computeVelocity): Not implemented!");}
00187   inline fmatvec::Vec FiniteElement1s23BTA::computeAngularVelocity(const fmatvec::Vec& q, const fmatvec::Vec& u, const MBSim::ContourPointData &data) { throw MBSim::MBSimError("ERROR (FiniteElement1s23BTA::computeAngularVelocity): Not implemented!"); }
00188   inline fmatvec::Mat FiniteElement1s23BTA::computeJacobianOfMotion(const fmatvec::Vec& q,const MBSim::ContourPointData &data) { return JGeneralized(q,data.getLagrangeParameterPosition()(0)); }
00189 
00190   inline double Sec(const double& alpha) { return 1.0/cos(alpha); }
00191   inline double Power(double base, int exponent) { return pow(base,exponent); }
00192 }
00193 
00194 #endif /* _FINITE_ELEMENT_1S_23_BTA_H_ */
00195