OGS
ProcessLib::TwoPhaseFlowWithPrho Namespace Reference

Classes

struct  IntegrationPointData
 
class  TwoPhaseFlowWithPrhoLocalAssembler
 
class  TwoPhaseFlowWithPrhoLocalAssemblerInterface
 
class  TwoPhaseFlowWithPrhoMaterialProperties
 
class  TwoPhaseFlowWithPrhoProcess
 A class to simulate the two-phase flow process with P-rho model in porous media. More...
 
struct  TwoPhaseFlowWithPrhoProcessData
 

Functions

std::unique_ptr< TwoPhaseFlowWithPrhoMaterialPropertiescreateTwoPhaseFlowPrhoMaterialProperties (BaseLib::ConfigTree const &config, MeshLib::PropertyVector< int > const *const material_ids)
 
void checkMPLProperties (std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const &media)
 
std::unique_ptr< ProcesscreateTwoPhaseFlowWithPrhoProcess (std::string const &name, 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, std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const &media)
 

Variables

const unsigned NUM_NODAL_DOF = 2
 

Function Documentation

◆ checkMPLProperties()

void ProcessLib::TwoPhaseFlowWithPrho::checkMPLProperties ( std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const & media)

Definition at line 28 of file CreateTwoPhaseFlowWithPrhoProcess.cpp.

30{
31 std::array const required_medium_properties = {
33 std::array const required_liquid_properties = {
35 std::array const required_gas_properties = {
38
39 for (auto const& m : media)
40 {
41 checkRequiredProperties(*m.second, required_medium_properties);
42 checkRequiredProperties(m.second->phase("AqueousLiquid"),
43 required_liquid_properties);
44 checkRequiredProperties(m.second->phase("Gas"),
45 required_gas_properties);
46 }
47}
void checkRequiredProperties(Component const &c, std::span< PropertyType const > const required_properties)
Definition Component.cpp:60

References MaterialPropertyLib::density, MaterialPropertyLib::molar_mass, MaterialPropertyLib::permeability, MaterialPropertyLib::porosity, and MaterialPropertyLib::viscosity.

Referenced by createTwoPhaseFlowWithPrhoProcess().

◆ createTwoPhaseFlowPrhoMaterialProperties()

std::unique_ptr< TwoPhaseFlowWithPrhoMaterialProperties > ProcessLib::TwoPhaseFlowWithPrho::createTwoPhaseFlowPrhoMaterialProperties ( BaseLib::ConfigTree const & config,
MeshLib::PropertyVector< int > const *const material_ids )
Input File Parameter
prj__processes__process__TWOPHASE_FLOW_PRHO__material_property__porous_medium
Input File Parameter
prj__processes__process__TWOPHASE_FLOW_PRHO__material_property__porous_medium__porous_medium
Input File Parameter
prj__processes__process__TWOPHASE_FLOW_PRHO__material_property__porous_medium__porous_medium__id
Input File Parameter
prj__processes__process__TWOPHASE_FLOW_PRHO__material_property__porous_medium__porous_medium__capillary_pressure
Input File Parameter
prj__processes__process__TWOPHASE_FLOW_PRHO__material_property__porous_medium__porous_medium__relative_permeability
Input File Parameter
prj__processes__process__TWOPHASE_FLOW_PRHO__material_property__porous_medium__porous_medium__relative_permeability__relative_permeability
Input File Parameter
prj__processes__process__TWOPHASE_FLOW_PRHO__material_property__porous_medium__porous_medium__relative_permeability__relative_permeability__id

Definition at line 31 of file CreateTwoPhaseFlowPrhoMaterialProperties.cpp.

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}
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
void reorderVector(std::vector< ValueType > &v, std::vector< IndexType > const &order)
Definition Algorithm.h:203
std::unique_ptr< RelativePermeability > createRelativePermeabilityModel(BaseLib::ConfigTree const &config)
std::unique_ptr< CapillaryPressureSaturation > createCapillaryPressureModel(BaseLib::ConfigTree const &config)

References MaterialLib::PorousMedium::createCapillaryPressureModel(), MaterialLib::PorousMedium::createRelativePermeabilityModel(), DBUG(), BaseLib::ConfigTree::getConfigSubtree(), and BaseLib::reorderVector().

Referenced by createTwoPhaseFlowWithPrhoProcess().

◆ createTwoPhaseFlowWithPrhoProcess()

std::unique_ptr< Process > ProcessLib::TwoPhaseFlowWithPrho::createTwoPhaseFlowWithPrhoProcess ( std::string const & name,
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,
std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const & media )
Input File Parameter
prj__processes__process__type

Process Variables

Input File Parameter
prj__processes__process__TWOPHASE_FLOW_PRHO__process_variables

Primary process variables as they appear in the global component vector:

Input File Parameter
prj__processes__process__TWOPHASE_FLOW_PRHO__process_variables__liquid_pressure
Input File Parameter
prj__processes__process__TWOPHASE_FLOW_PRHO__process_variables__overall_mass_density

Process Parameters

Input File Parameter
prj__processes__process__TWOPHASE_FLOW_PRHO__specific_body_force
Input File Parameter
prj__processes__process__TWOPHASE_FLOW_PRHO__mass_lumping
Input File Parameter
prj__processes__process__TWOPHASE_FLOW_PRHO__diffusion_coeff_component_b
Input File Parameter
prj__processes__process__TWOPHASE_FLOW_PRHO__diffusion_coeff_component_a
Input File Parameter
prj__processes__process__TWOPHASE_FLOW_PRHO__temperature
Input File Parameter
prj__processes__process__TWOPHASE_FLOW_PRHO__material_property

Definition at line 49 of file CreateTwoPhaseFlowWithPrhoProcess.cpp.

58{
60 config.checkConfigParameter("type", "TWOPHASE_FLOW_PRHO");
61
62 DBUG("Create TwoPhaseFlowProcess with Prho model.");
63
65
67 auto const pv_config = config.getConfigSubtree("process_variables");
68
70 auto per_process_variables = findProcessVariables(
71 variables, pv_config,
72 {
73 "liquid_pressure",
75 "overall_mass_density"});
76 std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>
77 process_variables;
78 process_variables.push_back(std::move(per_process_variables));
79
80 SecondaryVariableCollection secondary_variables;
81
82 ProcessLib::createSecondaryVariables(config, secondary_variables);
84 // Specific body force
85 std::vector<double> const b =
87 config.getConfigParameter<std::vector<double>>("specific_body_force");
88 assert(!b.empty() && b.size() < 4);
89 Eigen::VectorXd specific_body_force(b.size());
90 bool const has_gravity = MathLib::toVector(b).norm() > 0;
91 if (has_gravity)
92 {
93 std::copy_n(b.data(), b.size(), specific_body_force.data());
94 }
95
97 auto const mass_lumping = config.getConfigParameter<bool>("mass_lumping");
98 // diffusion coeff
99 auto const& diff_coeff_b = ParameterLib::findParameter<double>(
100 config,
102 "diffusion_coeff_component_b", parameters, 1, &mesh);
103 auto const& diff_coeff_a = ParameterLib::findParameter<double>(
104 config,
106 "diffusion_coeff_component_a", parameters, 1, &mesh);
107 auto const& temperature = ParameterLib::findParameter<double>(
108 config,
110 "temperature", parameters, 1, &mesh);
111
113 auto const& mat_config = config.getConfigSubtree("material_property");
114
115 auto const material_ids = materialIDs(mesh);
116 if (material_ids != nullptr)
117 {
118 INFO("The twophase flow is in heterogeneous porous media.");
119 }
120 else
121 {
122 INFO("The twophase flow is in homogeneous porous media.");
123 }
124
125 auto media_map =
127 checkMPLProperties(media);
128
129 std::unique_ptr<TwoPhaseFlowWithPrhoMaterialProperties> material =
130 createTwoPhaseFlowPrhoMaterialProperties(mat_config, material_ids);
131
132 TwoPhaseFlowWithPrhoProcessData process_data{
133 specific_body_force, has_gravity, mass_lumping,
134 diff_coeff_b, diff_coeff_a, temperature,
135 std::move(material), std::move(media_map)};
136
137 return std::make_unique<TwoPhaseFlowWithPrhoProcess>(
138 std::move(name), mesh, std::move(jacobian_assembler), parameters,
139 integration_order, std::move(process_variables),
140 std::move(process_data), std::move(secondary_variables));
141}
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:35
Handles configuration of several secondary variables from the project file.
MaterialSpatialDistributionMap createMaterialSpatialDistributionMap(std::map< int, std::shared_ptr< Medium > > const &media, MeshLib::Mesh const &mesh)
Eigen::Map< const Vector > toVector(std::vector< double > const &data, Eigen::VectorXd::Index size)
Creates an Eigen mapped vector from the given data vector.
OGS_NO_DANGLING 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
void checkMPLProperties(MeshLib::Mesh const &mesh, MaterialPropertyLib::MaterialSpatialDistributionMap const &media_map)
std::unique_ptr< TwoPhaseFlowWithPrhoMaterialProperties > createTwoPhaseFlowPrhoMaterialProperties(BaseLib::ConfigTree const &config, MeshLib::PropertyVector< int > const *const material_ids)
std::vector< std::reference_wrapper< ProcessVariable > > findProcessVariables(std::vector< ProcessVariable > const &variables, BaseLib::ConfigTree const &pv_config, std::initializer_list< std::string > tags)
void createSecondaryVariables(BaseLib::ConfigTree const &config, SecondaryVariableCollection &secondary_variables)

References BaseLib::ConfigTree::checkConfigParameter(), checkMPLProperties(), MaterialPropertyLib::createMaterialSpatialDistributionMap(), ProcessLib::createSecondaryVariables(), createTwoPhaseFlowPrhoMaterialProperties(), DBUG(), ParameterLib::findParameter(), ProcessLib::findProcessVariables(), BaseLib::ConfigTree::getConfigParameter(), BaseLib::ConfigTree::getConfigSubtree(), INFO(), and MathLib::toVector().

Referenced by ProjectData::parseProcesses().

Variable Documentation

◆ NUM_NODAL_DOF

const unsigned ProcessLib::TwoPhaseFlowWithPrho::NUM_NODAL_DOF = 2