OGS
Variable.h
Go to the documentation of this file.
1
11#pragma once
12
13#include <MGIS/Behaviour/Variable.hxx>
14
15#include "BaseLib/cpp23.h"
19
21{
27template <typename Derived>
29{
31 template <int DisplacementDim>
32 static constexpr std::size_t size()
33 {
35 }
36
38 template <int DisplacementDim>
39 static constexpr std::size_t rows()
40 {
41 using T = mgis::behaviour::Variable::Type;
42
43 switch (Derived::type)
44 {
45 case T::SCALAR:
46 return 1;
47 case T::VECTOR:
48 return DisplacementDim;
49 case T::STENSOR:
51 DisplacementDim);
52 case T::TENSOR:
53 return MaterialPropertyLib::tensorSize(DisplacementDim);
54 case T::VECTOR_1D:
55 case T::VECTOR_2D:
56 case T::VECTOR_3D:
57 case T::STENSOR_1D:
58 case T::STENSOR_2D:
59 case T::STENSOR_3D:
60 case T::TENSOR_1D:
61 case T::TENSOR_2D:
62 case T::TENSOR_3D:
63 case T::HIGHER_ORDER_TENSOR:
64 case T::ARRAY:
65 OGS_FATAL("Unsupported MGIS variable type {}.",
66 BaseLib::to_underlying(Derived::type));
67 }
68 }
69
71 template <int DisplacementDim>
72 static constexpr std::size_t cols()
73 {
74 using T = mgis::behaviour::Variable::Type;
75 switch (Derived::type)
76 {
77 case T::SCALAR:
78 return 1;
79 case T::VECTOR:
80 return 1;
81 case T::STENSOR:
82 return 1;
83 case T::TENSOR:
84 return 1;
85 case T::VECTOR_1D:
86 case T::VECTOR_2D:
87 case T::VECTOR_3D:
88 case T::STENSOR_1D:
89 case T::STENSOR_2D:
90 case T::STENSOR_3D:
91 case T::TENSOR_1D:
92 case T::TENSOR_2D:
93 case T::TENSOR_3D:
94 case T::HIGHER_ORDER_TENSOR:
95 case T::ARRAY:
96 OGS_FATAL("Unsupported MGIS variable type {}.",
97 BaseLib::to_underlying(Derived::type));
98 }
99 }
100};
101
103struct Strain : Variable<Strain>
104{
106 constexpr static const char* name = "Strain";
107
109 constexpr static mgis::behaviour::Variable::Type type =
110 mgis::behaviour::Variable::Type::STENSOR;
111
115 constexpr static auto mpl_var =
117};
118
120static constexpr Strain strain;
121
123struct GreenLagrangeStrain : Variable<GreenLagrangeStrain>
124{
126 constexpr static const char* name = "GreenLagrangeStrain";
127
129 constexpr static mgis::behaviour::Variable::Type type =
130 mgis::behaviour::Variable::Type::STENSOR;
131
135 constexpr static auto mpl_var =
137};
138
141
143struct DeformationGradient : Variable<DeformationGradient>
144{
146 constexpr static const char* name = "DeformationGradient";
147
149 constexpr static mgis::behaviour::Variable::Type type =
150 mgis::behaviour::Variable::Type::TENSOR;
151
153 constexpr static auto mpl_var =
155};
156
159
160struct LiquidPressure : Variable<LiquidPressure>
161{
162 constexpr static const char* name = "LiquidPressure";
163
164 constexpr static mgis::behaviour::Variable::Type type =
165 mgis::behaviour::Variable::Type::SCALAR;
166
167 constexpr static auto mpl_var =
169};
170
172
173struct Stress : Variable<Stress>
174{
175 constexpr static const char* name = "Stress";
176
177 constexpr static mgis::behaviour::Variable::Type type =
178 mgis::behaviour::Variable::Type::STENSOR;
179
181};
182
183static constexpr Stress stress;
184
185struct SecondPiolaKirchhoffStress : Variable<SecondPiolaKirchhoffStress>
186{
187 constexpr static const char* name = "SecondPiolaKirchhoffStress";
188
189 constexpr static mgis::behaviour::Variable::Type type =
190 mgis::behaviour::Variable::Type::STENSOR;
191
193};
194
196
197struct Saturation : Variable<Saturation>
198{
199 constexpr static const char* name = "Saturation";
200
201 constexpr static mgis::behaviour::Variable::Type type =
202 mgis::behaviour::Variable::Type::SCALAR;
203
204 constexpr static auto mpl_var =
206};
207
208static constexpr Saturation saturation;
209
210struct Temperature : Variable<Temperature>
211{
212 constexpr static const char* name = "Temperature";
213
214 constexpr static mgis::behaviour::Variable::Type type =
215 mgis::behaviour::Variable::Type::SCALAR;
216
217 constexpr static auto mpl_var =
219};
220
221static constexpr Temperature temperature;
222} // namespace MaterialLib::Solids::MFront
#define OGS_FATAL(...)
Definition Error.h:26
DeformationGradient deformation_gradient
constexpr auto to_underlying(E e) noexcept
Converts an enumeration to its underlying type.
Definition cpp23.h:29
static constexpr Temperature temperature
Definition Variable.h:221
static constexpr SecondPiolaKirchhoffStress second_piola_kirchhoff_stress
Definition Variable.h:195
static constexpr LiquidPressure liquid_pressure
Definition Variable.h:171
static constexpr Strain strain
Instance that can be used for overload resolution/template type deduction.
Definition Variable.h:120
static constexpr DeformationGradient deformation_gradient
Instance that can be used for overload resolution/template type deduction.
Definition Variable.h:158
static constexpr Saturation saturation
Definition Variable.h:208
static constexpr GreenLagrangeStrain green_lagrange_strain
Instance that can be used for overload resolution/template type deduction.
Definition Variable.h:140
static constexpr Stress stress
Definition Variable.h:183
constexpr int tensorSize(int dim)
See Tensor type for details.
Definition Tensor.h:19
constexpr int kelvin_vector_dimensions(int const displacement_dim)
Kelvin vector dimensions for given displacement dimension.
Meta data for deformation gradient.
Definition Variable.h:144
static constexpr const char * name
The name of the variable in MFront.
Definition Variable.h:146
static constexpr auto mpl_var
The VariableArray entry that holds this variable in OGS.
Definition Variable.h:153
static constexpr mgis::behaviour::Variable::Type type
The type of the variable in MFront.
Definition Variable.h:149
Meta data for Green-Lagrange strain.
Definition Variable.h:124
static constexpr mgis::behaviour::Variable::Type type
The type of the variable in MFront.
Definition Variable.h:129
static constexpr const char * name
The name of the variable in MFront.
Definition Variable.h:126
static constexpr const char * name
Definition Variable.h:162
static constexpr mgis::behaviour::Variable::Type type
Definition Variable.h:164
static constexpr mgis::behaviour::Variable::Type type
Definition Variable.h:201
static constexpr const char * name
Definition Variable.h:199
static constexpr mgis::behaviour::Variable::Type type
Definition Variable.h:189
static constexpr mgis::behaviour::Variable::Type type
The type of the variable in MFront.
Definition Variable.h:109
static constexpr const char * name
The name of the variable in MFront.
Definition Variable.h:106
static constexpr auto mpl_var
Definition Variable.h:115
static constexpr mgis::behaviour::Variable::Type type
Definition Variable.h:177
static constexpr auto mpl_var
Definition Variable.h:180
static constexpr const char * name
Definition Variable.h:175
static constexpr const char * name
Definition Variable.h:212
static constexpr mgis::behaviour::Variable::Type type
Definition Variable.h:214
static constexpr std::size_t cols()
The number of columns of the variable.
Definition Variable.h:72
static constexpr std::size_t rows()
The number of rows of the variable.
Definition Variable.h:39
static constexpr std::size_t size()
The number of components of the variable.
Definition Variable.h:32