mbsimflexiblebody 4.0.0 MBSim Flexible Body Module

1s_21_cosserat.h
1 /* Copyright (C) 2004-2012 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: thomas.cebulla@mytum.de
18 */
19
20 #ifndef _FLEXIBLE_BODY_1S_21_COSSERAT_H_
21 #define _FLEXIBLE_BODY_1S_21_COSSERAT_H_
22
23 #include <fmatvec/fmatvec.h>
24 #include "mbsimFlexibleBody/flexible_body/1s_cosserat.h"
25 #include "mbsimFlexibleBody/flexible_body.h"
26 #include "mbsimFlexibleBody/pointer.h"
27 #include "mbsimFlexibleBody/contours/flexible_band.h"
28 #include "mbsimFlexibleBody/flexible_body/fe/1s_21_cosserat_translation.h"
29 #include "mbsimFlexibleBody/flexible_body/fe/1s_21_cosserat_rotation.h"
30 #include <openmbvcppinterface/spineextrusion.h>
31
32 namespace MBSimFlexibleBody {
33
34 class NodeFrame;
35
56 class FlexibleBody1s21Cosserat : public FlexibleBody1sCosserat {
57 public:
58
64 FlexibleBody1s21Cosserat(const std::string &name, bool openStructure);
65
69 ~FlexibleBody1s21Cosserat() override;
70
71 /* INHERITED INTERFACE OF FLEXIBLE BODY */
72 void BuildElements() override;
73 const fmatvec::Vec& evalqFull() { if(updEle) BuildElements(); return qFull; }
74 const fmatvec::Vec& evaluFull() { if(updEle) BuildElements(); return uFull; }
75 void GlobalVectorContribution(int n, const fmatvec::Vec& locVec, fmatvec::Vec& gloVec) override;
76 void GlobalMatrixContribution(int n, const fmatvec::Mat& locMat, fmatvec::Mat& gloMat) override;
77 void GlobalMatrixContribution(int n, const fmatvec::SymMat& locMat, fmatvec::SymMat& gloMat) override;
78 void exportPositionVelocity(const std::string & filenamePos, const std::string & filenameVel = std::string(), const int & deg = 3, const bool & writePsFile = false) override;
79 void importPositionVelocity(const std::string & filenamePos, const std::string & filenameVel = std::string()) override;
80
81 void updatePositions(Frame1s* frame) override;
82 void updateVelocities(Frame1s* frame) override;
83 void updateAccelerations(Frame1s* frame) override;
84 void updateJacobians(Frame1s* frame, int j=0) override;
85 void updateGyroscopicAccelerations(Frame1s* frame) override;
86
87 void updatePositions(int node) override;
88 void updateVelocities(int node) override;
89 void updateAccelerations(int node) override;
90 void updateJacobians(int node, int j=0) override;
91 void updateGyroscopicAccelerations(int node) override;
92
93 // virtual fmatvec::Vec3 getAngles(int i);
94 // virtual fmatvec::Vec3 getDerivativeOfAngles(int i);
95
96 /* INHERITED INTERFACE OF OBJECT */
97 void init(InitStage stage, const MBSim::InitConfigSet &config) override;
98 double computePotentialEnergy() override;
99 void updateM() override;
100 void updateLLM() override;
101 // virtual void updatedu();
102 /***************************************************/
103
104 /* INHERITED INTERFACE OF OBJECTINTERFACE */
105 void updateh(int i = 0) override;
106
107 /* INHERITED INTERFACE OF ELEMENT */
108 /***************************************************/
109
110 /* GETTER / SETTER */
111 void setNumberElements(int n) override;
112
113 void setMomentsInertia(double I1_) override;
114 void setCurlRadius(double R1_) override;
115 void setMaterialDamping(double cEps0D_, double cEps1D_) override;
116
117 fmatvec::Mat3xV transformJacobian(fmatvec::Mat3xV J) override {
118 if (PODreduced)
119 return J * U;
120 return J;
121 }
122
123 int getNumberOfElementDOF() const override {
124 return 3;
125 }
126
127 int getNumberElements() const override {
128 return Elements;
129 }
130 double getLength() const {
131 return L;
132 }
133 int getqSizeFull() const override {
134 return qFull.size();
135 }
136 bool isOpenStructure() const {
137 return openStructure;
138 }
139
140 /* \brief Set SVD=true for POD model reduction
141 * \param reduced mass matrix
142 */
143 void enablePOD(const std::string & h5Path, int reduceMode = 0, int POMSize = 0);
144 /***************************************************/
145
150 fmatvec::Vector<fmatvec::Fixed<6>, double> getPositions(double x);
151
156 fmatvec::Vector<fmatvec::Fixed<6>, double> getVelocities(double x);
157
163 fmatvec::Vec3 computeAngles(double sGlobal, const fmatvec::Vec & vec);
164
168 void initInfo() override;
169
176 void BuildElementTranslation(const double& sGlobal, double& sLocal, int& currentElementTranslation) override;
177
178 protected:
179
183 fmatvec::SymMat MConst;
184
188 fmatvec::SymMat LLMConst;
189
193 bool JInterp;
194
198 bool PODreduced;
199
203 fmatvec::Mat U;
204
208 fmatvec::Vec qFull;
209
213 fmatvec::Vec uFull;
214
218 fmatvec::Vec hFull;
219
220 FlexibleBody1s21Cosserat(); // standard constructor
221 FlexibleBody1s21Cosserat(const FlexibleBody1s21Cosserat&); // copy constructor
222 FlexibleBody1s21Cosserat& operator=(const FlexibleBody1s21Cosserat&); // assignment operator
223
227 void initM() override;
228
234 void computeBoundaryCondition() override;
235
242 void GlobalVectorContributionRotation(int n, const fmatvec::Vec& locVec, fmatvec::Vec& gloVec) override;
243
249 fmatvec::Mat readPositionMatrix(const std::string & h5File, const std::string & job);
250
257 int findPOMSize(const fmatvec::Mat & POM, const fmatvec::Mat &SVD, double precission = 1 - 1.e-3);
258
259 }
260 ;
261
262 inline void FlexibleBody1s21Cosserat::updateM() {
263 M = MConst;
264 }
265
266 inline void FlexibleBody1s21Cosserat::updateLLM() {
267 LLM = LLMConst;
268 }
269
270 inline void FlexibleBody1s21Cosserat::setMomentsInertia(double I1_) {
271 I1 = I1_;
272 }
273
274 inline void FlexibleBody1s21Cosserat::setCurlRadius(double R1_) {
275 R1 = R1_;
276 if (initialised)
277 for (int i = 0; i < Elements; i++)
278 static_cast<FiniteElement1s21CosseratRotation*>(rotationDiscretization[i])->setCurlRadius(R1);
279 }
280 inline void FlexibleBody1s21Cosserat::setMaterialDamping(double cEps0D_, double cEps1D_) {
281 cEps0D = cEps0D_;
282 cEps1D = cEps1D_;
283 if (initialised)
284 for (int i = 0; i < Elements; i++)
285 static_cast<FiniteElement1s21CosseratTranslation*>(discretization[i])->setMaterialDamping(Elements * cEps0D, cEps1D);
286 }
287
288 }
289
290 #endif /* _FLEXIBLE_BODY_1S_21_COSSERAT_H_ */
MBSimFlexibleBody::FlexibleBody1s21Cosserat::computeAngles
fmatvec::Vec3 computeAngles(double sGlobal, const fmatvec::Vec &vec)
compute angles at Lagrangian coordinate in local FE coordinates
Definition: 1s_21_cosserat.cc:399
MBSimFlexibleBody::FlexibleBody::discretization
std::vector< DiscretizationInterface * > discretization
stl-vector of discretizations/finite elements
Definition: flexible_body.h:186
MBSimFlexibleBody::FlexibleBody1s21Cosserat::qFull
fmatvec::Vec qFull
vector of position-DOFs of full system
Definition: 1s_21_cosserat.h:208
MBSimFlexibleBody::FlexibleBody1s21Cosserat::~FlexibleBody1s21Cosserat
~FlexibleBody1s21Cosserat() override
destructor
Definition: 1s_21_cosserat.cc:42
MBSimFlexibleBody::FlexibleBody1s21Cosserat::uFull
fmatvec::Vec uFull
vector of velocity-DOFs of full system
Definition: 1s_21_cosserat.h:213
MBSimFlexibleBody::FlexibleBody1s21Cosserat::getVelocities
fmatvec::Vector< fmatvec::Fixed< 6 >, double > getVelocities(double x)
compute velocities and differentiated angles at Lagrangian coordinate in local FE coordinates
Definition: 1s_21_cosserat.cc:387
MBSimFlexibleBody::FlexibleBody1s21Cosserat::GlobalVectorContribution
void GlobalVectorContribution(int n, const fmatvec::Vec &locVec, fmatvec::Vec &gloVec) override
insert 'local' information in global vectors
Definition: 1s_21_cosserat.cc:102
MBSimFlexibleBody::FlexibleBody1s21Cosserat::importPositionVelocity
void importPositionVelocity(const std::string &filenamePos, const std::string &filenameVel=std::string()) override
imports the interpolated position and optional the velocity files (created with exportPositionVelocit...
Definition: 1s_21_cosserat.cc:572
MBSimFlexibleBody::Frame1s
Definition: frame_1s.h:27
MBSimFlexibleBody::FlexibleBody1s21Cosserat::getPositions
fmatvec::Vector< fmatvec::Fixed< 6 >, double > getPositions(double x)
compute positions and angle at Lagrangian coordinate in local FE coordinates
Definition: 1s_21_cosserat.cc:374
MBSimFlexibleBody::FlexibleBody1sCosserat::Elements
int Elements
number of translational elements
Definition: 1s_cosserat.h:163
MBSimFlexibleBody::FlexibleBody1s21Cosserat::PODreduced
bool PODreduced
bool true: execute POD, false: without POD
Definition: 1s_21_cosserat.h:198
MBSimFlexibleBody::FlexibleBody1sCosserat::R1
double R1
radius of undeformed shape R1: in t-b-plane R2: in t-n-plane
Definition: 1s_cosserat.h:203
MBSimFlexibleBody::FlexibleBody1sCosserat
Definition: 1s_cosserat.h:52
MBSimFlexibleBody::FlexibleBody1s21Cosserat::findPOMSize
int findPOMSize(const fmatvec::Mat &POM, const fmatvec::Mat &SVD, double precission=1 - 1.e-3)
find reduction order for POM
Definition: 1s_21_cosserat.cc:704
MBSimFlexibleBody::FlexibleBody1s::openStructure
bool openStructure
flag for open (cantilever beam) or closed (rings) structures
Definition: 1s.h:73
MBSim::Object::LLM
fmatvec::SymMat LLM
MBSimFlexibleBody::FlexibleBody1s21Cosserat::MConst
fmatvec::SymMat MConst
constant mass matrix
Definition: 1s_21_cosserat.h:183
MBSimFlexibleBody::FlexibleBody1s21Cosserat::GlobalMatrixContribution
void GlobalMatrixContribution(int n, const fmatvec::Mat &locMat, fmatvec::Mat &gloMat) override
insert 'local' information in global matrices
MBSimFlexibleBody::FlexibleBody1s21Cosserat::BuildElements
void BuildElements() override
references finite element coordinates to assembled coordinates
Definition: 1s_21_cosserat.cc:51
MBSimFlexibleBody::FlexibleBody1s21Cosserat::JInterp
bool JInterp
marker if Jacobians already interpolated
Definition: 1s_21_cosserat.h:193
MBSim::Element::InitStage
InitStage
MBSimFlexibleBody::FlexibleBody1s21Cosserat::U
fmatvec::Mat U
POM projection matrix.
Definition: 1s_21_cosserat.h:203
MBSimFlexibleBody::FlexibleBody1sCosserat::rotationDiscretization
std::vector< DiscretizationInterface * > rotationDiscretization
stl-vector of finite elements for rotation grid
Definition: 1s_cosserat.h:143
MBSimFlexibleBody::FlexibleBody1s21Cosserat::hFull
fmatvec::Vec hFull
vector of smooth right-hand side of full system
Definition: 1s_21_cosserat.h:218
MBSimFlexibleBody::FlexibleBody1s21Cosserat::initInfo
void initInfo() override
initialise beam only for giving information with respect to state, number elements,...
Definition: 1s_21_cosserat.cc:433
MBSimFlexibleBody::FlexibleBody1s21Cosserat::GlobalVectorContributionRotation
void GlobalVectorContributionRotation(int n, const fmatvec::Vec &locVec, fmatvec::Vec &gloVec) override
insert 'local' information in global vectors for rotation grid
Definition: 1s_21_cosserat.cc:114
MBSim::Element::name
std::string name
MBSimFlexibleBody::FlexibleBody::updEle
bool updEle
vector of contour parameters each describing a frame
Definition: flexible_body.h:217
MBSim::Body::frame
std::vector< Frame * > frame
MBSimFlexibleBody::FlexibleBody1sCosserat::cEps0D
double cEps0D
strain damping
Definition: 1s_cosserat.h:208
MBSimFlexibleBody::FlexibleBody1s21Cosserat::exportPositionVelocity
void exportPositionVelocity(const std::string &filenamePos, const std::string &filenameVel=std::string(), const int &deg=3, const bool &writePsFile=false) override
interpolates the position and optional the velocity coordinates of the flexible body with Nurbs-packa...
Definition: 1s_21_cosserat.cc:507
MBSimFlexibleBody::FlexibleBody1s21Cosserat::transformJacobian
fmatvec::Mat3xV transformJacobian(fmatvec::Mat3xV J) override
interface function to transform the Jacobian if the generalized coordinates have been changed
Definition: 1s_21_cosserat.h:117
MBSimFlexibleBody::FlexibleBody1s21Cosserat::initM
void initM() override
initialize translational part of mass matrix and calculate Cholesky decomposition
Definition: 1s_21_cosserat.cc:477
MBSimFlexibleBody::FlexibleBody1s21Cosserat::LLMConst
fmatvec::SymMat LLMConst
constant decomposed mass matrix
Definition: 1s_21_cosserat.h:188
MBSimFlexibleBody::FlexibleBody1s21Cosserat::BuildElementTranslation
void BuildElementTranslation(const double &sGlobal, double &sLocal, int &currentElementTranslation) override
detect current finite element (translation)
Definition: 1s_21_cosserat.cc:458
MBSimFlexibleBody::FlexibleBody1sCosserat::initialised
bool initialised
initialised FLAG
Definition: 1s_cosserat.h:213
MBSimFlexibleBody::FlexibleBody1s21Cosserat::computeBoundaryCondition
void computeBoundaryCondition() override
compute boundary conditions for rotation grid first and last finite difference rotation beam element ...
Definition: 1s_21_cosserat.cc:503
MBSimFlexibleBody::FlexibleBody1sCosserat::I1
double I1
area moments of inertia I0: around torsional axis I1: in t-b-plane I2: in t-n-plane
Definition: 1s_cosserat.h:191
MBSimFlexibleBody::FlexibleBody1s21Cosserat::readPositionMatrix
fmatvec::Mat readPositionMatrix(const std::string &h5File, const std::string &job)
read position matrix of other simulation for POD-reduction
Definition: 1s_21_cosserat.cc:656
MBSimFlexibleBody::FlexibleBody1s21Cosserat
flexible body for planar beam using Cosserat model
Definition: 1s_21_cosserat.h:56
MBSimFlexibleBody::FlexibleBody1s::L
double L
length of beam
Definition: 1s.h:68
MBSim::Object::M
fmatvec::SymMat M