mbsimflexiblebody  4.0.0
MBSim Flexible Body Module
superelement_linear_external.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 * Contact: thorsten.schindler@mytum.de
18 * rzander@users.berlios.de
19 */
20
21#ifndef _SUPERELEMENT_LINEAR_EXTERNAL_H_
22#define _SUPERELEMENT_LINEAR_EXTERNAL_H_
23
24#include "fmatvec/fmatvec.h"
25#include "mbsim/discretization_interface.h"
26#include "mbsim/mbsim_event.h"
27#include "mbsim/contour_pdata.h"
28
29namespace MBSimFlexibleBody {
30
39 public:
41 void init(MBSim::Element::InitStage stage, const MBSim::InitConfigSet &config);
42
46 void setM(const fmatvec::SymMat &M_);
47
51 void setK(const fmatvec::SqrMat &K_);
52
59 void setProportionalDamping(double alpha_,double beta_) { alpha=alpha_; beta=beta_; }
60
61 const fmatvec::SymMat& getM() const { return M; }
62 const fmatvec::Vec& geth() const { return h; }
63
64 const fmatvec::SqrMat& getdhdq() const { return Dhq; }
65 const fmatvec::SqrMat& getdhdu() const { return Dhqp; }
66 int getqSize() const { return K.size(); }
67 int getuSize() const { return M.size(); }
68
69 void computeM(const fmatvec::Vec& qElement) {}
73 void computeh(const fmatvec::Vec& qElement,const fmatvec::Vec& uElement) { h = - K * qElement - D * uElement; }
74 void computedhdz(const fmatvec::Vec& qElement,const fmatvec::Vec& uElement) {}
75 double computeKineticEnergy(const fmatvec::Vec& q,const fmatvec::Vec& u) { return 0.5*u.T()*M*u;}
76 double computeGravitationalEnergy(const fmatvec::Vec& q) { return 0.0;}
77 double computeElasticEnergy(const fmatvec::Vec& q) { return 0.5*q.T()*K*q;}
78
79 fmatvec::Vec computeVelocity(const fmatvec::Vec&q,const fmatvec::Vec&u,const MBSim::ContourPointData& cp) { return computeJacobianOfMotion(q,cp).T()*u;}
80 fmatvec::Vec computeAngularVelocity(const fmatvec::Vec&q,const fmatvec::Vec&u,const MBSim::ContourPointData& cp) { return computeJacobianOfMotion(q,cp).T()*u;}
81 fmatvec::Vec computePosition(const fmatvec::Vec&q,const MBSim::ContourPointData& cp);
82 fmatvec::SqrMat computeOrientation(const fmatvec::Vec&q,const MBSim::ContourPointData& cp) { throw MBSim::MBSimError("(SuperElementLinearExternal::computeOrientation): Not Implemented");}
83 fmatvec::Mat computeJacobianOfMotion(const fmatvec::Vec&q,const MBSim::ContourPointData& cp);
84
85 MBSim::ContourPointData addInterface(fmatvec::Mat J_, fmatvec::Vec KrP_);
86
87 protected:
89 fmatvec::SymMat M;
91 fmatvec::Vec h;
93 fmatvec::SqrMat K;
95 fmatvec::SqrMat D;
97 double alpha;
99 double beta;
101 fmatvec::SqrMat Dhq, Dhqp;
103 std::vector<fmatvec::Mat> J;
105 std::vector<fmatvec::Vec> KrP;
106 };
107
108}
109
110#endif /* _SUPERELEMENT_LINEAR_EXTERNAL_H_ */
111
discretization interface for flexible systems
Definition: discretization_interface.h:36
superelement for linear models from external preprocessing.
Definition: superelement_linear_external.h:38
void computedhdz(const fmatvec::Vec &qElement, const fmatvec::Vec &uElement)
compute Jacobian for implicit integration
Definition: superelement_linear_external.h:74
fmatvec::SqrMat Dhq
Definition: superelement_linear_external.h:101
int getuSize() const
Definition: superelement_linear_external.h:67
void setK(const fmatvec::SqrMat &K_)
Definition: superelement_linear_external.cc:45
fmatvec::Vec h
Definition: superelement_linear_external.h:91
const fmatvec::SymMat & getM() const
Definition: superelement_linear_external.h:61
double computeElasticEnergy(const fmatvec::Vec &q)
compute elastic energy
Definition: superelement_linear_external.h:77
void setProportionalDamping(double alpha_, double beta_)
Definition: superelement_linear_external.h:59
void computeM(const fmatvec::Vec &qElement)
compute mass matrix
Definition: superelement_linear_external.h:69
const fmatvec::SqrMat & getdhdu() const
Definition: superelement_linear_external.h:65
double beta
Definition: superelement_linear_external.h:99
double computeGravitationalEnergy(const fmatvec::Vec &q)
compute gravitational energy
Definition: superelement_linear_external.h:76
std::vector< fmatvec::Vec > KrP
Definition: superelement_linear_external.h:105
double computeKineticEnergy(const fmatvec::Vec &q, const fmatvec::Vec &u)
compute kinetic energy
Definition: superelement_linear_external.h:75
void setM(const fmatvec::SymMat &M_)
Definition: superelement_linear_external.cc:40
double alpha
Definition: superelement_linear_external.h:97
fmatvec::SymMat M
Definition: superelement_linear_external.h:89
fmatvec::SqrMat K
Definition: superelement_linear_external.h:93
int getqSize() const
Definition: superelement_linear_external.h:66
void computeh(const fmatvec::Vec &qElement, const fmatvec::Vec &uElement)
Definition: superelement_linear_external.h:73
const fmatvec::Vec & geth() const
Definition: superelement_linear_external.h:62
fmatvec::SqrMat D
Definition: superelement_linear_external.h:95
std::vector< fmatvec::Mat > J
Definition: superelement_linear_external.h:103
const fmatvec::SqrMat & getdhdq() const
Definition: superelement_linear_external.h:64