19 params.
addPrivateParam<std::string>(
"pf_material_type",
"hysteresis_order");
20 params.
addParam<
unsigned>(
"liquid_phase", 0,
"The phase number of the liquid phase");
24 "The initial order. 0 means the simulation will begin on the primary drying curve. 1 means "
25 "the simulation will begin on the first-order wetting curve. 2 means the simulation will "
26 "begin on the second-order drying curve, etc.");
28 "previous_turning_points",
30 "The turning points (liquid saturation values) at occured prior to the simulation. There "
31 "must be exactly initial_order of these values. The first value is the liquid saturation at "
32 "the transition from primary-drying to first-order-wetting; the second value is the liquid "
33 "saturation at the transition from first-order-wetting to second-order-drying; and so on. "
34 "You must ensure that your initial saturation field is commensurate with the "
35 "previous_turning_points.");
36 params.
addClassDescription(
"Computes hysteresis order for use in hysteretic capillary pressures "
37 "and relative permeabilities");
43 _liquid_ph_num(getParam<unsigned>(
"liquid_phase")),
44 _liquid_phase(
Moose::stringify(_liquid_ph_num)),
45 _initial_order(getParam<unsigned>(
"initial_order")),
46 _previous_turning_points(getParam<
std::vector<Real>>(
"previous_turning_points")),
47 _sat_old(_nodal_material
48 ? getMaterialPropertyOld<
std::vector<Real>>(
"PorousFlow_saturation_nodal")
49 : getMaterialPropertyOld<
std::vector<Real>>(
"PorousFlow_saturation_qp")),
50 _sat_older(_nodal_material
51 ? getMaterialPropertyOlder<
std::vector<Real>>(
"PorousFlow_saturation_nodal")
52 : getMaterialPropertyOlder<
std::vector<Real>>(
"PorousFlow_saturation_qp")),
53 _hys_order(_nodal_material ? declareProperty<unsigned>(
"PorousFlow_hysteresis_order_nodal")
54 : declareProperty<unsigned>(
"PorousFlow_hysteresis_order_qp")),
55 _hys_order_old(_nodal_material
56 ? getMaterialPropertyOld<unsigned>(
"PorousFlow_hysteresis_order_nodal")
57 : getMaterialPropertyOld<unsigned>(
"PorousFlow_hysteresis_order_qp")),
58 _hys_sat_tps(_nodal_material
60 "PorousFlow_hysteresis_saturation_tps_nodal")
62 "PorousFlow_hysteresis_saturation_tps_qp")),
66 "PorousFlow_hysteresis_saturation_tps_nodal")
68 "PorousFlow_hysteresis_saturation_tps_qp"))
71 paramError(
"liquid_phase",
72 "The Dictator proclaims that the number of fluid phases is ",
73 _dictator.numPhases(),
74 " while you have foolishly entered ",
76 " for your liquid phase number. Remember that indexing starts at 0. Be aware that "
77 "the Dictator does not tolerate mistakes.");
79 paramError(
"initial_order",
80 "The initial order must be less than the max order, which is hard-coded to ",
83 paramError(
"previous_turning_points",
86 " so there must be this many previous_turning_points");
88 if (tp < 0.0 || tp > 1.0)
89 paramError(
"previous_turning_points",
90 "Each previous_turning_point must lie in the range [0.0, 1.0]");
92 Real previous_tp = 1.0;
93 Real previous_jump = std::numeric_limits<Real>::max();
101 paramError(
"previous_turning_points",
102 "The previous_turning_points vector, {a, b, c, ...}, must be obey the following "
103 "order: a < 1; b > a; a < c < b, etc");
108 paramError(
"previous_turning_points",
109 "The previous_turning_points vector, {a, b, c, ...}, must be obey the following "
110 "order: a < 1; b > a; a < c < b, etc");
112 if (std::abs(this_jump) >= previous_jump)
113 paramError(
"previous_turning_points",
114 "The previous_turning_points vector, {a, b, c, ...}, must be obey the following "
115 "order: a < 1; b > a; a < c < b, etc");
118 previous_jump = std::abs(this_jump);
173 const bool drying_and_high_sat =
178 const bool wetting_and_low_sat =
181 if (drying_and_high_sat || wetting_and_low_sat)
187 bool can_reduce_order = (
_hys_order[_qp] > 1);
188 while (can_reduce_order)
190 can_reduce_order =
false;
192 const bool drying_and_low_sat =
196 const bool wetting_and_high_sat =
199 if (drying_and_low_sat || wetting_and_high_sat)
registerMooseObject("PorousFlowApp", PorousFlowHysteresisOrder)
virtual unsigned int size() const override final
Computes the hysteresis order for use by the hysteretic capillary pressure and relative-permeability ...
virtual void computeQpProperties() override
const unsigned _initial_order
Initial order.
const std::vector< Real > _previous_turning_points
Previous turning points that were encountered prior to the simulation.
const MaterialProperty< std::array< Real, PorousFlowConstants::MAX_HYSTERESIS_ORDER > > & _hys_sat_tps_old
Old value of recorded saturation values at the turning points.
MaterialProperty< std::array< Real, PorousFlowConstants::MAX_HYSTERESIS_ORDER > > & _hys_sat_tps
Recorded saturation values at the turning points.
const MaterialProperty< std::vector< Real > > & _sat_old
Old value of saturation.
static InputParameters validParams()
const MaterialProperty< std::vector< Real > > & _sat_older
Older value of saturation.
const MaterialProperty< unsigned > & _hys_order_old
Old value of hysteresis order at the nodes or quadpoints.
virtual void initQpStatefulProperties() override
const unsigned _liquid_ph_num
Liquid phase number.
PorousFlowHysteresisOrder(const InputParameters ¶meters)
MaterialProperty< unsigned > & _hys_order
Computed hysteresis order at the nodes or quadpoints.
PorousFlowMaterial is the base class for all PorousFlow Materials It allows users to specify that the...
static InputParameters validParams()
constexpr unsigned MAX_HYSTERESIS_ORDER