mbsimflexiblebody  4.0.0
MBSim Flexible Body Module
flexible_body_linear_external_ffr.h
1 /* Copyright (C) 2004-2015 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 _FLEXIBLE_BODY_LINEAR_EXTERNAL_FFR_H_
21 #define _FLEXIBLE_BODY_LINEAR_EXTERNAL_FFR_H_
22 
23 #include <iostream>
24 #include <fstream>
25 #include <sstream>
26 #include <string>
27 #include <cstdlib>
28 
29 #include "mbsim/frames/frame.h"
30 
31 #include "mbsimFlexibleBody/flexible_body.h"
32 #include "mbsimFlexibleBody/flexible_body/finite_elements/finite_element_linear_external_lumped_node.h"
33 
34 #include "mbsimFlexibleBody/frames/node_frame.h"
35 
36 //namespace unitTest{
37 // class linearExternalFFRTest;
38 //}
39 
40 namespace MBSimFlexibleBody {
41 
42  class NodeFrame;
43 
50  class FlexibleBodyLinearExternalFFR : public FlexibleBodyContinuum<fmatvec::Vec> /*, public FlexibleContourBody */{
51  public:
56  FlexibleBodyLinearExternalFFR(const std::string &name);
57 
61  ~FlexibleBodyLinearExternalFFR() override = default;
62 
63  /* INHERITED INTERFACE OF FLEIBLE BODY CONTOUR */
64  virtual int getNumberElements() const { return nNodes; }
65  virtual double getLength() const;
66  virtual bool isOpenStructure() const { return openStructure; }
67  /***************************************************/
68 
69  /* INHERITED INTERFACE OF FLEXIBLE BODY CONTINUUM */
71  /***************************************************/
72 
73  /* INHERITED INTERFACE OF OBJECTINTERFACE */
74  void updateM() override;
75  /***************************************************/
76 
77  /* INHERITED INTERFACE OF FLEXIBLE BODY */
78  void BuildElements() override;
79  void GlobalVectorContribution(int CurrentElement, const fmatvec::Vec& locVec, fmatvec::Vec& gloVec) override;
80  void GlobalMatrixContribution(int CurrentElement, const fmatvec::Mat& locMat, fmatvec::Mat& gloMat) override;
81  void GlobalMatrixContribution(int CurrentElement, const fmatvec::SymMat& locMat, fmatvec::SymMat& gloMat) override;
82  void updateh(int k = 0) override;
83  /***************************************************/
84 
85  /* INHERITED INTERFACE OF OBJECT */
86  void init(InitStage stage, const MBSim::InitConfigSet &config) override;
87  void calcqSize() override;
88  void calcuSize(int j) override;
89  /***************************************************/
90 
91  /* INHERITED INTERFACE OF ELEMENT */
92  /***************************************************/
93 
94  /* GETTER AND SETTER */
95  void setNumberOfModes(int nf_) {
96  nf = nf_;
97  }
98 
99  int getNumberModes() const {
100  return nf;
101  }
102 
103  MBSim::Frame * getFloatingFrameOfReference() {
104  return FFR;
105  }
106 
107  const fmatvec::Vec3 getModeShapeVector(int node, int column) const;
108 
112  void readFEMData(const std::string &inFilePath, const bool millimeterUnits, bool output = false);
113 
114  void enableFramePlot(double size = 1e-3, fmatvec::VecInt numbers = fmatvec::VecInt(0));
115 
116  void resetUpToDate() override;
117  const fmatvec::SqrMat3& evalA() { if(updAG) updateAGbarGbardot(); return A; }
118  const fmatvec::SqrMat3& evalG_bar() { if(updAG) updateAGbarGbardot(); return G_bar; }
119  const fmatvec::SqrMat3& evalG_bar_Dot() { if(updAG) updateAGbarGbardot(); return G_bar_Dot; }
120  const fmatvec::Vec& evalQv() { if(updQv) updateQv(); return Qv; }
121 
122  void updatePositions(MBSim::Frame *frame) override;
123  void updateVelocities(MBSim::Frame *frame) override;
124  void updateAccelerations(MBSim::Frame *frame) override;
125  void updateJacobians(MBSim::Frame *frame, int j=0) override;
126  void updateGyroscopicAccelerations(MBSim::Frame *frame) override;
127 
128  void updatePositions(int nodeIndex) override;
129  void updateVelocities(int nodeIndex) override;
130  void updateAccelerations(int nodeIndex) override;
131  void updateJacobians(int nodeIndex, int j=0) override;
132  void updateGyroscopicAccelerations(int nodeIndex) override;
133 
134  fmatvec::Vec3 evalLocalPosition(int i);
135 
136  protected:
140  void initM();
141 
145  void initQv();
146 
150  void updateQv();
151 
155  void computeShapeIntegrals();
156 
160  void updateAGbarGbardot();
161 
165  int nNodes;
166 
171 
175  fmatvec::Vec3 I_1;
176 
180  fmatvec::SymMat3 I_kl;
181 
185  fmatvec::Mat S_bar;
186 
190  fmatvec::SqrMat S_kl_bar[3][3];
191 
195  fmatvec::RowVec I_kl_bar[3][3];
196 
200  fmatvec::SymMat3 I_ThetaTheta_bar;
201 
205  fmatvec::Mat I_ThetaF_bar;
206 
210  fmatvec::SymMat K;
211 
215  fmatvec::SymMat KFull;
216 
220  fmatvec::SqrMat3 G_bar;
221 
225  fmatvec::SqrMat3 G_bar_Dot;
226 
230  fmatvec::SqrMat3 A;
231 
232  double M_RR{0};
233 
237  fmatvec::SymMat M_FF;
238 
242  fmatvec::Vec Qv;
243 
247  fmatvec::Vec mij;
248 
252  fmatvec::Mat phiFull;
253 
257  fmatvec::Mat phi;
258 
262  std::vector<fmatvec::Vec3> u0;
263 
267  int nf;
268 
273 
274  bool updAG, updQv;
275  };
276 
277 }
278 
279 #endif /* _FLEXIBLE_BODY_LINEAR_EXTERNAL_FFR_H_ */
void readFEMData(const std::string &inFilePath, const bool millimeterUnits, bool output=false)
read u0, mij, mode shape matrix and stiffness matrix form the input file
Definition: flexible_body_linear_external_ffr.cc:116
fmatvec::SymMat KFull
full stiffness matrix
Definition: flexible_body_linear_external_ffr.h:215
flexible body model based on floating frame reference using the system information external linear FE...
Definition: flexible_body_linear_external_ffr.h:50
fmatvec::Vec3 I_1
matrix for the computation of the mass-matrix (assembled part of the element matrix)
Definition: flexible_body_linear_external_ffr.h:175
void updateQv()
update the quadratic velocity vector
Definition: flexible_body_linear_external_ffr.cc:372
fmatvec::Vec mij
lumped mass for each node
Definition: flexible_body_linear_external_ffr.h:247
void GlobalVectorContribution(int CurrentElement, const fmatvec::Vec &locVec, fmatvec::Vec &gloVec) override
insert 'local' information in global vectors
Definition: flexible_body_linear_external_ffr.cc:669
void BuildElements() override
references finite element coordinates to assembled coordinates
Definition: flexible_body_linear_external_ffr.cc:665
fmatvec::SqrMat3 A
transformation matrix of coordinates of the moving frame of reference into the reference frame
Definition: flexible_body_linear_external_ffr.h:230
fmatvec::Mat phi
matrix of modes used
Definition: flexible_body_linear_external_ffr.h:257
fmatvec::SqrMat3 G_bar_Dot
transformation matrix of the time derivates of the angles into tho angular velocity in reference coor...
Definition: flexible_body_linear_external_ffr.h:225
fmatvec::Mat I_ThetaF_bar
I_ThetaF 3*nf.
Definition: flexible_body_linear_external_ffr.h:205
fmatvec::SymMat M_FF
matrix for the computation of the mass-matrix (assembled part of the element matrix)
Definition: flexible_body_linear_external_ffr.h:237
flexible body entirely described within MBSim holding all informations about continuum approximations
Definition: flexible_body.h:227
fmatvec::RowVec I_kl_bar[3][3]
matrix for the computation of the mass-matrix (assembled part of the element matrix)
Definition: flexible_body_linear_external_ffr.h:195
fmatvec::SqrMat3 G_bar
transformation matrix of the time derivates of the angles into tho angular velocity in reference coor...
Definition: flexible_body_linear_external_ffr.h:220
fmatvec::SymMat3 I_kl
matrix
Definition: flexible_body_linear_external_ffr.h:180
int nNodes
total number of nodes
Definition: flexible_body_linear_external_ffr.h:165
void computeShapeIntegrals()
compute the constant shape integrals of the whole body
Definition: flexible_body_linear_external_ffr.cc:417
bool openStructure
open or closed beam structure
Definition: flexible_body_linear_external_ffr.h:272
std::string name
std::vector< Frame * > frame
~FlexibleBodyLinearExternalFFR() override=default
destructor
fmatvec::SymMat3 I_ThetaTheta_bar
inertia tensor
Definition: flexible_body_linear_external_ffr.h:200
void initM()
initialize the mass matrix
Definition: flexible_body_linear_external_ffr.cc:274
MBSim::Frame * FFR
Floating Frame of Reference.
Definition: flexible_body_linear_external_ffr.h:170
void GlobalMatrixContribution(int CurrentElement, const fmatvec::Mat &locMat, fmatvec::Mat &gloMat) override
insert 'local' information in global matrices
Definition: flexible_body_linear_external_ffr.cc:673
FlexibleBodyLinearExternalFFR(const std::string &name)
constructor
Definition: flexible_body_linear_external_ffr.cc:39
fmatvec::Mat phiFull
matrix of all modes
Definition: flexible_body_linear_external_ffr.h:252
std::vector< fmatvec::Vec3 > u0
initial position of each node
Definition: flexible_body_linear_external_ffr.h:262
void initQv()
initialize the quadratic velocity vector
Definition: flexible_body_linear_external_ffr.cc:366
fmatvec::Mat S_bar
matrix for the computation of the mass-matrix (assembled part of the element matrix)
Definition: flexible_body_linear_external_ffr.h:185
fmatvec::Vec Qv
quadratic velocity vector
Definition: flexible_body_linear_external_ffr.h:242
fmatvec::SqrMat S_kl_bar[3][3]
matrix for the computation of the mass-matrix (assembled part of the element matrix)
Definition: flexible_body_linear_external_ffr.h:190
int nf
number of mode shapes used to describe the deformation
Definition: flexible_body_linear_external_ffr.h:267
void updateAGbarGbardot()
update A, G_bar, and G_bar_Dot
Definition: flexible_body_linear_external_ffr.cc:481
fmatvec::SymMat K
stiffness matrix
Definition: flexible_body_linear_external_ffr.h:210