OGS
Ehlers.h
Go to the documentation of this file.
1
19#pragma once
20
21#ifndef NDEBUG
22#include <iosfwd>
23#endif
24
25#include "BaseLib/Error.h"
27#include "MechanicsBase.h"
30
31namespace MaterialLib
32{
33namespace Solids
34{
35namespace Ehlers
36{
37enum class TangentType
38{
39 Elastic,
42};
43inline TangentType makeTangentType(std::string const& s)
44{
45 if (s == "Elastic")
46 {
48 }
49 if (s == "PlasticDamageSecant")
50 {
52 }
53 if (s == "Plastic")
54 {
56 }
57 OGS_FATAL("Not valid string '{:s}' to create a tangent type from.", s);
58}
59
64{
66
67 MaterialPropertiesParameters(P const& G_, P const& K_, P const& alpha_,
68 P const& beta_, P const& gamma_,
69 P const& delta_, P const& epsilon_,
70 P const& m_, P const& alpha_p_,
71 P const& beta_p_, P const& gamma_p_,
72 P const& delta_p_, P const& epsilon_p_,
73 P const& m_p_, P const& kappa_,
74 P const& hardening_coefficient_)
75 : G(G_),
76 K(K_),
77 alpha(alpha_),
78 beta(beta_),
79 gamma(gamma_),
80 delta(delta_),
81 epsilon(epsilon_),
82 m(m_),
83 alpha_p(alpha_p_),
84 beta_p(beta_p_),
85 gamma_p(gamma_p_),
86 delta_p(delta_p_),
87 epsilon_p(epsilon_p_),
88 m_p(m_p_),
89 kappa(kappa_),
90 hardening_coefficient(hardening_coefficient_)
91 {
92 }
93 // basic material parameters
94 P const& G;
95 P const& K;
96
97 P const& alpha;
99 P const& beta;
100 P const& gamma;
101 P const& delta;
102 P const& epsilon;
103 P const& m;
104
105 P const& alpha_p;
106 P const& beta_p;
107 P const& gamma_p;
108 P const& delta_p;
109 P const& epsilon_p;
110 P const& m_p;
111
112 P const& kappa;
114};
115
123
127{
130 : G(mp.G(t, x)[0]),
131 K(mp.K(t, x)[0]),
132 alpha(mp.alpha(t, x)[0]),
133 beta(mp.beta(t, x)[0]),
134 gamma(mp.gamma(t, x)[0]),
135 delta(mp.delta(t, x)[0]),
136 epsilon(mp.epsilon(t, x)[0]),
137 m(mp.m(t, x)[0]),
138 alpha_p(mp.alpha_p(t, x)[0]),
139 beta_p(mp.beta_p(t, x)[0]),
140 gamma_p(mp.gamma_p(t, x)[0]),
141 delta_p(mp.delta_p(t, x)[0]),
142 epsilon_p(mp.epsilon_p(t, x)[0]),
143 m_p(mp.m_p(t, x)[0]),
144 kappa(mp.kappa(t, x)[0]),
146 {
147 }
148 double const G;
149 double const K;
150
151 double const alpha;
152 double const beta;
153 double const gamma;
154 double const delta;
155 double const epsilon;
156 double const m;
157
158 double const alpha_p;
159 double const beta_p;
160 double const gamma_p;
161 double const delta_p;
162 double const epsilon_p;
163 double const m_p;
164
165 double const kappa;
167};
168
172{
173 DamageProperties(double const t,
176 : alpha_d(dp.alpha_d(t, x)[0]),
177 beta_d(dp.beta_d(t, x)[0]),
178 h_d(dp.h_d(t, x)[0])
179 {
180 }
181 double const alpha_d;
182 double const beta_d;
183 double const h_d;
184};
185
186template <typename KelvinVector>
187struct PlasticStrain final
188{
189 PlasticStrain() : D(KelvinVector::Zero()) {}
190 PlasticStrain(KelvinVector eps_p_D_, double const eps_p_V_,
191 double const eps_p_eff_)
192 : D(std::move(eps_p_D_)), V(eps_p_V_), eff(eps_p_eff_){};
193
194 KelvinVector D;
195 double V = 0;
196 double eff = 0;
197
199};
200
201class Damage final
202{
203public:
204 Damage() = default;
205 Damage(double const kappa_d, double const value)
207 {
208 }
209
210 double kappa_d() const { return _kappa_d; }
211 double& kappa_d() { return _kappa_d; }
212 double value() const { return _value; }
213 double& value() { return _value; }
214
215private:
216 double _kappa_d = 0;
217 double _value = 0;
218};
219
220template <int DisplacementDim>
222 : public MechanicsBase<DisplacementDim>::MaterialStateVariables
223{
225 {
228 }
229
230 void pushBackState() override
231 {
234 }
235
236 double getEquivalentPlasticStrain() const override;
237
238 static int const KelvinVectorSize =
243
246
247 // Initial values from previous timestep
250
251#ifndef NDEBUG
252 friend std::ostream& operator<<(std::ostream& os,
254 {
255 os << "State:\n"
256 << "eps_p_D: " << m.eps_p.D << "\n"
257 << "eps_p_eff: " << m.eps_p.eff << "\n"
258 << "kappa_d: " << m.damage.kappa_d() << "\n"
259 << "damage: " << m.damage.value() << "\n"
260 << "eps_p_D_prev: " << m.eps_p_prev.D << "\n"
261 << "eps_p_eff_prev: " << m.eps_p_prev.eff << "\n"
262 << "kappa_d_prev: " << m.damage_prev.kappa_d() << "\n"
263 << "damage_prev: " << m.damage_prev.value() << "\n";
264 return os;
265 }
266#endif // NDEBUG
267
269};
270
271template <int DisplacementDim>
272class SolidEhlers final : public MechanicsBase<DisplacementDim>
273{
274public:
275 static int const KelvinVectorSize =
277 static int const JacobianResidualSize =
278 2 * KelvinVectorSize + 3; // 2 is the number of components in the
279 // jacobian/residual, not the space
280 // dimension. And 3 is for additional
281 // variables.
282 using ResidualVectorType = Eigen::Matrix<double, JacobianResidualSize, 1>;
283 using JacobianMatrix = Eigen::Matrix<double, JacobianResidualSize,
284 JacobianResidualSize, Eigen::RowMajor>;
285
286public:
287 std::unique_ptr<
290 {
291 return std::make_unique<StateVariables<DisplacementDim>>();
292 }
293
294public:
299
300public:
302 NumLib::NewtonRaphsonSolverParameters nonlinear_solver_parameters,
303 MaterialPropertiesParameters material_properties,
304 std::unique_ptr<DamagePropertiesParameters>&& damage_properties,
305 TangentType tangent_type);
306
308 double const /*t*/,
310 double const /*dt*/,
311 KelvinVector const& eps,
312 KelvinVector const& sigma,
314 material_state_variables) const override;
315
316 std::optional<std::tuple<KelvinVector,
317 std::unique_ptr<typename MechanicsBase<
318 DisplacementDim>::MaterialStateVariables>,
321 MaterialPropertyLib::VariableArray const& variable_array_prev,
322 MaterialPropertyLib::VariableArray const& variable_array,
323 double const t, ParameterLib::SpatialPosition const& x, double const dt,
325 material_state_variables) const override;
326
327 std::vector<typename MechanicsBase<DisplacementDim>::InternalVariable>
328 getInternalVariables() const override;
329
331 double const t, ParameterLib::SpatialPosition const& x) const
332 {
333 return MaterialProperties(t, x, _mp);
334 }
335
336 double getBulkModulus(double const t,
338 KelvinMatrix const* const /*C*/) const override
339 {
340 return _mp.K(t, x)[0];
341 }
342
344 double const t, ParameterLib::SpatialPosition const& x) const
345 {
347 }
348
349private:
351
353 std::unique_ptr<DamagePropertiesParameters> _damage_properties;
355};
356
357extern template class SolidEhlers<2>;
358extern template class SolidEhlers<3>;
359
360extern template struct StateVariables<2>;
361extern template struct StateVariables<3>;
362} // namespace Ehlers
363} // namespace Solids
364} // namespace MaterialLib
#define OGS_FATAL(...)
Definition Error.h:26
double _kappa_d
damage driving variable
Definition Ehlers.h:216
Damage(double const kappa_d, double const value)
Definition Ehlers.h:205
double _value
isotropic damage variable
Definition Ehlers.h:217
std::vector< typename MechanicsBase< DisplacementDim >::InternalVariable > getInternalVariables() const override
Definition Ehlers.cpp:735
MaterialPropertiesParameters _mp
Definition Ehlers.h:352
NumLib::NewtonRaphsonSolverParameters const _nonlinear_solver_parameters
Definition Ehlers.h:350
Eigen::Matrix< double, JacobianResidualSize, JacobianResidualSize, Eigen::RowMajor > JacobianMatrix
Definition Ehlers.h:283
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:541
std::unique_ptr< typename MechanicsBase< DisplacementDim >::MaterialStateVariables > createMaterialStateVariables() const override
Definition Ehlers.h:289
MaterialProperties evaluatedMaterialProperties(double const t, ParameterLib::SpatialPosition const &x) const
Definition Ehlers.h:330
MathLib::KelvinVector::KelvinVectorType< DisplacementDim > KelvinVector
Definition Ehlers.h:295
std::unique_ptr< DamagePropertiesParameters > _damage_properties
Definition Ehlers.h:353
double getBulkModulus(double const t, ParameterLib::SpatialPosition const &x, KelvinMatrix const *const) const override
Definition Ehlers.h:336
MathLib::KelvinVector::KelvinMatrixType< DisplacementDim > KelvinMatrix
Definition Ehlers.h:297
Eigen::Matrix< double, JacobianResidualSize, 1 > ResidualVectorType
Definition Ehlers.h:282
SolidEhlers(NumLib::NewtonRaphsonSolverParameters nonlinear_solver_parameters, MaterialPropertiesParameters material_properties, std::unique_ptr< DamagePropertiesParameters > &&damage_properties, TangentType tangent_type)
Definition Ehlers.cpp:503
DamageProperties evaluatedDamageProperties(double const t, ParameterLib::SpatialPosition const &x) const
Definition Ehlers.h:343
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:516
TangentType makeTangentType(std::string const &s)
Definition Ehlers.h:43
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:173
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:67
MaterialProperties(double const t, ParameterLib::SpatialPosition const &x, MaterialPropertiesParameters const &mp)
Definition Ehlers.h:128
PlasticStrain(KelvinVector eps_p_D_, double const eps_p_V_, double const eps_p_eff_)
Definition Ehlers.h:190
KelvinVector D
deviatoric plastic strain
Definition Ehlers.h:194
double eff
effective plastic strain
Definition Ehlers.h:196
Damage damage_prev
damage part of the state.
Definition Ehlers.h:249
Damage damage
damage part of the state.
Definition Ehlers.h:245
MathLib::KelvinVector::KelvinVectorType< DisplacementDim > KelvinVector
Definition Ehlers.h:241
PlasticStrain< KelvinVector > eps_p
plastic part of the state.
Definition Ehlers.h:244
double getEquivalentPlasticStrain() const override
Definition Ehlers.cpp:52
PlasticStrain< KelvinVector > eps_p_prev
plastic part of the state.
Definition Ehlers.h:248
friend std::ostream & operator<<(std::ostream &os, StateVariables< DisplacementDim > const &m)
Definition Ehlers.h:252