mbsimflexiblebody  3.0.0
finite_element_1s_33_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  */
19 
20 #ifndef _FINITE_ELEMENT_1S_33_RCM_H_
21 #define _FINITE_ELEMENT_1S_33_RCM_H_
22 
23 #include "mbsim/discretization_interface.h"
24 #include "mbsim/mbsim_event.h"
25 #include "mbsim/contour_pdata.h"
26 #include "mbsimFlexibleBody/pointer.h"
27 #include "mbsimFlexibleBody/flexible_body/finite_elements/finite_element_1s_33_rcm/weight33RCM.h"
28 #include "fmatvec.h"
29 
30 namespace MBSimFlexibleBody {
31 
41  class FiniteElement1s33RCM : public MBSim::DiscretizationInterface {
42  public:
56  FiniteElement1s33RCM(double l0_,double rho_,double A_,double E_,double G_,double I1_,double I2_,double I0_,const fmatvec::Vec& g_,RevCardanPtr ag_);
57 
61  virtual ~FiniteElement1s33RCM() {}
62 
63  /* INHERITED INTERFACE OF DISCRETIZATIONINTERFACE */
64  virtual const fmatvec::SymMat& getM() const;
65  virtual const fmatvec::Vec& geth() const;
66  virtual const fmatvec::SqrMat& getdhdq() const;
67  virtual const fmatvec::SqrMat& getdhdu() const;
68  virtual int getqSize() const;
69  virtual int getuSize() const;
70 
71  virtual void computeM(const fmatvec::Vec& qG);
72  virtual void computeh(const fmatvec::Vec& qG,const fmatvec::Vec& qGt);
73  virtual void computedhdz(const fmatvec::Vec& qG, const fmatvec::Vec& qGt);
74  virtual double computeKineticEnergy(const fmatvec::Vec& qG,const fmatvec::Vec& qGt);
75  virtual double computeGravitationalEnergy(const fmatvec::Vec& qG);
76  virtual double computeElasticEnergy(const fmatvec::Vec& qG);
77 
78  virtual fmatvec::Vec computePosition(const fmatvec::Vec& q, const MBSim::ContourPointData &data);
79  virtual fmatvec::SqrMat computeOrientation(const fmatvec::Vec& q, const MBSim::ContourPointData &data);
80  virtual fmatvec::Vec computeVelocity(const fmatvec::Vec& q, const fmatvec::Vec& u, const MBSim::ContourPointData &data);
81  virtual fmatvec::Vec computeAngularVelocity(const fmatvec::Vec& q, const fmatvec::Vec& u, const MBSim::ContourPointData &data);
82  virtual fmatvec::Mat computeJacobianOfMotion(const fmatvec::Vec& qG,const MBSim::ContourPointData& data);
83  /*****************************************************/
84 
85  /* GETTER / SETTER */
86  void setGauss(int nGauss);
87  void setCurlRadius(double R1,double R2);
88  void setMaterialDamping(double epstD_,double k0D_);
89  void setLehrDamping(double epstL,double k0L);
90  double getl0() const;
91  /*****************************************************/
92 
99  const fmatvec::Vec& computeState(const fmatvec::Vec& qG,const fmatvec::Vec& qGt,double x);
100 
106  fmatvec::Mat computeJXqG(const fmatvec::Vec& qG,double x);
107 
113  fmatvec::Vec computeData(const fmatvec::Vec& qG,const fmatvec::Vec& qGt);
114 
115  private:
119  double l0;
120 
124  double rho;
125 
129  double A;
130 
134  double E;
135 
139  double G;
140 
144  double I1, I2, I0;
145 
149  fmatvec::Vec g;
150 
154  double k10, k20;
155 
159  double epstD, k0D;
160 
164  fmatvec::SymMat M;
165  fmatvec::Vec h;
166 
170  fmatvec::SqrMat dhdq, dhdu;
171 
175  fmatvec::SymMat MI;
176 
180  fmatvec::SqrMat Damp;
181 
185  double l0h2, l0h3;
186 
190  double x_Old;
191 
195  fmatvec::Vec X;
196 
200  fmatvec::Vec qG_Old, qGt_Old;
201 
205  double tol_comp;
206 
210  fmatvec::Mat drS, drSH;
211  fmatvec::RowVec depstil, dk0;
212 
216  RevCardanPtr ag;
217 
221  Trafo33RCMPtr tf;
222 
226  Weight33RCMPtr wt;
227 
231  void computedrS();
232 
236  void computedepstil();
237 
241  void computedk0();
242  };
243 
244  inline void FiniteElement1s33RCM::setGauss(int nGauss) { wt->setGauss(nGauss); }
245  inline double FiniteElement1s33RCM::getl0() const { return l0; }
246  inline const fmatvec::SymMat& FiniteElement1s33RCM::getM() const { return M; }
247  inline const fmatvec::Vec& FiniteElement1s33RCM::geth() const { return h; }
248  inline const fmatvec::SqrMat& FiniteElement1s33RCM::getdhdq() const { return dhdq; }
249  inline const fmatvec::SqrMat& FiniteElement1s33RCM::getdhdu() const { return dhdu; }
250  inline int FiniteElement1s33RCM::getqSize() const { return 16; }
251  inline int FiniteElement1s33RCM::getuSize() const { return 16; }
252  inline fmatvec::Vec FiniteElement1s33RCM::computePosition(const fmatvec::Vec& q, const MBSim::ContourPointData &data) { throw MBSim::MBSimError("ERROR (FiniteElement1s33RCM::computePosition): Not implemented!"); }
253  inline fmatvec::SqrMat FiniteElement1s33RCM::computeOrientation(const fmatvec::Vec& q, const MBSim::ContourPointData &data) { throw MBSim::MBSimError("ERROR (FiniteElement1s33RCM::computeOrientation): Not implemented!"); }
254  inline fmatvec::Vec FiniteElement1s33RCM::computeVelocity(const fmatvec::Vec& q, const fmatvec::Vec& u, const MBSim::ContourPointData &data) { throw MBSim::MBSimError("ERROR (FiniteElement1s33RCM::computeVelocity): Not implemented!"); }
255  inline fmatvec::Vec FiniteElement1s33RCM::computeAngularVelocity(const fmatvec::Vec& q, const fmatvec::Vec& u, const MBSim::ContourPointData &data) { throw MBSim::MBSimError("ERROR (FiniteElement1s33RCM::computeAngularVelocity): Not implemented!"); }
256  inline fmatvec::Mat FiniteElement1s33RCM::computeJacobianOfMotion(const fmatvec::Vec& qG,const MBSim::ContourPointData& data) { return computeJXqG(qG,data.getLagrangeParameterPosition()(0)); }
257 
258 }
259 
260 #endif /* _FINITE_ELEMENT_1S_33_RCM_H_ */
261