www.mooseframework.org
PorousFlow1PhaseP.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 
8 #include "PorousFlow1PhaseP.h"
10 
11 template <>
12 InputParameters
14 {
15  InputParameters params = validParams<PorousFlowVariableBase>();
16  params.addRequiredCoupledVar("porepressure",
17  "Variable that represents the porepressure of the single phase");
18  params.addParam<UserObjectName>("capillary_pressure",
19  "Name of the UserObject defining the capillary pressure");
20  params.addClassDescription("This Material is used for the fully saturated single-phase situation "
21  "where porepressure is the primary variable");
22  return params;
23 }
24 
25 PorousFlow1PhaseP::PorousFlow1PhaseP(const InputParameters & parameters)
26  : PorousFlowVariableBase(parameters),
27 
28  _porepressure_var(_nodal_material ? coupledNodalValue("porepressure")
29  : coupledValue("porepressure")),
30  _gradp_qp_var(coupledGradient("porepressure")),
31  _porepressure_varnum(coupled("porepressure")),
32  _p_var_num(_dictator.isPorousFlowVariable(_porepressure_varnum)
33  ? _dictator.porousFlowVariableNum(_porepressure_varnum)
34  : 0),
35  _pc_uo(parameters.isParamSetByUser("capillary_pressure")
36  ? &getUserObject<PorousFlowCapillaryPressure>("capillary_pressure")
37  : nullptr)
38 {
39  if (_num_phases != 1)
40  mooseError("The Dictator proclaims that the number of phases is ",
41  _dictator.numPhases(),
42  " whereas PorousFlow1PhaseP 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 dseff = dEffectiveSaturation_dP(_porepressure_var[_qp]);
61 
62  if (!_nodal_material)
63  {
64  (*_gradp_qp)[_qp][0] = _gradp_qp_var[_qp];
65  (*_grads_qp)[_qp][0] = dseff * _gradp_qp_var[_qp];
66  }
67 
68  // _porepressure is only dependent on _porepressure, and its derivative is 1
69  if (_dictator.isPorousFlowVariable(_porepressure_varnum))
70  {
71  // _porepressure is a PorousFlow variable
72  _dporepressure_dvar[_qp][0][_p_var_num] = 1.0;
73  _dsaturation_dvar[_qp][0][_p_var_num] = dseff;
74  if (!_nodal_material)
75  {
76  (*_dgradp_qp_dgradv)[_qp][0][_p_var_num] = 1.0;
77  (*_dgrads_qp_dgradv)[_qp][0][_p_var_num] = dseff;
78  (*_dgrads_qp_dv)[_qp][0][_p_var_num] =
80  }
81  }
82 }
83 
84 void
86 {
87  _porepressure[_qp][0] = _porepressure_var[_qp];
89 }
90 
91 Real
93 {
94  return _pc_uo->effectiveSaturation(pc);
95 }
96 
97 Real
99 {
100  return _pc_uo->dEffectiveSaturation(pc);
101 }
102 
103 Real
105 {
106  return _pc_uo->d2EffectiveSaturation(pc);
107 }
virtual Real d2EffectiveSaturation_dP2(Real pressure) const
Second derivative of effective saturation wrt to porepressure.
virtual void initQpStatefulProperties() override
const unsigned int _p_var_num
the PorousFlow variable number of the porepressure
MaterialProperty< std::vector< std::vector< Real > > > & _dporepressure_dvar
d(porepressure)/d(PorousFlow variable)
MaterialProperty< std::vector< Real > > & _saturation
Computed nodal or qp saturation of the phases.
virtual Real effectiveSaturation(Real pc) const =0
Effective saturation as a function of capillary pressure.
Base class for capillary pressure for multiphase flow in porous media.
MaterialProperty< std::vector< std::vector< Real > > > & _dsaturation_dvar
d(saturation)/d(PorousFlow variable)
InputParameters validParams< PorousFlow1PhaseP >()
InputParameters validParams< PorousFlowVariableBase >()
virtual void computeQpProperties() override
virtual void initQpStatefulProperties() override
virtual Real dEffectiveSaturation_dP(Real pressure) const
Derivative of effective saturation wrt to porepressure.
PorousFlow1PhaseP(const InputParameters &parameters)
virtual Real effectiveSaturation(Real pressure) const
Effective saturation as a function of porepressure.
virtual Real dEffectiveSaturation(Real pc) const =0
Derivative of effective saturation wrt capillary pressure.
virtual void computeQpProperties() override
const VariableValue & _porepressure_var
Nodal or quadpoint value of porepressure of the fluid phase.
const PorousFlowCapillaryPressure * _pc_uo
Capillary pressure UserObject Note: This pointer can be replaced with a reference once the deprecated...
const unsigned int _num_phases
Number of phases.
const unsigned int _porepressure_varnum
Moose variable number of the porepressure.
Base class for thermophysical variable materials, which assemble materials for primary variables such...
MaterialProperty< std::vector< Real > > & _porepressure
Computed nodal or quadpoint values of porepressure of the phases.
virtual Real d2EffectiveSaturation(Real pc) const =0
Second derivative of effective saturation wrt capillary pressure.
const VariableGradient & _gradp_qp_var
Gradient(_porepressure at quadpoints)
void buildQpPPSS()
Assemble std::vectors of porepressure, saturation and temperature at the quadpoints.