OGS 6.2.0-97-g4a610c866
createPermeabilityModel.cpp
Go to the documentation of this file.
1 
14 
15 #include <cassert>
16 
17 #include "BaseLib/ConfigTree.h"
18 
19 #include "BaseLib/Error.h"
23 #include "ParameterLib/Utils.h"
24 
25 namespace MaterialLib
26 {
27 namespace PorousMedium
28 {
29 std::unique_ptr<Permeability> createPermeabilityModel(
30  BaseLib::ConfigTree const& config,
31  std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters)
32 {
34  auto const type = config.getConfigParameter<std::string>("type");
35 
36  if (type == "Constant")
37  {
38  auto const& permeability_parameter = ParameterLib::findParameter<
39  double>(
40  config,
42  "permeability_tensor_entries", parameters, 0);
43 
44  int dimension = static_cast<int>(
45  std::sqrt(permeability_parameter.getNumberOfComponents()));
46  if (permeability_parameter.getNumberOfComponents() !=
47  dimension * dimension)
48  {
49  OGS_FATAL(
50  "The given parameter has %d components, but the permeability "
51  "tensor is defined for a %d dimensional problem.",
52  permeability_parameter.getNumberOfComponents(), dimension);
53  }
54 
55  return std::make_unique<Permeability>(
56  permeability_parameter, dimension);
57  }
58  OGS_FATAL("The permeability type '%s' is unavailable.\n",
59  "The available types are \n\tConstant.",
60  type.data());
61 }
62 
63 } // namespace PorousMedium
64 } // namespace MaterialLib
T getConfigParameter(std::string const &param) const
Parameter< ParameterDataType > & findParameter(std::string const &parameter_name, std::vector< std::unique_ptr< ParameterBase >> const &parameters, int const num_components)
Definition: Utils.h:84
std::unique_ptr< Permeability > createPermeabilityModel(BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters)
#define OGS_FATAL(fmt,...)
Definition: Error.h:63