mbsim  4.0.0
MBSim Kernel
rodas_integrator.h
1/* Copyright (C) 2004-2018 Martin Förg
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 *
18 * Contact:
19 * martin.o.foerg@googlemail.com
20 *
21 */
22
23#ifndef _RODAS_INTEGRATOR_H_
24#define _RODAS_INTEGRATOR_H_
25
26#include "dae_integrator.h"
27
28namespace MBSim {
29
33
34 private:
35 double delta(int i, double z) const override;
36 void par_ud_xd_par_t(fmatvec::Vec &pt);
37 void par_ud_xd_gdd_par_t(fmatvec::Vec &pt);
38 typedef void (*Fzdot)(int* n, double* t, double* y, double* yd, double* rpar, int* ipar);
39 typedef void (*Jac)(int* n, double *t, double *y, double *J, int *nn, double *rpar, int *ipar);
40 typedef void (*Pt)(int* n, double* t, double* y, double* pt, double* rpar, int* ipar);
41 typedef void (*Mass)(int* n, double* m, int* lmas, double* rpar, int* ipar);
42 static Fzdot fzdot[2];
43 static Jac jac[2];
44 static Pt pt[2];
45 static Mass mass[2];
46 static void fzdotODE(int* n, double* t, double* z, double* zd, double* rpar, int* ipar);
47 static void fzdotDAE1(int* n, double* t, double* y, double* yd, double* rpar, int* ipar);
48 static void jacODE(int* n, double *t, double *z, double *J, int *nn, double *rpar, int *ipar);
49 static void jacDAE1(int* n, double *t, double *y, double *J, int *nn, double *rpar, int *ipar);
50 static void ptODE(int* n, double* t, double* z, double* pt, double* rpar, int* ipar);
51 static void ptDAE1(int* n, double* t, double* y, double* pt, double* rpar, int* ipar);
52 static void massFull(int* n, double* m, int* lmas, double* rpar, int* ipar);
53 static void massReduced(int* n, double* m, int* lmas, double* rpar, int* ipar);
54 static void plot(int* nr, double* told, double* t, double* y, double* cont, int* lrc, int* n, double* rpar, int* ipar, int* irtrn);
55
56 void reinit() override;
57
58 double tPlot{0};
59 double dtOut{0};
60 double s0;
61 double time{0};
62
64 double dt0{0};
66 int maxSteps{std::numeric_limits<int>::max()};
68 double dtMax{0};
70 bool autonom{false};
71
72 int mlJac, muJac;
73 fmatvec::VecInt iWork;
74 fmatvec::Vec work;
75
76 bool drift { false };
77
78 std::exception_ptr exception;
79
80 public:
81 ~RODASIntegrator() override = default;
82
83 void setInitialStepSize(double dt0_) { dt0 = dt0_; }
84 void setMaximumStepSize(double dtMax_) { dtMax = dtMax_; }
85 void setStepLimit(int maxSteps_) { maxSteps = maxSteps_; }
86 void setFormalism(Formalism formalism_) { formalism = formalism_; }
87 void setReducedForm(bool reduced_) { reduced = reduced_; }
88 void setAutonomousSystem(bool autonom_) { autonom = autonom_; }
89
91 void integrate() override;
92
93 void initializeUsingXML(xercesc::DOMElement *element) override;
94 };
95
96}
97
98#endif
Base class for all DAE integrators.
Definition: dae_integrator.h:33
Formalism formalism
Definition: dae_integrator.h:65
bool reduced
Definition: implicit_integrator.h:47
virtual void integrate()=0
start the integration of the system set by setSystem. Each class implemeting this function should cal...
DAE-Integrator RODAS.
Definition: rodas_integrator.h:32
int maxSteps
Definition: rodas_integrator.h:66
void integrate() override
start the integration of the system set by setSystem. Each class implemeting this function should cal...
Definition: rodas_integrator.cc:388
double dt0
Definition: rodas_integrator.h:64
double dtMax
Definition: rodas_integrator.h:68
void initializeUsingXML(xercesc::DOMElement *element) override
initialize integrator
Definition: rodas_integrator.cc:532
bool autonom
Definition: rodas_integrator.h:70
namespace MBSim
Definition: bilateral_constraint.cc:30