https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PorousFlowRelativePermeabilityVG.C
Go to the documentation of this file.
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
11#include "libmesh/utility.h"
12
15
16template <bool is_ad>
19{
22 "m", "m > 0 & m < 1", "The van Genuchten exponent of the phase");
23 params.addRangeCheckedParam<Real>("seff_turnover",
24 1.0,
25 "seff_turnover > 0 & seff_turnover <= 1",
26 "The relative permeability will be a cubic for seff > "
27 "seff_turnover. The cubic is chosen so that its derivative "
28 "and value matche the VG function at seff=seff_turnover");
29 params.addParam<bool>("zero_derivative",
30 false,
31 "Employ a cubic for seff>seff_turnover that has zero derivative at seff=1");
32 params.addParam<bool>("wetting",
33 true,
34 "If true, use the van Genuchten form appropriate for a wetting (liquid) "
35 "phase. If false, use the non-wetting (gas) expression.");
36 params.addClassDescription("This Material calculates relative permeability of a phase "
37 "using the van Genuchten model");
38 return params;
39}
40
41template <bool is_ad>
43 const InputParameters & parameters)
44 : PorousFlowRelativePermeabilityBaseTempl<is_ad>(parameters),
45 _m(this->template getParam<Real>("m")),
46 _wetting(this->template getParam<bool>("wetting")),
47 _cut(this->template getParam<Real>("seff_turnover")),
48 _cub0(_wetting ? PorousFlowVanGenuchten::relativePermeability(_cut, _m)
49 : PorousFlowVanGenuchten::relativePermeabilityNW(_cut, _m)),
50 _cub1(_wetting ? PorousFlowVanGenuchten::dRelativePermeability(_cut, _m)
51 : PorousFlowVanGenuchten::dRelativePermeabilityNW(_cut, _m)),
52 _cub2(_cut < 1.0
53 ? (this->template getParam<bool>("zero_derivative")
54 ? 3.0 * (1.0 - _cub0 - _cub1 * (1.0 - _cut)) / Utility::pow<2>(1.0 - _cut) +
55 _cub1 / (1.0 - _cut)
56 : (_wetting ? PorousFlowVanGenuchten::d2RelativePermeability(_cut, _m)
57 : PorousFlowVanGenuchten::d2RelativePermeabilityNW(_cut, _m)))
58 : 0.0),
59 _cub3(_cut < 1.0
60 ? (this->template getParam<bool>("zero_derivative")
61 ? -2.0 * (1.0 - _cub0 - _cub1 * (1.0 - _cut)) / Utility::pow<3>(1.0 - _cut) -
62 _cub1 / Utility::pow<2>(1.0 - _cut)
63 : (1.0 - _cub0 - _cub1 * (1.0 - _cut) - _cub2 * Utility::pow<2>(1.0 - _cut)) /
64 Utility::pow<3>(1.0 - _cut))
65 : 0.0)
66{
67}
68
69template <bool is_ad>
72{
73 if (MetaPhysicL::raw_value(seff) < _cut)
74 {
75 if (_wetting)
77 else
79 }
80
81 return _cub0 + _cub1 * (seff - _cut) + _cub2 * Utility::pow<2>(seff - _cut) +
82 _cub3 * Utility::pow<3>(seff - _cut);
83}
84
85template <bool is_ad>
86Real
88{
89 if (seff < _cut)
90 {
91 if (_wetting)
93 else
95 }
96
97 return _cub1 + 2.0 * _cub2 * (seff - _cut) + 3.0 * _cub3 * Utility::pow<2>(seff - _cut);
98}
99
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
Moose::GenericType< Real, is_ad > GenericReal
registerMooseObject("PorousFlowApp", PorousFlowRelativePermeabilityVG)
void addRequiredRangeCheckedParam(const std::string &name, const std::string &parsed_function, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
void addRangeCheckedParam(const std::string &name, const T &value, const std::string &parsed_function, const std::string &doc_string)
Base class for PorousFlow relative permeability materials.
Material to calculate van Genuchten-type relative permeability of an arbitrary phase given the satura...
PorousFlowRelativePermeabilityVGTempl(const InputParameters &parameters)
virtual Real dRelativePermeability(Real seff) const override
Derivative of relative permeability with respect to effective saturation.
virtual GenericReal< is_ad > relativePermeability(GenericReal< is_ad > seff) const override
Relative permeability equation (must be overriden in derived class)
auto raw_value(const Eigen::Map< T > &in)
van Genuchten effective saturation, capillary pressure and relative permeability functions.
T relativePermeabilityNW(const T &seff, Real m)
Relative permeability for a non-wetting phase as a function of effective saturation.
Real dRelativePermeability(Real seff, Real m)
Derivative of relative permeability with respect to effective saturation.
T relativePermeability(const T &seff, Real m)
Relative permeability as a function of effective saturation.
Real dRelativePermeabilityNW(Real seff, Real m)
Derivative of relative permeability for a non-wetting phase with respect to effective saturation.