OGS
TRMVaporDiffusion.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 "TRMVaporDiffusion.h"
5
7{
8template <int DisplacementDim>
23
24template <int DisplacementDim>
26 SpaceTimeData const& x_t, MediaData const& media_data,
27 LiquidDensityData const& rho_L_data, SaturationData const& S_L_data,
28 SaturationDataDeriv const& dS_L_data, PorosityData const& poro_data,
32{
33 namespace MPL = MaterialPropertyLib;
34 MPL::VariableArray variables;
35 variables.temperature = T_data.T;
36 variables.liquid_phase_pressure = -p_cap_data.p_cap;
37 // setting pG to 1 atm
38 // TODO : rewrite equations s.t. p_L = pG-p_cap
39 variables.gas_phase_pressure = 1.0e5;
40 variables.density = rho_L_data.rho_LR;
41 variables.liquid_saturation = S_L_data.S_L;
42
43 auto const& medium = media_data.medium;
44
45 MPL::Phase const* gas_phase =
46 medium.hasPhase("Gas") ? &medium.phase("Gas") : nullptr;
47
48 out.setZero();
49
50 if (gas_phase && S_L_data.S_L < 1.0)
51 {
52 double const rho_wv =
54 .template value<double>(variables, x_t.x, x_t.t, x_t.dt);
55
56 double const drho_wv_dT =
58 .template dValue<double>(variables, MPL::Variable::temperature,
59 x_t.x, x_t.t, x_t.dt);
60 double const drho_wv_dp =
62 .template dValue<double>(variables,
64 x_t.x, x_t.t, x_t.dt);
65 auto const f_Tv =
66 gas_phase
67 ->property(
69 .template value<double>(variables, x_t.x, x_t.t, x_t.dt);
70
71 double const phi = poro_data.phi;
72 variables.porosity = phi;
73
74 double const S_g = 1.0 - S_L_data.S_L;
75 double const tortuosity =
76 medium.property(MPL::PropertyType::tortuosity)
77 .template value<double>(variables, x_t.x, x_t.t, x_t.dt);
78 double const D_v =
79 phi * S_g * tortuosity *
81 .template value<double>(variables, x_t.x, x_t.t, x_t.dt);
82
83 out.J_pT_X_dNTdN = f_Tv * D_v * drho_wv_dT;
84 out.K_pp_X_dNTdN = D_v * drho_wv_dp;
85
86 out.vapor_flux = -(out.J_pT_X_dNTdN * T_data.grad_T -
87 out.K_pp_X_dNTdN * p_cap_data.grad_p_cap);
89 gas_phase
90 ->property(
92 .template value<double>(variables, x_t.x, x_t.t, x_t.dt);
93
94 out.M_TT_X_NTN += out.heat_capacity_vapor * rho_wv * S_g * phi;
95
97 phi * (rho_wv * dS_L_data.dS_L_dp_cap + S_g * drho_wv_dp);
98
99 out.M_pT_X_NTN += phi * S_g * drho_wv_dT;
100
101 //
102 // Latent heat term
103 //
105 {
106 double const factor = phi * S_g / rho_L_data.rho_LR;
107 // The volumetric latent heat of vaporization of liquid water
108 double const L0 =
110 .template value<double>(variables, x_t.x, x_t.t, x_t.dt) *
111 rho_L_data.rho_LR;
112
113 double const rho_wv_over_rho_L = rho_wv / rho_L_data.rho_LR;
114
115 out.M_TT_X_NTN +=
116 factor * L0 *
117 (drho_wv_dT - rho_wv_over_rho_L * rho_L_data.drho_LR_dT);
118 out.M_Tp_X_NTN =
119 (factor * L0 *
120 (drho_wv_dp - rho_wv_over_rho_L * rho_L_data.drho_LR_dp) +
121 L0 * phi * rho_wv_over_rho_L * dS_L_data.dS_L_dp_cap);
122 out.K_TT_X_dNTdN = L0 * out.J_pT_X_dNTdN / rho_L_data.rho_LR;
123 out.K_Tp_X_dNTdN = L0 * out.K_pp_X_dNTdN / rho_L_data.rho_LR;
124 }
125 }
126}
127
128template struct TRMVaporDiffusionData<2>;
129template struct TRMVaporDiffusionData<3>;
130template struct TRMVaporDiffusionModel<2>;
131template struct TRMVaporDiffusionModel<3>;
132} // namespace ProcessLib::ThermoRichardsMechanics
Property const & property(PropertyType const &p) const
Definition Phase.cpp:44
bool hasProperty(PropertyType const &p) const
Definition Phase.cpp:60
@ thermal_diffusion_enhancement_factor
Thermal diffusion enhancement factor for water vapor flow.
Eigen::Vector< double, DisplacementDim > GlobalDimVector
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