OGS
MechanicsBase.h
Go to the documentation of this file.
1 
10 #pragma once
11 
12 #include <functional>
13 #include <memory>
14 #include <optional>
15 #include <tuple>
16 #include <vector>
17 
18 #include "BaseLib/DynamicSpan.h"
19 #include "BaseLib/Error.h"
21 #include "MathLib/KelvinVector.h"
22 
23 namespace ParameterLib
24 {
25 class SpatialPosition;
26 }
27 
28 namespace MeshLib
29 {
30 class Element;
31 }
32 
33 namespace MaterialLib
34 {
35 namespace Solids
36 {
38 {
39  Ehlers,
41  Lubby2,
42  CreepBGRa,
43  Invalid
44 };
45 
51 template <int DisplacementDim>
53 {
60  {
61  virtual ~MaterialStateVariables() = default;
62  virtual void pushBackState(){};
63  virtual double getEquivalentPlasticStrain() const { return 0.0; }
64  };
65 
68  virtual std::unique_ptr<MaterialStateVariables>
70  {
71  return std::make_unique<MaterialStateVariables>();
72  }
73 
74  using KelvinVector =
76  using KelvinMatrix =
78 
85  virtual std::optional<std::tuple<
86  KelvinVector, std::unique_ptr<MaterialStateVariables>, KelvinMatrix>>
88  MaterialPropertyLib::VariableArray const& variable_array_prev,
89  MaterialPropertyLib::VariableArray const& variable_array,
90  double const t,
92  double const dt,
93  MaterialStateVariables const& material_state_variables) const = 0;
94 
97  {
98  using Getter = std::function<std::vector<double> const&(
99  MaterialStateVariables const&, std::vector<double>& /*cache*/)>;
100  using WriteAccess = std::function<BaseLib::DynamicSpan<double>(
102 
104  std::string const name;
105 
107  int const num_components;
108 
110  Getter const getter;
111 
114  };
115 
118  virtual std::vector<InternalVariable> getInternalVariables() const
119  {
120  return {};
121  }
122 
125  {
127  }
128 
129  virtual double getBulkModulus(
130  double const /*t*/,
131  ParameterLib::SpatialPosition const& /*x*/,
132  KelvinMatrix const* const /*C*/ = nullptr) const
133  {
134  OGS_FATAL(
135  "getBulkModulus is not yet implemented for this Solid Material.");
136  }
137 
141  double const /*t*/, double const /*dt*/,
142  ParameterLib::SpatialPosition const& /*x*/, double const /*T*/,
143  double const /*deviatoric_stress_norm*/) const
144  {
145  return 0.0;
146  }
147 
148  virtual double computeFreeEnergyDensity(
149  double const t,
151  double const dt,
152  KelvinVector const& eps,
153  KelvinVector const& sigma,
154  MaterialStateVariables const& material_state_variables) const = 0;
155 
156  virtual ~MechanicsBase() = default;
157 };
158 
159 } // namespace Solids
160 } // namespace MaterialLib
#define OGS_FATAL(...)
Definition: Error.h:26
Eigen::Matrix< double, kelvin_vector_dimensions(DisplacementDim), 1, Eigen::ColMajor > KelvinVectorType
Definition: KelvinVector.h:49
Eigen::Matrix< double, kelvin_vector_dimensions(DisplacementDim), kelvin_vector_dimensions(DisplacementDim), Eigen::RowMajor > KelvinMatrixType
Definition: KelvinVector.h:57
static const double t
Helper type for providing access to internal variables.
Definition: MechanicsBase.h:97
Getter const getter
function accessing the internal variable
std::string const name
name of the internal variable
std::function< std::vector< double > const &(MaterialStateVariables const &, std::vector< double > &)> Getter
Definition: MechanicsBase.h:99
int const num_components
number of components of the internal variable
std::function< BaseLib::DynamicSpan< double >(MaterialStateVariables &)> WriteAccess
WriteAccess const reference
function accessing the internal variable
virtual std::optional< std::tuple< KelvinVector, std::unique_ptr< MaterialStateVariables >, KelvinMatrix > > integrateStress(MaterialPropertyLib::VariableArray const &variable_array_prev, MaterialPropertyLib::VariableArray const &variable_array, double const t, ParameterLib::SpatialPosition const &x, double const dt, MaterialStateVariables const &material_state_variables) const =0
virtual ConstitutiveModel getConstitutiveModel() const
Gets the type of constitutive model.
virtual std::vector< InternalVariable > getInternalVariables() const
virtual double getBulkModulus(double const, ParameterLib::SpatialPosition const &, KelvinMatrix const *const =nullptr) const
virtual std::unique_ptr< MaterialStateVariables > createMaterialStateVariables() const
Definition: MechanicsBase.h:69
virtual double getTemperatureRelatedCoefficient(double const, double const, ParameterLib::SpatialPosition const &, double const, double const) const
MathLib::KelvinVector::KelvinVectorType< DisplacementDim > KelvinVector
Definition: MechanicsBase.h:75
virtual double computeFreeEnergyDensity(double const t, ParameterLib::SpatialPosition const &x, double const dt, KelvinVector const &eps, KelvinVector const &sigma, MaterialStateVariables const &material_state_variables) const =0
MathLib::KelvinVector::KelvinMatrixType< DisplacementDim > KelvinMatrix
Definition: MechanicsBase.h:77