mbsimflexiblebody 4.0.0 MBSim Flexible Body Module

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/fe/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 */
70 using FlexibleBodyContinuum<fmatvec::Vec>::addFrame;
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
170 MBSim::Frame * FFR;
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
272 bool openStructure;
273
274 bool updAG, updQv;
275 };
276
277 }
278
279 #endif /* _FLEXIBLE_BODY_LINEAR_EXTERNAL_FFR_H_ */
MBSimFlexibleBody::FlexibleBodyLinearExternalFFR::readFEMData
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: linear_external_ffr.cc:116
MBSimFlexibleBody::FlexibleBodyLinearExternalFFR::KFull
fmatvec::SymMat KFull
full stiffness matrix
Definition: linear_external_ffr.h:215
MBSimFlexibleBody::FlexibleBodyLinearExternalFFR
flexible body model based on floating frame reference using the system information external linear FE...
Definition: linear_external_ffr.h:50
MBSimFlexibleBody::FlexibleBodyLinearExternalFFR::I_1
fmatvec::Vec3 I_1
matrix for the computation of the mass-matrix (assembled part of the element matrix)
Definition: linear_external_ffr.h:175
MBSimFlexibleBody::FlexibleBodyLinearExternalFFR::updateQv
void updateQv()
update the quadratic velocity vector
Definition: linear_external_ffr.cc:372
MBSimFlexibleBody::FlexibleBodyLinearExternalFFR::mij
fmatvec::Vec mij
lumped mass for each node
Definition: linear_external_ffr.h:247
MBSimFlexibleBody::FlexibleBodyLinearExternalFFR::GlobalVectorContribution
void GlobalVectorContribution(int CurrentElement, const fmatvec::Vec &locVec, fmatvec::Vec &gloVec) override
insert 'local' information in global vectors
Definition: linear_external_ffr.cc:669
MBSimFlexibleBody::FlexibleBodyLinearExternalFFR::BuildElements
void BuildElements() override
references finite element coordinates to assembled coordinates
Definition: linear_external_ffr.cc:665
MBSimFlexibleBody::FlexibleBodyLinearExternalFFR::A
fmatvec::SqrMat3 A
transformation matrix of coordinates of the moving frame of reference into the reference frame
Definition: linear_external_ffr.h:230
MBSimFlexibleBody::FlexibleBodyLinearExternalFFR::phi
fmatvec::Mat phi
matrix of modes used
Definition: linear_external_ffr.h:257
MBSimFlexibleBody::FlexibleBodyLinearExternalFFR::G_bar_Dot
fmatvec::SqrMat3 G_bar_Dot
transformation matrix of the time derivates of the angles into tho angular velocity in reference coor...
Definition: linear_external_ffr.h:225
MBSimFlexibleBody::FlexibleBodyLinearExternalFFR::I_ThetaF_bar
fmatvec::Mat I_ThetaF_bar
I_ThetaF 3*nf.
Definition: linear_external_ffr.h:205
MBSimFlexibleBody::FlexibleBodyLinearExternalFFR::M_FF
fmatvec::SymMat M_FF
matrix for the computation of the mass-matrix (assembled part of the element matrix)
Definition: linear_external_ffr.h:237
MBSimFlexibleBody::FlexibleBodyContinuum
flexible body entirely described within MBSim holding all informations about continuum approximations
Definition: flexible_body.h:227
MBSimFlexibleBody::FlexibleBodyLinearExternalFFR::I_kl_bar
fmatvec::RowVec I_kl_bar[3][3]
matrix for the computation of the mass-matrix (assembled part of the element matrix)
Definition: linear_external_ffr.h:195
MBSimFlexibleBody::FlexibleBodyLinearExternalFFR::G_bar
fmatvec::SqrMat3 G_bar
transformation matrix of the time derivates of the angles into tho angular velocity in reference coor...
Definition: linear_external_ffr.h:220
MBSimFlexibleBody::FlexibleBodyLinearExternalFFR::I_kl
fmatvec::SymMat3 I_kl
matrix
Definition: linear_external_ffr.h:180
MBSim::Element::InitStage
InitStage
MBSimFlexibleBody::FlexibleBodyLinearExternalFFR::nNodes
int nNodes
total number of nodes
Definition: linear_external_ffr.h:165
MBSimFlexibleBody::FlexibleBodyLinearExternalFFR::computeShapeIntegrals
void computeShapeIntegrals()
compute the constant shape integrals of the whole body
Definition: linear_external_ffr.cc:417
MBSimFlexibleBody::FlexibleBodyLinearExternalFFR::openStructure
bool openStructure
open or closed beam structure
Definition: linear_external_ffr.h:272
MBSim::Element::name
std::string name
MBSim::Body::frame
std::vector< Frame * > frame
MBSimFlexibleBody::FlexibleBodyLinearExternalFFR::~FlexibleBodyLinearExternalFFR
~FlexibleBodyLinearExternalFFR() override=default
destructor
MBSimFlexibleBody::FlexibleBodyLinearExternalFFR::I_ThetaTheta_bar
fmatvec::SymMat3 I_ThetaTheta_bar
inertia tensor
Definition: linear_external_ffr.h:200
MBSimFlexibleBody::FlexibleBodyLinearExternalFFR::initM
void initM()
initialize the mass matrix
Definition: linear_external_ffr.cc:274
MBSimFlexibleBody::FlexibleBodyLinearExternalFFR::FFR
MBSim::Frame * FFR
Floating Frame of Reference.
Definition: linear_external_ffr.h:170
MBSimFlexibleBody::FlexibleBodyLinearExternalFFR::GlobalMatrixContribution
void GlobalMatrixContribution(int CurrentElement, const fmatvec::Mat &locMat, fmatvec::Mat &gloMat) override
insert 'local' information in global matrices
Definition: linear_external_ffr.cc:673
MBSim::Frame
MBSimFlexibleBody::FlexibleBodyLinearExternalFFR::FlexibleBodyLinearExternalFFR
FlexibleBodyLinearExternalFFR(const std::string &name)
constructor
Definition: linear_external_ffr.cc:39
MBSimFlexibleBody::FlexibleBodyLinearExternalFFR::phiFull
fmatvec::Mat phiFull
matrix of all modes
Definition: linear_external_ffr.h:252
MBSimFlexibleBody::FlexibleBodyLinearExternalFFR::u0
std::vector< fmatvec::Vec3 > u0
initial position of each node
Definition: linear_external_ffr.h:262
MBSimFlexibleBody::FlexibleBodyLinearExternalFFR::initQv
void initQv()
initialize the quadratic velocity vector
Definition: linear_external_ffr.cc:366
MBSimFlexibleBody::FlexibleBodyLinearExternalFFR::S_bar
fmatvec::Mat S_bar
matrix for the computation of the mass-matrix (assembled part of the element matrix)
Definition: linear_external_ffr.h:185
MBSimFlexibleBody::FlexibleBodyLinearExternalFFR::Qv
fmatvec::Vec Qv
quadratic velocity vector
Definition: linear_external_ffr.h:242
MBSimFlexibleBody::FlexibleBodyLinearExternalFFR::S_kl_bar
fmatvec::SqrMat S_kl_bar[3][3]
matrix for the computation of the mass-matrix (assembled part of the element matrix)
Definition: linear_external_ffr.h:190
MBSimFlexibleBody::FlexibleBodyLinearExternalFFR::nf
int nf
number of mode shapes used to describe the deformation
Definition: linear_external_ffr.h:267
MBSimFlexibleBody::FlexibleBodyLinearExternalFFR::updateAGbarGbardot
void updateAGbarGbardot()
update A, G_bar, and G_bar_Dot
Definition: linear_external_ffr.cc:481
MBSimFlexibleBody::FlexibleBodyLinearExternalFFR::K
fmatvec::SymMat K
stiffness matrix
Definition: linear_external_ffr.h:210