LCOV - code coverage report
Current view: top level - src/materials - PorousFlowHystereticRelativePermeabilityGas.C (source / functions) Hit Total Coverage
Test: idaholab/moose porous_flow: #31405 (292dce) with base fef103 Lines: 46 46 100.0 %
Date: 2025-09-04 07:55:56 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of the MOOSE framework
       2             : //* https://mooseframework.inl.gov
       3             : //*
       4             : //* All rights reserved, see COPYRIGHT for full restrictions
       5             : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
       6             : //*
       7             : //* Licensed under LGPL 2.1, please see LICENSE for details
       8             : //* https://www.gnu.org/licenses/lgpl-2.1.html
       9             : 
      10             : #include "PorousFlowHystereticRelativePermeabilityGas.h"
      11             : #include "PorousFlowVanGenuchten.h"
      12             : 
      13             : registerMooseObject("PorousFlowApp", PorousFlowHystereticRelativePermeabilityGas);
      14             : 
      15             : InputParameters
      16         362 : PorousFlowHystereticRelativePermeabilityGas::validParams()
      17             : {
      18         362 :   InputParameters params = PorousFlowHystereticRelativePermeabilityBase::validParams();
      19        1086 :   params.addRangeCheckedParam<Real>(
      20         724 :       "gamma", 0.33, "gamma > 0", "Gamma parameter that is used for the gas relative permeability");
      21        1086 :   params.addRangeCheckedParam<Real>(
      22             :       "k_rg_max",
      23         724 :       1.0,
      24             :       "k_rg_max > 0 & k_rg_max <= 1",
      25             :       "Value of the gas relative permeability at liquid saturation = S_lr");
      26         724 :   MooseEnum low_ext_enum("linear_like cubic", "linear_like");
      27         724 :   params.addParam<MooseEnum>(
      28             :       "gas_low_extension_type",
      29             :       low_ext_enum,
      30             :       "Type of extension to use for liquid saturation < S_lr for the gas relative permeability.  "
      31             :       "All extensions employ a cubic whose value is 1.0 at liquid saturation = 0, and whose "
      32             :       "derivative is zero at liquid saturation = 0, and whose value is k_rg_max at liquid "
      33             :       "saturation = S_lr.  linear_like: the derivative at liquid_saturation = S_lr is equal to "
      34             :       "(k_rg_max - 1) / S_lr.  cubic: the derivative at liquid_saturation = S_lr equals the "
      35             :       "derivative of the unextended drying curve at that point");
      36         362 :   params.addClassDescription(
      37             :       "PorousFlow material that computes relative permeability of the gas phase in 1-phase or "
      38             :       "2-phase models that include hysteresis.  You should ensure that the 'phase' for this "
      39             :       "Material does indeed represent the gas phase");
      40         362 :   return params;
      41         362 : }
      42             : 
      43         282 : PorousFlowHystereticRelativePermeabilityGas::PorousFlowHystereticRelativePermeabilityGas(
      44         282 :     const InputParameters & parameters)
      45             :   : PorousFlowHystereticRelativePermeabilityBase(parameters),
      46         564 :     _liquid_phase(_phase_num == 0 ? 1 : 0),
      47         564 :     _gamma(getParam<Real>("gamma")),
      48         564 :     _k_rg_max(getParam<Real>("k_rg_max")),
      49         846 :     _krel_gas_prime((getParam<MooseEnum>("gas_low_extension_type") == "linear_like")
      50         282 :                         ? ((_s_lr > 0) ? (_k_rg_max - 1.0) / _s_lr : 0.0)
      51          66 :                         : PorousFlowVanGenuchten::drelativePermeabilityNWHys(
      52         348 :                               _s_lr, _s_lr, 0.0, _s_gr_max, 1.0, _m, _gamma, _k_rg_max, 0.0))
      53             : {
      54         282 : }
      55             : 
      56             : void
      57       23752 : PorousFlowHystereticRelativePermeabilityGas::computeRelPermQp()
      58             : {
      59       23752 :   const Real sl = _saturation[_qp][_liquid_phase];
      60             : 
      61       23752 :   if (_hys_order[_qp] == 0)
      62             :   {
      63       12818 :     _relative_permeability[_qp] = PorousFlowVanGenuchten::relativePermeabilityNWHys(
      64       12818 :         sl, _s_lr, 0.0, _s_gr_max, 1.0, _m, _gamma, _k_rg_max, _krel_gas_prime);
      65             :     // negative in the following from d(liquid_saturation)/d(gas_saturation)
      66       12818 :     _drelative_permeability_ds[_qp] = -PorousFlowVanGenuchten::drelativePermeabilityNWHys(
      67       12818 :         sl, _s_lr, 0.0, _s_gr_max, 1.0, _m, _gamma, _k_rg_max, _krel_gas_prime);
      68             :   }
      69             :   else
      70             :   {
      71             :     // following ternary deals with the case where the turning-point saturation occurs in the
      72             :     // low-saturation region (tp_sat < _s_lr).  There is "no hysteresis along the extension"
      73             :     // according to Doughty2008, so assume that the wetting curve is the same as would occur if
      74             :     // the turning-point saturation occured at _s_lr
      75             :     const Real effective_liquid_tp =
      76       10934 :         (_hys_sat_tps[_qp].at(0) < _s_lr) ? _s_lr : _hys_sat_tps[_qp].at(0);
      77       10934 :     const Real s_gas_max = (_hys_sat_tps[_qp].at(0) < _s_lr) ? _s_gr_max : _s_gr_tp0[_qp];
      78       10934 :     _relative_permeability[_qp] =
      79       10934 :         PorousFlowVanGenuchten::relativePermeabilityNWHys(sl,
      80             :                                                           _s_lr,
      81             :                                                           s_gas_max,
      82       10934 :                                                           _s_gr_max,
      83             :                                                           effective_liquid_tp,
      84       10934 :                                                           _m,
      85       10934 :                                                           _gamma,
      86       10934 :                                                           _k_rg_max,
      87       10934 :                                                           _krel_gas_prime);
      88             :     // negative in the following from d(liquid_saturation)/d(gas_saturation)
      89       10934 :     _drelative_permeability_ds[_qp] =
      90       10934 :         -PorousFlowVanGenuchten::drelativePermeabilityNWHys(sl,
      91       10934 :                                                             _s_lr,
      92             :                                                             s_gas_max,
      93       10934 :                                                             _s_gr_max,
      94             :                                                             effective_liquid_tp,
      95       10934 :                                                             _m,
      96       10934 :                                                             _gamma,
      97       10934 :                                                             _k_rg_max,
      98       10934 :                                                             _krel_gas_prime);
      99             :   }
     100       23752 : }

Generated by: LCOV version 1.14