OGS
ProcessLib::HydroMechanics Namespace Reference

Classes

class  HydroMechanicsLocalAssembler
 
class  HydroMechanicsProcess
 
struct  HydroMechanicsProcessData
 
struct  IntegrationPointData
 
struct  LocalAssemblerInterface
 
struct  Monolithic
 
struct  SecondaryData
 
struct  Staggered
 

Typedefs

using CouplingScheme = std::variant<Monolithic, Staggered>
 

Functions

CouplingScheme parseCouplingScheme (std::optional< BaseLib::ConfigTree > const &config)
 
template<int DisplacementDim>
std::unique_ptr< ProcesscreateHydroMechanicsProcess (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< ProcesscreateHydroMechanicsProcess< 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< ProcesscreateHydroMechanicsProcess< 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)
 

Typedef Documentation

◆ CouplingScheme

Function Documentation

◆ createHydroMechanicsProcess()

template<int DisplacementDim>
std::unique_ptr< Process > ProcessLib::HydroMechanics::createHydroMechanicsProcess ( 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__HYDRO_MECHANICS__coupling_scheme

Process Variables

Input File Parameter
prj__processes__process__HYDRO_MECHANICS__process_variables

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

Input File Parameter
prj__processes__process__HYDRO_MECHANICS__process_variables__pressure
Input File Parameter
prj__processes__process__HYDRO_MECHANICS__process_variables__displacement

Process Parameters

Input File Parameter
prj__processes__process__HYDRO_MECHANICS__specific_body_force
Input File Parameter
prj__processes__process__HYDRO_MECHANICS__mass_lumping

Definition at line 84 of file CreateHydroMechanicsProcess.cpp.

93{
95 config.checkConfigParameter("type", "HYDRO_MECHANICS");
96 DBUG("Create HydroMechanicsProcess.");
97
98 if (DisplacementDim == 2)
99 {
100 if (mesh.isAxiallySymmetric() &&
102 {
103 OGS_FATAL(
104 "Mesh {:s} is on a plane rotated around the vertical axis. The "
105 "axisymmetric problem can not use such mesh.",
106 mesh.getName());
107 }
108 }
109
110 auto const coupling_scheme = parseCouplingScheme(
112 config.getConfigSubtreeOptional("coupling_scheme"));
113
115
117 auto const pv_config = config.getConfigSubtree("process_variables");
118
119 ProcessVariable* variable_p = nullptr;
120 ProcessVariable* variable_u = nullptr;
121 std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>
122 process_variables;
123
124 int const hydraulic_process_id = 0;
125 int mechanics_related_process_id = 0;
126
127 if (std::holds_alternative<Monolithic>(coupling_scheme))
128 {
131 auto per_process_variables = findProcessVariables(
132 variables, pv_config,
133 {
134 "pressure",
136 "displacement"});
137 variable_p = &per_process_variables[0].get();
138 variable_u = &per_process_variables[1].get();
139 process_variables.push_back(std::move(per_process_variables));
140 }
141
142 if (std::holds_alternative<Staggered>(coupling_scheme))
143 {
144 using namespace std::string_literals;
145 for (auto const& variable_name : {"pressure"s, "displacement"s})
146 {
147 auto per_process_variables =
148 findProcessVariables(variables, pv_config, {variable_name});
149 process_variables.push_back(std::move(per_process_variables));
150 }
151 mechanics_related_process_id = 1;
152 variable_p = &process_variables[hydraulic_process_id][0].get();
153 variable_u = &process_variables[mechanics_related_process_id][0].get();
154 }
155
156 DBUG("Associate displacement with process variable '{:s}'.",
157 variable_u->getName());
158
159 if (variable_u->getNumberOfGlobalComponents() != DisplacementDim)
160 {
161 OGS_FATAL(
162 "Number of components of the process variable '{:s}' is different "
163 "from the displacement dimension: got {:d}, expected {:d}",
164 variable_u->getName(),
165 variable_u->getNumberOfGlobalComponents(),
166 DisplacementDim);
167 }
168
169 DBUG("Associate pressure with process variable '{:s}'.",
170 variable_p->getName());
171 if (variable_p->getNumberOfGlobalComponents() != 1)
172 {
173 OGS_FATAL(
174 "Pressure process variable '{:s}' is not a scalar variable but has "
175 "{:d} components.",
176 variable_p->getName(),
177 variable_p->getNumberOfGlobalComponents());
178 }
179
180 auto solid_constitutive_relations =
181 MaterialLib::Solids::createConstitutiveRelations<DisplacementDim>(
182 parameters, local_coordinate_system, config);
183
185 // Specific body force
186 Eigen::Matrix<double, DisplacementDim, 1> specific_body_force;
187 {
188 std::vector<double> const b =
190 config.getConfigParameter<std::vector<double>>(
191 "specific_body_force");
192 if (b.size() != DisplacementDim)
193 {
194 OGS_FATAL(
195 "The size of the specific body force vector does not match the "
196 "displacement dimension. Vector size is {:d}, displacement "
197 "dimension is {:d}",
198 b.size(), DisplacementDim);
199 }
200
201 std::copy_n(b.data(), b.size(), specific_body_force.data());
202 }
203
205 auto mass_lumping = config.getConfigParameter<bool>("mass_lumping", false);
206
207 auto media_map =
209
210 std::array const requiredMediumProperties = {
214 std::array const requiredFluidProperties = {MaterialPropertyLib::viscosity,
216 std::array const requiredSolidProperties = {MaterialPropertyLib::density};
217
218 // setting default to suppress -Wmaybe-uninitialized warning
219 MaterialPropertyLib::Variable phase_pressure =
221 for (auto const& element_id : mesh.getElements() | MeshLib::views::ids)
222 {
223 media_map.checkElementHasMedium(element_id);
224 auto const& medium = *media_map.getMedium(element_id);
225 if (element_id == 0)
226 {
227 phase_pressure =
228 medium.hasPhase("Gas")
231 }
232 else
233 {
234 auto const phase_pressure_tmp =
235 medium.hasPhase("Gas")
238 if (phase_pressure != phase_pressure_tmp)
239 {
240 OGS_FATAL(
241 "You are mixing liquid and gas phases in your model domain."
242 "OGS does not yet know how to handle this.");
243 }
244 }
245 checkRequiredProperties(medium, requiredMediumProperties);
246 checkRequiredProperties(fluidPhase(medium), requiredFluidProperties);
247 checkRequiredProperties(medium.phase("Solid"), requiredSolidProperties);
248 }
249 DBUG("Media properties verified.");
250
251 // Initial stress conditions
252 auto initial_stress = ProcessLib::createInitialStress<DisplacementDim>(
253 config, parameters, mesh);
254
255 const bool use_taylor_hood_elements = variable_p->getShapeFunctionOrder() !=
256 variable_u->getShapeFunctionOrder();
257
258 HydroMechanicsProcessData<DisplacementDim> process_data{
259 materialIDs(mesh),
260 std::move(media_map),
261 std::move(solid_constitutive_relations),
262 initial_stress,
263 specific_body_force,
264 mass_lumping,
265 coupling_scheme,
266 hydraulic_process_id,
267 mechanics_related_process_id,
268 use_taylor_hood_elements,
269 phase_pressure};
270
271 SecondaryVariableCollection secondary_variables;
272
273 ProcessLib::createSecondaryVariables(config, secondary_variables);
274
275 return std::make_unique<HydroMechanicsProcess<DisplacementDim>>(
276 std::move(name), mesh, std::move(jacobian_assembler), parameters,
277 integration_order, std::move(process_variables),
278 std::move(process_data), std::move(secondary_variables),
279 std::holds_alternative<Monolithic>(coupling_scheme));
280}
#define OGS_FATAL(...)
Definition Error.h:26
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
bool isAxiallySymmetric() const
Definition Mesh.h:137
const std::string getName() const
Get name of the mesh.
Definition Mesh.h:103
void checkRequiredProperties(Component const &c, std::span< PropertyType const > const required_properties)
Definition Component.cpp:60
MaterialSpatialDistributionMap createMaterialSpatialDistributionMap(std::map< int, std::shared_ptr< Medium > > const &media, MeshLib::Mesh const &mesh)
Phase const & fluidPhase(Medium const &medium)
Returns a gas or aqueous liquid phase of the given medium.
Definition Medium.cpp:100
constexpr ranges::views::view_closure ids
For an element of a range view return its id.
Definition Mesh.h:225
PropertyVector< int > const * materialIDs(Mesh const &mesh)
Definition Mesh.cpp:268
bool is2DMeshOnRotatedVerticalPlane(Mesh const &mesh)
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)

References MaterialPropertyLib::biot_coefficient, BaseLib::ConfigTree::checkConfigParameter(), MaterialPropertyLib::createMaterialSpatialDistributionMap(), ProcessLib::createSecondaryVariables(), DBUG(), MaterialPropertyLib::density, ProcessLib::findProcessVariables(), MaterialPropertyLib::gas_phase_pressure, BaseLib::ConfigTree::getConfigParameter(), BaseLib::ConfigTree::getConfigSubtree(), BaseLib::ConfigTree::getConfigSubtreeOptional(), MeshLib::Mesh::getElements(), MeshLib::Mesh::getName(), ProcessLib::ProcessVariable::getName(), ProcessLib::ProcessVariable::getNumberOfGlobalComponents(), ProcessLib::ProcessVariable::getShapeFunctionOrder(), MeshLib::views::ids, MeshLib::is2DMeshOnRotatedVerticalPlane(), MeshLib::Mesh::isAxiallySymmetric(), MaterialPropertyLib::liquid_phase_pressure, OGS_FATAL, parseCouplingScheme(), MaterialPropertyLib::permeability, MaterialPropertyLib::porosity, MaterialPropertyLib::reference_temperature, and MaterialPropertyLib::viscosity.

Referenced by ProjectData::parseProcesses().

◆ createHydroMechanicsProcess< 2 >()

template std::unique_ptr< Process > ProcessLib::HydroMechanics::createHydroMechanicsProcess< 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 )

◆ createHydroMechanicsProcess< 3 >()

template std::unique_ptr< Process > ProcessLib::HydroMechanics::createHydroMechanicsProcess< 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 )

◆ parseCouplingScheme()

CouplingScheme ProcessLib::HydroMechanics::parseCouplingScheme ( std::optional< BaseLib::ConfigTree > const & config)
Input File Parameter
prj__processes__process__HYDRO_MECHANICS__coupling_scheme__type
Input File Parameter
prj__processes__process__HYDRO_MECHANICS__coupling_scheme__fixed_stress_stabilization_parameter
Input File Parameter
prj__processes__process__HYDRO_MECHANICS__coupling_scheme__fixed_stress_over_time_step

Definition at line 34 of file CreateHydroMechanicsProcess.cpp.

36{
37 if (!config)
38 {
39 return Monolithic{};
40 }
41
42 auto const coupling_scheme_type =
44 config->getConfigParameter<std::string>("type");
45
46 if (coupling_scheme_type == "monolithic")
47 {
48 return Monolithic{};
49 }
50
51 // Default value is 0.5, which is recommended by [Mikelic & Wheeler].
52 double const fixed_stress_stabilization_parameter =
54 config->getConfigParameter<double>(
55 "fixed_stress_stabilization_parameter", 0.5);
56
57 DBUG("Using value {:g} for coupling parameter of staggered scheme.",
58 fixed_stress_stabilization_parameter);
59
60 { // Check parameter value. Optimum is not a-priori known, but within
61 // certain interval [Storvik & Nordbotten]
62 double const csp_min = 1.0 / 6.0;
63 double const csp_max = 1.0;
64 if (fixed_stress_stabilization_parameter < csp_min ||
65 fixed_stress_stabilization_parameter > csp_max)
66 {
67 WARN(
68 "Value of coupling scheme parameter = {:g} is out of "
69 "reasonable range ({:g}, {:g}).",
70 fixed_stress_stabilization_parameter, csp_min, csp_max);
71 }
72 }
73
74 bool const fixed_stress_over_time_step =
76 config->getConfigParameter<std::string>("fixed_stress_over_time_step",
77 "false") == "true";
78
79 return Staggered{fixed_stress_stabilization_parameter,
80 fixed_stress_over_time_step};
81}
void WARN(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:40

References DBUG(), and WARN().

Referenced by createHydroMechanicsProcess().