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 
382  double evalKineticEnergy() { return 0.5*u.T()*M*u; }
383 
388  double evalPotentialEnergy();
389 
394  void addElement(Element *element_);
395 
401  Element* getElement(const std::string &name);
402 
406  std::string getSolverInfo();
407 
412  void setStopIfNoConvergence(bool flag, bool dropInfo = false) { stopIfNoConvergence = flag; dropContactInfo=dropInfo; }
413 
417  void dropContactMatrices();
418 
419  // install the MBSim signal handler
420  static void installSignalHandler();
421 
425  static void sigInterruptHandler(int);
426 
430  static void sigAbortHandler(int);
431 
432  static void sigSegfaultHandler(int);
433 
434  void checkExitRequest();
435 
436  // TODO just for testing
437  void setPartialEventDrivenSolver(bool peds_) { peds = peds_; }
438 
444  void writez(std::string fileName, bool formatH5=true);
445 
451  void writeStateTable(std::string fileName);
452 
457  void readz0(std::string fileName);
458 
459  void initializeUsingXML(xercesc::DOMElement *element) override;
460 
465  void setProjectionTolerance(double tol) { tolProj = tol; }
466 
471  void updatezRef(fmatvec::Vec &ext);
472 
477  void updatezdRef(fmatvec::Vec &ext);
478 
483  void setFlushEvery(unsigned int every) { flushEvery = every; }
484 
485  void setAlwaysConsiderContact(bool alwaysConsiderContact_) { alwaysConsiderContact = alwaysConsiderContact_; }
486 
487  void setInverseKinetics(bool inverseKinetics_) { inverseKinetics = inverseKinetics_; }
488  bool getInverseKinetics() const { return inverseKinetics; }
489 
490  void setInitialProjection(bool initialProjection_) { initialProjection = initialProjection_; }
491  bool getInitialProjection() const { return initialProjection; }
492 
493  void setDetermineEquilibriumState(bool determineEquilibriumState_) { determineEquilibriumState = determineEquilibriumState_; }
494  bool getDetermineEquilibriumState() const { return determineEquilibriumState; }
495 
496  void setUseConstraintSolverForSmoothMotion(bool useConstraintSolverForSmoothMotion_) { useConstraintSolverForSmoothMotion = useConstraintSolverForSmoothMotion_; }
497  bool getUseConstraintSolverForSmoothMotion() const { return useConstraintSolverForSmoothMotion; }
498 
499  void setUseConstraintSolverForPlot(bool useConstraintSolverForPlot_) { useConstraintSolverForPlot = useConstraintSolverForPlot_; }
500  bool getUseConstraintSolverForPlot() const { return useConstraintSolverForPlot; }
501 
502  fmatvec::Mat dhdq(int lb=0, int ub=0);
503  fmatvec::Mat dhdu(int lb=0, int ub=0);
504  fmatvec::Mat dhdx();
505  fmatvec::Vec dhdt();
506 
507  void setRootID(int ID) {rootID = ID;}
508  int getRootID() const {return rootID;}
509 
510  void resetUpToDate() override;
511 
512  bool getUpdateT() { return updT; }
513  bool getUpdateM() { return updM; }
514  bool getUpdateLLM() { return updLLM; }
515  bool getUpdateh(int j) { return updh[j]; }
516  bool getUpdater(int j) { return updr[j]; }
517  bool getUpdaterdt() { return updrdt; }
518  bool getUpdateW(int j) { return updW[j]; }
519  bool getUpdateV(int j) { return updV[j]; }
520  bool getUpdatewb() { return updwb; }
521  bool getUpdateg() { return updg; }
522  bool getUpdategd() { return updgd; }
523  bool getUpdatela() { return updla; }
524  bool getUpdateLa() { return updLa; }
525  bool getUpdatezd() { return updzd; }
526  bool getUpdatedq() { return upddq; }
527  bool getUpdatedu() { return upddu; }
528  bool getUpdatedx() { return upddx; }
529  void setUpdatela(bool updla_) { updla = updla_; }
530  void setUpdateLa(bool updLa_) { updLa = updLa_; }
531  void setUpdateG(bool updG_) { updG = updG_; }
532  void setUpdatebi(bool updbi_) { updbi = updbi_; }
533  void setUpdatebc(bool updbc_) { updbc = updbc_; }
534  void setUpdatezd(bool updzd_) { updzd = updzd_; }
535  void setUpdateW(bool updW_, int i=0) { updW[i] = updW_; }
536 
541  void updategRef(fmatvec::Vec &ref) override { Group::updategRef(ref); updg = true; }
542 
547  void updategdRef(fmatvec::Vec &ref) override { Group::updategdRef(ref); updgd = true; }
548 
553  void updatewbRef(fmatvec::Vec &ref) override { Group::updatewbRef(ref); updwb = true; }
554 
560  void updateWRef(fmatvec::Mat &ref, int i=0) override { Group::updateWRef(ref,i); updW[i] = true; }
561 
567  void updateVRef(fmatvec::Mat &ref, int i=0) override { Group::updateVRef(ref,i); updV[i] = true; }
568 
572  virtual void updatelaInverseKinetics();
573 
574  void updatedq() override;
575  void updatedu() override;
576  void updatedx() override;
577 
578  void updateStopVector() override;
579 
580  void plot() override;
581 
582  void addEnvironment(Environment* env);
583 
588  template<class Env>
589  Env* getEnvironment();
590 
594 
595  std::vector<StateTable>& getStateTable() { return tabz; }
596 
597  protected:
601  double t;
602 
606  double dt;
607 
611  int zSize;
612 
617 
622 
627 
632 
637 
642 
647 
652 
657 
662 
667 
672 
677 
682 
687 
692 
693  fmatvec::Vec dxParent, dqParent, duParent;
694 
699 
703  fmatvec::Vec rParent[2], rdtParent;
704 
709 
713  fmatvec::VecInt jsvParent;
714 
718  fmatvec::VecInt LinkStatusParent;
719 
724  fmatvec::VecInt LinkStatusRegParent;
725 
729  fmatvec::SparseMat Gs;
730 
735 
740 
745 
749  bool term;
750 
754  int maxIter, highIter, maxDampingSteps, iterc, iteri;
755 
759  double lmParm;
760 
764  Solver contactSolver, impactSolver;
765 
770 
775 
779  bool useOldla;
780 
784  bool numJac;
785 
789  fmatvec::VecInt decreaseLevels;
790 
794  fmatvec::VecInt checkTermLevels;
795 
800 
805 
809  bool peds;
810 
815  unsigned int flushEvery;
816 
821  unsigned int flushCount;
822 
826  double tolProj;
827 
831  fmatvec::Vec laInverseKineticsParent;
832  fmatvec::Mat bInverseKineticsParent;
833 
837  fmatvec::Mat WInverseKineticsParent;
838 
839  bool alwaysConsiderContact;
840  bool inverseKinetics;
841  bool initialProjection;
842  bool determineEquilibriumState;
843  bool useConstraintSolverForSmoothMotion;
844  bool useConstraintSolverForPlot;
845 
846  fmatvec::Vec corrParent;
847 
848  int rootID;
849 
850  double gTol, gdTol, gddTol, laTol, LaTol;
851 
852  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;
853 
854  bool solveDirectly;
855 
856  std::vector<StateTable> tabz;
857 
858  private:
862  void constructor();
863 
868 
872  static bool exitRequest;
873 
877  bool READZ0;
878 
887  void addToGraph(Graph* graph, fmatvec::SqrMat &A, int i, std::vector<Element*> &objList);
888 
889  bool truncateSimulationFiles;
890 
891  // Holds the dynamic systems before the "reorganize hierarchy" takes place.
892  // This is required since all elements of all other containers from DynamicSystem are readded to DynamicSystemSolver,
893  // except this container (which is a "pure" container = no calculation is done in DynamicSystem)
894  // However, we must hold this container until the dtor of DynamicSystemSolver is called to avoid the deallocation of other
895  // elements hold by DynamicSystem elements (especially (currently only) hdf5File)
896  std::vector<DynamicSystem*> dynamicsystemPreReorganize;
897 
898  double facSizeGs;
899 
900  std::vector<std::unique_ptr<Environment>> environments;
901  MBSimEnvironment *mbsimEnvironment = nullptr;
902  };
903 
904  template<class Env>
906  // get the Environment of type Env
907  auto &reqType=typeid(Env);
908  for(auto &e : environments)
909  if(reqType==typeid(*e))
910  return static_cast<Env*>(e.get());
911  auto newEnv=new Env;
912  addEnvironment(newEnv);
913  return newEnv;
914  }
915 
916 }
917 
918 #endif /* _DYNAMIC_SYSTEM_SOLVER_H_ */
bool useOldla
flag if contac force parameter of last time step should be used
Definition: dynamic_system_solver.h:779
Definition: dynamic_system_solver.h:33
void plot() override
plots time dependent data
Definition: dynamic_system_solver.cc:1587
int solveImpactsGaussSeidel() override
solve impact equations with Gauss-Seidel scheme on velocity level
Definition: dynamic_system_solver.cc:499
int(DynamicSystemSolver::* solveConstraints_)()
Definition: dynamic_system_solver.h:280
int solveConstraintsLinearEquations()
solution of contact equations with Cholesky decomposition
Definition: dynamic_system_solver.cc:858
fmatvec::Vec gParent
relative distances
Definition: dynamic_system_solver.h:676
int zSize
size of state vector
Definition: dynamic_system_solver.h:611
double t
time
Definition: dynamic_system_solver.h:601
bool checkGSize
boolean if force action matrix should be resized in each step
Definition: dynamic_system_solver.h:799
int solveImpactsLinearEquations()
solution of contact equations with Cholesky decomposition on velocity level
Definition: dynamic_system_solver.cc:863
fmatvec::Vec rParent[2]
nonsmooth right hand side
Definition: dynamic_system_solver.h:703
int solveConstraintsGaussSeidel() override
solve contact equations with Gauss-Seidel scheme
Definition: dynamic_system_solver.cc:479
void initLa()
load contact impulses for use as starting value
Definition: dynamic_system_solver.cc:1117
bool term
boolean to check for termination of contact equations solution
Definition: dynamic_system_solver.h:749
void readz0(std::string fileName)
reads state from a file
Definition: dynamic_system_solver.cc:1282
Env * getEnvironment()
Definition: dynamic_system_solver.h:905
bool dropContactInfo
flag if contact matrices for debugging should be dropped in no-convergence case
Definition: dynamic_system_solver.h:774
int solveConstraintsFixpointSingle() override
solve contact equations with single step fixed point scheme
Definition: dynamic_system_solver.cc:417
double tolProj
Tolerance for projection of generalized position.
Definition: dynamic_system_solver.h:826
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:1107
virtual void updateVRef(fmatvec::Mat &VParent, int j=0)
references to condensed contact force direction matrix of dynamic system parent
Definition: dynamic_system.cc:810
fmatvec::SparseMat Gs
sparse mass action matrix
Definition: dynamic_system_solver.h:729
fmatvec::VecInt checkTermLevels
TODO.
Definition: dynamic_system_solver.h:794
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:764
void updategRef(fmatvec::Vec &ref) override
references to relative distances of dynamic system parent
Definition: dynamic_system_solver.h:541
fmatvec::Vec bc
TODO.
Definition: dynamic_system_solver.h:744
bool stopIfNoConvergence
flag if the contact equations should be stopped if there is no convergence
Definition: dynamic_system_solver.h:769
virtual const fmatvec::Vec & shift()
update for event driven integrator for event
Definition: dynamic_system_solver.cc:1423
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:567
fmatvec::Mat TParent
matrix of linear relation between differentiated positions and velocities
Definition: dynamic_system_solver.h:636
fmatvec::Vec sParent
TODO.
Definition: dynamic_system_solver.h:666
fmatvec::Vec u
velocities, differentiated velocities, initial velocities
Definition: dynamic_system.h:812
fmatvec::VecInt LinkStatusRegParent
status vector of single valued links
Definition: dynamic_system_solver.h:724
Definition: environment.h:37
fmatvec::Vec zd
derivative of state vector
Definition: dynamic_system_solver.h:621
void getLinkStatusReg(fmatvec::VecInt &LinkStatusRegExt)
Definition: dynamic_system_solver.cc:977
void updateWRef(fmatvec::Mat &ref, int i=0) override
references to contact force direction matrix of dynamic system parent
Definition: dynamic_system_solver.h:560
fmatvec::Vec gdParent
relative velocities
Definition: dynamic_system_solver.h:681
void projectGeneralizedVelocities(int mode)
drift projection for positions
Definition: dynamic_system_solver.cc:1064
fmatvec::VecInt LinkStatusParent
status vector of set valued links with piecewise link equation (which piece is valid)
Definition: dynamic_system_solver.h:718
virtual void updatewbRef(fmatvec::Vec &wbParent)
references to TODO of dynamic system parent
Definition: dynamic_system.cc:782
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:821
void checkImpactsForTermination() override
validate force laws concerning given tolerances on velocity level
Definition: dynamic_system_solver.cc:662
std::string getSolverInfo()
Definition: dynamic_system_solver.cc:1174
fmatvec::Vec z
state vector
Definition: dynamic_system_solver.h:616
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:1219
double lmParm
Levenberg-Marquard parameter.
Definition: dynamic_system_solver.h:759
int solveImpactsFixpointSingle() override
solve impact equations with single step fixed point scheme on velocity level
Definition: dynamic_system_solver.cc:448
void addElement(Element *element_)
Definition: dynamic_system_solver.cc:1135
fmatvec::Vec rFactorParent
relaxation parameters for contact equations
Definition: dynamic_system_solver.h:661
void checkConstraintsForTermination() override
validate force laws concerning given tolerances
Definition: dynamic_system_solver.cc:651
virtual void updateWRef(fmatvec::Mat &WParent, int j=0)
references to contact force direction matrix of dynamic system parent
Definition: dynamic_system.cc:789
fmatvec::VecInt decreaseLevels
decreasing relaxation factors is done in levels containing the number of contact iterations as condit...
Definition: dynamic_system_solver.h:789
virtual void updatelaInverseKinetics()
update inverse kinetics constraint forces
Definition: dynamic_system_solver.cc:1516
void setStopIfNoConvergence(bool flag, bool dropInfo=false)
Definition: dynamic_system_solver.h:412
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:776
void dropContactMatrices()
Definition: dynamic_system_solver.cc:1189
void updatezdRef(fmatvec::Vec &ext)
references to differentiated external state
Definition: dynamic_system_solver.cc:1302
void initialize()
Initialize the system.
Definition: dynamic_system_solver.cc:88
virtual void updateG()
updates mass action matrix
Definition: dynamic_system_solver.cc:868
~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:784
unsigned int flushEvery
flushes all hdf5-files every x-times the plot-routine is called TODO
Definition: dynamic_system_solver.h:815
fmatvec::Mat WParent[2]
contact force directions
Definition: dynamic_system_solver.h:641
void plot() override
plots time dependent data
Definition: dynamic_system.cc:336
double evalPotentialEnergy()
compute potential energy of entire dynamic system \tofo change? TODO
Definition: dynamic_system_solver.cc:1122
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:465
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:1147
bool positionDriftCompensationNeeded(double gmax)
check if drift compensation on position level is needed
Definition: dynamic_system_solver.cc:985
fmatvec::VecInt jsvParent
boolean evaluation of stopvector
Definition: dynamic_system_solver.h:713
void savela()
save contact forces for use as starting value in next time step
Definition: dynamic_system_solver.cc:1102
Definition: planar_contour.h:30
void projectGeneralizedPositions(int mode, bool fullUpdate=false)
drift projection for positions
Definition: dynamic_system_solver.cc:1011
fmatvec::SymMat LLMParent
Cholesky decomposition of mass matrix.
Definition: dynamic_system_solver.h:631
std::string name
name of element
Definition: element.h:235
int limitGSize
TODO.
Definition: dynamic_system_solver.h:804
static bool exitRequest
boolean signal evaluation for end integration set by user
Definition: dynamic_system_solver.h:872
fmatvec::SymMat MParent
mass matrix
Definition: dynamic_system_solver.h:626
bool peds
TODO, flag for occuring impact and sticking in event driven solver.
Definition: dynamic_system_solver.h:809
fmatvec::Vec hParent[2]
smooth, smooth with respect to objects, smooth with respect to links right hand side
Definition: dynamic_system_solver.h:698
void writeStateTable(std::string fileName)
writes state table to a file
Definition: dynamic_system_solver.cc:1271
void constructor()
set plot feature default values
Definition: dynamic_system_solver.cc:1316
fmatvec::SqrMat G
mass action matrix
Definition: dynamic_system_solver.h:739
double dt
step size
Definition: dynamic_system_solver.h:606
void saveLa()
save contact impulses for use as starting value in next time step
Definition: dynamic_system_solver.cc:1112
bool integratorExitRequest
boolean signal evaluation for end integration set by program
Definition: dynamic_system_solver.h:867
fmatvec::Vec wbParent
TODO.
Definition: dynamic_system_solver.h:651
void addToGraph(Graph *graph, fmatvec::SqrMat &A, int i, std::vector< Element * > &objList)
adds list of objects to tree
Definition: dynamic_system_solver.cc:1410
virtual void updategRef(fmatvec::Vec &gParent)
references to relative distances of dynamic system parent
Definition: dynamic_system.cc:747
void updatewbRef(fmatvec::Vec &ref) override
references to TODO of dynamic system parent
Definition: dynamic_system_solver.h:553
fmatvec::Vec la
contact force parameters
Definition: dynamic_system.h:832
int maxIter
maximum number of contact iterations, high number of contact iterations for warnings,...
Definition: dynamic_system_solver.h:754
void getLinkStatus(fmatvec::VecInt &LinkStatusExt)
Definition: dynamic_system_solver.cc:969
Solver
solver for contact equations
Definition: dynamic_system_solver.h:71
MBSimEnvironment * getMBSimEnvironment()
Definition: dynamic_system_solver.cc:1615
fmatvec::Vec zParent
state
Definition: dynamic_system_solver.h:686
fmatvec::Vec laParent
contact force parameters
Definition: dynamic_system_solver.h:656
fmatvec::Vec resParent
residuum of contact equations
Definition: dynamic_system_solver.h:671
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:483
bool velocityDriftCompensationNeeded(double gdmax)
check if drift compensation on velocity level is needed
Definition: dynamic_system_solver.cc:998
fmatvec::Vec svParent
stopvector (rootfunctions for event driven integration
Definition: dynamic_system_solver.h:708
fmatvec::SqrMat Jprox
JACOBIAN of contact equations for Newton scheme.
Definition: dynamic_system_solver.h:734
fmatvec::Mat VParent[2]
condensed contact force directions
Definition: dynamic_system_solver.h:646
void updatezRef(fmatvec::Vec &ext)
references to external state
Definition: dynamic_system_solver.cc:1290
void writez(std::string fileName, bool formatH5=true)
writes state to a file
Definition: dynamic_system_solver.cc:1251
static void sigAbortHandler(int)
handler for abort signals
Definition: dynamic_system_solver.cc:1224
fmatvec::SymMat M
mass matrix
Definition: dynamic_system.h:797
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:519
void decreaserFactors()
decrease relaxation factors if mass action matrix is not diagonal dominant
Definition: dynamic_system_solver.cc:963
void computeInitialCondition()
compute initial condition for links for event driven integrator
Definition: dynamic_system_solver.cc:819
bool READZ0
is a state read from a file
Definition: dynamic_system_solver.h:877
int solveImpactsRootFinding() override
solve impact equations with Newton scheme on velocity level
Definition: dynamic_system_solver.cc:586
void updategdRef(fmatvec::Vec &ref) override
references to relative velocities of dynamic system parent
Definition: dynamic_system_solver.h:547
virtual void updategdRef(fmatvec::Vec &gdParent)
references to relative velocities of dynamic system parent
Definition: dynamic_system.cc:754
fmatvec::Vec zdParent
differentiated state
Definition: dynamic_system_solver.h:691
double evalKineticEnergy()
compute kinetic energy of entire dynamic system
Definition: dynamic_system_solver.h:382
namespace MBSim
Definition: eigenanalyzer.cc:47