OGS
NoPhaseTransition.cpp
Go to the documentation of this file.
1
10#include "NoPhaseTransition.h"
11
13
14namespace ProcessLib::TH2M
15{
16namespace ConstitutiveRelations
17{
19 std::map<int, std::shared_ptr<MaterialPropertyLib::Medium>> const& media)
21{
22 DBUG("Create NoPhaseTransition constitutive model.");
23
24 // check for minimum requirement definitions in media object
25 std::array const required_gas_properties = {
28 std::array const required_liquid_properties = {
30
31 for (auto const& m : media)
32 {
33 checkRequiredProperties(m.second->phase("Gas"),
34 required_gas_properties);
35 checkRequiredProperties(m.second->phase("AqueousLiquid"),
36 required_liquid_properties);
37 }
38}
39
41 MediaData const& media_data,
42 GasPressureData const& p_GR,
43 CapillaryPressureData const& p_cap,
44 TemperatureData const& T_data,
45 PureLiquidDensityData const& rho_W_LR,
46 ViscosityData& viscosity_data,
47 EnthalpyData& enthalpy_data,
48 MassMoleFractionsData& mass_mole_fractions_data,
49 FluidDensityData& fluid_density_data,
50 VapourPartialPressureData& vapour_pressure_data,
51 ConstituentDensityData& constituent_density_data,
52 PhaseTransitionData& cv) const
53{
55
56 // primary variables
57 auto const pGR = p_GR();
58 auto const pCap = p_cap();
59 auto const T = T_data.T;
60 variables.gas_phase_pressure = pGR;
61 variables.temperature = T;
62
63 auto const& liquid_phase = media_data.liquid;
64 auto const& gas_phase = media_data.gas;
65
66 vapour_pressure_data.pWGR = 0;
67
68 // C-component is only component in the gas phase
69 cv.xnWG = 0.;
70 cv.xmWG = 0.;
71 mass_mole_fractions_data.xnCG = 1. - cv.xnWG;
72 mass_mole_fractions_data.xmCG = 1. - cv.xmWG;
73
74 auto const M =
76 .template value<double>(variables, x_t.x, x_t.t, x_t.dt);
77
78 variables.molar_mass = M;
79
80 fluid_density_data.rho_GR =
82 .template value<double>(variables, x_t.x, x_t.t, x_t.dt);
83 viscosity_data.mu_GR =
85 .template value<double>(variables, x_t.x, x_t.t, x_t.dt);
86
87 constituent_density_data.rho_C_GR = fluid_density_data.rho_GR;
88 constituent_density_data.rho_W_GR = 0;
89 constituent_density_data.rho_C_LR = 0;
90
91 // W-component is only component in the liquid phase
92 mass_mole_fractions_data.xmWL = 1.;
93
94 auto const pLR = pGR - pCap;
95 variables.liquid_phase_pressure = pLR;
96 fluid_density_data.rho_LR = rho_W_LR();
97 variables.density = fluid_density_data.rho_LR;
98
99 viscosity_data.mu_LR =
101 .template value<double>(variables, x_t.x, x_t.t, x_t.dt);
102
103 // specific heat capacities
104 auto const cpG =
105 gas_phase
107 .template value<double>(variables, x_t.x, x_t.t, x_t.dt);
108
109 auto const cpL =
110 liquid_phase
112 .template value<double>(variables, x_t.x, x_t.t, x_t.dt);
113
114 // specific phase enthalpies
115 enthalpy_data.h_G = cpG * T;
116 enthalpy_data.h_L = cpL * T;
117 cv.dh_G_dT = cpG;
118 cv.dh_L_dT = cpL;
119
120 // specific inner energies
121 cv.uG = enthalpy_data.h_G - pGR / fluid_density_data.rho_GR;
122 cv.uL = enthalpy_data.h_L;
123
124 auto const drho_GR_dT =
126 .template dValue<double>(variables,
128 x_t.x, x_t.t, x_t.dt);
129 cv.du_G_dT = cpG + pGR * drho_GR_dT / fluid_density_data.rho_GR /
130 fluid_density_data.rho_GR;
131
132 cv.du_L_dT = cpL;
133
134 cv.drho_GR_dp_GR =
136 .template dValue<double>(
138 x_t.x, x_t.t, x_t.dt);
139 cv.drho_LR_dp_LR =
141 .template dValue<double>(
143 x_t.x, x_t.t, x_t.dt);
145
146 cv.du_G_dp_GR = -1 / fluid_density_data.rho_GR +
147 pGR * cv.drho_GR_dp_GR / fluid_density_data.rho_GR /
148 fluid_density_data.rho_GR;
149
151 cv.drho_C_LR_dp_LR = 0;
152 cv.drho_C_LR_dp_GR = 0;
153 cv.drho_C_GR_dT = drho_GR_dT;
154
155 auto const drho_LR_dT =
157 .template dValue<double>(variables,
159 x_t.x, x_t.t, x_t.dt);
160 cv.drho_C_LR_dT = 0;
161
162 cv.du_L_dp_GR = 0;
163 cv.du_L_dp_cap = 0;
164 /* TODO update to the following when uL has same structure as the uG:
165 +-1 / fluid_density_data.rho_LR + pLR* cv.drho_LR_dp_cap /
166 fluid_density_data.rho_LR /
167 fluid_density_data.rho_LR;
168 */
169
172 cv.drho_W_LR_dT = drho_LR_dT;
173 cv.drho_W_GR_dT = 0;
174 cv.drho_W_GR_dp_GR = 0;
175 cv.drho_W_GR_dp_cap = 0;
176}
177} // namespace ConstitutiveRelations
178} // namespace ProcessLib::TH2M
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
ParameterLib::SpatialPosition x
Definition Base.h:74
MaterialPropertyLib::Phase const & liquid
Definition Base.h:44
MaterialPropertyLib::Phase const & gas
Definition Base.h:45
void eval(SpaceTimeData const &x_t, MediaData const &media_data, GasPressureData const &p_GR, CapillaryPressureData const &p_cap, TemperatureData const &T_data, PureLiquidDensityData const &rho_W_LR, ViscosityData &viscosity_data, EnthalpyData &enthalpy_data, MassMoleFractionsData &mass_mole_fractions_data, FluidDensityData &fluid_density_data, VapourPartialPressureData &vapour_pressure_data, ConstituentDensityData &constituent_density_data, PhaseTransitionData &cv) const override
NoPhaseTransition(std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const &media)