OGS
Variable.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#pragma once
5
6#include <MGIS/Behaviour/Variable.hxx>
7
8#include "BaseLib/cpp23.h"
12
14{
20template <typename Derived>
22{
24 template <int DisplacementDim>
25 static constexpr std::size_t size()
26 {
28 }
29
31 template <int DisplacementDim>
32 static constexpr std::size_t rows()
33 {
34 using T = mgis::behaviour::Variable::Type;
35
36 switch (Derived::type)
37 {
38 case T::SCALAR:
39 return 1;
40 case T::VECTOR:
41 return DisplacementDim;
42 case T::STENSOR:
44 DisplacementDim);
45 case T::TENSOR:
46 return MaterialPropertyLib::tensorSize(DisplacementDim);
47 case T::VECTOR_1D:
48 case T::VECTOR_2D:
49 case T::VECTOR_3D:
50 case T::STENSOR_1D:
51 case T::STENSOR_2D:
52 case T::STENSOR_3D:
53 case T::TENSOR_1D:
54 case T::TENSOR_2D:
55 case T::TENSOR_3D:
56 case T::HIGHER_ORDER_TENSOR:
57 case T::ARRAY:
58 OGS_FATAL("Unsupported MGIS variable type {}.",
59 BaseLib::to_underlying(Derived::type));
60 }
61 }
62
64 template <int DisplacementDim>
65 static constexpr std::size_t cols()
66 {
67 using T = mgis::behaviour::Variable::Type;
68 switch (Derived::type)
69 {
70 case T::SCALAR:
71 return 1;
72 case T::VECTOR:
73 return 1;
74 case T::STENSOR:
75 return 1;
76 case T::TENSOR:
77 return 1;
78 case T::VECTOR_1D:
79 case T::VECTOR_2D:
80 case T::VECTOR_3D:
81 case T::STENSOR_1D:
82 case T::STENSOR_2D:
83 case T::STENSOR_3D:
84 case T::TENSOR_1D:
85 case T::TENSOR_2D:
86 case T::TENSOR_3D:
87 case T::HIGHER_ORDER_TENSOR:
88 case T::ARRAY:
89 OGS_FATAL("Unsupported MGIS variable type {}.",
90 BaseLib::to_underlying(Derived::type));
91 }
92 }
93};
94
96struct Strain : Variable<Strain>
97{
99 constexpr static const char* name = "Strain";
100
102 constexpr static mgis::behaviour::Variable::Type type =
103 mgis::behaviour::Variable::Type::STENSOR;
104
108 constexpr static auto mpl_var =
110};
111
113static constexpr Strain strain;
114
116struct GreenLagrangeStrain : Variable<GreenLagrangeStrain>
117{
119 constexpr static const char* name = "GreenLagrangeStrain";
120
122 constexpr static mgis::behaviour::Variable::Type type =
123 mgis::behaviour::Variable::Type::STENSOR;
124
128 constexpr static auto mpl_var =
130};
131
134
136struct DeformationGradient : Variable<DeformationGradient>
137{
139 constexpr static const char* name = "DeformationGradient";
140
142 constexpr static mgis::behaviour::Variable::Type type =
143 mgis::behaviour::Variable::Type::TENSOR;
144
146 constexpr static auto mpl_var =
148};
149
152
153struct LiquidPressure : Variable<LiquidPressure>
154{
155 constexpr static const char* name = "LiquidPressure";
156
157 constexpr static mgis::behaviour::Variable::Type type =
158 mgis::behaviour::Variable::Type::SCALAR;
159
160 constexpr static auto mpl_var =
162};
163
165
166struct Stress : Variable<Stress>
167{
168 constexpr static const char* name = "Stress";
169
170 constexpr static mgis::behaviour::Variable::Type type =
171 mgis::behaviour::Variable::Type::STENSOR;
172
174};
175
176static constexpr Stress stress;
177
178struct SecondPiolaKirchhoffStress : Variable<SecondPiolaKirchhoffStress>
179{
180 constexpr static const char* name = "SecondPiolaKirchhoffStress";
181
182 constexpr static mgis::behaviour::Variable::Type type =
183 mgis::behaviour::Variable::Type::STENSOR;
184
186};
187
189
190struct Saturation : Variable<Saturation>
191{
192 constexpr static const char* name = "Saturation";
193
194 constexpr static mgis::behaviour::Variable::Type type =
195 mgis::behaviour::Variable::Type::SCALAR;
196
197 constexpr static auto mpl_var =
199};
200
201static constexpr Saturation saturation;
202
203struct Temperature : Variable<Temperature>
204{
205 constexpr static const char* name = "Temperature";
206
207 constexpr static mgis::behaviour::Variable::Type type =
208 mgis::behaviour::Variable::Type::SCALAR;
209
210 constexpr static auto mpl_var =
212};
213
214static constexpr Temperature temperature;
215} // namespace MaterialLib::Solids::MFront
#define OGS_FATAL(...)
Definition Error.h:19
DeformationGradient deformation_gradient
constexpr auto to_underlying(E e) noexcept
Converts an enumeration to its underlying type.
Definition cpp23.h:22
static constexpr Temperature temperature
Definition Variable.h:214
static constexpr SecondPiolaKirchhoffStress second_piola_kirchhoff_stress
Definition Variable.h:188
static constexpr LiquidPressure liquid_pressure
Definition Variable.h:164
static constexpr Strain strain
Instance that can be used for overload resolution/template type deduction.
Definition Variable.h:113
static constexpr DeformationGradient deformation_gradient
Instance that can be used for overload resolution/template type deduction.
Definition Variable.h:151
static constexpr Saturation saturation
Definition Variable.h:201
static constexpr GreenLagrangeStrain green_lagrange_strain
Instance that can be used for overload resolution/template type deduction.
Definition Variable.h:133
static constexpr Stress stress
Definition Variable.h:176
constexpr int tensorSize(int dim)
See Tensor type for details.
Definition Tensor.h:13
constexpr int kelvin_vector_dimensions(int const displacement_dim)
Kelvin vector dimensions for given displacement dimension.
Meta data for deformation gradient.
Definition Variable.h:137
static constexpr const char * name
The name of the variable in MFront.
Definition Variable.h:139
static constexpr auto mpl_var
The VariableArray entry that holds this variable in OGS.
Definition Variable.h:146
static constexpr mgis::behaviour::Variable::Type type
The type of the variable in MFront.
Definition Variable.h:142
Meta data for Green-Lagrange strain.
Definition Variable.h:117
static constexpr mgis::behaviour::Variable::Type type
The type of the variable in MFront.
Definition Variable.h:122
static constexpr const char * name
The name of the variable in MFront.
Definition Variable.h:119
static constexpr const char * name
Definition Variable.h:155
static constexpr mgis::behaviour::Variable::Type type
Definition Variable.h:157
static constexpr mgis::behaviour::Variable::Type type
Definition Variable.h:194
static constexpr const char * name
Definition Variable.h:192
static constexpr mgis::behaviour::Variable::Type type
Definition Variable.h:182
Meta data for strain.
Definition Variable.h:97
static constexpr mgis::behaviour::Variable::Type type
The type of the variable in MFront.
Definition Variable.h:102
static constexpr const char * name
The name of the variable in MFront.
Definition Variable.h:99
static constexpr auto mpl_var
Definition Variable.h:108
static constexpr mgis::behaviour::Variable::Type type
Definition Variable.h:170
static constexpr auto mpl_var
Definition Variable.h:173
static constexpr const char * name
Definition Variable.h:168
static constexpr const char * name
Definition Variable.h:205
static constexpr mgis::behaviour::Variable::Type type
Definition Variable.h:207
static constexpr std::size_t cols()
The number of columns of the variable.
Definition Variable.h:65
static constexpr std::size_t rows()
The number of rows of the variable.
Definition Variable.h:32
static constexpr std::size_t size()
The number of components of the variable.
Definition Variable.h:25