33 std::string
const& name,
35 std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&& jacobian_assembler,
36 std::vector<ProcessVariable>
const& variables,
37 std::vector<std::unique_ptr<ParameterLib::ParameterBase>>
const& parameters,
38 std::optional<ParameterLib::CoordinateSystem>
const&
39 local_coordinate_system,
40 unsigned const integration_order,
42 std::map<
int, std::shared_ptr<MaterialPropertyLib::Medium>>
const& media)
46 DBUG(
"Create HydroMechanicsProcess with LIE.");
47 auto const coupling_scheme =
50 const bool use_monolithic_scheme =
51 !(coupling_scheme && (*coupling_scheme ==
"staggered"));
60 std::vector<std::reference_wrapper<ProcessVariable>> p_u_process_variables;
61 std::vector<std::reference_wrapper<ProcessVariable>> p_process_variables;
62 std::vector<std::reference_wrapper<ProcessVariable>> u_process_variables;
63 std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>
65 for (std::string
const& pv_name : range)
67 if (pv_name !=
"pressure" && pv_name !=
"displacement" &&
68 !pv_name.starts_with(
"displacement_jump"))
71 "Found a process variable name '{}'. It should be "
72 "'displacement' or 'displacement_jumpN' or 'pressure'",
75 auto variable = std::find_if(variables.cbegin(), variables.cend(),
77 { return v.getName() == pv_name; });
79 if (variable == variables.end())
82 "Could not find process variable '{:s}' in the provided "
83 "variables list for config tag <{:s}>.",
84 pv_name,
"process_variable");
86 DBUG(
"Found process variable '{:s}' for config tag <{:s}>.",
87 variable->getName(),
"process_variable");
89 if (pv_name.find(
"displacement") != std::string::npos &&
90 variable->getNumberOfGlobalComponents() != DisplacementDim)
93 "Number of components of the process variable '{:s}' is "
94 "different from the displacement dimension: got {:d}, expected "
97 variable->getNumberOfGlobalComponents(),
101 if (!use_monolithic_scheme)
103 if (pv_name ==
"pressure")
105 p_process_variables.emplace_back(
110 u_process_variables.emplace_back(
116 p_u_process_variables.emplace_back(
121 if (p_u_process_variables.size() > 3 || u_process_variables.size() > 2)
123 OGS_FATAL(
"Currently only one displacement jump is supported");
126 if (!use_monolithic_scheme)
128 process_variables.push_back(std::move(p_process_variables));
129 process_variables.push_back(std::move(u_process_variables));
133 process_variables.push_back(std::move(p_u_process_variables));
137 auto solid_constitutive_relations =
139 parameters, local_coordinate_system, materialIDs(mesh), config);
142 Eigen::Matrix<double, DisplacementDim, 1> specific_body_force;
144 std::vector<double>
const b =
147 "specific_body_force");
148 if (b.size() != DisplacementDim)
151 "The size of the specific body force vector does not match the "
152 "displacement dimension. Vector size is {:d}, displacement "
154 b.size(), DisplacementDim);
157 std::copy_n(b.data(), b.size(), specific_body_force.data());
161 std::unique_ptr<MaterialLib::Fracture::FractureModelBase<DisplacementDim>>
162 fracture_model =
nullptr;
163 auto const opt_fracture_model_config =
166 if (opt_fracture_model_config)
168 auto& fracture_model_config = *opt_fracture_model_config;
170 auto const frac_type =
172 fracture_model_config.peekConfigParameter<std::string>(
"type");
174 if (frac_type ==
"LinearElasticIsotropic")
178 DisplacementDim>(parameters, fracture_model_config);
180 else if (frac_type ==
"Coulomb")
184 parameters, fracture_model_config);
186 else if (frac_type ==
"CohesiveZoneModeI")
190 fracture_model_config);
195 "Cannot construct fracture constitutive relation of given type "
202 std::vector<FractureProperty> fracture_properties;
204 auto fracture_properties_config :
208 fracture_properties.emplace_back(
209 fracture_properties.size(),
211 fracture_properties_config.getConfigParameter<
int>(
"material_id"),
214 fracture_properties_config,
"initial_aperture", parameters, 1,
218 std::size_t
const n_var_du =
220 process_variables | ranges::views::transform(ranges::size),
223 if (n_var_du != fracture_properties.size())
226 "The number of displacement jumps {} and the number of "
227 "<fracture_properties> {} are not consistent.",
229 fracture_properties.size());
236 "initial_effective_stress", parameters,
239 DBUG(
"Use '{:s}' as initial effective stress parameter.",
240 initial_effective_stress.name);
247 "initial_fracture_effective_stress", parameters, DisplacementDim,
249 DBUG(
"Use '{:s}' as initial fracture effective stress parameter.",
250 initial_fracture_effective_stress.name);
253 auto opt_deactivate_matrix_in_flow =
256 bool const deactivate_matrix_in_flow =
257 opt_deactivate_matrix_in_flow && *opt_deactivate_matrix_in_flow;
259 if (deactivate_matrix_in_flow)
260 INFO(
"Deactivate matrix elements in flow calculation.");
268 std::array
const requiredMediumProperties = {
278 for (
auto const& medium : media_map.media())
280 checkRequiredProperties(*medium, requiredMediumProperties);
281 checkRequiredProperties(fluidPhase(*medium), requiredFluidProperties);
282 checkRequiredProperties(medium->phase(
"Solid"),
283 requiredSolidProperties);
289 media_map.checkElementHasMedium(element_id);
290 auto const& medium = *media_map.getMedium(element_id);
297 auto const permeability =
299 .value(variables, x_position, 0.0 , 0.0 );
300 if (!std::holds_alternative<double>(permeability))
303 "The permeability model for the fracture must be "
304 "isotropic, and it must return a scalar value.");
310 materialIDs(mesh), std::move(solid_constitutive_relations),
311 std::move(media_map), specific_body_force,
312 std::move(fracture_model), std::move(fracture_properties),
313 initial_effective_stress, initial_fracture_effective_stress,
314 deactivate_matrix_in_flow, use_b_bar};
320 return std::make_unique<HydroMechanicsProcess<DisplacementDim>>(
321 std::move(name), mesh, std::move(jacobian_assembler), parameters,
322 integration_order, std::move(process_variables),
323 std::move(process_data), std::move(secondary_variables),
324 use_monolithic_scheme);