OGS
IntegrationPointData.h
Go to the documentation of this file.
1
11#pragma once
12
13#include <memory>
14
20
21namespace ProcessLib
22{
23namespace ThermoHydroMechanics
24{
25template <typename BMatricesType, typename ShapeMatrixTypeDisplacement,
26 typename ShapeMatricesTypePressure, int DisplacementDim, int NPoints>
28{
34 solid_material.createMaterialStateVariables())
35 {
36 // Initialize current time step values
37 static const int kelvin_vector_size =
39 sigma_eff.setZero(kelvin_vector_size);
40 sigma_eff_ice.setZero(kelvin_vector_size);
41 eps.setZero(kelvin_vector_size);
42 eps0.setZero(kelvin_vector_size);
43 eps0_prev.setZero(kelvin_vector_size);
44 eps_m.setZero(kelvin_vector_size);
45 eps_m_prev.resize(kelvin_vector_size);
46 eps_m_ice.setZero(kelvin_vector_size);
47 eps_m_ice_prev.resize(kelvin_vector_size);
48
49 // Previous time step values are not initialized and are set later.
50 sigma_eff_prev.resize(kelvin_vector_size);
51 sigma_eff_ice_prev.resize(kelvin_vector_size);
52 }
53
54 typename BMatricesType::KelvinVectorType sigma_eff, sigma_eff_prev;
55 typename BMatricesType::KelvinVectorType eps, eps0, eps0_prev;
56 typename BMatricesType::KelvinVectorType eps_m, eps_m_prev;
57
58 typename BMatricesType::KelvinVectorType sigma_eff_ice, sigma_eff_ice_prev;
59 typename BMatricesType::KelvinVectorType eps_m_ice, eps_m_ice_prev;
60
61 typename ShapeMatrixTypeDisplacement::NodalRowVectorType N_u;
62 typename ShapeMatrixTypeDisplacement::GlobalDimNodalMatrixType dNdx_u;
63
64 // Scalar shape matrices for pressure and temperature.
65 typename ShapeMatricesTypePressure::NodalRowVectorType N;
66 typename ShapeMatricesTypePressure::GlobalDimNodalMatrixType dNdx;
67
69 std::unique_ptr<typename MaterialLib::Solids::MechanicsBase<
70 DisplacementDim>::MaterialStateVariables>
72
73 double phi_fr = std::numeric_limits<double>::quiet_NaN();
74 double phi_fr_prev = std::numeric_limits<double>::quiet_NaN();
76
77 double porosity;
78
88
91 double const t,
92 ParameterLib::SpatialPosition const& x_position,
93 double const dt,
94 double const temperature)
95 {
96 namespace MPL = MaterialPropertyLib;
97
98 MPL::VariableArray variable_array;
99 MPL::VariableArray variable_array_prev;
100
102
103 variable_array.stress.emplace<KV>(KV::Zero());
104 variable_array.mechanical_strain.emplace<KV>(KV::Zero());
105 variable_array.temperature = temperature;
106
107 variable_array_prev.stress.emplace<KV>(KV::Zero());
108 variable_array_prev.mechanical_strain.emplace<KV>(KV::Zero());
109 variable_array_prev.temperature = temperature;
110
111 auto&& solution = solid_material.integrateStress(
112 variable_array_prev, variable_array, t, x_position, dt,
114
115 if (!solution)
116 {
117 OGS_FATAL("Computation of elastic tangent stiffness failed.");
118 }
119
121 std::move(std::get<2>(*solution));
122
123 return C;
124 }
125
126 typename BMatricesType::KelvinMatrixType updateConstitutiveRelation(
127 MaterialPropertyLib::VariableArray const& variable_array,
128 double const t,
129 ParameterLib::SpatialPosition const& x_position,
130 double const dt,
131 double const temperature_prev)
132 {
133 MaterialPropertyLib::VariableArray variable_array_prev;
134 variable_array_prev.stress
137 variable_array_prev.mechanical_strain
139 eps_m_prev);
140 variable_array_prev.temperature = temperature_prev;
141
142 auto&& solution = solid_material.integrateStress(
143 variable_array_prev, variable_array, t, x_position, dt,
145
146 if (!solution)
147 OGS_FATAL("Computation of local constitutive relation failed.");
148
150 std::tie(sigma_eff, material_state_variables, C) = std::move(*solution);
151
152 return C;
153 }
154
155 typename BMatricesType::KelvinMatrixType updateConstitutiveRelationIce(
157 ice_constitutive_relation,
158 MaterialPropertyLib::VariableArray const& variable_array,
159 double const t,
160 ParameterLib::SpatialPosition const& x_position,
161 double const dt,
162 double const temperature_prev)
163 {
164 MaterialPropertyLib::VariableArray variable_array_prev;
165
166 variable_array_prev.stress
169 variable_array_prev.mechanical_strain
172 variable_array_prev.temperature = temperature_prev;
173
174 // Extend for non-linear ice materials if necessary.
175 auto const null_state =
176 ice_constitutive_relation.createMaterialStateVariables();
177 ice_constitutive_relation.initializeInternalStateVariables(
178 t, x_position, *null_state);
179 auto&& solution = ice_constitutive_relation.integrateStress(
180 variable_array_prev, variable_array, t, x_position, dt,
181 *null_state);
182
183 if (!solution)
184 OGS_FATAL("Computation of local constitutive relation failed.");
185
187 std::tie(sigma_eff_ice, material_state_variables, C_IR) =
188 std::move(*solution);
189
190 return C_IR;
191 }
193};
194
195template <int DisplacementDim>
197{
199 // Darcy velocity for output. Care must be taken for the deactivated
200 // elements.
201 DimVector velocity = DimVector::Constant(
202 DisplacementDim, std::numeric_limits<double>::quiet_NaN());
203
204 double fluid_density = std::numeric_limits<double>::quiet_NaN();
205 double viscosity = std::numeric_limits<double>::quiet_NaN();
206};
207
208template <int DisplacementDim>
234
235} // namespace ThermoHydroMechanics
236} // namespace ProcessLib
#define OGS_FATAL(...)
Definition Error.h:26
constexpr int kelvin_vector_dimensions(int const displacement_dim)
Kelvin vector dimensions for given displacement dimension.
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
typename ::detail::EigenMatrixType< N, 1 >::type VectorType
typename ::detail::EigenMatrixType< N, M >::type MatrixType
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 std::unique_ptr< MaterialStateVariables > createMaterialStateVariables() const
MathLib::KelvinVector::KelvinMatrixType< DisplacementDim > C
typename MatrixPolicyType::MatrixType< DisplacementDim, DisplacementDim > DimMatrix
MathLib::KelvinVector::KelvinVectorType< DisplacementDim > J_uT_fr
MathLib::KelvinVector::KelvinVectorType< DisplacementDim > r_u_fr
MathLib::KelvinVector::KelvinVectorType< DisplacementDim > solid_linear_thermal_expansion_coefficient
MathLib::KelvinVector::KelvinMatrixType< DisplacementDim > J_uu_fr
MatrixPolicyType::VectorType< DisplacementDim > DimVector
BMatricesType::KelvinMatrixType updateConstitutiveRelation(MaterialPropertyLib::VariableArray const &variable_array, double const t, ParameterLib::SpatialPosition const &x_position, double const dt, double const temperature_prev)
MathLib::KelvinVector::KelvinMatrixType< DisplacementDim > computeElasticTangentStiffness(double const t, ParameterLib::SpatialPosition const &x_position, double const dt, double const temperature)
ShapeMatricesTypePressure::GlobalDimNodalMatrixType dNdx
std::unique_ptr< typename MaterialLib::Solids::MechanicsBase< DisplacementDim >::MaterialStateVariables > material_state_variables
MaterialLib::Solids::MechanicsBase< DisplacementDim > const & solid_material
ShapeMatrixTypeDisplacement::NodalRowVectorType N_u
BMatricesType::KelvinMatrixType updateConstitutiveRelationIce(MaterialLib::Solids::MechanicsBase< DisplacementDim > const &ice_constitutive_relation, MaterialPropertyLib::VariableArray const &variable_array, double const t, ParameterLib::SpatialPosition const &x_position, double const dt, double const temperature_prev)
ShapeMatricesTypePressure::NodalRowVectorType N
ShapeMatrixTypeDisplacement::GlobalDimNodalMatrixType dNdx_u
IntegrationPointData(MaterialLib::Solids::MechanicsBase< DisplacementDim > const &solid_material)