OGS
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"
28 #include "ParameterLib/Parameter.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  {
48  return TangentType::Elastic;
49  }
50  if (s == "PlasticDamageSecant")
51  {
53  }
54  if (s == "Plastic")
55  {
56  return TangentType::Plastic;
57  }
58  OGS_FATAL("Not valid string '{:s}' to create a tangent type from.", s);
59 }
60 
65 {
67 
68  MaterialPropertiesParameters(P const& G_, P const& K_, P const& alpha_,
69  P const& beta_, P const& gamma_,
70  P const& delta_, P const& epsilon_,
71  P const& m_, P const& alpha_p_,
72  P const& beta_p_, P const& gamma_p_,
73  P const& delta_p_, P const& epsilon_p_,
74  P const& m_p_, P const& kappa_,
75  P const& hardening_coefficient_)
76  : G(G_),
77  K(K_),
78  alpha(alpha_),
79  beta(beta_),
80  gamma(gamma_),
81  delta(delta_),
82  epsilon(epsilon_),
83  m(m_),
84  alpha_p(alpha_p_),
85  beta_p(beta_p_),
86  gamma_p(gamma_p_),
87  delta_p(delta_p_),
88  epsilon_p(epsilon_p_),
89  m_p(m_p_),
90  kappa(kappa_),
91  hardening_coefficient(hardening_coefficient_)
92  {
93  }
94  // basic material parameters
95  P const& G;
96  P const& K;
97 
98  P const& alpha;
100  P const& beta;
101  P const& gamma;
102  P const& delta;
103  P const& epsilon;
104  P const& m;
105 
106  P const& alpha_p;
107  P const& beta_p;
108  P const& gamma_p;
109  P const& delta_p;
110  P const& epsilon_p;
111  P const& m_p;
112 
113  P const& kappa;
115 };
116 
118 {
120  P const& alpha_d;
121  P const& beta_d;
122  P const& h_d;
123 };
124 
127 struct MaterialProperties final
128 {
131  : G(mp.G(t, x)[0]),
132  K(mp.K(t, x)[0]),
133  alpha(mp.alpha(t, x)[0]),
134  beta(mp.beta(t, x)[0]),
135  gamma(mp.gamma(t, x)[0]),
136  delta(mp.delta(t, x)[0]),
137  epsilon(mp.epsilon(t, x)[0]),
138  m(mp.m(t, x)[0]),
139  alpha_p(mp.alpha_p(t, x)[0]),
140  beta_p(mp.beta_p(t, x)[0]),
141  gamma_p(mp.gamma_p(t, x)[0]),
142  delta_p(mp.delta_p(t, x)[0]),
143  epsilon_p(mp.epsilon_p(t, x)[0]),
144  m_p(mp.m_p(t, x)[0]),
145  kappa(mp.kappa(t, x)[0]),
147  {
148  }
149  double const G;
150  double const K;
151 
152  double const alpha;
153  double const beta;
154  double const gamma;
155  double const delta;
156  double const epsilon;
157  double const m;
158 
159  double const alpha_p;
160  double const beta_p;
161  double const gamma_p;
162  double const delta_p;
163  double const epsilon_p;
164  double const m_p;
165 
166  double const kappa;
167  double const hardening_coefficient;
168 };
169 
173 {
174  DamageProperties(double const t,
176  DamagePropertiesParameters const& dp)
177  : alpha_d(dp.alpha_d(t, x)[0]),
178  beta_d(dp.beta_d(t, x)[0]),
179  h_d(dp.h_d(t, x)[0])
180  {
181  }
182  double const alpha_d;
183  double const beta_d;
184  double const h_d;
185 };
186 
187 template <typename KelvinVector>
188 struct PlasticStrain final
189 {
190  PlasticStrain() : D(KelvinVector::Zero()) {}
191  PlasticStrain(KelvinVector eps_p_D_, double const eps_p_V_,
192  double const eps_p_eff_)
193  : D(std::move(eps_p_D_)), V(eps_p_V_), eff(eps_p_eff_){};
194 
195  KelvinVector D;
196  double V = 0;
197  double eff = 0;
198 
200 };
201 
202 class Damage final
203 {
204 public:
205  Damage() = default;
206  Damage(double const kappa_d, double const value)
208  {
209  }
210 
211  double kappa_d() const { return _kappa_d; }
212  double& kappa_d() { return _kappa_d; }
213  double value() const { return _value; }
214  double& value() { return _value; }
215 
216 private:
217  double _kappa_d = 0;
218  double _value = 0;
219 };
220 
221 template <int DisplacementDim>
223  : public MechanicsBase<DisplacementDim>::MaterialStateVariables
224 {
226  {
227  eps_p = eps_p_prev;
229  }
230 
231  void pushBackState() override
232  {
233  eps_p_prev = eps_p;
235  }
236 
237  double getEquivalentPlasticStrain() const override;
238 
239  static int const KelvinVectorSize =
242  using KelvinVector =
244 
247 
248  // Initial values from previous timestep
251 
252 #ifndef NDEBUG
253  friend std::ostream& operator<<(
254  std::ostream& os, StateVariables<DisplacementDim> const& m)
255  {
256  os << "State:\n"
257  << "eps_p_D: " << m.eps_p.D << "\n"
258  << "eps_p_eff: " << m.eps_p.eff << "\n"
259  << "kappa_d: " << m.damage.kappa_d() << "\n"
260  << "damage: " << m.damage.value() << "\n"
261  << "eps_p_D_prev: " << m.eps_p_prev.D << "\n"
262  << "eps_p_eff_prev: " << m.eps_p_prev.eff << "\n"
263  << "kappa_d_prev: " << m.damage_prev.kappa_d() << "\n"
264  << "damage_prev: " << m.damage_prev.value() << "\n"
265  << "lambda: " << m.lambda << "\n";
266  return os;
267  }
268 #endif // NDEBUG
269 
271 };
272 
273 template <int DisplacementDim>
274 class SolidEhlers final : public MechanicsBase<DisplacementDim>
275 {
276 public:
277  static int const KelvinVectorSize =
279  static int const JacobianResidualSize =
280  2 * KelvinVectorSize + 3; // 2 is the number of components in the
281  // jacobian/residual, not the space
282  // dimension. And 3 is for additional
283  // variables.
284  using ResidualVectorType = Eigen::Matrix<double, JacobianResidualSize, 1>;
285  using JacobianMatrix = Eigen::Matrix<double, JacobianResidualSize,
286  JacobianResidualSize, Eigen::RowMajor>;
287 
288 public:
289  std::unique_ptr<
292  {
293  return std::make_unique<StateVariables<DisplacementDim>>();
294  }
295 
296 public:
297  using KelvinVector =
299  using KelvinMatrix =
301 
302 public:
303  SolidEhlers(
304  NumLib::NewtonRaphsonSolverParameters nonlinear_solver_parameters,
305  MaterialPropertiesParameters material_properties,
306  std::unique_ptr<DamagePropertiesParameters>&& damage_properties,
307  TangentType tangent_type);
308 
310  double const /*t*/,
311  ParameterLib::SpatialPosition const& /*x*/,
312  double const /*dt*/,
313  KelvinVector const& eps,
314  KelvinVector const& sigma,
316  material_state_variables) const override;
317 
318  std::optional<std::tuple<KelvinVector,
319  std::unique_ptr<typename MechanicsBase<
320  DisplacementDim>::MaterialStateVariables>,
321  KelvinMatrix>>
323  MaterialPropertyLib::VariableArray const& variable_array_prev,
324  MaterialPropertyLib::VariableArray const& variable_array,
325  double const t, ParameterLib::SpatialPosition const& x, double const dt,
327  material_state_variables) const override;
328 
329  std::vector<typename MechanicsBase<DisplacementDim>::InternalVariable>
330  getInternalVariables() const override;
331 
333  double const t, ParameterLib::SpatialPosition const& x) const
334  {
335  return MaterialProperties(t, x, _mp);
336  }
337 
338  double getBulkModulus(double const t,
340  KelvinMatrix const* const /*C*/) const override
341  {
342  return _mp.K(t, x)[0];
343  }
344 
346  double const t, ParameterLib::SpatialPosition const& x) const
347  {
348  return DamageProperties(t, x, *_damage_properties);
349  }
350 
351 private:
353 
355  std::unique_ptr<DamagePropertiesParameters> _damage_properties;
357 };
358 
359 extern template class SolidEhlers<2>;
360 extern template class SolidEhlers<3>;
361 } // namespace Ehlers
362 } // namespace Solids
363 } // namespace MaterialLib
#define OGS_FATAL(...)
Definition: Error.h:26
double _kappa_d
damage driving variable
Definition: Ehlers.h:217
Damage(double const kappa_d, double const value)
Definition: Ehlers.h:206
double _value
isotropic damage variable
Definition: Ehlers.h:218
std::vector< typename MechanicsBase< DisplacementDim >::InternalVariable > getInternalVariables() const override
Definition: Ehlers.cpp:712
MaterialPropertiesParameters _mp
Definition: Ehlers.h:354
NumLib::NewtonRaphsonSolverParameters const _nonlinear_solver_parameters
Definition: Ehlers.h:352
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:517
MaterialProperties evaluatedMaterialProperties(double const t, ParameterLib::SpatialPosition const &x) const
Definition: Ehlers.h:332
std::unique_ptr< DamagePropertiesParameters > _damage_properties
Definition: Ehlers.h:355
std::unique_ptr< typename MechanicsBase< DisplacementDim >::MaterialStateVariables > createMaterialStateVariables() const override
Definition: Ehlers.h:291
double getBulkModulus(double const t, ParameterLib::SpatialPosition const &x, KelvinMatrix const *const) const override
Definition: Ehlers.h:338
Eigen::Matrix< double, JacobianResidualSize, JacobianResidualSize, Eigen::RowMajor > JacobianMatrix
Definition: Ehlers.h:286
MathLib::KelvinVector::KelvinMatrixType< DisplacementDim > KelvinMatrix
Definition: Ehlers.h:300
MathLib::KelvinVector::KelvinVectorType< DisplacementDim > KelvinVector
Definition: Ehlers.h:298
Eigen::Matrix< double, JacobianResidualSize, 1 > ResidualVectorType
Definition: Ehlers.h:284
SolidEhlers(NumLib::NewtonRaphsonSolverParameters nonlinear_solver_parameters, MaterialPropertiesParameters material_properties, std::unique_ptr< DamagePropertiesParameters > &&damage_properties, TangentType tangent_type)
Definition: Ehlers.cpp:479
DamageProperties evaluatedDamageProperties(double const t, ParameterLib::SpatialPosition const &x) const
Definition: Ehlers.h:345
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:492
TangentType makeTangentType(std::string const &s)
Definition: Ehlers.h:44
std::array< VariableType, static_cast< int >(Variable::number_of_variables)> VariableArray
Definition: VariableType.h:108
Eigen::Matrix< double, kelvin_vector_dimensions(DisplacementDim), 1, Eigen::ColMajor > KelvinVectorType
Definition: KelvinVector.h:48
constexpr int kelvin_vector_dimensions(int const displacement_dim)
Kelvin vector dimensions for given displacement dimension.
Definition: KelvinVector.h:23
Eigen::Matrix< double, kelvin_vector_dimensions(DisplacementDim), kelvin_vector_dimensions(DisplacementDim), Eigen::RowMajor > KelvinMatrixType
Definition: KelvinVector.h:56
DamageProperties(double const t, ParameterLib::SpatialPosition const &x, DamagePropertiesParameters const &dp)
Definition: Ehlers.h:174
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:68
MaterialProperties(double const t, ParameterLib::SpatialPosition const &x, MaterialPropertiesParameters const &mp)
Definition: Ehlers.h:129
PlasticStrain(KelvinVector eps_p_D_, double const eps_p_V_, double const eps_p_eff_)
Definition: Ehlers.h:191
KelvinVector D
deviatoric plastic strain
Definition: Ehlers.h:193
double eff
effective plastic strain
Definition: Ehlers.h:197
Damage damage_prev
damage part of the state.
Definition: Ehlers.h:250
Damage damage
damage part of the state.
Definition: Ehlers.h:246
friend std::ostream & operator<<(std::ostream &os, StateVariables< DisplacementDim > const &m)
Definition: Ehlers.h:253
PlasticStrain< KelvinVector > eps_p
plastic part of the state.
Definition: Ehlers.h:245
double getEquivalentPlasticStrain() const override
Definition: Ehlers.cpp:50
MathLib::KelvinVector::KelvinVectorType< DisplacementDim > KelvinVector
Definition: Ehlers.h:243
PlasticStrain< KelvinVector > eps_p_prev
plastic part of the state.
Definition: Ehlers.h:249