29 namespace HydroMechanics
31 template <
int GlobalDim>
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,
45 DBUG(
"Create HydroMechanicsProcess with LIE.");
46 auto const coupling_scheme =
49 const bool use_monolithic_scheme =
50 !(coupling_scheme && (*coupling_scheme ==
"staggered"));
58 std::vector<std::reference_wrapper<ProcessVariable>> p_u_process_variables;
59 std::vector<std::reference_wrapper<ProcessVariable>> p_process_variables;
60 std::vector<std::reference_wrapper<ProcessVariable>> u_process_variables;
61 std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>
63 for (std::string
const& pv_name : range)
65 if (pv_name !=
"pressure" && pv_name !=
"displacement" &&
66 pv_name.find(
"displacement_jump") != 0)
69 "Found a process variable name '{:s}'. It should be "
70 "'displacement' or 'displacement_jumpN' or 'pressure'");
72 auto variable = std::find_if(variables.cbegin(), variables.cend(),
74 { return v.getName() == pv_name; });
76 if (variable == variables.end())
79 "Could not find process variable '{:s}' in the provided "
80 "variables list for config tag <{:s}>.",
81 pv_name,
"process_variable");
83 DBUG(
"Found process variable '{:s}' for config tag <{:s}>.",
84 variable->getName(),
"process_variable");
86 if (pv_name.find(
"displacement") != std::string::npos &&
87 variable->getNumberOfGlobalComponents() != GlobalDim)
90 "Number of components of the process variable '{:s}' is "
91 "different from the displacement dimension: got {:d}, expected "
94 variable->getNumberOfGlobalComponents(),
98 if (!use_monolithic_scheme)
100 if (pv_name ==
"pressure")
102 p_process_variables.emplace_back(
107 u_process_variables.emplace_back(
113 p_u_process_variables.emplace_back(
118 if (p_u_process_variables.size() > 3 || u_process_variables.size() > 2)
120 OGS_FATAL(
"Currently only one displacement jump is supported");
123 if (!use_monolithic_scheme)
125 process_variables.push_back(std::move(p_process_variables));
126 process_variables.push_back(std::move(u_process_variables));
130 process_variables.push_back(std::move(p_u_process_variables));
133 auto solid_constitutive_relations =
134 MaterialLib::Solids::createConstitutiveRelations<GlobalDim>(
135 parameters, local_coordinate_system, config);
138 auto& intrinsic_permeability = ParameterLib::findParameter<double>(
141 "intrinsic_permeability", parameters, 1, &mesh);
143 DBUG(
"Use '{:s}' as intrinsic permeability parameter.",
144 intrinsic_permeability.name);
147 auto& specific_storage = ParameterLib::findParameter<double>(
150 "specific_storage", parameters, 1, &mesh);
152 DBUG(
"Use '{:s}' as specific storage parameter.", specific_storage.name);
158 "fluid_viscosity", parameters, 1, &mesh);
165 "fluid_density", parameters, 1, &mesh);
172 "biot_coefficient", parameters, 1, &mesh);
176 auto& porosity = ParameterLib::findParameter<double>(
179 "porosity", parameters, 1, &mesh);
180 DBUG(
"Use '{:s}' as porosity parameter.", porosity.name);
183 auto& solid_density = ParameterLib::findParameter<double>(
186 "solid_density", parameters, 1, &mesh);
187 DBUG(
"Use '{:s}' as solid density parameter.", solid_density.name);
190 Eigen::Matrix<double, GlobalDim, 1> specific_body_force;
192 std::vector<double>
const b =
195 "specific_body_force");
196 if (b.size() != GlobalDim)
199 "The size of the specific body force vector does not match the "
200 "displacement dimension. Vector size is {:d}, displacement "
202 b.size(), GlobalDim);
205 std::copy_n(b.data(), b.size(), specific_body_force.data());
209 std::unique_ptr<MaterialLib::Fracture::FractureModelBase<GlobalDim>>
210 fracture_model =
nullptr;
211 auto const opt_fracture_model_config =
214 if (opt_fracture_model_config)
216 auto& fracture_model_config = *opt_fracture_model_config;
218 auto const frac_type =
220 fracture_model_config.peekConfigParameter<std::string>(
"type");
222 if (frac_type ==
"LinearElasticIsotropic")
225 MaterialLib::Fracture::createLinearElasticIsotropic<GlobalDim>(
226 parameters, fracture_model_config);
228 else if (frac_type ==
"Coulomb")
230 fracture_model = MaterialLib::Fracture::createCoulomb<GlobalDim>(
231 parameters, fracture_model_config);
233 else if (frac_type ==
"CohesiveZoneModeI")
235 fracture_model = MaterialLib::Fracture::CohesiveZoneModeI::
236 createCohesiveZoneModeI<GlobalDim>(parameters,
237 fracture_model_config);
242 "Cannot construct fracture constitutive relation of given type "
249 std::unique_ptr<FracturePropertyHM> frac_prop =
nullptr;
250 auto opt_fracture_properties_config =
253 if (opt_fracture_properties_config)
255 auto& fracture_properties_config = *opt_fracture_properties_config;
257 frac_prop = std::make_unique<ProcessLib::LIE::FracturePropertyHM>(
260 fracture_properties_config.getConfigParameter<
int>(
"material_id"),
261 ParameterLib::findParameter<double>(
263 fracture_properties_config,
"initial_aperture", parameters, 1,
265 ParameterLib::findParameter<double>(
267 fracture_properties_config,
"specific_storage", parameters, 1,
269 ParameterLib::findParameter<double>(
271 fracture_properties_config,
"biot_coefficient", parameters, 1,
273 if (frac_prop->aperture0.isTimeDependent())
276 "The initial aperture parameter '{:s}' must not be "
278 frac_prop->aperture0.name);
281 auto permeability_model_config =
283 fracture_properties_config.getConfigSubtree(
"permeability_model");
284 frac_prop->permeability_model =
286 permeability_model_config);
290 auto& initial_effective_stress = ParameterLib::findParameter<double>(
293 "initial_effective_stress", parameters,
295 DBUG(
"Use '{:s}' as initial effective stress parameter.",
296 initial_effective_stress.name);
303 "initial_fracture_effective_stress", parameters, GlobalDim, &mesh);
304 DBUG(
"Use '{:s}' as initial fracture effective stress parameter.",
305 initial_fracture_effective_stress.name);
308 auto opt_deactivate_matrix_in_flow =
311 bool const deactivate_matrix_in_flow =
312 opt_deactivate_matrix_in_flow && *opt_deactivate_matrix_in_flow;
314 if (deactivate_matrix_in_flow)
315 INFO(
"Deactivate matrix elements in flow calculation.");
321 "reference_temperature", std::numeric_limits<double>::quiet_NaN());
325 std::move(solid_constitutive_relations),
326 intrinsic_permeability,
334 std::move(fracture_model),
335 std::move(frac_prop),
336 initial_effective_stress,
337 initial_fracture_effective_stress,
338 deactivate_matrix_in_flow,
345 return std::make_unique<HydroMechanicsProcess<GlobalDim>>(
346 std::move(
name), mesh, std::move(jacobian_assembler), parameters,
347 integration_order, std::move(process_variables),
348 std::move(process_data), std::move(secondary_variables),
349 use_monolithic_scheme);
355 std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&& jacobian_assembler,
356 std::vector<ProcessVariable>
const& variables,
357 std::vector<std::unique_ptr<ParameterLib::ParameterBase>>
const& parameters,
358 std::optional<ParameterLib::CoordinateSystem>
const&
359 local_coordinate_system,
360 unsigned const integration_order,
365 std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&& jacobian_assembler,
366 std::vector<ProcessVariable>
const& variables,
367 std::vector<std::unique_ptr<ParameterLib::ParameterBase>>
const& parameters,
368 std::optional<ParameterLib::CoordinateSystem>
const&
369 local_coordinate_system,
370 unsigned const integration_order,
void INFO(char const *fmt, Args const &... args)
void DBUG(char const *fmt, Args const &... args)
void checkConfigParameter(std::string const ¶m, T const &value) const
std::optional< ConfigTree > getConfigSubtreeOptional(std::string const &root) const
std::optional< T > getConfigParameterOptional(std::string const ¶m) const
T getConfigParameter(std::string const ¶m) const
ConfigTree getConfigSubtree(std::string const &root) const
Range< ValueIterator< T > > getConfigParameterList(std::string const ¶m) const
Handles configuration of several secondary variables from the project file.
std::unique_ptr< Permeability > createPermeabilityModel(BaseLib::ConfigTree const &config)
constexpr int kelvin_vector_dimensions(int const displacement_dim)
Kelvin vector dimensions for given displacement dimension.
PropertyVector< int > const * materialIDs(Mesh const &mesh)
Parameter< ParameterDataType > & findParameter(std::string const ¶meter_name, std::vector< std::unique_ptr< ParameterBase >> const ¶meters, int const num_components, MeshLib::Mesh const *const mesh=nullptr)
template std::unique_ptr< Process > createHydroMechanicsProcess< 2 >(std::string name, MeshLib::Mesh &mesh, std::unique_ptr< ProcessLib::AbstractJacobianAssembler > &&jacobian_assembler, std::vector< ProcessVariable > const &variables, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const ¶meters, std::optional< ParameterLib::CoordinateSystem > const &local_coordinate_system, unsigned const integration_order, BaseLib::ConfigTree const &config)
template std::unique_ptr< Process > createHydroMechanicsProcess< 3 >(std::string name, MeshLib::Mesh &mesh, std::unique_ptr< ProcessLib::AbstractJacobianAssembler > &&jacobian_assembler, std::vector< ProcessVariable > const &variables, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const ¶meters, std::optional< ParameterLib::CoordinateSystem > const &local_coordinate_system, unsigned const integration_order, BaseLib::ConfigTree const &config)
std::unique_ptr< Process > createHydroMechanicsProcess(std::string name, MeshLib::Mesh &mesh, std::unique_ptr< ProcessLib::AbstractJacobianAssembler > &&jacobian_assembler, std::vector< ProcessVariable > const &variables, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const ¶meters, std::optional< ParameterLib::CoordinateSystem > const &local_coordinate_system, unsigned const integration_order, BaseLib::ConfigTree const &config)
double fluid_viscosity(const double p, const double T, const double x)
double fluid_density(const double p, const double T, const double x)
void createSecondaryVariables(BaseLib::ConfigTree const &config, SecondaryVariableCollection &secondary_variables)