OGS
CreateThermalTwoPhaseFlowWithPPProcess.cpp
Go to the documentation of this file.
1
11
12#include <cassert>
13
17#include "ParameterLib/Utils.h"
22
23namespace ProcessLib
24{
25namespace ThermalTwoPhaseFlowWithPP
26{
28 std::map<int, std::shared_ptr<MaterialPropertyLib::Medium>> const& media)
29{
30 std::array const required_property_medium = {
39
40 std::array const required_property_solid_phase = {
43
44 std::array const required_property_liquid_phase = {
48
49 std::array const required_property_gas_phase = {
51
52 std::array const required_property_vapour_component = {
57
58 std::array const required_property_dry_air_component = {
61
62 std::array const required_property_contaminant_vapour_component = {
67
68 std::array const required_property_dissolved_contaminant_component = {
70
71 for (auto const& m : media)
72 {
73 auto const& gas_phase = m.second->phase("Gas");
74 auto const& liquid_phase = m.second->phase("AqueousLiquid");
75 checkRequiredProperties(*m.second, required_property_medium);
76 checkRequiredProperties(gas_phase, required_property_gas_phase);
77 checkRequiredProperties(liquid_phase, required_property_liquid_phase);
78 checkRequiredProperties(m.second->phase("Solid"),
79 required_property_solid_phase);
80
81 // TODO (BM): should use index to identify components (same for impl.h)
82 checkRequiredProperties(gas_phase.component("w"),
83 required_property_vapour_component);
84 checkRequiredProperties(gas_phase.component("a"),
85 required_property_dry_air_component);
86 checkRequiredProperties(gas_phase.component("c"),
87 required_property_contaminant_vapour_component);
88 checkRequiredProperties(
89 liquid_phase.component("c"),
90 required_property_dissolved_contaminant_component);
91 }
92}
93
95 std::string const& name,
96 MeshLib::Mesh& mesh,
97 std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&& jacobian_assembler,
98 std::vector<ProcessVariable> const& variables,
99 std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters,
100 unsigned const integration_order,
101 BaseLib::ConfigTree const& config,
102 std::map<int, std::shared_ptr<MaterialPropertyLib::Medium>> const& media)
103{
105 config.checkConfigParameter("type", "THERMAL_TWOPHASE_WITH_PP");
106
108 DBUG("Create nonisothermal two-phase flow model.");
110 auto const pv_config = config.getConfigSubtree("process_variables");
111
113 auto per_process_variables = findProcessVariables(
114 variables, pv_config,
115 {
116 "gas_pressure",
118 "capillary_pressure",
120 "total_molar_fraction_contaminant",
122 "temperature"});
123 std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>
124 process_variables;
125 process_variables.push_back(std::move(per_process_variables));
126
127 SecondaryVariableCollection secondary_variables;
128
129 ProcessLib::createSecondaryVariables(config, secondary_variables);
131 // Specific body force
132 std::vector<double> const b =
134 config.getConfigParameter<std::vector<double>>("specific_body_force");
135 assert(!b.empty() && b.size() < 4);
136 Eigen::VectorXd specific_body_force(b.size());
137 bool const has_gravity = MathLib::toVector(b).norm() > 0;
138 if (has_gravity)
139 {
140 std::copy_n(b.data(), b.size(), specific_body_force.data());
141 }
142
144 auto mass_lumping = config.getConfigParameter<bool>("mass_lumping");
145
146 auto media_map =
148
149 DBUG("Check the media properties of ThermalTwoPhaseFlowWithPP process ...");
150 checkMPLProperties(media);
151 DBUG("Media properties verified.");
152
154 std::move(media_map), specific_body_force, has_gravity, mass_lumping};
155
156 return std::make_unique<ThermalTwoPhaseFlowWithPPProcess>(
157 std::move(name), mesh, std::move(jacobian_assembler), parameters,
158 integration_order, std::move(process_variables),
159 std::move(process_data), std::move(secondary_variables));
160}
161
162} // namespace ThermalTwoPhaseFlowWithPP
163} // namespace ProcessLib
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
T getConfigParameter(std::string const &param) const
ConfigTree getConfigSubtree(std::string const &root) const
void checkConfigParameter(std::string const &param, std::string_view const value) const
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)
@ relative_permeability_nonwetting_phase
@ longitudinal_dispersivity
used to compute the hydrodynamic dispersion tensor.
@ transversal_dispersivity
used to compute the hydrodynamic dispersion tensor.
Eigen::Map< const Vector > toVector(std::vector< double > const &data, Eigen::VectorXd::Index size)
Creates an Eigen mapped vector from the given data vector.
void checkMPLProperties(std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const &media)
std::unique_ptr< Process > createThermalTwoPhaseFlowWithPPProcess(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)
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)