mbsimflexiblebody  3.0.0
finite_element_1s_21_rcm.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_21_RCM_H_
22 #define _FINITE_ELEMENT_1S_21_RCM_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 
46  class FiniteElement1s21RCM : public MBSim::DiscretizationInterface {
47  public:
52 
61  FiniteElement1s21RCM(double l0_, double Arho_, double EA_, double EI_, fmatvec::Vec g_);
62 
66  virtual ~FiniteElement1s21RCM() {}
67 
68  /* INHERITED INTERFACE */
69  virtual const fmatvec::SymMat& getM() const { return M; }
70  virtual const fmatvec::Vec& geth() const { return h; }
71  virtual const fmatvec::SqrMat& getdhdq() const { return Dhq; }
72  virtual const fmatvec::SqrMat& getdhdu() const { return Dhqp; }
73  virtual int getqSize() const { return 8; }
74  virtual int getuSize() const { return 8; }
75  virtual void computeM(const fmatvec::Vec& qElement);
76  virtual void computeh(const fmatvec::Vec& qElement, const fmatvec::Vec& qpElement);
77  virtual void computedhdz(const fmatvec::Vec& qElement, const fmatvec::Vec& qpElement);
78  virtual double computeKineticEnergy(const fmatvec::Vec& qElement, const fmatvec::Vec& qpElement);
79  virtual double computeGravitationalEnergy(const fmatvec::Vec& qElement);
80  virtual double computeElasticEnergy(const fmatvec::Vec& qElement);
81  virtual fmatvec::Vec computePosition(const fmatvec::Vec&q, const MBSim::ContourPointData& cp) { throw MBSim::MBSimError("ERROR (FiniteElement1s21RCM::computePosition): not implemented!"); }
82  virtual fmatvec::SqrMat computeOrientation(const fmatvec::Vec&q, const MBSim::ContourPointData& cp) { throw MBSim::MBSimError("ERROR (FiniteElement1s21RCM::computeOrientation): not implemented!"); }
83  virtual fmatvec::Vec computeVelocity (const fmatvec::Vec&q, const fmatvec::Vec&u, const MBSim::ContourPointData& cp) { throw MBSim::MBSimError("ERROR (FiniteElement1s21RCM::computeVelocity): not implemented!"); }
84  virtual fmatvec::Vec computeAngularVelocity(const fmatvec::Vec&q, const fmatvec::Vec&u, const MBSim::ContourPointData& cp) { throw MBSim::MBSimError("ERROR (FiniteElement1s21RCM::computeAngularVelocity): not implemented!"); }
85  virtual fmatvec::Mat computeJacobianOfMotion(const fmatvec::Vec&q, const MBSim::ContourPointData& cp) { return JGeneralized(q,cp.getLagrangeParameterPosition()(0)); }
86  /***************************************************/
90  fmatvec::Vec computeAdditionalElementData(fmatvec::Vec &qElement, fmatvec::Vec &qpElement);
91 
92  /* GETTER / SETTER */
93  void setCurlRadius(double);
94  void setMaterialDamping(double);
95  void setLehrDamping(double);
96  /***************************************************/
97 
103  fmatvec::Vec LocateBeam(const fmatvec::Vec&q, const double &s);
104 
111  fmatvec::Vec StateBeam(const fmatvec::Vec&q, const fmatvec::Vec&u, const double &s);
112 
118  fmatvec::Mat JGeneralizedInternal(const fmatvec::Vec& qElement, const double& s);
119 
125  fmatvec::Mat JGeneralized (const fmatvec::Vec& qElement, const double& s);
126 
134  fmatvec::Mat JpGeneralized(const fmatvec::Vec& qElement, const fmatvec::Vec& qpElement, const double& s,const double& sp);
135 
141  fmatvec::Vec ElementData(fmatvec::Vec qElement, fmatvec::Vec qpElement);
142 
143  protected:
147  double l0, Arho, EA, EI;
148 
152  double wss0;
153 
157  double depsilon;
158 
162  fmatvec::Vec g;
163 
167  fmatvec::SymMat M;
168 
172  fmatvec::Vec h;
173 
177  fmatvec::SqrMat Dhq, Dhqp;
178 
182  fmatvec::SqrMat Damp;
183 
187  fmatvec::Vec qLocal, qpLocal, hIntermediate;
188 
192  fmatvec::SymMat MLocal;
193 
197  fmatvec::SqrMat Jeg, Jegp;
198 
202  fmatvec::Vec qElement_Old, qpElement_Old;
203 
207  double tol_comp;
208 
209  private:
215  void BuildqLocal(const fmatvec::Vec& qGlobal, fmatvec::Vec& qLocal);
216 
222  void BuildJacobi(const fmatvec::Vec& qLocal, fmatvec::SqrMat& Jeg);
223 
231  void BuildJacobi(const fmatvec::Vec& qLocal, const fmatvec::Vec& qpIntern, fmatvec::SqrMat& Jeg, fmatvec::SqrMat& Jegp);
232 
240  fmatvec::Vec LocateLocalBeam(const fmatvec::Vec& qLocal, const fmatvec::Vec& qpLocal, const double& s, const bool calcAll=true);
241 
253  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);
254 
258  double l0h2, l0h3, l0h4, l0h5, l0h7, l0h8;
259  };
260 
261  inline double Sec(const double& alpha) { return 1.0/cos(alpha); }
262  inline double Power(double base, int exponent) { return pow(base,exponent); }
263 
264 }
265 
266 #endif /* _FINITE_ELEMENT_1S_21_RCM_H_ */
267