Skip to content
Permalink
Browse files

Merge pull request #13013 from cpgr/pfps

Make PorousFlow2PhasePS consistent with PorousFlow2PhasePP
  • Loading branch information...
andrsd committed Mar 8, 2019
2 parents 1b95810 + 0bf4a78 commit 69845499ca76eff86d86970cc4ec861bd9823c71
@@ -34,36 +34,25 @@ class PorousFlow2PhasePS : public PorousFlowVariableBase
*/
void buildQpPPSS();

/**
* Effective saturation of liquid phase
* @param saturation true saturation
* @return effective saturation
*/
virtual Real effectiveSaturation(Real saturation) const;

virtual void initQpStatefulProperties() override;
virtual void computeQpProperties() override;

/// Nodal or quadpoint value of porepressure of the zero phase (eg, the gas phase)
/// Nodal or quadpoint value of porepressure of phase zero (eg, the liquid phase)
const VariableValue & _phase0_porepressure;
/// Gradient(phase0_porepressure) at the qps
const VariableGradient & _phase0_gradp_qp;
/// Moose variable number of the phase0 porepressure
const unsigned int _phase0_porepressure_varnum;
/// PorousFlow variable number of the phase0 porepressure
const unsigned int _pvar;
/// Nodal or quadpoint value of saturation of the one phase (eg, the water phase)
/// Nodal or quadpoint value of saturation of phase one (eg, the gas phase)
const VariableValue & _phase1_saturation;
/// Gradient(phase1_saturation) at the qps
const VariableGradient & _phase1_grads_qp;
/// Moose variable number of the phase1 saturation
const unsigned int _phase1_saturation_varnum;
/// PorousFlow variable number of the phase1 saturation
const unsigned int _svar;
/// Liquid residual saturation
const Real _sat_lr;
/// Derivative of effective saturation with respect to saturation
const Real _dseff_ds;
/// Capillary pressure UserObject
const PorousFlowCapillaryPressure & _pc_uo;
};
@@ -18,14 +18,9 @@ validParams<PorousFlow2PhasePS>()
{
InputParameters params = validParams<PorousFlowVariableBase>();
params.addRequiredCoupledVar("phase0_porepressure",
"Variable that is the porepressure of phase 0 (eg, the gas phase)");
"Variable that is the porepressure of phase 0 (the liquid phase)");
params.addRequiredCoupledVar("phase1_saturation",
"Variable that is the saturation of phase 1 (eg, the water phase)");
params.addRangeCheckedParam<Real>(
"sat_lr",
0.0,
"sat_lr >= 0 & sat_lr <= 1",
"Liquid residual saturation. Must be between 0 and 1. Default is 0");
"Variable that is the saturation of phase 1 (the gas phase)");
params.addRequiredParam<UserObjectName>("capillary_pressure",
"Name of the UserObject defining the capillary pressure");
params.addClassDescription("This Material calculates the 2 porepressures and the 2 saturations "
@@ -53,8 +48,6 @@ PorousFlow2PhasePS::PorousFlow2PhasePS(const InputParameters & parameters)
? _dictator.porousFlowVariableNum(_phase1_saturation_varnum)
: 0),

_sat_lr(getParam<Real>("sat_lr")),
_dseff_ds(1.0 / (1.0 - _sat_lr)),
_pc_uo(getUserObject<PorousFlowCapillaryPressure>("capillary_pressure"))
{
if (_dictator.numPhases() != 2)
@@ -78,7 +71,7 @@ PorousFlow2PhasePS::computeQpProperties()
PorousFlowVariableBase::computeQpProperties();

buildQpPPSS();
const Real dpc = _pc_uo.dCapillaryPressure(_phase1_saturation[_qp]);
const Real dpc = _pc_uo.dCapillaryPressure(1.0 - _phase1_saturation[_qp]);

if (!_nodal_material)
{
@@ -103,7 +96,7 @@ PorousFlow2PhasePS::computeQpProperties()
// _saturation is only dependent on _phase1_saturation, and its derivative is +/- 1
if (_dictator.isPorousFlowVariable(_phase1_saturation_varnum))
{
// _phase1_saturation is a porflow variable
// _phase1_saturation is a PorousFlow variable
// _phase1_porepressure depends on saturation through the capillary pressure function
_dsaturation_dvar[_qp][0][_svar] = -1.0;
_dsaturation_dvar[_qp][1][_svar] = 1.0;
@@ -113,8 +106,8 @@ PorousFlow2PhasePS::computeQpProperties()
{
(*_dgrads_qp_dgradv)[_qp][0][_svar] = -1.0;
(*_dgrads_qp_dgradv)[_qp][1][_svar] = 1.0;
const Real d2pc_qp = _pc_uo.d2CapillaryPressure(_phase1_saturation[_qp]);
(*_dgradp_qp_dv)[_qp][1][_svar] = -d2pc_qp * (*_grads_qp)[_qp][1];
const Real d2pc_qp = _pc_uo.d2CapillaryPressure(1.0 - _phase1_saturation[_qp]);
(*_dgradp_qp_dv)[_qp][1][_svar] = d2pc_qp * (*_grads_qp)[_qp][1];
(*_dgradp_qp_dgradv)[_qp][1][_svar] = -dpc;
}
}
@@ -125,13 +118,7 @@ PorousFlow2PhasePS::buildQpPPSS()
{
_saturation[_qp][0] = 1.0 - _phase1_saturation[_qp];
_saturation[_qp][1] = _phase1_saturation[_qp];
const Real pc = _pc_uo.capillaryPressure(_phase1_saturation[_qp]);
const Real pc = _pc_uo.capillaryPressure(1.0 - _phase1_saturation[_qp]);
_porepressure[_qp][0] = _phase0_porepressure[_qp];
_porepressure[_qp][1] = _phase0_porepressure[_qp] - pc;
}

Real
PorousFlow2PhasePS::effectiveSaturation(Real saturation) const
{
return (saturation - _sat_lr) / (1.0 - _sat_lr);
_porepressure[_qp][1] = _phase0_porepressure[_qp] + pc;
}
@@ -17,7 +17,7 @@ validParams<PorousFlowCapillaryPressure>()
params.addRangeCheckedParam<Real>(
"sat_lr",
0.0,
"sat_lr >= 0 & sat_lr <= 1",
"sat_lr >= 0 & sat_lr < 1",
"Liquid residual saturation. Must be between 0 and 1. Default is 0");
params.addRangeCheckedParam<Real>("pc_max",
1.0e9,
Binary file not shown.
Oops, something went wrong.

0 comments on commit 6984549

Please sign in to comment.
You can’t perform that action at this time.