39 std::string
const& name,
41 std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&& jacobian_assembler,
42 std::vector<ProcessVariable>
const& variables,
43 std::vector<std::unique_ptr<ParameterLib::ParameterBase>>
const& parameters,
44 std::optional<ParameterLib::CoordinateSystem>
const&
45 local_coordinate_system,
46 unsigned const integration_order,
48 std::map<
int, std::shared_ptr<MaterialPropertyLib::Medium>>
const& media)
52 DBUG(
"Create HydroMechanicsProcess with LIE.");
53 auto const coupling_scheme =
56 const bool use_monolithic_scheme =
57 !(coupling_scheme && (*coupling_scheme ==
"staggered"));
66 std::vector<std::reference_wrapper<ProcessVariable>> p_u_process_variables;
67 std::vector<std::reference_wrapper<ProcessVariable>> p_process_variables;
68 std::vector<std::reference_wrapper<ProcessVariable>> u_process_variables;
69 std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>
71 for (std::string
const& pv_name : range)
73 if (pv_name !=
"pressure" && pv_name !=
"displacement" &&
74 !pv_name.starts_with(
"displacement_jump"))
77 "Found a process variable name '{}'. It should be "
78 "'displacement' or 'displacement_jumpN' or 'pressure'",
81 auto variable = std::find_if(variables.cbegin(), variables.cend(),
83 { return v.getName() == pv_name; });
85 if (variable == variables.end())
88 "Could not find process variable '{:s}' in the provided "
89 "variables list for config tag <{:s}>.",
90 pv_name,
"process_variable");
92 DBUG(
"Found process variable '{:s}' for config tag <{:s}>.",
93 variable->getName(),
"process_variable");
95 if (pv_name.find(
"displacement") != std::string::npos &&
96 variable->getNumberOfGlobalComponents() != GlobalDim)
99 "Number of components of the process variable '{:s}' is "
100 "different from the displacement dimension: got {:d}, expected "
103 variable->getNumberOfGlobalComponents(),
107 if (!use_monolithic_scheme)
109 if (pv_name ==
"pressure")
111 p_process_variables.emplace_back(
116 u_process_variables.emplace_back(
122 p_u_process_variables.emplace_back(
127 if (p_u_process_variables.size() > 3 || u_process_variables.size() > 2)
129 OGS_FATAL(
"Currently only one displacement jump is supported");
132 if (!use_monolithic_scheme)
134 process_variables.push_back(std::move(p_process_variables));
135 process_variables.push_back(std::move(u_process_variables));
139 process_variables.push_back(std::move(p_u_process_variables));
143 auto solid_constitutive_relations =
145 parameters, local_coordinate_system, materialIDs(mesh), config);
148 Eigen::Matrix<double, GlobalDim, 1> specific_body_force;
150 std::vector<double>
const b =
153 "specific_body_force");
154 if (b.size() != GlobalDim)
157 "The size of the specific body force vector does not match the "
158 "displacement dimension. Vector size is {:d}, displacement "
160 b.size(), GlobalDim);
163 std::copy_n(b.data(), b.size(), specific_body_force.data());
167 std::unique_ptr<MaterialLib::Fracture::FractureModelBase<GlobalDim>>
168 fracture_model =
nullptr;
169 auto const opt_fracture_model_config =
172 if (opt_fracture_model_config)
174 auto& fracture_model_config = *opt_fracture_model_config;
176 auto const frac_type =
178 fracture_model_config.peekConfigParameter<std::string>(
"type");
180 if (frac_type ==
"LinearElasticIsotropic")
184 parameters, fracture_model_config);
186 else if (frac_type ==
"Coulomb")
189 parameters, fracture_model_config);
191 else if (frac_type ==
"CohesiveZoneModeI")
195 fracture_model_config);
200 "Cannot construct fracture constitutive relation of given type "
207 std::unique_ptr<FractureProperty> frac_prop =
nullptr;
208 auto opt_fracture_properties_config =
211 if (opt_fracture_properties_config)
213 auto& fracture_properties_config = *opt_fracture_properties_config;
215 frac_prop = std::make_unique<ProcessLib::LIE::FractureProperty>(
219 fracture_properties_config,
"initial_aperture", parameters, 1,
221 if (frac_prop->aperture0.isTimeDependent())
224 "The initial aperture parameter '{:s}' must not be "
226 frac_prop->aperture0.name);
234 "initial_effective_stress", parameters,
236 DBUG(
"Use '{:s}' as initial effective stress parameter.",
237 initial_effective_stress.name);
244 "initial_fracture_effective_stress", parameters, GlobalDim, &mesh);
245 DBUG(
"Use '{:s}' as initial fracture effective stress parameter.",
246 initial_fracture_effective_stress.name);
249 auto opt_deactivate_matrix_in_flow =
252 bool const deactivate_matrix_in_flow =
253 opt_deactivate_matrix_in_flow && *opt_deactivate_matrix_in_flow;
255 if (deactivate_matrix_in_flow)
256 INFO(
"Deactivate matrix elements in flow calculation.");
264 std::array
const requiredMediumProperties = {
274 for (
auto const& medium : media_map.media())
276 checkRequiredProperties(*medium, requiredMediumProperties);
277 checkRequiredProperties(fluidPhase(*medium), requiredFluidProperties);
278 checkRequiredProperties(medium->phase(
"Solid"),
279 requiredSolidProperties);
285 media_map.checkElementHasMedium(element_id);
286 auto const& medium = *media_map.getMedium(element_id);
293 auto const permeability =
295 .value(variables, x_position, 0.0 , 0.0 );
296 if (!std::holds_alternative<double>(permeability))
299 "The permeability model for the fracture must be "
300 "isotropic, and it must return a scalar value.");
306 materialIDs(mesh), std::move(solid_constitutive_relations),
307 std::move(media_map), specific_body_force,
308 std::move(fracture_model), std::move(frac_prop),
309 initial_effective_stress, initial_fracture_effective_stress,
310 deactivate_matrix_in_flow, use_b_bar};
316 return std::make_unique<HydroMechanicsProcess<GlobalDim>>(
317 std::move(name), mesh, std::move(jacobian_assembler), parameters,
318 integration_order, std::move(process_variables),
319 std::move(process_data), std::move(secondary_variables),
320 use_monolithic_scheme);