OGS
ProcessLib::ThermoHydroMechanics Namespace Reference

Classes

struct  ConstitutiveRelationsValues
struct  IntegrationPointData
struct  IntegrationPointDataForOutput
struct  LocalAssemblerInterface
struct  SecondaryData
class  ThermoHydroMechanicsLocalAssembler
class  ThermoHydroMechanicsProcess
struct  ThermoHydroMechanicsProcessData

Functions

template<int DisplacementDim>
std::unique_ptr< ProcesscreateThermoHydroMechanicsProcess (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, std::optional< ParameterLib::CoordinateSystem > const &local_coordinate_system, unsigned const integration_order, BaseLib::ConfigTree const &config, std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const &media)
template std::unique_ptr< ProcesscreateThermoHydroMechanicsProcess< 2 > (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, std::optional< ParameterLib::CoordinateSystem > const &local_coordinate_system, unsigned const integration_order, BaseLib::ConfigTree const &config, std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const &media)
template std::unique_ptr< ProcesscreateThermoHydroMechanicsProcess< 3 > (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, std::optional< ParameterLib::CoordinateSystem > const &local_coordinate_system, unsigned const integration_order, BaseLib::ConfigTree const &config, std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const &media)
template<int DisplacementDim>
THERMOHYDROMECHANICS_EXPORT std::unique_ptr< ProcesscreateThermoHydroMechanicsProcess (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, std::optional< ParameterLib::CoordinateSystem > const &local_coordinate_system, unsigned const integration_order, BaseLib::ConfigTree const &config, std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const &media)

Function Documentation

◆ createThermoHydroMechanicsProcess() [1/2]

template<int DisplacementDim>
std::unique_ptr< Process > ProcessLib::ThermoHydroMechanics::createThermoHydroMechanicsProcess ( 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,
std::optional< ParameterLib::CoordinateSystem > const & local_coordinate_system,
unsigned const integration_order,
BaseLib::ConfigTree const & config,
std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const & media )
Input File Parameter
prj__processes__process__type
Input File Parameter
prj__processes__process__THERMO_HYDRO_MECHANICS__coupling_scheme

Process Variables

Input File Parameter
prj__processes__process__THERMO_HYDRO_MECHANICS__process_variables

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

Input File Parameter
prj__processes__process__THERMO_HYDRO_MECHANICS__process_variables__temperature
Input File Parameter
prj__processes__process__THERMO_HYDRO_MECHANICS__process_variables__pressure
Input File Parameter
prj__processes__process__THERMO_HYDRO_MECHANICS__process_variables__displacement

Process Parameters

Input File Parameter
prj__processes__process__THERMO_HYDRO_MECHANICS__specific_body_force
Input File Parameter
prj__processes__process__linear

Definition at line 26 of file CreateThermoHydroMechanicsProcess.cpp.

35{
37 config.checkConfigParameter("type", "THERMO_HYDRO_MECHANICS");
38 DBUG("Create ThermoHydroMechanicsProcess.");
39
40 auto const coupling_scheme =
42 config.getConfigParameterOptional<std::string>("coupling_scheme");
43 const bool use_monolithic_scheme =
44 !(coupling_scheme && (*coupling_scheme == "staggered"));
45
47
49 auto const pv_config = config.getConfigSubtree("process_variables");
50
51 ProcessVariable* variable_T;
52 ProcessVariable* variable_p;
53 ProcessVariable* variable_u;
54 std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>
55 process_variables;
56 if (use_monolithic_scheme) // monolithic scheme.
57 {
60 auto per_process_variables = findProcessVariables(
61 variables, pv_config,
62 {
63 "temperature",
65 "pressure",
67 "displacement"});
68 variable_T = &per_process_variables[0].get();
69 variable_p = &per_process_variables[1].get();
70 variable_u = &per_process_variables[2].get();
71 process_variables.push_back(std::move(per_process_variables));
72 }
73 else // staggered scheme.
74 {
75 using namespace std::string_literals;
76 for (auto const& variable_name :
77 {"temperature"s, "pressure"s, "displacement"s})
78 {
79 auto per_process_variables =
80 findProcessVariables(variables, pv_config, {variable_name});
81 process_variables.push_back(std::move(per_process_variables));
82 }
83 variable_T = &process_variables[0][0].get();
84 variable_p = &process_variables[1][0].get();
85 variable_u = &process_variables[2][0].get();
86 }
87
88 if (variable_T->getShapeFunctionOrder() != 1)
89 {
91 "The shape function order of temperature must be 1 but its input "
92 "value in <process_variable><order> is {:d}. Please correct it.",
93 variable_T->getShapeFunctionOrder());
94 }
95 if (variable_p->getShapeFunctionOrder() != 1)
96 {
98 "The shape function order of pressure must be 1 but its input "
99 "value in <process_variable><order> is {:d}. Please correct it.",
100 variable_p->getShapeFunctionOrder());
101 }
102
103 DBUG("Associate displacement with process variable '{:s}'.",
104 variable_u->getName());
105
106 if (variable_u->getNumberOfGlobalComponents() != DisplacementDim)
107 {
108 OGS_FATAL(
109 "Number of components of the process variable '{:s}' is different "
110 "from the displacement dimension: got {:d}, expected {:d}",
111 variable_u->getName(),
112 variable_u->getNumberOfGlobalComponents(),
113 DisplacementDim);
114 }
115
116 DBUG("Associate pressure with process variable '{:s}'.",
117 variable_p->getName());
118 if (variable_p->getNumberOfGlobalComponents() != 1)
119 {
120 OGS_FATAL(
121 "Pressure process variable '{:s}' is not a scalar variable but has "
122 "{:d} components.",
123 variable_p->getName(),
124 variable_p->getNumberOfGlobalComponents());
125 }
126
127 DBUG("Associate temperature with process variable '{:s}'.",
128 variable_T->getName());
129 if (variable_T->getNumberOfGlobalComponents() != 1)
130 {
131 OGS_FATAL(
132 "temperature process variable '{:s}' is not a scalar variable but "
133 "has {:d} components.",
134 variable_T->getName(),
135 variable_T->getNumberOfGlobalComponents());
136 }
137
139 auto solid_constitutive_relations =
141 parameters, local_coordinate_system, materialIDs(mesh), config);
142
143 auto ice_constitutive_relation =
145 parameters, local_coordinate_system, config);
146
147 // Specific body force
148 Eigen::Matrix<double, DisplacementDim, 1> specific_body_force;
149 {
150 std::vector<double> const b =
152 config.getConfigParameter<std::vector<double>>(
153 "specific_body_force");
154 if (b.size() != DisplacementDim)
155 {
156 OGS_FATAL(
157 "The size of the specific body force vector does not match the "
158 "displacement dimension. Vector size is {:d}, displacement "
159 "dimension is {:d}",
160 b.size(), DisplacementDim);
161 }
162
163 std::copy_n(b.data(), b.size(), specific_body_force.data());
164 }
165
166 auto const is_linear =
168 config.getConfigParameter("linear", false);
169
170 auto media_map =
172
173 // Initial stress conditions
174
176 config, parameters, mesh);
177
178 auto stabilizer = NumLib::createNumericalStabilization(mesh, config);
179
181 materialIDs(mesh),
182 std::move(media_map),
183 std::move(solid_constitutive_relations),
184 std::move(ice_constitutive_relation),
185 std::move(initial_stress),
186 specific_body_force,
187 std::move(stabilizer)};
188
189 SecondaryVariableCollection secondary_variables;
190
191 ProcessLib::createSecondaryVariables(config, secondary_variables);
192
193 return std::make_unique<ThermoHydroMechanicsProcess<DisplacementDim>>(
194 std::move(name), mesh, std::move(jacobian_assembler), parameters,
195 integration_order, std::move(process_variables),
196 std::move(process_data), std::move(secondary_variables),
197 use_monolithic_scheme, is_linear);
198}
#define OGS_FATAL(...)
Definition Error.h:19
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:22
unsigned getShapeFunctionOrder() const
std::string const & getName() const
int getNumberOfGlobalComponents() const
Returns the number of components of the process variable.
std::map< int, std::shared_ptr< MaterialLib::Solids::MechanicsBase< DisplacementDim > > > createConstitutiveRelations(std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, std::optional< ParameterLib::CoordinateSystem > const &local_coordinate_system, MeshLib::PropertyVector< int > const *const material_ids, BaseLib::ConfigTree const &config)
std::unique_ptr< MaterialLib::Solids::MechanicsBase< DisplacementDim > > createConstitutiveRelationIce(std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, std::optional< ParameterLib::CoordinateSystem > const &local_coordinate_system, BaseLib::ConfigTree const &config)
MaterialSpatialDistributionMap createMaterialSpatialDistributionMap(std::map< int, std::shared_ptr< Medium > > const &media, MeshLib::Mesh const &mesh)
PropertyVector< int > const * materialIDs(Mesh const &mesh)
Definition Mesh.cpp:258
NumericalStabilization createNumericalStabilization(MeshLib::Mesh const &mesh, BaseLib::ConfigTree const &config)
std::vector< std::reference_wrapper< ProcessVariable > > findProcessVariables(std::vector< ProcessVariable > const &variables, BaseLib::ConfigTree const &pv_config, std::initializer_list< std::string > tags)
InitialStress createInitialStress(BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, MeshLib::Mesh const &mesh, bool const mandatory_stress_type)
void createSecondaryVariables(BaseLib::ConfigTree const &config, SecondaryVariableCollection &secondary_variables)

References BaseLib::ConfigTree::checkConfigParameter(), MaterialLib::Solids::createConstitutiveRelationIce(), MaterialLib::Solids::createConstitutiveRelations(), ProcessLib::createInitialStress(), MaterialPropertyLib::createMaterialSpatialDistributionMap(), NumLib::createNumericalStabilization(), ProcessLib::createSecondaryVariables(), DBUG(), ProcessLib::findProcessVariables(), BaseLib::ConfigTree::getConfigParameter(), BaseLib::ConfigTree::getConfigParameterOptional(), BaseLib::ConfigTree::getConfigSubtree(), ProcessLib::ProcessVariable::getName(), ProcessLib::ProcessVariable::getNumberOfGlobalComponents(), ProcessLib::ProcessVariable::getShapeFunctionOrder(), and OGS_FATAL.

◆ createThermoHydroMechanicsProcess() [2/2]

template<int DisplacementDim>
THERMOHYDROMECHANICS_EXPORT std::unique_ptr< Process > ProcessLib::ThermoHydroMechanics::createThermoHydroMechanicsProcess ( 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,
std::optional< ParameterLib::CoordinateSystem > const & local_coordinate_system,
unsigned const integration_order,
BaseLib::ConfigTree const & config,
std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const & media )
Input File Parameter
prj__processes__process__type
Input File Parameter
prj__processes__process__THERMO_HYDRO_MECHANICS__coupling_scheme

Process Variables

Input File Parameter
prj__processes__process__THERMO_HYDRO_MECHANICS__process_variables

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

Input File Parameter
prj__processes__process__THERMO_HYDRO_MECHANICS__process_variables__temperature
Input File Parameter
prj__processes__process__THERMO_HYDRO_MECHANICS__process_variables__pressure
Input File Parameter
prj__processes__process__THERMO_HYDRO_MECHANICS__process_variables__displacement

Process Parameters

Input File Parameter
prj__processes__process__THERMO_HYDRO_MECHANICS__specific_body_force
Input File Parameter
prj__processes__process__linear

Definition at line 26 of file CreateThermoHydroMechanicsProcess.cpp.

35{
37 config.checkConfigParameter("type", "THERMO_HYDRO_MECHANICS");
38 DBUG("Create ThermoHydroMechanicsProcess.");
39
40 auto const coupling_scheme =
42 config.getConfigParameterOptional<std::string>("coupling_scheme");
43 const bool use_monolithic_scheme =
44 !(coupling_scheme && (*coupling_scheme == "staggered"));
45
47
49 auto const pv_config = config.getConfigSubtree("process_variables");
50
51 ProcessVariable* variable_T;
52 ProcessVariable* variable_p;
53 ProcessVariable* variable_u;
54 std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>
55 process_variables;
56 if (use_monolithic_scheme) // monolithic scheme.
57 {
60 auto per_process_variables = findProcessVariables(
61 variables, pv_config,
62 {
63 "temperature",
65 "pressure",
67 "displacement"});
68 variable_T = &per_process_variables[0].get();
69 variable_p = &per_process_variables[1].get();
70 variable_u = &per_process_variables[2].get();
71 process_variables.push_back(std::move(per_process_variables));
72 }
73 else // staggered scheme.
74 {
75 using namespace std::string_literals;
76 for (auto const& variable_name :
77 {"temperature"s, "pressure"s, "displacement"s})
78 {
79 auto per_process_variables =
80 findProcessVariables(variables, pv_config, {variable_name});
81 process_variables.push_back(std::move(per_process_variables));
82 }
83 variable_T = &process_variables[0][0].get();
84 variable_p = &process_variables[1][0].get();
85 variable_u = &process_variables[2][0].get();
86 }
87
88 if (variable_T->getShapeFunctionOrder() != 1)
89 {
91 "The shape function order of temperature must be 1 but its input "
92 "value in <process_variable><order> is {:d}. Please correct it.",
93 variable_T->getShapeFunctionOrder());
94 }
95 if (variable_p->getShapeFunctionOrder() != 1)
96 {
98 "The shape function order of pressure must be 1 but its input "
99 "value in <process_variable><order> is {:d}. Please correct it.",
100 variable_p->getShapeFunctionOrder());
101 }
102
103 DBUG("Associate displacement with process variable '{:s}'.",
104 variable_u->getName());
105
106 if (variable_u->getNumberOfGlobalComponents() != DisplacementDim)
107 {
108 OGS_FATAL(
109 "Number of components of the process variable '{:s}' is different "
110 "from the displacement dimension: got {:d}, expected {:d}",
111 variable_u->getName(),
112 variable_u->getNumberOfGlobalComponents(),
113 DisplacementDim);
114 }
115
116 DBUG("Associate pressure with process variable '{:s}'.",
117 variable_p->getName());
118 if (variable_p->getNumberOfGlobalComponents() != 1)
119 {
120 OGS_FATAL(
121 "Pressure process variable '{:s}' is not a scalar variable but has "
122 "{:d} components.",
123 variable_p->getName(),
124 variable_p->getNumberOfGlobalComponents());
125 }
126
127 DBUG("Associate temperature with process variable '{:s}'.",
128 variable_T->getName());
129 if (variable_T->getNumberOfGlobalComponents() != 1)
130 {
131 OGS_FATAL(
132 "temperature process variable '{:s}' is not a scalar variable but "
133 "has {:d} components.",
134 variable_T->getName(),
135 variable_T->getNumberOfGlobalComponents());
136 }
137
139 auto solid_constitutive_relations =
141 parameters, local_coordinate_system, materialIDs(mesh), config);
142
143 auto ice_constitutive_relation =
145 parameters, local_coordinate_system, config);
146
147 // Specific body force
148 Eigen::Matrix<double, DisplacementDim, 1> specific_body_force;
149 {
150 std::vector<double> const b =
152 config.getConfigParameter<std::vector<double>>(
153 "specific_body_force");
154 if (b.size() != DisplacementDim)
155 {
156 OGS_FATAL(
157 "The size of the specific body force vector does not match the "
158 "displacement dimension. Vector size is {:d}, displacement "
159 "dimension is {:d}",
160 b.size(), DisplacementDim);
161 }
162
163 std::copy_n(b.data(), b.size(), specific_body_force.data());
164 }
165
166 auto const is_linear =
168 config.getConfigParameter("linear", false);
169
170 auto media_map =
172
173 // Initial stress conditions
174
176 config, parameters, mesh);
177
178 auto stabilizer = NumLib::createNumericalStabilization(mesh, config);
179
181 materialIDs(mesh),
182 std::move(media_map),
183 std::move(solid_constitutive_relations),
184 std::move(ice_constitutive_relation),
185 std::move(initial_stress),
186 specific_body_force,
187 std::move(stabilizer)};
188
189 SecondaryVariableCollection secondary_variables;
190
191 ProcessLib::createSecondaryVariables(config, secondary_variables);
192
193 return std::make_unique<ThermoHydroMechanicsProcess<DisplacementDim>>(
194 std::move(name), mesh, std::move(jacobian_assembler), parameters,
195 integration_order, std::move(process_variables),
196 std::move(process_data), std::move(secondary_variables),
197 use_monolithic_scheme, is_linear);
198}

References BaseLib::ConfigTree::checkConfigParameter(), MaterialLib::Solids::createConstitutiveRelationIce(), MaterialLib::Solids::createConstitutiveRelations(), ProcessLib::createInitialStress(), MaterialPropertyLib::createMaterialSpatialDistributionMap(), NumLib::createNumericalStabilization(), ProcessLib::createSecondaryVariables(), DBUG(), ProcessLib::findProcessVariables(), BaseLib::ConfigTree::getConfigParameter(), BaseLib::ConfigTree::getConfigParameterOptional(), BaseLib::ConfigTree::getConfigSubtree(), ProcessLib::ProcessVariable::getName(), ProcessLib::ProcessVariable::getNumberOfGlobalComponents(), ProcessLib::ProcessVariable::getShapeFunctionOrder(), and OGS_FATAL.

◆ createThermoHydroMechanicsProcess< 2 >()

template THERMOHYDROMECHANICS_EXPORT std::unique_ptr< Process > ProcessLib::ThermoHydroMechanics::createThermoHydroMechanicsProcess< 2 > ( 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,
std::optional< ParameterLib::CoordinateSystem > const & local_coordinate_system,
unsigned const integration_order,
BaseLib::ConfigTree const & config,
std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const & media )

◆ createThermoHydroMechanicsProcess< 3 >()

template THERMOHYDROMECHANICS_EXPORT std::unique_ptr< Process > ProcessLib::ThermoHydroMechanics::createThermoHydroMechanicsProcess< 3 > ( 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,
std::optional< ParameterLib::CoordinateSystem > const & local_coordinate_system,
unsigned const integration_order,
BaseLib::ConfigTree const & config,
std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const & media )