Itasca C++ Interface
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
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#include "shared/src/vector.h"
12
13#ifndef __GNUC__
14#pragma warning(push)
15#pragma warning(disable : 4251)
16#endif
17
18namespace itascaxd {
19 class IContactMechanical;
20 class IContactThermal;
21 class IContactFluid;
22} // namespace itascaxd
23
24namespace cmodelsxd {
25 using namespace itasca;
26 using namespace itascaxd;
27
28 class ContactModelThermalState;
29 class ContactModelFluidState;
37 public:
43 virtual const IContactMechanical* getMechanicalContact() const = 0;
45 virtual const IContact* getContact() const = 0;
46
51 DVect2 end1Curvature_ = DVect2(0.0);
52 DVect2 end2Curvature_ = DVect2(0.0);
53 double inertialMass_ = 0.0;
55 double gap_ = 0.0;
56 double maxConvergence_ = 0.0;
57 double end1Volume_ = 0.0;
58 double end2Volume_ = 0.0;
59#ifdef THREED
60 std::array<double,6> end1Stress_ = {0,0,0,0,0,0};
61 std::array<double,6> end2Stress_ = {0,0,0,0,0,0};
62#else
63 std::array<double,3> end1Stress_ = {0,0,0};
64 std::array<double,3> end2Stress_ = {0,0,0};
65#endif
66 bool canFail_ = true;
67 };
68
74 class CONTACTMODEL_EXPORT ContactModelMechanical : public ContactModel,
75 public IContactModelMechanical {
76 public:
79
81 ~ContactModelMechanical() override;
82
84 int getIndex() const override { throw Exception("Not at this level"); };
85 void setIndex(int) override { throw Exception("Not at this level");};
86 double getActivityDistance() const override { throw Exception("Not at this level");};
87 void resetForcesAndMoments() override { throw Exception("Not at this level");};
88 void setForce(const DVect &,IContact *) override {throw Exception("Not at this level");};
89 void setArea(const double &) override {throw Exception("Not at this level");};
90 double getArea() const override {throw Exception("Not at this level");};
91
92
94 static const char* getPluginPrefix() { return "contactmodelmechanical"; }
95
97 static const char* getPluginDirectory() { return "contactmodels/mechanical"; }
98
99 // IContactModel overrides
100
102 bool isOKToDelete() const override { return true; }
103
104 // IContactModelMechanical functions.
105
107 ContactModel* getContactModel() override { return this; }
108
110 const ContactModel* getContactModel() const override { return this; }
111
113 virtual bool checkActivity(const double&) { return false; }
114
116 bool isSliding() const override { return false; }
117
119 bool isBonded() const override { return false; }
120
122 void unbond() override {}
123
125 bool hasNormal() const override { return false; };
126
128 DVect3 getNormal() const override { return DVect3(0.0); }
129
131 void setPorePressure(const double&) override {
132 throw Exception("The contact model does not support pore pressures.");
133 }
134
136 void propagateStateInformation(IContactModelMechanical*,
137 [[maybe_unused]] const CAxes& n = CAxes(),
138 [[maybe_unused]] const CAxes& l = CAxes()) override {}
139
142 virtual bool endPropertyUpdated(const QString& name, const IContactMechanical* c) = 0;
143
145 virtual bool validate(ContactModelMechanicalState* state, const double& timestep) = 0;
146
150 ContactModelMechanicalState* state, const double& timestep) = 0;
151
154 IContactThermal*, const double&) {
155 return false;
156 }
157
161 virtual DVect2 getTimestepLimits(ContactModelMechanicalState*, const double&) const {
162 return DVect2(0.0, limits<double>::max());
163 }
164
166 virtual DVect2 getEffectiveTranslationalStiffness() const { return DVect2(0.0, 0.0); }
167
169 virtual DAVect getEffectiveRotationalStiffness() const { return DAVect(0.0); }
170
172 void getSphereList(const IContact*, std::vector<DVect>*, std::vector<double>*,
173 std::vector<double>*) override {}
174#ifdef THREED
175
177 void getDiskList(const IContact*, std::vector<DVect>*, std::vector<DVect>*,
178 std::vector<double>*, std::vector<double>*) override {}
179#endif
180
182 void getCylinderList(const IContact*, std::vector<DVect>*, std::vector<DVect>*,
183 std::vector<double>*, std::vector<double>*, std::vector<double>*) override {}
184
186 virtual DVect getForce() const { return DVect(0.0); }
187
190 virtual DAVect getMomentOn1(const IContactMechanical*) const { return DAVect(0.0); }
191
194 virtual DAVect getMomentOn2(const IContactMechanical*) const { return DAVect(0.0); }
195
197 virtual DAVect getModelMomentOn1() const { return DAVect(0.0); }
198
200 virtual DAVect getModelMomentOn2() const { return DAVect(0.0); }
201
202 ContactModelMechanical *clone() const override { throw Exception("Must be reimplemented."); }
203
207 const ContactModelMechanical & operator=(const ContactModelMechanical &) { return *this; }
209 virtual void addToStorage(poly::vector<ContactModelMechanical> *,int = -1) { throw std::runtime_error("Base method called."); }
210
211 };
212} // namespace cmodelsxd
213
214#ifndef __GNUC__
215#pragma warning(pop)
216#endif
217
218// 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
Contact model implementation.
Definition contactmodel.h:80
Mechanical contact model implementation.
Definition contactmodelmechanical.h:75
void propagateStateInformation(IContactModelMechanical *, const CAxes &n=CAxes(), const CAxes &l=CAxes()) override
Default implementation - state information is not propagated.
Definition contactmodelmechanical.h:136
virtual DAVect getMomentOn1(const IContactMechanical *) const
Definition contactmodelmechanical.h:190
virtual bool checkActivity(const double &)
Default implementation - the contact is not active.
Definition contactmodelmechanical.h:113
bool isOKToDelete() const override
Generic implementation - by default it is always OK to delete a contact.
Definition contactmodelmechanical.h:102
ContactModelMechanical * clone() const override
Make a clone of this contact model. Must be implemeted.
Definition contactmodelmechanical.h:202
ContactModelMechanical(const ContactModelMechanical &) noexcept
Copy constructor.
Definition contactmodelmechanical.h:205
int getIndex() const override
Overrides so that the class is not abstract.
Definition contactmodelmechanical.h:84
virtual DAVect getEffectiveRotationalStiffness() const
Return the effective rotational stiffness - used for timestep calculation.
Definition contactmodelmechanical.h:169
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:153
virtual DVect2 getTimestepLimits(ContactModelMechanicalState *, const double &) const
Definition contactmodelmechanical.h:161
bool isBonded() const override
Default implementation - the contact model is not bonded.
Definition contactmodelmechanical.h:119
void unbond() override
Default implementation - the contact model is not bonded.
Definition contactmodelmechanical.h:122
virtual DAVect getModelMomentOn1() const
Return the moment on 1 that the contact model holds, not including any torque.
Definition contactmodelmechanical.h:197
virtual DVect2 getEffectiveTranslationalStiffness() const
Return the effective translational stiffness - used for timestep calculation.
Definition contactmodelmechanical.h:166
virtual DVect getForce() const
Return the total force that the contact model holds.
Definition contactmodelmechanical.h:186
virtual void addToStorage(poly::vector< ContactModelMechanical > *, int=-1)
For polymorphic container access.
Definition contactmodelmechanical.h:209
virtual DAVect getMomentOn2(const IContactMechanical *) const
Definition contactmodelmechanical.h:194
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:172
virtual DAVect getModelMomentOn2() const
Return the moment on 2 that the contact model holds, not including any torque.
Definition contactmodelmechanical.h:200
void setPorePressure(const double &) override
Default implementation - throws an exception if contact model doesn't support it.
Definition contactmodelmechanical.h:131
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:182
DVect3 getNormal() const override
Default implementation - the contact model normal is the 0 vector.
Definition contactmodelmechanical.h:128
bool hasNormal() const override
Default implementation - the contact model has no normal.
Definition contactmodelmechanical.h:125
ContactModel * getContactModel() override
Return the IContactModel pointer.
Definition contactmodelmechanical.h:107
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:116
const ContactModel * getContactModel() const override
Return the const IContactModel pointer.
Definition contactmodelmechanical.h:110
static const char * getPluginDirectory()
Directory for this type of plugin.
Definition contactmodelmechanical.h:97
const ContactModelMechanical & operator=(const ContactModelMechanical &)
Assignment operator.
Definition contactmodelmechanical.h:207
static const char * getPluginPrefix()
Prefix for this type of plugin.
Definition contactmodelmechanical.h:94
The ContactModelMechnicalState class holds necessary information to communicate back and forth betwee...
Definition contactmodelmechanical.h:36
std::array< double, 3 > end1Stress_
stress on end1
Definition contactmodelmechanical.h:63
~ContactModelMechanicalState() override
Destructor.
Definition contactmodelmechanical.h:41
DVect2 end1Curvature_
principal curvatures of end1 (min,max)
Definition contactmodelmechanical.h:51
DVect relativeTranslationalIncrement_
Definition contactmodelmechanical.h:47
ContactModelMechanicalState()
Constructor.
Definition contactmodelmechanical.h:39
DAVect relativeAngularIncrement_
current relative angular displacement increment
Definition contactmodelmechanical.h:50
double gap_
current contact gap
Definition contactmodelmechanical.h:55
virtual const IContact * getContact() const =0
Return a const pointer to the IContact interface.
bool canFail_
failure should be discarded
Definition contactmodelmechanical.h:66
DVect2 end2Curvature_
principal curvatures of end2 (min,max)
Definition contactmodelmechanical.h:52
double maxConvergence_
maximum convergence of the pieces
Definition contactmodelmechanical.h:56
CAxes axes_
contact axis system
Definition contactmodelmechanical.h:49
virtual const IContactMechanical * getMechanicalContact() const =0
Return a const pointer to the IContactMechanical interface.
double end2Volume_
volume of end2
Definition contactmodelmechanical.h:58
double end1Volume_
volume of end1
Definition contactmodelmechanical.h:57
double inertialMass_
Definition contactmodelmechanical.h:53
The ContactModelState class holds necessary information to communicate back and forth between the cod...
Definition contactmodel.h:48
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:14
Itasca Library standard namespace, specific to 2D or 3D.
Definition icontactmodule.h:4