LCOV - code coverage report
Current view: top level - src/materials - PorousFlowRelativePermeabilityVG.C (source / functions) Hit Total Coverage
Test: porous_flow Test Coverage Lines: 37 39 94.9 %
Date: 2017-11-20 14:50:56 Functions: 6 6 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /****************************************************************/
       2             : /* MOOSE - Multiphysics Object Oriented Simulation Environment  */
       3             : /*                                                              */
       4             : /*          All contents are licensed under LGPL V2.1           */
       5             : /*             See LICENSE for full restrictions                */
       6             : /****************************************************************/
       7             : 
       8             : #include "PorousFlowRelativePermeabilityVG.h"
       9             : #include "libmesh/utility.h"
      10             : 
      11             : template <>
      12             : InputParameters
      13          11 : validParams<PorousFlowRelativePermeabilityVG>()
      14             : {
      15          11 :   InputParameters params = validParams<PorousFlowRelativePermeabilityBase>();
      16          44 :   params.addRequiredRangeCheckedParam<Real>(
      17          11 :       "m", "m > 0 & m < 1", "The van Genuchten exponent of the phase");
      18          44 :   params.addRangeCheckedParam<Real>("seff_turnover",
      19             :                                     1.0,
      20             :                                     "seff_turnover > 0 & seff_turnover <= 1",
      21             :                                     "The relative permeability will be a cubic for seff > "
      22             :                                     "seff_turnover.  The cubic is chosen so that its derivative "
      23          11 :                                     "and value matche the VG function at seff=seff_turnover");
      24          33 :   params.addParam<bool>("zero_derivative",
      25             :                         false,
      26          11 :                         "Employ a cubic for seff>seff_turnover that has zero derivative at seff=1");
      27          22 :   params.addClassDescription(
      28          11 :       "This Material calculates relative permeability of a phase using the van Genuchten model");
      29          11 :   return params;
      30             : }
      31             : 
      32          33 : PorousFlowRelativePermeabilityVG::PorousFlowRelativePermeabilityVG(
      33          33 :     const InputParameters & parameters)
      34             :   : PorousFlowRelativePermeabilityBase(parameters),
      35          99 :     _m(getParam<Real>("m")),
      36          99 :     _cut(getParam<Real>("seff_turnover")),
      37          33 :     _cub0(PorousFlowVanGenuchten::relativePermeability(_cut, _m)),
      38          33 :     _cub1(PorousFlowVanGenuchten::dRelativePermeability(_cut, _m)),
      39          33 :     _cub2(_cut < 1.0
      40          78 :               ? (getParam<bool>("zero_derivative")
      41          12 :                      ? 3.0 * (1.0 - _cub0 - _cub1 * (1.0 - _cut)) / Utility::pow<2>(1.0 - _cut) +
      42           0 :                            _cub1 / (1.0 - _cut)
      43           6 :                      : PorousFlowVanGenuchten::d2RelativePermeability(_cut, _m))
      44             :               : 0.0),
      45          33 :     _cub3(_cut < 1.0
      46          78 :               ? (getParam<bool>("zero_derivative")
      47          12 :                      ? -2.0 * (1.0 - _cub0 - _cub1 * (1.0 - _cut)) / Utility::pow<3>(1.0 - _cut) -
      48           0 :                            _cub1 / Utility::pow<2>(1.0 - _cut)
      49          12 :                      : (1.0 - _cub0 - _cub1 * (1.0 - _cut) - _cub2 * Utility::pow<2>(1.0 - _cut)) /
      50             :                            Utility::pow<3>(1.0 - _cut))
      51         231 :               : 0.0)
      52             : {
      53          33 : }
      54             : 
      55             : Real
      56       97312 : PorousFlowRelativePermeabilityVG::relativePermeability(Real seff) const
      57             : {
      58       97312 :   if (seff < _cut)
      59       96104 :     return PorousFlowVanGenuchten::relativePermeability(seff, _m);
      60             : 
      61        2416 :   return _cub0 + _cub1 * (seff - _cut) + _cub2 * Utility::pow<2>(seff - _cut) +
      62        2416 :          _cub3 * Utility::pow<3>(seff - _cut);
      63             : }
      64             : 
      65             : Real
      66       97312 : PorousFlowRelativePermeabilityVG::dRelativePermeability(Real seff) const
      67             : {
      68       97312 :   if (seff < _cut)
      69       96104 :     return PorousFlowVanGenuchten::dRelativePermeability(seff, _m);
      70             : 
      71        2416 :   return _cub1 + 2.0 * _cub2 * (seff - _cut) + 3.0 * _cub3 * Utility::pow<2>(seff - _cut);
      72        2499 : }

Generated by: LCOV version 1.11