OGS
LinearElasticIsotropicPhaseField.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
5
7{
9 int const i, int const j,
10 Eigen::Matrix<double, 3, 1> const& principal_strain)
11{
12 if (i == j)
13 {
14 return 0.0;
15 }
16 if (std::fabs(principal_strain[i] - principal_strain[j]) <
17 std::numeric_limits<double>::epsilon())
18 {
19 return 2 * heaviside(principal_strain[i]);
20 }
21 return 2 *
22 (macaulayTensile(principal_strain[i]) -
23 macaulayTensile(principal_strain[j])) /
24 (principal_strain[i] - principal_strain[j]);
25}
26
28 int const i, int const j,
29 Eigen::Matrix<double, 3, 1> const& principal_strain)
30{
31 if (i == j)
32 {
33 return 0.0;
34 }
35 double num_zero = 1.e-14;
36
37 if (std::fabs(principal_strain[i] - principal_strain[j]) < num_zero)
38 {
39 return 2 * (1 - heaviside(principal_strain[i]));
40 }
41 return 2 *
42 (macaulayCompressive(principal_strain[i]) -
43 macaulayCompressive(principal_strain[j])) /
44 (principal_strain[i] - principal_strain[j]);
45}
46
63
64template <>
68{
70
71 result(0, 0) = A(0) * B(0);
72 result(0, 1) = result(1, 0) = A(3) * B(3) / 2.;
73 result(0, 2) = result(2, 0) = A(5) * B(5) / 2.;
74 result(0, 3) = result(3, 0) = (A(0) * B(3) + A(3) * B(0)) / 2;
75 result(0, 4) = result(4, 0) =
76 (A(3) * B(5) + A(5) * B(3)) / (2. * std::sqrt(2.));
77 result(0, 5) = result(5, 0) = (A(0) * B(5) + A(5) * B(0)) / 2;
78
79 result(1, 1) = A(1) * B(1);
80 result(1, 2) = result(2, 1) = A(4) * B(4) / 2.;
81 result(1, 3) = result(3, 1) = (A(1) * B(3) + A(3) * B(1)) / 2.;
82 result(1, 4) = result(4, 1) = (A(1) * B(4) + A(4) * B(1)) / 2.;
83 result(1, 5) = result(5, 1) =
84 (A(3) * B(4) + A(4) * B(3)) / (2. * std::sqrt(2.));
85
86 result(2, 2) = A(2) * B(2);
87 result(2, 3) = result(3, 2) =
88 (A(4) * B(5) + A(5) * B(4)) / (2. * std::sqrt(2.));
89 result(2, 4) = result(4, 2) = (A(2) * B(4) + A(4) * B(2)) / 2.;
90 result(2, 5) = result(5, 2) = (A(2) * B(5) + A(5) * B(2)) / 2.;
91
92 result(3, 3) = (A(0) * B(1) + A(1) * B(0) + A(3) * B(3)) / 2.;
93 result(3, 4) = result(4, 3) =
94 (A(3) * B(4) + A(4) * B(3)) / 4. +
95 (A(1) * B(5) + A(5) * B(1)) / (2. * std::sqrt(2.));
96 result(3, 5) = result(5, 3) =
97 (A(3) * B(5) + A(5) * B(3)) / 4. +
98 (A(0) * B(4) + A(4) * B(0)) / (2. * std::sqrt(2.));
99
100 result(4, 4) = (A(1) * B(2) + A(2) * B(1) + A(4) * B(4)) / 2.;
101 result(4, 5) = result(5, 4) =
102 (A(4) * B(5) + A(5) * B(4)) / 4. +
103 (A(2) * B(3) + A(3) * B(2)) / (2. * std::sqrt(2.));
104
105 result(5, 5) = (A(0) * B(2) + A(2) * B(0) + A(5) * B(5)) / 2.;
106 return result;
107}
108
109template <>
113{
115
116 result(0, 0) = A(0) * B(0);
117 result(0, 1) = result(1, 0) = A(3) * B(3) / 2.;
118 result(0, 2) = result(2, 0) = 0;
119 result(0, 3) = result(3, 0) = (A(0) * B(3) + A(3) * B(0)) / 2;
120
121 result(1, 1) = A(1) * B(1);
122 result(1, 2) = result(2, 1) = 0;
123 result(1, 3) = result(3, 1) = (A(1) * B(3) + A(3) * B(1)) / 2.;
124
125 result(2, 2) = A(2) * B(2);
126 result(2, 3) = result(3, 2) = 0;
127
128 result(3, 3) = (A(0) * B(1) + A(1) * B(0) + A(3) * B(3)) / 2.;
129
130 return result;
131}
132
133} // namespace MaterialLib::Solids::Phasefield
MathLib::KelvinVector::KelvinMatrixType< 3 > aOdotB< 3 >(MathLib::KelvinVector::KelvinVectorType< 3 > const &A, MathLib::KelvinVector::KelvinVectorType< 3 > const &B)
double evaluateHCompSpectral(int const i, int const j, Eigen::Matrix< double, 3, 1 > const &principal_strain)
MathLib::KelvinVector::KelvinMatrixType< 2 > aOdotB< 2 >(MathLib::KelvinVector::KelvinVectorType< 2 > const &A, MathLib::KelvinVector::KelvinVectorType< 2 > const &B)
double evaluateHTensSpectral(int const i, int const j, Eigen::Matrix< double, 3, 1 > const &principal_strain)
H terms in the Spectral decomposition:
Eigen::Matrix< double, kelvin_vector_dimensions(DisplacementDim), 1, Eigen::ColMajor > KelvinVectorType
Eigen::Matrix< double, kelvin_vector_dimensions(DisplacementDim), kelvin_vector_dimensions(DisplacementDim), Eigen::RowMajor > KelvinMatrixType