OGS
TRMVaporDiffusionModel.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
5
7{
8template <int DisplacementDim>
10 SpaceTimeData const& x_t, MediaData const& media_data,
11 LiquidDensityData const& rho_L_data, SaturationData const& S_L_data,
12 SaturationDataDeriv const& dS_L_data, PorosityData const& poro_data,
16{
17 namespace MPL = MaterialPropertyLib;
18 MPL::VariableArray variables;
19 variables.temperature = T_data.T;
20 variables.liquid_phase_pressure = -p_cap_data.p_cap;
21 // setting pG to 1 atm
22 // TODO : rewrite equations s.t. p_L = pG-p_cap
23 variables.gas_phase_pressure = 1.0e5;
24 variables.density = rho_L_data.rho_LR;
25 variables.liquid_saturation = S_L_data.S_L;
26
27 auto const& medium = media_data.medium;
28
29 MPL::Phase const* gas_phase =
31
32 out.setZero();
33
34 if (gas_phase && S_L_data.S_L < 1.0)
35 {
36 double const rho_wv =
38 .template value<double>(variables, x_t.x, x_t.t, x_t.dt);
39
40 double const drho_wv_dT =
42 .template dValue<double>(variables, MPL::Variable::temperature,
43 x_t.x, x_t.t, x_t.dt);
44 double const drho_wv_dp =
46 .template dValue<double>(variables,
48 x_t.x, x_t.t, x_t.dt);
49 auto const f_Tv =
50 gas_phase
51 ->property(
53 .template value<double>(variables, x_t.x, x_t.t, x_t.dt);
54
55 double const phi = poro_data.phi;
56 variables.porosity = phi;
57
58 double const S_g = 1.0 - S_L_data.S_L;
59 double const tortuosity =
60 medium.property(MPL::PropertyType::tortuosity)
61 .template value<double>(variables, x_t.x, x_t.t, x_t.dt);
62 double const D_v =
63 phi * S_g * tortuosity *
65 .template value<double>(variables, x_t.x, x_t.t, x_t.dt);
66
67 out.J_pT_X_dNTdN = f_Tv * D_v * drho_wv_dT;
68 out.K_pp_X_dNTdN = D_v * drho_wv_dp;
69
70 out.vapor_flux = -(out.J_pT_X_dNTdN * T_data.grad_T -
71 out.K_pp_X_dNTdN * p_cap_data.grad_p_cap);
73 gas_phase
74 ->property(
76 .template value<double>(variables, x_t.x, x_t.t, x_t.dt);
77
78 out.M_TT_X_NTN += out.heat_capacity_vapor * rho_wv * S_g * phi;
79
81 phi * (rho_wv * dS_L_data.dS_L_dp_cap + S_g * drho_wv_dp);
82
83 out.M_pT_X_NTN += phi * S_g * drho_wv_dT;
84
85 //
86 // Latent heat term
87 //
89 {
90 double const factor = phi * S_g / rho_L_data.rho_LR;
91 // The volumetric latent heat of vaporization of liquid water
92 double const L0 =
94 .template value<double>(variables, x_t.x, x_t.t, x_t.dt) *
95 rho_L_data.rho_LR;
96
97 double const rho_wv_over_rho_L = rho_wv / rho_L_data.rho_LR;
98
99 out.M_TT_X_NTN +=
100 factor * L0 *
101 (drho_wv_dT - rho_wv_over_rho_L * rho_L_data.drho_LR_dT);
102 out.M_Tp_X_NTN =
103 (factor * L0 *
104 (drho_wv_dp - rho_wv_over_rho_L * rho_L_data.drho_LR_dp) +
105 L0 * phi * rho_wv_over_rho_L * dS_L_data.dS_L_dp_cap);
106 out.K_TT_X_dNTdN = L0 * out.J_pT_X_dNTdN / rho_L_data.rho_LR;
107 out.K_Tp_X_dNTdN = L0 * out.K_pp_X_dNTdN / rho_L_data.rho_LR;
108 }
109 }
110}
111
112template struct TRMVaporDiffusionModel<2>;
113template struct TRMVaporDiffusionModel<3>;
114} // namespace ProcessLib::ThermoRichardsMechanics
Property const & property(PropertyType const &p) const
Definition Phase.cpp:81
bool hasProperty(PropertyType const &p) const
Definition Phase.cpp:97
Phase const * getOptionalPhase(Medium const &medium, PhaseName phase_name)
Definition Medium.cpp:110
@ thermal_diffusion_enhancement_factor
Thermal diffusion enhancement factor for water vapor flow.
MaterialPropertyLib::Medium const & medium
Definition MediaData.h:19
void eval(SpaceTimeData const &x_t, MediaData const &media_data, LiquidDensityData const &rho_L_data, SaturationData const &S_L_data, SaturationDataDeriv const &dS_L_data, PorosityData const &poro_data, CapillaryPressureData< DisplacementDim > const &p_cap_data, TemperatureData< DisplacementDim > const &T_data, TRMVaporDiffusionData< DisplacementDim > &out) const
Eigen::Vector< double, DisplacementDim > grad_T