Itasca C++ Interface
Loading...
Searching...
No Matches
contactmodelmechanical.h
Go to the documentation of this file.
1#pragma once
2// contactmodelmechanical.h
9#include "contactmodel.h"
10#include "contactmodel/interface/icontactmodelmechanical.h"
11
12#ifndef __GNUC__
13#pragma warning(push)
14#pragma warning(disable : 4251)
15#endif
16
17namespace itascaxd {
18 class IContactMechanical;
19 class IContactThermal;
20 class IContactFluid;
21} // namespace itascaxd
22
23namespace cmodelsxd {
24 using namespace itasca;
25 using namespace itascaxd;
26
27 class ContactModelThermalState;
28 class ContactModelFluidState;
36 public:
39 : // force_(0.0)
40 //, momentOn1_(0.0)
41 //, momentOn2_(0.0)
43 end1Curvature_(0.0), end2Curvature_(0.0), inertialMass_(0.0), gap_(0.0),
44 canFail_(true) {}
45
49 virtual const IContactMechanical* getMechanicalContact() const = 0;
51 virtual const IContact* getContact() const = 0;
52
53 // DVect force_; ///< current total force at this contact
54 // (computed by the contact model) DAVect momentOn1_; ///<
55 // moment applied to end1 DAVect momentOn2_; ///< moment applied
56 // to end2
64 double gap_;
65 bool canFail_;
66 };
67
73 class CONTACTMODEL_EXPORT ContactModelMechanical : public ContactModel,
74 public IContactModelMechanical {
75 public:
78
80 ~ContactModelMechanical() override;
81
83 static const char* getPluginPrefix() { return "contactmodelmechanical"; }
84
86 static const char* getPluginDirectory() { return "contactmodels/mechanical"; }
87
88 // IContactModel overrides
89
91 bool isOKToDelete() const override { return true; }
92
93 // IContactModelMechanical functions.
94
96 ContactModel* getContactModel() override { return this; }
97
99 const ContactModel* getContactModel() const override { return this; }
100
102 virtual bool checkActivity(const double&) { return false; }
103
105 bool isSliding() const override { return false; }
106
108 bool isBonded() const override { return false; }
109
111 void unbond() override {}
112
114 bool hasNormal() const override { return false; };
115
117 DVect3 getNormal() const override { return DVect3(0.0); }
118
120 void setPorePressure(const double&) override {
121 throw Exception("The contact model does not support pore pressures.");
122 }
123
125 void propagateStateInformation(IContactModelMechanical*,
126 [[maybe_unused]] const CAxes& n = CAxes(),
127 [[maybe_unused]] const CAxes& l = CAxes()) override {}
128
131 virtual bool endPropertyUpdated(const QString& name, const IContactMechanical* c) = 0;
132
134 virtual bool validate(ContactModelMechanicalState* state, const double& timestep) = 0;
135
139 ContactModelMechanicalState* state, const double& timestep) = 0;
140
143 IContactThermal*, const double&) {
144 return false;
145 }
148 ContactModelFluidState*, const double&) {
149 return false;
150 }
151
155 virtual DVect2 getTimestepLimits(ContactModelMechanicalState*, const double&) const {
156 return DVect2(0.0, limits<double>::max());
157 }
158
160 virtual DVect2 getEffectiveTranslationalStiffness() const { return DVect2(0.0, 0.0); }
161
163 virtual DAVect getEffectiveRotationalStiffness() const { return DAVect(0.0); }
164
166 void getSphereList(const IContact*, std::vector<DVect>*, std::vector<double>*,
167 std::vector<double>*) override {}
168#ifdef THREED
169
171 void getDiskList(const IContact*, std::vector<DVect>*, std::vector<DVect>*,
172 std::vector<double>*, std::vector<double>*) override {}
173#endif
174
176 void getCylinderList(const IContact*, std::vector<DVect>*, std::vector<DVect>*,
177 std::vector<double>*, std::vector<double>*, std::vector<double>*) override {}
178
180 virtual DVect getForce(const IContactMechanical*) const { return DVect(0.0); }
181
183 virtual DAVect getMomentOn1(const IContactMechanical*) const { return DAVect(0.0); }
184
186 virtual DAVect getMomentOn2(const IContactMechanical* c) const { return getMomentOn1(c); }
187
188 ContactModelMechanical* clone() const override {
189 throw Exception("Must be reimplemented.");
190 };
191 };
192} // namespace cmodelsxd
193
194#ifndef __GNUC__
195#pragma warning(pop)
196#endif
197
198// EoF
Class for specifying a particular 3D cartesian axes system, and converting to and from it.
Definition caxes.h:103
Base exception class for all Itasca code.
Definition baseexception.h:10
Definition contactmodelfluid.h:20
Contact model implementation.
Definition contactmodel.h:77
Mechanical contact model implementation.
Definition contactmodelmechanical.h:74
void propagateStateInformation(IContactModelMechanical *, const CAxes &n=CAxes(), const CAxes &l=CAxes()) override
Default implementation - state information is not propagated.
Definition contactmodelmechanical.h:125
virtual DAVect getMomentOn1(const IContactMechanical *) const
Return the total moment on 1 that the contact model holds.
Definition contactmodelmechanical.h:183
virtual bool checkActivity(const double &)
Default implementation - the contact is not active.
Definition contactmodelmechanical.h:102
bool isOKToDelete() const override
Generic implementation - by default it is always OK to delete a contact.
Definition contactmodelmechanical.h:91
ContactModelMechanical * clone() const override
Make a clone of this contact model. Must be implemeted.
Definition contactmodelmechanical.h:188
virtual DAVect getEffectiveRotationalStiffness() const
Return the effective rotational stiffness - used for timestep calculation.
Definition contactmodelmechanical.h:163
virtual bool validate(ContactModelMechanicalState *state, const double &timestep)=0
Returns true if contact is valid. Must be implemented.
virtual bool thermalCoupling(ContactModelMechanicalState *, ContactModelThermalState *, IContactThermal *, const double &)
Used for explicit mechanical/thermal coupling. Returns true if anything changed.
Definition contactmodelmechanical.h:142
virtual DVect2 getTimestepLimits(ContactModelMechanicalState *, const double &) const
Definition contactmodelmechanical.h:155
bool isBonded() const override
Default implementation - the contact model is not bonded.
Definition contactmodelmechanical.h:108
void unbond() override
Default implementation - the contact model is not bonded.
Definition contactmodelmechanical.h:111
virtual DVect2 getEffectiveTranslationalStiffness() const
Return the effective translational stiffness - used for timestep calculation.
Definition contactmodelmechanical.h:160
virtual DAVect getMomentOn2(const IContactMechanical *c) const
Return the total moment on 2 that the contact model holds.
Definition contactmodelmechanical.h:186
virtual bool forceDisplacementLaw(ContactModelMechanicalState *state, const double &timestep)=0
void getSphereList(const IContact *, std::vector< DVect > *, std::vector< double > *, std::vector< double > *) override
Default implementation so that no sphere list must be defined.
Definition contactmodelmechanical.h:166
void setPorePressure(const double &) override
Default implementation - throws an exception if contact model doesn't support it.
Definition contactmodelmechanical.h:120
void getCylinderList(const IContact *, std::vector< DVect > *, std::vector< DVect > *, std::vector< double > *, std::vector< double > *, std::vector< double > *) override
Default implementation so that no cylinder list must be defined.
Definition contactmodelmechanical.h:176
DVect3 getNormal() const override
Default implementation - the contact model normal is the 0 vector.
Definition contactmodelmechanical.h:117
bool hasNormal() const override
Default implementation - the contact model has no normal.
Definition contactmodelmechanical.h:114
ContactModel * getContactModel() override
Return the IContactModel pointer.
Definition contactmodelmechanical.h:96
virtual bool endPropertyUpdated(const QString &name, const IContactMechanical *c)=0
bool isSliding() const override
Default implementation - the contact model is not sliding.
Definition contactmodelmechanical.h:105
const ContactModel * getContactModel() const override
Return the const IContactModel pointer.
Definition contactmodelmechanical.h:99
virtual bool coupling(ContactModelMechanicalState *, ContactModelThermalState *, ContactModelFluidState *, const double &)
Used for explicit mechanical/fluid/thermal coupling. Returns true if anything changed.
Definition contactmodelmechanical.h:147
static const char * getPluginDirectory()
Directory for this type of plugin.
Definition contactmodelmechanical.h:86
virtual DVect getForce(const IContactMechanical *) const
Return the total force that the contact model holds.
Definition contactmodelmechanical.h:180
static const char * getPluginPrefix()
Prefix for this type of plugin.
Definition contactmodelmechanical.h:83
The ContactModelMechnicalState class holds necessary information to communicate back and forth betwee...
Definition contactmodelmechanical.h:35
~ContactModelMechanicalState() override
Destructor.
Definition contactmodelmechanical.h:47
DVect2 end1Curvature_
principal curvatures of end1 (min,max)
Definition contactmodelmechanical.h:60
DVect relativeTranslationalIncrement_
Definition contactmodelmechanical.h:57
ContactModelMechanicalState()
Constructor.
Definition contactmodelmechanical.h:38
DAVect relativeAngularIncrement_
current relative angular displacement increment
Definition contactmodelmechanical.h:59
double gap_
current contact gap
Definition contactmodelmechanical.h:64
virtual const IContact * getContact() const =0
Return a const pointer to the IContact interface.
bool canFail_
failure should be discarded
Definition contactmodelmechanical.h:65
DVect2 end2Curvature_
principal curvatures of end2 (min,max)
Definition contactmodelmechanical.h:61
virtual const IContactMechanical * getMechanicalContact() const =0
Return a const pointer to the IContactMechanical interface.
double inertialMass_
Definition contactmodelmechanical.h:62
The ContactModelState class holds necessary information to communicate back and forth between the cod...
Definition contactmodel.h:45
Definition contactmodelthermal.h:23
Contact class.
Definition icontact.h:33
ContactMechanical class.
Definition icontactmechanical.h:37
ContactThermal class.
Definition icontactthermal.h:36
debug checked shorthand for std::numeric_limits<T>::
Definition limit.h:25
Contact model class.
CAxes3D CAxes
Compact axis system, either 2D or 3D.
Definition dim.h:165
DVect3 DVect
Vector of doubles, either 2D or 3D.
Definition dim.h:154
DAVect3 DAVect
Angular vector of doubles, either 2D or 3D.
Definition dim.h:162
namespace Itasca
Definition basememory.cpp:10
Itasca Library standard namespace, specific to 2D or 3D.
Definition icontactmodule.h:4