mbsimflexiblebody  4.0.0
MBSim Flexible Body Module
1S_reference_curve.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 * Created on: Jul 30, 2013
18 * Contact: kilian.grundl@gmail.com
19 */
20
21#ifndef FINITE_ELEMENT_1S_REFERENCE_CURVE_H_
22#define FINITE_ELEMENT_1S_REFERENCE_CURVE_H_
23
24#include <mbsimFlexibleBody/flexible_body/1S_reference_curve.h>
25
26#include <mbsimFlexibleBody/contours/nc/contour_1s_neutral_reference_curve.h>
27
28#include <mbsim/discretization_interface.h>
29
30#include <mbsim/functions/function.h>
31
32namespace MBSimFlexibleBody {
33
38 friend class funcPTP;
39 friend class funcPTdPdxi;
40 friend class funcPTdPdt;
41 friend class funcPTdPdqk;
42 friend class funcForWgamma;
43 friend class funcForWb;
44
45 public:
49 FlexibleBody1SReferenceCurveFE(FlexibleBody1SReferenceCurve * parent, int eleNo, Vec2 alpha, int order, int nodeDofs);
50
52
56 virtual void init(MBSim::Element::InitStage stage, const MBSim::InitConfigSet &config);
57 virtual int getqSize() const {
58 throw std::runtime_error("Not implemented" + string(__func__));
59 }
60
61 virtual fmatvec::Vec getq() const {
62 return parent->qElement[element];
63 }
64
65 virtual int getuSize() const {
66 throw std::runtime_error("Not implemented" + string(__func__));
67 }
68
69 virtual const fmatvec::SymMat& getM() const {
70 return M;
71 }
72 virtual const fmatvec::Vec& geth() const {
73 return h;
74 }
75
76 virtual const fmatvec::SqrMat& getdhdq() const {
77 throw std::runtime_error("Not implemented" + string(__func__));
78 }
79 virtual const fmatvec::SqrMat& getdhdu() const {
80 throw std::runtime_error("Not implemented");
81 }
82 virtual void computeM(const fmatvec::Vec& q);
83 virtual void computeh(const fmatvec::Vec& q, const fmatvec::Vec& u);
84 virtual void computedhdz(const fmatvec::Vec& q, const fmatvec::Vec& u) {
85 throw std::runtime_error("Not implemented");
86 }
87 virtual double computeKineticEnergy(const fmatvec::Vec& q, const fmatvec::Vec& u) {
88 throw std::runtime_error("Not implemented");
89 }
90 virtual double computeGravitationalEnergy(const fmatvec::Vec& q) {
91 throw std::runtime_error("Not implemented");
92 }
93 virtual double computeElasticEnergy(const fmatvec::Vec& q) {
94 throw std::runtime_error("Not implemented");
95 }
96 virtual fmatvec::Vec computePosition(const fmatvec::Vec& q, const MBSim::ContourPointData &data) {
97 throw std::runtime_error("Not implemented");
98 }
99 virtual fmatvec::SqrMat computeOrientation(const fmatvec::Vec& q, const MBSim::ContourPointData &data) {
100 throw std::runtime_error("Not implemented");
101 }
102 virtual fmatvec::Vec computeVelocity(const fmatvec::Vec& q, const fmatvec::Vec& u, const MBSim::ContourPointData &data) {
103 throw std::runtime_error("Not implemented");
104 }
105 virtual fmatvec::Vec computeAngularVelocity(const fmatvec::Vec& q, const fmatvec::Vec& u, const MBSim::ContourPointData &data) {
106 throw std::runtime_error("Not implemented");
107 }
108 virtual fmatvec::Mat computeJacobianOfMotion(const fmatvec::Vec& q, const MBSim::ContourPointData &data) {
109 throw std::runtime_error("Not implemented");
110 }
111
112 virtual void setDofDir(fmatvec::VecInt dofDirElement_) {
113 dofDirs = dofDirElement_;
114 }
115
116 virtual fmatvec::VecInt getDofDirs() {
117 return dofDirs;
118 }
119
123 virtual int getAddDoFSizeMax() const {
124 return getNodesSize() * nodeDirs;
125 }
126
130 virtual int getNodesSize() const {
131 return (order + 1);
132 }
133
134 FlexibleBody1SReferenceCurve * getParent() {
135 return parent;
136 }
137
138 const std::vector<int> getFreeDofs() {
139 return freeDoFs;
140 }
141
142 const fmatvec::Vec2 getAlpha() {
143 return alpha;
144 }
145
146 int findLocalDof(int globalDof) {
147 for (size_t i = 0; i < freeDoFs.size(); i++) {
148 if (dofDirs(freeDoFs[i]) == globalDof)
149 return freeDoFs[i];
150 }
151 return -1;
152 }
153
157 virtual double computeXiLoc(double xiGlob);
158
162 virtual double computeXiGlob(double xiLoc);
163
167 fmatvec::Vec3 computer(double xi, int derXi = 0, int derTheta = 0);
168
172 fmatvec::Vec3 computev(double xi, int derXi = 0);
173
177 fmatvec::Vec3 computedrdqk(double xi, int derXi, int qIndLoc);
178
186 virtual double computeN(int j, double xiLoc, int derXi);
187
191 virtual double computeLegendre(int j, double xiLoc, int derXi);
192
197 fmatvec::Vec3 computeB(int dofDirLocal, double xiGlob, int derXi, int derTheta);
198
202 fmatvec::Vec3 computeBqf(double xi, int derXi, int derTheta);
203
207 fmatvec::Vec3 computeBuf(double xi, int derXi, int derTheta);
208
213 virtual fmatvec::Vec3 computeS(int columnEle, double xiGlob, int derXi);
214
218 virtual fmatvec::Vec3 computeSTimeslocVec(double xiGlob, int derXi, const fmatvec::Vec & locVec);
219
223 virtual fmatvec::Vec3 computeAnodeTimesSTimeslocVec(double xiGlob, int derXi, int derTheta, const fmatvec::Vec & locVec);
224
228 fmatvec::Mat3xV computeP(double xi, int derXi);
229
233 fmatvec::Mat3xV computedPdqk(double xi, int dofDirLocal);
234
238 double computeeps(double xiGlob);
239
243 double computedepsdqk(int localDofDir, double xiGlob);
244
248 double computeKappan(double xiGlob);
249
253 double computeKappab(double xiGlob);
254
258 double computedKappandqk(double xiGlob, int qIndLocal);
259
263 double computedKappabdqk(double xiGlob, int qIndLocal);
264
268 double dWndqk(double xiGlob, int qInd);
269
273 void updateIntegrationBorders(double t);
274
275 private:
280
285
290 fmatvec::VecInt dofDirs;
291
292 /*
293 * \brief start and end node in the global system
294 */
295 fmatvec::Vec2 alpha;
296
300 std::vector<double> borders;
301
305 int order;
306
311
315 std::vector<int> freeDoFs;
316
323 std::vector<std::vector<std::vector<double>> > coeffs;
324
328 std::vector<double> getLagrangeCoeffs(int nodeNo);
329
333 std::vector<double> getHermiteCoeffs(int nodeNo);
334
338 fmatvec::SymMat M;
339
343 fmatvec::Vec h;
344
348 fmatvec::VecV hT1;
349
353 fmatvec::VecV hT2;
354
358 fmatvec::VecV hT3;
359
363 fmatvec::VecV hV1;
364
368 fmatvec::VecV hV2;
369
373 fmatvec::VecV hV3;
374
378 fmatvec::VecV hV4;
379
383 fmatvec::SymMatV integratePTP();
384
388 fmatvec::SqrMatV integratePTdPdxi();
389
393 fmatvec::SqrMatV integratePTdPdt();
394
398 fmatvec::SqrMatV integratePTdPdqk(int qInd);
399
403 double integrateForWgamma(int qInd);
404
408 double integrateForWn(int qIndLoc);
409
413 double integrateForWb(int qIndLoc);
414
415 /*
416 * \brief compute the global xi value of the given local dof direction
417 * \remark the input values [0,1] have to global xi-values!
418 */
419 double computeXiOfDOF(int dofDirLocal);
420
424 int AVers = 2;
425 };
426
427}
428
429#endif /* FINITE_ELEMENT_1S_REFERENCE_CURVE_H_ */
discretization interface for flexible systems
Definition: discretization_interface.h:36
Finite-Element class for the body FlexibleBody1SReferenceCurve.
Definition: 1S_reference_curve.h:37
virtual int getNodesSize() const
get the number of Nodes
Definition: 1S_reference_curve.h:130
std::vector< int > freeDoFs
number of free DoFs in the element
Definition: 1S_reference_curve.h:315
fmatvec::SymMat M
Mass matrix of the element.
Definition: 1S_reference_curve.h:338
std::vector< double > borders
borders for the integration
Definition: 1S_reference_curve.h:300
fmatvec::Vec3 computeBuf(double xi, int derXi, int derTheta)
compute the multiplication of the B matrix with uf
Definition: 1S_reference_curve.cc:436
double computedKappabdqk(double xiGlob, int qIndLocal)
compute derivative of kappab w.r.t. the given DoF
Definition: 1S_reference_curve.cc:1010
void updateIntegrationBorders(double t)
update the borders as
Definition: 1S_reference_curve.cc:1046
fmatvec::Mat3xV computeP(double xi, int derXi)
compute the P matrix
Definition: 1S_reference_curve.cc:739
fmatvec::Vec3 computer(double xi, int derXi=0, int derTheta=0)
compute the position and/or its derivative w.r.t. xi and/or theta
Definition: 1S_reference_curve.cc:261
virtual const fmatvec::SqrMat & getdhdq() const
Definition: 1S_reference_curve.h:76
fmatvec::VecV hV3
third part of the h-vector coming from the potential energy (binormal bending)
Definition: 1S_reference_curve.h:373
fmatvec::SqrMatV integratePTdPdqk(int qInd)
computes the integral for the third part of the h vector coming from the kinetic energy (\int P^T * d...
Definition: 1S_reference_curve.cc:818
virtual void init(MBSim::Element::InitStage stage, const MBSim::InitConfigSet &config)
initialize the FE
Definition: 1S_reference_curve.cc:56
virtual double computeN(int j, double xiLoc, int derXi)
compute the result of the ansatz function N of number j Here hierarchical basis is used.
Definition: 1S_reference_curve.cc:290
virtual void computeh(const fmatvec::Vec &q, const fmatvec::Vec &u)
compute smooth right hand side
Definition: 1S_reference_curve.cc:159
double computeeps(double xiGlob)
compute the local elongation
Definition: 1S_reference_curve.cc:874
int element
number of the element
Definition: 1S_reference_curve.h:284
fmatvec::Vec3 computeB(int dofDirLocal, double xiGlob, int derXi, int derTheta)
compute the column i of the B matrix (the column that is connected to the localDOF)
Definition: 1S_reference_curve.cc:344
fmatvec::SqrMatV integratePTdPdxi()
computes the integral for the first part of the h vector coming from the kinetic energy (\int P^T * P...
Definition: 1S_reference_curve.cc:794
virtual const fmatvec::Vec & geth() const
Definition: 1S_reference_curve.h:72
double computedepsdqk(int localDofDir, double xiGlob)
compute the derivative of the local elongation w.r.t. local Dof direction
Definition: 1S_reference_curve.cc:882
double integrateForWgamma(int qInd)
computes the integral for the first part of the h vector coming from the potential energy (intForWgam...
Definition: 1S_reference_curve.cc:832
std::vector< double > getLagrangeCoeffs(int nodeNo)
function that holds the coefficient for the lagrange polynoms
Definition: 1S_reference_curve.cc:547
double computeKappab(double xiGlob)
compute the bending in t/b-plane
Definition: 1S_reference_curve.cc:923
double computeKappan(double xiGlob)
compute the bending in t/n-plane
Definition: 1S_reference_curve.cc:915
fmatvec::Mat3xV computedPdqk(double xi, int dofDirLocal)
compute the P matrix derived wrt the generalized position
Definition: 1S_reference_curve.cc:754
virtual double computeGravitationalEnergy(const fmatvec::Vec &q)
compute gravitational energy
Definition: 1S_reference_curve.h:90
fmatvec::Vec h
the right hand side vector
Definition: 1S_reference_curve.h:343
int AVers
switch between different versions of the A-Matrix
Definition: 1S_reference_curve.h:424
std::vector< std::vector< std::vector< double > > > coeffs
list of polynomial coefficients First index is the node Second index is the derivative third index is...
Definition: 1S_reference_curve.h:323
int order
degree of the element
Definition: 1S_reference_curve.h:305
fmatvec::SqrMatV integratePTdPdt()
computes the integral for the second part of the h vector coming from the kinetic energy (\int P^T * ...
Definition: 1S_reference_curve.cc:806
std::vector< double > getHermiteCoeffs(int nodeNo)
function that holds the coefficient for the hermite polynoms
Definition: 1S_reference_curve.cc:642
fmatvec::SymMatV integratePTP()
computes the integral needed for the mass matrix (\int P^T P)
Definition: 1S_reference_curve.cc:782
virtual fmatvec::Vec3 computeSTimeslocVec(double xiGlob, int derXi, const fmatvec::Vec &locVec)
compute S times the given vector
Definition: 1S_reference_curve.cc:498
virtual fmatvec::Vec3 computeAnodeTimesSTimeslocVec(double xiGlob, int derXi, int derTheta, const fmatvec::Vec &locVec)
compute A of the node times the respective shape functions times the given vector
Definition: 1S_reference_curve.cc:519
virtual double computeXiLoc(double xiGlob)
compute the local position
Definition: 1S_reference_curve.cc:245
virtual void computedhdz(const fmatvec::Vec &q, const fmatvec::Vec &u)
compute Jacobian for implicit integration
Definition: 1S_reference_curve.h:84
fmatvec::VecV hT1
first part of h-vector coming from the kinetic energy
Definition: 1S_reference_curve.h:348
fmatvec::VecV hT3
second part of h-vector coming from the kinetic energy
Definition: 1S_reference_curve.h:358
virtual const fmatvec::SqrMat & getdhdu() const
Definition: 1S_reference_curve.h:79
fmatvec::VecV hV4
fourth part of the h-vector coming from the potential energy (torsion)
Definition: 1S_reference_curve.h:378
virtual void computeM(const fmatvec::Vec &q)
compute mass matrix
Definition: 1S_reference_curve.cc:227
fmatvec::VecV hV1
first part of h-vector coming from the potential energy (elongation)
Definition: 1S_reference_curve.h:363
fmatvec::VecV hV2
second part of h-vector coming from the potential energy (normal bending)
Definition: 1S_reference_curve.h:368
FlexibleBody1SReferenceCurveFE(FlexibleBody1SReferenceCurve *parent, int eleNo, Vec2 alpha, int order, int nodeDofs)
standard constructor
Definition: 1S_reference_curve.cc:37
double integrateForWn(int qIndLoc)
computes the integral of the h vector coming from the potential energy (intForWn)
Definition: 1S_reference_curve.cc:846
fmatvec::Vec3 computedrdqk(double xi, int derXi, int qIndLoc)
computes the derivative wrt the generalized position of the local element
Definition: 1S_reference_curve.cc:275
fmatvec::VecV hT2
second part of h-vector coming from the kinetic energy
Definition: 1S_reference_curve.h:353
virtual fmatvec::Vec3 computeS(int columnEle, double xiGlob, int derXi)
return the column of DOF with column i
Definition: 1S_reference_curve.cc:481
virtual double computeKineticEnergy(const fmatvec::Vec &q, const fmatvec::Vec &u)
compute kinetic energy
Definition: 1S_reference_curve.h:87
fmatvec::Vec3 computeBqf(double xi, int derXi, int derTheta)
compute the multiplication of the B matrix with qf
Definition: 1S_reference_curve.cc:391
double computedKappandqk(double xiGlob, int qIndLocal)
compute derivative of kappan w.r.t. the given DoF
Definition: 1S_reference_curve.cc:928
virtual double computeElasticEnergy(const fmatvec::Vec &q)
compute elastic energy
Definition: 1S_reference_curve.h:93
virtual int getAddDoFSizeMax() const
get the number of possible degrees of freedom (some may be locked, but this is not covered in the num...
Definition: 1S_reference_curve.h:123
int nodeDirs
Degrees of freedom for one node (number of directions)
Definition: 1S_reference_curve.h:310
virtual int getuSize() const
Definition: 1S_reference_curve.h:65
virtual const fmatvec::SymMat & getM() const
Definition: 1S_reference_curve.h:69
virtual double computeXiGlob(double xiLoc)
compute the global position
Definition: 1S_reference_curve.cc:253
virtual int getqSize() const
Definition: 1S_reference_curve.h:57
double dWndqk(double xiGlob, int qInd)
compute the change of bending energy in the t/n-plane at the position w.r.t the given DoF
Definition: 1S_reference_curve.cc:1039
fmatvec::Vec3 computev(double xi, int derXi=0)
compute the velocity and/or its derivative w.r.t. xi and/or theta
Definition: 1S_reference_curve.cc:268
fmatvec::VecInt dofDirs
vector that connects local DOFs of an element to the global DOFs
Definition: 1S_reference_curve.h:290
FlexibleBody1SReferenceCurve * parent
parent body
Definition: 1S_reference_curve.h:279
virtual double computeLegendre(int j, double xiLoc, int derXi)
compute Legendre Polynomial
Definition: 1S_reference_curve.cc:315
double integrateForWb(int qIndLoc)
computes the integral for the second part of the h vector coming from the potential energy (intForWb)
Definition: 1S_reference_curve.cc:860
class that implements an one dimensional nonlinear beam that uses a reference curve for the nonlinear...
Definition: 1S_reference_curve.h:66
std::vector< fmatvec::Vec > qElement
stl-vector of finite element wise positions
Definition: flexible_body.h:191
Definition: 1S_reference_curve_functions.h:216
this function returns basically three values. As these share some values it makes sense to not comput...
Definition: 1S_reference_curve_functions.h:157
Definition: 1S_reference_curve_functions.h:28
Definition: 1S_reference_curve_functions.h:118
Definition: 1S_reference_curve_functions.h:78
Definition: 1S_reference_curve_functions.h:52