Loading [MathJax]/extensions/tex2jax.js
OGS
createPermeabilityModel.cpp
Go to the documentation of this file.
1 
14 
15 #include <cassert>
16 
17 #include "BaseLib/ConfigTree.h"
18 #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.getNumberOfGlobalComponents()));
46  if (permeability_parameter.getNumberOfGlobalComponents() !=
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.getNumberOfGlobalComponents(),
53  dimension);
54  }
55 
56  return std::make_unique<Permeability>(permeability_parameter,
57  dimension);
58  }
59 
60  if (type == "Dupuit")
61  {
62  auto const& permeability_parameter = ParameterLib::findParameter<
63  double>(
64  config,
66  "permeability_tensor_entries", parameters, 0);
67 
68  int dimension = static_cast<int>(
69  std::sqrt(permeability_parameter.getNumberOfGlobalComponents()));
70  if (permeability_parameter.getNumberOfGlobalComponents() !=
71  dimension * dimension)
72  {
73  OGS_FATAL(
74  "The given parameter has {:d} components, but the permeability "
75  "tensor is defined for a {:d} dimensional problem.",
76  permeability_parameter.getNumberOfGlobalComponents(),
77  dimension);
78  }
79 
80  return std::make_unique<DupuitPermeability>(permeability_parameter,
81  dimension);
82  }
83  OGS_FATAL("The permeability type '{:s}' is unavailable.\n",
84  "The available types are \n\tConstant.",
85  type.data());
86 }
87 
88 } // namespace PorousMedium
89 } // namespace MaterialLib
#define OGS_FATAL(...)
Definition: Error.h:26
T getConfigParameter(std::string const &param) const
std::unique_ptr< Permeability > createPermeabilityModel(BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters)
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)
Definition: Utils.h:102