https://mooseframework.inl.gov
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 
10 #include "PorousFlow1PhaseHysP.h"
11 
13 
16 {
18  params.addRequiredCoupledVar(
19  "porepressure", "Variable that represents the porepressure of the single liquid phase");
20  params.addClassDescription(
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  if (_num_phases != 1)
40  mooseError("The Dictator proclaims that the number of phases is ",
41  _dictator.numPhases(),
42  " whereas PorousFlow1PhaseHysP can only be used for 1-phase simulations. Be aware "
43  "that the Dictator has noted your mistake.");
44 }
45 
46 void
48 {
50  buildQpPPSS();
51 }
52 
53 void
55 {
56  // size stuff correctly and prepare the derivative matrices with zeroes
58 
59  buildQpPPSS();
60  const Real pc = -_porepressure_var[_qp];
61  const Real ds = -dliquidSaturationQp(pc);
62 
63  if (!_nodal_material)
64  {
65  (*_gradp_qp)[_qp][0] = _gradp_qp_var[_qp];
66  (*_grads_qp)[_qp][0] = ds * _gradp_qp_var[_qp];
67  }
68 
69  // _porepressure is only dependent on _porepressure, and its derivative is 1
70  if (_dictator.isPorousFlowVariable(_porepressure_varnum))
71  {
72  // _porepressure is a PorousFlow variable
73  (*_dporepressure_dvar)[_qp][0][_p_var_num] = 1.0;
74  (*_dsaturation_dvar)[_qp][0][_p_var_num] = ds;
75  if (!_nodal_material)
76  {
77  (*_dgradp_qp_dgradv)[_qp][0][_p_var_num] = 1.0;
78  (*_dgrads_qp_dgradv)[_qp][0][_p_var_num] = ds;
79  (*_dgrads_qp_dv)[_qp][0][_p_var_num] = d2liquidSaturationQp(pc) * _gradp_qp_var[_qp];
80  }
81  }
82 }
83 
84 void
86 {
87  _porepressure[_qp][0] = _porepressure_var[_qp];
88  _pc[_qp] = -_porepressure_var[_qp];
89  _saturation[_qp][0] = liquidSaturationQp(_pc[_qp]);
90 }
virtual void computeQpProperties() override
virtual void initQpStatefulProperties() override
const VariableGradient & _gradp_qp_var
Gradient(_porepressure at quadpoints)
void mooseError(Args &&... args)
GenericMaterialProperty< std::vector< Real >, is_ad > & _porepressure
Computed nodal or quadpoint values of porepressure of the phases.
PorousFlow1PhaseHysP(const InputParameters &parameters)
const VariableValue & _porepressure_var
Nodal or quadpoint value of porepressure of the fluid phase.
const unsigned int _p_var_num
The PorousFlow variable number of the porepressure.
registerMooseObject("PorousFlowApp", PorousFlow1PhaseHysP)
const unsigned int _porepressure_varnum
Moose variable number of the porepressure.
Base material designed to calculate and store quantities relevant for hysteretic capillary pressure c...
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
const unsigned int _num_phases
Number of phases.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void addClassDescription(const std::string &doc_string)
void buildQpPPSS()
Assemble std::vectors of porepressure and saturation.
GenericMaterialProperty< std::vector< Real >, is_ad > & _saturation
Computed nodal or qp saturation of the phases.
static InputParameters validParams()
MaterialProperty< Real > & _pc
Computed nodal or quadpoint values of capillary pressure.
Material designed to calculate fluid phase porepressure and saturation for the single-phase partially...