mbsim  4.0.0
MBSim Kernel
dynamic_system_solver.h
1 /* Copyright (C) 2004-2018 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 _DYNAMIC_SYSTEM_SOLVER_H_
21 #define _DYNAMIC_SYSTEM_SOLVER_H_
22 
23 #include "mbsim/group.h"
24 #include "fmatvec/sparse_matrix.h"
25 #include "mbsim/functions/function.h"
26 #include "mbsim/environment.h"
27 
28 namespace MBSim {
29 
30  class Graph;
31  class MBSimEnvironment;
32 
33  struct StateTable {
34  std::string name;
35  char label;
36  int number;
37  StateTable() = default;
38  StateTable(const std::string &name_, char label_, int number_) : name(name_), label(label_), number(number_) { }
39  };
40 
56  class DynamicSystemSolver : public Group {
57 
58  class Residuum : public MBSim::Function<fmatvec::Vec(fmatvec::Vec)> {
59  public:
60  Residuum(MBSim::DynamicSystemSolver *sys_) : sys(sys_) { }
61  fmatvec::Vec operator()(const fmatvec::Vec &z);
62  private:
64  };
65 
66  public:
67 
71  enum Solver { fixedpoint, GaussSeidel, direct, rootfinding, unknownSolver };
72 
77  DynamicSystemSolver(const std::string &name="");
78 
82  ~DynamicSystemSolver() override;
83 
122  void initialize();
123 
124  /*
125  * If true (the default) then
126  * the simulation output files (h5 files) are deleted/truncated/regenerated.
127  * If false, then these files left are untouched from a previous run.
128  * This is useful to regenerate the
129  * e.g. OpenMBV XML files without doing a new integration.
130  */
131  void setTruncateSimulationFiles(bool trunc) { truncateSimulationFiles=trunc; }
132 
133  /* INHERITED INTERFACE OF GROUP */
134  void init(InitStage stage, const InitConfigSet &config) override;
135  using Group::plot;
136  /***************************************************/
137 
138  /* INHERITED INTERFACE OF DYNAMICSYSTEM */
139  int solveConstraintsFixpointSingle() override;
140  int solveImpactsFixpointSingle() override;
141  int solveConstraintsGaussSeidel() override;
142  int solveImpactsGaussSeidel() override;
143  int solveConstraintsRootFinding() override;
144  int solveImpactsRootFinding() override;
145  void checkConstraintsForTermination() override;
146  void checkImpactsForTermination() override;
147  /***************************************************/
148 
149  /* INHERITED INTERFACE OF OBJECTINTERFACE */
150  void updateT() override;
151  void updateh(int i=0) override;
152  void updateM() override;
153  void updateLLM() override;
154  void updatezd() override;
155  /***************************************************/
156 
157  /* INHERITED INTERFACE OF LINKINTERFACE */
158 
169  virtual void updater(int j=0);
170  virtual void updaterdt();
171  void updatewb() override;
172  void updateg() override;
173  void updategd() override;
174  void updateW(int j=0) override;
175  void updateV(int j=0) override;
176  virtual void updatebc();
177  virtual void updatebi();
178  virtual void updatela();
179  virtual void updateLa();
180  /***************************************************/
181 
182  /* INHERITED INTERFACE OF ELEMENT */
183  /***************************************************/
184 
185  /* GETTER / SETTER */
186 
187  void setConstraintSolver(Solver solver_) { contactSolver = solver_; }
188  void setImpactSolver(Solver solver_) { impactSolver = solver_; }
189  const Solver& getConstraintSolver() { return contactSolver; }
190  const Solver& getImpactSolver() { return impactSolver; }
191  void setTermination(bool term_) { term = term_; }
192  void setMaximumNumberOfIterations(int iter) { maxIter = iter; }
193  void setHighNumberOfIterations(int iter) { highIter = iter; }
194  void setNumericalJacobian(bool numJac_) { numJac = numJac_; }
195  void setMaximumDampingSteps(int maxDSteps) { maxDampingSteps = maxDSteps; }
196  void setLevenbergMarquardtParamater(double lmParm_) { lmParm = lmParm_; }
197 
198  void setUseOldla(bool flag) { useOldla = flag; }
199  void setDecreaseLevels(const fmatvec::VecInt &decreaseLevels_) { decreaseLevels = decreaseLevels_; }
200  void setCheckTermLevels(const fmatvec::VecInt &checkTermLevels_) { checkTermLevels = checkTermLevels_; }
201  void setCheckGSize(bool checkGSize_) { checkGSize = checkGSize_; }
202  void setLimitGSize(int limitGSize_) { limitGSize = limitGSize_; checkGSize = false; }
203 
204  double& getTime() { return t; }
205  const double& getTime() const { return t; }
206  void setTime(double t_) { t = t_; }
207 
208  double getStepSize() const { return dt; }
209  void setStepSize(double dt_) { dt = dt_; }
210 
211  int getzSize() const { return zSize; }
212 
213  fmatvec::Vec& getState() { return z; }
214  const fmatvec::Vec& getState() const { return z; }
215  void setState(const fmatvec::Vec &z_) { z = z_; }
216 
217  void setzd(const fmatvec::Vec &zd_) { zd = zd_; }
218 
219  const fmatvec::SqrMat& getG(bool check=true) const { assert((not check) or (not updG)); return G; }
220  const fmatvec::SparseMat& getGs(bool check=true) const { assert((not check) or (not updG)); return Gs; }
221  const fmatvec::Vec& getbc(bool check=true) const { assert((not check) or (not updbc)); return bc; }
222  const fmatvec::Vec& getbi(bool check=true) const { assert((not check) or (not updbi)); return bi; }
223  const fmatvec::SqrMat& getJprox() const { return Jprox; }
224  fmatvec::SqrMat& getG(bool check=true) { assert((not check) or (not updG)); return G; }
225  fmatvec::SparseMat& getGs(bool check=true) { assert((not check) or (not updG)); return Gs; }
226  fmatvec::Vec& getbc(bool check=true) { assert((not check) or (not updbc)); return bc; }
227  fmatvec::Vec& getbi(bool check=true) { assert((not check) or (not updbi)); return bi; }
228  fmatvec::SqrMat& getJprox() { return Jprox; }
229 
230  const fmatvec::Vec& evaldq() { if(upddq) updatedq(); return dq; }
231  const fmatvec::Vec& evaldu() { if(upddu) updatedu(); return du; }
232  const fmatvec::Vec& evaldx() { if(upddx) updatedx(); return dx; }
233  const fmatvec::Vec& evalzd();
234  const fmatvec::SqrMat& evalG() { if(updG) updateG(); return G; }
235  const fmatvec::SparseMat& evalGs() { if(updG) updateG(); return Gs; }
236  const fmatvec::Vec& evalbc() { if(updbc) updatebc(); return bc; }
237  const fmatvec::Vec& evalbi() { if(updbi) updatebi(); return bi; }
238  const fmatvec::Vec& evalsv();
239  const fmatvec::Vec& evalz0();
240  const fmatvec::Vec& evalla() { if(updla) updatela(); return la; }
241  const fmatvec::Vec& evalLa() { if(updLa) updateLa(); return La; }
242 
243  fmatvec::Vec& getzParent() { return zParent; }
244  fmatvec::Vec& getzdParent() { return zdParent; }
245  fmatvec::Vec& getlaParent() { return laParent; }
246  fmatvec::Vec& getLaParent() { return LaParent; }
247 // const fmatvec::Vec& getzParent() const { return zParent; }
248 // const fmatvec::Vec& getzdParent() const { return zdParent; }
249 // const fmatvec::Mat& getWParent(int i=0) const { return WParent[i]; }
250  fmatvec::Mat& getWParent(int i=0) { return WParent[i]; }
251  fmatvec::Mat& getVParent(int i=0) { return VParent[i]; }
252 // fmatvec::Vec& getlaParent() { return laParent; }
253 // fmatvec::Vec& getLaParent() { return LaParent; }
254 // const fmatvec::Vec& getgParent() const { return gParent; }
255  fmatvec::Vec& getgParent() { return gParent; }
256 // const fmatvec::Vec& getgdParent() const { return gdParent; }
257  fmatvec::Vec& getgdParent() { return gdParent; }
258  fmatvec::Vec& getresParent() { return resParent; }
259  fmatvec::Vec& getrFactorParent() { return rFactorParent; }
260 
261  void resizezParent(int nz) { zParent.resize(nz); }
262  void resizezdParent(int nz) { zdParent.resize(nz); }
263 
264  DynamicSystemSolver* getDynamicSystemSolver() { return this; }
265  bool getIntegratorExitRequest() { return integratorExitRequest; }
266  int getMaxIter() {return maxIter;}
267  int getIterC() {return iterc;}
268  int getIterI() {return iteri;}
269  /***************************************************/
270 
275 
281 
288 
295 
303 
308  virtual void updateG();
309 
313  void decreaserFactors();
314 
321  virtual const fmatvec::Vec& shift();
322 
327  void getLinkStatus(fmatvec::VecInt &LinkStatusExt);
328 
333  void getLinkStatusReg(fmatvec::VecInt &LinkStatusRegExt);
334 
338  bool positionDriftCompensationNeeded(double gmax);
339 
343  bool velocityDriftCompensationNeeded(double gdmax);
344 
348  void projectGeneralizedPositions(int mode, bool fullUpdate=false);
349 
353  void projectGeneralizedVelocities(int mode);
354 
359  void savela();
360 
365  void initla();
366 
371  void saveLa();
372 
377  void initLa();
378 
383  void addElement(Element *element_);
384 
390  Element* getElement(const std::string &name);
391 
395  std::string getSolverInfo();
396 
401  void setStopIfNoConvergence(bool flag, bool dropInfo = false) { stopIfNoConvergence = flag; dropContactInfo=dropInfo; }
402 
406  void dropContactMatrices();
407 
408  // MBSim signal handler
409 #ifndef SWIG
411  public:
412  SignalHandler();
413  ~SignalHandler();
414  private:
415  #ifdef HAVE_ANSICSIGNAL
416  using SigHandle = void (*)(int);
417  SigHandle oldSigInt;
418  SigHandle oldSigTerm;
419  #endif
420  };
421 #endif
422 
426  static void sigInterruptHandler(int);
427 
428  void checkExitRequest();
429 
430  // TODO just for testing
431  void setPartialEventDrivenSolver(bool peds_) { peds = peds_; }
432 
438  void writez(std::string fileName, bool formatH5=true);
439 
445  void writeStateTable(std::string fileName);
446 
451  void readz0(std::string fileName);
452 
453  void initializeUsingXML(xercesc::DOMElement *element) override;
454 
459  void setProjectionTolerance(double tol) { tolProj = tol; }
460 
465  void updatezRef(fmatvec::Vec &ext);
466 
471  void updatezdRef(fmatvec::Vec &ext);
472 
473  void setAlwaysConsiderContact(bool alwaysConsiderContact_) { alwaysConsiderContact = alwaysConsiderContact_; }
474 
475  void setInverseKinetics(bool inverseKinetics_) { inverseKinetics = inverseKinetics_; }
476  bool getInverseKinetics() const { return inverseKinetics; }
477 
478  void setInitialProjection(bool initialProjection_) { initialProjection = initialProjection_; }
479  bool getInitialProjection() const { return initialProjection; }
480 
481  void setDetermineEquilibriumState(bool determineEquilibriumState_) { determineEquilibriumState = determineEquilibriumState_; }
482  bool getDetermineEquilibriumState() const { return determineEquilibriumState; }
483 
484  void setUseConstraintSolverForSmoothMotion(bool useConstraintSolverForSmoothMotion_) { useConstraintSolverForSmoothMotion = useConstraintSolverForSmoothMotion_; }
485  bool getUseConstraintSolverForSmoothMotion() const { return useConstraintSolverForSmoothMotion; }
486 
487  void setUseConstraintSolverForPlot(bool useConstraintSolverForPlot_) { useConstraintSolverForPlot = useConstraintSolverForPlot_; }
488  bool getUseConstraintSolverForPlot() const { return useConstraintSolverForPlot; }
489 
490  fmatvec::Mat dhdq(int lb=0, int ub=0);
491  fmatvec::Mat dhdu(int lb=0, int ub=0);
492  fmatvec::Mat dhdx();
493  fmatvec::Vec dhdt();
494 
495  void setRootID(int ID) {rootID = ID;}
496  int getRootID() const {return rootID;}
497 
498  void resetUpToDate() override;
499 
500  bool getUpdateT() { return updT; }
501  bool getUpdateM() { return updM; }
502  bool getUpdateLLM() { return updLLM; }
503  bool getUpdateh(int j) { return updh[j]; }
504  bool getUpdater(int j) { return updr[j]; }
505  bool getUpdaterdt() { return updrdt; }
506  bool getUpdateW(int j) { return updW[j]; }
507  bool getUpdateV(int j) { return updV[j]; }
508  bool getUpdatewb() { return updwb; }
509  bool getUpdateg() { return updg; }
510  bool getUpdategd() { return updgd; }
511  bool getUpdatela() { return updla; }
512  bool getUpdateLa() { return updLa; }
513  bool getUpdatezd() { return updzd; }
514  bool getUpdatedq() { return upddq; }
515  bool getUpdatedu() { return upddu; }
516  bool getUpdatedx() { return upddx; }
517  void setUpdatela(bool updla_) { updla = updla_; }
518  void setUpdateLa(bool updLa_) { updLa = updLa_; }
519  void setUpdateG(bool updG_) { updG = updG_; }
520  void setUpdatebi(bool updbi_) { updbi = updbi_; }
521  void setUpdatebc(bool updbc_) { updbc = updbc_; }
522  void setUpdatezd(bool updzd_) { updzd = updzd_; }
523  void setUpdateW(bool updW_, int i=0) { updW[i] = updW_; }
524 
529  void updategRef(fmatvec::Vec &ref) override { Group::updategRef(ref); updg = true; }
530 
535  void updategdRef(fmatvec::Vec &ref) override { Group::updategdRef(ref); updgd = true; }
536 
541  void updatewbRef(fmatvec::Vec &ref) override { Group::updatewbRef(ref); updwb = true; }
542 
548  void updateWRef(fmatvec::Mat &ref, int i=0) override { Group::updateWRef(ref,i); updW[i] = true; }
549 
555  void updateVRef(fmatvec::Mat &ref, int i=0) override { Group::updateVRef(ref,i); updV[i] = true; }
556 
560  virtual void updatelaInverseKinetics();
561 
562  void updatedq() override;
563  void updatedu() override;
564  void updatedx() override;
565 
566  void updateStopVector() override;
567 
568  void updateInternalState();
569 
570  void plot() override;
571 
572  void addEnvironment(Environment* env);
573 
578  template<class Env>
579  Env* getEnvironment();
580 
584 
585  std::vector<StateTable>& getStateTable() { return tabz; }
586 
587  protected:
591  double t;
592 
596  double dt;
597 
601  int zSize;
602 
607 
612 
617 
622 
627 
632 
637 
642 
647 
652 
657 
662 
663  fmatvec::Vec curisParent, nextisParent;
664 
669 
674 
679 
684 
685  fmatvec::Vec dxParent, dqParent, duParent;
686 
691 
695  fmatvec::Vec rParent[2], rdtParent;
696 
701 
705  fmatvec::VecInt jsvParent;
706 
710  fmatvec::VecInt LinkStatusParent;
711 
716  fmatvec::VecInt LinkStatusRegParent;
717 
721  fmatvec::SparseMat Gs;
722 
727 
732 
737 
741  bool term;
742 
746  int maxIter, highIter, maxDampingSteps, iterc, iteri;
747 
751  double lmParm;
752 
756  Solver contactSolver, impactSolver;
757 
762 
767 
771  bool useOldla;
772 
776  bool numJac;
777 
781  fmatvec::VecInt decreaseLevels;
782 
786  fmatvec::VecInt checkTermLevels;
787 
792 
797 
801  bool peds;
802 
806  double tolProj;
807 
811  fmatvec::Vec laInverseKineticsParent;
812  fmatvec::Mat bInverseKineticsParent;
813 
817  fmatvec::Mat WInverseKineticsParent;
818 
819  bool alwaysConsiderContact;
820  bool inverseKinetics;
821  bool initialProjection;
822  bool determineEquilibriumState;
823  bool useConstraintSolverForSmoothMotion;
824  bool useConstraintSolverForPlot;
825 
826  fmatvec::Vec corrParent;
827 
828  int rootID;
829 
830  double gTol, gdTol, gddTol, laTol, LaTol;
831 
832  bool updT, updh[2], updr[2], updrdt, updM, updLLM, updW[2], updV[2], updwb, updg, updgd, updG, updbc, updbi, updsv, updzd, updla, updLa, upddq, upddu, upddx;
833 
834  bool solveDirectly;
835 
836  std::vector<StateTable> tabz;
837 
838  private:
842  void constructor();
843 
848 
852  static std::atomic<bool> exitRequest;
853  static_assert(decltype(exitRequest)::is_always_lock_free);
854 
858  bool READZ0;
859 
868  void addToGraph(Graph* graph, fmatvec::SqrMat &A, int i, std::vector<Element*> &objList);
869 
870  bool truncateSimulationFiles;
871 
872  // Holds the dynamic systems before the "reorganize hierarchy" takes place.
873  // This is required since all elements of all other containers from DynamicSystem are readded to DynamicSystemSolver,
874  // except this container (which is a "pure" container = no calculation is done in DynamicSystem)
875  // However, we must hold this container until the dtor of DynamicSystemSolver is called to avoid the deallocation of other
876  // elements hold by DynamicSystem elements (especially (currently only) hdf5File)
877  std::vector<DynamicSystem*> dynamicsystemPreReorganize;
878 
879  double facSizeGs;
880 
881  std::vector<std::unique_ptr<Environment>> environments;
882  MBSimEnvironment *mbsimEnvironment = nullptr;
883 
884  bool firstPlot { true };
885  };
886 
887  template<class Env>
889  // get the Environment of type Env
890  auto &reqType=typeid(Env);
891  for(auto &e : environments)
892  if(reqType==typeid(*e))
893  return static_cast<Env*>(e.get());
894  auto newEnv=new Env;
895  addEnvironment(newEnv);
896  return newEnv;
897  }
898 
899 }
900 
901 #endif /* _DYNAMIC_SYSTEM_SOLVER_H_ */
bool useOldla
flag if contac force parameter of last time step should be used
Definition: dynamic_system_solver.h:771
Definition: dynamic_system_solver.h:33
void plot() override
plots time dependent data
Definition: dynamic_system_solver.cc:1582
int solveImpactsGaussSeidel() override
solve impact equations with Gauss-Seidel scheme on velocity level
Definition: dynamic_system_solver.cc:516
int(DynamicSystemSolver::* solveConstraints_)()
Definition: dynamic_system_solver.h:280
int solveConstraintsLinearEquations()
solution of contact equations with Cholesky decomposition
Definition: dynamic_system_solver.cc:875
fmatvec::Vec gParent
relative distances
Definition: dynamic_system_solver.h:668
int zSize
size of state vector
Definition: dynamic_system_solver.h:601
double t
time
Definition: dynamic_system_solver.h:591
bool checkGSize
boolean if force action matrix should be resized in each step
Definition: dynamic_system_solver.h:791
int solveImpactsLinearEquations()
solution of contact equations with Cholesky decomposition on velocity level
Definition: dynamic_system_solver.cc:880
fmatvec::Vec rParent[2]
nonsmooth right hand side
Definition: dynamic_system_solver.h:695
int solveConstraintsGaussSeidel() override
solve contact equations with Gauss-Seidel scheme
Definition: dynamic_system_solver.cc:496
void initLa()
load contact impulses for use as starting value
Definition: dynamic_system_solver.cc:1134
bool term
boolean to check for termination of contact equations solution
Definition: dynamic_system_solver.h:741
void readz0(std::string fileName)
reads state from a file
Definition: dynamic_system_solver.cc:1275
Env * getEnvironment()
Definition: dynamic_system_solver.h:888
bool dropContactInfo
flag if contact matrices for debugging should be dropped in no-convergence case
Definition: dynamic_system_solver.h:766
int solveConstraintsFixpointSingle() override
solve contact equations with single step fixed point scheme
Definition: dynamic_system_solver.cc:434
double tolProj
Tolerance for projection of generalized position.
Definition: dynamic_system_solver.h:806
solver interface for modelling and simulation of dynamic systems
Definition: dynamic_system_solver.h:56
void initla()
load contact forces for use as starting value
Definition: dynamic_system_solver.cc:1124
virtual void updateVRef(fmatvec::Mat &VParent, int j=0)
references to condensed contact force direction matrix of dynamic system parent
Definition: dynamic_system.cc:828
fmatvec::SparseMat Gs
sparse mass action matrix
Definition: dynamic_system_solver.h:721
fmatvec::VecInt checkTermLevels
TODO.
Definition: dynamic_system_solver.h:786
DynamicSystemSolver(const std::string &name="")
constructor
Definition: dynamic_system_solver.cc:70
Solver contactSolver
solver for contact equations and impact equations
Definition: dynamic_system_solver.h:756
void updategRef(fmatvec::Vec &ref) override
references to relative distances of dynamic system parent
Definition: dynamic_system_solver.h:529
fmatvec::Vec bc
TODO.
Definition: dynamic_system_solver.h:736
bool stopIfNoConvergence
flag if the contact equations should be stopped if there is no convergence
Definition: dynamic_system_solver.h:761
virtual const fmatvec::Vec & shift()
update for event driven integrator for event
Definition: dynamic_system_solver.cc:1414
void updateVRef(fmatvec::Mat &ref, int i=0) override
references to condensed contact force direction matrix of dynamic system parent
Definition: dynamic_system_solver.h:555
fmatvec::Mat TParent
matrix of linear relation between differentiated positions and velocities
Definition: dynamic_system_solver.h:626
fmatvec::Vec sParent
TODO.
Definition: dynamic_system_solver.h:656
fmatvec::VecInt LinkStatusRegParent
status vector of single valued links
Definition: dynamic_system_solver.h:716
Definition: environment.h:37
fmatvec::Vec zd
derivative of state vector
Definition: dynamic_system_solver.h:611
void getLinkStatusReg(fmatvec::VecInt &LinkStatusRegExt)
Definition: dynamic_system_solver.cc:994
void updateWRef(fmatvec::Mat &ref, int i=0) override
references to contact force direction matrix of dynamic system parent
Definition: dynamic_system_solver.h:548
fmatvec::Vec gdParent
relative velocities
Definition: dynamic_system_solver.h:673
void projectGeneralizedVelocities(int mode)
drift projection for positions
Definition: dynamic_system_solver.cc:1081
fmatvec::VecInt LinkStatusParent
status vector of set valued links with piecewise link equation (which piece is valid)
Definition: dynamic_system_solver.h:710
virtual void updatewbRef(fmatvec::Vec &wbParent)
references to TODO of dynamic system parent
Definition: dynamic_system.cc:800
group ingredients do not depend on each other
Definition: group.h:35
void checkImpactsForTermination() override
validate force laws concerning given tolerances on velocity level
Definition: dynamic_system_solver.cc:679
std::string getSolverInfo()
Definition: dynamic_system_solver.cc:1178
fmatvec::Vec z
state vector
Definition: dynamic_system_solver.h:606
basic class of MBSim mainly for plotting
Definition: element.h:56
static void sigInterruptHandler(int)
handler for user interrupt signal
Definition: dynamic_system_solver.cc:1228
double lmParm
Levenberg-Marquard parameter.
Definition: dynamic_system_solver.h:751
int solveImpactsFixpointSingle() override
solve impact equations with single step fixed point scheme on velocity level
Definition: dynamic_system_solver.cc:465
void addElement(Element *element_)
Definition: dynamic_system_solver.cc:1139
fmatvec::Vec rFactorParent
relaxation parameters for contact equations
Definition: dynamic_system_solver.h:651
void checkConstraintsForTermination() override
validate force laws concerning given tolerances
Definition: dynamic_system_solver.cc:668
virtual void updateWRef(fmatvec::Mat &WParent, int j=0)
references to contact force direction matrix of dynamic system parent
Definition: dynamic_system.cc:807
fmatvec::VecInt decreaseLevels
decreasing relaxation factors is done in levels containing the number of contact iterations as condit...
Definition: dynamic_system_solver.h:781
virtual void updatelaInverseKinetics()
update inverse kinetics constraint forces
Definition: dynamic_system_solver.cc:1507
void setStopIfNoConvergence(bool flag, bool dropInfo=false)
Definition: dynamic_system_solver.h:401
Definition: dynamic_system_solver.h:58
Definition: environment.h:59
virtual void updater(int j=0)
update smooth link force law
Definition: dynamic_system_solver.cc:793
void dropContactMatrices()
Definition: dynamic_system_solver.cc:1193
void updatezdRef(fmatvec::Vec &ext)
references to differentiated external state
Definition: dynamic_system_solver.cc:1295
void initialize()
Initialize the system.
Definition: dynamic_system_solver.cc:88
virtual void updateG()
updates mass action matrix
Definition: dynamic_system_solver.cc:885
~DynamicSystemSolver() override
destructor
Definition: dynamic_system_solver.cc:80
bool numJac
flag if Jacobian for Newton scheme should be calculated numerically
Definition: dynamic_system_solver.h:776
fmatvec::Mat WParent[2]
contact force directions
Definition: dynamic_system_solver.h:631
void plot() override
plots time dependent data
Definition: dynamic_system.cc:332
class for tree-structured mechanical systems with recursive and flat memory mechanism
Definition: graph.h:36
InitStage
The stages of the initialization.
Definition: element.h:62
void setProjectionTolerance(double tol)
set tolerance for projection of generalized position
Definition: dynamic_system_solver.h:459
int(DynamicSystemSolver::* solveImpacts_)()
function pointer for election of prox-solver for impact equations on velocity level
Definition: dynamic_system_solver.h:287
Element * getElement(const std::string &name)
Definition: dynamic_system_solver.cc:1151
bool positionDriftCompensationNeeded(double gmax)
check if drift compensation on position level is needed
Definition: dynamic_system_solver.cc:1002
fmatvec::VecInt jsvParent
boolean evaluation of stopvector
Definition: dynamic_system_solver.h:705
void savela()
save contact forces for use as starting value in next time step
Definition: dynamic_system_solver.cc:1119
Definition: contact_kinematics.h:32
void projectGeneralizedPositions(int mode, bool fullUpdate=false)
drift projection for positions
Definition: dynamic_system_solver.cc:1028
fmatvec::SymMat LLMParent
Cholesky decomposition of mass matrix.
Definition: dynamic_system_solver.h:621
std::string name
name of element
Definition: element.h:249
static std::atomic< bool > exitRequest
boolean signal evaluation for end integration set by user
Definition: dynamic_system_solver.h:852
int limitGSize
TODO.
Definition: dynamic_system_solver.h:796
fmatvec::SymMat MParent
mass matrix
Definition: dynamic_system_solver.h:616
bool peds
TODO, flag for occuring impact and sticking in event driven solver.
Definition: dynamic_system_solver.h:801
fmatvec::Vec hParent[2]
smooth, smooth with respect to objects, smooth with respect to links right hand side
Definition: dynamic_system_solver.h:690
void writeStateTable(std::string fileName)
writes state table to a file
Definition: dynamic_system_solver.cc:1264
void constructor()
set plot feature default values
Definition: dynamic_system_solver.cc:1309
fmatvec::SqrMat G
mass action matrix
Definition: dynamic_system_solver.h:731
double dt
step size
Definition: dynamic_system_solver.h:596
void saveLa()
save contact impulses for use as starting value in next time step
Definition: dynamic_system_solver.cc:1129
bool integratorExitRequest
boolean signal evaluation for end integration set by program
Definition: dynamic_system_solver.h:847
fmatvec::Vec wbParent
TODO.
Definition: dynamic_system_solver.h:641
void addToGraph(Graph *graph, fmatvec::SqrMat &A, int i, std::vector< Element * > &objList)
adds list of objects to tree
Definition: dynamic_system_solver.cc:1401
virtual void updategRef(fmatvec::Vec &gParent)
references to relative distances of dynamic system parent
Definition: dynamic_system.cc:765
void updatewbRef(fmatvec::Vec &ref) override
references to TODO of dynamic system parent
Definition: dynamic_system_solver.h:541
fmatvec::Vec la
contact force parameters
Definition: dynamic_system.h:856
int maxIter
maximum number of contact iterations, high number of contact iterations for warnings,...
Definition: dynamic_system_solver.h:746
void getLinkStatus(fmatvec::VecInt &LinkStatusExt)
Definition: dynamic_system_solver.cc:986
Solver
solver for contact equations
Definition: dynamic_system_solver.h:71
MBSimEnvironment * getMBSimEnvironment()
Definition: dynamic_system_solver.cc:1622
fmatvec::Vec zParent
state
Definition: dynamic_system_solver.h:678
fmatvec::Vec laParent
contact force parameters
Definition: dynamic_system_solver.h:646
fmatvec::Vec resParent
residuum of contact equations
Definition: dynamic_system_solver.h:661
bool velocityDriftCompensationNeeded(double gdmax)
check if drift compensation on velocity level is needed
Definition: dynamic_system_solver.cc:1015
fmatvec::Vec svParent
stopvector (rootfunctions for event driven integration
Definition: dynamic_system_solver.h:700
fmatvec::SqrMat Jprox
JACOBIAN of contact equations for Newton scheme.
Definition: dynamic_system_solver.h:726
fmatvec::Mat VParent[2]
condensed contact force directions
Definition: dynamic_system_solver.h:636
void updatezRef(fmatvec::Vec &ext)
references to external state
Definition: dynamic_system_solver.cc:1283
void writez(std::string fileName, bool formatH5=true)
writes state to a file
Definition: dynamic_system_solver.cc:1242
void init(InitStage stage, const InitConfigSet &config) override
plots time series header
Definition: dynamic_system_solver.cc:104
int solveConstraintsRootFinding() override
solve contact equations with Newton scheme
Definition: dynamic_system_solver.cc:536
void decreaserFactors()
decrease relaxation factors if mass action matrix is not diagonal dominant
Definition: dynamic_system_solver.cc:980
void computeInitialCondition()
compute initial condition for links for event driven integrator
Definition: dynamic_system_solver.cc:836
bool READZ0
is a state read from a file
Definition: dynamic_system_solver.h:853
int solveImpactsRootFinding() override
solve impact equations with Newton scheme on velocity level
Definition: dynamic_system_solver.cc:603
void updategdRef(fmatvec::Vec &ref) override
references to relative velocities of dynamic system parent
Definition: dynamic_system_solver.h:535
virtual void updategdRef(fmatvec::Vec &gdParent)
references to relative velocities of dynamic system parent
Definition: dynamic_system.cc:772
fmatvec::Vec zdParent
differentiated state
Definition: dynamic_system_solver.h:683
Definition: dynamic_system_solver.h:410
namespace MBSim
Definition: bilateral_constraint.cc:29