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
28 namespace MBSim {
29
33 class PHEM56Integrator : public RootFindingIntegrator {
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* nv, int* nu, int* nl, 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* p, double* v, double* u, double* xl, double* g, double* gp, double* f, double* gpp, double* gt, double* fl, double* qdot, double* udot, double* am);
46 static void solout(int* nr, int* nq, int* nv, int* nu, int* nl, int* lrdo, double* q, double* v, double* u, 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};
60 int numberOfStepsBetweenProjections{0};
62 bool projectOntoIndex1ConstraintManifold{false};
64 fmatvec::Vec aTol;
66 fmatvec::Vec rTol;
68 double dt0{1e-3};
70 int maxSteps{2000000000};
72 double dtMax{0};
73
74 public:
75
76 ~PHEM56Integrator() override = default;
77
78 void setAbsoluteTolerance(const fmatvec::Vec &aTol_) { aTol <<= aTol_; }
79 void setAbsoluteTolerance(double aTol_) { aTol.resize(1,fmatvec::INIT,aTol_); }
80 void setRelativeTolerance(const fmatvec::Vec &rTol_) { rTol <<= rTol_; }
81 void setRelativeTolerance(double rTol_) { rTol.resize(1,fmatvec::INIT,rTol_); }
82 void setInitialStepSize(double dt0_) { dt0 = dt0_; }
83 void setMaximumStepSize(double dtMax_) { dtMax = dtMax_; }
84 void setStepLimit(int maxSteps_) { maxSteps = maxSteps_; }
85 void setLinearAlgebra(LinearAlgebra linearAlgebra_) { linearAlgebra = linearAlgebra_; }
86 void setGeneralVMatrix(bool generalVMatrix_) { generalVMatrix = generalVMatrix_; }
87 void setInitialProjection(bool initialProjection_) { initialProjection = initialProjection_; }
88 void setNumberOfStepsBetweenProjections(int numberOfStepsBetweenProjections_) { numberOfStepsBetweenProjections = numberOfStepsBetweenProjections_; }
89 void setProjectOntoIndex1ConstraintManifold(bool projectOntoIndex1ConstraintManifold_) { projectOntoIndex1ConstraintManifold = projectOntoIndex1ConstraintManifold_; }
90
91 const fmatvec::Vec& getAbsoluteTolerance() const { return aTol; }
92 const fmatvec::Vec& getRelativeTolerance() const { return rTol; }
93
94 using Integrator::integrate;
95 void integrate() override;
96
97 void initializeUsingXML(xercesc::DOMElement *element) override;
98 };
99
100 }
101
102 #endif
MBSim::PHEM56Integrator::rTol
fmatvec::Vec rTol
Definition: phem56_integrator.h:66
MBSim::PHEM56Integrator::linearAlgebra
LinearAlgebra linearAlgebra
Definition: phem56_integrator.h:54
MBSim::RootFindingIntegrator
Integrator with root-finding.
Definition: root_finding_integrator.h:32
MBSim::Integrator::integrate
virtual void integrate()=0
start the integration of the system set by setSystem. Each class implemeting this function should cal...
MBSim::PHEM56Integrator::numberOfStepsBetweenProjections
int numberOfStepsBetweenProjections
Definition: phem56_integrator.h:60
MBSim::PHEM56Integrator::aTol
fmatvec::Vec aTol
Definition: phem56_integrator.h:64
MBSim::PHEM56Integrator::dt0
double dt0
Definition: phem56_integrator.h:68
MBSim::PHEM56Integrator::integrate
void integrate() override
start the integration of the system set by setSystem. Each class implemeting this function should cal...
Definition: phem56_integrator.cc:282
MBSim::PHEM56Integrator::dtMax
double dtMax
Definition: phem56_integrator.h:72
MBSim::PHEM56Integrator::projectOntoIndex1ConstraintManifold
bool projectOntoIndex1ConstraintManifold
Definition: phem56_integrator.h:62
MBSim::PHEM56Integrator::initializeUsingXML
void initializeUsingXML(xercesc::DOMElement *element) override
initialize integrator
Definition: phem56_integrator.cc:386
MBSim::PHEM56Integrator::maxSteps
int maxSteps
Definition: phem56_integrator.h:70
MBSim::PHEM56Integrator
DAE-Integrator PHEM56.
Definition: phem56_integrator.h:33
MBSim::PHEM56Integrator::initialProjection
bool initialProjection
Definition: phem56_integrator.h:58
MBSim::PHEM56Integrator::generalVMatrix
bool generalVMatrix
Definition: phem56_integrator.h:56
MBSim
namespace MBSim
Definition: bilateral_constraint.cc:30