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; }
77 const fmatvec::Vec& getx()
const {
return x; }
78 fmatvec::Vec& getx() {
return x; }
79 const fmatvec::Vec& getxd(
bool check=
true)
const;
80 fmatvec::Vec& getxd(
bool check=
true);
81 int getxInd() {
return xInd; }
82 virtual void setxInd(
int xInd_) { xInd = xInd_; };
83 int getxSize()
const {
return xSize; }
84 virtual void updatexRef(fmatvec::Vec& ref);
85 virtual void updatexdRef(fmatvec::Vec& ref);
86 virtual void updatedxRef(fmatvec::Vec& ref);
87 virtual void updatebRef(fmatvec::Mat &hRef);
88 void init(
InitStage stage,
const InitConfigSet &config)
override;
93 virtual void setbInd(
int bInd_) { bInd = bInd_; };
103 virtual void updateWRef(fmatvec::Mat& ref,
int i=0) = 0;
108 virtual void updateVRef(fmatvec::Mat& ref,
int i=0) = 0;
113 virtual void updatehRef(fmatvec::Vec &hRef,
int i=0) = 0;
118 virtual void updaterRef(fmatvec::Vec &ref,
int i=0) = 0;
190 int getisInd() {
return isInd; }
191 int getisSize() {
return isSize; }
192 virtual void calcisSize() { isSize = 0; }
201 virtual void postprocessing() {}
311 virtual void jacobianImpacts() { throwError(
"(Link::jacobianImpacts): Not implemented."); }
316 virtual void updaterFactors() { throwError(
"(Link::updaterFactors): Not implemented."); }
336 virtual void setGeneralizedForceTolerance(
double tol) { laTol = tol; }
337 virtual void setGeneralizedImpulseTolerance(
double tol) { LaTol = tol; }
338 virtual void setGeneralizedRelativePositionTolerance(
double tol) {
gTol = tol; }
339 virtual void setGeneralizedRelativeVelocityTolerance(
double tol) { gdTol = tol; }
340 virtual void setGeneralizedRelativeAccelerationTolerance(
double tol) { gddTol = tol; }
341 virtual void setGeneralizedRelativePositionCorrectionValue(
double corr) {
gCorr = corr; }
342 virtual void setGeneralizedRelativeVelocityCorrectionValue(
double corr) { gdCorr = corr; }
343 virtual void setrMax(
double rMax_) {
rMax = rMax_; }
344 virtual void setLinkStatusInd(
int LinkStatusInd_) { LinkStatusInd = LinkStatusInd_; };
345 virtual void setLinkStatusRegInd(
int LinkStatusRegInd_) { LinkStatusRegInd = LinkStatusRegInd_; };
346 virtual void setlaInd(
int laInd_) { laInd = laInd_;Ila=fmatvec::RangeV(laInd,laInd+
laSize-1); }
347 virtual void setisInd(
int isInd_) { isInd = isInd_; }
348 virtual void setgInd(
int gInd_) { gInd = gInd_;
Ig=fmatvec::RangeV(gInd,gInd+
gSize-1); }
349 virtual void setgdInd(
int gdInd_) { gdInd = gdInd_; }
350 virtual void setrFactorInd(
int rFactorInd_) { rFactorInd = rFactorInd_; }
359 virtual void LinearImpactEstimation(
double t, fmatvec::Vec &gInActive_,fmatvec::Vec &gdInActive_,
int *IndInActive_,fmatvec::Vec &gAct_,
int *IndActive_) { }
365 virtual void updatecorr(
int j) { corr.init(0); }
366 virtual void updatecorrRef(fmatvec::Vec &ref);
367 virtual void calccorrSize(
int j) { corrSize = 0; }
368 virtual void setcorrInd(
int corrInd_) { corrInd = corrInd_; }
369 virtual void checkRoot() { }
372 void setx(
const fmatvec::Vec &x_) {
x = x_; }
374 virtual void setsvInd(
int svInd_) { svInd = svInd_; };
375 int getsvSize()
const {
return svSize; }
381 const fmatvec::Vec& getla(
bool check=
true)
const;
382 const fmatvec::Vec& getLa(
bool check=
true)
const;
383 fmatvec::Vec& getla(
bool check=
true);
384 fmatvec::Vec& getLa(
bool check=
true);
385 fmatvec::Vec& getwb(
bool check=
true);
387 int getlaInd()
const {
return laInd; }
388 int getlaSize()
const {
return laSize; }
389 int getbSize()
const {
return bSize; }
391 const fmatvec::Vec& evalg();
392 const fmatvec::Vec& evalgd();
393 const fmatvec::Vec& evalla();
394 const fmatvec::Vec& evalLa();
395 const fmatvec::Vec& evalwb();
396 const fmatvec::Vec& evalxd();
398 int getgdInd()
const {
return gdInd; }
399 int getgSize()
const {
return gSize; }
400 int getgdSize()
const {
return gdSize; }
404 const fmatvec::VecInt& getrFactorUnsure()
const {
return rFactorUnsure; }
406 void resetUpToDate()
override { updrrel =
true; updvrel =
true; updla =
true; }
408 virtual void updateGeneralizedPositions() { updrrel =
false; }
409 virtual void updateGeneralizedVelocities() { updvrel =
false; }
410 virtual void updateGeneralizedForces() { updla =
false; }
412 const fmatvec::VecV& evalGeneralizedRelativePosition() {
if(updrrel) updateGeneralizedPositions();
return rrel; }
413 const fmatvec::VecV& evalGeneralizedRelativeVelocity() {
if(updvrel) updateGeneralizedVelocities();
return vrel; }
414 const fmatvec::VecV& evalGeneralizedForce() {
if(updla) updateGeneralizedForces();
return lambda; }
416 fmatvec::VecV& getGeneralizedRelativePosition(
bool check=
true) { assert((not check) or (not updrrel));
return rrel; }
417 fmatvec::VecV& getGeneralizedRelativeVelocity(
bool check=
true) { assert((not check) or (not updvrel));
return vrel; }
418 fmatvec::VecV& getGeneralizedForce(
bool check=
true) { assert((not check) or (not updla));
return lambda; }
446 int getcorrSize()
const {
return corrSize; }
448 bool getUpdaterrel()
const {
return updrrel; }
514 fmatvec::Vec curis, nextis;
519 fmatvec::Vec
g, gd, la, La;
551 fmatvec::RangeV
Ig, Ila;
556 double gTol, gdTol, gddTol, laTol, LaTol;
596 std::vector<fmatvec::Mat>
W[2];
601 std::vector<fmatvec::Mat>
V[2];
606 std::vector<fmatvec::Vec>
h[2];
611 std::vector<fmatvec::Mat>
dhdq;
612 std::vector<fmatvec::Mat> dhdu;
613 std::vector<fmatvec::Vec> dhdt;
618 std::vector<fmatvec::Vec>
r[2];
630 int corrSize, corrInd;
633 fmatvec::VecV rrel, vrel, lambda;
635 bool updSize, updrrel, updvrel, updla;
fmatvec::Vec x
order one parameters
Definition: link.h:458
std::vector< fmatvec::Mat > V[2]
reduced force direction matrix for nonsmooth right hand side
Definition: link.h:601
void createPlotGroup() override
creates the plotGroup for H5-output
Definition: link.cc:259
virtual void updateLinkStatusRegRef(fmatvec::VecInt &LinkStatusRegParent)
reference to vector of link status (for single-valued links)
Definition: link.cc:127
void savela()
saves contact forces for use as starting value in next time step
Definition: link.cc:172
fmatvec::Vec x0
order one initial value
Definition: link.h:470
void decreaserFactors()
decrease rfactor if mass action matrix is not diagonal dominant (cf. Foerg: Dissertation,...
Definition: link.cc:194
double rMax
maximum r-factor
Definition: link.h:586
fmatvec::Vec g
relative position, relative velocity, contact force and impact parameters
Definition: link.h:519
general link to one or more objects
Definition: link.h:48
virtual void updatewbRef(fmatvec::Vec &ref)
references to TODO of dynamic system parent
Definition: link.cc:66
fmatvec::VecInt LinkStatusReg
status of link
Definition: link.h:507
virtual void checkImpactsForTermination()
verify underlying force laws on velocity level concerning given tolerances
Definition: link.h:321
fmatvec::Mat b
TODO.
Definition: link.h:628
int laSize
size and local index of contact force parameters
Definition: link.h:541
int gdSize
size and local index of relative velocities
Definition: link.h:536
virtual void updateLaRef(fmatvec::Vec &ref)
references to contact force parameter of dynamic system parent
Definition: link.cc:86
fmatvec::Vec sv
stop vector for event driven integration (root function)
Definition: link.h:480
void init(InitStage stage, const InitConfigSet &config) override
plots time series header
Definition: link.cc:137
virtual void solveConstraintsRootFinding()
Definition: link.h:301
virtual void solveImpactsGaussSeidel()
Definition: link.h:285
virtual void calcgSize(int j)
calculates size of relative distances
Definition: link.h:206
int xSize
size and local index of order one parameters
Definition: link.h:475
virtual void updaterFactorRef(fmatvec::Vec &ref)
references to rfactors of dynamic system parent
Definition: link.cc:111
int bSize
size and local index of contact force parameters
Definition: link.h:546
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:183
std::vector< fmatvec::Vec > h[2]
smooth complete and link right hand side
Definition: link.h:606
fmatvec::VecInt LinkStatus
status of link (default 0) describing which piece of the equation is valid (e.g. stick or slip)
Definition: link.h:496
fmatvec::Vec rFactor
vector of rfactors for relaxation of contact equations
Definition: link.h:571
virtual void updateInternalStateRef(fmatvec::Vec &cur, fmatvec::Vec &next)
references to internal state of dynamic system parent
Definition: link.cc:94
virtual void updatelaRef(fmatvec::Vec &ref)
references to contact force parameter of dynamic system parent
Definition: link.cc:82
virtual bool detectImpact()
Definition: link.h:268
virtual void updateresRef(fmatvec::Vec &ref)
references to residuum of nonlinear contact equations of dynamic system parent
Definition: link.cc:107
fmatvec::VecInt jsv
evaluation of roots of stop vector with a boolean vector
Definition: link.h:485
basic class of MBSim mainly for plotting
Definition: element.h:58
int LinkStatusSize
size and local index of link status vector (set-valued)
Definition: link.h:501
virtual void updateLinkStatusRef(fmatvec::VecInt &LinkStatusParent)
reference to vector of link status (for set valued links with piecewise link equations)
Definition: link.cc:123
virtual void checkActive(int j)
check if set-valued contacts are active and set corresponding attributes
Definition: link.h:334
virtual void updategRef(fmatvec::Vec &ref)
references to contact relative distances of dynamic system parent
Definition: link.cc:99
fmatvec::Vec la0
attribute to save contact force parameter of previous time step
Definition: link.h:566
virtual bool isActive() const =0
virtual void updateWRef(fmatvec::Mat &ref, int i=0)=0
references to contact force direction matrix of dynamic system parent
virtual void solveConstraintsGaussSeidel()
Definition: link.h:290
virtual void deletelaRef()
delete reference to contact force parameter of dynamic system parent
Definition: link.cc:90
virtual void updatejsvRef(fmatvec::VecInt &jsvParent)
references to stopvector evaluation of dynamic system parent (root detection with corresponding bool ...
Definition: link.cc:119
virtual void calcbSize()
calculates size of rfactors
Definition: link.h:224
std::vector< fmatvec::Mat > W[2]
force direction matrix for nonsmooth right hand side
Definition: link.h:596
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:359
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:311
virtual void checkConstraintsForTermination()
verify underlying force laws concerning given tolerances
Definition: link.h:326
virtual void updategdRef(fmatvec::Vec &ref)
references to contact relative velocities of dynamic system parent
Definition: link.cc:103
virtual void updaterRef(fmatvec::Vec &ref, int i=0)=0
references to nonsmooth force vector of dynamic system parent
InitStage
The stages of the initialization.
Definition: element.h:64
int svSize
size and local index of stop vector
Definition: link.h:490
virtual void SizeLinearImpactEstimation(int *sizeInActive_, int *sizeActive_)
calculates the number of active and inactive unilateral constraints and increments sizeActive/sizeInA...
Definition: link.h:364
virtual void calcsvSize()
calculates size of stopvector (root function for event driven integration)
Definition: link.h:229
virtual void aboutToUpdateInternalState()
Definition: link.h:199
virtual void updatesvRef(fmatvec::Vec &sv)
references to stopvector of dynamic system parent (root function for event driven integration)
Definition: link.cc:115
void initla()
load contact forces for use as starting value
Definition: link.cc:176
std::vector< fmatvec::Vec > r[2]
nonsmooth right hand side
Definition: link.h:618
virtual void solveImpactsFixpointSingle()
Definition: link.h:274
fmatvec::RangeV Ig
local index of relative distances and contact force parameters
Definition: link.h:551
virtual void updateVRef(fmatvec::Mat &ref, int i=0)=0
references to condensed contact force direction matrix of dynamic system parent
std::string name
name of element
Definition: element.h:262
virtual void solveImpactsRootFinding()
Definition: link.h:296
virtual void solveConstraintsFixpointSingle()
Definition: link.h:279
fmatvec::Vec laS
contact forces of smooth contact laws
Definition: link.h:524
virtual void calcLinkStatusSize()
calculates size of vector LinkStatus
Definition: link.h:234
fmatvec::Vec res
Definition: link.h:591
virtual void calcrFactorSize(int j)
calculates size of rfactors
Definition: link.h:219
virtual void updatehRef(fmatvec::Vec &hRef, int i=0)=0
references to complete and link smooth force vector of dynamic system parent
void initLa()
load contact impulses for use as starting value
Definition: link.cc:187
double gCorr
correction factor for relative position and relative velocity
Definition: link.h:561
virtual void updaterFactors()
update relaxation factors for contact equations
Definition: link.h:316
double gTol
tolerance for relative position, relative velocity, relative acceleration, force and impact
Definition: link.h:556
virtual bool gActiveChanged()=0
std::vector< fmatvec::Mat > dhdq
smooth Jacobians for implicit integration
Definition: link.h:611
virtual void calcLinkStatusRegSize()
calculates size of vector LinkStatusReg
Definition: link.h:239
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:246
int gSize
size and local index of relative distances
Definition: link.h:531
int LinkStatusRegSize
size and local index of single-valued link status vector
Definition: link.h:512
fmatvec::Vec wb
TODO.
Definition: link.h:623
virtual void jacobianConstraints()
computes JACOBIAN and mass action matrix of nonlinear contact equations
Definition: link.h:306
int rFactorSize
size and local index of rfactors
Definition: link.h:581
fmatvec::VecInt rFactorUnsure
boolean vector defining if rfactor belongs to not diagonal dominant mass action matrix (cf....
Definition: link.h:576
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:253
virtual void calcgdSize(int j)
calculates size of gap velocities
Definition: link.h:214
fmatvec::Vec xd
differentiated order one parameters
Definition: link.h:463
virtual void calclaSize(int j)
calculates size of contact force parameters
Definition: link.h:188
namespace MBSim
Definition: bilateral_constraint.cc:29