mbsim  4.0.0
MBSim Kernel
generalized_clutch.h
1 /* Copyright (C) 2004-2021 MBSim Development Team
2  * This library is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU Lesser General Public
4  * License as published by the Free Software Foundation; either
5  * version 2.1 of the License, or (at your option) any later version.
6  *
7  * This library is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10  * Lesser General Public License for more details.
11  *
12  * You should have received a copy of the GNU Lesser General Public
13  * License along with this library; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15  *
16  * Contact: martin.o.foerg@googlemail.com
17  */
18 
19 #ifndef _GENERALIZED_CLUTCH_H_
20 #define _GENERALIZED_CLUTCH_H_
21 
22 #include "mbsim/links/dual_rigid_body_link.h"
23 #include "mbsim/functions/function.h"
24 
25 namespace MBSim {
26 
27  class FrictionForceLaw;
28  class FrictionImpactLaw;
29 
31  protected:
32  FrictionForceLaw *laT{nullptr};
33  FrictionImpactLaw *LaT{nullptr};
34  Function<double(double)> *e{nullptr};
35  Function<double(double)> *laN{nullptr};
36  unsigned int gActive{1}, gActive0{0};
37  unsigned int gdActive{1};
38  unsigned int gddActive{1};
39  fmatvec::Vec gdn, gdd;
40  int gdDir;
41  int rootID{0};
42  public:
43  GeneralizedClutch(const std::string &name="") : DualRigidBodyLink(name), gdn(1), gdd(1) { }
44  ~GeneralizedClutch() override;
45  void updateGeneralizedForces() override;
46  void updateh(int i=0) override;
47  void updateW(int i=0) override;
48  void updatewb() override;
49  void updateg() override { }
50  void updategd() override;
51  const double& evalgdn();
52  const double& evalgdd();
53 
54  bool isActive() const override;
55  bool gActiveChanged() override;
56  bool isSetValued() const override;
57  bool isSingleValued() const override { return true; }
58  void plot() override;
59  void init(InitStage stage, const InitConfigSet &config) override;
60 
61  void setGeneralizedFrictionForceLaw(FrictionForceLaw *laT_);
62  void setGeneralizedFrictionImpactLaw(FrictionImpactLaw *LaT_);
63  void setEngagementFunction(Function<double(double)> *e_) {
64  e = e_;
65  e->setParent(this);
66  }
67  void setGeneralizedNormalForceFunction(Function<double(double)> *laN_) {
68  laN = laN_;
69  laN->setParent(this);
70  }
71 
72  void updateStopVector() override;
73  void calclaSize(int j) override;
74  void calcgSize(int j) override;
75  void calcgdSize(int j) override;
76  void calcrFactorSize(int j) override;
77  void calcsvSize() override;
78  void checkActive(int j) override;
79  void calccorrSize(int j) override;
80  void updatecorr(int j) override;
81  void checkRoot() override;
82  void updaterFactors() override;
83  void solveConstraintsFixpointSingle() override;
84  void solveImpactsFixpointSingle() override;
85  void checkConstraintsForTermination() override;
86  void checkImpactsForTermination() override;
87 
88  void initializeUsingXML(xercesc::DOMElement *element) override;
89  };
90 
91 }
92 
93 #endif
bool gActiveChanged() override
Definition: generalized_clutch.cc:98
bool isActive() const override
Definition: generalized_clutch.cc:94
Definition: generalized_clutch.h:30
void checkImpactsForTermination() override
verify underlying force laws on velocity level concerning given tolerances
Definition: generalized_clutch.cc:401
void calcgdSize(int j) override
calculates size of gap velocities
Definition: generalized_clutch.cc:182
void solveConstraintsFixpointSingle() override
Definition: generalized_clutch.cc:347
void checkActive(int j) override
check if set-valued contacts are active and set corresponding attributes
Definition: generalized_clutch.cc:207
void calclaSize(int j) override
calculates size of contact force parameters
Definition: generalized_clutch.cc:165
basic friction force law on velocity level for constraint description
Definition: friction_impact_law.h:32
InitStage
The stages of the initialization.
Definition: element.h:64
basic friction force law on acceleration level for constraint description
Definition: friction_force_law.h:32
void init(InitStage stage, const InitConfigSet &config) override
plots time series header
Definition: generalized_clutch.cc:104
Definition: contact_kinematics.h:32
std::string name
name of element
Definition: element.h:262
bool isSetValued() const override
asks the link if it contains force laws that contribute to the lagrange multiplier and is therefore s...
Definition: generalized_clutch.cc:43
void calcgSize(int j) override
calculates size of relative distances
Definition: generalized_clutch.cc:177
bool isSingleValued() const override
asks the link if it contains single valued force laws that contribute to the right-hand side vector h
Definition: generalized_clutch.h:57
void plot() override
plots time dependent data
Definition: generalized_clutch.cc:130
void checkConstraintsForTermination() override
verify underlying force laws concerning given tolerances
Definition: generalized_clutch.cc:381
void updaterFactors() override
update relaxation factors for contact equations
Definition: generalized_clutch.cc:325
void calcsvSize() override
calculates size of stopvector (root function for event driven integration)
Definition: generalized_clutch.cc:202
void calcrFactorSize(int j) override
calculates size of rfactors
Definition: generalized_clutch.cc:194
void solveImpactsFixpointSingle() override
Definition: generalized_clutch.cc:364
namespace MBSim
Definition: bilateral_constraint.cc:29