|
mbsimflexiblebody
4.0.0
|
00001 /* Copyright (C) 2004-2014 MBSim Development Team 00002 * 00003 * This library is free software; you can redistribute it and/or 00004 * modify it under the terms of the GNU Lesser General Public 00005 * License as published by the Free Software Foundation; either 00006 * version 2.1 of the License, or (at your option) any later version. 00007 * 00008 * This library is distributed in the hope that it will be useful, 00009 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 * Lesser General Public License for more details. 00012 * 00013 * You should have received a copy of the GNU Lesser General Public 00014 * License along with this library; if not, write to the Free Software 00015 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00016 * 00017 * Contact: thorsten.schindler@mytum.de 00018 */ 00019 00020 #ifndef _FLEXIBLE_BODY_1S_21_ANCF_H_ 00021 #define _FLEXIBLE_BODY_1S_21_ANCF_H_ 00022 00023 #include "mbsimFlexibleBody/flexible_body.h" 00024 #include "mbsimFlexibleBody/flexible_body/finite_elements/finite_element_1s_21_ancf.h" 00025 #include "mbsim/mbsim_event.h" 00026 00027 #ifdef HAVE_OPENMBVCPPINTERFACE 00028 #include <openmbvcppinterface/spineextrusion.h> 00029 #endif 00030 00031 00032 namespace MBSimFlexibleBody { 00033 00048 class FlexibleBody1s21ANCF : public FlexibleBodyContinuum<double> { 00049 00050 public: 00056 FlexibleBody1s21ANCF(const std::string &name, bool openStructure); 00057 00061 virtual ~FlexibleBody1s21ANCF() {} 00062 00063 /* INHERITED INTERFACE OF FLEXIBLE BODY */ 00064 virtual void updateM(double t, int k) {} 00065 virtual void BuildElements(); 00066 virtual void GlobalVectorContribution(int n, const fmatvec::Vec& locVec, fmatvec::Vec& gloVec); 00067 virtual void GlobalMatrixContribution(int n, const fmatvec::Mat& locMat, fmatvec::Mat& gloMat); 00068 virtual void GlobalMatrixContribution(int n, const fmatvec::SymMat& locMat, fmatvec::SymMat& gloMat); 00069 virtual void updateKinematicsForFrame(MBSim::ContourPointData &cp, MBSim::Frame::Feature ff, MBSim::Frame *frame=0); 00070 virtual void updateJacobiansForFrame(MBSim::ContourPointData &data, MBSim::Frame *frame=0); 00071 /****************************************/ 00072 00073 /* INHERITED INTERFACE OF OBJECT */ 00074 virtual void init(InitStage stage); 00075 virtual void facLLM(int i = 0) {} 00076 /***************************************************/ 00077 00078 /* INHERITED INTERFACE OF ELEMENT */ 00079 virtual void plot(double t, double dt=1); 00080 virtual std::string getType() const { return "FlexibleBody1s21ANCF"; } 00081 /***************************************************/ 00082 00083 /* GETTER / SETTER */ 00084 void setNumberElements(int n); 00085 void setLength(double L_) { L = L_; } 00086 void setEModul(double E_) { E = E_; } 00087 void setCrossSectionalArea(double A_) { A = A_; } 00088 void setMomentInertia(double I_) { I = I_; } 00089 void setDensity(double rho_) { rho = rho_; } 00090 void setCurlRadius(double rc_); 00091 void setMaterialDamping(double deps_, double dkappa_); 00092 void setEulerPerspective(bool Euler_, double v0_); 00093 #ifdef HAVE_OPENMBVCPPINTERFACE 00094 void setOpenMBVSpineExtrusion(const boost::shared_ptr<OpenMBV::SpineExtrusion> &body) { openMBVBody=body; } 00095 #endif 00096 int getNumberElements(){ return Elements; } 00097 double getLength(){ return L; } 00098 /***************************************************/ 00099 00104 fmatvec::Vec computeState(double x); 00105 00109 void initInfo(); 00110 00115 void initRelaxed(double alpha); 00116 00117 private: 00121 int Elements; 00122 00126 double L; 00127 00131 double l0; 00132 00136 double E; 00137 00141 double A; 00142 00146 double I; 00147 00151 double rho; 00152 00156 double rc; 00157 00161 double deps; 00162 00166 double dkappa; 00167 00171 bool openStructure; 00172 00176 bool initialised; 00177 00181 double v0; 00182 00186 bool Euler; 00187 00191 void initM(); 00192 00199 void BuildElement(const double& sGlobal, double& sLocal, int& currentElement); 00200 }; 00201 00202 inline void FlexibleBody1s21ANCF::setCurlRadius(double rc_) { 00203 rc = rc_; 00204 if(initialised) 00205 for(int i = 0; i < Elements; i++) 00206 static_cast<FiniteElement1s21ANCF*>(discretization[i])->setCurlRadius(rc); 00207 } 00208 00209 inline void FlexibleBody1s21ANCF::setMaterialDamping(double deps_, double dkappa_) { 00210 deps = deps_; 00211 dkappa = dkappa_; 00212 if(initialised) 00213 for(int i = 0; i < Elements; i++) 00214 static_cast<FiniteElement1s21ANCF*>(discretization[i])->setMaterialDamping(deps,dkappa); 00215 } 00216 00217 inline void FlexibleBody1s21ANCF::setEulerPerspective(bool Euler_, double v0_) { 00218 if(openStructure) { 00219 throw(new MBSim::MBSimError("(FlexibleBody1s21ANCF::setEulerPerspective): implemented only for closed structures!")); 00220 } 00221 else { 00222 Euler = Euler_; 00223 v0 = v0_; 00224 } 00225 } 00226 } 00227 #endif /* _FLEXIBLE_BODY_1S_21_ANCF_H_ */ 00228
1.8.0