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(
29 required_gas_properties);
30 checkRequiredProperties(
32 required_liquid_properties);
33 }
34}
35
37 MediaData const& media_data,
38 GasPressureData const& p_GR,
39 CapillaryPressureData const& p_cap,
40 TemperatureData const& T_data,
41 PureLiquidDensityData const& rho_W_LR,
42 FluidEnthalpyData& fluid_enthalpy_data,
43 MassMoleFractionsData& mass_mole_fractions_data,
44 FluidDensityData& fluid_density_data,
45 VapourPartialPressureData& vapour_pressure_data,
46 ConstituentDensityData& constituent_density_data,
47 PhaseTransitionData& cv) const
48{
50
51 // primary variables
52 auto const pGR = p_GR.pG;
53 auto const pCap = p_cap.pCap;
54 auto const T = T_data.T;
55 variables.gas_phase_pressure = pGR;
56 variables.temperature = T;
57
58 auto const& liquid_phase = media_data.liquid;
59 auto const& gas_phase = media_data.gas;
60
61 vapour_pressure_data.pWGR = 0;
62
63 // C-component is only component in the gas phase
64 cv.dxmWG_dpGR = 0.;
65 cv.dxmWG_dpCap = 0.;
66 cv.dxmWG_dT = 0.;
67 mass_mole_fractions_data.xnCG = 1.;
68 mass_mole_fractions_data.xmCG = 1.;
69
70 auto const M =
72 .template value<double>(variables, x_t.x, x_t.t, x_t.dt);
73
74 variables.molar_mass = M;
75
76 fluid_density_data.rho_GR =
78 .template value<double>(variables, x_t.x, x_t.t, x_t.dt);
79
80 constituent_density_data.rho_C_GR = fluid_density_data.rho_GR;
81 constituent_density_data.rho_W_GR = 0;
82 constituent_density_data.rho_C_LR = 0;
83
84 // W-component is only component in the liquid phase
85 mass_mole_fractions_data.xmWL = 1.;
86 cv.dxmWL_dpGR = 0;
87 cv.dxmWL_dpCap = 0;
88 cv.dxmWL_dT = 0;
89
90 auto const pLR = pGR - pCap;
91 variables.liquid_phase_pressure = pLR;
92 fluid_density_data.rho_LR = rho_W_LR();
93 variables.density = fluid_density_data.rho_LR;
94
95 // specific heat capacities
96 auto const cpG =
97 gas_phase
99 .template value<double>(variables, x_t.x, x_t.t, x_t.dt);
100
101 auto const cpL =
102 liquid_phase
104 .template value<double>(variables, x_t.x, x_t.t, x_t.dt);
105
106 // specific phase enthalpies
107 fluid_enthalpy_data.h_G = cpG * T;
108 fluid_enthalpy_data.h_L = cpL * T;
109 cv.dh_G_dT = cpG;
110 cv.dh_L_dT = cpL;
111
112 // specific inner energies
113 cv.uG = fluid_enthalpy_data.h_G - pGR / fluid_density_data.rho_GR;
114 cv.uL = fluid_enthalpy_data.h_L;
115
116 cv.drho_GR_dT =
118 .template dValue<double>(variables,
120 x_t.x, x_t.t, x_t.dt);
121 cv.du_G_dT = cpG + pGR * cv.drho_GR_dT / fluid_density_data.rho_GR /
122 fluid_density_data.rho_GR;
123
124 cv.du_L_dT = cpL;
125
126 cv.drho_GR_dp_cap = 0;
127
128 cv.drho_GR_dp_GR =
130 .template dValue<double>(
132 x_t.x, x_t.t, x_t.dt);
133 cv.drho_LR_dp_LR =
135 .template dValue<double>(
137 x_t.x, x_t.t, x_t.dt);
138
139 cv.du_G_dp_GR = -1 / fluid_density_data.rho_GR +
140 pGR * cv.drho_GR_dp_GR / fluid_density_data.rho_GR /
141 fluid_density_data.rho_GR;
142
144 cv.drho_C_GR_dp_cap = 0;
145 cv.drho_C_GR_dT = cv.drho_GR_dT;
146
147 cv.drho_LR_dT =
149 .template dValue<double>(variables,
151 x_t.x, x_t.t, x_t.dt);
152
155 cv.drho_W_LR_dT = cv.drho_LR_dT;
156 cv.drho_W_GR_dT = 0;
157 cv.drho_W_GR_dp_GR = 0;
158 cv.drho_W_GR_dp_cap = 0;
159
162
163 cv.hCG = 0;
164 cv.hWG = 0;
165}
166} // namespace ConstitutiveRelations
167} // 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)