41 std::string
const& name,
43 std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&& jacobian_assembler,
44 std::vector<ProcessVariable>
const& variables,
45 std::vector<std::unique_ptr<ParameterLib::ParameterBase>>
const& parameters,
46 std::optional<ParameterLib::CoordinateSystem>
const&
47 local_coordinate_system,
48 unsigned const integration_order,
50 std::map<
int, std::shared_ptr<MaterialPropertyLib::Medium>>
const& media)
54 DBUG(
"Create HydroMechanicsProcess with LIE.");
55 auto const coupling_scheme =
58 const bool use_monolithic_scheme =
59 !(coupling_scheme && (*coupling_scheme ==
"staggered"));
68 std::vector<std::reference_wrapper<ProcessVariable>> p_u_process_variables;
69 std::vector<std::reference_wrapper<ProcessVariable>> p_process_variables;
70 std::vector<std::reference_wrapper<ProcessVariable>> u_process_variables;
71 std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>
73 for (std::string
const& pv_name : range)
75 if (pv_name !=
"pressure" && pv_name !=
"displacement" &&
76 !pv_name.starts_with(
"displacement_jump"))
79 "Found a process variable name '{}'. It should be "
80 "'displacement' or 'displacement_jumpN' or 'pressure'",
83 auto variable = std::find_if(variables.cbegin(), variables.cend(),
85 { return v.getName() == pv_name; });
87 if (variable == variables.end())
90 "Could not find process variable '{:s}' in the provided "
91 "variables list for config tag <{:s}>.",
92 pv_name,
"process_variable");
94 DBUG(
"Found process variable '{:s}' for config tag <{:s}>.",
95 variable->getName(),
"process_variable");
97 if (pv_name.find(
"displacement") != std::string::npos &&
98 variable->getNumberOfGlobalComponents() != DisplacementDim)
101 "Number of components of the process variable '{:s}' is "
102 "different from the displacement dimension: got {:d}, expected "
105 variable->getNumberOfGlobalComponents(),
109 if (!use_monolithic_scheme)
111 if (pv_name ==
"pressure")
113 p_process_variables.emplace_back(
118 u_process_variables.emplace_back(
124 p_u_process_variables.emplace_back(
129 if (p_u_process_variables.size() > 3 || u_process_variables.size() > 2)
131 OGS_FATAL(
"Currently only one displacement jump is supported");
134 if (!use_monolithic_scheme)
136 process_variables.push_back(std::move(p_process_variables));
137 process_variables.push_back(std::move(u_process_variables));
141 process_variables.push_back(std::move(p_u_process_variables));
145 auto solid_constitutive_relations =
147 parameters, local_coordinate_system, materialIDs(mesh), config);
150 Eigen::Matrix<double, DisplacementDim, 1> specific_body_force;
152 std::vector<double>
const b =
155 "specific_body_force");
156 if (b.size() != DisplacementDim)
159 "The size of the specific body force vector does not match the "
160 "displacement dimension. Vector size is {:d}, displacement "
162 b.size(), DisplacementDim);
165 std::copy_n(b.data(), b.size(), specific_body_force.data());
169 std::unique_ptr<MaterialLib::Fracture::FractureModelBase<DisplacementDim>>
170 fracture_model =
nullptr;
171 auto const opt_fracture_model_config =
174 if (opt_fracture_model_config)
176 auto& fracture_model_config = *opt_fracture_model_config;
178 auto const frac_type =
180 fracture_model_config.peekConfigParameter<std::string>(
"type");
182 if (frac_type ==
"LinearElasticIsotropic")
186 DisplacementDim>(parameters, fracture_model_config);
188 else if (frac_type ==
"Coulomb")
192 parameters, fracture_model_config);
194 else if (frac_type ==
"CohesiveZoneModeI")
198 fracture_model_config);
203 "Cannot construct fracture constitutive relation of given type "
210 std::vector<FractureProperty> fracture_properties;
212 auto fracture_properties_config :
216 fracture_properties.emplace_back(
217 fracture_properties.size(),
219 fracture_properties_config.getConfigParameter<
int>(
"material_id"),
222 fracture_properties_config,
"initial_aperture", parameters, 1,
226 std::size_t
const n_var_du =
228 process_variables | ranges::views::transform(ranges::size),
231 if (n_var_du != fracture_properties.size())
234 "The number of displacement jumps {} and the number of "
235 "<fracture_properties> {} are not consistent.",
237 fracture_properties.size());
244 "initial_effective_stress", parameters,
247 DBUG(
"Use '{:s}' as initial effective stress parameter.",
248 initial_effective_stress.name);
255 "initial_fracture_effective_stress", parameters, DisplacementDim,
257 DBUG(
"Use '{:s}' as initial fracture effective stress parameter.",
258 initial_fracture_effective_stress.name);
261 auto opt_deactivate_matrix_in_flow =
264 bool const deactivate_matrix_in_flow =
265 opt_deactivate_matrix_in_flow && *opt_deactivate_matrix_in_flow;
267 if (deactivate_matrix_in_flow)
268 INFO(
"Deactivate matrix elements in flow calculation.");
276 std::array
const requiredMediumProperties = {
286 for (
auto const& medium : media_map.media())
288 checkRequiredProperties(*medium, requiredMediumProperties);
289 checkRequiredProperties(fluidPhase(*medium), requiredFluidProperties);
290 checkRequiredProperties(medium->phase(
"Solid"),
291 requiredSolidProperties);
297 media_map.checkElementHasMedium(element_id);
298 auto const& medium = *media_map.getMedium(element_id);
305 auto const permeability =
307 .value(variables, x_position, 0.0 , 0.0 );
308 if (!std::holds_alternative<double>(permeability))
311 "The permeability model for the fracture must be "
312 "isotropic, and it must return a scalar value.");
318 materialIDs(mesh), std::move(solid_constitutive_relations),
319 std::move(media_map), specific_body_force,
320 std::move(fracture_model), std::move(fracture_properties),
321 initial_effective_stress, initial_fracture_effective_stress,
322 deactivate_matrix_in_flow, use_b_bar};
328 return std::make_unique<HydroMechanicsProcess<DisplacementDim>>(
329 std::move(name), mesh, std::move(jacobian_assembler), parameters,
330 integration_order, std::move(process_variables),
331 std::move(process_data), std::move(secondary_variables),
332 use_monolithic_scheme);