OGS
CreateSaturationDependentSwelling.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<SaturationDependentSwelling> createSaturationDependentSwelling(
11 BaseLib::ConfigTree const& config,
12 ParameterLib::CoordinateSystem const* const local_coordinate_system)
13{
15 config.checkConfigParameter("type", "SaturationDependentSwelling");
16
17 // Second access for storage.
19 auto property_name = config.peekConfigParameter<std::string>("name");
20
21 DBUG("Create SaturationDependentSwelling solid phase property {:s}.",
22 property_name);
23
24 auto const swelling_pressures =
26 config.getConfigParameter<std::vector<double>>("swelling_pressures");
27
28 if (swelling_pressures.size() != 3)
29 {
31 "The number of swelling pressures must be three, but {:d} were "
32 "given.",
33 swelling_pressures.size());
34 }
35
36 auto const exponents =
38 config.getConfigParameter<std::vector<double>>("exponents");
39
40 if (exponents.size() != 3)
41 {
42 OGS_FATAL("The number of exponents must be three, but {:d} were given.",
43 exponents.size());
44 }
45
46 if (swelling_pressures.size() != exponents.size())
47 {
49 "The number of swelling pressures and exponents must be equal, but "
50 "they are {:d} and {:d}, respectively.",
51 swelling_pressures.size(), exponents.size());
52 }
53
54 auto const lower_saturation_limit =
56 config.getConfigParameter<double>("lower_saturation_limit");
57
58 auto const upper_saturation_limit =
60 config.getConfigParameter<double>("upper_saturation_limit");
61
62 return std::make_unique<SaturationDependentSwelling>(
63 std::move(property_name),
64 std::array<double, 3>{swelling_pressures[0], swelling_pressures[1],
65 swelling_pressures[2]},
66 std::array<double, 3>{exponents[0], exponents[1], exponents[2]},
67 lower_saturation_limit, upper_saturation_limit,
68 local_coordinate_system);
69}
70} // 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
T getConfigParameter(std::string const &param) const
void checkConfigParameter(std::string const &param, std::string_view const value) const
std::unique_ptr< SaturationDependentSwelling > createSaturationDependentSwelling(BaseLib::ConfigTree const &config, ParameterLib::CoordinateSystem const *const local_coordinate_system)
A local coordinate system used for tensor transformations.