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
52 LinearAlgebra linearAlgebra{DGETRF};
54 bool generalVMatrix{true};
56 bool initialProjection{false};
62 fmatvec::Vec aTol;
64 fmatvec::Vec rTol;
66 double dt0{1e-3};
68 int maxSteps{std::numeric_limits<int>::max()};
70 double dtMax{0};
71
72 fmatvec::RangeV Rv;
73
74 bool drift { false };
75
76 std::exception_ptr exception;
77
78 public:
79
80 ~PHEM56Integrator() override = default;
81
82 void setAbsoluteTolerance(const fmatvec::Vec &aTol_) { aTol <<= aTol_; }
83 void setAbsoluteTolerance(double aTol_) { aTol.resize(1,fmatvec::INIT,aTol_); }
84 void setRelativeTolerance(const fmatvec::Vec &rTol_) { rTol <<= rTol_; }
85 void setRelativeTolerance(double rTol_) { rTol.resize(1,fmatvec::INIT,rTol_); }
86 void setInitialStepSize(double dt0_) { dt0 = dt0_; }
87 void setMaximumStepSize(double dtMax_) { dtMax = dtMax_; }
88 void setStepLimit(int maxSteps_) { maxSteps = maxSteps_; }
89 void setLinearAlgebra(LinearAlgebra linearAlgebra_) { linearAlgebra = linearAlgebra_; }
90 void setGeneralVMatrix(bool generalVMatrix_) { generalVMatrix = generalVMatrix_; }
91 void setInitialProjection(bool initialProjection_) { initialProjection = initialProjection_; }
92 void setNumberOfStepsBetweenProjections(int numberOfStepsBetweenProjections_) { numberOfStepsBetweenProjections = numberOfStepsBetweenProjections_; }
93 void setProjectOntoIndex1ConstraintManifold(bool projectOntoIndex1ConstraintManifold_) { projectOntoIndex1ConstraintManifold = projectOntoIndex1ConstraintManifold_; }
94
95 const fmatvec::Vec& getAbsoluteTolerance() const { return aTol; }
96 const fmatvec::Vec& getRelativeTolerance() const { return rTol; }
97
99 void integrate() override;
100
101 void initializeUsingXML(xercesc::DOMElement *element) override;
102 };
103
104}
105
106#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:60
bool generalVMatrix
Definition: phem56_integrator.h:54
fmatvec::Vec rTol
Definition: phem56_integrator.h:64
int maxSteps
Definition: phem56_integrator.h:68
int numberOfStepsBetweenProjections
Definition: phem56_integrator.h:58
double dtMax
Definition: phem56_integrator.h:70
bool initialProjection
Definition: phem56_integrator.h:56
fmatvec::Vec aTol
Definition: phem56_integrator.h:62
void integrate() override
start the integration of the system set by setSystem. Each class implemeting this function should cal...
Definition: phem56_integrator.cc:292
void initializeUsingXML(xercesc::DOMElement *element) override
initialize integrator
Definition: phem56_integrator.cc:415
LinearAlgebra linearAlgebra
Definition: phem56_integrator.h:52
double dt0
Definition: phem56_integrator.h:66
Integrator with root-finding.
Definition: root_finding_integrator.h:32
namespace MBSim
Definition: bilateral_constraint.cc:30