OGS 6.1.0-1699-ge946d4c5f
Ehlers.h
Go to the documentation of this file.
1 
19 #pragma once
20 
21 #ifndef NDEBUG
22 #include <ostream>
23 #endif
24 
25 #include "BaseLib/Error.h"
26 #include "MathLib/KelvinVector.h"
27 #include "NumLib/NewtonRaphson.h"
29 
30 #include "MechanicsBase.h"
31 
32 namespace MaterialLib
33 {
34 namespace Solids
35 {
36 namespace Ehlers
37 {
38 enum class TangentType
39 {
40  Elastic,
42  Plastic
43 };
44 inline TangentType makeTangentType(std::string const& s)
45 {
46  if (s == "Elastic")
47  return TangentType::Elastic;
48  if (s == "PlasticDamageSecant")
50  if (s == "Plastic")
51  return TangentType::Plastic;
52  OGS_FATAL("Not valid string '%s' to create a tangent type from.",
53  s.c_str());
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;
94  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 
113 {
115  P const& alpha_d;
116  P const& beta_d;
117  P const& h_d;
118 };
119 
122 struct MaterialProperties final
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]),
141  hardening_coefficient(mp.hardening_coefficient(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;
162  double const hardening_coefficient;
163 };
164 
168 {
169  DamageProperties(double const t,
171  DamagePropertiesParameters const& dp)
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 
182 template <typename KelvinVector>
183 struct 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 
197 class Damage final
198 {
199 public:
200  Damage() = default;
201  Damage(double const kappa_d, double const value)
202  : _kappa_d(kappa_d), _value(value)
203  {
204  }
205 
206  double kappa_d() const { return _kappa_d; }
207  double value() const { return _value; }
208 
209 private:
210  double _kappa_d = 0;
211  double _value = 0;
212 };
213 
214 template <int DisplacementDim>
216  : public MechanicsBase<DisplacementDim>::MaterialStateVariables
217 {
218  StateVariables& operator=(StateVariables const&) = default;
221  state) noexcept override
222  {
223  assert(dynamic_cast<StateVariables const*>(&state) != nullptr);
224  return operator=(static_cast<StateVariables const&>(state));
225  }
226 
228  {
229  eps_p = eps_p_prev;
230  damage = damage_prev;
231  }
232 
233  void pushBackState() override
234  {
235  eps_p_prev = eps_p;
236  damage_prev = damage;
237  }
238 
239  using KelvinVector =
241 
244 
245  // Initial values from previous timestep
248 
249 #ifndef NDEBUG
250  friend std::ostream& operator<<(
251  std::ostream& os, StateVariables<DisplacementDim> const& m)
252  {
253  os << "State:\n"
254  << "eps_p_D: " << m.eps_p.D << "\n"
255  << "eps_p_eff: " << m.eps_p.eff << "\n"
256  << "kappa_d: " << m.damage.kappa_d() << "\n"
257  << "damage: " << m.damage.value() << "\n"
258  << "eps_p_D_prev: " << m.eps_p_prev.D << "\n"
259  << "eps_p_eff_prev: " << m.eps_p_prev.eff << "\n"
260  << "kappa_d_prev: " << m.damage_prev.kappa_d() << "\n"
261  << "damage_prev: " << m.damage_prev.value() << "\n"
262  << "lambda: " << m.lambda << "\n";
263  return os;
264  }
265 #endif // NDEBUG
266 
268 };
269 
270 template <int DisplacementDim>
271 class SolidEhlers final : public MechanicsBase<DisplacementDim>
272 {
273 public:
274  static int const KelvinVectorSize =
276  static int const JacobianResidualSize =
277  2 * KelvinVectorSize + 3; // 2 is the number of components in the
278  // jacobian/residual, not the space
279  // dimension. And 3 is for additional
280  // variables.
281  using ResidualVectorType = Eigen::Matrix<double, JacobianResidualSize, 1>;
282  using JacobianMatrix = Eigen::Matrix<double, JacobianResidualSize,
283  JacobianResidualSize, Eigen::RowMajor>;
284 
285 public:
286  std::unique_ptr<
289  {
290  return std::make_unique<StateVariables<DisplacementDim>>();
291  }
292 
293 public:
294  using KelvinVector =
296  using KelvinMatrix =
298 
299 public:
300  SolidEhlers(
301  NumLib::NewtonRaphsonSolverParameters nonlinear_solver_parameters,
302  MaterialPropertiesParameters material_properties,
303  std::unique_ptr<DamagePropertiesParameters>&& damage_properties,
304  TangentType tangent_type);
305 
306  double computeFreeEnergyDensity(
307  double const /*t*/,
308  ProcessLib::SpatialPosition const& /*x*/,
309  double const /*dt*/,
310  KelvinVector const& eps,
311  KelvinVector const& sigma,
313  material_state_variables) const override;
314 
315  boost::optional<std::tuple<KelvinVector,
316  std::unique_ptr<typename MechanicsBase<
317  DisplacementDim>::MaterialStateVariables>,
318  KelvinMatrix>>
319  integrateStress(
320  double const t, ProcessLib::SpatialPosition const& x, double const dt,
321  KelvinVector const& eps_prev, KelvinVector const& eps,
322  KelvinVector const& sigma_prev,
324  material_state_variables,
325  double const T) const override;
326 
327  std::vector<typename MechanicsBase<DisplacementDim>::InternalVariable>
328  getInternalVariables() const override;
329 
331  double const t, ProcessLib::SpatialPosition const& x) const
332  {
333  return MaterialProperties(t, x, _mp);
334  }
335 
337  double const t, ProcessLib::SpatialPosition const& x) const
338  {
339  return DamageProperties(t, x, *_damage_properties);
340  }
341 
342 private:
344 
346  std::unique_ptr<DamagePropertiesParameters> _damage_properties;
348 };
349 
350 extern template class SolidEhlers<2>;
351 extern template class SolidEhlers<3>;
352 } // namespace Ehlers
353 } // namespace Solids
354 } // namespace MaterialLib
KelvinVector D
deviatoric plastic strain
Definition: Ehlers.h:188
Kelvin vector dimensions for given displacement dimension.
Definition: KelvinVector.h:23
Damage damage
damage part of the state.
Definition: Ehlers.h:243
DamageProperties(double const t, ProcessLib::SpatialPosition const &x, DamagePropertiesParameters const &dp)
Definition: Ehlers.h:169
NumLib::NewtonRaphsonSolverParameters const _nonlinear_solver_parameters
Definition: Ehlers.h:343
Eigen::Matrix< double, JacobianResidualSize, 1 > ResidualVectorType
Definition: Ehlers.h:281
Eigen::Matrix< double, KelvinVectorDimensions< DisplacementDim >::value, KelvinVectorDimensions< DisplacementDim >::value, Eigen::RowMajor > KelvinMatrixType
Definition: KelvinVector.h:59
MathLib::KelvinVector::KelvinVectorType< DisplacementDim > KelvinVector
Definition: Ehlers.h:240
PlasticStrain< KelvinVector > eps_p
plastic part of the state.
Definition: Ehlers.h:242
Eigen::Matrix< double, JacobianResidualSize, JacobianResidualSize, Eigen::RowMajor > JacobianMatrix
Definition: Ehlers.h:283
DamageProperties evaluatedDamageProperties(double const t, ProcessLib::SpatialPosition const &x) const
Definition: Ehlers.h:336
friend std::ostream & operator<<(std::ostream &os, StateVariables< DisplacementDim > const &m)
Definition: Ehlers.h:250
MathLib::KelvinVector::KelvinMatrixType< DisplacementDim > KelvinMatrix
Definition: Ehlers.h:297
MaterialProperties evaluatedMaterialProperties(double const t, ProcessLib::SpatialPosition const &x) const
Definition: Ehlers.h:330
MaterialPropertiesParameters _mp
Definition: Ehlers.h:345
Damage(double const kappa_d, double const value)
Definition: Ehlers.h:201
PlasticStrain(KelvinVector eps_p_D_, double const eps_p_V_, double const eps_p_eff_)
Definition: Ehlers.h:186
MechanicsBase< DisplacementDim >::MaterialStateVariables & operator=(typename MechanicsBase< DisplacementDim >::MaterialStateVariables const &state) noexcept override
Definition: Ehlers.h:219
std::unique_ptr< typename MechanicsBase< DisplacementDim >::MaterialStateVariables > createMaterialStateVariables() const override
Definition: Ehlers.h:288
TangentType makeTangentType(std::string const &s)
Definition: Ehlers.h:44
Damage damage_prev
damage part of the state.
Definition: Ehlers.h:247
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
#define OGS_FATAL(fmt,...)
Definition: Error.h:71
MathLib::KelvinVector::KelvinVectorType< DisplacementDim > KelvinVector
Definition: Ehlers.h:295
PlasticStrain< KelvinVector > eps_p_prev
plastic part of the state.
Definition: Ehlers.h:246
std::unique_ptr< DamagePropertiesParameters > _damage_properties
Definition: Ehlers.h:346
MaterialProperties(double const t, ProcessLib::SpatialPosition const &x, MaterialPropertiesParameters const &mp)
Definition: Ehlers.h:124
Eigen::Matrix< double, KelvinVectorDimensions< DisplacementDim >::value, 1, Eigen::ColMajor > KelvinVectorType
Definition: KelvinVector.h:49