All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
finite_element_1S_reference_curve_functions.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: Sep 06, 2013
18  * Contact: kilian.grundl@gmail.com
19  */
20 
21 #ifndef FINITE_ELEMENT_1S_REFERENCE_CURVE_FUNCTIONS_H_
22 #define FINITE_ELEMENT_1S_REFERENCE_CURVE_FUNCTIONS_H_
23 
24 #include "mbsimFlexibleBody/flexible_body/finite_elements/finite_element_1S_reference_curve.h"
25 
26 namespace MBSimFlexibleBody {
27 
28  class funcPTP : public MBSim::Function<fmatvec::SymMatV(double)> {
29  public:
31  refBody(refBody) {
32  }
33 
34  ~funcPTP() {
35  }
36 
37  fmatvec::SymMatV operator()(const double & xi) {
38  fmatvec::Mat3xV P = refBody->computeP(xi, 0);
39  fmatvec::SymMatV PTP(P.cols(), INIT, 0.);
40  for (int i = 0; i < PTP.size(); i++) {
41  Vec3 coli = P.col(i);
42  for (int j = i; j < PTP.size(); j++) {
43  PTP(i, j) = scalarProduct(coli, P.col(j));
44  }
45  }
46  return PTP;
47  }
48  private:
50  };
51 
52  class funcPTdPdxi : public MBSim::Function<fmatvec::SqrMatV(double)> {
53  public:
55  refBody(refBody) {
56  }
57 
58  ~funcPTdPdxi() {
59  }
60 
61  fmatvec::SqrMatV operator()(const double & xi) {
62  fmatvec::Mat3xV P = refBody->computeP(xi, 0);
63  fmatvec::Mat3xV dPdxi = refBody->computeP(xi, 1);
64 
65  SqrMatV ret(P.cols(), INIT, 0.);
66  for (int i = 0; i < P.cols(); i++) {
67  Vec3 colP = P.col(i);
68  for (int j = 0; j < dPdxi.cols(); j++)
69  ret(i, j) = scalarProduct(colP, dPdxi.col(j));
70  }
71 
72  return ret;
73  }
74  private:
76  };
77 
78  class funcPTdPdt : public MBSim::Function<fmatvec::SqrMatV(double)> {
79  public:
81  refBody(refBody) {
82  }
83 
84  ~funcPTdPdt() {
85  }
86 
87  fmatvec::SqrMatV operator()(const double & xi) {
88  fmatvec::Mat3xV P = refBody->computeP(xi, 0);
89  fmatvec::Mat3xV dPdt(P.cols(), INIT, 0.);
90 
91  SqrMatV ret(P.cols(), INIT, 0.);
92 
93  /* Compute dPdt*/
94  // Theta
95  Vec q = refBody->getq();
96  dPdt = refBody->computedPdqk(xi, 1) * q(1);
97 
98  //flexible DoFs
99  for (int qInd = 2; qInd < P.cols(); qInd++) {
100  dPdt.add(0, q(qInd) * refBody->computeB(qInd, xi, 1, 0));
101  dPdt.add(1, q(qInd) * refBody->computeB(qInd, xi, 0, 1));
102 
103  }
104 
105  /* Multiplication with P^T*/
106  for (int i = 0; i < P.cols(); i++) {
107  Vec3 colP = P.col(i);
108  for (int j = 0; j < dPdt.cols(); j++)
109  ret(i, j) += scalarProduct(colP, dPdt.col(j));
110  }
111 
112  return ret;
113  }
114  private:
116  };
117 
118  class funcPTdPdqk : public MBSim::Function<fmatvec::SqrMatV(double)> {
119  public:
121  refBody(refBody), qInd(-1) {
122  }
123 
124  void setqInd(int qInd_) {
125  qInd = qInd_;
126  }
127 
128  ~funcPTdPdqk() {
129  }
130 
131  fmatvec::SqrMatV operator()(const double & xi) {
132  fmatvec::Mat3xV P = refBody->computeP(xi, 0);
133  fmatvec::Mat3xV dPdqk = refBody->computedPdqk(xi, qInd);
134  fmatvec::SqrMatV ret(P.cols(), INIT, 0.);
135 
136  // for the flexible DoFs dPdqk is zero...
137  int endCol = dPdqk.cols();
138  if (qInd > 1)
139  endCol = 2;
140 
141  for (int i = 0; i < P.cols(); i++) {
142  Vec3 col = P.col(i);
143  for (int j = 0; j < endCol; j++)
144  ret(i, j) = scalarProduct(col, dPdqk.col(j));
145  }
146 
147  return ret;
148  }
149  private:
151  int qInd;
152  };
153 
157  class funcForWgamma : public MBSim::Function<fmatvec::Vec1(double)> {
158  public:
160  refBody(refBody), dofDirOfElement(-1) {
161  }
162 
163  void setDofDirOfElement(int qInd_) {
164  dofDirOfElement = qInd_;
165  }
166 
167  ~funcForWgamma() {
168  }
169 
170  fmatvec::Vec1 operator()(const double & xi) {
171  fmatvec::Vec1 retVal;
172 
173  Vec3 drdxi = refBody->computer(xi, 1, 0);
174  double drdxipw2 = scalarProduct(drdxi, drdxi);
175 // Vec3 drdxidxi = refBody->computer(xi, 2, 0);
176 // double drdxidxipw2 = scalarProduct(drdxidxi, drdxidxi);
177  Vec3 drdxidqk = refBody->computedrdqk(xi, 1, dofDirOfElement);
178 // Vec3 drdxidxidqk = refBody->computedrdqk(xi, 2, qInd);
179 
180 // Part for W_gamma (elongation deformation)
181 // Full influence
182  double sqrdrdxipw2 = sqrt(drdxipw2);
183  double ForW_gamma = scalarProduct(drdxi, drdxidqk);
184  retVal(0) = (sqrdrdxipw2 - 1.) * ForW_gamma / sqrdrdxipw2;
185 
186  return retVal;
187  }
188  private:
190  int dofDirOfElement;
191  };
192 
193  class funcForWn : public MBSim::Function<fmatvec::Vec1(double)> {
194  public:
196  refBody(refBody), qIndLoc(-1) {
197  }
198 
199  void setqIndLoc(int qIndLoc_) {
200  qIndLoc = qIndLoc_;
201  }
202 
203  ~funcForWn() {
204  }
205 
206  fmatvec::Vec1 operator()(const double & xi) {
207  double kappan = refBody->computeKappan(xi);
208  double dkappandqk = refBody->computedKappandqk(xi, qIndLoc);
209  return Vec1(INIT, kappan * dkappandqk);
210  }
211  private:
213  int qIndLoc;
214  };
215 
216  class funcForWb : public MBSim::Function<fmatvec::Vec1(double)> {
217  public:
219  refBody(refBody), qIndLoc(-1) {
220  }
221 
222  void setqIndLoc(int qIndLoc_) {
223  qIndLoc = qIndLoc_;
224  }
225 
226  ~funcForWb() {
227  }
228 
229  fmatvec::Vec1 operator()(const double & xi) {
230  double kappab = refBody->computeKappab(xi);
231  double dkappabdqk = refBody->computedKappabdqk(xi, qIndLoc);
232  return Vec1(INIT, kappab * dkappabdqk);
233  }
234  private:
236  int qIndLoc;
237  };
238 }
239 
240 #endif /* FINITE_ELEMENT_1S_REFERENCE_CURVE_FUNCTIONS_H_ */
fmatvec::Mat3xV computeP(double xi, int derXi)
compute the P matrix
Definition: finite_element_1S_reference_curve.cc:739
this function returns basically three values. As these share some values it makes sense to not comput...
Definition: finite_element_1S_reference_curve_functions.h:157
double computedKappabdqk(double xiGlob, int qIndLocal)
compute derivative of kappab w.r.t. the given DoF
Definition: finite_element_1S_reference_curve.cc:1010
Definition: finite_element_1S_reference_curve_functions.h:118
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: finite_element_1S_reference_curve.cc:344
Definition: finite_element_1S_reference_curve_functions.h:78
Definition: finite_element_1S_reference_curve_functions.h:216
double computeKappab(double xiGlob)
compute the bending in t/b-plane
Definition: finite_element_1S_reference_curve.cc:923
Finite-Element class for the body FlexibleBody1SReferenceCurve.
Definition: finite_element_1S_reference_curve.h:37
double computedKappandqk(double xiGlob, int qIndLocal)
compute derivative of kappan w.r.t. the given DoF
Definition: finite_element_1S_reference_curve.cc:928
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: finite_element_1S_reference_curve.cc:261
Definition: finite_element_1S_reference_curve_functions.h:28
Definition: finite_element_1S_reference_curve_functions.h:193
double computeKappan(double xiGlob)
compute the bending in t/n-plane
Definition: finite_element_1S_reference_curve.cc:915
Definition: finite_element_1S_reference_curve_functions.h:52
fmatvec::Mat3xV computedPdqk(double xi, int dofDirLocal)
compute the P matrix derived wrt the generalized position
Definition: finite_element_1S_reference_curve.cc:754
fmatvec::Vec3 computedrdqk(double xi, int derXi, int qIndLoc)
computes the derivative wrt the generalized position of the local element
Definition: finite_element_1S_reference_curve.cc:275

Impressum / Disclaimer / Datenschutz Generated by doxygen 1.8.5 Valid HTML