OGS
CreepBGRa.cpp
Go to the documentation of this file.
1
12#include "CreepBGRa.h"
13
14#include <Eigen/LU>
15#include <limits>
16
19
20namespace MPL = MaterialPropertyLib;
21
22namespace MaterialLib
23{
24namespace Solids
25{
26namespace Creep
27{
28double getCreepConstantCoefficient(const double A, const double n,
29 const double sigma0)
30{
31 return A * std::pow(1.5, 0.5 * (1 + n)) / std::pow(sigma0, n);
32}
33
34template <int DisplacementDim>
35std::optional<std::tuple<typename CreepBGRa<DisplacementDim>::KelvinVector,
36 std::unique_ptr<typename MechanicsBase<
37 DisplacementDim>::MaterialStateVariables>,
40 MaterialPropertyLib::VariableArray const& variable_array_prev,
41 MaterialPropertyLib::VariableArray const& variable_array, double const t,
42 ParameterLib::SpatialPosition const& x, double const dt,
44 /*material_state_variables*/) const
45{
46 auto const& eps_m = std::get<MPL::SymmetricTensor<DisplacementDim>>(
47 variable_array.mechanical_strain);
48 auto const& eps_m_prev = std::get<MPL::SymmetricTensor<DisplacementDim>>(
49 variable_array_prev.mechanical_strain);
50 auto const& sigma_prev = std::get<MPL::SymmetricTensor<DisplacementDim>>(
51 variable_array_prev.stress);
52 auto const T = variable_array_prev.temperature;
53
55
56 Eigen::FullPivLU<Eigen::Matrix<double, KelvinVectorSize, KelvinVectorSize,
57 Eigen::RowMajor>>
58 linear_solver;
59
60 const auto C = this->getElasticTensor(t, x, T);
61 KelvinVector sigma_try = sigma_prev + C * (eps_m - eps_m_prev);
62
63 auto const& deviatoric_matrix = Invariants::deviatoric_projection;
64
65 double const norm_s_try =
66 Invariants::FrobeniusNorm(deviatoric_matrix * sigma_try);
67 // In case |s_{try}| is zero and _n < 3 (rare case).
68 if (norm_s_try < std::numeric_limits<double>::epsilon() * C(0, 0))
69 {
70 return {std::make_tuple(sigma_try, createMaterialStateVariables(), C)};
71 }
72
73 ResidualVectorType solution = sigma_try;
74
75 const double A = _a(t, x)[0];
76 const double n = _n(t, x)[0];
77 const double sigma0 = _sigma_f(t, x)[0];
78 const double Q = _q(t, x)[0];
79
80 const double constant_coefficient =
81 getCreepConstantCoefficient(A, n, sigma0);
82
83 const double b =
84 dt * constant_coefficient *
86
87 double const G2b = 2.0 * b * this->_mp.mu(t, x);
88
89 auto const update_jacobian = [&solution, &G2b, &n](JacobianMatrix& jacobian)
90 {
91 auto const& D = Invariants::deviatoric_projection;
92 KelvinVector const s_n1 = D * solution;
93 double const norm_s_n1 = Invariants::FrobeniusNorm(s_n1);
94 double const pow_norm_s_n1_n_minus_one_2b_G =
95 G2b * std::pow(norm_s_n1, n - 1);
96 jacobian = KelvinMatrix::Identity() +
97 (pow_norm_s_n1_n_minus_one_2b_G * D +
98 (n - 1) * G2b * std::pow(norm_s_n1, n - 3) * s_n1 *
99 s_n1.transpose());
100 };
101
102 auto const update_residual =
103 [&solution, &G2b, &n, &sigma_try](ResidualVectorType& r)
104 {
105 KelvinVector const s_n1 = Invariants::deviatoric_projection * solution;
106 double const norm_s_n1 = Invariants::FrobeniusNorm(s_n1);
107 double const pow_norm_s_n1_n_minus_one_2b_G =
108 G2b * std::pow(norm_s_n1, n - 1);
109 r = solution - sigma_try + pow_norm_s_n1_n_minus_one_2b_G * s_n1;
110 };
111
112 auto const update_solution = [&](ResidualVectorType const& increment)
113 { solution += increment; };
114
115 auto newton_solver =
116 NumLib::NewtonRaphson(linear_solver, update_jacobian, update_residual,
117 update_solution, _nonlinear_solver_parameters);
118
119 JacobianMatrix jacobian;
120 auto const success_iterations = newton_solver.solve(jacobian);
121
122 if (!success_iterations)
123 {
124 return {};
125 }
126
127 // If *success_iterations>0, tangentStiffness = J_(sigma)^{-1}C
128 // where J_(sigma) is the Jacobian of the last local Newton-Raphson
129 // iteration, which is already LU decomposed.
130 KelvinMatrix tangentStiffness =
131 (*success_iterations == 0) ? C : linear_solver.solve(C);
132
133 return {std::make_tuple(solution, createMaterialStateVariables(),
134 tangentStiffness)};
135}
136
137template <int DisplacementDim>
139 double const t, double const dt, ParameterLib::SpatialPosition const& x,
140 double const T, double const deviatoric_stress_norm) const
141{
142 const double A = _a(t, x)[0];
143 const double n = _n(t, x)[0];
144 const double sigma0 = _sigma_f(t, x)[0];
145 const double Q = _q(t, x)[0];
146
147 const double constant_coefficient =
148 getCreepConstantCoefficient(A, n, sigma0);
149
150 return 2.0 * constant_coefficient *
151 std::exp(-Q /
153 this->_mp.mu(t, x) * std::pow(deviatoric_stress_norm, n - 1) * dt *
155}
156
157template class CreepBGRa<2>;
158template class CreepBGRa<3>;
159
160} // namespace Creep
161} // namespace Solids
162} // namespace MaterialLib
A class for computing the BGRa creep model, which reads.
Definition CreepBGRa.h:40
Eigen::Matrix< double, KelvinVectorSize, KelvinVectorSize, Eigen::RowMajor > JacobianMatrix
Definition CreepBGRa.h:44
Eigen::Matrix< double, KelvinVectorSize, 1 > ResidualVectorType
Definition CreepBGRa.h:43
MathLib::KelvinVector::KelvinMatrixType< DisplacementDim > KelvinMatrix
Definition CreepBGRa.h:49
MathLib::KelvinVector::KelvinVectorType< DisplacementDim > KelvinVector
Definition CreepBGRa.h:47
double getTemperatureRelatedCoefficient(double const t, double const dt, ParameterLib::SpatialPosition const &x, double const T, double const deviatoric_stress_norm) const override
std::optional< std::tuple< KelvinVector, std::unique_ptr< typename MechanicsBase< DisplacementDim >::MaterialStateVariables >, KelvinMatrix > > integrateStress(MaterialPropertyLib::VariableArray const &variable_array_prev, MaterialPropertyLib::VariableArray const &variable_array, double const t, ParameterLib::SpatialPosition const &x, double const dt, typename MechanicsBase< DisplacementDim >::MaterialStateVariables const &material_state_variables) const override
Definition CreepBGRa.cpp:39
double getCreepConstantCoefficient(const double A, const double n, const double sigma0)
Definition CreepBGRa.cpp:28