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 
27 namespace MBSim {
28 
29  class Graph;
30  class Environment;
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  // install the MBSim signal handler
409  static void installSignalHandler();
410 
414  static void sigInterruptHandler(int);
415 
419  static void sigAbortHandler(int);
420 
421  static void sigSegfaultHandler(int);
422 
423  void checkExitRequest();
424 
425  // TODO just for testing
426  void setPartialEventDrivenSolver(bool peds_) { peds = peds_; }
427 
433  void writez(std::string fileName, bool formatH5=true);
434 
440  void writeStateTable(std::string fileName);
441 
446  void readz0(std::string fileName);
447 
448  void initializeUsingXML(xercesc::DOMElement *element) override;
449 
454  void setProjectionTolerance(double tol) { tolProj = tol; }
455 
460  void updatezRef(fmatvec::Vec &ext);
461 
466  void updatezdRef(fmatvec::Vec &ext);
467 
472  void setFlushEvery(unsigned int every) { flushEvery = every; }
473 
474  void setAlwaysConsiderContact(bool alwaysConsiderContact_) { alwaysConsiderContact = alwaysConsiderContact_; }
475 
476  void setInverseKinetics(bool inverseKinetics_) { inverseKinetics = inverseKinetics_; }
477  bool getInverseKinetics() const { return inverseKinetics; }
478 
479  void setInitialProjection(bool initialProjection_) { initialProjection = initialProjection_; }
480  bool getInitialProjection() const { return initialProjection; }
481 
482  void setDetermineEquilibriumState(bool determineEquilibriumState_) { determineEquilibriumState = determineEquilibriumState_; }
483  bool getDetermineEquilibriumState() const { return determineEquilibriumState; }
484 
485  void setUseConstraintSolverForSmoothMotion(bool useConstraintSolverForSmoothMotion_) { useConstraintSolverForSmoothMotion = useConstraintSolverForSmoothMotion_; }
486  bool getUseConstraintSolverForSmoothMotion() const { return useConstraintSolverForSmoothMotion; }
487 
488  void setUseConstraintSolverForPlot(bool useConstraintSolverForPlot_) { useConstraintSolverForPlot = useConstraintSolverForPlot_; }
489  bool getUseConstraintSolverForPlot() const { return useConstraintSolverForPlot; }
490 
491  fmatvec::Mat dhdq(int lb=0, int ub=0);
492  fmatvec::Mat dhdu(int lb=0, int ub=0);
493  fmatvec::Mat dhdx();
494  fmatvec::Vec dhdt();
495 
496  void setRootID(int ID) {rootID = ID;}
497  int getRootID() const {return rootID;}
498 
499  void resetUpToDate() override;
500 
501  bool getUpdateT() { return updT; }
502  bool getUpdateM() { return updM; }
503  bool getUpdateLLM() { return updLLM; }
504  bool getUpdateh(int j) { return updh[j]; }
505  bool getUpdater(int j) { return updr[j]; }
506  bool getUpdaterdt() { return updrdt; }
507  bool getUpdateW(int j) { return updW[j]; }
508  bool getUpdateV(int j) { return updV[j]; }
509  bool getUpdatewb() { return updwb; }
510  bool getUpdateg() { return updg; }
511  bool getUpdategd() { return updgd; }
512  bool getUpdatela() { return updla; }
513  bool getUpdateLa() { return updLa; }
514  bool getUpdatezd() { return updzd; }
515  bool getUpdatedq() { return upddq; }
516  bool getUpdatedu() { return upddu; }
517  bool getUpdatedx() { return upddx; }
518  void setUpdatela(bool updla_) { updla = updla_; }
519  void setUpdateLa(bool updLa_) { updLa = updLa_; }
520  void setUpdateG(bool updG_) { updG = updG_; }
521  void setUpdatebi(bool updbi_) { updbi = updbi_; }
522  void setUpdatebc(bool updbc_) { updbc = updbc_; }
523  void setUpdatezd(bool updzd_) { updzd = updzd_; }
524  void setUpdateW(bool updW_, int i=0) { updW[i] = updW_; }
525 
530  void updategRef(fmatvec::Vec &ref) override { Group::updategRef(ref); updg = true; }
531 
536  void updategdRef(fmatvec::Vec &ref) override { Group::updategdRef(ref); updgd = true; }
537 
542  void updatewbRef(fmatvec::Vec &ref) override { Group::updatewbRef(ref); updwb = true; }
543 
549  void updateWRef(fmatvec::Mat &ref, int i=0) override { Group::updateWRef(ref,i); updW[i] = true; }
550 
556  void updateVRef(fmatvec::Mat &ref, int i=0) override { Group::updateVRef(ref,i); updV[i] = true; }
557 
561  virtual void updatelaInverseKinetics();
562 
563  void updatedq() override;
564  void updatedu() override;
565  void updatedx() override;
566 
567  void updateStopVector() override;
568 
569  void updateInternalState();
570 
571  void plot() override;
572 
573  void addEnvironment(Environment* env);
574 
579  template<class Env>
580  Env* getEnvironment();
581 
585 
586  std::vector<StateTable>& getStateTable() { return tabz; }
587 
588  protected:
592  double t;
593 
597  double dt;
598 
602  int zSize;
603 
608 
613 
618 
623 
628 
633 
638 
643 
648 
653 
658 
663 
664  fmatvec::Vec curisParent, nextisParent;
665 
670 
675 
680 
685 
686  fmatvec::Vec dxParent, dqParent, duParent;
687 
692 
696  fmatvec::Vec rParent[2], rdtParent;
697 
702 
706  fmatvec::VecInt jsvParent;
707 
711  fmatvec::VecInt LinkStatusParent;
712 
717  fmatvec::VecInt LinkStatusRegParent;
718 
722  fmatvec::SparseMat Gs;
723 
728 
733 
738 
742  bool term;
743 
747  int maxIter, highIter, maxDampingSteps, iterc, iteri;
748 
752  double lmParm;
753 
757  Solver contactSolver, impactSolver;
758 
763 
768 
772  bool useOldla;
773 
777  bool numJac;
778 
782  fmatvec::VecInt decreaseLevels;
783 
787  fmatvec::VecInt checkTermLevels;
788 
793 
798 
802  bool peds;
803 
808  unsigned int flushEvery;
809 
814  unsigned int flushCount;
815 
819  double tolProj;
820 
824  fmatvec::Vec laInverseKineticsParent;
825  fmatvec::Mat bInverseKineticsParent;
826 
830  fmatvec::Mat WInverseKineticsParent;
831 
832  bool alwaysConsiderContact;
833  bool inverseKinetics;
834  bool initialProjection;
835  bool determineEquilibriumState;
836  bool useConstraintSolverForSmoothMotion;
837  bool useConstraintSolverForPlot;
838 
839  fmatvec::Vec corrParent;
840 
841  int rootID;
842 
843  double gTol, gdTol, gddTol, laTol, LaTol;
844 
845  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;
846 
847  bool solveDirectly;
848 
849  std::vector<StateTable> tabz;
850 
851  private:
855  void constructor();
856 
861 
865  static bool exitRequest;
866 
870  bool READZ0;
871 
880  void addToGraph(Graph* graph, fmatvec::SqrMat &A, int i, std::vector<Element*> &objList);
881 
882  bool truncateSimulationFiles;
883 
884  // Holds the dynamic systems before the "reorganize hierarchy" takes place.
885  // This is required since all elements of all other containers from DynamicSystem are readded to DynamicSystemSolver,
886  // except this container (which is a "pure" container = no calculation is done in DynamicSystem)
887  // However, we must hold this container until the dtor of DynamicSystemSolver is called to avoid the deallocation of other
888  // elements hold by DynamicSystem elements (especially (currently only) hdf5File)
889  std::vector<DynamicSystem*> dynamicsystemPreReorganize;
890 
891  double facSizeGs;
892 
893  std::vector<std::unique_ptr<Environment>> environments;
894  MBSimEnvironment *mbsimEnvironment = nullptr;
895  };
896 
897  template<class Env>
899  // get the Environment of type Env
900  auto &reqType=typeid(Env);
901  for(auto &e : environments)
902  if(reqType==typeid(*e))
903  return static_cast<Env*>(e.get());
904  auto newEnv=new Env;
905  addEnvironment(newEnv);
906  return newEnv;
907  }
908 
909 }
910 
911 #endif /* _DYNAMIC_SYSTEM_SOLVER_H_ */
bool useOldla
flag if contac force parameter of last time step should be used
Definition: dynamic_system_solver.h:772
Definition: dynamic_system_solver.h:33
void plot() override
plots time dependent data
Definition: dynamic_system_solver.cc:1585
int solveImpactsGaussSeidel() override
solve impact equations with Gauss-Seidel scheme on velocity level
Definition: dynamic_system_solver.cc:504
int(DynamicSystemSolver::* solveConstraints_)()
Definition: dynamic_system_solver.h:280
int solveConstraintsLinearEquations()
solution of contact equations with Cholesky decomposition
Definition: dynamic_system_solver.cc:863
fmatvec::Vec gParent
relative distances
Definition: dynamic_system_solver.h:669
int zSize
size of state vector
Definition: dynamic_system_solver.h:602
double t
time
Definition: dynamic_system_solver.h:592
bool checkGSize
boolean if force action matrix should be resized in each step
Definition: dynamic_system_solver.h:792
int solveImpactsLinearEquations()
solution of contact equations with Cholesky decomposition on velocity level
Definition: dynamic_system_solver.cc:868
fmatvec::Vec rParent[2]
nonsmooth right hand side
Definition: dynamic_system_solver.h:696
int solveConstraintsGaussSeidel() override
solve contact equations with Gauss-Seidel scheme
Definition: dynamic_system_solver.cc:484
void initLa()
load contact impulses for use as starting value
Definition: dynamic_system_solver.cc:1122
bool term
boolean to check for termination of contact equations solution
Definition: dynamic_system_solver.h:742
void readz0(std::string fileName)
reads state from a file
Definition: dynamic_system_solver.cc:1276
Env * getEnvironment()
Definition: dynamic_system_solver.h:898
bool dropContactInfo
flag if contact matrices for debugging should be dropped in no-convergence case
Definition: dynamic_system_solver.h:767
int solveConstraintsFixpointSingle() override
solve contact equations with single step fixed point scheme
Definition: dynamic_system_solver.cc:422
double tolProj
Tolerance for projection of generalized position.
Definition: dynamic_system_solver.h:819
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:1112
virtual void updateVRef(fmatvec::Mat &VParent, int j=0)
references to condensed contact force direction matrix of dynamic system parent
Definition: dynamic_system.cc:847
fmatvec::SparseMat Gs
sparse mass action matrix
Definition: dynamic_system_solver.h:722
fmatvec::VecInt checkTermLevels
TODO.
Definition: dynamic_system_solver.h:787
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:757
void updategRef(fmatvec::Vec &ref) override
references to relative distances of dynamic system parent
Definition: dynamic_system_solver.h:530
fmatvec::Vec bc
TODO.
Definition: dynamic_system_solver.h:737
bool stopIfNoConvergence
flag if the contact equations should be stopped if there is no convergence
Definition: dynamic_system_solver.h:762
virtual const fmatvec::Vec & shift()
update for event driven integrator for event
Definition: dynamic_system_solver.cc:1417
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:556
fmatvec::Mat TParent
matrix of linear relation between differentiated positions and velocities
Definition: dynamic_system_solver.h:627
fmatvec::Vec sParent
TODO.
Definition: dynamic_system_solver.h:657
fmatvec::VecInt LinkStatusRegParent
status vector of single valued links
Definition: dynamic_system_solver.h:717
Definition: environment.h:37
fmatvec::Vec zd
derivative of state vector
Definition: dynamic_system_solver.h:612
void getLinkStatusReg(fmatvec::VecInt &LinkStatusRegExt)
Definition: dynamic_system_solver.cc:982
void updateWRef(fmatvec::Mat &ref, int i=0) override
references to contact force direction matrix of dynamic system parent
Definition: dynamic_system_solver.h:549
fmatvec::Vec gdParent
relative velocities
Definition: dynamic_system_solver.h:674
void projectGeneralizedVelocities(int mode)
drift projection for positions
Definition: dynamic_system_solver.cc:1069
fmatvec::VecInt LinkStatusParent
status vector of set valued links with piecewise link equation (which piece is valid)
Definition: dynamic_system_solver.h:711
virtual void updatewbRef(fmatvec::Vec &wbParent)
references to TODO of dynamic system parent
Definition: dynamic_system.cc:819
group ingredients do not depend on each other
Definition: group.h:35
unsigned int flushCount
counts plot-calls until files to be flushed TODO
Definition: dynamic_system_solver.h:814
void checkImpactsForTermination() override
validate force laws concerning given tolerances on velocity level
Definition: dynamic_system_solver.cc:667
std::string getSolverInfo()
Definition: dynamic_system_solver.cc:1166
fmatvec::Vec z
state vector
Definition: dynamic_system_solver.h:607
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:1211
double lmParm
Levenberg-Marquard parameter.
Definition: dynamic_system_solver.h:752
int solveImpactsFixpointSingle() override
solve impact equations with single step fixed point scheme on velocity level
Definition: dynamic_system_solver.cc:453
void addElement(Element *element_)
Definition: dynamic_system_solver.cc:1127
fmatvec::Vec rFactorParent
relaxation parameters for contact equations
Definition: dynamic_system_solver.h:652
void checkConstraintsForTermination() override
validate force laws concerning given tolerances
Definition: dynamic_system_solver.cc:656
virtual void updateWRef(fmatvec::Mat &WParent, int j=0)
references to contact force direction matrix of dynamic system parent
Definition: dynamic_system.cc:826
fmatvec::VecInt decreaseLevels
decreasing relaxation factors is done in levels containing the number of contact iterations as condit...
Definition: dynamic_system_solver.h:782
virtual void updatelaInverseKinetics()
update inverse kinetics constraint forces
Definition: dynamic_system_solver.cc:1510
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:781
void dropContactMatrices()
Definition: dynamic_system_solver.cc:1181
void updatezdRef(fmatvec::Vec &ext)
references to differentiated external state
Definition: dynamic_system_solver.cc:1296
void initialize()
Initialize the system.
Definition: dynamic_system_solver.cc:88
virtual void updateG()
updates mass action matrix
Definition: dynamic_system_solver.cc:873
~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:777
unsigned int flushEvery
flushes all hdf5-files every x-times the plot-routine is called TODO
Definition: dynamic_system_solver.h:808
fmatvec::Mat WParent[2]
contact force directions
Definition: dynamic_system_solver.h:632
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:454
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:1139
bool positionDriftCompensationNeeded(double gmax)
check if drift compensation on position level is needed
Definition: dynamic_system_solver.cc:990
fmatvec::VecInt jsvParent
boolean evaluation of stopvector
Definition: dynamic_system_solver.h:706
void savela()
save contact forces for use as starting value in next time step
Definition: dynamic_system_solver.cc:1107
Definition: contact_kinematics.h:32
void projectGeneralizedPositions(int mode, bool fullUpdate=false)
drift projection for positions
Definition: dynamic_system_solver.cc:1016
fmatvec::SymMat LLMParent
Cholesky decomposition of mass matrix.
Definition: dynamic_system_solver.h:622
std::string name
name of element
Definition: element.h:249
int limitGSize
TODO.
Definition: dynamic_system_solver.h:797
static bool exitRequest
boolean signal evaluation for end integration set by user
Definition: dynamic_system_solver.h:865
fmatvec::SymMat MParent
mass matrix
Definition: dynamic_system_solver.h:617
bool peds
TODO, flag for occuring impact and sticking in event driven solver.
Definition: dynamic_system_solver.h:802
fmatvec::Vec hParent[2]
smooth, smooth with respect to objects, smooth with respect to links right hand side
Definition: dynamic_system_solver.h:691
void writeStateTable(std::string fileName)
writes state table to a file
Definition: dynamic_system_solver.cc:1265
void constructor()
set plot feature default values
Definition: dynamic_system_solver.cc:1310
fmatvec::SqrMat G
mass action matrix
Definition: dynamic_system_solver.h:732
double dt
step size
Definition: dynamic_system_solver.h:597
void saveLa()
save contact impulses for use as starting value in next time step
Definition: dynamic_system_solver.cc:1117
bool integratorExitRequest
boolean signal evaluation for end integration set by program
Definition: dynamic_system_solver.h:860
fmatvec::Vec wbParent
TODO.
Definition: dynamic_system_solver.h:642
void addToGraph(Graph *graph, fmatvec::SqrMat &A, int i, std::vector< Element * > &objList)
adds list of objects to tree
Definition: dynamic_system_solver.cc:1404
virtual void updategRef(fmatvec::Vec &gParent)
references to relative distances of dynamic system parent
Definition: dynamic_system.cc:784
void updatewbRef(fmatvec::Vec &ref) override
references to TODO of dynamic system parent
Definition: dynamic_system_solver.h:542
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:747
void getLinkStatus(fmatvec::VecInt &LinkStatusExt)
Definition: dynamic_system_solver.cc:974
Solver
solver for contact equations
Definition: dynamic_system_solver.h:71
MBSimEnvironment * getMBSimEnvironment()
Definition: dynamic_system_solver.cc:1613
fmatvec::Vec zParent
state
Definition: dynamic_system_solver.h:679
fmatvec::Vec laParent
contact force parameters
Definition: dynamic_system_solver.h:647
fmatvec::Vec resParent
residuum of contact equations
Definition: dynamic_system_solver.h:662
void setFlushEvery(unsigned int every)
set the number of plot-routine-calls after which all hdf5-files will be flushed
Definition: dynamic_system_solver.h:472
bool velocityDriftCompensationNeeded(double gdmax)
check if drift compensation on velocity level is needed
Definition: dynamic_system_solver.cc:1003
fmatvec::Vec svParent
stopvector (rootfunctions for event driven integration
Definition: dynamic_system_solver.h:701
fmatvec::SqrMat Jprox
JACOBIAN of contact equations for Newton scheme.
Definition: dynamic_system_solver.h:727
fmatvec::Mat VParent[2]
condensed contact force directions
Definition: dynamic_system_solver.h:637
void updatezRef(fmatvec::Vec &ext)
references to external state
Definition: dynamic_system_solver.cc:1284
void writez(std::string fileName, bool formatH5=true)
writes state to a file
Definition: dynamic_system_solver.cc:1243
static void sigAbortHandler(int)
handler for abort signals
Definition: dynamic_system_solver.cc:1216
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:524
void decreaserFactors()
decrease relaxation factors if mass action matrix is not diagonal dominant
Definition: dynamic_system_solver.cc:968
void computeInitialCondition()
compute initial condition for links for event driven integrator
Definition: dynamic_system_solver.cc:824
bool READZ0
is a state read from a file
Definition: dynamic_system_solver.h:870
int solveImpactsRootFinding() override
solve impact equations with Newton scheme on velocity level
Definition: dynamic_system_solver.cc:591
void updategdRef(fmatvec::Vec &ref) override
references to relative velocities of dynamic system parent
Definition: dynamic_system_solver.h:536
virtual void updategdRef(fmatvec::Vec &gdParent)
references to relative velocities of dynamic system parent
Definition: dynamic_system.cc:791
fmatvec::Vec zdParent
differentiated state
Definition: dynamic_system_solver.h:684
namespace MBSim
Definition: eigenanalyzer.cc:47