OGS
CreateEmbeddedFracturePermeability.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
7
9{
10std::unique_ptr<Property> createEmbeddedFracturePermeability(
11 int const geometry_dimension, BaseLib::ConfigTree const& config,
12 std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters)
13{
14 if ((geometry_dimension != 2) && (geometry_dimension != 3))
15 {
17 "The EmbeddedFracturePermeability is implemented only for 2D or 3D "
18 "problems");
19 }
20
22 config.checkConfigParameter("type", "EmbeddedFracturePermeability");
23
24 // Second access for storage.
26 auto property_name = config.peekConfigParameter<std::string>("name");
27
28 DBUG("Create EmbeddedFracturePermeability medium property");
29
30 auto const k =
32 config.getConfigParameter<double>("intrinsic_permeability");
33
34 auto const b0 =
36 config.getConfigParameter<double>("initial_aperture");
37
38 auto const a =
40 config.getConfigParameter<double>("mean_frac_distance");
41
42 auto const e0 =
44 config.getConfigParameter<double>("threshold_strain");
45
46 bool n_const = false;
47 Eigen::Matrix<double, 3, 1> n;
48 if (auto const n_ptr =
50 config.getConfigParameterOptional<std::vector<double>>(
51 "fracture_normal"))
52 {
53 if ((*n_ptr).size() != 3)
54 {
56 "The size of the fracture normal vector must be 3, but is %d.",
57 (*n_ptr).size());
58 }
59 DBUG("Using constant fracture normal vector.");
60 std::copy_n((*n_ptr).data(), 3, n.data());
61 n_const = true;
62 n /= n.norm();
63 }
64 else
65 {
66 DBUG(
67 "No constant fracture normal was given. By default it will be "
68 "determined as the third principal stress vector.");
69 }
70
71 std::string const fracture_rotation_xy_param_name =
73 config.getConfigParameter<std::string>("fracture_rotation_xy");
74
75 auto const& phi_xy = ParameterLib::findParameter<double>(
76 fracture_rotation_xy_param_name, parameters, 0, nullptr);
77
78 std::string const fracture_rotation_yz_param_name =
80 config.getConfigParameter<std::string>("fracture_rotation_yz");
81
82 auto const& phi_yz = ParameterLib::findParameter<double>(
83 fracture_rotation_yz_param_name, parameters, 0, nullptr);
84
85 auto const jf =
87 config.getConfigParameter<double>("jacobian_factor", 0.);
88
89 if (geometry_dimension == 2)
90 {
91 return std::make_unique<EmbeddedFracturePermeability<2>>(
92 std::move(property_name), n, n_const, k, b0, a, e0, phi_xy, phi_yz,
93 jf);
94 }
95 return std::make_unique<EmbeddedFracturePermeability<3>>(
96 std::move(property_name), n, n_const, k, b0, a, e0, phi_xy, phi_yz, jf);
97}
98} // namespace MaterialPropertyLib
#define OGS_FATAL(...)
Definition Error.h:19
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:22
T peekConfigParameter(std::string const &param) const
std::optional< T > getConfigParameterOptional(std::string const &param) const
T getConfigParameter(std::string const &param) const
void checkConfigParameter(std::string const &param, std::string_view const value) const
std::unique_ptr< Property > createEmbeddedFracturePermeability(int const geometry_dimension, BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters)
OGS_NO_DANGLING Parameter< ParameterDataType > & findParameter(std::string const &parameter_name, std::vector< std::unique_ptr< ParameterBase > > const &parameters, int const num_components, MeshLib::Mesh const *const mesh=nullptr)