mbsimflexiblebody  4.0.0
MBSim Flexible Body Module
1s_33_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: thorsten.schindler@mytum.de
18 */
19
20#ifndef _FLEXIBLE_BODY_1S_33_COSSERAT_H_
21#define _FLEXIBLE_BODY_1S_33_COSSERAT_H_
22
23#include "1s_cosserat.h"
24#include "mbsimFlexibleBody/pointer.h"
25#include "mbsimFlexibleBody/flexible_body/fe/1s_33_cosserat_translation.h"
26#include "mbsimFlexibleBody/flexible_body/fe/1s_33_cosserat_rotation.h"
27
28namespace MBSimFlexibleBody {
29
30 class NodeFrame;
31
32// class NurbsCurve1s;
33
58 public:
59
65 FlexibleBody1s33Cosserat(const std::string &name, bool openStructure);
66
71
72 /* INHERITED INTERFACE OF FLEXIBLE BODY */
73 void BuildElements() override;
74 void GlobalVectorContribution(int n, const fmatvec::Vec& locVec, fmatvec::Vec& gloVec) override;
75 void GlobalMatrixContribution(int n, const fmatvec::Mat& locMat, fmatvec::Mat& gloMat) override;
76 void GlobalMatrixContribution(int n, const fmatvec::SymMat& locMat, fmatvec::SymMat& gloMat) override;
77 void exportPositionVelocity(const std::string & filenamePos, const std::string & filenameVel = std::string(), const int & deg = 3, const bool & writePsFile = false) override;
78 void importPositionVelocity(const std::string & filenamePos, const std::string & filenameVel = std::string()) override;
79 /***************************************************/
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 fmatvec::Vec3 getAngles(int i) override;
94 fmatvec::Vec3 getDerivativeOfAngles(int i) override;
95
96 /* INHERITED INTERFACE OF OBJECT */
97 void init(InitStage stage, const MBSim::InitConfigSet &config) override;
98 double computePotentialEnergy() override;
99 /***************************************************/
100
101 /* INHERITED INTERFACE OF OBJECTINTERFACE */
102 void updateLLM() override;
103
104 /* INHERITED INTERFACE OF ELEMENT */
105 /***************************************************/
106
107 /* GETTER / SETTER */
108 void setNumberElements(int n) override;
109
110 void setMomentsInertia(double I1_, double I2_, double I0_) override;
111
112 void setCurlRadius(double R1_, double R2_) override;
113 void setMaterialDamping(double cEps0D_, double cEps1D_, double cEps2D_) override;
114
115 int getNumberOfElementDOF() const override { return 6; }
116
117 int getNumberElements() const override { return Elements; }
118 int getNumberDOFs() const { return qSize; }
119 /***************************************************/
120
125 fmatvec::Vector<fmatvec::Fixed<6>, double> getPositions(double x);
126
131 fmatvec::Vector<fmatvec::Fixed<6>, double> getVelocities(double x);
132
138 fmatvec::Vec3 computeAngles(double sGlobal, const fmatvec::Vec & vec);
139
143 void initInfo() override;
144
157 void BuildElementTranslation(const double& sGlobal, double& sLocal, int& currentElementTranslation) override;
158
159 protected:
160
165
172 double I2, I0;
173
179 double R2;
180
184 double cEps2D;
185
186 FlexibleBody1s33Cosserat(); // standard constructor
187 FlexibleBody1s33Cosserat(const FlexibleBody1s33Cosserat&); // copy constructor
188 FlexibleBody1s33Cosserat& operator=(const FlexibleBody1s33Cosserat&); // assignment operator
189
193 void initM() override;
194
200 void computeBoundaryCondition() override;
201
208 void GlobalVectorContributionRotation(int n, const fmatvec::Vec& locVec, fmatvec::Vec& gloVec) override;
209 };
210
211 inline void FlexibleBody1s33Cosserat::setMomentsInertia(double I1_, double I2_, double I0_) {
212 I1 = I1_;
213 I2 = I2_;
214 I0 = I0_;
215 }
216
217 inline void FlexibleBody1s33Cosserat::setCurlRadius(double R1_, double R2_) {
218 R1 = R1_;
219 R2 = R2_;
220 if (initialised)
221 for (int i = 0; i < Elements; i++)
222 static_cast<FiniteElement1s33CosseratRotation*>(rotationDiscretization[i])->setCurlRadius(R1, R2);
223 }
224 inline void FlexibleBody1s33Cosserat::setMaterialDamping(double cEps0D_, double cEps1D_, double cEps2D_) {
225 cEps0D = cEps0D_;
226 cEps1D = cEps1D_;
227 cEps2D = cEps2D_;
228 if (initialised)
229 for (int i = 0; i < Elements; i++)
230 static_cast<FiniteElement1s33CosseratTranslation*>(discretization[i])->setMaterialDamping(Elements * cEps0D, cEps1D, cEps2D);
231 }
232
233}
234
235#endif /* _FLEXIBLE_BODY_1S_33_COSSERAT_H_ */
finite element for spatial beam using Cosserat model
Definition: 1s_33_cosserat.h:57
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_33_cosserat.cc:541
void initM() override
initialize translational part of mass matrix and calculate Cholesky decomposition
Definition: 1s_33_cosserat.cc:433
void computeBoundaryCondition() override
compute boundary conditions for rotation grid first and last finite difference rotation beam element ...
Definition: 1s_33_cosserat.cc:446
double cEps2D
strain damping
Definition: 1s_33_cosserat.h:184
void GlobalVectorContribution(int n, const fmatvec::Vec &locVec, fmatvec::Vec &gloVec) override
insert 'local' information in global vectors
Definition: 1s_33_cosserat.cc:111
void GlobalMatrixContribution(int n, const fmatvec::Mat &locMat, fmatvec::Mat &gloMat) override
insert 'local' information in global matrices
void BuildElementTranslation(const double &sGlobal, double &sLocal, int &currentElementTranslation) override
detect current finite element (t void setOpenMBVSpineExtrusion(OpenMBV::SpineExtrusion* spineExtrusio...
Definition: 1s_33_cosserat.cc:414
void GlobalVectorContributionRotation(int n, const fmatvec::Vec &locVec, fmatvec::Vec &gloVec) override
insert 'local' information in global vectors for rotation grid
Definition: 1s_33_cosserat.cc:450
FlexibleBody1s33Cosserat(const std::string &name, bool openStructure)
constructor
bool JTransInterp
marker if Jacobians already interpolated
Definition: 1s_33_cosserat.h:164
void GlobalMatrixContribution(int n, const fmatvec::SymMat &locMat, fmatvec::SymMat &gloMat) override
insert 'local' information in global matrices
void initInfo() override
initialise beam only for giving information with respect to state, number elements,...
Definition: 1s_33_cosserat.cc:391
fmatvec::Vector< fmatvec::Fixed< 6 >, double > getVelocities(double x)
compute velocities and differentiated angles at Lagrangian coordinate in local FE coordinates
Definition: 1s_33_cosserat.cc:342
void BuildElements() override
references finite element coordinates to assembled coordinates
Definition: 1s_33_cosserat.cc:49
~FlexibleBody1s33Cosserat() override
destructor
Definition: 1s_33_cosserat.cc:40
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_33_cosserat.cc:476
double I2
area moments of inertia I0: around torsional axis I1: in t-b-plane I2: in t-n-plane
Definition: 1s_33_cosserat.h:172
double R2
radius of undeformed shape R1: in t-b-plane R2: in t-n-plane
Definition: 1s_33_cosserat.h:179
fmatvec::Vec3 computeAngles(double sGlobal, const fmatvec::Vec &vec)
compute angles at Lagrangian coordinate in local FE coordinates
Definition: 1s_33_cosserat.cc:358
fmatvec::Vector< fmatvec::Fixed< 6 >, double > getPositions(double x)
compute positions and angle at Lagrangian coordinate in local FE coordinates
Definition: 1s_33_cosserat.cc:327
Definition: 1s_cosserat.h:52
double cEps0D
strain damping
Definition: 1s_cosserat.h:208
int Elements
number of translational elements
Definition: 1s_cosserat.h:163
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
std::vector< DiscretizationInterface * > rotationDiscretization
stl-vector of finite elements for rotation grid
Definition: 1s_cosserat.h:143
double R1
radius of undeformed shape R1: in t-b-plane R2: in t-n-plane
Definition: 1s_cosserat.h:203
bool initialised
initialised FLAG
Definition: 1s_cosserat.h:213
bool openStructure
flag for open (cantilever beam) or closed (rings) structures
Definition: 1s.h:73
std::vector< DiscretizationInterface * > discretization
stl-vector of discretizations/finite elements
Definition: flexible_body.h:186
Definition: frame_1s.h:27
std::vector< Frame * > frame
std::string name