OGS
ProcessLib::HT Namespace Reference

Namespaces

namespace  anonymous_namespace{HTFEM.cpp}

Classes

class  HTFEM
class  HTLocalAssemblerInterface
class  HTProcess
struct  HTProcessData
struct  IntegrationPointData
class  MonolithicHTFEM
class  StaggeredHTFEM

Functions

void checkThermalExpansivitySetting (MaterialPropertyLib::MaterialSpatialDistributionMap const &media_map)
void checkMPLProperties (MeshLib::Mesh const &mesh, MaterialPropertyLib::MaterialSpatialDistributionMap const &media_map)
std::unique_ptr< ProcesscreateHTProcess (std::string const &name, MeshLib::Mesh &mesh, std::unique_ptr< ProcessLib::AbstractJacobianAssembler > &&jacobian_assembler, std::vector< ProcessVariable > const &variables, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, unsigned const integration_order, BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< MeshLib::Mesh > > const &meshes, std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const &media)
double evalEffectiveThermalExpansivity (double const t, double const dt, ParameterLib::SpatialPosition const &pos, MaterialPropertyLib::VariableArray const &vars, MaterialPropertyLib::Medium const &medium, MaterialPropertyLib::Phase const &liquid_phase, MaterialPropertyLib::Phase const &solid_phase, bool const has_solid_thermal_expansivity, double const specific_storage)
void checkBiotStorageRelation (double const t, double const dt, ParameterLib::SpatialPosition const &pos, MaterialPropertyLib::VariableArray const &vars, MaterialPropertyLib::Medium const &medium, MaterialPropertyLib::Phase const &solid_phase)

Variables

const unsigned NUM_NODAL_DOF = 2

Function Documentation

◆ checkBiotStorageRelation()

void ProcessLib::HT::checkBiotStorageRelation ( double const t,
double const dt,
ParameterLib::SpatialPosition const & pos,
MaterialPropertyLib::VariableArray const & vars,
MaterialPropertyLib::Medium const & medium,
MaterialPropertyLib::Phase const & solid_phase )

Checks the requirement \(\alpha_B=1 \Rightarrow S_s=0\) on the evaluated Biot coefficient of medium and the evaluated specific storage of solid_phase at the position pos, and ends the run with OGS_FATAL if it is violated.

Both properties are evaluated with vars, t and dt, i.e. with the state the caller has set. At initialisation time the caller passes an empty vars and \(t=dt=0\) – the literal zero, not the initial time of the time loop, which may differ. Properties that depend on neither the primary variables nor the time are therefore fully checked there. Properties that do depend on the primary variables evaluate to NaN instead; a Biot coefficient of NaN compares unequal to one and a specific storage of NaN is excluded explicitly, so the check passes in both cases. A property depending on the time is checked at \(t=0\) only, which is a state the simulation need not pass through at all. Those cases are covered by the check on the evaluated values in evalEffectiveThermalExpansivity().

Definition at line 83 of file HTFEM.cpp.

88{
89 double const biot_coefficient =
91 .template value<double>(vars, pos, t, dt);
92 double const specific_storage =
94 .template value<double>(vars, pos, t, dt);
95
96 checkBiotStorageRelationValues(pos, biot_coefficient, specific_storage);
97}

References MaterialPropertyLib::biot_coefficient, MaterialPropertyLib::Medium::property(), MaterialPropertyLib::Phase::property(), and MaterialPropertyLib::storage.

Referenced by ProcessLib::HT::HTFEM< ShapeFunction, GlobalDim >::initializeConcrete().

◆ checkMPLProperties()

void ProcessLib::HT::checkMPLProperties ( MeshLib::Mesh const & mesh,
MaterialPropertyLib::MaterialSpatialDistributionMap const & media_map )

Definition at line 58 of file CreateHTProcess.cpp.

61{
62 std::array const required_property_medium = {
68
69 std::array const required_property_liquid_phase = {
74
75 std::array const required_property_solid_phase = {
80
81 std::array<MaterialPropertyLib::PropertyType, 0> const
82 required_gas_properties{};
83
85 mesh, media_map, required_property_medium,
86 required_property_solid_phase, required_property_liquid_phase,
87 required_gas_properties);
88
90}
void checkMaterialSpatialDistributionMap(MeshLib::Mesh const &mesh, MaterialPropertyLib::MaterialSpatialDistributionMap const &media_map, ContainerMedium const &required_properties_medium, ContainerSolid const &required_properties_solid_phase, ContainerLiquid const &required_properties_liquid_phase, ContainerGas const &required_properties_gas_phase)
void checkThermalExpansivitySetting(MaterialPropertyLib::MaterialSpatialDistributionMap const &media_map)

References MaterialPropertyLib::checkMaterialSpatialDistributionMap(), checkThermalExpansivitySetting(), MaterialPropertyLib::density, MaterialPropertyLib::permeability, MaterialPropertyLib::porosity, MaterialPropertyLib::specific_heat_capacity, MaterialPropertyLib::storage, MaterialPropertyLib::thermal_conductivity, MaterialPropertyLib::thermal_longitudinal_dispersivity, MaterialPropertyLib::thermal_transversal_dispersivity, and MaterialPropertyLib::viscosity.

Referenced by createHTProcess().

◆ checkThermalExpansivitySetting()

void ProcessLib::HT::checkThermalExpansivitySetting ( MaterialPropertyLib::MaterialSpatialDistributionMap const & media_map)

Definition at line 27 of file CreateHTProcess.cpp.

29{
30 for (auto const& medium : media_map.media())
31 {
32 auto const& solid_phase =
34
35 bool const has_thermal_expansivity = solid_phase.hasProperty(
37 if (has_thermal_expansivity)
38 {
39 bool const has_biot_coefficient = medium->hasProperty(
41 if (!has_biot_coefficient)
42 {
44 "Thermal expansivity is defined in the solid phase of "
45 "{:s}, which requires the Biot coefficient. Add the "
46 "'biot_coefficient' property to that medium's properties "
47 "in the material configuration.",
48 medium->description());
49 }
50
51 // The requirement alpha_B = 1 => S_s = 0 is checked on the
52 // evaluated values in checkBiotStorageRelation() and
53 // evalEffectiveThermalExpansivity().
54 }
55 }
56}
#define OGS_FATAL(...)
Definition Error.h:10

References MaterialPropertyLib::biot_coefficient, MaterialPropertyLib::MaterialSpatialDistributionMap::media(), OGS_FATAL, MaterialPropertyLib::Solid, and MaterialPropertyLib::thermal_expansivity.

Referenced by checkMPLProperties().

◆ createHTProcess()

std::unique_ptr< Process > ProcessLib::HT::createHTProcess ( std::string const & name,
MeshLib::Mesh & mesh,
std::unique_ptr< ProcessLib::AbstractJacobianAssembler > && jacobian_assembler,
std::vector< ProcessVariable > const & variables,
std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const & parameters,
unsigned const integration_order,
BaseLib::ConfigTree const & config,
std::vector< std::unique_ptr< MeshLib::Mesh > > const & meshes,
std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const & media )
Input File Parameter
prj__processes__process__type
Input File Parameter
prj__processes__process__HT__coupling_scheme

Process Variables

Input File Parameter
prj__processes__process__HT__process_variables

Primary process variables as they appear in the global component vector:

Input File Parameter
prj__processes__process__HT__process_variables__temperature
Input File Parameter
prj__processes__process__HT__process_variables__pressure

Process Parameters

Input File Parameter
prj__processes__process__HT__specific_body_force
Input File Parameter
prj__processes__process__calculatesurfaceflux
Input File Parameter
prj__processes__process__HT__aperture_size
Input File Parameter
prj__processes__process__HT__aperture_size__parameter
Input File Parameter
prj__processes__process__HT__equation_balance_type

Definition at line 92 of file CreateHTProcess.cpp.

102{
104 config.checkConfigParameter("type", "HT");
105
106 DBUG("Create HTProcess.");
107
108 auto const coupling_scheme =
110 config.getConfigParameterOptional<std::string>("coupling_scheme");
111 const bool use_monolithic_scheme =
112 !(coupling_scheme && (*coupling_scheme == "staggered"));
113
115
117 auto const pv_config = config.getConfigSubtree("process_variables");
118
119 // Process IDs, which are set according to the appearance order of the
120 // process variables.
121 int const heat_transport_process_id = 0;
122 int hydraulic_process_id = 0;
123
124 std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>
125 process_variables;
126 if (use_monolithic_scheme) // monolithic scheme.
127 {
130 auto per_process_variables = findProcessVariables(
131 variables, pv_config,
132 {
133 "temperature",
135 "pressure"});
136 process_variables.push_back(std::move(per_process_variables));
137 }
138 else // staggered scheme.
139 {
140 using namespace std::string_literals;
141 for (auto const& variable_name : {"temperature"s, "pressure"s})
142 {
143 auto per_process_variables =
144 findProcessVariables(variables, pv_config, {variable_name});
145 process_variables.push_back(std::move(per_process_variables));
146 }
147 hydraulic_process_id = 1;
148 }
149
151 std::vector<double> const b =
153 config.getConfigParameter<std::vector<double>>("specific_body_force");
154 assert(!b.empty() && b.size() < 4);
155 int const mesh_space_dimension =
157 if (static_cast<int>(b.size()) != mesh_space_dimension)
158 {
159 OGS_FATAL(
160 "specific body force (gravity vector) has {:d} components, "
161 "mesh dimension is {:d}",
162 b.size(), mesh_space_dimension);
163 }
164
165 // Specific body force parameter.
166 Eigen::VectorXd specific_body_force(b.size());
167 bool const has_gravity = MathLib::toVector(b).norm() > 0;
168 if (has_gravity)
169 {
170 std::copy_n(b.data(), b.size(), specific_body_force.data());
171 }
172
173 std::unique_ptr<ProcessLib::SurfaceFluxData> surfaceflux;
174 auto calculatesurfaceflux_config =
176 config.getConfigSubtreeOptional("calculatesurfaceflux");
177 if (calculatesurfaceflux_config)
178 {
180 *calculatesurfaceflux_config, meshes);
181 }
182
183 auto media_map =
185
186 DBUG("Check the media properties of HT process ...");
187 checkMPLProperties(mesh, media_map);
188 DBUG("Media properties verified.");
189
190 auto stabilizer = NumLib::createNumericalStabilization(mesh, config);
191
192 auto const* aperture_size_parameter = &ParameterLib::findParameter<double>(
194 auto const aperture_config =
196 config.getConfigSubtreeOptional("aperture_size");
197 if (aperture_config)
198 {
199 aperture_size_parameter = &ParameterLib::findParameter<double>(
201 *aperture_config, "parameter", parameters, 1);
202 }
203
204 auto const rotation_matrices = MeshLib::getElementRotationMatrices(
205 mesh_space_dimension, mesh.getDimension(), mesh.getElements());
206 std::vector<Eigen::VectorXd> projected_specific_body_force_vectors;
207 projected_specific_body_force_vectors.reserve(rotation_matrices.size());
208
209 std::transform(rotation_matrices.begin(), rotation_matrices.end(),
210 std::back_inserter(projected_specific_body_force_vectors),
211 [&specific_body_force](const auto& R)
212 { return R * R.transpose() * specific_body_force; });
213
214 auto const equation_balance_type_str =
216 config.getConfigParameter<std::string>("equation_balance_type",
217 "volume");
218 if (equation_balance_type_str != "volume" &&
219 equation_balance_type_str != "mass")
220 {
221 OGS_FATAL(
222 "Invalid equation_balance_type '{}'. Supported values: 'volume' or "
223 "'mass'.",
224 equation_balance_type_str);
225 }
226 bool const is_volume_balance_equation_type =
227 (equation_balance_type_str == "volume");
228
229 if (is_volume_balance_equation_type)
230 {
232 media_map);
233 }
234
235 HTProcessData process_data{std::move(media_map),
236 has_gravity,
237 heat_transport_process_id,
238 hydraulic_process_id,
239 std::move(stabilizer),
240 projected_specific_body_force_vectors,
241 mesh_space_dimension,
242 *aperture_size_parameter,
243 is_volume_balance_equation_type,
244 NumLib::ShapeMatrixCache{integration_order}};
245
246 SecondaryVariableCollection secondary_variables;
247
248 ProcessLib::createSecondaryVariables(config, secondary_variables);
249
250 return std::make_unique<HTProcess>(
251 std::move(name), mesh, std::move(jacobian_assembler), parameters,
252 integration_order, std::move(process_variables),
253 std::move(process_data), std::move(secondary_variables),
254 use_monolithic_scheme, std::move(surfaceflux));
255}
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:22
std::vector< Node * > const & getNodes() const
Get the nodes-vector for the mesh.
Definition Mesh.h:98
std::vector< Element * > const & getElements() const
Get the element-vector for the mesh.
Definition Mesh.h:101
unsigned getDimension() const
Definition Mesh.h:80
static PROCESSLIB_EXPORT const std::string constant_one_parameter_name
Definition Process.h:40
MaterialSpatialDistributionMap createMaterialSpatialDistributionMap(std::map< int, std::shared_ptr< Medium > > const &media, MeshLib::Mesh const &mesh)
Eigen::Map< const Vector > toVector(std::vector< double > const &data, Eigen::VectorXd::Index size)
Creates an Eigen mapped vector from the given data vector.
std::vector< Eigen::MatrixXd > getElementRotationMatrices(int const space_dimension, int const mesh_dimension, std::vector< Element * > const &elements)
Element rotation matrix computation.
int getSpaceDimension(std::vector< Node * > const &nodes)
Computes dimension of the embedding space containing the set of given points.
NumericalStabilization createNumericalStabilization(MeshLib::Mesh const &mesh, BaseLib::ConfigTree const &config)
OGS_NO_DANGLING Parameter< ParameterDataType > & findParameter(std::string const &parameter_name, std::vector< std::unique_ptr< ParameterBase > > const &parameters, int const num_components, MeshLib::Mesh const *const mesh=nullptr)
void checkVolumeBalanceEquationSetting(MaterialPropertyLib::MaterialSpatialDistributionMap const &media_map)
void checkMPLProperties(MeshLib::Mesh const &mesh, MaterialPropertyLib::MaterialSpatialDistributionMap const &media_map)
std::vector< std::reference_wrapper< ProcessVariable > > findProcessVariables(std::vector< ProcessVariable > const &variables, BaseLib::ConfigTree const &pv_config, std::initializer_list< std::string > tags)
void createSecondaryVariables(BaseLib::ConfigTree const &config, SecondaryVariableCollection &secondary_variables)
static std::unique_ptr< ProcessLib::SurfaceFluxData > createSurfaceFluxData(BaseLib::ConfigTree const &calculatesurfaceflux_config, std::vector< std::unique_ptr< MeshLib::Mesh > > const &meshes)

References BaseLib::ConfigTree::checkConfigParameter(), checkMPLProperties(), ProcessLib::Common::HydraulicProcess::checkVolumeBalanceEquationSetting(), ProcessLib::Process::constant_one_parameter_name, MaterialPropertyLib::createMaterialSpatialDistributionMap(), NumLib::createNumericalStabilization(), ProcessLib::createSecondaryVariables(), ProcessLib::SurfaceFluxData::createSurfaceFluxData(), DBUG(), ParameterLib::findParameter(), ProcessLib::findProcessVariables(), BaseLib::ConfigTree::getConfigParameter(), BaseLib::ConfigTree::getConfigParameterOptional(), BaseLib::ConfigTree::getConfigSubtree(), BaseLib::ConfigTree::getConfigSubtreeOptional(), MeshLib::Mesh::getDimension(), MeshLib::getElementRotationMatrices(), MeshLib::Mesh::getElements(), MeshLib::Mesh::getNodes(), MeshLib::getSpaceDimension(), OGS_FATAL, and MathLib::toVector().

Referenced by ProjectData::parseProcesses().

◆ evalEffectiveThermalExpansivity()

double ProcessLib::HT::evalEffectiveThermalExpansivity ( double const t,
double const dt,
ParameterLib::SpatialPosition const & pos,
MaterialPropertyLib::VariableArray const & vars,
MaterialPropertyLib::Medium const & medium,
MaterialPropertyLib::Phase const & liquid_phase,
MaterialPropertyLib::Phase const & solid_phase,
bool const has_solid_thermal_expansivity,
double const specific_storage )

Computes the effective thermal expansivity \(3(\alpha_B-\phi)\alpha_T^s - \phi\frac{\partial \varrho_f}{\partial T}/\varrho_f\) used in the thermal expansion term of the pressure equation.

The fluid contribution \(-\phi\frac{\partial \varrho_f}{\partial T}/\varrho_f\) is always present. The solid contribution \(3(\alpha_B-\phi)\alpha_T^s\) is added only if has_solid_thermal_expansivity is true.

Parameters
tCurrent time.
dtTime increment.
posSpatial position of the current integration point.
varsVariable array of the current integration point. Its density and porosity members must already be set, since they are read instead of being evaluated here.
mediumMedium, provides the Biot coefficient \(\alpha_B\).
liquid_phaseLiquid phase, provides \(\frac{\partial \varrho_f}{\partial T}\).
solid_phaseSolid phase, provides the linear solid thermal expansivity \(\alpha_T^s\).
has_solid_thermal_expansivityWhether the solid phase defines thermal_expansivity. Passed in rather than queried here so that the callers can hoist the property lookup out of their integration point loop.
specific_storageSpecific storage \(S_s\) of the solid phase at the current integration point. Not used in the returned value; it is passed in only so that the requirement \(\alpha_B=1 \Rightarrow S_s=0\) can be checked against the evaluated values, which is the only place where it can be checked for properties that depend on the primary variables. The function is fatal if the requirement is violated. Passed in rather than evaluated here to avoid evaluating the storage property twice per integration point, since the callers already need its value.

Definition at line 43 of file HTFEM.cpp.

50{
51 double const dfluid_density_dT =
53 .template dValue<double>(
55
56 double const fluid_density = vars.density;
57 double const porosity = vars.porosity;
58 double const fluid_thermal_expansivity =
59 -porosity * dfluid_density_dT / fluid_density;
60
61 if (!has_solid_thermal_expansivity)
62 {
63 return fluid_thermal_expansivity;
64 }
65
66 double const linear_solid_thermal_expansivity =
67 solid_phase
69 .template value<double>(vars, pos, t, dt);
70 double const biot_coefficient =
72 .template value<double>(vars, pos, t, dt);
73
74 // Both properties may vary in space and time, so the evaluated values are
75 // the only ones that can be compared. The state independent cases are
76 // caught earlier by checkBiotStorageRelation().
77 checkBiotStorageRelationValues(pos, biot_coefficient, specific_storage);
78
79 return fluid_thermal_expansivity + 3.0 * (biot_coefficient - porosity) *
80 linear_solid_thermal_expansivity;
81}

References MaterialPropertyLib::biot_coefficient, MaterialPropertyLib::density, MaterialPropertyLib::VariableArray::density, MaterialPropertyLib::VariableArray::porosity, MaterialPropertyLib::Medium::property(), MaterialPropertyLib::Phase::property(), MaterialPropertyLib::temperature, and MaterialPropertyLib::thermal_expansivity.

Referenced by ProcessLib::HT::MonolithicHTFEM< ShapeFunction, GlobalDim >::assemble(), and ProcessLib::HT::StaggeredHTFEM< ShapeFunction, GlobalDim >::assembleHydraulicEquation().

Variable Documentation

◆ NUM_NODAL_DOF