mbsim 4.0.0 MBSim Kernel

disk_contact.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 _DISK_CONTACT_H_
21 #define _DISK_CONTACT_H_
22
23 #include <mbsim/links/contour_link.h>
24
25 namespace MBSim {
26
27 class GeneralizedForceLaw;
28 class GeneralizedImpactLaw;
29 class FrictionForceLaw;
30 class FrictionImpactLaw;
31
35 class DiskContact: public ContourLink {
36
37 public:
42 DiskContact(const std::string &name="") : ContourLink(name) { }
43
44 ~DiskContact();
45
46 void resetUpToDate() override;
47
48 bool isSticking() const;
49
50 const double& evalGeneralizedNormalForce() { if(updlaN) updateGeneralizedNormalForce(); return lambdaN; }
51 const fmatvec::VecV& evalGeneralizedTangentialForce() { if(updlaT) updateGeneralizedTangentialForce(); return lambdaT; }
52
53 double& getGeneralizedNormalForce(bool check=true) { assert((not check) or (not updlaN)); return lambdaN; }
54
55 const double& evallaN();
56 const fmatvec::Vec& evallaT();
57
58 const double& evalLaN();
59 const fmatvec::Vec& evalLaT();
60
61 const double& evalgdnN();
62 const fmatvec::Vec& evalgdnT();
63
64 const double& evalgddN();
65 const fmatvec::Vec& evalgddT();
66
67 /* INHERITED INTERFACE OF LINKINTERFACE */
68 void updateForce() override;
69 void updateMoment() override;
70 void updateForceDirections() override;
71 void updateGeneralizedNormalForce() { (this->*updateGeneralizedNormalForce_)(); updlaN = false; }
72 void updateGeneralizedTangentialForce() { (this->*updateGeneralizedTangentialForce_)(); updlaT = false; }
73 void updateGeneralizedNormalForceS();
74 void updateGeneralizedNormalForceM();
75 void updateGeneralizedTangentialForceS();
76 void updateGeneralizedTangentialForceM();
77 void (DiskContact::*updateGeneralizedNormalForce_)();
78 void (DiskContact::*updateGeneralizedTangentialForce_)();
79 void updateGeneralizedForces() override;
80 void updatePositions(Frame *frame) override;
81 void updateGeneralizedPositions() override;
82 void updateGeneralizedVelocities() override;
83 void updateg() override;
84 void updategd() override;
85 void updateh(int i=0) override;
86 void updateW(int i=0) override;
87 void updateV(int i=0) override;
88 void updatewb() override;
89 void updateStopVector() override;
90 void updateStopVectorParameters() override;
91 /***************************************************/
92
93 /* INHERITED INTERFACE OF LINK */
94 void updatelaRef(fmatvec::Vec& ref) override;
95 void updateLaRef(fmatvec::Vec& ref) override;
96 void updategdRef(fmatvec::Vec& ref) override;
97 void calcSize() override;
98 void calclaSize(int j) override;
99 void calcgSize(int j) override;
100 void calcgdSize(int j) override;
101 void calcrFactorSize(int j) override;
102 void calcsvSize() override;
103 void calcLinkStatusSize() override;
104 void calcLinkStatusRegSize() override;
105 void init(InitStage stage, const InitConfigSet &config) override;
106 bool isSetValued() const override;
107 bool isSingleValued() const override;
108 void updateLinkStatus() override;
109 void updateLinkStatusReg() override;
110 bool isActive() const override;
111 bool gActiveChanged() override;
112 bool detectImpact() override;
113 void solveImpactsFixpointSingle() override;
114 void solveConstraintsFixpointSingle() override;
115 void solveImpactsGaussSeidel() override;
116 void solveConstraintsGaussSeidel() override;
117 void solveImpactsRootFinding() override;
118 void solveConstraintsRootFinding() override;
119 void jacobianConstraints() override;
120 void jacobianImpacts() override;
121 void updaterFactors() override;
122 void checkConstraintsForTermination() override;
123 void checkImpactsForTermination() override;
124 void checkActive(int j) override;
125 void LinearImpactEstimation(double t, fmatvec::Vec &gInActive_,fmatvec::Vec &gdInActive_,int *IndInActive_,fmatvec::Vec &gAct_,int *IndActive_) override;
126 void SizeLinearImpactEstimation(int *sizeInActive_, int *sizeActive_) override;
127
128 /***************************************************/
129
130 /* INHERITED INTERFACE OF ELEMENT */
131 /***************************************************/
132
133 /* GETTER / SETTER */
134 void setNormalForceLaw(GeneralizedForceLaw *fcl_);
135 GeneralizedForceLaw * getNormalForceLaw() const { return fcl; }
136 void setNormalImpactLaw(GeneralizedImpactLaw *fnil_);
137 void setTangentialForceLaw(FrictionForceLaw *fdf_);
138 void setTangentialImpactLaw(FrictionImpactLaw *ftil_);
139 /***************************************************/
140
141 void calccorrSize(int j) override;
142 void updatecorr(int j) override;
143
144 void checkRoot() override;
145
146 void initializeUsingXML(xercesc::DOMElement *element) override;
147
148 protected:
152 double rE;
153
157 GeneralizedForceLaw *fcl{nullptr};
158
162 FrictionForceLaw *fdf{nullptr};
163
167 GeneralizedImpactLaw *fnil{nullptr};
168
172 FrictionImpactLaw *ftil{nullptr};
173
179 fmatvec::Vec laN, LaN;
180
186 fmatvec::Vec laT, LaT;
187
192 fmatvec::Vec gdN;
193
199 fmatvec::Vec gdT;
200
204 unsigned int gActive{0}, gActive0{0};
205
206 enum Direction {
207 normal,
208 tangential,
209 DirectionDIM
210 };
211
217 std::array<unsigned int, DirectionDIM> gdActive;
218
224 std::array<unsigned int, DirectionDIM> gddActive;
225
229 fmatvec::Vec gdnN, gdnT;
230
234 fmatvec::Vec gddN, gddT;
235
236 double lambdaN;
237 fmatvec::VecV lambdaT;
238
239 bool updlaN{true}, updlaT{true};
240
241 int gdTDir;
242
250 int rootID{0};
251 };
252
253 }
254
255 #endif
MBSim::DiskContact::calcrFactorSize
void calcrFactorSize(int j) override
calculates size of rfactors
Definition: disk_contact.cc:402
MBSim::GeneralizedForceLaw
basic force law on acceleration level for constraint description
Definition: generalized_force_law.h:34
MBSim::DiskContact::init
void init(InitStage stage, const InitConfigSet &config) override
plots time series header
Definition: disk_contact.cc:452
MBSim::DiskContact::gddActive
std::array< unsigned int, DirectionDIM > gddActive
boolean flag symbolising activity of contact on acceleration level
Definition: disk_contact.h:224
MBSim::DiskContact::checkActive
void checkActive(int j) override
check if set-valued contacts are active and set corresponding attributes
Definition: disk_contact.cc:914
MBSim::DiskContact::solveConstraintsFixpointSingle
void solveConstraintsFixpointSingle() override
Definition: disk_contact.cc:590
MBSim::DiskContact::checkConstraintsForTermination
void checkConstraintsForTermination() override
verify underlying force laws concerning given tolerances
Definition: disk_contact.cc:848
MBSim::DiskContact::gActive
unsigned int gActive
boolean flag symbolising activity of contact on position level with possibility to save previous time...
Definition: disk_contact.h:204
MBSim::DiskContact::detectImpact
bool detectImpact() override
Definition: disk_contact.cc:536
MBSim::DiskContact::isActive
bool isActive() const override
Definition: disk_contact.cc:526
MBSim::DiskContact::solveConstraintsGaussSeidel
void solveConstraintsGaussSeidel() override
Definition: disk_contact.cc:648
MBSim::DiskContact::calcLinkStatusRegSize
void calcLinkStatusRegSize() override
calculates size of vector LinkStatusReg
Definition: disk_contact.cc:446
MBSim::DiskContact::rootID
int rootID
type of detected root
Definition: disk_contact.h:250
MBSim::DiskContact::updatelaRef
void updatelaRef(fmatvec::Vec &ref) override
references to contact force parameter of dynamic system parent
Definition: disk_contact.cc:247
MBSim::DiskContact::laT
fmatvec::Vec laT
force in tangential direction
Definition: disk_contact.h:186
MBSim::DiskContact::checkImpactsForTermination
void checkImpactsForTermination() override
verify underlying force laws on velocity level concerning given tolerances
Definition: disk_contact.cc:883
MBSim::DiskContact::DiskContact
DiskContact(const std::string &name="")
constructor
Definition: disk_contact.h:42
MBSim::DiskContact::fcl
GeneralizedForceLaw * fcl
force laws in normal and tangential direction on acceleration and velocity level
Definition: disk_contact.h:157
MBSim::DiskContact::fnil
GeneralizedImpactLaw * fnil
force law defining relation between penetration velocity and resulting normal impulses
Definition: disk_contact.h:167
MBSim::DiskContact::jacobianImpacts
void jacobianImpacts() override
computes JACOBIAN and mass action matrix of nonlinear contact equations on velocity level
Definition: disk_contact.cc:773
MBSim::DiskContact::SizeLinearImpactEstimation
void SizeLinearImpactEstimation(int *sizeInActive_, int *sizeActive_) override
calculates the number of active and inactive unilateral constraints and increments sizeActive/sizeInA...
Definition: disk_contact.cc:1129
MBSim::DiskContact::updateLaRef
void updateLaRef(fmatvec::Vec &ref) override
references to contact force parameter of dynamic system parent
Definition: disk_contact.cc:257
MBSim::DiskContact::jacobianConstraints
void jacobianConstraints() override
computes JACOBIAN and mass action matrix of nonlinear contact equations
Definition: disk_contact.cc:736
MBSim::DiskContact::isSetValued
bool isSetValued() const override
asks the link if it contains force laws that contribute to the lagrange multiplier and is therefore s...
Definition: disk_contact.cc:497
MBSim::DiskContact::gActiveChanged
bool gActiveChanged() override
Definition: disk_contact.cc:530
MBSim::DiskContact
class for disk contacts
Definition: disk_contact.h:35
MBSim::DiskContact::gdT
fmatvec::Vec gdT
relative velocity in tangential direction
Definition: disk_contact.h:199
MBSim::DiskContact::gdN
fmatvec::Vec gdN
relative velocity in normal direction
Definition: disk_contact.h:192
MBSim::DiskContact::calcLinkStatusSize
void calcLinkStatusSize() override
calculates size of vector LinkStatus
Definition: disk_contact.cc:440
MBSim::FrictionImpactLaw
basic friction force law on velocity level for constraint description
Definition: friction_impact_law.h:32
MBSim::Element::InitStage
InitStage
The stages of the initialization.
Definition: element.h:62
MBSim::FrictionForceLaw
basic friction force law on acceleration level for constraint description
Definition: friction_force_law.h:34
MBSim::ContourLink
contour link
Definition: contour_link.h:34
MBSim::DiskContact::solveImpactsRootFinding
void solveImpactsRootFinding() override
Definition: disk_contact.cc:680
MBSim::GeneralizedImpactLaw
basic force law on velocity level for constraint description
Definition: generalized_impact_law.h:32
MBSim::DiskContact::gdnN
fmatvec::Vec gdnN
new gap velocity after an impact for event driven scheme
Definition: disk_contact.h:229
MBSim::Element::name
std::string name
name of element
Definition: element.h:260
MBSim::DiskContact::laN
fmatvec::Vec laN
force in normal direction
Definition: disk_contact.h:179
MBSim::DiskContact::calcgSize
void calcgSize(int j) override
calculates size of relative distances
Definition: disk_contact.cc:341
MBSim::DiskContact::gdActive
std::array< unsigned int, DirectionDIM > gdActive
boolean flag symbolising activity of contact on velocity level
Definition: disk_contact.h:217
MBSim::DiskContact::solveImpactsGaussSeidel
void solveImpactsGaussSeidel() override
Definition: disk_contact.cc:617
MBSim::DiskContact::calclaSize
void calclaSize(int j) override
calculates size of contact force parameters
Definition: disk_contact.cc:284
MBSim::DiskContact::fdf
FrictionForceLaw * fdf
force law defining relation between tangential velocities and tangential forces
Definition: disk_contact.h:162
MBSim::DiskContact::solveConstraintsRootFinding
void solveConstraintsRootFinding() override
Definition: disk_contact.cc:708
MBSim::DiskContact::solveImpactsFixpointSingle
void solveImpactsFixpointSingle() override
Definition: disk_contact.cc:564
MBSim::DiskContact::gddN
fmatvec::Vec gddN
gap acceleration for event driven scheme on acceleration level
Definition: disk_contact.h:234
MBSim::DiskContact::updaterFactors
void updaterFactors() override
update relaxation factors for contact equations
Definition: disk_contact.cc:809
MBSim::DiskContact::ftil
FrictionImpactLaw * ftil
force law defining relation between tangential velocities and forces impulses
Definition: disk_contact.h:172
MBSim::DiskContact::isSingleValued
bool isSingleValued() const override
asks the link if it contains single valued force laws that contribute to the right-hand side vector h
Definition: disk_contact.cc:501
MBSim::DiskContact::calcgdSize
void calcgdSize(int j) override
calculates size of gap velocities
Definition: disk_contact.cc:353
MBSim::DiskContact::rE
double rE
effective radius
Definition: disk_contact.h:152
MBSim::DiskContact::LinearImpactEstimation
void LinearImpactEstimation(double t, fmatvec::Vec &gInActive_, fmatvec::Vec &gdInActive_, int *IndInActive_, fmatvec::Vec &gAct_, int *IndActive_) override
get gap distance and calculate gap velocity of unilateral links to estimate impacts within the next s...
Definition: disk_contact.cc:1115
MBSim::DiskContact::updategdRef
void updategdRef(fmatvec::Vec &ref) override
references to contact relative velocities of dynamic system parent
Definition: disk_contact.cc:267
MBSim
namespace MBSim
Definition: bilateral_constraint.cc:30
MBSim::DiskContact::calcsvSize
void calcsvSize() override
calculates size of stopvector (root function for event driven integration)
Definition: disk_contact.cc:429