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...
 

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. 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.

Definition at line 25 of file PorousFlow2PhasePP.h.

Constructor & Destructor Documentation

◆ PorousFlow2PhasePP()

PorousFlow2PhasePP::PorousFlow2PhasePP ( const InputParameters &  parameters)

Definition at line 34 of file PorousFlow2PhasePP.C.

35  : PorousFlowVariableBase(parameters),
36 
37  _phase0_porepressure(_nodal_material ? coupledNodalValue("phase0_porepressure")
38  : coupledValue("phase0_porepressure")),
39  _phase0_gradp_qp(coupledGradient("phase0_porepressure")),
40  _phase0_porepressure_varnum(coupled("phase0_porepressure")),
41  _p0var(_dictator.isPorousFlowVariable(_phase0_porepressure_varnum)
42  ? _dictator.porousFlowVariableNum(_phase0_porepressure_varnum)
43  : 0),
44 
45  _phase1_porepressure(_nodal_material ? coupledNodalValue("phase1_porepressure")
46  : coupledValue("phase1_porepressure")),
47  _phase1_gradp_qp(coupledGradient("phase1_porepressure")),
48  _phase1_porepressure_varnum(coupled("phase1_porepressure")),
49  _p1var(_dictator.isPorousFlowVariable(_phase1_porepressure_varnum)
50  ? _dictator.porousFlowVariableNum(_phase1_porepressure_varnum)
51  : 0),
52  _pc_uo(getUserObject<PorousFlowCapillaryPressure>("capillary_pressure"))
53 {
54  if (_num_phases != 2)
55  mooseError("The Dictator announces that the number of phases is ",
56  _dictator.numPhases(),
57  " whereas PorousFlow2PhasePP can only be used for 2-phase simulation. When you "
58  "have an efficient government, you have a dictatorship.");
59 }
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 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)
const PorousFlowCapillaryPressure & _pc_uo
Capillary pressure UserObject.

Member Function Documentation

◆ buildQpPPSS()

Real PorousFlow2PhasePP::buildQpPPSS ( )
protected

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

Definition at line 136 of file PorousFlow2PhasePP.C.

Referenced by computeQpProperties(), and initQpStatefulProperties().

137 {
138  _porepressure[_qp][0] = _phase0_porepressure[_qp];
139  _porepressure[_qp][1] = _phase1_porepressure[_qp];
140  const Real pc = _phase0_porepressure[_qp] - _phase1_porepressure[_qp]; // this is <= 0
141  const Real seff = _pc_uo.effectiveSaturation(pc);
142  _saturation[_qp][0] = seff;
143  _saturation[_qp][1] = 1.0 - seff;
144  return pc;
145 }
virtual Real effectiveSaturation(Real pc, unsigned qp=0) const =0
Effective saturation as a function of capillary pressure.
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)
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.
const PorousFlowCapillaryPressure & _pc_uo
Capillary pressure UserObject.

◆ computeQpProperties()

void PorousFlow2PhasePP::computeQpProperties ( )
overrideprotectedvirtual

Reimplemented from PorousFlowVariableBase.

Definition at line 69 of file PorousFlow2PhasePP.C.

70 {
71  // size stuff correctly and prepare the derivative matrices with zeroes
73 
74  const Real pc = buildQpPPSS();
75  const Real dseff = _pc_uo.dEffectiveSaturation(pc); // d(seff)/d(pc)
76 
77  if (!_nodal_material)
78  {
79  (*_gradp_qp)[_qp][0] = _phase0_gradp_qp[_qp];
80  (*_gradp_qp)[_qp][1] = _phase1_gradp_qp[_qp];
81  (*_grads_qp)[_qp][0] = dseff * ((*_gradp_qp)[_qp][0] - (*_gradp_qp)[_qp][1]);
82  (*_grads_qp)[_qp][1] = -(*_grads_qp)[_qp][0];
83  }
84 
85  // the derivatives of porepressure with respect to porepressure
86  // remain fixed (at unity) throughout the simulation
87  if (_dictator.isPorousFlowVariable(_phase0_porepressure_varnum))
88  {
89  _dporepressure_dvar[_qp][0][_p0var] = 1.0;
90  if (!_nodal_material)
91  (*_dgradp_qp_dgradv)[_qp][0][_p0var] = 1.0;
92  }
93  if (_dictator.isPorousFlowVariable(_phase1_porepressure_varnum))
94  {
95  _dporepressure_dvar[_qp][1][_p1var] = 1.0;
96  if (!_nodal_material)
97  (*_dgradp_qp_dgradv)[_qp][1][_p1var] = 1.0;
98  }
99 
100  if (_dictator.isPorousFlowVariable(_phase0_porepressure_varnum))
101  {
102  _dsaturation_dvar[_qp][0][_p0var] = dseff;
103  _dsaturation_dvar[_qp][1][_p0var] = -dseff;
104  }
105  if (_dictator.isPorousFlowVariable(_phase1_porepressure_varnum))
106  {
107  _dsaturation_dvar[_qp][0][_p1var] = -dseff;
108  _dsaturation_dvar[_qp][1][_p1var] = dseff;
109  }
110 
111  if (!_nodal_material)
112  {
113  const Real d2seff_qp = _pc_uo.d2EffectiveSaturation(pc); // d^2(seff_qp)/d(pc_qp)^2
114  if (_dictator.isPorousFlowVariable(_phase0_porepressure_varnum))
115  {
116  (*_dgrads_qp_dgradv)[_qp][0][_p0var] = dseff;
117  (*_dgrads_qp_dv)[_qp][0][_p0var] =
118  d2seff_qp * (_phase0_gradp_qp[_qp] - _phase1_gradp_qp[_qp]);
119  (*_dgrads_qp_dgradv)[_qp][1][_p0var] = -dseff;
120  (*_dgrads_qp_dv)[_qp][1][_p0var] =
121  -d2seff_qp * (_phase0_gradp_qp[_qp] - _phase1_gradp_qp[_qp]);
122  }
123  if (_dictator.isPorousFlowVariable(_phase1_porepressure_varnum))
124  {
125  (*_dgrads_qp_dgradv)[_qp][0][_p1var] = -dseff;
126  (*_dgrads_qp_dv)[_qp][0][_p1var] =
127  -d2seff_qp * (_phase0_gradp_qp[_qp] - _phase1_gradp_qp[_qp]);
128  (*_dgrads_qp_dgradv)[_qp][1][_p1var] = dseff;
129  (*_dgrads_qp_dv)[_qp][1][_p1var] =
130  d2seff_qp * (_phase0_gradp_qp[_qp] - _phase1_gradp_qp[_qp]);
131  }
132  }
133 }
MaterialProperty< std::vector< std::vector< Real > > > & _dporepressure_dvar
d(porepressure)/d(PorousFlow variable)
virtual Real d2EffectiveSaturation(Real pc, unsigned qp=0) const =0
Second derivative of effective saturation wrt capillary pressure.
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.
const VariableGradient & _phase1_gradp_qp
Gradient(phase1_porepressure) at the qps.
virtual Real dEffectiveSaturation(Real pc, unsigned qp=0) const =0
Derivative of effective saturation wrt capillary pressure.
const PorousFlowCapillaryPressure & _pc_uo
Capillary pressure UserObject.

◆ initQpStatefulProperties()

void PorousFlow2PhasePP::initQpStatefulProperties ( )
overrideprotectedvirtual

Reimplemented from PorousFlowVariableBase.

Definition at line 62 of file PorousFlow2PhasePP.C.

63 {
65  buildQpPPSS();
66 }
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

◆ _dgradp_qp_dgradv

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 54 of file PorousFlowVariableBase.h.

◆ _dgradp_qp_dv

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

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

Definition at line 57 of file PorousFlowVariableBase.h.

◆ _dgrads_qp_dgradv

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 69 of file PorousFlowVariableBase.h.

◆ _dgrads_qp_dv

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

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

Definition at line 72 of file PorousFlowVariableBase.h.

◆ _dporepressure_dvar

MaterialProperty<std::vector<std::vector<Real> > >& PorousFlowVariableBase::_dporepressure_dvar
protectedinherited

◆ _dsaturation_dvar

MaterialProperty<std::vector<std::vector<Real> > >& PorousFlowVariableBase::_dsaturation_dvar
protectedinherited

◆ _gradp_qp

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

Grad(p) at the quadpoints.

Definition at line 51 of file PorousFlowVariableBase.h.

◆ _grads_qp

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

Grad(s) at the quadpoints.

Definition at line 66 of file PorousFlowVariableBase.h.

◆ _num_components

const unsigned int PorousFlowVariableBase::_num_components
protectedinherited

◆ _num_pf_vars

const unsigned int PorousFlowVariableBase::_num_pf_vars
protectedinherited

◆ _num_phases

const unsigned int PorousFlowVariableBase::_num_phases
protectedinherited

◆ _p0var

const unsigned int PorousFlow2PhasePP::_p0var
protected

PorousFlow variable number of the phase0 porepressure.

Definition at line 47 of file PorousFlow2PhasePP.h.

Referenced by computeQpProperties().

◆ _p1var

const unsigned int PorousFlow2PhasePP::_p1var
protected

PorousFlow variable number of the phase1 porepressure.

Definition at line 55 of file PorousFlow2PhasePP.h.

Referenced by computeQpProperties().

◆ _pc_uo

const PorousFlowCapillaryPressure& PorousFlow2PhasePP::_pc_uo
protected

Capillary pressure UserObject.

Definition at line 57 of file PorousFlow2PhasePP.h.

Referenced by buildQpPPSS(), and computeQpProperties().

◆ _phase0_gradp_qp

const VariableGradient& PorousFlow2PhasePP::_phase0_gradp_qp
protected

Gradient(phase0_porepressure) at the qps.

Definition at line 43 of file PorousFlow2PhasePP.h.

Referenced by computeQpProperties().

◆ _phase0_porepressure

const VariableValue& PorousFlow2PhasePP::_phase0_porepressure
protected

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

Definition at line 41 of file PorousFlow2PhasePP.h.

Referenced by buildQpPPSS().

◆ _phase0_porepressure_varnum

const unsigned int PorousFlow2PhasePP::_phase0_porepressure_varnum
protected

Moose variable number of the phase0 porepressure.

Definition at line 45 of file PorousFlow2PhasePP.h.

Referenced by computeQpProperties().

◆ _phase1_gradp_qp

const VariableGradient& PorousFlow2PhasePP::_phase1_gradp_qp
protected

Gradient(phase1_porepressure) at the qps.

Definition at line 51 of file PorousFlow2PhasePP.h.

Referenced by computeQpProperties().

◆ _phase1_porepressure

const VariableValue& PorousFlow2PhasePP::_phase1_porepressure
protected

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

Definition at line 49 of file PorousFlow2PhasePP.h.

Referenced by buildQpPPSS().

◆ _phase1_porepressure_varnum

const unsigned int PorousFlow2PhasePP::_phase1_porepressure_varnum
protected

Moose variable number of the phase1 porepressure.

Definition at line 53 of file PorousFlow2PhasePP.h.

Referenced by computeQpProperties().

◆ _porepressure

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

◆ _saturation

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

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