OGS
CreatePermeabilityOrthotropicPowerLaw.cpp
Go to the documentation of this file.
1
10#include "BaseLib/ConfigTree.h"
13
14namespace MaterialPropertyLib
15{
16std::unique_ptr<Property> createPermeabilityOrthotropicPowerLaw(
17 BaseLib::ConfigTree const& config,
18 ParameterLib::CoordinateSystem const* const local_coordinate_system)
19{
21 config.checkConfigParameter("type", "PermeabilityOrthotropicPowerLaw");
22
23 // Second access for storage.
25 auto property_name = config.peekConfigParameter<std::string>("name");
26
27 DBUG("Create PermeabilityOrthotropicPowerLaw solid phase property {:s}.",
28 property_name);
29
30 auto const intrinsic_permeabilities =
32 config.getConfigParameter<std::vector<double>>(
33 "intrinsic_permeabilities");
34
35 if (!((intrinsic_permeabilities.size() == 3) ||
36 (intrinsic_permeabilities.size() == 2)))
37 {
39 "The number of intrinsic permeabilities must be two or three, but "
40 "{:d} were given.",
41 intrinsic_permeabilities.size());
42 }
43
44 auto const exponents =
46 config.getConfigParameter<std::vector<double>>("exponents");
47
48 if (exponents.size() != 3 && exponents.size() != 2)
49 {
51 "The number of exponents must be two or three, but {:d} were "
52 "given.",
53 exponents.size());
54 }
55
56 if (intrinsic_permeabilities.size() != exponents.size())
57 {
59 "The number of intrinsic permeabilities and exponents must be "
60 "equal, but they are {:d} and {:d}, respectively.",
61 intrinsic_permeabilities.size(), exponents.size());
62 }
63
64 if (exponents.size() == 2)
65 {
66 return std::make_unique<PermeabilityOrthotropicPowerLaw<2>>(
67 std::move(property_name),
68 std::array<double, 2>{intrinsic_permeabilities[0],
69 intrinsic_permeabilities[1]},
70 std::array<double, 2>{exponents[0], exponents[1]},
71 local_coordinate_system);
72 }
73 if (exponents.size() == 3)
74 {
75 return std::make_unique<PermeabilityOrthotropicPowerLaw<3>>(
76 std::move(property_name),
77 std::array<double, 3>{intrinsic_permeabilities[0],
78 intrinsic_permeabilities[1],
79 intrinsic_permeabilities[2]},
80 std::array<double, 3>{exponents[0], exponents[1], exponents[2]},
81 local_coordinate_system);
82 }
84 "Could not create PermeabilityOrthotropicPowerLaw material model.");
85}
86} // namespace MaterialPropertyLib
#define OGS_FATAL(...)
Definition Error.h:26
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
T peekConfigParameter(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 > createPermeabilityOrthotropicPowerLaw(BaseLib::ConfigTree const &config, ParameterLib::CoordinateSystem const *const local_coordinate_system)
A local coordinate system used for tensor transformations.