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 Real capillaryPressure (Real saturation) const
 Capillary pressure as a function of saturation. More...
 
virtual Real dCapillaryPressure_dS (Real seff) const
 Derivative of capillary pressure wrt to saturation. More...
 
virtual Real d2CapillaryPressure_dS2 (Real saturation) const
 Second derivative of capillary pressure wrt to saturation. 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 Note: This pointer can be replaced with a reference once the deprecated PS 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

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

Definition at line 24 of file PorousFlow2PhasePS.h.

Constructor & Destructor Documentation

PorousFlow2PhasePS::PorousFlow2PhasePS ( const InputParameters &  parameters)

Definition at line 33 of file PorousFlow2PhasePS.C.

34  : PorousFlowVariableBase(parameters),
35 
36  _phase0_porepressure(_nodal_material ? coupledNodalValue("phase0_porepressure")
37  : coupledValue("phase0_porepressure")),
38  _phase0_gradp_qp(coupledGradient("phase0_porepressure")),
39  _phase0_porepressure_varnum(coupled("phase0_porepressure")),
40  _pvar(_dictator.isPorousFlowVariable(_phase0_porepressure_varnum)
41  ? _dictator.porousFlowVariableNum(_phase0_porepressure_varnum)
42  : 0),
43 
44  _phase1_saturation(_nodal_material ? coupledNodalValue("phase1_saturation")
45  : coupledValue("phase1_saturation")),
46  _phase1_grads_qp(coupledGradient("phase1_saturation")),
47  _phase1_saturation_varnum(coupled("phase1_saturation")),
48  _svar(_dictator.isPorousFlowVariable(_phase1_saturation_varnum)
49  ? _dictator.porousFlowVariableNum(_phase1_saturation_varnum)
50  : 0),
51 
52  _sat_lr(getParam<Real>("sat_lr")),
53  _dseff_ds(1.0 / (1.0 - _sat_lr)),
54  _pc_uo(parameters.isParamSetByUser("capillary_pressure")
55  ? &getUserObject<PorousFlowCapillaryPressure>("capillary_pressure")
56  : nullptr)
57 {
58  if (_dictator.numPhases() != 2)
59  mooseError("The Dictator proclaims that the number of phases is ",
60  _dictator.numPhases(),
61  " whereas PorousFlow2PhasePS can only be used for 2-phase simulation. Be aware "
62  "that the Dictator has noted your mistake.");
63 }
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 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 PorousFlowCapillaryPressure * _pc_uo
Capillary pressure UserObject Note: This pointer can be replaced with a reference once the deprecated...
const Real _dseff_ds
Derivative of effective saturation with respect to saturation.

Member Function Documentation

void PorousFlow2PhasePS::buildQpPPSS ( )
protected

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

Definition at line 122 of file PorousFlow2PhasePS.C.

Referenced by computeQpProperties(), and initQpStatefulProperties().

123 {
124  _saturation[_qp][0] = 1.0 - _phase1_saturation[_qp];
125  _saturation[_qp][1] = _phase1_saturation[_qp];
126  const Real pc = capillaryPressure(_phase1_saturation[_qp]);
127  _porepressure[_qp][0] = _phase0_porepressure[_qp];
128  _porepressure[_qp][1] = _phase0_porepressure[_qp] - pc;
129 }
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.
const VariableValue & _phase1_saturation
Nodal or quadpoint value of saturation of the one phase (eg, the water phase)
virtual Real capillaryPressure(Real saturation) const
Capillary pressure as a function of saturation.
MaterialProperty< std::vector< Real > > & _porepressure
Computed nodal or quadpoint values of porepressure of the phases.
Real PorousFlow2PhasePS::capillaryPressure ( Real  saturation) const
protectedvirtual

Capillary pressure as a function of saturation.

Default is constant capillary pressure = 0.0. Override in derived classes to implement other capillary pressure forulations

Parameters
saturationtrue saturation
Returns
capillary pressure (Pa)

Reimplemented in PorousFlow2PhasePS_VG.

Definition at line 138 of file PorousFlow2PhasePS.C.

Referenced by buildQpPPSS().

139 {
141 }
virtual Real capillaryPressure(Real saturation) const
Capillary pressure is calculated as a function of true saturation.
const PorousFlowCapillaryPressure * _pc_uo
Capillary pressure UserObject Note: This pointer can be replaced with a reference once the deprecated...
void FORTRAN_CALL() saturation(double &P, double &T, int &N, int &nerr)
void PorousFlow2PhasePS::computeQpProperties ( )
overrideprotectedvirtual

Reimplemented from PorousFlowVariableBase.

Definition at line 73 of file PorousFlow2PhasePS.C.

74 {
75  // size stuff correctly and prepare the derivative matrices with zeroes
77 
78  buildQpPPSS();
79  const Real dpc = dCapillaryPressure_dS(_phase1_saturation[_qp]);
80 
81  if (!_nodal_material)
82  {
83  (*_grads_qp)[_qp][0] = -_phase1_grads_qp[_qp];
84  (*_grads_qp)[_qp][1] = _phase1_grads_qp[_qp];
85  (*_gradp_qp)[_qp][0] = _phase0_gradp_qp[_qp];
86  (*_gradp_qp)[_qp][1] = _phase0_gradp_qp[_qp] - dpc * (*_grads_qp)[_qp][1];
87  }
88 
89  // _porepressure depends on _phase0_porepressure, and its derivative is 1
90  if (_dictator.isPorousFlowVariable(_phase0_porepressure_varnum))
91  {
92  // _phase0_porepressure is a PorousFlow variable
93  for (unsigned phase = 0; phase < _num_phases; ++phase)
94  {
95  _dporepressure_dvar[_qp][phase][_pvar] = 1.0;
96  if (!_nodal_material)
97  (*_dgradp_qp_dgradv)[_qp][phase][_pvar] = 1.0;
98  }
99  }
100 
101  // _saturation is only dependent on _phase1_saturation, and its derivative is +/- 1
102  if (_dictator.isPorousFlowVariable(_phase1_saturation_varnum))
103  {
104  // _phase1_saturation is a porflow variable
105  // _phase1_porepressure depends on saturation through the capillary pressure function
106  _dsaturation_dvar[_qp][0][_svar] = -1.0;
107  _dsaturation_dvar[_qp][1][_svar] = 1.0;
108  _dporepressure_dvar[_qp][1][_svar] = -dpc;
109 
110  if (!_nodal_material)
111  {
112  (*_dgrads_qp_dgradv)[_qp][0][_svar] = -1.0;
113  (*_dgrads_qp_dgradv)[_qp][1][_svar] = 1.0;
114  const Real d2pc_qp = d2CapillaryPressure_dS2(_phase1_saturation[_qp]);
115  (*_dgradp_qp_dv)[_qp][1][_svar] = -d2pc_qp * (*_grads_qp)[_qp][1];
116  (*_dgradp_qp_dgradv)[_qp][1][_svar] = -dpc;
117  }
118  }
119 }
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 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.
const unsigned int _num_phases
Number of phases.
virtual Real d2CapillaryPressure_dS2(Real saturation) const
Second derivative of capillary pressure wrt to saturation.
virtual Real dCapillaryPressure_dS(Real seff) const
Derivative of capillary pressure wrt to saturation.
Real PorousFlow2PhasePS::d2CapillaryPressure_dS2 ( Real  saturation) const
protectedvirtual

Second derivative of capillary pressure wrt to saturation.

Override in derived classes to implement other capillary pressure forulations

Parameters
saturationtrue saturation
Returns
second derivative of capillary pressure wrt saturation

Reimplemented in PorousFlow2PhasePS_VG.

Definition at line 150 of file PorousFlow2PhasePS.C.

Referenced by computeQpProperties().

151 {
153 }
virtual Real d2CapillaryPressure(Real saturation) const
Second derivative of capillary pressure wrt true saturation.
const PorousFlowCapillaryPressure * _pc_uo
Capillary pressure UserObject Note: This pointer can be replaced with a reference once the deprecated...
void FORTRAN_CALL() saturation(double &P, double &T, int &N, int &nerr)
Real PorousFlow2PhasePS::dCapillaryPressure_dS ( Real  seff) const
protectedvirtual

Derivative of capillary pressure wrt to saturation.

Override in derived classes to implement other capillary pressure forulations

Parameters
saturationtrue saturation
Returns
derivative of capillary pressure wrt saturation

Reimplemented in PorousFlow2PhasePS_VG.

Definition at line 144 of file PorousFlow2PhasePS.C.

Referenced by computeQpProperties().

145 {
147 }
virtual Real dCapillaryPressure(Real saturation) const
Derivative of capillary pressure wrt true saturation.
const PorousFlowCapillaryPressure * _pc_uo
Capillary pressure UserObject Note: This pointer can be replaced with a reference once the deprecated...
void FORTRAN_CALL() saturation(double &P, double &T, int &N, int &nerr)
Real PorousFlow2PhasePS::effectiveSaturation ( Real  saturation) const
protectedvirtual

Effective saturation of liquid phase.

Parameters
saturationtrue saturation
Returns
effective saturation

Definition at line 132 of file PorousFlow2PhasePS.C.

Referenced by PorousFlow2PhasePS_VG::capillaryPressure(), PorousFlow2PhasePS_VG::d2CapillaryPressure_dS2(), and PorousFlow2PhasePS_VG::dCapillaryPressure_dS().

133 {
134  return (saturation - _sat_lr) / (1.0 - _sat_lr);
135 }
const Real _sat_lr
Liquid residual saturation.
void FORTRAN_CALL() saturation(double &P, double &T, int &N, int &nerr)
void PorousFlow2PhasePS::initQpStatefulProperties ( )
overrideprotectedvirtual

Reimplemented from PorousFlowVariableBase.

Definition at line 66 of file PorousFlow2PhasePS.C.

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

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
const Real PorousFlow2PhasePS::_dseff_ds
protected

Derivative of effective saturation with respect to saturation.

Definition at line 93 of file PorousFlow2PhasePS.h.

Referenced by PorousFlow2PhasePS_VG::d2CapillaryPressure_dS2(), and PorousFlow2PhasePS_VG::dCapillaryPressure_dS().

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 PorousFlowCapillaryPressure* PorousFlow2PhasePS::_pc_uo
protected

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

Definition at line 97 of file PorousFlow2PhasePS.h.

Referenced by capillaryPressure(), d2CapillaryPressure_dS2(), and dCapillaryPressure_dS().

const VariableGradient& PorousFlow2PhasePS::_phase0_gradp_qp
protected

Gradient(phase0_porepressure) at the qps.

Definition at line 77 of file PorousFlow2PhasePS.h.

Referenced by computeQpProperties().

const VariableValue& PorousFlow2PhasePS::_phase0_porepressure
protected

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

Definition at line 75 of file PorousFlow2PhasePS.h.

Referenced by buildQpPPSS().

const unsigned int PorousFlow2PhasePS::_phase0_porepressure_varnum
protected

Moose variable number of the phase0 porepressure.

Definition at line 79 of file PorousFlow2PhasePS.h.

Referenced by computeQpProperties().

const VariableGradient& PorousFlow2PhasePS::_phase1_grads_qp
protected

Gradient(phase1_saturation) at the qps.

Definition at line 85 of file PorousFlow2PhasePS.h.

Referenced by computeQpProperties().

const VariableValue& PorousFlow2PhasePS::_phase1_saturation
protected

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

Definition at line 83 of file PorousFlow2PhasePS.h.

Referenced by buildQpPPSS(), and computeQpProperties().

const unsigned int PorousFlow2PhasePS::_phase1_saturation_varnum
protected

Moose variable number of the phase1 saturation.

Definition at line 87 of file PorousFlow2PhasePS.h.

Referenced by computeQpProperties().

MaterialProperty<std::vector<Real> >& PorousFlowVariableBase::_porepressure
protectedinherited
const unsigned int PorousFlow2PhasePS::_pvar
protected

PorousFlow variable number of the phase0 porepressure.

Definition at line 81 of file PorousFlow2PhasePS.h.

Referenced by computeQpProperties().

const Real PorousFlow2PhasePS::_sat_lr
protected

Liquid residual saturation.

Definition at line 91 of file PorousFlow2PhasePS.h.

Referenced by effectiveSaturation().

MaterialProperty<std::vector<Real> >& PorousFlowVariableBase::_saturation
protectedinherited
const unsigned int PorousFlow2PhasePS::_svar
protected

PorousFlow variable number of the phase1 saturation.

Definition at line 89 of file PorousFlow2PhasePS.h.

Referenced by computeQpProperties().


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