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 <span>
16#include <tuple>
17#include <vector>
18
19#include "BaseLib/Error.h"
22
23namespace ParameterLib
24{
25class SpatialPosition;
26}
27
28namespace MeshLib
29{
30class Element;
31}
32
33namespace MaterialLib
34{
35namespace Solids
36{
45
51template <int DisplacementDim>
52struct MechanicsBase
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
75 double const /*t*/,
78 {
79 }
80
85
92 virtual std::optional<std::tuple<
93 KelvinVector, std::unique_ptr<MaterialStateVariables>, KelvinMatrix>>
95 MaterialPropertyLib::VariableArray const& variable_array_prev,
96 MaterialPropertyLib::VariableArray const& variable_array,
97 double const t,
99 double const dt,
100 MaterialStateVariables const& material_state_variables) const = 0;
101
104 {
105 using Getter = std::function<std::vector<double> const&(
106 MaterialStateVariables const&, std::vector<double>& /*cache*/)>;
108 std::function<std::span<double>(MaterialStateVariables&)>;
109
111 std::string const name;
112
114 int const num_components;
115
118
121 };
122
125 virtual std::vector<InternalVariable> getInternalVariables() const
126 {
127 return {};
128 }
129
135
136 virtual double getBulkModulus(
137 double const /*t*/,
139 KelvinMatrix const* const /*C*/ = nullptr) const
140 {
141 OGS_FATAL(
142 "getBulkModulus is not yet implemented for this Solid Material.");
143 }
144
148 double const /*t*/, double const /*dt*/,
149 ParameterLib::SpatialPosition const& /*x*/, double const /*T*/,
150 double const /*deviatoric_stress_norm*/) const
151 {
152 return 0.0;
153 }
154
156 double const t,
158 double const dt,
159 KelvinVector const& eps,
160 KelvinVector const& sigma,
161 MaterialStateVariables const& material_state_variables) const = 0;
162
163 virtual ~MechanicsBase() = default;
164};
165
166} // namespace Solids
167} // namespace MaterialLib
#define OGS_FATAL(...)
Definition Error.h:26
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
Helper type for providing access to internal variables.
Getter const getter
function accessing the internal variable
std::string const name
name of the internal variable
std::function< std::span< double >(MaterialStateVariables &)> WriteAccess
int const num_components
number of components of the internal variable
std::function< std::vector< double > const &( MaterialStateVariables const &, std::vector< double > &)> Getter
WriteAccess const reference
function accessing the internal variable
virtual ConstitutiveModel getConstitutiveModel() const
Gets the type of constitutive model.
virtual std::vector< InternalVariable > getInternalVariables() const
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 void initializeInternalStateVariables(double const, ParameterLib::SpatialPosition const &, typename MechanicsBase< DisplacementDim >::MaterialStateVariables &) const
virtual double getBulkModulus(double const, ParameterLib::SpatialPosition const &, KelvinMatrix const *const =nullptr) const
MathLib::KelvinVector::KelvinVectorType< DisplacementDim > KelvinVector
virtual std::unique_ptr< MaterialStateVariables > createMaterialStateVariables() const
virtual double getTemperatureRelatedCoefficient(double const, double const, ParameterLib::SpatialPosition const &, double const, double const) const
MathLib::KelvinVector::KelvinMatrixType< DisplacementDim > KelvinMatrix
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