-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMaterials.h
232 lines (186 loc) · 8.26 KB
/
Materials.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
//
// Created by alhei on 2022/07/31.
//
#ifndef ALE_MATERIALS_H
#define ALE_MATERIALS_H
#include <deal.II/base/symmetric_tensor.h>
#include <deal.II/base/tensor.h>
#include <deal.II/physics/elasticity/kinematics.h>
#include <deal.II/physics/elasticity/standard_tensors.h>
using namespace dealii;
using namespace std;
template<unsigned int dim>
class Material {
public:
virtual Tensor<2, dim> tau(const Tensor<2, dim> &F) const = 0;
virtual Tensor<4, dim> jaumann_tangent(const Tensor<2, dim> &F) const = 0;
virtual void stress_and_tangent(const Tensor<2, dim> &F,
Tensor<2, dim> &tau,
Tensor<4, dim> &tangent) const = 0;
virtual void stress_and_tangent(const Tensor<2, dim> &F,
Tensor<2, dim> &tau,
SymmetricTensor<4, dim> &tangent) const = 0;
protected:
const SymmetricTensor<2, dim> I = Physics::Elasticity::StandardTensors<dim>::I;
const SymmetricTensor<4, dim> IotimesI = Physics::Elasticity::StandardTensors<dim>::IxI;
};
template<unsigned int dim>
class ElasticMaterial : public Material<dim> {
};
template<unsigned int dim>
class StVenantKirchhoff : public ElasticMaterial<dim> {
public:
explicit StVenantKirchhoff<dim>(double lambda_in = 52, double mu_in = 26);
Tensor<2, dim> tau(const Tensor<2, dim> &F) const;
Tensor<4, dim> jaumann_tangent(const Tensor<2, dim> &F) const;
void stress_and_tangent(const Tensor<2, dim> &F,
Tensor<2, dim> &tau,
Tensor<4, dim> &tangent) const;
void stress_and_tangent(const Tensor<2, dim> &F,
Tensor<2, dim> &tau,
SymmetricTensor<4, dim> &tangent) const;
private:
const double lambda;
const double mu;
array<unsigned int, dim> range;
};
template<unsigned int dim>
StVenantKirchhoff<dim>::StVenantKirchhoff(double lambda_in, double mu_in): lambda(lambda_in), mu(mu_in) {
iota(range.begin(), range.end(), 0);
}
template<unsigned int dim>
Tensor<2, dim> StVenantKirchhoff<dim>::tau(const Tensor<2, dim> &F) const {
Tensor<2, dim> B = F * transpose(F);
return (lambda * (trace(B) - (double) dim) / 2. - mu) * B
+ mu * B * B;
}
template<unsigned int dim>
Tensor<4, dim> StVenantKirchhoff<dim>::jaumann_tangent(const Tensor<2, dim> &F) const {
Tensor<4, dim> out;
Tensor<2, dim> B = F * transpose(F);
for (const auto &i: range)
for (const auto &j: range)
for (const auto &k: range)
for (const auto &l: range)
out[i][j][k][l] = lambda * B[i][j] * B[k][l] + 2 * mu * B[i][k] * B[j][l];
return out;
}
template<unsigned int dim>
void StVenantKirchhoff<dim>::stress_and_tangent(const Tensor<2, dim> &F,
Tensor<2, dim> &tau,
Tensor<4, dim> &tangent) const {
Tensor<2, dim> B = F * transpose(F);
tau = B * (lambda * (trace(B) - (double) dim) / 2. - mu) + mu * B * B;
for (const auto &i: range)
for (const auto &j: range)
for (const auto &k: range)
for (const auto &l: range)
tangent[i][j][k][l] = lambda * B[i][j] * B[k][l] + 2 * mu * B[i][k] * B[j][l];
}
template<unsigned int dim>
void StVenantKirchhoff<dim>::stress_and_tangent(const Tensor<2, dim> &F,
Tensor<2, dim> &tau,
SymmetricTensor<4, dim> &tangent) const {
Tensor<2, dim> B = F * transpose(F);
tau = B * (lambda * (trace(B) - (double) dim) / 2. - mu) + mu * B * B;
for (const auto &i: range)
for (const auto &j: range)
for (const auto &k: range)
for (const auto &l: range)
tangent[i][j][k][l] = lambda * B[i][j] * B[k][l] + 2 * mu * B[i][k] * B[j][l];
}
template<unsigned int dim>
class NeoHookIsoVol : public ElasticMaterial<dim> {
public:
explicit NeoHookIsoVol<dim>(double kap_in = 44.12e3, double mu_in = 16.92e3);
Tensor<2, dim> tau(const Tensor<2, dim> &F) const;
Tensor<4, dim> jaumann_tangent(const Tensor<2, dim> &F) const;
void stress_and_tangent(const Tensor<2, dim> &F,
Tensor<2, dim> &tau,
Tensor<4, dim> &tangent) const;
void stress_and_tangent(const Tensor<2, dim> &F,
Tensor<2, dim> &tau,
SymmetricTensor<4, dim> &tangent) const;
private:
// const double lambda;
const double kap;
const double mu;
// const SymmetricTensor<2, dim> IodotI = Physics::Elasticity::StandardTensors<dim>::;
array<unsigned int, dim> range;
};
template<unsigned int dim>
void NeoHookIsoVol<dim>::stress_and_tangent(const Tensor<2, dim> &F, Tensor<2, dim> &tau,
SymmetricTensor<4, dim> &tangent) const {
double J = determinant(F);
Tensor<2, dim> Fbar = pow(J, -1. / 3.) * F;
SymmetricTensor<2, dim> Bbar = symmetrize(Fbar * transpose(Fbar));
double I1bar = trace(Bbar);
// Tensor<2, dim> I = this->I;
SymmetricTensor<4, dim> IodotI;
IodotI = 0;
for (const auto &i: range)
for (const auto &j: range)
for (const auto &k: range)
for (const auto &l: range)
IodotI[i][j][k][l] += this->I[i][k] * this->I[j][l];
tau = mu * (Bbar - I1bar * this->I / 3.) + kap * (pow(J, 2) - 1) * this->I / 2.;
tangent = 2 * mu * (I1bar * IodotI / 3.
- (outer_product(this->I, Bbar) + outer_product(Bbar, this->I)) / 3.
+ I1bar * this->IotimesI / 9.);
tangent += kap * (J * J * (this->IotimesI - IodotI) + IodotI);
}
template<unsigned int dim>
void
NeoHookIsoVol<dim>::stress_and_tangent(const Tensor<2, dim> &F, Tensor<2, dim> &tau, Tensor<4, dim> &tangent) const {
double J = determinant(F);
Tensor<2, dim> Fbar = pow(J, -1. / 3.) * F;
SymmetricTensor<2, dim> Bbar = symmetrize(Fbar * transpose(Fbar));
double I1bar = trace(Bbar);
// Tensor<2, dim> I = this->I;
SymmetricTensor<4, dim> IodotI;
IodotI = 0;
for (const auto &i: range)
for (const auto &j: range)
for (const auto &k: range)
for (const auto &l: range)
IodotI[i][j][k][l] += this->I[i][k] * this->I[j][l];
tau = mu * (Bbar - I1bar * this->I / 3.) + kap * (pow(J, 2) - 1) * this->I / 2.;
tangent = 2 * mu * (I1bar * IodotI / 3.
- (outer_product(this->I, Bbar) + outer_product(Bbar, this->I)) / 3.
+ I1bar * this->IotimesI / 9.);
// tangent += kap * (J * J * (this->IotimesI - IodotI) + IodotI);
tangent = tangent + kap * (J * J * (this->IotimesI - IodotI) + IodotI);
}
template<unsigned int dim>
Tensor<4, dim> NeoHookIsoVol<dim>::jaumann_tangent(const Tensor<2, dim> &F) const {
double J = determinant(F);
Tensor<2, dim> Fbar = pow(J, -1. / 3.) * F;
SymmetricTensor<2, dim> Bbar = symmetrize(Fbar * transpose(Fbar));
double I1bar = trace(Bbar);
SymmetricTensor<4, dim> IodotI;
IodotI = 0;
for (const auto &i: range)
for (const auto &j: range)
for (const auto &k: range)
for (const auto &l: range)
IodotI[i][j][k][l] += this->I[i][k] * this->I[j][l];
SymmetricTensor<4, dim> tangent = 2 * mu * (I1bar * IodotI / 3.
- (outer_product(this->I, Bbar) + outer_product(Bbar, this->I)) / 3.
+ I1bar * this->IotimesI / 9.);
tangent += kap * (J * J * (this->IotimesI - IodotI) + IodotI);
return tangent;
}
template<unsigned int dim>
Tensor<2, dim> NeoHookIsoVol<dim>::tau(const Tensor<2, dim> &F) const {
double J = determinant(F);
Tensor<2, dim> Fbar = pow(J, -1. / 3.) * F;
SymmetricTensor<2, dim> Bbar = symmetrize(Fbar * transpose(Fbar));
double I1bar = trace(Bbar);
Tensor<2, dim> tau_val = mu * (Bbar - I1bar * this->I / 3.) + kap * (pow(J, 2) - 1) * this->I / 2.;
return tau_val;
}
template<unsigned int dim>
NeoHookIsoVol<dim>::NeoHookIsoVol(double kap_in, double mu_in): kap(kap_in), mu(mu_in) {
iota(range.begin(), range.end(), 0);
}
#endif //ALE_MATERIALS_H