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 FluidEnthalpyData& fluid_enthalpy_data,
47 MassMoleFractionsData& mass_mole_fractions_data,
48 FluidDensityData& fluid_density_data,
49 VapourPartialPressureData& vapour_pressure_data,
50 ConstituentDensityData& constituent_density_data,
51 PhaseTransitionData& cv) const
52{
54
55 // primary variables
56 auto const pGR = p_GR();
57 auto const pCap = p_cap();
58 auto const T = T_data.T;
59 variables.gas_phase_pressure = pGR;
60 variables.temperature = T;
61
62 auto const& liquid_phase = media_data.liquid;
63 auto const& gas_phase = media_data.gas;
64
65 vapour_pressure_data.pWGR = 0;
66
67 // C-component is only component in the gas phase
68 cv.dxmWG_dpGR = 0.;
69 cv.dxmWG_dpCap = 0.;
70 cv.dxmWG_dT = 0.;
71 mass_mole_fractions_data.xnCG = 1.;
72 mass_mole_fractions_data.xmCG = 1.;
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
84 constituent_density_data.rho_C_GR = fluid_density_data.rho_GR;
85 constituent_density_data.rho_W_GR = 0;
86 constituent_density_data.rho_C_LR = 0;
87
88 // W-component is only component in the liquid phase
89 mass_mole_fractions_data.xmWL = 1.;
90 cv.dxmWL_dpGR = 0;
91 cv.dxmWL_dpCap = 0;
92 cv.dxmWL_dT = 0;
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 // specific heat capacities
100 auto const cpG =
101 gas_phase
103 .template value<double>(variables, x_t.x, x_t.t, x_t.dt);
104
105 auto const cpL =
106 liquid_phase
108 .template value<double>(variables, x_t.x, x_t.t, x_t.dt);
109
110 // specific phase enthalpies
111 fluid_enthalpy_data.h_G = cpG * T;
112 fluid_enthalpy_data.h_L = cpL * T;
113 cv.dh_G_dT = cpG;
114 cv.dh_L_dT = cpL;
115
116 // specific inner energies
117 cv.uG = fluid_enthalpy_data.h_G - pGR / fluid_density_data.rho_GR;
118 cv.uL = fluid_enthalpy_data.h_L;
119
120 cv.drho_GR_dT =
122 .template dValue<double>(variables,
124 x_t.x, x_t.t, x_t.dt);
125 cv.du_G_dT = cpG + pGR * cv.drho_GR_dT / fluid_density_data.rho_GR /
126 fluid_density_data.rho_GR;
127
128 cv.du_L_dT = cpL;
129
130 cv.drho_GR_dp_cap = 0;
131
132 cv.drho_GR_dp_GR =
134 .template dValue<double>(
136 x_t.x, x_t.t, x_t.dt);
137 cv.drho_LR_dp_LR =
139 .template dValue<double>(
141 x_t.x, x_t.t, x_t.dt);
142
143 cv.du_G_dp_GR = -1 / fluid_density_data.rho_GR +
144 pGR * cv.drho_GR_dp_GR / fluid_density_data.rho_GR /
145 fluid_density_data.rho_GR;
146
148 cv.drho_C_GR_dp_cap = 0;
149 cv.drho_C_GR_dT = cv.drho_GR_dT;
150
151 cv.drho_LR_dT =
153 .template dValue<double>(variables,
155 x_t.x, x_t.t, x_t.dt);
156
159 cv.drho_W_LR_dT = cv.drho_LR_dT;
160 cv.drho_W_GR_dT = 0;
161 cv.drho_W_GR_dp_GR = 0;
162 cv.drho_W_GR_dp_cap = 0;
163
166
167 cv.hCG = 0;
168 cv.hWG = 0;
169}
170} // namespace ConstitutiveRelations
171} // 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:47
MaterialPropertyLib::Phase const & gas
Definition Base.h:48
NoPhaseTransition(std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const &media)
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, FluidEnthalpyData &fluid_enthalpy_data, MassMoleFractionsData &mass_mole_fractions_data, FluidDensityData &fluid_density_data, VapourPartialPressureData &vapour_pressure_data, ConstituentDensityData &constituent_density_data, PhaseTransitionData &cv) const override