LCOV - code coverage report
Current view: top level - src/userobjects - PorousFlowCapillaryPressureVG.C (source / functions) Hit Total Coverage
Test: idaholab/moose porous_flow: #31405 (292dce) with base fef103 Lines: 34 35 97.1 %
Date: 2025-09-04 07:55:56 Functions: 8 8 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 "PorousFlowCapillaryPressureVG.h"
      11             : #include "PorousFlowVanGenuchten.h"
      12             : 
      13             : registerMooseObject("PorousFlowApp", PorousFlowCapillaryPressureVG);
      14             : 
      15             : InputParameters
      16        7420 : PorousFlowCapillaryPressureVG::validParams()
      17             : {
      18        7420 :   InputParameters params = PorousFlowCapillaryPressure::validParams();
      19       14840 :   params.addRequiredRangeCheckedParam<Real>(
      20             :       "m",
      21             :       "m >= 0 & m <= 1",
      22             :       "van Genuchten exponent m. Must be between 0 and 1, and optimally should be set to >0.5");
      23       14840 :   params.addRequiredRangeCheckedParam<Real>(
      24             :       "alpha", "alpha > 0", "van Genuchten parameter alpha. Must be positive");
      25       22260 :   params.addRangeCheckedParam<Real>("s_scale",
      26       14840 :                                     1.0,
      27             :                                     "s_scale > 0.0 & s_scale <= 1.0",
      28             :                                     "CapillaryPressure = f(Seff * s_scale) - "
      29             :                                     "f(s_scale), where f is the van Genuchten "
      30             :                                     "expression.  Setting s_scale<1 is unusual "
      31             :                                     "but sometimes helps fully saturated, "
      32             :                                     "2-phase PP simulations converge as the "
      33             :                                     "zero derivative (1/f'(S=1)=0) is removed");
      34        7420 :   params.addClassDescription("van Genuchten capillary pressure");
      35        7420 :   return params;
      36           0 : }
      37             : 
      38        4066 : PorousFlowCapillaryPressureVG::PorousFlowCapillaryPressureVG(const InputParameters & parameters)
      39             :   : PorousFlowCapillaryPressure(parameters),
      40        4066 :     _m(getParam<Real>("m")),
      41        8132 :     _alpha(getParam<Real>("alpha")),
      42        8132 :     _s_scale(getParam<Real>("s_scale")),
      43        8132 :     _pc_sscale(PorousFlowVanGenuchten::capillaryPressure(_s_scale, _alpha, _m, _pc_max))
      44             : {
      45        4066 : }
      46             : 
      47             : Real
      48      764262 : PorousFlowCapillaryPressureVG::capillaryPressureCurve(Real saturation, unsigned /*qp*/) const
      49             : {
      50      764262 :   const Real seff = effectiveSaturationFromSaturation(saturation) * _s_scale;
      51      764262 :   return PorousFlowVanGenuchten::capillaryPressure(seff, _alpha, _m, _pc_max) - _pc_sscale;
      52             : }
      53             : 
      54             : Real
      55      796920 : PorousFlowCapillaryPressureVG::dCapillaryPressureCurve(Real saturation, unsigned /*qp*/) const
      56             : {
      57      796920 :   const Real seff = effectiveSaturationFromSaturation(saturation) * _s_scale;
      58      796920 :   return PorousFlowVanGenuchten::dCapillaryPressure(seff, _alpha, _m, _pc_max) * _dseff_ds *
      59      796920 :          _s_scale;
      60             : }
      61             : 
      62             : Real
      63      404438 : PorousFlowCapillaryPressureVG::d2CapillaryPressureCurve(Real saturation, unsigned /*qp*/) const
      64             : {
      65      404438 :   const Real seff = effectiveSaturationFromSaturation(saturation) * _s_scale;
      66      404438 :   return PorousFlowVanGenuchten::d2CapillaryPressure(seff, _alpha, _m, _pc_max) * _dseff_ds *
      67      404438 :          _dseff_ds * _s_scale * _s_scale;
      68             : }
      69             : 
      70             : Real
      71    37083797 : PorousFlowCapillaryPressureVG::effectiveSaturation(Real pc, unsigned /*qp*/) const
      72             : {
      73    37083797 :   return (1.0 / _s_scale) *
      74    37083797 :          PorousFlowVanGenuchten::effectiveSaturation(pc - _pc_sscale, _alpha, _m);
      75             : }
      76             : 
      77             : Real
      78    36359957 : PorousFlowCapillaryPressureVG::dEffectiveSaturation(Real pc, unsigned /*qp*/) const
      79             : {
      80    36359957 :   return (1.0 / _s_scale) *
      81    36359957 :          PorousFlowVanGenuchten::dEffectiveSaturation(pc - _pc_sscale, _alpha, _m);
      82             : }
      83             : 
      84             : Real
      85    17995940 : PorousFlowCapillaryPressureVG::d2EffectiveSaturation(Real pc, unsigned /*qp*/) const
      86             : {
      87    17995940 :   return (1.0 / _s_scale) *
      88    17995940 :          PorousFlowVanGenuchten::d2EffectiveSaturation(pc - _pc_sscale, _alpha, _m);
      89             : }

Generated by: LCOV version 1.14