LCOV - code coverage report
Current view: top level - src/materials - PorousFlowRelativePermeabilityBase.C (source / functions) Hit Total Coverage
Test: porous_flow Test Coverage Lines: 41 42 97.6 %
Date: 2017-11-18 13:30:36 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 "PorousFlowRelativePermeabilityBase.h"
       9             : 
      10             : template <>
      11             : InputParameters
      12         234 : validParams<PorousFlowRelativePermeabilityBase>()
      13             : {
      14         234 :   InputParameters params = validParams<PorousFlowMaterialBase>();
      15         936 :   params.addRangeCheckedParam<Real>(
      16         234 :       "scaling", 1.0, "scaling>=0", "Relative permeability is multiplied by this factor");
      17         936 :   params.addRangeCheckedParam<Real>(
      18             :       "s_res",
      19             :       0,
      20             :       "s_res >= 0 & s_res < 1",
      21         234 :       "The residual saturation of the phase j. Must be between 0 and 1");
      22         936 :   params.addRangeCheckedParam<Real>(
      23             :       "sum_s_res",
      24             :       0,
      25             :       "sum_s_res >= 0 & sum_s_res < 1",
      26         234 :       "Sum of residual saturations over all phases.  Must be between 0 and 1");
      27         468 :   params.addClassDescription("Base class for PorousFlow relative permeability materials");
      28         234 :   return params;
      29             : }
      30             : 
      31         702 : PorousFlowRelativePermeabilityBase::PorousFlowRelativePermeabilityBase(
      32         702 :     const InputParameters & parameters)
      33             :   : PorousFlowMaterialBase(parameters),
      34        2106 :     _scaling(getParam<Real>("scaling")),
      35         702 :     _saturation_variable_name(_dictator.saturationVariableNameDummy()),
      36         702 :     _saturation(_nodal_material
      37        2106 :                     ? getMaterialProperty<std::vector<Real>>("PorousFlow_saturation_nodal")
      38        1092 :                     : getMaterialProperty<std::vector<Real>>("PorousFlow_saturation_qp")),
      39             :     _relative_permeability(
      40        2106 :         _nodal_material ? declareProperty<Real>("PorousFlow_relative_permeability_nodal" + _phase)
      41        1092 :                         : declareProperty<Real>("PorousFlow_relative_permeability_qp" + _phase)),
      42             :     _drelative_permeability_ds(
      43         702 :         _nodal_material
      44        3120 :             ? declarePropertyDerivative<Real>("PorousFlow_relative_permeability_nodal" + _phase,
      45        2730 :                                               _saturation_variable_name)
      46        1092 :             : declarePropertyDerivative<Real>("PorousFlow_relative_permeability_qp" + _phase,
      47        1482 :                                               _saturation_variable_name)),
      48        2106 :     _s_res(getParam<Real>("s_res")),
      49        2106 :     _sum_s_res(getParam<Real>("sum_s_res")),
      50        6708 :     _dseff_ds(1.0 / (1.0 - _sum_s_res))
      51             : {
      52         702 :   if (_sum_s_res < _s_res)
      53           0 :     mooseError("Sum of residual saturations sum_s_res cannot be smaller than s_res in ", name());
      54         702 : }
      55             : 
      56             : void
      57     4762734 : PorousFlowRelativePermeabilityBase::computeQpProperties()
      58             : {
      59             :   // Effective saturation
      60     9525468 :   Real seff = effectiveSaturation(_saturation[_qp][_phase_num]);
      61             :   Real relperm, drelperm;
      62             : 
      63     4762734 :   if (seff < 0.0)
      64             :   {
      65             :     // Relative permeability is 0 for saturation less than residual
      66             :     relperm = 0.0;
      67             :     drelperm = 0.0;
      68             :   }
      69     4759672 :   else if (seff >= 0.0 && seff <= 1)
      70             :   {
      71     4757138 :     relperm = relativePermeability(seff);
      72     4757138 :     drelperm = dRelativePermeability(seff);
      73             :   }
      74             :   else // seff > 1
      75             :   {
      76             :     // Relative permeability is 1 when fully saturated
      77             :     relperm = 1.0;
      78             :     drelperm = 0.0;
      79             :   }
      80             : 
      81     9525468 :   _relative_permeability[_qp] = relperm * _scaling;
      82     9525468 :   _drelative_permeability_ds[_qp] = drelperm * _dseff_ds * _scaling;
      83     4762734 : }
      84             : 
      85             : Real
      86     4762734 : PorousFlowRelativePermeabilityBase::effectiveSaturation(Real saturation) const
      87             : {
      88     4762734 :   return (saturation - _s_res) / (1.0 - _sum_s_res);
      89        2499 : }

Generated by: LCOV version 1.11