www.mooseframework.org
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PorousFlow2PhasePP Class Reference

Base material designed to calculate fluid phase porepressure and saturation for the two-phase situation assuming phase porepressures as the nonlinear variables. More...

#include <PorousFlow2PhasePP.h>

Inheritance diagram for PorousFlow2PhasePP:
[legend]

Public Member Functions

 PorousFlow2PhasePP (const InputParameters &parameters)
 

Protected Member Functions

virtual void initQpStatefulProperties () override
 
virtual void computeQpProperties () override
 
Real buildQpPPSS ()
 Assemble std::vectors of porepressure and saturation at the nodes and quadpoints, and return the capillary pressure. More...
 
virtual Real effectiveSaturation (Real pressure) const
 Effective saturation as a function of porepressure (a negative quantity). More...
 
virtual Real dEffectiveSaturation_dP (Real pressure) const
 Derivative of effective saturation wrt to p. More...
 
virtual Real d2EffectiveSaturation_dP2 (Real pressure) const
 Second derivative of effective saturation wrt to porepressure. More...
 

Protected Attributes

const VariableValue & _phase0_porepressure
 Nodal or quadpoint value of porepressure of the zero phase (eg, the water phase) More...
 
const VariableGradient & _phase0_gradp_qp
 Gradient(phase0_porepressure) at the qps. More...
 
const unsigned int _phase0_porepressure_varnum
 Moose variable number of the phase0 porepressure. More...
 
const unsigned int _p0var
 PorousFlow variable number of the phase0 porepressure. More...
 
const VariableValue & _phase1_porepressure
 Nodal or quadpoint value of porepressure of the one phase (eg, the gas phase) More...
 
const VariableGradient & _phase1_gradp_qp
 Gradient(phase1_porepressure) at the qps. More...
 
const unsigned int _phase1_porepressure_varnum
 Moose variable number of the phase1 porepressure. More...
 
const unsigned int _p1var
 PorousFlow variable number of the phase1 porepressure. More...
 
const PorousFlowCapillaryPressure_pc_uo
 Capillary pressure UserObject Note: This pointer can be replaced with a reference once the deprecated PP materials have been removed. More...
 
const unsigned int _num_phases
 Number of phases. More...
 
const unsigned int _num_components
 Number of components. More...
 
const unsigned int _num_pf_vars
 Number of PorousFlow variables. More...
 
MaterialProperty< std::vector< Real > > & _porepressure
 Computed nodal or quadpoint values of porepressure of the phases. More...
 
MaterialProperty< std::vector< std::vector< Real > > > & _dporepressure_dvar
 d(porepressure)/d(PorousFlow variable) More...
 
MaterialProperty< std::vector< RealGradient > > *const _gradp_qp
 Grad(p) at the quadpoints. More...
 
MaterialProperty< std::vector< std::vector< Real > > > *const _dgradp_qp_dgradv
 d(grad porepressure)/d(grad PorousFlow variable) at the quadpoints More...
 
MaterialProperty< std::vector< std::vector< RealGradient > > > *const _dgradp_qp_dv
 d(grad porepressure)/d(PorousFlow variable) at the quadpoints More...
 
MaterialProperty< std::vector< Real > > & _saturation
 Computed nodal or qp saturation of the phases. More...
 
MaterialProperty< std::vector< std::vector< Real > > > & _dsaturation_dvar
 d(saturation)/d(PorousFlow variable) More...
 
MaterialProperty< std::vector< RealGradient > > *const _grads_qp
 Grad(s) at the quadpoints. More...
 
MaterialProperty< std::vector< std::vector< Real > > > *const _dgrads_qp_dgradv
 d(grad saturation)/d(grad PorousFlow variable) at the quadpoints More...
 
MaterialProperty< std::vector< std::vector< RealGradient > > > *const _dgrads_qp_dv
 d(grad saturation)/d(PorousFlow variable) at the quadpoints More...
 

Detailed Description

Base material designed to calculate fluid phase porepressure and saturation for the two-phase situation assuming phase porepressures as the nonlinear variables.

Inherit and over-ride effectiveSaturation, dEffectiveSaturation, and d2EffectiveSaturation to implement specific capillary pressure functions

Definition at line 26 of file PorousFlow2PhasePP.h.

Constructor & Destructor Documentation

PorousFlow2PhasePP::PorousFlow2PhasePP ( const InputParameters &  parameters)

Definition at line 30 of file PorousFlow2PhasePP.C.

31  : PorousFlowVariableBase(parameters),
32 
33  _phase0_porepressure(_nodal_material ? coupledNodalValue("phase0_porepressure")
34  : coupledValue("phase0_porepressure")),
35  _phase0_gradp_qp(coupledGradient("phase0_porepressure")),
36  _phase0_porepressure_varnum(coupled("phase0_porepressure")),
37  _p0var(_dictator.isPorousFlowVariable(_phase0_porepressure_varnum)
38  ? _dictator.porousFlowVariableNum(_phase0_porepressure_varnum)
39  : 0),
40 
41  _phase1_porepressure(_nodal_material ? coupledNodalValue("phase1_porepressure")
42  : coupledValue("phase1_porepressure")),
43  _phase1_gradp_qp(coupledGradient("phase1_porepressure")),
44  _phase1_porepressure_varnum(coupled("phase1_porepressure")),
45  _p1var(_dictator.isPorousFlowVariable(_phase1_porepressure_varnum)
46  ? _dictator.porousFlowVariableNum(_phase1_porepressure_varnum)
47  : 0),
48  _pc_uo(parameters.isParamSetByUser("capillary_pressure")
49  ? &getUserObject<PorousFlowCapillaryPressure>("capillary_pressure")
50  : nullptr)
51 {
52  if (_num_phases != 2)
53  mooseError("The Dictator announces that the number of phases is ",
54  _dictator.numPhases(),
55  " whereas PorousFlow2PhasePP can only be used for 2-phase simulation. When you "
56  "have an efficient government, you have a dictatorship.");
57 }
const unsigned int _p0var
PorousFlow variable number of the phase0 porepressure.
const unsigned int _phase0_porepressure_varnum
Moose variable number of the phase0 porepressure.
Base class for capillary pressure for multiphase flow in porous media.
const VariableValue & _phase0_porepressure
Nodal or quadpoint value of porepressure of the zero phase (eg, the water phase)
PorousFlowVariableBase(const InputParameters &parameters)
const VariableGradient & _phase0_gradp_qp
Gradient(phase0_porepressure) at the qps.
const unsigned int _phase1_porepressure_varnum
Moose variable number of the phase1 porepressure.
const unsigned int _p1var
PorousFlow variable number of the phase1 porepressure.
const VariableGradient & _phase1_gradp_qp
Gradient(phase1_porepressure) at the qps.
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 VariableValue & _phase1_porepressure
Nodal or quadpoint value of porepressure of the one phase (eg, the gas phase)

Member Function Documentation

Real PorousFlow2PhasePP::buildQpPPSS ( )
protected

Assemble std::vectors of porepressure and saturation at the nodes and quadpoints, and return the capillary pressure.

Definition at line 134 of file PorousFlow2PhasePP.C.

Referenced by computeQpProperties(), and initQpStatefulProperties().

135 {
136  _porepressure[_qp][0] = _phase0_porepressure[_qp];
137  _porepressure[_qp][1] = _phase1_porepressure[_qp];
138  const Real pc = _phase0_porepressure[_qp] - _phase1_porepressure[_qp]; // this is <= 0
139  const Real seff = effectiveSaturation(pc);
140  _saturation[_qp][0] = seff;
141  _saturation[_qp][1] = 1.0 - seff;
142  return pc;
143 }
MaterialProperty< std::vector< Real > > & _saturation
Computed nodal or qp saturation of the phases.
const VariableValue & _phase0_porepressure
Nodal or quadpoint value of porepressure of the zero phase (eg, the water phase)
virtual Real effectiveSaturation(Real pressure) const
Effective saturation as a function of porepressure (a negative quantity).
const VariableValue & _phase1_porepressure
Nodal or quadpoint value of porepressure of the one phase (eg, the gas phase)
MaterialProperty< std::vector< Real > > & _porepressure
Computed nodal or quadpoint values of porepressure of the phases.
void PorousFlow2PhasePP::computeQpProperties ( )
overrideprotectedvirtual

Reimplemented from PorousFlowVariableBase.

Definition at line 67 of file PorousFlow2PhasePP.C.

68 {
69  // size stuff correctly and prepare the derivative matrices with zeroes
71 
72  const Real pc = buildQpPPSS();
73  const Real dseff = dEffectiveSaturation_dP(pc); // d(seff)/d(pc)
74 
75  if (!_nodal_material)
76  {
77  (*_gradp_qp)[_qp][0] = _phase0_gradp_qp[_qp];
78  (*_gradp_qp)[_qp][1] = _phase1_gradp_qp[_qp];
79  (*_grads_qp)[_qp][0] = dseff * ((*_gradp_qp)[_qp][0] - (*_gradp_qp)[_qp][1]);
80  (*_grads_qp)[_qp][1] = -(*_grads_qp)[_qp][0];
81  }
82 
83  // the derivatives of porepressure with respect to porepressure
84  // remain fixed (at unity) throughout the simulation
85  if (_dictator.isPorousFlowVariable(_phase0_porepressure_varnum))
86  {
87  _dporepressure_dvar[_qp][0][_p0var] = 1.0;
88  if (!_nodal_material)
89  (*_dgradp_qp_dgradv)[_qp][0][_p0var] = 1.0;
90  }
91  if (_dictator.isPorousFlowVariable(_phase1_porepressure_varnum))
92  {
93  _dporepressure_dvar[_qp][1][_p1var] = 1.0;
94  if (!_nodal_material)
95  (*_dgradp_qp_dgradv)[_qp][1][_p1var] = 1.0;
96  }
97 
98  if (_dictator.isPorousFlowVariable(_phase0_porepressure_varnum))
99  {
100  _dsaturation_dvar[_qp][0][_p0var] = dseff;
101  _dsaturation_dvar[_qp][1][_p0var] = -dseff;
102  }
103  if (_dictator.isPorousFlowVariable(_phase1_porepressure_varnum))
104  {
105  _dsaturation_dvar[_qp][0][_p1var] = -dseff;
106  _dsaturation_dvar[_qp][1][_p1var] = dseff;
107  }
108 
109  if (!_nodal_material)
110  {
111  const Real d2seff_qp = d2EffectiveSaturation_dP2(pc); // d^2(seff_qp)/d(pc_qp)^2
112  if (_dictator.isPorousFlowVariable(_phase0_porepressure_varnum))
113  {
114  (*_dgrads_qp_dgradv)[_qp][0][_p0var] = dseff;
115  (*_dgrads_qp_dv)[_qp][0][_p0var] =
116  d2seff_qp * (_phase0_gradp_qp[_qp] - _phase1_gradp_qp[_qp]);
117  (*_dgrads_qp_dgradv)[_qp][1][_p0var] = -dseff;
118  (*_dgrads_qp_dv)[_qp][1][_p0var] =
119  -d2seff_qp * (_phase0_gradp_qp[_qp] - _phase1_gradp_qp[_qp]);
120  }
121  if (_dictator.isPorousFlowVariable(_phase1_porepressure_varnum))
122  {
123  (*_dgrads_qp_dgradv)[_qp][0][_p1var] = -dseff;
124  (*_dgrads_qp_dv)[_qp][0][_p1var] =
125  -d2seff_qp * (_phase0_gradp_qp[_qp] - _phase1_gradp_qp[_qp]);
126  (*_dgrads_qp_dgradv)[_qp][1][_p1var] = dseff;
127  (*_dgrads_qp_dv)[_qp][1][_p1var] =
128  d2seff_qp * (_phase0_gradp_qp[_qp] - _phase1_gradp_qp[_qp]);
129  }
130  }
131 }
virtual Real d2EffectiveSaturation_dP2(Real pressure) const
Second derivative of effective saturation wrt to porepressure.
MaterialProperty< std::vector< std::vector< Real > > > & _dporepressure_dvar
d(porepressure)/d(PorousFlow variable)
const unsigned int _p0var
PorousFlow variable number of the phase0 porepressure.
const unsigned int _phase0_porepressure_varnum
Moose variable number of the phase0 porepressure.
MaterialProperty< std::vector< std::vector< Real > > > & _dsaturation_dvar
d(saturation)/d(PorousFlow variable)
Real buildQpPPSS()
Assemble std::vectors of porepressure and saturation at the nodes and quadpoints, and return the capi...
const VariableGradient & _phase0_gradp_qp
Gradient(phase0_porepressure) at the qps.
virtual void computeQpProperties() override
const unsigned int _phase1_porepressure_varnum
Moose variable number of the phase1 porepressure.
const unsigned int _p1var
PorousFlow variable number of the phase1 porepressure.
virtual Real dEffectiveSaturation_dP(Real pressure) const
Derivative of effective saturation wrt to p.
const VariableGradient & _phase1_gradp_qp
Gradient(phase1_porepressure) at the qps.
Real PorousFlow2PhasePP::d2EffectiveSaturation_dP2 ( Real  pressure) const
protectedvirtual

Second derivative of effective saturation wrt to porepressure.

Default = 0 for constant saturation. Over-ride in derived classes to implement other effective saturation forulations

Parameters
pressureporepressure (Pa): a negative quantity
Returns
second derivative of effective saturation wrt porepressure

Reimplemented in PorousFlow2PhasePP_RSC, and PorousFlow2PhasePP_VG.

Definition at line 158 of file PorousFlow2PhasePP.C.

Referenced by computeQpProperties().

159 {
160  return _pc_uo->d2EffectiveSaturation(pc);
161 }
const PorousFlowCapillaryPressure * _pc_uo
Capillary pressure UserObject Note: This pointer can be replaced with a reference once the deprecated...
virtual Real d2EffectiveSaturation(Real pc) const =0
Second derivative of effective saturation wrt capillary pressure.
Real PorousFlow2PhasePP::dEffectiveSaturation_dP ( Real  pressure) const
protectedvirtual

Derivative of effective saturation wrt to p.

Default = 0 for constant saturation. Over-ride in derived classes to implement other effective saturation forulations

Parameters
pressureporepressure (Pa): a negative quantity
Returns
derivative of effective saturation wrt porepressure

Reimplemented in PorousFlow2PhasePP_RSC, and PorousFlow2PhasePP_VG.

Definition at line 152 of file PorousFlow2PhasePP.C.

Referenced by computeQpProperties().

153 {
154  return _pc_uo->dEffectiveSaturation(pc);
155 }
virtual Real dEffectiveSaturation(Real pc) const =0
Derivative of effective saturation wrt capillary pressure.
const PorousFlowCapillaryPressure * _pc_uo
Capillary pressure UserObject Note: This pointer can be replaced with a reference once the deprecated...
Real PorousFlow2PhasePP::effectiveSaturation ( Real  pressure) const
protectedvirtual

Effective saturation as a function of porepressure (a negative quantity).

Default is constant saturation = 1. Over-ride in derived classes to implement other effective saturation forulations

Parameters
pressureporepressure (Pa): a negative quantity
Returns
effective saturation

Reimplemented in PorousFlow2PhasePP_RSC, and PorousFlow2PhasePP_VG.

Definition at line 146 of file PorousFlow2PhasePP.C.

Referenced by buildQpPPSS().

147 {
148  return _pc_uo->effectiveSaturation(pc);
149 }
virtual Real effectiveSaturation(Real pc) const =0
Effective saturation as a function of capillary pressure.
const PorousFlowCapillaryPressure * _pc_uo
Capillary pressure UserObject Note: This pointer can be replaced with a reference once the deprecated...
void PorousFlow2PhasePP::initQpStatefulProperties ( )
overrideprotectedvirtual

Reimplemented from PorousFlowVariableBase.

Definition at line 60 of file PorousFlow2PhasePP.C.

61 {
63  buildQpPPSS();
64 }
virtual void initQpStatefulProperties() override
Real buildQpPPSS()
Assemble std::vectors of porepressure and saturation at the nodes and quadpoints, and return the capi...

Member Data Documentation

MaterialProperty<std::vector<std::vector<Real> > >* const PorousFlowVariableBase::_dgradp_qp_dgradv
protectedinherited

d(grad porepressure)/d(grad PorousFlow variable) at the quadpoints

Definition at line 52 of file PorousFlowVariableBase.h.

MaterialProperty<std::vector<std::vector<RealGradient> > >* const PorousFlowVariableBase::_dgradp_qp_dv
protectedinherited

d(grad porepressure)/d(PorousFlow variable) at the quadpoints

Definition at line 55 of file PorousFlowVariableBase.h.

MaterialProperty<std::vector<std::vector<Real> > >* const PorousFlowVariableBase::_dgrads_qp_dgradv
protectedinherited

d(grad saturation)/d(grad PorousFlow variable) at the quadpoints

Definition at line 67 of file PorousFlowVariableBase.h.

MaterialProperty<std::vector<std::vector<RealGradient> > >* const PorousFlowVariableBase::_dgrads_qp_dv
protectedinherited

d(grad saturation)/d(PorousFlow variable) at the quadpoints

Definition at line 70 of file PorousFlowVariableBase.h.

MaterialProperty<std::vector<std::vector<Real> > >& PorousFlowVariableBase::_dporepressure_dvar
protectedinherited
MaterialProperty<std::vector<std::vector<Real> > >& PorousFlowVariableBase::_dsaturation_dvar
protectedinherited
MaterialProperty<std::vector<RealGradient> >* const PorousFlowVariableBase::_gradp_qp
protectedinherited

Grad(p) at the quadpoints.

Definition at line 49 of file PorousFlowVariableBase.h.

MaterialProperty<std::vector<RealGradient> >* const PorousFlowVariableBase::_grads_qp
protectedinherited

Grad(s) at the quadpoints.

Definition at line 64 of file PorousFlowVariableBase.h.

const unsigned int PorousFlowVariableBase::_num_components
protectedinherited
const unsigned int PorousFlowVariableBase::_num_pf_vars
protectedinherited
const unsigned int PorousFlowVariableBase::_num_phases
protectedinherited
const unsigned int PorousFlow2PhasePP::_p0var
protected

PorousFlow variable number of the phase0 porepressure.

Definition at line 78 of file PorousFlow2PhasePP.h.

Referenced by computeQpProperties().

const unsigned int PorousFlow2PhasePP::_p1var
protected

PorousFlow variable number of the phase1 porepressure.

Definition at line 86 of file PorousFlow2PhasePP.h.

Referenced by computeQpProperties().

const PorousFlowCapillaryPressure* PorousFlow2PhasePP::_pc_uo
protected

Capillary pressure UserObject Note: This pointer can be replaced with a reference once the deprecated PP materials have been removed.

Definition at line 90 of file PorousFlow2PhasePP.h.

Referenced by d2EffectiveSaturation_dP2(), dEffectiveSaturation_dP(), and effectiveSaturation().

const VariableGradient& PorousFlow2PhasePP::_phase0_gradp_qp
protected

Gradient(phase0_porepressure) at the qps.

Definition at line 74 of file PorousFlow2PhasePP.h.

Referenced by computeQpProperties().

const VariableValue& PorousFlow2PhasePP::_phase0_porepressure
protected

Nodal or quadpoint value of porepressure of the zero phase (eg, the water phase)

Definition at line 72 of file PorousFlow2PhasePP.h.

Referenced by buildQpPPSS().

const unsigned int PorousFlow2PhasePP::_phase0_porepressure_varnum
protected

Moose variable number of the phase0 porepressure.

Definition at line 76 of file PorousFlow2PhasePP.h.

Referenced by computeQpProperties().

const VariableGradient& PorousFlow2PhasePP::_phase1_gradp_qp
protected

Gradient(phase1_porepressure) at the qps.

Definition at line 82 of file PorousFlow2PhasePP.h.

Referenced by computeQpProperties().

const VariableValue& PorousFlow2PhasePP::_phase1_porepressure
protected

Nodal or quadpoint value of porepressure of the one phase (eg, the gas phase)

Definition at line 80 of file PorousFlow2PhasePP.h.

Referenced by buildQpPPSS().

const unsigned int PorousFlow2PhasePP::_phase1_porepressure_varnum
protected

Moose variable number of the phase1 porepressure.

Definition at line 84 of file PorousFlow2PhasePP.h.

Referenced by computeQpProperties().

MaterialProperty<std::vector<Real> >& PorousFlowVariableBase::_porepressure
protectedinherited
MaterialProperty<std::vector<Real> >& PorousFlowVariableBase::_saturation
protectedinherited

The documentation for this class was generated from the following files: