www.mooseframework.org
PorousFlowRelativePermeabilityBase.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 
11 
12 template <>
13 InputParameters
15 {
16  InputParameters params = validParams<PorousFlowMaterialBase>();
17  params.addRangeCheckedParam<Real>(
18  "scaling", 1.0, "scaling>=0", "Relative permeability is multiplied by this factor");
19  params.addRangeCheckedParam<Real>(
20  "s_res",
21  0,
22  "s_res >= 0 & s_res < 1",
23  "The residual saturation of the phase j. Must be between 0 and 1");
24  params.addRangeCheckedParam<Real>(
25  "sum_s_res",
26  0,
27  "sum_s_res >= 0 & sum_s_res < 1",
28  "Sum of residual saturations over all phases. Must be between 0 and 1");
29  params.addPrivateParam<std::string>("pf_material_type", "relative_permeability");
30  params.addClassDescription("Base class for PorousFlow relative permeability materials");
31  return params;
32 }
33 
35  const InputParameters & parameters)
36  : PorousFlowMaterialBase(parameters),
37  _scaling(getParam<Real>("scaling")),
38  _saturation(_nodal_material
39  ? getMaterialProperty<std::vector<Real>>("PorousFlow_saturation_nodal")
40  : getMaterialProperty<std::vector<Real>>("PorousFlow_saturation_qp")),
41  _relative_permeability(
42  _nodal_material ? declareProperty<Real>("PorousFlow_relative_permeability_nodal" + _phase)
43  : declareProperty<Real>("PorousFlow_relative_permeability_qp" + _phase)),
44  _drelative_permeability_ds(
45  _nodal_material
46  ? declarePropertyDerivative<Real>("PorousFlow_relative_permeability_nodal" + _phase,
47  _saturation_variable_name)
48  : declarePropertyDerivative<Real>("PorousFlow_relative_permeability_qp" + _phase,
49  _saturation_variable_name)),
50  _s_res(getParam<Real>("s_res")),
51  _sum_s_res(getParam<Real>("sum_s_res")),
52  _dseff_ds(1.0 / (1.0 - _sum_s_res))
53 {
54  if (_sum_s_res < _s_res)
55  mooseError("Sum of residual saturations sum_s_res cannot be smaller than s_res in ", name());
56 }
57 
58 void
60 {
61  // Effective saturation
62  Real seff = effectiveSaturation(_saturation[_qp][_phase_num]);
63  Real relperm, drelperm;
64 
65  if (seff < 0.0)
66  {
67  // Relative permeability is 0 for saturation less than residual
68  relperm = 0.0;
69  drelperm = 0.0;
70  }
71  else if (seff >= 0.0 && seff <= 1)
72  {
73  relperm = relativePermeability(seff);
74  drelperm = dRelativePermeability(seff);
75  }
76  else // seff > 1
77  {
78  // Relative permeability is 1 when fully saturated
79  relperm = 1.0;
80  drelperm = 0.0;
81  }
82 
83  _relative_permeability[_qp] = relperm * _scaling;
84  _drelative_permeability_ds[_qp] = drelperm * _dseff_ds * _scaling;
85 }
86 
87 Real
89 {
90  return (saturation - _s_res) / (1.0 - _sum_s_res);
91 }
PorousFlowRelativePermeabilityBase::relativePermeability
virtual Real relativePermeability(Real seff) const =0
Relative permeability equation (must be overriden in derived class)
validParams< PorousFlowRelativePermeabilityBase >
InputParameters validParams< PorousFlowRelativePermeabilityBase >()
Definition: PorousFlowRelativePermeabilityBase.C:14
PorousFlowRelativePermeabilityBase::_s_res
const Real _s_res
Residual saturation of specified phase.
Definition: PorousFlowRelativePermeabilityBase.h:66
PorousFlowRelativePermeabilityBase.h
PorousFlowRelativePermeabilityBase::_drelative_permeability_ds
MaterialProperty< Real > & _drelative_permeability_ds
Derivative of relative permeability wrt phase saturation.
Definition: PorousFlowRelativePermeabilityBase.h:63
PorousFlowRelativePermeabilityBase::dRelativePermeability
virtual Real dRelativePermeability(Real seff) const =0
Derivative of relative permeability with respect to effective saturation.
validParams< PorousFlowMaterialBase >
InputParameters validParams< PorousFlowMaterialBase >()
Definition: PorousFlowMaterialBase.C:15
PorousFlowRelativePermeabilityBase::_sum_s_res
const Real _sum_s_res
Sum of residual saturations over all phases.
Definition: PorousFlowRelativePermeabilityBase.h:69
PorousFlowRelativePermeabilityBase::computeQpProperties
virtual void computeQpProperties() override
Definition: PorousFlowRelativePermeabilityBase.C:59
PorousFlowRelativePermeabilityBase::_dseff_ds
const Real _dseff_ds
Derivative of effective saturation with respect to saturation.
Definition: PorousFlowRelativePermeabilityBase.h:72
PorousFlowRelativePermeabilityBase::PorousFlowRelativePermeabilityBase
PorousFlowRelativePermeabilityBase(const InputParameters &parameters)
Definition: PorousFlowRelativePermeabilityBase.C:34
name
const std::string name
Definition: Setup.h:21
PorousFlowRelativePermeabilityBase::_saturation
const MaterialProperty< std::vector< Real > > & _saturation
Saturation material property.
Definition: PorousFlowRelativePermeabilityBase.h:57
PorousFlowRelativePermeabilityBase::_scaling
const Real _scaling
Relative permeability is multiplied by this quantity.
Definition: PorousFlowRelativePermeabilityBase.h:54
PorousFlowRelativePermeabilityBase::_relative_permeability
MaterialProperty< Real > & _relative_permeability
Relative permeability material property.
Definition: PorousFlowRelativePermeabilityBase.h:60
PorousFlowMaterialBase::_phase_num
const unsigned int _phase_num
Phase number of fluid.
Definition: PorousFlowMaterialBase.h:34
PorousFlowRelativePermeabilityBase::effectiveSaturation
virtual Real effectiveSaturation(Real saturation) const
Effective saturation of fluid phase.
Definition: PorousFlowRelativePermeabilityBase.C:88
PorousFlowMaterialBase
Base class for all PorousFlow materials that provide phase-dependent properties.
Definition: PorousFlowMaterialBase.h:27