mbsim  4.0.0
MBSim Kernel
quasi_static_integrator.h
1/* Copyright (C) 2004-2010 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: martin.o.foerg@googlemail.com
18 */
19
20#ifndef _QUASI_STATIC_INTEGRATOR_H_
21#define _QUASI_STATIC_INTEGRATOR_H_
22
23#include "integrator.h"
24#include "mbsim/functions/function.h"
25#include<mbsim/dynamic_system_solver.h>
26
27namespace MBSim {
28
34 class hgFun : public MBSim::Function<fmatvec::Vec(fmatvec::Vec)> {
35 public:
40 sys(sys_), t(0) {
41 }
42
46 ~hgFun() override = default;
47 ;
48
49 /* INHERITED INTERFACE */
50 fmatvec::Vec operator()(const fmatvec::Vec& qla) override;
51
52 void setT(double t) {
53 this->t = t;
54 }
55
56 /*******************************************************/
57
58 private:
59
61 double t;
62
63 };
64
70 class jacFun : public MBSim::Function<fmatvec::SqrMat(fmatvec::Vec)> {
71 public:
75 jacFun(MBSim::DynamicSystemSolver* sys_, double t_, fmatvec::Vec& z_) :
76 sys(sys_), t(t_), z(z_) {
77 }
78
82 ~jacFun() override = default;
83 ;
84
85 /* INHERITED INTERFACE */
86 fmatvec::SqrMat operator()(const fmatvec::Vec& q) override;
87 /*******************************************************/
88
89 private:
90
92 double t;
93 fmatvec::Vec z;
94
95 };
102 public:
107
111 ~QuasiStaticIntegrator() override = default;
112
113 void preIntegrate() override;
114 void subIntegrate(double tStop) override;
115 void postIntegrate() override;
116
117 /* INHERITED INTERFACE OF INTEGRATOR */
119 void integrate() override;
120 void initializeUsingXML(xercesc::DOMElement *element) override;
121 /***************************************************/
122
123 /* GETTER / SETTER */
124 void setStepSize(double dt_) {
125 dt = dt_;
126 }
127 void setgTolerance(double tolerance_) {
128 gTol = tolerance_;
129 }
130 void sethTolerance(double tolerance_) {
131 hTol = tolerance_;
132 }
133 void setmaxExtraPolate(int value) {
134 maxExtraPolate = value;
135 }
136 void setextraPolateAfter(int value) {
137 extraPolateAfter = value;
138 }
139 void setupdateJacobianEvery(int value) {
140 updateJacobianEvery = value;
141 }
142 /***************************************************/
143
144 private:
148 double dt{1e-3};
149
153 double t{0.}, tPlot{0.};
154
158 double gTol{1e-10};
159
163 double hTol{1e-10};
164
168 int iter{0}, step{0}, integrationSteps{0}, maxIter{0}, sumIter{0};
169
174
179
184
188 double s0{0.}, time{0.};
189
193 int stepPlot{0};
194
198 fmatvec::Vec z, q, u, x;
199 };
200
201}
202
203#endif /* _QUASI_STATIC_INTEGRATOR_H_ */
solver interface for modelling and simulation of dynamic systems
Definition: dynamic_system_solver.h:61
Definition: function.h:53
integrator-interface for dynamic systems
Definition: integrator.h:37
virtual void integrate()=0
start the integration of the system set by setSystem. Each class implemeting this function should cal...
Definition: quasi_static_integrator.h:101
double gTol
tolerance for the newton iteration for distances
Definition: quasi_static_integrator.h:158
double s0
computing time counter
Definition: quasi_static_integrator.h:188
double dt
step size
Definition: quasi_static_integrator.h:148
int updateJacobianEvery
value of how often the Jacobian should be updated every step
Definition: quasi_static_integrator.h:183
void initializeUsingXML(xercesc::DOMElement *element) override
initialize integrator
Definition: quasi_static_integrator.cc:203
fmatvec::Vec z
state, position, velocity, order coordinate of dynamical system
Definition: quasi_static_integrator.h:198
void integrate() override
start the integration of the system set by setSystem. Each class implemeting this function should cal...
Definition: quasi_static_integrator.cc:197
double t
time and plot time
Definition: quasi_static_integrator.h:153
int iter
iteration counter for constraints, plots, integration, maximum constraints, cummulation constraint
Definition: quasi_static_integrator.h:168
double hTol
tolerance for newton iteration for forces
Definition: quasi_static_integrator.h:163
int maxExtraPolate
value of how many points in the past should be used to extrapolate for new value
Definition: quasi_static_integrator.h:173
~QuasiStaticIntegrator() override=default
destructor
QuasiStaticIntegrator()
constructor
Definition: quasi_static_integrator.cc:40
int stepPlot
plot step difference
Definition: quasi_static_integrator.h:193
int extraPolateAfter
extrapolate after such and that integration steps
Definition: quasi_static_integrator.h:178
calculate h vector according the new q and system boundary conditions
Definition: quasi_static_integrator.h:34
hgFun(MBSim::DynamicSystemSolver *sys_)
constructor
Definition: quasi_static_integrator.h:39
~hgFun() override=default
destructor
function for the dh/dq
Definition: quasi_static_integrator.h:70
~jacFun() override=default
destructor
jacFun(MBSim::DynamicSystemSolver *sys_, double t_, fmatvec::Vec &z_)
constructor
Definition: quasi_static_integrator.h:75
namespace MBSim
Definition: bilateral_constraint.cc:30