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
40namespace 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
156
160 void updateAGbarGbardot();
161
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_ */
flexible body entirely described within MBSim holding all informations about continuum approximations
Definition: flexible_body.h:227
FlexibleBodyContinuum(const std::string &name)
constructor
Definition: flexible_body.h:233
flexible body model based on floating frame reference using the system information external linear FE...
Definition: linear_external_ffr.h:50
fmatvec::Mat I_ThetaF_bar
I_ThetaF 3*nf.
Definition: linear_external_ffr.h:205
void GlobalMatrixContribution(int CurrentElement, const fmatvec::Mat &locMat, fmatvec::Mat &gloMat) override
insert 'local' information in global matrices
Definition: linear_external_ffr.cc:674
fmatvec::SymMat3 I_kl
matrix
Definition: linear_external_ffr.h:180
fmatvec::SymMat K
stiffness matrix
Definition: linear_external_ffr.h:210
fmatvec::Mat phiFull
matrix of all modes
Definition: linear_external_ffr.h:252
bool openStructure
open or closed beam structure
Definition: linear_external_ffr.h:272
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
void initM()
initialize the mass matrix
Definition: linear_external_ffr.cc:275
fmatvec::SymMat M_FF
matrix for the computation of the mass-matrix (assembled part of the element matrix)
Definition: linear_external_ffr.h:237
~FlexibleBodyLinearExternalFFR() override=default
destructor
void GlobalVectorContribution(int CurrentElement, const fmatvec::Vec &locVec, fmatvec::Vec &gloVec) override
insert 'local' information in global vectors
Definition: linear_external_ffr.cc:670
fmatvec::SymMat3 I_ThetaTheta_bar
inertia tensor
Definition: linear_external_ffr.h:200
int nNodes
total number of nodes
Definition: linear_external_ffr.h:165
void updateAGbarGbardot()
update A, G_bar, and G_bar_Dot
Definition: linear_external_ffr.cc:482
void BuildElements() override
references finite element coordinates to assembled coordinates
Definition: linear_external_ffr.cc:666
fmatvec::Vec3 I_1
matrix for the computation of the mass-matrix (assembled part of the element matrix)
Definition: linear_external_ffr.h:175
fmatvec::Vec mij
lumped mass for each node
Definition: linear_external_ffr.h:247
int nf
number of mode shapes used to describe the deformation
Definition: linear_external_ffr.h:267
MBSim::Frame * FFR
Floating Frame of Reference.
Definition: linear_external_ffr.h:170
fmatvec::SymMat KFull
full stiffness matrix
Definition: linear_external_ffr.h:215
fmatvec::SqrMat3 A
transformation matrix of coordinates of the moving frame of reference into the reference frame
Definition: linear_external_ffr.h:230
void computeShapeIntegrals()
compute the constant shape integrals of the whole body
Definition: linear_external_ffr.cc:418
fmatvec::Mat phi
matrix of modes used
Definition: linear_external_ffr.h:257
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
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
void updateQv()
update the quadratic velocity vector
Definition: linear_external_ffr.cc:373
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
std::vector< fmatvec::Vec3 > u0
initial position of each node
Definition: linear_external_ffr.h:262
fmatvec::Mat S_bar
matrix for the computation of the mass-matrix (assembled part of the element matrix)
Definition: linear_external_ffr.h:185
fmatvec::Vec Qv
quadratic velocity vector
Definition: linear_external_ffr.h:242
void initQv()
initialize the quadratic velocity vector
Definition: linear_external_ffr.cc:367
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
FlexibleBodyLinearExternalFFR(const std::string &name)
constructor
Definition: linear_external_ffr.cc:39
std::vector< Frame * > frame
std::string name