mbsim  4.0.0
MBSim Kernel
phem56_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 _PHEM56_INTEGRATOR_H_
24#define _PHEM56_INTEGRATOR_H_
25
26#include "root_finding_integrator.h"
27
28namespace MBSim {
29
34
35 public:
36
37 enum LinearAlgebra {
38 DEC=0,
39 DGETRF,
40 unknown
41 };
42
43 private:
44
45 static void fprob(int* ifcn, int* nq, int* nu, int* nx, int* nla, int* nzg, int* nzf, int* lrda, int* nblk, int* nmrc, int* npgp, int* npfl, int* indgr, int* indgc, int* indflr, int* indflc, double* t, double* q, double* u, double* x, double* xl, double* g, double* WT_, double* f, double* wb, double* deltagd_, double* V_, double* qd_, double* xd_, double* M_);
46 static void solout(int* nr, int* nq, int* nu, int* nx, int* nla, int* lrdo, double* q, double* u, double* x, double* a, double* rlam, double* dowk, int* irtrn);
47
48 double tPlot{0};
49 double dtOut{0};
50 double s0;
51 double time{0};
52
54 LinearAlgebra linearAlgebra{DGETRF};
56 bool generalVMatrix{true};
58 bool initialProjection{false};
64 fmatvec::Vec aTol;
66 fmatvec::Vec rTol;
68 double dt0{1e-3};
70 int maxSteps{std::numeric_limits<int>::max()};
72 double dtMax{0};
73
74 fmatvec::RangeV Rv;
75
76 bool drift { false };
77
78 std::exception_ptr exception;
79
80 public:
81
82 ~PHEM56Integrator() override = default;
83
84 void setAbsoluteTolerance(const fmatvec::Vec &aTol_) { aTol <<= aTol_; }
85 void setAbsoluteTolerance(double aTol_) { aTol.resize(1,fmatvec::INIT,aTol_); }
86 void setRelativeTolerance(const fmatvec::Vec &rTol_) { rTol <<= rTol_; }
87 void setRelativeTolerance(double rTol_) { rTol.resize(1,fmatvec::INIT,rTol_); }
88 void setInitialStepSize(double dt0_) { dt0 = dt0_; }
89 void setMaximumStepSize(double dtMax_) { dtMax = dtMax_; }
90 void setStepLimit(int maxSteps_) { maxSteps = maxSteps_; }
91 void setLinearAlgebra(LinearAlgebra linearAlgebra_) { linearAlgebra = linearAlgebra_; }
92 void setGeneralVMatrix(bool generalVMatrix_) { generalVMatrix = generalVMatrix_; }
93 void setInitialProjection(bool initialProjection_) { initialProjection = initialProjection_; }
94 void setNumberOfStepsBetweenProjections(int numberOfStepsBetweenProjections_) { numberOfStepsBetweenProjections = numberOfStepsBetweenProjections_; }
95 void setProjectOntoIndex1ConstraintManifold(bool projectOntoIndex1ConstraintManifold_) { projectOntoIndex1ConstraintManifold = projectOntoIndex1ConstraintManifold_; }
96
97 const fmatvec::Vec& getAbsoluteTolerance() const { return aTol; }
98 const fmatvec::Vec& getRelativeTolerance() const { return rTol; }
99
101 void integrate() override;
102
103 void initializeUsingXML(xercesc::DOMElement *element) override;
104 };
105
106}
107
108#endif
virtual void integrate()=0
start the integration of the system set by setSystem. Each class implemeting this function should cal...
DAE-Integrator PHEM56.
Definition: phem56_integrator.h:33
bool projectOntoIndex1ConstraintManifold
Definition: phem56_integrator.h:62
bool generalVMatrix
Definition: phem56_integrator.h:56
fmatvec::Vec rTol
Definition: phem56_integrator.h:66
int maxSteps
Definition: phem56_integrator.h:70
int numberOfStepsBetweenProjections
Definition: phem56_integrator.h:60
double dtMax
Definition: phem56_integrator.h:72
bool initialProjection
Definition: phem56_integrator.h:58
fmatvec::Vec aTol
Definition: phem56_integrator.h:64
void integrate() override
start the integration of the system set by setSystem. Each class implemeting this function should cal...
Definition: phem56_integrator.cc:296
void initializeUsingXML(xercesc::DOMElement *element) override
initialize integrator
Definition: phem56_integrator.cc:421
LinearAlgebra linearAlgebra
Definition: phem56_integrator.h:54
double dt0
Definition: phem56_integrator.h:68
Integrator with root-finding.
Definition: root_finding_integrator.h:32
namespace MBSim
Definition: bilateral_constraint.cc:30