mbsimflexiblebody  3.0.0
finite_element_1s_23_bta.h
1 /* Copyright (C) 2004-2011 MBSim Development Team
2  *
3  * This library is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU Lesser General Public
5  * License as published by the Free Software Foundation; either
6  * version 2.1 of the License, or (at your option) any later version.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with this library; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16  *
17  * Contact: thorsten.schindler@mytum.de
18  * rzander@users.berlios.de
19  */
20 
21 #ifndef _FINITE_ELEMENT_1S_23_BTA_H_
22 #define _FINITE_ELEMENT_1S_23_BTA_H_
23 
24 #include "mbsim/discretization_interface.h"
25 #include "mbsim/contour_pdata.h"
26 #include "mbsim/mbsim_event.h"
27 #include "fmatvec.h"
28 
29 namespace MBSimFlexibleBody {
30 
39  class FiniteElement1s23BTA : public MBSim::DiscretizationInterface {
40  public:
51  FiniteElement1s23BTA(double l0, double Arho, double EIyy, double EIzz, double Itrho, double GIt, fmatvec::Vec g);
52 
56  virtual ~FiniteElement1s23BTA() {}
57 
58  /* INHERITED INTERFACE OF DISCRETIZATIONINTERFACE */
59  virtual const fmatvec::SymMat& getM() const;
60  virtual const fmatvec::Vec& geth() const;
61  virtual const fmatvec::SqrMat& getdhdq() const;
62  virtual const fmatvec::SqrMat& getdhdu() const;
63  virtual int getqSize() const;
64  virtual int getuSize() const;
65 
66  virtual void computeM(const fmatvec::Vec& qG);
67  virtual void computeh(const fmatvec::Vec& qG,const fmatvec::Vec& qGt);
68  virtual void computedhdz(const fmatvec::Vec& qG, const fmatvec::Vec& qGt);
69  virtual double computeKineticEnergy(const fmatvec::Vec& q,const fmatvec::Vec& u);
70  virtual double computeGravitationalEnergy(const fmatvec::Vec& q);
71  virtual double computeElasticEnergy(const fmatvec::Vec& q);
72 
73  virtual fmatvec::Vec computePosition(const fmatvec::Vec& q, const MBSim::ContourPointData &data);
74  virtual fmatvec::SqrMat computeOrientation(const fmatvec::Vec& q, const MBSim::ContourPointData& data);
75  virtual fmatvec::Vec computeVelocity(const fmatvec::Vec& q, const fmatvec::Vec& u, const MBSim::ContourPointData &data);
76  virtual fmatvec::Vec computeAngularVelocity(const fmatvec::Vec& q, const fmatvec::Vec& u, const MBSim::ContourPointData &data);
77  virtual fmatvec::Mat computeJacobianOfMotion(const fmatvec::Vec& q,const MBSim::ContourPointData &data);
78  /*****************************************************/
79 
80  /* GETTER / SETTER */
81  void setMaterialDamping(double) { throw MBSim::MBSimError("ERROR (FiniteElement1s23BTA:setMaterialDamping): Not implemented!"); }
82  void setLehrDamping(double) { throw MBSim::MBSimError("ERROR (FiniteElement1s23BTA:setLehrDamping): Not implemented!"); }
83  void setTorsionalDamping(double dTorsional_) { dTorsional=dTorsional_; }
84  /*****************************************************/
85 
91  fmatvec::Vec Tangent(const fmatvec::Vec& q, const double& s);
92 
98  fmatvec::SqrMat AWK(const fmatvec::Vec& q, const double& s);
99 
107  fmatvec::Vec StateAxis(const fmatvec::Vec& q, const fmatvec::Vec& v, const double& s);
108 
115  fmatvec::Mat JGeneralized(const fmatvec::Vec& q, const double& s);
116 
117  private:
121  double l0;
122 
126  double Arho;
127 
131  double EIyy, EIzz;
132 
136  double Itrho;
137 
141  double GIt;
142 
146  fmatvec::Vec g;
147 
151  double depsilon, dTorsional;
152 
156  fmatvec::SymMat M;
157  fmatvec::Vec h;
158 
162  fmatvec::SqrMat Dhq, Dhqp;
163 
167  fmatvec::SqrMat Damp;
168 
172  double l0h2, l0h3;
173  };
174 
175  inline const fmatvec::SymMat& FiniteElement1s23BTA::getM() const { return M; }
176  inline const fmatvec::Vec& FiniteElement1s23BTA::geth() const { return h; }
177  inline const fmatvec::SqrMat& FiniteElement1s23BTA::getdhdq() const { return Dhq; }
178  inline const fmatvec::SqrMat& FiniteElement1s23BTA::getdhdu() const { return Dhqp; }
179  inline int FiniteElement1s23BTA::getqSize() const { return 10; }
180  inline int FiniteElement1s23BTA::getuSize() const { return 10; }
181  inline double FiniteElement1s23BTA::computeKineticEnergy(const fmatvec::Vec& q,const fmatvec::Vec& u) { throw MBSim::MBSimError("ERROR (FiniteElement1s23BTA:computeKineticEnergy): Not implemented!"); }
182  inline double FiniteElement1s23BTA::computeGravitationalEnergy(const fmatvec::Vec& q) { throw MBSim::MBSimError("ERROR WARNING (FiniteElement1s23BTA:computeGravitationalEnergy): Not implemented!"); }
183  inline double FiniteElement1s23BTA::computeElasticEnergy(const fmatvec::Vec& q) { throw MBSim::MBSimError("ERROR (FiniteElement1s23BTA:computeElasticEnergy): Not implemented!"); }
184  inline fmatvec::Vec FiniteElement1s23BTA::computePosition(const fmatvec::Vec& q, const MBSim::ContourPointData &data) {throw MBSim::MBSimError("ERROR (FiniteElement1s23BTA::computePosition): Not implemented!"); }
185  inline fmatvec::SqrMat FiniteElement1s23BTA::computeOrientation(const fmatvec::Vec& q, const MBSim::ContourPointData &data) { throw MBSim::MBSimError("ERROR (FiniteElement1s23BTA::computeOrientation): Not implemented!"); }
186  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!");}
187  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!"); }
188  inline fmatvec::Mat FiniteElement1s23BTA::computeJacobianOfMotion(const fmatvec::Vec& q,const MBSim::ContourPointData &data) { return JGeneralized(q,data.getLagrangeParameterPosition()(0)); }
189 
190  inline double Sec(const double& alpha) { return 1.0/cos(alpha); }
191  inline double Power(double base, int exponent) { return pow(base,exponent); }
192 }
193 
194 #endif /* _FINITE_ELEMENT_1S_23_BTA_H_ */
195