mbsim  4.0.0
MBSim Kernel
daspk_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 _DASPK_INTEGRATOR_H_
24#define _DASPK_INTEGRATOR_H_
25
26#include "dae_integrator.h"
27
28namespace MBSim {
29
35
36 private:
37 double delta(int i, double z) const override;
38 typedef void (*Delta)(double* t, double* y_, double* yd_, double* cj, double* delta_, int *ires, double* rpar, int* ipar);
39 typedef void (*Jac)(double* t, double* y_, double* yd_, double* J_, double* cj, double* rpar, int* ipar);
40 static Delta delt[5];
41 static Jac jac[5];
42 static void deltaODE(double* t, double* z_, double* zd_, double* cj, double* delta_, int *ires, double* rpar, int* ipar);
43 static void deltaDAE1(double* t, double* y_, double* yd_, double* cj, double* delta_, int *ires, double* rpar, int* ipar);
44 static void deltaDAE2(double* t, double* y_, double* yd_, double* cj, double* delta_, int *ires, double* rpar, int* ipar);
45 static void deltaGGL(double* t, double* y_, double* yd_, double* cj, double* delta_, int *ires, double* rpar, int* ipar);
46 static void jacODE(double* t, double* z_, double* zd_, double* J_, double* cj, double* rpar, int* ipar);
47 static void jacDAE1(double* t, double* y_, double* yd_, double* J_, double* cj, double* rpar, int* ipar);
48 static void jacDAE2(double* t, double* y_, double* yd_, double* J_, double* cj, double* rpar, int* ipar);
49 static void jacGGL(double* t, double* y_, double* yd_, double* J_, double* cj, double* rpar, int* ipar);
50
51 void init() override;
52 void reinit() override;
53
55 double dtMax{0};
57 double dt0{0};
60
61 fmatvec::VecInt info, iPar, iWork;
62 fmatvec::Vec work;
63 double h;
64 int lphi, lewt;
65 double *yd;
66
67 std::exception_ptr exception;
68
69 public:
70 void setMaximumStepSize(double dtMax_) { dtMax = dtMax_; }
71 void setInitialStepSize(double dt0_) { dt0 = dt0_; }
72 void setExcludeAlgebraicVariablesFromErrorTest(bool excludeAlgebraicVariables_) { excludeAlgebraicVariables = excludeAlgebraicVariables_; }
73
75 void integrate();
76
77 virtual void initializeUsingXML(xercesc::DOMElement *element);
78 };
79
80}
81
82#endif
Base class for all DAE integrators.
Definition: dae_integrator.h:33
Petzold’s DAE solver DASPK.
Definition: daspk_integrator.h:34
double dt0
Definition: daspk_integrator.h:57
bool excludeAlgebraicVariables
Definition: daspk_integrator.h:59
double dtMax
Definition: daspk_integrator.h:55
void integrate()
start the integration of the system set by setSystem. Each class implemeting this function should cal...
Definition: daspk_integrator.cc:318
virtual void initializeUsingXML(xercesc::DOMElement *element)
initialize integrator
Definition: daspk_integrator.cc:590
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