https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PorousFlow1PhaseHysP.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
13
16{
19 "porepressure", "Variable that represents the porepressure of the single liquid phase");
21 "This Material is used for unsaturated single-phase situations "
22 "where porepressure is the primary variable and the capillary pressure is hysteretic. The "
23 "hysteretic formulation assumes that the single phase is a liquid");
24 return params;
25}
26
29 _pc(_nodal_material ? declareProperty<Real>("PorousFlow_hysteretic_capillary_pressure_nodal")
30 : declareProperty<Real>("PorousFlow_hysteretic_capillary_pressure_qp")),
31 _porepressure_var(_nodal_material ? coupledDofValues("porepressure")
32 : coupledValue("porepressure")),
33 _gradp_qp_var(coupledGradient("porepressure")),
34 _porepressure_varnum(coupled("porepressure")),
35 _p_var_num(_dictator.isPorousFlowVariable(_porepressure_varnum)
36 ? _dictator.porousFlowVariableNum(_porepressure_varnum)
37 : 0)
38{
39 checkNodalVariables({"porepressure"});
40
41 if (_num_phases != 1)
42 mooseError("The Dictator proclaims that the number of phases is ",
43 _dictator.numPhases(),
44 " whereas PorousFlow1PhaseHysP can only be used for 1-phase simulations. Be aware "
45 "that the Dictator has noted your mistake.");
46}
47
48void
54
55void
57{
58 // size stuff correctly and prepare the derivative matrices with zeroes
60
62 const Real pc = -_porepressure_var[_qp];
63 const Real ds = -dliquidSaturationQp(pc);
64
65 if (!_nodal_material)
66 {
67 (*_gradp_qp)[_qp][0] = _gradp_qp_var[_qp];
68 (*_grads_qp)[_qp][0] = ds * _gradp_qp_var[_qp];
69 }
70
71 // _porepressure is only dependent on _porepressure, and its derivative is 1
72 if (_dictator.isPorousFlowVariable(_porepressure_varnum))
73 {
74 // _porepressure is a PorousFlow variable
75 (*_dporepressure_dvar)[_qp][0][_p_var_num] = 1.0;
76 (*_dsaturation_dvar)[_qp][0][_p_var_num] = ds;
77 if (!_nodal_material)
78 {
79 (*_dgradp_qp_dgradv)[_qp][0][_p_var_num] = 1.0;
80 (*_dgrads_qp_dgradv)[_qp][0][_p_var_num] = ds;
81 (*_dgrads_qp_dv)[_qp][0][_p_var_num] = d2liquidSaturationQp(pc) * _gradp_qp_var[_qp];
82 }
83 }
84}
85
86void
void mooseError(Args &&... args)
registerMooseObject("PorousFlowApp", PorousFlow1PhaseHysP)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
Material designed to calculate fluid phase porepressure and saturation for the single-phase partially...
const VariableGradient & _gradp_qp_var
Gradient(_porepressure at quadpoints)
const VariableValue & _porepressure_var
Nodal or quadpoint value of porepressure of the fluid phase.
void buildQpPPSS()
Assemble std::vectors of porepressure and saturation.
const unsigned int _p_var_num
The PorousFlow variable number of the porepressure.
virtual void computeQpProperties() override
const unsigned int _porepressure_varnum
Moose variable number of the porepressure.
MaterialProperty< Real > & _pc
Computed nodal or quadpoint values of capillary pressure.
static InputParameters validParams()
virtual void initQpStatefulProperties() override
PorousFlow1PhaseHysP(const InputParameters &parameters)
Base material designed to calculate and store quantities relevant for hysteretic capillary pressure c...
const unsigned int _num_phases
Number of phases.
GenericMaterialProperty< std::vector< Real >, is_ad > & _porepressure
Computed nodal or quadpoint values of porepressure of the phases.
GenericMaterialProperty< std::vector< Real >, is_ad > & _saturation
Computed nodal or qp saturation of the phases.