LCOV - code coverage report
Current view: top level - src/materials - PorousFlowRelativePermeabilityBW.C (source / functions) Hit Total Coverage
Test: idaholab/moose porous_flow: #31405 (292dce) with base fef103 Lines: 23 30 76.7 %
Date: 2025-09-04 07:55:56 Functions: 4 8 50.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 "PorousFlowRelativePermeabilityBW.h"
      11             : 
      12             : registerMooseObject("PorousFlowApp", PorousFlowRelativePermeabilityBW);
      13             : registerMooseObject("PorousFlowApp", ADPorousFlowRelativePermeabilityBW);
      14             : 
      15             : template <bool is_ad>
      16             : InputParameters
      17         211 : PorousFlowRelativePermeabilityBWTempl<is_ad>::validParams()
      18             : {
      19         211 :   InputParameters params = PorousFlowRelativePermeabilityBaseTempl<is_ad>::validParams();
      20         422 :   params.addRequiredRangeCheckedParam<Real>(
      21             :       "Sn",
      22             :       "Sn >= 0",
      23             :       "Low saturation.  This must be < Ss, and non-negative.  This is BW's "
      24             :       "initial effective saturation, below which effective saturation never goes "
      25             :       "in their simulations/models.  If Kn=0 then Sn is the immobile saturation.  "
      26             :       "This form of effective saturation is only correct for Kn small.");
      27         633 :   params.addRangeCheckedParam<Real>(
      28             :       "Ss",
      29         422 :       1.0,
      30             :       "Ss <= 1",
      31             :       "High saturation.  This must be > Sn and <= 1.  Effective saturation "
      32             :       "where porepressure = 0.  Effective saturation never exceeds this "
      33             :       "value in BW's simulations/models.");
      34         422 :   params.addRequiredRangeCheckedParam<Real>(
      35             :       "Kn", "Kn >= 0", "Low relative permeability.  This must be < Ks, and non-negative.");
      36         422 :   params.addRequiredRangeCheckedParam<Real>(
      37             :       "Ks", "Ks <= 1", "High relative permeability.  This must be > Kn and less than unity");
      38         422 :   params.addRequiredRangeCheckedParam<Real>(
      39             :       "C", "C > 1", "BW's C parameter.  Must be > 1.  Typical value would be 1.05.");
      40         211 :   params.addClassDescription("Broadbridge-White form of relative permeability");
      41         211 :   return params;
      42           0 : }
      43             : 
      44             : template <bool is_ad>
      45         165 : PorousFlowRelativePermeabilityBWTempl<is_ad>::PorousFlowRelativePermeabilityBWTempl(
      46             :     const InputParameters & parameters)
      47             :   : PorousFlowRelativePermeabilityBaseTempl<is_ad>(parameters),
      48         165 :     _sn(this->template getParam<Real>("Sn")),
      49         330 :     _ss(this->template getParam<Real>("Ss")),
      50         330 :     _kn(this->template getParam<Real>("Kn")),
      51         330 :     _ks(this->template getParam<Real>("Ks")),
      52         495 :     _c(this->template getParam<Real>("C"))
      53             : {
      54         165 :   if (_ss <= _sn)
      55           0 :     mooseError("In BW relative permeability Sn set to ",
      56           0 :                _sn,
      57             :                " and Ss set to ",
      58           0 :                _ss,
      59             :                " but these must obey Ss > Sn");
      60         165 :   if (_ks <= _kn)
      61           0 :     mooseError("In BW relative permeability Kn set to ",
      62           0 :                _kn,
      63             :                " and Ks set to ",
      64           0 :                _ks,
      65             :                " but these must obey Ks > Kn");
      66         165 : }
      67             : 
      68             : template <bool is_ad>
      69             : GenericReal<is_ad>
      70     2743104 : PorousFlowRelativePermeabilityBWTempl<is_ad>::relativePermeability(GenericReal<is_ad> seff) const
      71             : {
      72     2743104 :   return PorousFlowBroadbridgeWhite::relativePermeability(seff, _c, _sn, _ss, _kn, _ks);
      73             : }
      74             : 
      75             : template <bool is_ad>
      76             : Real
      77     2743104 : PorousFlowRelativePermeabilityBWTempl<is_ad>::dRelativePermeability(Real seff) const
      78             : {
      79     2743104 :   return PorousFlowBroadbridgeWhite::dRelativePermeability(seff, _c, _sn, _ss, _kn, _ks);
      80             : }
      81             : 
      82             : template class PorousFlowRelativePermeabilityBWTempl<false>;
      83             : template class PorousFlowRelativePermeabilityBWTempl<true>;

Generated by: LCOV version 1.14