https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PorousFlowHystereticRelativePermeabilityBase.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
14{
16 params.addRangeCheckedParam<Real>(
17 "S_lr",
18 0.0,
19 "S_lr >= 0 & S_lr < 1",
20 "Liquid residual saturation. At liquid saturation = S_lr, the liquid relative permeability "
21 "is zero and the gas relative permeability is k_rg_max. Almost definitely you need to set "
22 "S_lr equal to the quantity used for your hysteretic capillary-pressure curve, if you are "
23 "using one.");
25 "S_gr_max",
26 "S_gr_max >= 0 & S_gr_max < 1",
27 "Residual gas saturation. For liquid saturation = 1 - S_gr_max, the gas wetting "
28 "relative-permeability is zero, if the turning point was <= S_lr. 1 - S_gr_max is the "
29 "maximum liquid saturation for which the van Genuchten expression is valid for the liquid "
30 "relative-permeability wetting curve. You must ensure S_gr_max < 1 - S_lr. Often S_gr_max "
31 "= -0.3136 * ln(porosity) - 0.1334 is used");
33 "m", "m > 0 & m < 1", "van Genuchten m parameter. Suggested value is around 0.9");
34 params.addPrivateParam<std::string>("pf_material_type", "relative_permeability");
35 params.addPrivateParam<bool>("is_ad", false);
36 params.addClassDescription("PorousFlow material that computes relative permeability for 1-phase "
37 "or 2-phase models that include hysteresis");
38 return params;
39}
40
42 const InputParameters & parameters)
43 : PorousFlowMaterialBase(parameters),
44 _s_lr(getParam<Real>("S_lr")),
45 _s_gr_max(getParam<Real>("S_gr_max")),
46 _m(getParam<Real>("m")),
47 _saturation(_nodal_material
48 ? getMaterialProperty<std::vector<Real>>("PorousFlow_saturation_nodal")
49 : getMaterialProperty<std::vector<Real>>("PorousFlow_saturation_qp")),
50 _hys_order(_nodal_material ? getMaterialProperty<unsigned>("PorousFlow_hysteresis_order_nodal")
51 : getMaterialProperty<unsigned>("PorousFlow_hysteresis_order_qp")),
52 _hys_order_old(_nodal_material
53 ? getMaterialPropertyOld<unsigned>("PorousFlow_hysteresis_order_nodal")
54 : getMaterialPropertyOld<unsigned>("PorousFlow_hysteresis_order_qp")),
55 _hys_sat_tps(
56 _nodal_material
57 ? getMaterialProperty<std::array<Real, PorousFlowConstants::MAX_HYSTERESIS_ORDER>>(
58 "PorousFlow_hysteresis_saturation_tps_nodal")
59 : getMaterialProperty<std::array<Real, PorousFlowConstants::MAX_HYSTERESIS_ORDER>>(
60 "PorousFlow_hysteresis_saturation_tps_qp")),
61 _relative_permeability(
62 _nodal_material ? declareProperty<Real>("PorousFlow_relative_permeability_nodal" + _phase)
63 : declareProperty<Real>("PorousFlow_relative_permeability_qp" + _phase)),
64 _drelative_permeability_ds(
65 _nodal_material
66 ? declarePropertyDerivative<Real>("PorousFlow_relative_permeability_nodal" + _phase,
67 _saturation_variable_name)
68 : declarePropertyDerivative<Real>("PorousFlow_relative_permeability_qp" + _phase,
69 _saturation_variable_name)),
70 _s_gr_tp0(_nodal_material
71 ? declareProperty<Real>("PorousFlow_hysteresis_s_gr_tp0_nodal" + _phase)
72 : declareProperty<Real>("PorousFlow_hysteresis_s_gr_tp0_qp" + _phase))
73{
74 mooseAssert(_dictator.numPhases() <= 2,
75 "PorousFlowHystereticRelativePermeability Materials can only be used for "
76 "1-phase or 2-phase models. The Dictator proclaims that the number of phases "
77 "exceeds 2, and dictators are never incorrect.");
78 if (_s_gr_max >= 1 - _s_lr)
79 paramError("S_gr_max", "Must be less than 1 - S_lr");
80}
81
82void
84{
85 PorousFlowMaterialBase::initQpStatefulProperties();
86 if (_hys_order[_qp] >= 1)
88
90}
91
92void
94{
95 PorousFlowMaterialBase::computeQpProperties();
96
97 if (_hys_order[_qp] != _hys_order_old[_qp] && _hys_order[_qp] == 1)
99
101}
102
103Real
105{
106 const Real a = 1.0 / _s_gr_max - 1.0 / (1.0 - _s_lr);
107 return (1.0 - slDel) / (1.0 + a * (1.0 - slDel));
108}
109
110void
112{
113 // s_gr_tp0 is the Land expression as a function of the zeroth turning point saturation
114 _s_gr_tp0[_qp] = landSat(tp_sat);
115}
void addRequiredRangeCheckedParam(const std::string &name, const std::string &parsed_function, const std::string &doc_string)
void addPrivateParam(const std::string &name, const T &value)
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)
const Real _s_lr
Liquid saturation at which the liquid relperm is zero and the gas relperm is k_rg_max.
const MaterialProperty< std::array< Real, PorousFlowConstants::MAX_HYSTERESIS_ORDER > > & _hys_sat_tps
Saturation values at the turning points, as computed by PorousFlowHysteresisOrder.
MaterialProperty< Real > & _s_gr_tp0
Computed nodal or quadpoint values the Land expression, at the turning point from primary drying to f...
virtual void computeRelPermQp()=0
Compute the relative permeability and its derivative wrt the _phase_num saturation,...
const MaterialProperty< unsigned > & _hys_order
Hysteresis order, as computed by PorousFlowHysteresisOrder.
const MaterialProperty< unsigned > & _hys_order_old
Old value of hysteresis order, as computed by PorousFlowHysteresisOrder.
virtual void computeTurningPoint0Info(Real tp_sat)
Compute all relevant quantities at the zeroth turning point (the transition from primary drying to fi...
Base class for all PorousFlow materials that provide phase-dependent properties.
static InputParameters validParams()