OGS 6.2.0-97-g4a610c866
CreateLiquidFlowProcess.cpp
Go to the documentation of this file.
1 
13 
14 #include <algorithm>
15 
18 #include "ParameterLib/Utils.h"
21 
22 #include "LiquidFlowProcess.h"
23 
24 namespace ProcessLib
25 {
26 namespace LiquidFlow
27 {
28 std::unique_ptr<Process> createLiquidFlowProcess(
29  MeshLib::Mesh& mesh,
30  std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&& jacobian_assembler,
31  std::vector<ProcessVariable> const& variables,
32  std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters,
33  unsigned const integration_order,
34  BaseLib::ConfigTree const& config)
35 {
37  config.checkConfigParameter("type", "LIQUID_FLOW");
38 
39  DBUG("Create LiquidFlowProcess.");
40 
41  // Process variable.
42 
44  auto const pv_config = config.getConfigSubtree("process_variables");
45 
46  auto per_process_variables = findProcessVariables(
47  variables, pv_config,
48  {
49  "process_variable"});
50  std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>
51  process_variables;
52  process_variables.push_back(std::move(per_process_variables));
53 
54  SecondaryVariableCollection secondary_variables;
55 
56  NumLib::NamedFunctionCaller named_function_caller({"LiquidFlow_pressure"});
57 
58  ProcessLib::createSecondaryVariables(config, secondary_variables,
59  named_function_caller);
60 
61  // Get the gravity vector for the Darcy velocity
63  auto const& darcy_g_config = config.getConfigSubtree("darcy_gravity");
64  const auto gravity_axis_id_input =
66  darcy_g_config.getConfigParameter<int>("axis_id");
67  if (gravity_axis_id_input >= static_cast<int>(mesh.getDimension()))
68  {
69  OGS_FATAL(
70  "The gravity axis must be a number between 0 and one less than the "
71  "mesh dimension, which is %d. Read gravity axis %d from input "
72  "file.",
73  mesh.getDimension(), gravity_axis_id_input);
74  }
75  const auto g =
77  darcy_g_config.getConfigParameter<double>("g");
78  if (g < 0.)
79  {
80  OGS_FATAL("Gravity magnitude must be non-negative.");
81  }
82  const int gravity_axis_id = (g == 0.) ? -1 : gravity_axis_id_input;
83 
84  auto const& refT =
86  config.getConfigParameterOptional<double>("reference_temperature");
87  const double reference_temperature =
88  refT ? *refT
90 
92  auto const& mat_config = config.getConfigSubtree("material_property");
93 
94  auto const material_ids = materialIDs(mesh);
95  if (material_ids)
96  {
97  INFO("The liquid flow is in heterogeneous porous media.");
98  }
99  else
100  {
101  INFO("The liquid flow is in homogeneous porous media.");
102  }
103 
104  return std::unique_ptr<Process>{new LiquidFlowProcess{
105  mesh, std::move(jacobian_assembler), parameters, integration_order,
106  std::move(process_variables), std::move(secondary_variables),
107  std::move(named_function_caller), material_ids, gravity_axis_id, g,
108  reference_temperature, mat_config}};
109 }
110 
111 } // namespace LiquidFlow
112 } // namespace ProcessLib
void createSecondaryVariables(BaseLib::ConfigTree const &config, SecondaryVariableCollection &secondary_variables, NumLib::NamedFunctionCaller &named_function_caller)
A class to simulate the liquid flow process in porous media described by.
std::unique_ptr< Process > createLiquidFlowProcess(MeshLib::Mesh &mesh, std::unique_ptr< ProcessLib::AbstractJacobianAssembler > &&jacobian_assembler, std::vector< ProcessVariable > const &variables, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters, unsigned const integration_order, BaseLib::ConfigTree const &config)
T getConfigParameter(std::string const &param) const
std::vector< std::reference_wrapper< ProcessVariable > > findProcessVariables(std::vector< ProcessVariable > const &variables, BaseLib::ConfigTree const &pv_config, std::initializer_list< std::string > tags)
Builds expression trees of named functions dynamically at runtime.
void checkConfigParameter(std::string const &param, T const &value) const
PropertyVector< int > const * materialIDs(Mesh const &mesh)
Definition: Mesh.cpp:403
ConfigTree getConfigSubtree(std::string const &root) const
Definition: ConfigTree.cpp:150
Handles configuration of several secondary variables from the project file.
unsigned getDimension() const
Returns the dimension of the mesh (determined by the maximum dimension over all elements).
Definition: Mesh.h:81
const double CelsiusZeroInKelvin
Zero degrees Celsius in Kelvin.
boost::optional< T > getConfigParameterOptional(std::string const &param) const
#define OGS_FATAL(fmt,...)
Definition: Error.h:63