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

Material designed to calculate fluid-phase porepressures and saturations at nodes and qps using a specified capillary pressure formulation. More...

#include <PorousFlow2PhasePS.h>

Inheritance diagram for PorousFlow2PhasePS:
[legend]

Public Member Functions

 PorousFlow2PhasePS (const InputParameters &parameters)
 

Protected Member Functions

void buildQpPPSS ()
 Assemble std::vectors of porepressure and saturation at the nodes and quadpoints. More...
 
virtual Real effectiveSaturation (Real saturation) const
 Effective saturation of liquid phase. More...
 
virtual void initQpStatefulProperties () override
 
virtual void computeQpProperties () override
 

Protected Attributes

const VariableValue & _phase0_porepressure
 Nodal or quadpoint value of porepressure of the zero phase (eg, the gas 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 _pvar
 PorousFlow variable number of the phase0 porepressure. More...
 
const VariableValue & _phase1_saturation
 Nodal or quadpoint value of saturation of the one phase (eg, the water phase) More...
 
const VariableGradient & _phase1_grads_qp
 Gradient(phase1_saturation) at the qps. More...
 
const unsigned int _phase1_saturation_varnum
 Moose variable number of the phase1 saturation. More...
 
const unsigned int _svar
 PorousFlow variable number of the phase1 saturation. More...
 
const Real _sat_lr
 Liquid residual saturation. More...
 
const Real _dseff_ds
 Derivative of effective saturation with respect to saturation. 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

Material designed to calculate fluid-phase porepressures and saturations at nodes and qps using a specified capillary pressure formulation.

Definition at line 25 of file PorousFlow2PhasePS.h.

Constructor & Destructor Documentation

◆ PorousFlow2PhasePS()

PorousFlow2PhasePS::PorousFlow2PhasePS ( const InputParameters &  parameters)

Definition at line 37 of file PorousFlow2PhasePS.C.

38  : PorousFlowVariableBase(parameters),
39 
40  _phase0_porepressure(_nodal_material ? coupledNodalValue("phase0_porepressure")
41  : coupledValue("phase0_porepressure")),
42  _phase0_gradp_qp(coupledGradient("phase0_porepressure")),
43  _phase0_porepressure_varnum(coupled("phase0_porepressure")),
44  _pvar(_dictator.isPorousFlowVariable(_phase0_porepressure_varnum)
45  ? _dictator.porousFlowVariableNum(_phase0_porepressure_varnum)
46  : 0),
47 
48  _phase1_saturation(_nodal_material ? coupledNodalValue("phase1_saturation")
49  : coupledValue("phase1_saturation")),
50  _phase1_grads_qp(coupledGradient("phase1_saturation")),
51  _phase1_saturation_varnum(coupled("phase1_saturation")),
52  _svar(_dictator.isPorousFlowVariable(_phase1_saturation_varnum)
53  ? _dictator.porousFlowVariableNum(_phase1_saturation_varnum)
54  : 0),
55 
56  _sat_lr(getParam<Real>("sat_lr")),
57  _dseff_ds(1.0 / (1.0 - _sat_lr)),
58  _pc_uo(getUserObject<PorousFlowCapillaryPressure>("capillary_pressure"))
59 {
60  if (_dictator.numPhases() != 2)
61  mooseError("The Dictator proclaims that the number of phases is ",
62  _dictator.numPhases(),
63  " whereas PorousFlow2PhasePS can only be used for 2-phase simulation. Be aware "
64  "that the Dictator has noted your mistake.");
65 }
const unsigned int _pvar
PorousFlow variable number of the phase0 porepressure.
const VariableGradient & _phase0_gradp_qp
Gradient(phase0_porepressure) at the qps.
const VariableValue & _phase0_porepressure
Nodal or quadpoint value of porepressure of the zero phase (eg, the gas phase)
const unsigned int _phase0_porepressure_varnum
Moose variable number of the phase0 porepressure.
Base class for capillary pressure for multiphase flow in porous media.
PorousFlowVariableBase(const InputParameters &parameters)
const Real _sat_lr
Liquid residual saturation.
const PorousFlowCapillaryPressure & _pc_uo
Capillary pressure UserObject.
const VariableValue & _phase1_saturation
Nodal or quadpoint value of saturation of the one phase (eg, the water phase)
const unsigned int _svar
PorousFlow variable number of the phase1 saturation.
const unsigned int _phase1_saturation_varnum
Moose variable number of the phase1 saturation.
const VariableGradient & _phase1_grads_qp
Gradient(phase1_saturation) at the qps.
const Real _dseff_ds
Derivative of effective saturation with respect to saturation.

Member Function Documentation

◆ buildQpPPSS()

void PorousFlow2PhasePS::buildQpPPSS ( )
protected

Assemble std::vectors of porepressure and saturation at the nodes and quadpoints.

Definition at line 124 of file PorousFlow2PhasePS.C.

Referenced by computeQpProperties(), and initQpStatefulProperties().

125 {
126  _saturation[_qp][0] = 1.0 - _phase1_saturation[_qp];
127  _saturation[_qp][1] = _phase1_saturation[_qp];
128  const Real pc = _pc_uo.capillaryPressure(_phase1_saturation[_qp]);
129  _porepressure[_qp][0] = _phase0_porepressure[_qp];
130  _porepressure[_qp][1] = _phase0_porepressure[_qp] - pc;
131 }
const VariableValue & _phase0_porepressure
Nodal or quadpoint value of porepressure of the zero phase (eg, the gas phase)
MaterialProperty< std::vector< Real > > & _saturation
Computed nodal or qp saturation of the phases.
virtual Real capillaryPressure(Real saturation, unsigned qp=0) const
Capillary pressure is calculated as a function of true saturation.
const PorousFlowCapillaryPressure & _pc_uo
Capillary pressure UserObject.
const VariableValue & _phase1_saturation
Nodal or quadpoint value of saturation of the one phase (eg, the water phase)
MaterialProperty< std::vector< Real > > & _porepressure
Computed nodal or quadpoint values of porepressure of the phases.

◆ computeQpProperties()

void PorousFlow2PhasePS::computeQpProperties ( )
overrideprotectedvirtual

Reimplemented from PorousFlowVariableBase.

Definition at line 75 of file PorousFlow2PhasePS.C.

76 {
77  // size stuff correctly and prepare the derivative matrices with zeroes
79 
80  buildQpPPSS();
81  const Real dpc = _pc_uo.dCapillaryPressure(_phase1_saturation[_qp]);
82 
83  if (!_nodal_material)
84  {
85  (*_grads_qp)[_qp][0] = -_phase1_grads_qp[_qp];
86  (*_grads_qp)[_qp][1] = _phase1_grads_qp[_qp];
87  (*_gradp_qp)[_qp][0] = _phase0_gradp_qp[_qp];
88  (*_gradp_qp)[_qp][1] = _phase0_gradp_qp[_qp] - dpc * (*_grads_qp)[_qp][1];
89  }
90 
91  // _porepressure depends on _phase0_porepressure, and its derivative is 1
92  if (_dictator.isPorousFlowVariable(_phase0_porepressure_varnum))
93  {
94  // _phase0_porepressure is a PorousFlow variable
95  for (unsigned phase = 0; phase < _num_phases; ++phase)
96  {
97  _dporepressure_dvar[_qp][phase][_pvar] = 1.0;
98  if (!_nodal_material)
99  (*_dgradp_qp_dgradv)[_qp][phase][_pvar] = 1.0;
100  }
101  }
102 
103  // _saturation is only dependent on _phase1_saturation, and its derivative is +/- 1
104  if (_dictator.isPorousFlowVariable(_phase1_saturation_varnum))
105  {
106  // _phase1_saturation is a porflow variable
107  // _phase1_porepressure depends on saturation through the capillary pressure function
108  _dsaturation_dvar[_qp][0][_svar] = -1.0;
109  _dsaturation_dvar[_qp][1][_svar] = 1.0;
110  _dporepressure_dvar[_qp][1][_svar] = -dpc;
111 
112  if (!_nodal_material)
113  {
114  (*_dgrads_qp_dgradv)[_qp][0][_svar] = -1.0;
115  (*_dgrads_qp_dgradv)[_qp][1][_svar] = 1.0;
116  const Real d2pc_qp = _pc_uo.d2CapillaryPressure(_phase1_saturation[_qp]);
117  (*_dgradp_qp_dv)[_qp][1][_svar] = -d2pc_qp * (*_grads_qp)[_qp][1];
118  (*_dgradp_qp_dgradv)[_qp][1][_svar] = -dpc;
119  }
120  }
121 }
const unsigned int _pvar
PorousFlow variable number of the phase0 porepressure.
MaterialProperty< std::vector< std::vector< Real > > > & _dporepressure_dvar
d(porepressure)/d(PorousFlow variable)
void buildQpPPSS()
Assemble std::vectors of porepressure and saturation at the nodes and quadpoints. ...
const VariableGradient & _phase0_gradp_qp
Gradient(phase0_porepressure) at the qps.
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)
const PorousFlowCapillaryPressure & _pc_uo
Capillary pressure UserObject.
const VariableValue & _phase1_saturation
Nodal or quadpoint value of saturation of the one phase (eg, the water phase)
const unsigned int _svar
PorousFlow variable number of the phase1 saturation.
virtual void computeQpProperties() override
const unsigned int _phase1_saturation_varnum
Moose variable number of the phase1 saturation.
const VariableGradient & _phase1_grads_qp
Gradient(phase1_saturation) at the qps.
virtual Real d2CapillaryPressure(Real saturation, unsigned qp=0) const
Second derivative of capillary pressure wrt true saturation.
virtual Real dCapillaryPressure(Real saturation, unsigned qp=0) const
Derivative of capillary pressure wrt true saturation.
const unsigned int _num_phases
Number of phases.

◆ effectiveSaturation()

Real PorousFlow2PhasePS::effectiveSaturation ( Real  saturation) const
protectedvirtual

Effective saturation of liquid phase.

Parameters
saturationtrue saturation
Returns
effective saturation

Definition at line 134 of file PorousFlow2PhasePS.C.

135 {
136  return (saturation - _sat_lr) / (1.0 - _sat_lr);
137 }
const Real _sat_lr
Liquid residual saturation.

◆ initQpStatefulProperties()

void PorousFlow2PhasePS::initQpStatefulProperties ( )
overrideprotectedvirtual

Reimplemented from PorousFlowVariableBase.

Definition at line 68 of file PorousFlow2PhasePS.C.

69 {
71  buildQpPPSS();
72 }
void buildQpPPSS()
Assemble std::vectors of porepressure and saturation at the nodes and quadpoints. ...
virtual void initQpStatefulProperties() override

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

◆ _dseff_ds

const Real PorousFlow2PhasePS::_dseff_ds
protected

Derivative of effective saturation with respect to saturation.

Definition at line 66 of file PorousFlow2PhasePS.h.

◆ _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

◆ _pc_uo

const PorousFlowCapillaryPressure& PorousFlow2PhasePS::_pc_uo
protected

Capillary pressure UserObject.

Definition at line 68 of file PorousFlow2PhasePS.h.

Referenced by buildQpPPSS(), and computeQpProperties().

◆ _phase0_gradp_qp

const VariableGradient& PorousFlow2PhasePS::_phase0_gradp_qp
protected

Gradient(phase0_porepressure) at the qps.

Definition at line 50 of file PorousFlow2PhasePS.h.

Referenced by computeQpProperties().

◆ _phase0_porepressure

const VariableValue& PorousFlow2PhasePS::_phase0_porepressure
protected

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

Definition at line 48 of file PorousFlow2PhasePS.h.

Referenced by buildQpPPSS().

◆ _phase0_porepressure_varnum

const unsigned int PorousFlow2PhasePS::_phase0_porepressure_varnum
protected

Moose variable number of the phase0 porepressure.

Definition at line 52 of file PorousFlow2PhasePS.h.

Referenced by computeQpProperties().

◆ _phase1_grads_qp

const VariableGradient& PorousFlow2PhasePS::_phase1_grads_qp
protected

Gradient(phase1_saturation) at the qps.

Definition at line 58 of file PorousFlow2PhasePS.h.

Referenced by computeQpProperties().

◆ _phase1_saturation

const VariableValue& PorousFlow2PhasePS::_phase1_saturation
protected

Nodal or quadpoint value of saturation of the one phase (eg, the water phase)

Definition at line 56 of file PorousFlow2PhasePS.h.

Referenced by buildQpPPSS(), and computeQpProperties().

◆ _phase1_saturation_varnum

const unsigned int PorousFlow2PhasePS::_phase1_saturation_varnum
protected

Moose variable number of the phase1 saturation.

Definition at line 60 of file PorousFlow2PhasePS.h.

Referenced by computeQpProperties().

◆ _porepressure

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

◆ _pvar

const unsigned int PorousFlow2PhasePS::_pvar
protected

PorousFlow variable number of the phase0 porepressure.

Definition at line 54 of file PorousFlow2PhasePS.h.

Referenced by computeQpProperties().

◆ _sat_lr

const Real PorousFlow2PhasePS::_sat_lr
protected

Liquid residual saturation.

Definition at line 64 of file PorousFlow2PhasePS.h.

Referenced by effectiveSaturation().

◆ _saturation

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

◆ _svar

const unsigned int PorousFlow2PhasePS::_svar
protected

PorousFlow variable number of the phase1 saturation.

Definition at line 62 of file PorousFlow2PhasePS.h.

Referenced by computeQpProperties().


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