PeriDyno 1.0.0
Loading...
Searching...
No Matches
CoSemiImplicitHyperelasticitySolver.h
Go to the documentation of this file.
1#pragma once
2#include "Peridynamics/Bond.h"
4#include "Topology/TriangleSet.h"
6
9
10namespace dyno
11{
12 template<typename TDataType> class ContactRule;
13
14 template<typename TDataType>
16 {
18
19 public:
20 typedef typename TDataType::Real Real;
21 typedef typename TDataType::Coord Coord;
22 typedef typename TDataType::Matrix Matrix;
23 typedef typename ::dyno::TBond<TDataType> Bond;
24
27
28 void solveElasticity() override;
29
30 void setObjectVolume(Real volume) { this->m_objectVolume = volume; m_objectVolumeSet = true; }
31 void setParticleVolume(Real volume) { this->m_particleVolume = volume; m_particleVolumeSet = true; }
32 void setContactMaxIte(int ite) {
33 if (this->mContactRule) {
34 (this->mContactRule)->setContactMaxIte(ite);
35 }
36 }
38
40
41 DEF_VAR(bool, NeighborSearchingAdjacent, true, "");
42
43 DEF_ARRAY_IN(Coord, RestNorm, DeviceType::GPU, "Vertex Rest Normal");
44
45 DEF_ARRAY_IN(Coord, Norm, DeviceType::GPU, "Vertex Normal");
46
47 DEF_ARRAY_IN(Coord, OldPosition, DeviceType::GPU, "");
48
49 DEF_ARRAY_IN(Attribute, Attribute, DeviceType::GPU, "Particle Attribute");
50
51 DEF_VAR_IN(Real, Unit, "mesh unit");
52
54
55 void setXi(Real xi_) {
56 this->xi = xi_;
57 mContactRule->varXi()->setValue(this->xi);
58 }
59
60 void setK_bend(Real k) {
61 Real k_old = this->k_bend;
62 if (k_old > EPSILON)
63 this->k_bend *= (k / k_old);
64 else
65 this->k_bend = k * this->E;
66 }
67
68 void setSelfContact(bool s_){
69 this->selfContact = s_;
70 }
71
72 Real getXi() { return this->xi; }
73
74 void setE(Real E_) {
75 Real E_old = this->E;
76 this->E = E_;
77 this->k_bend *= (this->E / E_old);
78 }
80 return this->E;
81 }
82 void setS(Real s_) {
83 this->s = s_;
84 mContactRule->varS()->setValue(this->s);
85 }
86
87 Real getS(Real E, Real nv) { return this->s; }
88
90 return 15 * E / (4 * (1 + nv)); //mu
91 }
92
94 return 9 * E * nv / (2 * (1 + nv) * (1 - 2 * nv)); //lambda
95 }
97 this->grad_res_eps = r;
98 }
99 void setAccelerated(bool acc_) {
100 this->acc = acc_;
101 }
102
103 public:
104 std::shared_ptr<ContactRule<TDataType>> getContactRulePtr() {
105 return mContactRule;
106 }
107 protected:
110
112
113 private:
115 Real E = 1e3;
116 Real k_bend = 0.0 * E;
117 Real s = 0.0;
118 Real xi = 0.1;
119 Real d = 1.0;
122
127
129
146
148
154 bool m_objectVolumeSet = false;
157 std::shared_ptr<ContactRule<TDataType>> mContactRule;
158 bool m_alphaCompute = true; // inversion control
159 bool selfContact = true;
160 bool acc = false;
161 };
162}
#define DECLARE_TCLASS(name, T1)
Definition Object.h:87
particle attribute 0x00000000: [31-30]material; [29]motion; [28]Dynamic; [27-8]undefined yet,...
Definition Attribute.h:26
DEF_ARRAY_IN(Attribute, Attribute, DeviceType::GPU, "Particle Attribute")
DEF_VAR_IN(EnergyModels< Real >, EnergyModels, "")
DEF_VAR(bool, NeighborSearchingAdjacent, true, "")
std::shared_ptr< ContactRule< TDataType > > mContactRule
std::shared_ptr< ContactRule< TDataType > > getContactRulePtr()
DEF_ARRAY_IN(Coord, OldPosition, DeviceType::GPU, "")
DEF_ARRAY_IN(Coord, Norm, DeviceType::GPU, "Vertex Normal")
DEF_VAR_IN(EnergyType, EnergyType, "")
DEF_ARRAY_IN(Coord, RestNorm, DeviceType::GPU, "Vertex Rest Normal")
DEF_INSTANCE_IN(TriangleSet< TDataType >, TriangularMesh, "")
This is an implementation of AdditiveCCD based on peridyno.
Definition Array.h:25
Array< T, DeviceType::GPU > DArray
Definition Array.inl:89
constexpr Real EPSILON
Definition Typedef.inl:42