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

Rogers-Stallybrass-Clements form of capillary pressure. More...

#include <PorousFlowCapillaryPressureRSC.h>

Inheritance diagram for PorousFlowCapillaryPressureRSC:
[legend]

Public Member Functions

 PorousFlowCapillaryPressureRSC (const InputParameters &parameters)
 
virtual Real capillaryPressureCurve (Real saturation) const override
 Raw capillary pressure curve (does not include logarithmic extension) More...
 
virtual Real dCapillaryPressureCurve (Real saturation) const override
 Derivative of raw capillary pressure wrt true saturation. More...
 
virtual Real d2CapillaryPressureCurve (Real saturation) const override
 Second derivative of raw capillary pressure wrt true saturation. More...
 
virtual Real effectiveSaturation (Real pc) const override
 Effective saturation as a function of capillary pressure. More...
 
virtual Real dEffectiveSaturation (Real pc) const override
 Derivative of effective saturation wrt capillary pressure. More...
 
virtual Real d2EffectiveSaturation (Real pc) const override
 Second derivative of effective saturation wrt capillary pressure. More...
 
virtual void initialize () final
 
virtual void execute () final
 
virtual void finalize () final
 
virtual void initialSetup () override
 
virtual Real capillaryPressure (Real saturation) const
 Capillary pressure is calculated as a function of true saturation. More...
 
virtual Real dCapillaryPressure (Real saturation) const
 Derivative of capillary pressure wrt true saturation. More...
 
virtual Real d2CapillaryPressure (Real saturation) const
 Second derivative of capillary pressure wrt true saturation. More...
 

Protected Member Functions

Real effectiveSaturationFromSaturation (Real saturation) const
 Effective saturation of liquid phase given liquid saturation and residual liquid saturation. More...
 
Real extensionSaturation () const
 Calculates the saturation where the logarithmic extension to capillary pressure meets the raw curve using Newton's method. More...
 
Real interceptFunction (Real s) const
 Calculates the saturation where the logarithmic extension to capillary pressure at low saturation. More...
 
Real interceptFunctionDeriv (Real s) const
 Calculates the saturation where the logarithmic extension to capillary pressure at low saturation. More...
 
Real capillaryPressureLogExt (Real s) const
 The capillary pressure in the logarithmic extension. More...
 
Real dCapillaryPressureLogExt (Real s) const
 The derivative of capillary pressure in the logarithmic extension. More...
 
Real d2CapillaryPressureLogExt (Real s) const
 The second derivative of capillary pressure in the logarithmic extension. More...
 

Protected Attributes

const Real _oil_viscosity
 Oil viscosity (which must be twice the water viscocity in this formulation) More...
 
const Real _scale_ratio
 Scale ratio: porosity/permeability/beta^2, where beta is chosen by the user. More...
 
const Real _shift
 Shift. seff_water = 1/Sqrt(1 + Exp((Pc - shift)/scale)), where scale = 0.25 * scale_ratio * oil_viscosity. More...
 
const Real _scale
 Scale = 0.25 * scale_ratio * oil_viscosity. More...
 
const Real _sat_lr
 Liquid residual saturation. More...
 
const Real _dseff_ds
 Derivative of effective saturation with respect to saturation. More...
 
bool _log_ext
 Flag to use a logarithmic extension for low saturation. More...
 
const Real _pc_max
 Maximum capillary pressure (Pa). Note: must be <= 0. More...
 
Real _sat_ext
 Saturation where the logarithmic extension meets the raw curve. More...
 
Real _pc_ext
 Capillary pressure where the extension meets the raw curve. More...
 
Real _slope_ext
 Gradient of the logarithmic extension. More...
 
const Real _log10
 log(10) More...
 

Detailed Description

Rogers-Stallybrass-Clements form of capillary pressure.

Definition at line 21 of file PorousFlowCapillaryPressureRSC.h.

Constructor & Destructor Documentation

PorousFlowCapillaryPressureRSC::PorousFlowCapillaryPressureRSC ( const InputParameters &  parameters)

Definition at line 32 of file PorousFlowCapillaryPressureRSC.C.

33  : PorousFlowCapillaryPressure(parameters),
34  _oil_viscosity(getParam<Real>("oil_viscosity")),
35  _scale_ratio(getParam<Real>("scale_ratio")),
36  _shift(getParam<Real>("shift")),
38 {
39  // Set _log_ext to false as no capillary pressure curves are implmented in this class
40  _log_ext = false;
41 }
const Real _oil_viscosity
Oil viscosity (which must be twice the water viscocity in this formulation)
const Real _shift
Shift. seff_water = 1/Sqrt(1 + Exp((Pc - shift)/scale)), where scale = 0.25 * scale_ratio * oil_visco...
PorousFlowCapillaryPressure(const InputParameters &parameters)
bool _log_ext
Flag to use a logarithmic extension for low saturation.
const Real _scale_ratio
Scale ratio: porosity/permeability/beta^2, where beta is chosen by the user.
const Real _scale
Scale = 0.25 * scale_ratio * oil_viscosity.

Member Function Documentation

Real PorousFlowCapillaryPressure::capillaryPressure ( Real  saturation) const
virtualinherited

Capillary pressure is calculated as a function of true saturation.

Note that this method includes the ability to use a logarithmic extension at low saturation.

Parameters
saturationtrue saturation
Returns
capillary pressure (Pa)

Definition at line 59 of file PorousFlowCapillaryPressure.C.

Referenced by PorousFlow2PhasePS::capillaryPressure(), PorousFlowCapillaryPressure::finalize(), PorousFlowCapillaryPressure::initialSetup(), PorousFlowFluidStateWaterNCG::thermophysicalProperties(), and PorousFlowFluidStateBrineCO2::thermophysicalProperties().

60 {
61  if (_log_ext && saturation < _sat_ext)
63  else
65 }
Real capillaryPressureLogExt(Real s) const
The capillary pressure in the logarithmic extension.
Real _sat_ext
Saturation where the logarithmic extension meets the raw curve.
bool _log_ext
Flag to use a logarithmic extension for low saturation.
virtual Real capillaryPressureCurve(Real saturation) const =0
Raw capillary pressure curve (does not include logarithmic extension)
void FORTRAN_CALL() saturation(double &P, double &T, int &N, int &nerr)
Real PorousFlowCapillaryPressureRSC::capillaryPressureCurve ( Real  saturation) const
overridevirtual

Raw capillary pressure curve (does not include logarithmic extension)

Parameters
saturationtrue saturation
Returns
capillary pressure (Pa)

Implements PorousFlowCapillaryPressure.

Definition at line 43 of file PorousFlowCapillaryPressureRSC.C.

44 {
45  mooseError("PorousFlowCapillaryPressureRSC::capillaryPressure not implemented");
46  return 0.0;
47 }
Real PorousFlowCapillaryPressure::capillaryPressureLogExt ( Real  s) const
protectedinherited

The capillary pressure in the logarithmic extension.

Parameters
sliquid saturation
Returns
capillary pressure in logarithmic extension

Definition at line 92 of file PorousFlowCapillaryPressure.C.

Referenced by PorousFlowCapillaryPressure::capillaryPressure(), and PorousFlowCapillaryPressure::finalize().

93 {
94  return _pc_ext * std::pow(10.0, _slope_ext * (saturation - _sat_ext));
95 }
Real _slope_ext
Gradient of the logarithmic extension.
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
Real _pc_ext
Capillary pressure where the extension meets the raw curve.
Real _sat_ext
Saturation where the logarithmic extension meets the raw curve.
void FORTRAN_CALL() saturation(double &P, double &T, int &N, int &nerr)
Real PorousFlowCapillaryPressure::d2CapillaryPressure ( Real  saturation) const
virtualinherited

Second derivative of capillary pressure wrt true saturation.

Parameters
saturationtrue saturation
Returns
second derivative of capillary pressure with respect to true saturation

Definition at line 77 of file PorousFlowCapillaryPressure.C.

Referenced by PorousFlowFluidStateFlashBase::computeQpProperties(), PorousFlow2PhasePS::d2CapillaryPressure_dS2(), and PorousFlowCapillaryPressure::finalize().

78 {
79  if (_log_ext && saturation < _sat_ext)
81  else
83 }
Real d2CapillaryPressureLogExt(Real s) const
The second derivative of capillary pressure in the logarithmic extension.
virtual Real d2CapillaryPressureCurve(Real saturation) const =0
Second derivative of raw capillary pressure wrt true saturation.
Real _sat_ext
Saturation where the logarithmic extension meets the raw curve.
bool _log_ext
Flag to use a logarithmic extension for low saturation.
void FORTRAN_CALL() saturation(double &P, double &T, int &N, int &nerr)
Real PorousFlowCapillaryPressureRSC::d2CapillaryPressureCurve ( Real  saturation) const
overridevirtual

Second derivative of raw capillary pressure wrt true saturation.

Parameters
saturationtrue saturation
Returns
second derivative of capillary pressure with respect to true saturation

Implements PorousFlowCapillaryPressure.

Definition at line 55 of file PorousFlowCapillaryPressureRSC.C.

56 {
57  mooseError("PorousFlowCapillaryPressureRSC::d2CapillaryPressure not implemented");
58  return 0.0;
59 }
Real PorousFlowCapillaryPressure::d2CapillaryPressureLogExt ( Real  s) const
protectedinherited

The second derivative of capillary pressure in the logarithmic extension.

Parameters
sliquid saturation
Returns
second derivative of capillary pressure in logarithmic extension

Definition at line 104 of file PorousFlowCapillaryPressure.C.

Referenced by PorousFlowCapillaryPressure::d2CapillaryPressure(), and PorousFlowCapillaryPressure::finalize().

105 {
106  return _pc_ext * _slope_ext * _slope_ext * _log10 * _log10 *
107  std::pow(10.0, _slope_ext * (saturation - _sat_ext));
108 }
Real _slope_ext
Gradient of the logarithmic extension.
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
Real _pc_ext
Capillary pressure where the extension meets the raw curve.
Real _sat_ext
Saturation where the logarithmic extension meets the raw curve.
void FORTRAN_CALL() saturation(double &P, double &T, int &N, int &nerr)
Real PorousFlowCapillaryPressureRSC::d2EffectiveSaturation ( Real  pc) const
overridevirtual

Second derivative of effective saturation wrt capillary pressure.

Parameters
pccapillary pressure
Returns
second derivative of effective saturation wrt capillary pressure

Implements PorousFlowCapillaryPressure.

Definition at line 74 of file PorousFlowCapillaryPressureRSC.C.

75 {
77 }
const Real _shift
Shift. seff_water = 1/Sqrt(1 + Exp((Pc - shift)/scale)), where scale = 0.25 * scale_ratio * oil_visco...
Real d2EffectiveSaturation(Real pc, Real shift, Real scale)
Second derivative of effective saturation wrt capillary pressure.
const Real _scale
Scale = 0.25 * scale_ratio * oil_viscosity.
Real PorousFlowCapillaryPressure::dCapillaryPressure ( Real  saturation) const
virtualinherited

Derivative of capillary pressure wrt true saturation.

Parameters
saturationtrue saturation
Returns
derivative of capillary pressure with respect to true saturation

Definition at line 68 of file PorousFlowCapillaryPressure.C.

Referenced by PorousFlowFluidStateFlashBase::computeQpProperties(), PorousFlow2PhasePS::dCapillaryPressure_dS(), and PorousFlowCapillaryPressure::finalize().

69 {
70  if (_log_ext && saturation < _sat_ext)
72  else
74 }
virtual Real dCapillaryPressureCurve(Real saturation) const =0
Derivative of raw capillary pressure wrt true saturation.
Real _sat_ext
Saturation where the logarithmic extension meets the raw curve.
bool _log_ext
Flag to use a logarithmic extension for low saturation.
void FORTRAN_CALL() saturation(double &P, double &T, int &N, int &nerr)
Real dCapillaryPressureLogExt(Real s) const
The derivative of capillary pressure in the logarithmic extension.
Real PorousFlowCapillaryPressureRSC::dCapillaryPressureCurve ( Real  saturation) const
overridevirtual

Derivative of raw capillary pressure wrt true saturation.

Parameters
saturationtrue saturation
Returns
derivative of capillary pressure with respect to true saturation

Implements PorousFlowCapillaryPressure.

Definition at line 49 of file PorousFlowCapillaryPressureRSC.C.

50 {
51  mooseError("PorousFlowCapillaryPressureRSC::dCapillaryPressure not implemented");
52  return 0.0;
53 }
Real PorousFlowCapillaryPressure::dCapillaryPressureLogExt ( Real  s) const
protectedinherited

The derivative of capillary pressure in the logarithmic extension.

Parameters
sliquid saturation
Returns
derivative of capillary pressure in logarithmic extension

Definition at line 98 of file PorousFlowCapillaryPressure.C.

Referenced by PorousFlowCapillaryPressure::dCapillaryPressure(), and PorousFlowCapillaryPressure::finalize().

99 {
100  return _pc_ext * _slope_ext * _log10 * std::pow(10.0, _slope_ext * (saturation - _sat_ext));
101 }
Real _slope_ext
Gradient of the logarithmic extension.
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
Real _pc_ext
Capillary pressure where the extension meets the raw curve.
Real _sat_ext
Saturation where the logarithmic extension meets the raw curve.
void FORTRAN_CALL() saturation(double &P, double &T, int &N, int &nerr)
Real PorousFlowCapillaryPressureRSC::dEffectiveSaturation ( Real  pc) const
overridevirtual

Derivative of effective saturation wrt capillary pressure.

Parameters
pccapillary pressure (Pa)
Returns
derivative of effective saturation wrt capillary pressure

Implements PorousFlowCapillaryPressure.

Definition at line 68 of file PorousFlowCapillaryPressureRSC.C.

69 {
71 }
Real dEffectiveSaturation(Real pc, Real shift, Real scale)
Derivative of effective saturation wrt capillary pressure.
const Real _shift
Shift. seff_water = 1/Sqrt(1 + Exp((Pc - shift)/scale)), where scale = 0.25 * scale_ratio * oil_visco...
const Real _scale
Scale = 0.25 * scale_ratio * oil_viscosity.
Real PorousFlowCapillaryPressureRSC::effectiveSaturation ( Real  pc) const
overridevirtual

Effective saturation as a function of capillary pressure.

Parameters
pccapillary pressure (Pa)
Returns
effective saturation

Implements PorousFlowCapillaryPressure.

Definition at line 62 of file PorousFlowCapillaryPressureRSC.C.

63 {
65 }
const Real _shift
Shift. seff_water = 1/Sqrt(1 + Exp((Pc - shift)/scale)), where scale = 0.25 * scale_ratio * oil_visco...
Real effectiveSaturation(Real pc, Real shift, Real scale)
Effective saturation as a function of capillary pressure.
const Real _scale
Scale = 0.25 * scale_ratio * oil_viscosity.
Real PorousFlowCapillaryPressure::effectiveSaturationFromSaturation ( Real  saturation) const
protectedinherited

Effective saturation of liquid phase given liquid saturation and residual liquid saturation.

Note: not to be mistaken with effectiveSaturation(pc) which is a function of capillary pressure.

Parameters
saturationtrue saturation
Returns
effective saturation

Definition at line 86 of file PorousFlowCapillaryPressure.C.

Referenced by PorousFlowCapillaryPressureVG::capillaryPressureCurve(), PorousFlowCapillaryPressureBC::capillaryPressureCurve(), PorousFlowCapillaryPressureVG::d2CapillaryPressureCurve(), PorousFlowCapillaryPressureBC::d2CapillaryPressureCurve(), PorousFlowCapillaryPressureVG::dCapillaryPressureCurve(), PorousFlowCapillaryPressureBC::dCapillaryPressureCurve(), and PorousFlowCapillaryPressure::finalize().

87 {
88  return (saturation - _sat_lr) / (1.0 - _sat_lr);
89 }
const Real _sat_lr
Liquid residual saturation.
void FORTRAN_CALL() saturation(double &P, double &T, int &N, int &nerr)
virtual void PorousFlowCapillaryPressure::execute ( )
inlinefinalvirtualinherited

Definition at line 39 of file PorousFlowCapillaryPressure.h.

39 {};
Real PorousFlowCapillaryPressure::extensionSaturation ( ) const
protectedinherited

Calculates the saturation where the logarithmic extension to capillary pressure meets the raw curve using Newton's method.

Returns
saturation where logarithmic extension begins

Definition at line 111 of file PorousFlowCapillaryPressure.C.

Referenced by PorousFlowCapillaryPressure::finalize(), and PorousFlowCapillaryPressure::initialSetup().

112 {
113  // Initial guess for saturation where extension matches curve
114  Real sat = _sat_lr + 0.01;
115 
116  // Calculate the saturation where the extension matches the derivative of the
117  // raw capillary pressure curve
118  const unsigned int max_its = 20;
119  const Real nr_tol = 1.0e-8;
120  unsigned int iter = 0;
121 
122  while (std::abs(interceptFunction(sat)) > nr_tol)
123  {
124  sat = sat - interceptFunction(sat) / interceptFunctionDeriv(sat);
125 
126  iter++;
127  if (iter > max_its)
128  break;
129  }
130 
131  return sat;
132 }
Real interceptFunction(Real s) const
Calculates the saturation where the logarithmic extension to capillary pressure at low saturation...
const Real _sat_lr
Liquid residual saturation.
Real interceptFunctionDeriv(Real s) const
Calculates the saturation where the logarithmic extension to capillary pressure at low saturation...
virtual void PorousFlowCapillaryPressure::finalize ( )
inlinefinalvirtualinherited

Definition at line 40 of file PorousFlowCapillaryPressure.h.

40 {};
virtual void PorousFlowCapillaryPressure::initialize ( )
inlinefinalvirtualinherited

Definition at line 38 of file PorousFlowCapillaryPressure.h.

38 {};
void PorousFlowCapillaryPressure::initialSetup ( )
overridevirtualinherited

Definition at line 46 of file PorousFlowCapillaryPressure.C.

Referenced by PorousFlowCapillaryPressure::finalize().

47 {
48  // If _log_ext = true, calculate the saturation where the the logarithmic
49  // extension meets the raw capillary pressure curve.
50  if (_log_ext)
51  {
54  _slope_ext = (std::log10(_pc_ext) - std::log10(_pc_max)) / _sat_ext;
55  }
56 }
Real _slope_ext
Gradient of the logarithmic extension.
Real extensionSaturation() const
Calculates the saturation where the logarithmic extension to capillary pressure meets the raw curve u...
const Real _pc_max
Maximum capillary pressure (Pa). Note: must be <= 0.
virtual Real capillaryPressure(Real saturation) const
Capillary pressure is calculated as a function of true saturation.
Real _pc_ext
Capillary pressure where the extension meets the raw curve.
Real _sat_ext
Saturation where the logarithmic extension meets the raw curve.
bool _log_ext
Flag to use a logarithmic extension for low saturation.
Real PorousFlowCapillaryPressure::interceptFunction ( Real  s) const
protectedinherited

Calculates the saturation where the logarithmic extension to capillary pressure at low saturation.

Parameters
seffective saturation
Returns
capillary pressure function in the logarithmic extension

Definition at line 135 of file PorousFlowCapillaryPressure.C.

Referenced by PorousFlowCapillaryPressure::extensionSaturation(), and PorousFlowCapillaryPressure::finalize().

136 {
139 
140  return std::log10(pc) - saturation * dpc / (_log10 * pc) - std::log10(_pc_max);
141 }
virtual Real dCapillaryPressureCurve(Real saturation) const =0
Derivative of raw capillary pressure wrt true saturation.
const Real _pc_max
Maximum capillary pressure (Pa). Note: must be <= 0.
virtual Real capillaryPressureCurve(Real saturation) const =0
Raw capillary pressure curve (does not include logarithmic extension)
void FORTRAN_CALL() saturation(double &P, double &T, int &N, int &nerr)
Real PorousFlowCapillaryPressure::interceptFunctionDeriv ( Real  s) const
protectedinherited

Calculates the saturation where the logarithmic extension to capillary pressure at low saturation.

Parameters
seffective saturation
Returns
derivative of logarithmic extension function

Definition at line 144 of file PorousFlowCapillaryPressure.C.

Referenced by PorousFlowCapillaryPressure::extensionSaturation(), and PorousFlowCapillaryPressure::finalize().

145 {
149 
150  return saturation * (dpc * dpc / pc - d2pc) / (_log10 * pc);
151 }
virtual Real dCapillaryPressureCurve(Real saturation) const =0
Derivative of raw capillary pressure wrt true saturation.
virtual Real d2CapillaryPressureCurve(Real saturation) const =0
Second derivative of raw capillary pressure wrt true saturation.
virtual Real capillaryPressureCurve(Real saturation) const =0
Raw capillary pressure curve (does not include logarithmic extension)
void FORTRAN_CALL() saturation(double &P, double &T, int &N, int &nerr)

Member Data Documentation

const Real PorousFlowCapillaryPressure::_dseff_ds
protectedinherited
const Real PorousFlowCapillaryPressure::_log10
protectedinherited
bool PorousFlowCapillaryPressure::_log_ext
protectedinherited
const Real PorousFlowCapillaryPressureRSC::_oil_viscosity
protected

Oil viscosity (which must be twice the water viscocity in this formulation)

Definition at line 36 of file PorousFlowCapillaryPressureRSC.h.

Real PorousFlowCapillaryPressure::_pc_ext
protectedinherited
const Real PorousFlowCapillaryPressure::_pc_max
protectedinherited
Real PorousFlowCapillaryPressure::_sat_ext
protectedinherited
const Real PorousFlowCapillaryPressure::_sat_lr
protectedinherited
const Real PorousFlowCapillaryPressureRSC::_scale
protected

Scale = 0.25 * scale_ratio * oil_viscosity.

Definition at line 42 of file PorousFlowCapillaryPressureRSC.h.

Referenced by d2EffectiveSaturation(), dEffectiveSaturation(), and effectiveSaturation().

const Real PorousFlowCapillaryPressureRSC::_scale_ratio
protected

Scale ratio: porosity/permeability/beta^2, where beta is chosen by the user.

Definition at line 38 of file PorousFlowCapillaryPressureRSC.h.

const Real PorousFlowCapillaryPressureRSC::_shift
protected

Shift. seff_water = 1/Sqrt(1 + Exp((Pc - shift)/scale)), where scale = 0.25 * scale_ratio * oil_viscosity.

Definition at line 40 of file PorousFlowCapillaryPressureRSC.h.

Referenced by d2EffectiveSaturation(), dEffectiveSaturation(), and effectiveSaturation().

Real PorousFlowCapillaryPressure::_slope_ext
protectedinherited

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