23 #include "mbsim/element.h"
24 #include "mbsim/mbsim_event.h"
32 extern const PlotFeatureEnum generalizedRelativePosition, generalizedRelativeVelocity, generalizedForce;
56 virtual void calcSize() { }
57 int getGeneralizedRelativePositionSize() {
if(updSize) calcSize();
return ng; }
58 int getGeneralizedRelativeVelocitySize() {
if(updSize) calcSize();
return ngd; }
59 int getGeneralizedForceSize() {
if(updSize) calcSize();
return nla; }
61 virtual void updateg() { }
62 virtual void updategd() { }
63 virtual void updatewb() { }
64 virtual void updateW(
int i=0) { }
65 virtual void updateV(
int i=0) { }
66 virtual void updateh(
int i=0) { }
67 virtual void updateStopVector() { }
68 virtual void updateStopVectorParameters() { }
69 virtual void updateLinkStatus() { }
70 virtual void updateLinkStatusReg() { }
71 virtual void updateJacobians(
int j=0) { }
72 virtual void updateb() { }
74 virtual void updatedx();
75 virtual void updatexd() { }
76 virtual void calcxSize() {
xSize = 0; }
79 virtual void setxInd(
int xInd_) { xInd = xInd_; };
80 virtual int getxSize()
const {
return xSize; }
85 void init(
InitStage stage,
const InitConfigSet &config)
override;
90 virtual void setbInd(
int bInd_) { bInd = bInd_; };
165 virtual void updatejsvRef(
const fmatvec::VecInt &jsvParent);
290 virtual void jacobianImpacts() { throwError(
"(Link::jacobianImpacts): Not implemented."); }
295 virtual void updaterFactors() { throwError(
"(Link::updaterFactors): Not implemented."); }
320 virtual void setGeneralizedForceTolerance(
double tol) { laTol = tol; }
321 virtual void setGeneralizedImpulseTolerance(
double tol) { LaTol = tol; }
322 virtual void setGeneralizedRelativePositionTolerance(
double tol) {
gTol = tol; }
323 virtual void setGeneralizedRelativeVelocityTolerance(
double tol) { gdTol = tol; }
324 virtual void setGeneralizedRelativeAccelerationTolerance(
double tol) { gddTol = tol; }
325 virtual void setGeneralizedRelativePositionCorrectionValue(
double corr) {
gCorr = corr; }
326 virtual void setGeneralizedRelativeVelocityCorrectionValue(
double corr) { gdCorr = corr; }
327 virtual void setrMax(
double rMax_) {
rMax = rMax_; }
328 virtual void setLinkStatusInd(
int LinkStatusInd_) { LinkStatusInd = LinkStatusInd_; };
329 virtual void setLinkStatusRegInd(
int LinkStatusRegInd_) { LinkStatusRegInd = LinkStatusRegInd_; };
330 virtual void setlaInd(
int laInd_) { laInd = laInd_;Ila=fmatvec::RangeV(laInd,laInd+
laSize-1); }
331 virtual void setgInd(
int gInd_) { gInd = gInd_;
Ig=fmatvec::RangeV(gInd,gInd+
gSize-1); }
332 virtual void setgdInd(
int gdInd_) { gdInd = gdInd_; }
333 virtual void setrFactorInd(
int rFactorInd_) { rFactorInd = rFactorInd_; }
348 virtual void updatecorr(
int j) { corr.init(0); }
350 virtual void calccorrSize(
int j) { corrSize = 0; }
351 virtual void setcorrInd(
int corrInd_) { corrInd = corrInd_; }
352 virtual void checkRoot() { }
357 virtual void setsvInd(
int svInd_) { svInd = svInd_; };
358 int getsvSize()
const {
return svSize; }
370 int getlaInd()
const {
return laInd; }
371 int getlaSize()
const {
return laSize; }
372 int getbSize()
const {
return bSize; }
381 int getgdInd()
const {
return gdInd; }
382 int getgSize()
const {
return gSize; }
383 int getgdSize()
const {
return gdSize; }
387 const fmatvec::VecInt& getrFactorUnsure()
const {
return rFactorUnsure; }
389 void resetUpToDate()
override { updrrel =
true; updvrel =
true; updla =
true; }
391 virtual void updateGeneralizedPositions() { updrrel =
false; }
392 virtual void updateGeneralizedVelocities() { updvrel =
false; }
393 virtual void updateGeneralizedForces() { updla =
false; }
395 const fmatvec::VecV& evalGeneralizedRelativePosition() {
if(updrrel) updateGeneralizedPositions();
return rrel; }
396 const fmatvec::VecV& evalGeneralizedRelativeVelocity() {
if(updvrel) updateGeneralizedVelocities();
return vrel; }
397 const fmatvec::VecV& evalGeneralizedForce() {
if(updla) updateGeneralizedForces();
return lambda; }
399 fmatvec::VecV& getGeneralizedRelativePosition(
bool check=
true) { assert((not check) or (not updrrel));
return rrel; }
400 fmatvec::VecV& getGeneralizedRelativeVelocity(
bool check=
true) { assert((not check) or (not updvrel));
return vrel; }
401 fmatvec::VecV& getGeneralizedForce(
bool check=
true) { assert((not check) or (not updla));
return lambda; }
429 int getcorrSize()
const {
return corrSize; }
431 bool getUpdaterrel()
const {
return updrrel; }
528 fmatvec::RangeV
Ig, Ila;
533 double gTol, gdTol, gddTol, laTol, LaTol;
573 std::vector<fmatvec::Mat>
W[2];
578 std::vector<fmatvec::Mat>
V[2];
583 std::vector<fmatvec::Vec>
h[2];
588 std::vector<fmatvec::Mat>
dhdq;
589 std::vector<fmatvec::Mat> dhdu;
590 std::vector<fmatvec::Vec> dhdt;
595 std::vector<fmatvec::Vec>
r[2];
607 int corrSize, corrInd;
610 fmatvec::VecV rrel, vrel, lambda;
612 bool updSize, updrrel, updvrel, updla;
virtual void updateVRef(const fmatvec::Mat &ref, int i=0)=0
references to condensed contact force direction matrix of dynamic system parent
virtual void updateWRef(const fmatvec::Mat &ref, int i=0)=0
references to contact force direction matrix of dynamic system parent
fmatvec::Vec x
order one parameters
Definition: link.h:439
std::vector< fmatvec::Mat > V[2]
reduced force direction matrix for nonsmooth right hand side
Definition: link.h:578
void savela()
saves contact forces for use as starting value in next time step
Definition: link.cc:180
fmatvec::Vec x0
order one initial value
Definition: link.h:451
void decreaserFactors()
decrease rfactor if mass action matrix is not diagonal dominant (cf. Foerg: Dissertation, page 80 et seq.)
Definition: link.cc:202
virtual bool isSetValued() const
asks the link if it contains force laws that contribute to the lagrange multiplier and is therefore s...
Definition: link.h:225
double rMax
maximum r-factor
Definition: link.h:563
fmatvec::Vec g
relative position, relative velocity, contact force and impact parameters
Definition: link.h:498
general link to one or more objects
Definition: link.h:48
virtual void updatejsvRef(const fmatvec::VecInt &jsvParent)
references to stopvector evaluation of dynamic system parent (root detection with corresponding bool ...
Definition: link.cc:116
fmatvec::VecInt LinkStatusReg
status of link
Definition: link.h:488
virtual void checkImpactsForTermination()
verify underlying force laws on velocity level concerning given tolerances
Definition: link.h:300
fmatvec::Mat b
TODO.
Definition: link.h:605
virtual double evalPotentialEnergy()
compute potential energy
Definition: link.h:318
int laSize
size and local index of contact force parameters
Definition: link.h:518
int gdSize
size and local index of relative velocities
Definition: link.h:513
virtual void updateLaRef(const fmatvec::Vec &ref)
references to contact force parameter of dynamic system parent
Definition: link.cc:88
fmatvec::Vec sv
stop vector for event driven integration (root function)
Definition: link.h:461
void init(InitStage stage, const InitConfigSet &config) override
plots time series header
Definition: link.cc:134
virtual void solveConstraintsRootFinding()
Definition: link.h:280
virtual void solveImpactsGaussSeidel()
Definition: link.h:264
virtual void calcgSize(int j)
calculates size of relative distances
Definition: link.h:185
int xSize
size and local index of order one parameters
Definition: link.h:456
int bSize
size and local index of contact force parameters
Definition: link.h:523
Link(const std::string &name)
constructor
Definition: link.cc:39
void saveLa()
saves contact impulses for use as starting value in next time step
Definition: link.cc:191
virtual void updaterFactorRef(const fmatvec::Vec &ref)
references to rfactors of dynamic system parent
Definition: link.cc:108
std::vector< fmatvec::Vec > h[2]
smooth complete and link right hand side
Definition: link.h:583
fmatvec::VecInt LinkStatus
status of link (default 0) describing which piece of the equation is valid (e.g. stick or slip) ...
Definition: link.h:477
fmatvec::Vec rFactor
vector of rfactors for relaxation of contact equations
Definition: link.h:548
virtual bool detectImpact()
Definition: link.h:247
virtual void updatelaRef(const fmatvec::Vec &ref)
references to contact force parameter of dynamic system parent
Definition: link.cc:84
fmatvec::VecInt jsv
evaluation of roots of stop vector with a boolean vector
Definition: link.h:466
virtual void updatesvRef(const fmatvec::Vec &sv)
references to stopvector of dynamic system parent (root function for event driven integration) ...
Definition: link.cc:112
basic class of MBSim mainly for plotting
Definition: element.h:56
int LinkStatusSize
size and local index of link status vector (set-valued)
Definition: link.h:482
virtual void updaterRef(const fmatvec::Vec &ref, int i=0)=0
references to nonsmooth force vector of dynamic system parent
virtual void checkActive(int j)
check if set-valued contacts are active and set corresponding attributes
Definition: link.h:313
virtual void updategdRef(const fmatvec::Vec &ref)
references to contact relative velocities of dynamic system parent
Definition: link.cc:100
fmatvec::Vec la0
attribute to save contact force parameter of previous time step
Definition: link.h:543
virtual bool isActive() const =0
virtual void solveConstraintsGaussSeidel()
Definition: link.h:269
virtual void deletelaRef()
delete reference to contact force parameter of dynamic system parent
Definition: link.cc:92
virtual void calcbSize()
calculates size of rfactors
Definition: link.h:203
std::vector< fmatvec::Mat > W[2]
force direction matrix for nonsmooth right hand side
Definition: link.h:573
virtual void LinearImpactEstimation(double t, fmatvec::Vec &gInActive_, fmatvec::Vec &gdInActive_, int *IndInActive_, fmatvec::Vec &gAct_, int *IndActive_)
get gap distance and calculate gap velocity of unilateral links to estimate impacts within the next s...
Definition: link.h:342
void plot() override
plots time dependent data
Definition: link.cc:42
virtual void jacobianImpacts()
computes JACOBIAN and mass action matrix of nonlinear contact equations on velocity level ...
Definition: link.h:290
virtual void updatehRef(const fmatvec::Vec &hRef, int i=0)=0
references to complete and link smooth force vector of dynamic system parent
virtual void checkConstraintsForTermination()
verify underlying force laws concerning given tolerances
Definition: link.h:305
InitStage
The stages of the initialization.
Definition: element.h:62
int svSize
size and local index of stop vector
Definition: link.h:471
virtual void SizeLinearImpactEstimation(int *sizeInActive_, int *sizeActive_)
calculates the number of active and inactive unilateral constraints and increments sizeActive/sizeInA...
Definition: link.h:347
virtual void calcsvSize()
calculates size of stopvector (root function for event driven integration)
Definition: link.h:208
void initla()
load contact forces for use as starting value
Definition: link.cc:184
std::vector< fmatvec::Vec > r[2]
nonsmooth right hand side
Definition: link.h:595
virtual void solveImpactsFixpointSingle()
Definition: link.h:253
fmatvec::RangeV Ig
local index of relative distances and contact force parameters
Definition: link.h:528
std::string name
name of element
Definition: element.h:235
virtual void solveImpactsRootFinding()
Definition: link.h:275
virtual void updatewbRef(const fmatvec::Vec &ref)
references to TODO of dynamic system parent
Definition: link.cc:68
virtual void solveConstraintsFixpointSingle()
Definition: link.h:258
fmatvec::Vec laS
contact forces of smooth contact laws
Definition: link.h:503
virtual void calcLinkStatusSize()
calculates size of vector LinkStatus
Definition: link.h:213
virtual void updateLinkStatusRef(const fmatvec::VecInt &LinkStatusParent)
reference to vector of link status (for set valued links with piecewise link equations) ...
Definition: link.cc:120
fmatvec::Vec res
Definition: link.h:568
virtual void calcrFactorSize(int j)
calculates size of rfactors
Definition: link.h:198
void initLa()
load contact impulses for use as starting value
Definition: link.cc:195
double gCorr
correction factor for relative position and relative velocity
Definition: link.h:538
virtual void updaterFactors()
update relaxation factors for contact equations
Definition: link.h:295
double gTol
tolerance for relative position, relative velocity, relative acceleration, force and impact ...
Definition: link.h:533
virtual bool gActiveChanged()=0
std::vector< fmatvec::Mat > dhdq
smooth Jacobians for implicit integration
Definition: link.h:588
virtual void calcLinkStatusRegSize()
calculates size of vector LinkStatusReg
Definition: link.h:218
virtual void updateresRef(const fmatvec::Vec &ref)
references to residuum of nonlinear contact equations of dynamic system parent
Definition: link.cc:104
int gSize
size and local index of relative distances
Definition: link.h:508
int LinkStatusRegSize
size and local index of single-valued link status vector
Definition: link.h:493
fmatvec::Vec wb
TODO.
Definition: link.h:600
virtual void jacobianConstraints()
computes JACOBIAN and mass action matrix of nonlinear contact equations
Definition: link.h:285
virtual bool isSingleValued() const
asks the link if it contains single valued force laws that contribute to the right-hand side vector h...
Definition: link.h:232
int rFactorSize
size and local index of rfactors
Definition: link.h:558
fmatvec::VecInt rFactorUnsure
boolean vector defining if rfactor belongs to not diagonal dominant mass action matrix (cf...
Definition: link.h:553
virtual void calcgdSize(int j)
calculates size of gap velocities
Definition: link.h:193
fmatvec::Vec xd
differentiated order one parameters
Definition: link.h:444
virtual void updateLinkStatusRegRef(const fmatvec::VecInt &LinkStatusRegParent)
reference to vector of link status (for single-valued links)
Definition: link.cc:124
virtual void calclaSize(int j)
calculates size of contact force parameters
Definition: link.h:180
virtual void updategRef(const fmatvec::Vec &ref)
references to contact relative distances of dynamic system parent
Definition: link.cc:96