mbsim  4.0.0
MBSim Kernel
implicit_euler_integrator.h
1/* Copyright (C) 2004-2009 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 _IMPLICIT_EULER_INTEGRATOR_H_
21#define _IMPLICIT_EULER_INTEGRATOR_H_
22
23#include "integrator.h"
24#include "mbsim/functions/function.h"
25
26namespace MBSim {
27
30
31 class Residuum : public MBSim::Function<fmatvec::Vec(fmatvec::Vec)> {
32 public:
33 Residuum(MBSim::DynamicSystemSolver *sys_, double dt_) : sys(sys_), dt(dt_) { }
34 void setState(const fmatvec::Vec &zk_) { zk <<= zk_; }
35 protected:
37 fmatvec::Vec zk;
38 double dt;
39 };
40
41 class ResiduumFull : public Residuum {
42 public:
43 ResiduumFull(MBSim::DynamicSystemSolver *sys, double dt) : Residuum(sys, dt) { }
44 fmatvec::Vec operator()(const fmatvec::Vec &z);
45 };
46
47 class ResiduumReduced : public Residuum {
48 public:
49 ResiduumReduced(MBSim::DynamicSystemSolver *sys, double dt) : Residuum(sys, dt) { }
50 fmatvec::Vec operator()(const fmatvec::Vec &ux);
51 };
52
53 public:
57 ~ImplicitEulerIntegrator() override = default;
58
59 void preIntegrate() override;
60 void subIntegrate(double tStop) override;
61 void postIntegrate() override;
62
63 /* INHERITED INTERFACE OF INTEGRATOR */
65 void integrate() override;
66 void initializeUsingXML(xercesc::DOMElement *element) override;
67 /***************************************************/
68
69 /* GETTER / SETTER */
70 void setStepSize(double dt_) {dt = dt_;}
71 void setReducedForm(bool reduced_) { reduced = reduced_; }
72 /***************************************************/
73
74 private:
78 double dt{1e-3};
79
81 bool reduced{false};
82
83 double tPlot;
84 int iter, step, integrationSteps;
85 double s0, time;
86 int stepPlot;
87
88 Residuum *res{nullptr};
89 };
90
91}
92
93#endif
solver interface for modelling and simulation of dynamic systems
Definition: dynamic_system_solver.h:61
Definition: function.h:53
Definition: implicit_euler_integrator.h:41
Definition: implicit_euler_integrator.h:47
Definition: implicit_euler_integrator.h:31
Implicit Euler integrator.
Definition: implicit_euler_integrator.h:29
bool reduced
Definition: implicit_euler_integrator.h:81
void integrate() override
start the integration of the system set by setSystem. Each class implemeting this function should cal...
Definition: implicit_euler_integrator.cc:129
~ImplicitEulerIntegrator() override=default
destructor
double dt
step size
Definition: implicit_euler_integrator.h:78
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...
namespace MBSim
Definition: bilateral_constraint.cc:30