OGS
TRMVaporDiffusion.cpp
Go to the documentation of this file.
1
11#include "TRMVaporDiffusion.h"
12
14{
15template <int DisplacementDim>
17{
18 heat_capacity_vapor = 0;
19 vapor_flux = GlobalDimVector<DisplacementDim>::Zero(DisplacementDim);
20 storage_coefficient_by_water_vapor = 0;
21
22 J_pT_X_dNTdN = 0;
23 K_pp_X_dNTdN = 0;
24 K_TT_X_dNTdN = 0;
25 K_Tp_X_dNTdN = 0;
26 M_Tp_X_NTN = 0;
27 M_TT_X_NTN = 0;
28 M_pT_X_NTN = 0;
29}
30
31template <int DisplacementDim>
33 SpaceTimeData const& x_t, MediaData const& media_data,
34 LiquidDensityData const& rho_L_data, SaturationData const& S_L_data,
35 SaturationDataDeriv const& dS_L_data, PorosityData const& poro_data,
39{
40 namespace MPL = MaterialPropertyLib;
41 MPL::VariableArray variables;
42 variables.temperature = T_data.T;
43 variables.liquid_phase_pressure = -p_cap_data.p_cap;
44 // setting pG to 1 atm
45 // TODO : rewrite equations s.t. p_L = pG-p_cap
46 variables.gas_phase_pressure = 1.0e5;
47 variables.density = rho_L_data.rho_LR;
48 variables.liquid_saturation = S_L_data.S_L;
49
50 auto const& medium = media_data.medium;
51
52 MPL::Phase const* gas_phase =
53 medium.hasPhase("Gas") ? &medium.phase("Gas") : nullptr;
54
55 out.setZero();
56
57 if (gas_phase && S_L_data.S_L < 1.0)
58 {
59 double const rho_wv =
61 .template value<double>(variables, x_t.x, x_t.t, x_t.dt);
62
63 double const drho_wv_dT =
65 .template dValue<double>(variables, MPL::Variable::temperature,
66 x_t.x, x_t.t, x_t.dt);
67 double const drho_wv_dp =
69 .template dValue<double>(variables,
70 MPL::Variable::liquid_phase_pressure,
71 x_t.x, x_t.t, x_t.dt);
72 auto const f_Tv =
73 gas_phase
74 ->property(
75 MPL::PropertyType::thermal_diffusion_enhancement_factor)
76 .template value<double>(variables, x_t.x, x_t.t, x_t.dt);
77
78 double const phi = poro_data.phi;
79 variables.porosity = phi;
80
81 double const S_g = 1.0 - S_L_data.S_L;
82 double const tortuosity =
83 medium.property(MPL::PropertyType::tortuosity)
84 .template value<double>(variables, x_t.x, x_t.t, x_t.dt);
85 double const D_v =
86 phi * S_g * tortuosity *
87 gas_phase->property(MPL::PropertyType::diffusion)
88 .template value<double>(variables, x_t.x, x_t.t, x_t.dt);
89
90 out.J_pT_X_dNTdN = f_Tv * D_v * drho_wv_dT;
91 out.K_pp_X_dNTdN = D_v * drho_wv_dp;
92
93 out.vapor_flux = -(out.J_pT_X_dNTdN * T_data.grad_T -
94 out.K_pp_X_dNTdN * p_cap_data.grad_p_cap);
96 gas_phase
97 ->property(
99 .template value<double>(variables, x_t.x, x_t.t, x_t.dt);
100
101 out.M_TT_X_NTN += out.heat_capacity_vapor * rho_wv * S_g * phi;
102
104 phi * (rho_wv * dS_L_data.dS_L_dp_cap + S_g * drho_wv_dp);
105
106 out.M_pT_X_NTN += phi * S_g * drho_wv_dT;
107
108 //
109 // Latent heat term
110 //
111 if (gas_phase->hasProperty(MPL::PropertyType::specific_latent_heat))
112 {
113 double const factor = phi * S_g / rho_L_data.rho_LR;
114 // The volumetric latent heat of vaporization of liquid water
115 double const L0 =
116 gas_phase->property(MPL::PropertyType::specific_latent_heat)
117 .template value<double>(variables, x_t.x, x_t.t, x_t.dt) *
118 rho_L_data.rho_LR;
119
120 double const rho_wv_over_rho_L = rho_wv / rho_L_data.rho_LR;
121
122 out.M_TT_X_NTN +=
123 factor * L0 *
124 (drho_wv_dT - rho_wv_over_rho_L * rho_L_data.drho_LR_dT);
125 out.M_Tp_X_NTN =
126 (factor * L0 *
127 (drho_wv_dp - rho_wv_over_rho_L * rho_L_data.drho_LR_dp) +
128 L0 * phi * rho_wv_over_rho_L * dS_L_data.dS_L_dp_cap);
129 out.K_TT_X_dNTdN = L0 * out.J_pT_X_dNTdN / rho_L_data.rho_LR;
130 out.K_Tp_X_dNTdN = L0 * out.K_pp_X_dNTdN / rho_L_data.rho_LR;
131 }
132 }
133}
134
135template struct TRMVaporDiffusionData<2>;
136template struct TRMVaporDiffusionData<3>;
137template struct TRMVaporDiffusionModel<2>;
138template struct TRMVaporDiffusionModel<3>;
139} // namespace ProcessLib::ThermoRichardsMechanics
Property const & property(PropertyType const &p) const
Definition Phase.cpp:53
bool hasProperty(PropertyType const &p) const
Definition Phase.cpp:69
Eigen::Vector< double, DisplacementDim > GlobalDimVector
Definition Base.h:32
ParameterLib::SpatialPosition x
Definition Base.h:74
Eigen::Vector< double, DisplacementDim > grad_p_cap
Definition Base.h:79
MaterialPropertyLib::Medium const & medium
Definition Base.h:61
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
Definition Base.h:71