OGS
CreateTwoPhaseFlowPrhoMaterialProperties.cpp
Go to the documentation of this file.
1
12
13#include "BaseLib/Algorithm.h"
14#include "BaseLib/ConfigTree.h"
15#include "BaseLib/Logging.h"
22#include "MeshLib/Mesh.h"
25
26namespace ProcessLib
27{
28namespace TwoPhaseFlowWithPrho
29{
30std::unique_ptr<TwoPhaseFlowWithPrhoMaterialProperties>
32 BaseLib::ConfigTree const& config,
33 MeshLib::PropertyVector<int> const* const material_ids)
34{
35 DBUG("Reading material properties of two-phase flow process.");
36
37 // Get porous properties
38 std::vector<int> mat_ids;
39 std::vector<int> mat_krel_ids;
40 std::vector<
41 std::unique_ptr<MaterialLib::PorousMedium::CapillaryPressureSaturation>>
42 _capillary_pressure_models;
43 std::vector<
44 std::unique_ptr<MaterialLib::PorousMedium::RelativePermeability>>
45 _relative_permeability_models;
46
48 auto const& poro_config = config.getConfigSubtree("porous_medium");
50 for (auto const& conf : poro_config.getConfigSubtreeList("porous_medium"))
51 {
53 auto const id = conf.getConfigAttributeOptional<int>("id");
54 mat_ids.push_back(*id);
55
56 auto const& capillary_pressure_conf =
58 conf.getConfigSubtree("capillary_pressure");
60 capillary_pressure_conf);
61 _capillary_pressure_models.emplace_back(std::move(pc));
62
63 auto const& krel_config =
65 conf.getConfigSubtree("relative_permeability");
66 for (
67 auto const& krel_conf :
69 krel_config.getConfigSubtreeList("relative_permeability"))
70 {
71 auto const krel_id =
73 krel_conf.getConfigAttributeOptional<int>("id");
74 mat_krel_ids.push_back(*krel_id);
75 auto krel_n =
77 krel_conf);
78 _relative_permeability_models.emplace_back(std::move(krel_n));
79 }
80 BaseLib::reorderVector(_relative_permeability_models, mat_krel_ids);
81 }
82
83 return std::make_unique<TwoPhaseFlowWithPrhoMaterialProperties>(
84 material_ids,
85 std::move(_capillary_pressure_models),
86 std::move(_relative_permeability_models));
87}
88
89} // namespace TwoPhaseFlowWithPrho
90} // namespace ProcessLib
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
Definition of the Mesh class.
Definition of the PiecewiseLinearInterpolation class.
ConfigTree getConfigSubtree(std::string const &root) const
void reorderVector(std::vector< ValueType > &v, std::vector< IndexType > const &order)
Definition Algorithm.h:199
std::unique_ptr< RelativePermeability > createRelativePermeabilityModel(BaseLib::ConfigTree const &config)
std::unique_ptr< CapillaryPressureSaturation > createCapillaryPressureModel(BaseLib::ConfigTree const &config)
std::unique_ptr< TwoPhaseFlowWithPrhoMaterialProperties > createTwoPhaseFlowPrhoMaterialProperties(BaseLib::ConfigTree const &config, MeshLib::PropertyVector< int > const *const material_ids)