OGS
NoPhaseTransition.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#include "NoPhaseTransition.h"
5
7
8namespace ProcessLib::TH2M
9{
11{
13 std::map<int, std::shared_ptr<MaterialPropertyLib::Medium>> const& media)
15{
16 DBUG("Create NoPhaseTransition constitutive model.");
17
18 // check for minimum requirement definitions in media object
19 std::array const required_gas_properties = {
22 std::array const required_liquid_properties = {
24
25 for (auto const& m : media)
26 {
27 checkRequiredProperties(m.second->phase("Gas"),
28 required_gas_properties);
29 checkRequiredProperties(m.second->phase("AqueousLiquid"),
30 required_liquid_properties);
31 }
32}
33
35 MediaData const& media_data,
36 GasPressureData const& p_GR,
37 CapillaryPressureData const& p_cap,
38 TemperatureData const& T_data,
39 PureLiquidDensityData const& rho_W_LR,
40 FluidEnthalpyData& fluid_enthalpy_data,
41 MassMoleFractionsData& mass_mole_fractions_data,
42 FluidDensityData& fluid_density_data,
43 VapourPartialPressureData& vapour_pressure_data,
44 ConstituentDensityData& constituent_density_data,
45 PhaseTransitionData& cv) const
46{
48
49 // primary variables
50 auto const pGR = p_GR.pG;
51 auto const pCap = p_cap.pCap;
52 auto const T = T_data.T;
53 variables.gas_phase_pressure = pGR;
54 variables.temperature = T;
55
56 auto const& liquid_phase = media_data.liquid;
57 auto const& gas_phase = media_data.gas;
58
59 vapour_pressure_data.pWGR = 0;
60
61 // C-component is only component in the gas phase
62 cv.dxmWG_dpGR = 0.;
63 cv.dxmWG_dpCap = 0.;
64 cv.dxmWG_dT = 0.;
65 mass_mole_fractions_data.xnCG = 1.;
66 mass_mole_fractions_data.xmCG = 1.;
67
68 auto const M =
70 .template value<double>(variables, x_t.x, x_t.t, x_t.dt);
71
72 variables.molar_mass = M;
73
74 fluid_density_data.rho_GR =
76 .template value<double>(variables, x_t.x, x_t.t, x_t.dt);
77
78 constituent_density_data.rho_C_GR = fluid_density_data.rho_GR;
79 constituent_density_data.rho_W_GR = 0;
80 constituent_density_data.rho_C_LR = 0;
81
82 // W-component is only component in the liquid phase
83 mass_mole_fractions_data.xmWL = 1.;
84 cv.dxmWL_dpGR = 0;
85 cv.dxmWL_dpCap = 0;
86 cv.dxmWL_dT = 0;
87
88 auto const pLR = pGR - pCap;
89 variables.liquid_phase_pressure = pLR;
90 fluid_density_data.rho_LR = rho_W_LR();
91 variables.density = fluid_density_data.rho_LR;
92
93 // specific heat capacities
94 auto const cpG =
95 gas_phase
97 .template value<double>(variables, x_t.x, x_t.t, x_t.dt);
98
99 auto const cpL =
100 liquid_phase
102 .template value<double>(variables, x_t.x, x_t.t, x_t.dt);
103
104 // specific phase enthalpies
105 fluid_enthalpy_data.h_G = cpG * T;
106 fluid_enthalpy_data.h_L = cpL * T;
107 cv.dh_G_dT = cpG;
108 cv.dh_L_dT = cpL;
109
110 // specific inner energies
111 cv.uG = fluid_enthalpy_data.h_G - pGR / fluid_density_data.rho_GR;
112 cv.uL = fluid_enthalpy_data.h_L;
113
114 cv.drho_GR_dT =
116 .template dValue<double>(variables,
118 x_t.x, x_t.t, x_t.dt);
119 cv.du_G_dT = cpG + pGR * cv.drho_GR_dT / fluid_density_data.rho_GR /
120 fluid_density_data.rho_GR;
121
122 cv.du_L_dT = cpL;
123
124 cv.drho_GR_dp_cap = 0;
125
126 cv.drho_GR_dp_GR =
128 .template dValue<double>(
130 x_t.x, x_t.t, x_t.dt);
131 cv.drho_LR_dp_LR =
133 .template dValue<double>(
135 x_t.x, x_t.t, x_t.dt);
136
137 cv.du_G_dp_GR = -1 / fluid_density_data.rho_GR +
138 pGR * cv.drho_GR_dp_GR / fluid_density_data.rho_GR /
139 fluid_density_data.rho_GR;
140
142 cv.drho_C_GR_dp_cap = 0;
143 cv.drho_C_GR_dT = cv.drho_GR_dT;
144
145 cv.drho_LR_dT =
147 .template dValue<double>(variables,
149 x_t.x, x_t.t, x_t.dt);
150
153 cv.drho_W_LR_dT = cv.drho_LR_dT;
154 cv.drho_W_GR_dT = 0;
155 cv.drho_W_GR_dp_GR = 0;
156 cv.drho_W_GR_dp_cap = 0;
157
160
161 cv.hCG = 0;
162 cv.hWG = 0;
163}
164} // namespace ConstitutiveRelations
165} // namespace ProcessLib::TH2M
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:22
BaseLib::StrongType< double, struct PureLiquidDensityTag > PureLiquidDensityData
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
PhaseTransitionModel(std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const &media)