OGS
CreateStrainDependentPermeability.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
5
6#include <string>
7
9#include "BaseLib/Error.h"
10#include "Parameter.h"
13#include "ParameterLib/Utils.h"
15
16namespace MaterialPropertyLib
17{
18std::unique_ptr<Property> createStrainDependentPermeability(
19 int const geometry_dimension,
20 BaseLib::ConfigTree const& config,
21 std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters,
22 ParameterLib::CoordinateSystem const* const local_coordinate_system)
23{
24 if ((geometry_dimension != 2) && (geometry_dimension != 3))
25 {
27 "The StrainDependentPermeability is implemented only for 2D or 3D "
28 "problems");
29 }
30
32 config.checkConfigParameter("type", "StrainDependentPermeability");
33
34 // Second access for storage.
36 auto property_name = config.peekConfigParameter<std::string>("name");
37
38 DBUG("Create StrainDependentPermeability property {:s}.", property_name);
39
40 std::string const& parameter_name =
42 config.getConfigParameter<std::string>("initial_permeability");
43 auto const& parameter_k0 = ParameterLib::findParameter<double>(
44 parameter_name, parameters, 0, nullptr);
45
46 auto const b1 =
48 config.getConfigParameter<double>("b1");
49 auto const b2 =
51 config.getConfigParameter<double>("b2");
52 auto const b3 =
54 config.getConfigParameter<double>("b3");
55 auto const minimum_permeability =
57 config.getConfigParameter<double>("minimum_permeability");
58 auto const maximum_permeability =
60 config.getConfigParameter<double>("maximum_permeability");
61
62 if (minimum_permeability > maximum_permeability)
63 {
65 "The value of minimum_permeability of {:e} is larger that the "
66 "value of maximum_permeability of {:e} in "
67 "StrainDependentPermeability",
68 minimum_permeability, maximum_permeability);
69 }
70
71 if (geometry_dimension == 2)
72 {
73 return std::make_unique<StrainDependentPermeability<2>>(
74 std::move(property_name), parameter_k0, b1, b2, b3,
75 minimum_permeability, maximum_permeability,
76 local_coordinate_system);
77 }
78
79 return std::make_unique<StrainDependentPermeability<3>>(
80 std::move(property_name), parameter_k0, b1, b2, b3,
81 minimum_permeability, maximum_permeability, local_coordinate_system);
82}
83} // 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< Property > createStrainDependentPermeability(int const geometry_dimension, BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, ParameterLib::CoordinateSystem const *const local_coordinate_system)
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)
A local coordinate system used for tensor transformations.