OGS
Ehlers.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
14
15#pragma once
16
17#ifndef NDEBUG
18#include <iosfwd>
19#endif
20
21#include "BaseLib/Error.h"
23#include "MechanicsBase.h"
26
27namespace MaterialLib
28{
29namespace Solids
30{
31namespace Ehlers
32{
39inline TangentType makeTangentType(std::string const& s)
40{
41 if (s == "Elastic")
42 {
44 }
45 if (s == "PlasticDamageSecant")
46 {
48 }
49 if (s == "Plastic")
50 {
52 }
53 OGS_FATAL("Not valid string '{:s}' to create a tangent type from.", s);
54}
55
60{
62
63 MaterialPropertiesParameters(P const& G_, P const& K_, P const& alpha_,
64 P const& beta_, P const& gamma_,
65 P const& delta_, P const& epsilon_,
66 P const& m_, P const& alpha_p_,
67 P const& beta_p_, P const& gamma_p_,
68 P const& delta_p_, P const& epsilon_p_,
69 P const& m_p_, P const& kappa_,
70 P const& hardening_coefficient_)
71 : G(G_),
72 K(K_),
73 alpha(alpha_),
74 beta(beta_),
75 gamma(gamma_),
76 delta(delta_),
77 epsilon(epsilon_),
78 m(m_),
79 alpha_p(alpha_p_),
80 beta_p(beta_p_),
81 gamma_p(gamma_p_),
82 delta_p(delta_p_),
83 epsilon_p(epsilon_p_),
84 m_p(m_p_),
85 kappa(kappa_),
86 hardening_coefficient(hardening_coefficient_)
87 {
88 }
89 // basic material parameters
90 P const& G;
91 P const& K;
92
93 P const& alpha;
95 P const& beta;
96 P const& gamma;
97 P const& delta;
98 P const& epsilon;
99 P const& m;
100
101 P const& alpha_p;
102 P const& beta_p;
103 P const& gamma_p;
104 P const& delta_p;
105 P const& epsilon_p;
106 P const& m_p;
107
108 P const& kappa;
110};
111
119
123{
126 : G(mp.G(t, x)[0]),
127 K(mp.K(t, x)[0]),
128 alpha(mp.alpha(t, x)[0]),
129 beta(mp.beta(t, x)[0]),
130 gamma(mp.gamma(t, x)[0]),
131 delta(mp.delta(t, x)[0]),
132 epsilon(mp.epsilon(t, x)[0]),
133 m(mp.m(t, x)[0]),
134 alpha_p(mp.alpha_p(t, x)[0]),
135 beta_p(mp.beta_p(t, x)[0]),
136 gamma_p(mp.gamma_p(t, x)[0]),
137 delta_p(mp.delta_p(t, x)[0]),
138 epsilon_p(mp.epsilon_p(t, x)[0]),
139 m_p(mp.m_p(t, x)[0]),
140 kappa(mp.kappa(t, x)[0]),
142 {
143 }
144 double const G;
145 double const K;
146
147 double const alpha;
148 double const beta;
149 double const gamma;
150 double const delta;
151 double const epsilon;
152 double const m;
153
154 double const alpha_p;
155 double const beta_p;
156 double const gamma_p;
157 double const delta_p;
158 double const epsilon_p;
159 double const m_p;
160
161 double const kappa;
163};
164
168{
169 DamageProperties(double const t,
172 : alpha_d(dp.alpha_d(t, x)[0]),
173 beta_d(dp.beta_d(t, x)[0]),
174 h_d(dp.h_d(t, x)[0])
175 {
176 }
177 double const alpha_d;
178 double const beta_d;
179 double const h_d;
180};
181
182template <typename KelvinVector>
183struct PlasticStrain final
184{
185 PlasticStrain() : D(KelvinVector::Zero()) {}
186 PlasticStrain(KelvinVector eps_p_D_, double const eps_p_V_,
187 double const eps_p_eff_)
188 : D(std::move(eps_p_D_)), V(eps_p_V_), eff(eps_p_eff_){};
189
190 KelvinVector D;
191 double V = 0;
192 double eff = 0;
193
195};
196
197class Damage final
198{
199public:
200 Damage() = default;
201 Damage(double const kappa_d, double const value)
203 {
204 }
205
206 double kappa_d() const { return _kappa_d; }
207 double& kappa_d() { return _kappa_d; }
208 double value() const { return _value; }
209 double& value() { return _value; }
210
211private:
212 double _kappa_d = 0;
213 double _value = 0;
214};
215
216template <int DisplacementDim>
218 : public MechanicsBase<DisplacementDim>::MaterialStateVariables
219{
221 {
224 }
225
226 void pushBackState() override
227 {
230 }
231
232 double getEquivalentPlasticStrain() const override;
233
234 static int const KelvinVectorSize =
239
242
243 // Initial values from previous timestep
246
247#ifndef NDEBUG
248 friend std::ostream& operator<<(std::ostream& os,
250 {
251 os << "State:\n"
252 << "eps_p_D: " << m.eps_p.D << "\n"
253 << "eps_p_eff: " << m.eps_p.eff << "\n"
254 << "kappa_d: " << m.damage.kappa_d() << "\n"
255 << "damage: " << m.damage.value() << "\n"
256 << "eps_p_D_prev: " << m.eps_p_prev.D << "\n"
257 << "eps_p_eff_prev: " << m.eps_p_prev.eff << "\n"
258 << "kappa_d_prev: " << m.damage_prev.kappa_d() << "\n"
259 << "damage_prev: " << m.damage_prev.value() << "\n";
260 return os;
261 }
262#endif // NDEBUG
263
265};
266
267template <int DisplacementDim>
268class SolidEhlers final : public MechanicsBase<DisplacementDim>
269{
270public:
271 static int const KelvinVectorSize =
273 static int const JacobianResidualSize =
274 2 * KelvinVectorSize + 3; // 2 is the number of components in the
275 // jacobian/residual, not the space
276 // dimension. And 3 is for additional
277 // variables.
278 using ResidualVectorType = Eigen::Matrix<double, JacobianResidualSize, 1>;
279 using JacobianMatrix = Eigen::Matrix<double, JacobianResidualSize,
280 JacobianResidualSize, Eigen::RowMajor>;
281
282public:
283 std::unique_ptr<
286 {
287 return std::make_unique<StateVariables<DisplacementDim>>();
288 }
289
290public:
295
296public:
298 NumLib::NewtonRaphsonSolverParameters nonlinear_solver_parameters,
299 MaterialPropertiesParameters material_properties,
300 std::unique_ptr<DamagePropertiesParameters>&& damage_properties,
301 TangentType tangent_type);
302
304 double const /*t*/,
306 double const /*dt*/,
307 KelvinVector const& eps,
308 KelvinVector const& sigma,
310 material_state_variables) const override;
311
312 std::optional<std::tuple<KelvinVector,
313 std::unique_ptr<typename MechanicsBase<
314 DisplacementDim>::MaterialStateVariables>,
317 MaterialPropertyLib::VariableArray const& variable_array_prev,
318 MaterialPropertyLib::VariableArray const& variable_array,
319 double const t, ParameterLib::SpatialPosition const& x, double const dt,
321 material_state_variables) const override;
322
323 std::vector<typename MechanicsBase<DisplacementDim>::InternalVariable>
324 getInternalVariables() const override;
325
327 double const t, ParameterLib::SpatialPosition const& x) const
328 {
329 return MaterialProperties(t, x, _mp);
330 }
331
332 double getBulkModulus(double const t,
334 KelvinMatrix const* const /*C*/) const override
335 {
336 return _mp.K(t, x)[0];
337 }
338
340 double const t, ParameterLib::SpatialPosition const& x) const
341 {
343 }
344
345private:
347
349 std::unique_ptr<DamagePropertiesParameters> _damage_properties;
351};
352
353extern template class SolidEhlers<2>;
354extern template class SolidEhlers<3>;
355
356extern template struct StateVariables<2>;
357extern template struct StateVariables<3>;
358} // namespace Ehlers
359} // namespace Solids
360} // namespace MaterialLib
#define OGS_FATAL(...)
Definition Error.h:19
double _kappa_d
damage driving variable
Definition Ehlers.h:212
Damage(double const kappa_d, double const value)
Definition Ehlers.h:201
double _value
isotropic damage variable
Definition Ehlers.h:213
std::vector< typename MechanicsBase< DisplacementDim >::InternalVariable > getInternalVariables() const override
Definition Ehlers.cpp:726
MaterialPropertiesParameters _mp
Definition Ehlers.h:348
NumLib::NewtonRaphsonSolverParameters const _nonlinear_solver_parameters
Definition Ehlers.h:346
Eigen::Matrix< double, JacobianResidualSize, JacobianResidualSize, Eigen::RowMajor > JacobianMatrix
Definition Ehlers.h:279
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 Ehlers.cpp:535
std::unique_ptr< typename MechanicsBase< DisplacementDim >::MaterialStateVariables > createMaterialStateVariables() const override
Definition Ehlers.h:285
MaterialProperties evaluatedMaterialProperties(double const t, ParameterLib::SpatialPosition const &x) const
Definition Ehlers.h:326
MathLib::KelvinVector::KelvinVectorType< DisplacementDim > KelvinVector
Definition Ehlers.h:291
std::unique_ptr< DamagePropertiesParameters > _damage_properties
Definition Ehlers.h:349
double getBulkModulus(double const t, ParameterLib::SpatialPosition const &x, KelvinMatrix const *const) const override
Definition Ehlers.h:332
MathLib::KelvinVector::KelvinMatrixType< DisplacementDim > KelvinMatrix
Definition Ehlers.h:293
Eigen::Matrix< double, JacobianResidualSize, 1 > ResidualVectorType
Definition Ehlers.h:278
SolidEhlers(NumLib::NewtonRaphsonSolverParameters nonlinear_solver_parameters, MaterialPropertiesParameters material_properties, std::unique_ptr< DamagePropertiesParameters > &&damage_properties, TangentType tangent_type)
Definition Ehlers.cpp:497
DamageProperties evaluatedDamageProperties(double const t, ParameterLib::SpatialPosition const &x) const
Definition Ehlers.h:339
double computeFreeEnergyDensity(double const, ParameterLib::SpatialPosition const &, double const, KelvinVector const &eps, KelvinVector const &sigma, typename MechanicsBase< DisplacementDim >::MaterialStateVariables const &material_state_variables) const override
Definition Ehlers.cpp:510
TangentType makeTangentType(std::string const &s)
Definition Ehlers.h:39
constexpr int kelvin_vector_dimensions(int const displacement_dim)
Kelvin vector dimensions for given displacement dimension.
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
DamageProperties(double const t, ParameterLib::SpatialPosition const &x, DamagePropertiesParameters const &dp)
Definition Ehlers.h:169
MaterialPropertiesParameters(P const &G_, P const &K_, P const &alpha_, P const &beta_, P const &gamma_, P const &delta_, P const &epsilon_, P const &m_, P const &alpha_p_, P const &beta_p_, P const &gamma_p_, P const &delta_p_, P const &epsilon_p_, P const &m_p_, P const &kappa_, P const &hardening_coefficient_)
Definition Ehlers.h:63
MaterialProperties(double const t, ParameterLib::SpatialPosition const &x, MaterialPropertiesParameters const &mp)
Definition Ehlers.h:124
PlasticStrain(KelvinVector eps_p_D_, double const eps_p_V_, double const eps_p_eff_)
Definition Ehlers.h:186
KelvinVector D
deviatoric plastic strain
Definition Ehlers.h:190
double eff
effective plastic strain
Definition Ehlers.h:192
MathLib::KelvinVector::Invariants< KelvinVectorSize > Invariants
Definition Ehlers.h:236
Damage damage_prev
damage part of the state.
Definition Ehlers.h:245
Damage damage
damage part of the state.
Definition Ehlers.h:241
MathLib::KelvinVector::KelvinVectorType< DisplacementDim > KelvinVector
Definition Ehlers.h:237
PlasticStrain< KelvinVector > eps_p
plastic part of the state.
Definition Ehlers.h:240
double getEquivalentPlasticStrain() const override
Definition Ehlers.cpp:46
PlasticStrain< KelvinVector > eps_p_prev
plastic part of the state.
Definition Ehlers.h:244
friend std::ostream & operator<<(std::ostream &os, StateVariables< DisplacementDim > const &m)
Definition Ehlers.h:248