OGS 6.1.0-1721-g6382411ad
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"
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<ProcessLib::ParameterBase>> const& parameters)
32 {
34  auto const type = config.getConfigParameter<std::string>("type");
35 
36  if (type == "Constant")
37  {
38  auto const& permeability_parameter = ProcessLib::findParameter<double>(
39  config,
41  "permeability_tensor_entries", parameters, 0);
42 
43  int dimension = static_cast<int>(
44  std::sqrt(permeability_parameter.getNumberOfComponents()));
45  if (permeability_parameter.getNumberOfComponents() !=
46  dimension * dimension)
47  {
48  OGS_FATAL(
49  "The given parameter has %d components, but the permeability "
50  "tensor is defined for a %d dimensional problem.",
51  permeability_parameter.getNumberOfComponents(), dimension);
52  }
53 
54  return std::make_unique<Permeability>(
55  permeability_parameter, dimension);
56  }
57  OGS_FATAL("The permeability type '%s' is unavailable.\n",
58  "The available types are \n\tConstant.",
59  type.data());
60 }
61 
62 } // end of namespace
63 } // end of namespace
T getConfigParameter(std::string const &param) const
std::unique_ptr< Permeability > createPermeabilityModel(BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< ProcessLib::ParameterBase >> const &parameters)
#define OGS_FATAL(fmt,...)
Definition: Error.h:71