All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
time_stepping_ssc_integrator.h
1 /* Copyright (C) 2004-2009 MBSim Development Team
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  * Contact: martin.o.foerg@googlemail.com
18  */
19 
20 #ifndef _TIME_STEPPING_SSC_INTEGRATOR_H_
21 #define _TIME_STEPPING_SSC_INTEGRATOR_H_
22 
23 #include "integrator.h"
24 #include "mbsim/utils/stopwatch.h"
25 
26 namespace MBSim {
27  class Link;
28 }
29 
30 namespace MBSimIntegrator {
31 
67 
68  protected:
72 
73  double dt, dtOld, dte;
74  double dtMin, dtMax;
75  double dt_SSC_vorGapControl;
76  bool driftCompensation;
77  double t, tPlot;
78  int qSize, xSize, uSize, zSize;
79  fmatvec::Vec ze, zi, z1d, z2d, z2dRE, z3d, z4d, z6d, z2b, z3b, z4b, z6b, zStern;
80  fmatvec::VecInt LS, LSe, LStmp_T1, LStmp_T2, LStmp_T3, LSA, LSB1, LSB2, LSC1, LSC2, LSC3, LSC4, LSD1, LSD2, LSD3, LSD4, LSD5, LSD6;
81  fmatvec::Vec la, lae, la1d, la2b;
82  fmatvec::VecInt laSizes, laeSizes, la1dSizes, la2bSizes;
83  fmatvec::Vec gInActive, gdInActive;
84  std::vector<MBSim::Link*> SetValuedLinkListT1;
85  std::vector<MBSim::Link*> SetValuedLinkListT2;
86  std::vector<MBSim::Link*> SetValuedLinkListT3;
87 
88  int StepsWithUnchangedConstraints;
89 
99  bool FlagSSC;
103  int maxOrder;
108  int method;
109  /* Flag for Gap Control */
110  bool FlagGapControl;
112  double gapTol;
114  double maxGainSSC;
118  std::ofstream integPlot;
144  double time;
147  int iter, iterA, iterB1, iterB2, iterC1, iterC2, iterC3, iterC4, iterB2RE, maxIterUsed, maxIter, sumIter;
148  int integrationSteps, integrationStepswithChange, refusedSteps, refusedStepsWithImpact;
149  int wrongAlertGapControl, stepsOkAfterGapControl, stepsRefusedAfterGapControl, statusGapControl;
150  int singleStepsT1, singleStepsT2, singleStepsT3;
151  double dtRelGapControl, qUncertaintyByExtrapolation;
152  int indexLSException;
153  fmatvec::Vec gUniActive;
154  double Penetration, PenetrationCounter, PenetrationLog, PenetrationMin, PenetrationMax;
155  double maxdtUsed, mindtUsed;
156  bool ChangeByGapControl;
157  bool calcBlock2;
158  bool IterConvergence;
159  bool ConstraintsChanged, ConstraintsChangedBlock1, ConstraintsChangedBlock2;
160  int integrationStepsOrder1;
161  int integrationStepsOrder2;
162  int order;
163  int StepTrials;
164  int AnzahlAktiverKontakte;
165  double gNDurchschnittprostep;
166 
167  fmatvec::Vec bi;
168 
169  public:
175  void setInitialStepSize(double dt_) {dt = dt_;}
177  void setStepSizeMax(double dtMax_) {dtMax = dtMax_;}
179  void setStepSizeMin(double dtMin_) {dtMin = dtMin_;}
181  void setmaxGainSSC(double maxGain) {maxGainSSC = maxGain;}
183  void setSafetyFactorSSC(double sfactor) {safetyFactorSSC=sfactor;}
184  void setSafetyFactorGapControl(double s){safetyFactorGapControl=s;}
186  void setOutputInterpolation(bool flag=true) {outputInterpolation = flag;}
188  void setFlagPlotIntegrator(bool flag=true) {FlagPlotIntegrator = flag;}
190  void setFlagOutputOnlyAtTPlot(bool flag=true) {FlagOutputOnlyAtTPlot = flag;}
200  void setGapControl(int strategy=1) {FlagGapControl=(strategy>=0); GapControlStrategy=(strategy<0)?0:strategy; }
202  void setDriftCompensation(bool dc) {driftCompensation = dc;}
207  void setMaxOrder(int order_, int method_=0);
208  /* deactivate step size control */
209  void deactivateSSC(bool flag=false) {FlagSSC=flag;}
214  void setFlagErrorTest(int Flag, bool alwaysValid=true);
215 
217  void integrate(MBSim::DynamicSystemSolver& system_);
219  void integrate(MBSim::DynamicSystemSolver& systemT1_, MBSim::DynamicSystemSolver& systemT2_, MBSim::DynamicSystemSolver& systemT3_, int Threads=0);
220 
221  void setAbsoluteTolerance(const fmatvec::Vec &aTol_) {aTol = aTol_;}
222  void setAbsoluteTolerance(double aTol_) {aTol = fmatvec::Vec(1,fmatvec::INIT,aTol_);}
223  void setRelativeTolerance(const fmatvec::Vec &rTol_) {rTol = rTol_;}
224  void setRelativeTolerance(double rTol_) {rTol = fmatvec::Vec(1,fmatvec::INIT,rTol_);}
225  void setgapTolerance(double gTol) {gapTol = gTol;}
226 
230  void subIntegrate(MBSim::DynamicSystemSolver& system, double tStop);
231  void postIntegrate(MBSim::DynamicSystemSolver& system);
233 
235  void getDataForGapControl();
236  bool testTolerances();
237  bool GapControl(double qUnsafe, bool SSCTestOK);
238  bool changedLinkStatus(const fmatvec::VecInt &L1, const fmatvec::VecInt &L2, int ex);
239  double calculatedtNewRel(const fmatvec::Vec &ErrorLocal, double H);
240  void plot();
241 
242  virtual void initializeUsingXML(xercesc::DOMElement *element);
243 
244  void updatebi();
245  void updatela();
246  void updatezd();
247  };
248 
249 }
250 
251 #endif
void setmaxGainSSC(double maxGain)
Definition: time_stepping_ssc_integrator.h:181
void integrate(MBSim::DynamicSystemSolver &system_)
Definition: time_stepping_ssc_integrator.cc:105
int FlagErrorTest
Definition: time_stepping_ssc_integrator.h:91
Vector< Ref, double > Vec
void setFlagOutputOnlyAtTPlot(bool flag=true)
Definition: time_stepping_ssc_integrator.h:190
solver interface for modelling and simulation of dynamic systems
Definition: dynamic_system_solver.h:48
int method
Definition: time_stepping_ssc_integrator.h:108
bool FlagPlotIntegrationSum
Definition: time_stepping_ssc_integrator.h:122
bool FlagErrorTestAlwaysValid
Definition: time_stepping_ssc_integrator.h:93
void setStepSizeMin(double dtMin_)
Definition: time_stepping_ssc_integrator.h:179
bool FlagPlotIntegrator
Definition: time_stepping_ssc_integrator.h:120
void setGapControl(int strategy=1)
Definition: time_stepping_ssc_integrator.h:200
int GapControlStrategy
Definition: time_stepping_ssc_integrator.h:140
int numThreads
Definition: time_stepping_ssc_integrator.h:142
std::ofstream integPlot
Definition: time_stepping_ssc_integrator.h:118
void getDataForGapControl()
Definition: time_stepping_ssc_integrator.cc:1457
Half-explicit time-stepping integrator of first or higer order with StepSize Control (SSC) important ...
Definition: time_stepping_ssc_integrator.h:66
bool FlagSSC
Definition: time_stepping_ssc_integrator.h:99
void setInitialStepSize(double dt_)
Definition: time_stepping_ssc_integrator.h:175
MBSim::StopWatch Timer
Definition: time_stepping_ssc_integrator.h:146
bool FlagOutputOnlyAtTPlot
Definition: time_stepping_ssc_integrator.h:126
void setSafetyFactorSSC(double sfactor)
Definition: time_stepping_ssc_integrator.h:183
void setMaxOrder(int order_, int method_=0)
Definition: time_stepping_ssc_integrator.cc:95
double safetyFactorSSC
Definition: time_stepping_ssc_integrator.h:116
double time
Definition: time_stepping_ssc_integrator.h:144
TimeSteppingSSCIntegrator()
Definition: time_stepping_ssc_integrator.cc:46
Definition: stopwatch.h:35
void preIntegrate(MBSim::DynamicSystemSolver &system)
Definition: time_stepping_ssc_integrator.cc:117
double safetyFactorGapControl
Definition: time_stepping_ssc_integrator.h:132
int maxOrder
Definition: time_stepping_ssc_integrator.h:103
double gapTol
Definition: time_stepping_ssc_integrator.h:112
void setOutputInterpolation(bool flag=true)
Definition: time_stepping_ssc_integrator.h:186
void setFlagErrorTest(int Flag, bool alwaysValid=true)
Definition: time_stepping_ssc_integrator.cc:87
bool FlagPlotEveryStep
Definition: time_stepping_ssc_integrator.h:128
bool outputInterpolation
Definition: time_stepping_ssc_integrator.h:130
virtual void initializeUsingXML(xercesc::DOMElement *element)
initialize integrator
Definition: time_stepping_ssc_integrator.cc:1483
integrator-interface for dynamic systems
Definition: integrator.h:40
fmatvec::Vec rTol
Definition: time_stepping_ssc_integrator.h:97
void setStepSizeMax(double dtMax_)
Definition: time_stepping_ssc_integrator.h:177
fmatvec::Vec aTol
Definition: time_stepping_ssc_integrator.h:95
static DynamicSystemSolver * system
dynamic system
Definition: solver.h:65
void setFlagPlotIntegrator(bool flag=true)
Definition: time_stepping_ssc_integrator.h:188
double maxGainSSC
Definition: time_stepping_ssc_integrator.h:114
void setDriftCompensation(bool dc)
Definition: time_stepping_ssc_integrator.h:202
bool FlagCoutInfo
Definition: time_stepping_ssc_integrator.h:124
~TimeSteppingSSCIntegrator()
Definition: time_stepping_ssc_integrator.cc:81

Impressum / Disclaimer / Datenschutz Generated by doxygen 1.8.5 Valid HTML