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

Specialized class for water and vapor mixture using pressure and enthalpy. More...

#include <PorousFlowWaterVapor.h>

Inheritance diagram for PorousFlowWaterVapor:
[legend]

Public Member Functions

 PorousFlowWaterVapor (const InputParameters &parameters)
 
virtual std::string fluidStateName () const override
 Name of FluidState. More...
 
void thermophysicalProperties (Real pressure, Real enthalpy, unsigned int qp, FluidStatePhaseEnum &phase_state, std::vector< FluidStateProperties > &fsp) const override
 Determines the complete thermophysical state of the system for a given set of primary variables. More...
 
unsigned int getPressureIndex () const
 
unsigned int getEnthalpyIndex () const
 
void initialize () final
 
void execute () final
 
void finalize () final
 
unsigned int numPhases () const
 The maximum number of phases in this model. More...
 
unsigned int numComponents () const
 The maximum number of components in this model. More...
 
unsigned int aqueousPhaseIndex () const
 The index of the aqueous phase. More...
 
unsigned int gasPhaseIndex () const
 The index of the gas phase. More...
 
unsigned int aqueousComponentIndex () const
 The index of the aqueous fluid component. More...
 
unsigned int gasComponentIndex () const
 The index of the gas fluid component. More...
 
unsigned int saltComponentIndex () const
 The index of the salt component. More...
 
void clearFluidStateProperties (std::vector< FluidStateProperties > &fsp) const
 Clears the contents of the FluidStateProperties data structure. More...
 

Protected Attributes

const SinglePhaseFluidProperties_water_fp
 Fluid properties UserObject for water. More...
 
const Real _Mh2o
 Molar mass of water (kg/mol) More...
 
const Real _p_triple
 Triple point pressure of water (Pa) More...
 
const Real _p_critical
 Critical pressure of water (Pa) More...
 
const Real _T_triple
 Triple point temperature of water (K) More...
 
const Real _T_critical
 Critical temperature of water (K) More...
 
const unsigned int _pidx
 Index of derivative wrt pressure. More...
 
const unsigned int _hidx
 Index of derivative wrt enthalpy. More...
 
const Real dT
 Perturbation applied to saturation temperature to move to gas/liquid phase. More...
 
unsigned int _num_phases
 Number of phases. More...
 
unsigned int _num_components
 Number of components. More...
 
const unsigned int _aqueous_phase_number
 Phase number of the aqueous phase. More...
 
unsigned int _gas_phase_number
 Phase number of the gas phase. More...
 
const unsigned int _aqueous_fluid_component
 Fluid component number of the aqueous component. More...
 
unsigned int _gas_fluid_component
 Fluid component number of the gas phase. More...
 
const unsigned int _salt_component
 Salt component index. More...
 
const Real _R
 Universal gas constant (J/mol/K) More...
 
const Real _T_c2k
 Conversion from C to K. More...
 
const PorousFlowCapillaryPressure_pc
 Capillary pressure UserObject. More...
 
FluidStateProperties _empty_fsp
 Empty FluidStateProperties object. More...
 

Detailed Description

Specialized class for water and vapor mixture using pressure and enthalpy.

Note: It is important to note that this class must be used in a non-isothernal setting (i.e., with both fluid and heat transport) in order for the problem to be well posed.

Definition at line 26 of file PorousFlowWaterVapor.h.

Constructor & Destructor Documentation

◆ PorousFlowWaterVapor()

PorousFlowWaterVapor::PorousFlowWaterVapor ( const InputParameters &  parameters)

Definition at line 27 of file PorousFlowWaterVapor.C.

29  _water_fp(getUserObject<SinglePhaseFluidProperties>("water_fp")),
35 {
36  // Check that the correct FluidProperties UserObjects have been provided
37  if (_water_fp.fluidName() != "water")
38  paramError("water_fp", "A valid water FluidProperties UserObject must be provided in water_fp");
39 
40  // Set the number of phases and components, and their indexes
41  _num_phases = 2;
42  _num_components = 1;
45 
46  // Check that _aqueous_phase_number is <= total number of phases
48  paramError("liquid_phase_number",
49  "This value is larger than the possible number of phases ",
50  _num_phases);
51 
52  // Check that _aqueous_fluid_component is <= total number of fluid components
54  paramError("liquid_fluid_component",
55  "This value is larger than the possible number of fluid components",
57 
59 }

Member Function Documentation

◆ aqueousComponentIndex()

unsigned int PorousFlowFluidStateBase::aqueousComponentIndex ( ) const
inlineinherited

The index of the aqueous fluid component.

Returns
aqueous fluid component number

Definition at line 92 of file PorousFlowFluidStateBase.h.

92 { return _aqueous_fluid_component; };

◆ aqueousPhaseIndex()

unsigned int PorousFlowFluidStateBase::aqueousPhaseIndex ( ) const
inlineinherited

The index of the aqueous phase.

Returns
aqueous phase number

Definition at line 80 of file PorousFlowFluidStateBase.h.

80 { return _aqueous_phase_number; };

◆ clearFluidStateProperties()

void PorousFlowFluidStateBase::clearFluidStateProperties ( std::vector< FluidStateProperties > &  fsp) const
inherited

Clears the contents of the FluidStateProperties data structure.

Parameters
[out]fspFluidStateProperties data structure with all data initialized to 0

Definition at line 39 of file PorousFlowFluidStateBase.C.

40 {
41  std::fill(fsp.begin(), fsp.end(), _empty_fsp);
42 }

Referenced by PorousFlowWaterNCG::thermophysicalProperties(), PorousFlowFluidStateSingleComponent::thermophysicalProperties(), and PorousFlowBrineCO2::thermophysicalProperties().

◆ execute()

void PorousFlowFluidStateBase::execute ( )
inlinefinalinherited

Definition at line 61 of file PorousFlowFluidStateBase.h.

61 {};

◆ finalize()

void PorousFlowFluidStateBase::finalize ( )
inlinefinalinherited

Definition at line 62 of file PorousFlowFluidStateBase.h.

62 {};

◆ fluidStateName()

std::string PorousFlowWaterVapor::fluidStateName ( ) const
overridevirtual

Name of FluidState.

Implements PorousFlowFluidStateBase.

Definition at line 62 of file PorousFlowWaterVapor.C.

63 {
64  return "water-vapor";
65 }

◆ gasComponentIndex()

unsigned int PorousFlowFluidStateBase::gasComponentIndex ( ) const
inlineinherited

The index of the gas fluid component.

Returns
gas fluid component number

Definition at line 98 of file PorousFlowFluidStateBase.h.

98 { return _gas_fluid_component; };

◆ gasPhaseIndex()

unsigned int PorousFlowFluidStateBase::gasPhaseIndex ( ) const
inlineinherited

The index of the gas phase.

Returns
gas phase number

Definition at line 86 of file PorousFlowFluidStateBase.h.

86 { return _gas_phase_number; };

◆ getEnthalpyIndex()

unsigned int PorousFlowFluidStateSingleComponentBase::getEnthalpyIndex ( ) const
inlineinherited

Definition at line 45 of file PorousFlowFluidStateSingleComponentBase.h.

45 { return _hidx; };

◆ getPressureIndex()

unsigned int PorousFlowFluidStateSingleComponentBase::getPressureIndex ( ) const
inlineinherited

Definition at line 44 of file PorousFlowFluidStateSingleComponentBase.h.

44 { return _pidx; };

◆ initialize()

void PorousFlowFluidStateBase::initialize ( )
inlinefinalinherited

Definition at line 60 of file PorousFlowFluidStateBase.h.

60 {};

◆ numComponents()

unsigned int PorousFlowFluidStateBase::numComponents ( ) const
inlineinherited

The maximum number of components in this model.

Returns
number of components

Definition at line 74 of file PorousFlowFluidStateBase.h.

74 { return _num_components; };

◆ numPhases()

unsigned int PorousFlowFluidStateBase::numPhases ( ) const
inlineinherited

The maximum number of phases in this model.

Returns
number of phases

Definition at line 68 of file PorousFlowFluidStateBase.h.

68 { return _num_phases; };

Referenced by PorousFlowFluidState::PorousFlowFluidState(), and PorousFlowFluidStateSingleComponent::PorousFlowFluidStateSingleComponent().

◆ saltComponentIndex()

unsigned int PorousFlowFluidStateBase::saltComponentIndex ( ) const
inlineinherited

The index of the salt component.

Returns
salt component number

Definition at line 104 of file PorousFlowFluidStateBase.h.

104 { return _salt_component; };

◆ thermophysicalProperties()

void PorousFlowWaterVapor::thermophysicalProperties ( Real  pressure,
Real  enthalpy,
unsigned int  qp,
FluidStatePhaseEnum phase_state,
std::vector< FluidStateProperties > &  fsp 
) const
overridevirtual

Determines the complete thermophysical state of the system for a given set of primary variables.

Parameters
pressuregas phase pressure (Pa)
enthalpyfluid enthalpy (J/kg)
qpquadpoint index
[out]phase_statethe current phase (gas, liquid or two-phase)
[out]fspthe FluidStateProperties struct containing all properties

Implements PorousFlowFluidStateSingleComponentBase.

Definition at line 68 of file PorousFlowWaterVapor.C.

73 {
76 
77  // AD versions of primary variables
78  DualReal p = pressure;
79  Moose::derivInsert(p.derivatives(), _pidx, 1.0);
80  DualReal h = enthalpy;
81  Moose::derivInsert(h.derivatives(), _hidx, 1.0);
82 
83  DualReal Tsat = 0.0;
84  DualReal hl = 0.0;
85  DualReal hv = 0.0;
86 
87  // Determine the phase state of the system
88  if (p.value() >= _p_triple && p.value() <= _p_critical)
89  {
90  // Saturation temperature at the given pressure
91  Tsat = _water_fp.vaporTemperature(p);
92 
93  // Enthalpy of saturated liquid and saturated vapor
94  hl = _water_fp.h_from_p_T(p, Tsat - dT);
95  hv = _water_fp.h_from_p_T(p, Tsat + dT);
96 
97  if (h.value() < hl)
98  phase_state = FluidStatePhaseEnum::LIQUID;
99 
100  else if (h.value() >= hl && h.value() <= hv)
101  phase_state = FluidStatePhaseEnum::TWOPHASE;
102 
103  else // h > hv
104  phase_state = FluidStatePhaseEnum::GAS;
105  }
106  else // p.value() > _p_critical
107  {
108  // Check whether the phase point is in the liquid or vapor state
109  const DualReal T = _water_fp.T_from_p_h(p, h);
110 
111  if (T.value() <= _T_critical)
112  phase_state = FluidStatePhaseEnum::LIQUID;
113  else
114  {
115  // The supercritical state is treated as a gas
116  phase_state = FluidStatePhaseEnum::GAS;
117  }
118  }
119 
120  // Calculate the properties for each phase as required
121  switch (phase_state)
122  {
124  {
125  gas.pressure = p + _pc.capillaryPressure(0.0, qp);
126  gas.saturation = 1.0;
127 
128  const DualReal T = _water_fp.T_from_p_h(gas.pressure, h);
129 
130  gas.temperature = T;
131  liquid.temperature = T;
132 
133  gas.density = _water_fp.rho_from_p_T(gas.pressure, T);
134  gas.viscosity = _water_fp.mu_from_p_T(gas.pressure, T);
135  gas.enthalpy = h;
136  gas.internal_energy = _water_fp.e_from_p_T(gas.pressure, T);
137 
138  break;
139  }
140 
142  {
143  const DualReal T = _water_fp.T_from_p_h(p, h);
144 
145  liquid.pressure = p;
146  liquid.temperature = T;
147  liquid.density = _water_fp.rho_from_p_T(p, T);
148  liquid.viscosity = _water_fp.mu_from_p_T(p, T);
149  liquid.enthalpy = h;
150  liquid.internal_energy = _water_fp.e_from_p_T(p, T);
151  liquid.saturation = 1.0;
152 
153  break;
154  }
155 
157  {
158  // Latent heat of vaporization
159  const DualReal hvl = hv - hl;
160 
161  // Vapor quality
162  const DualReal X = (h - hl) / hvl;
163 
164  // Perturbed saturation temperature to ensure that the correct
165  // phase properties are calculated
166  const DualReal Tsatl = Tsat - dT;
167  const DualReal Tsatv = Tsat + dT;
168 
169  // Density
170  const DualReal rhol = _water_fp.rho_from_p_T(p, Tsatl);
171  const DualReal rhov = _water_fp.rho_from_p_T(p, Tsatv);
172 
173  // Vapor (gas) saturation
174  const DualReal satv = X * rhol / (rhov + X * (rhol - rhov));
175 
176  gas.temperature = Tsat;
177  gas.density = rhov;
178  gas.viscosity = _water_fp.mu_from_p_T(p, Tsatv);
179  gas.enthalpy = hv;
180  gas.internal_energy = _water_fp.e_from_p_T(p, Tsatv);
181  gas.saturation = satv;
182 
183  liquid.temperature = Tsat;
184  liquid.density = rhol;
185  liquid.viscosity = _water_fp.mu_from_p_T(p, Tsatl);
186  liquid.enthalpy = hl;
187  liquid.internal_energy = _water_fp.e_from_p_T(p, Tsatl);
188  liquid.saturation = 1.0 - satv;
189 
190  liquid.pressure = p;
191  gas.pressure = p + _pc.capillaryPressure(liquid.saturation, qp);
192 
193  break;
194  }
195  }
196 }

Member Data Documentation

◆ _aqueous_fluid_component

const unsigned int PorousFlowFluidStateBase::_aqueous_fluid_component
protectedinherited

◆ _aqueous_phase_number

const unsigned int PorousFlowFluidStateBase::_aqueous_phase_number
protectedinherited

◆ _empty_fsp

FluidStateProperties PorousFlowFluidStateBase::_empty_fsp
protectedinherited

◆ _gas_fluid_component

unsigned int PorousFlowFluidStateBase::_gas_fluid_component
protectedinherited

◆ _gas_phase_number

unsigned int PorousFlowFluidStateBase::_gas_phase_number
protectedinherited

◆ _hidx

const unsigned int PorousFlowFluidStateSingleComponentBase::_hidx
protectedinherited

Index of derivative wrt enthalpy.

Definition at line 51 of file PorousFlowFluidStateSingleComponentBase.h.

Referenced by PorousFlowFluidStateSingleComponentBase::getEnthalpyIndex(), and thermophysicalProperties().

◆ _Mh2o

const Real PorousFlowWaterVapor::_Mh2o
protected

Molar mass of water (kg/mol)

Definition at line 43 of file PorousFlowWaterVapor.h.

◆ _num_components

unsigned int PorousFlowFluidStateBase::_num_components
protectedinherited

◆ _num_phases

unsigned int PorousFlowFluidStateBase::_num_phases
protectedinherited

◆ _p_critical

const Real PorousFlowWaterVapor::_p_critical
protected

Critical pressure of water (Pa)

Definition at line 47 of file PorousFlowWaterVapor.h.

Referenced by thermophysicalProperties().

◆ _p_triple

const Real PorousFlowWaterVapor::_p_triple
protected

Triple point pressure of water (Pa)

Definition at line 45 of file PorousFlowWaterVapor.h.

Referenced by thermophysicalProperties().

◆ _pc

const PorousFlowCapillaryPressure& PorousFlowFluidStateBase::_pc
protectedinherited

◆ _pidx

const unsigned int PorousFlowFluidStateSingleComponentBase::_pidx
protectedinherited

Index of derivative wrt pressure.

Definition at line 45 of file PorousFlowFluidStateSingleComponentBase.h.

Referenced by PorousFlowFluidStateSingleComponentBase::getPressureIndex(), and thermophysicalProperties().

◆ _R

const Real PorousFlowFluidStateBase::_R
protectedinherited

Universal gas constant (J/mol/K)

Definition at line 133 of file PorousFlowFluidStateBase.h.

Referenced by PorousFlowWaterNCG::enthalpyOfDissolution(), and PorousFlowBrineCO2::enthalpyOfDissolutionGas().

◆ _salt_component

const unsigned int PorousFlowFluidStateBase::_salt_component
protectedinherited

Salt component index.

Definition at line 131 of file PorousFlowFluidStateBase.h.

Referenced by PorousFlowFluidStateBase::saltComponentIndex().

◆ _T_c2k

const Real PorousFlowFluidStateBase::_T_c2k
protectedinherited

◆ _T_critical

const Real PorousFlowWaterVapor::_T_critical
protected

Critical temperature of water (K)

Definition at line 51 of file PorousFlowWaterVapor.h.

Referenced by thermophysicalProperties().

◆ _T_triple

const Real PorousFlowWaterVapor::_T_triple
protected

Triple point temperature of water (K)

Definition at line 49 of file PorousFlowWaterVapor.h.

◆ _water_fp

const SinglePhaseFluidProperties& PorousFlowWaterVapor::_water_fp
protected

Fluid properties UserObject for water.

Definition at line 41 of file PorousFlowWaterVapor.h.

Referenced by PorousFlowWaterVapor(), and thermophysicalProperties().

◆ dT

const Real PorousFlowFluidStateSingleComponentBase::dT
protectedinherited

Perturbation applied to saturation temperature to move to gas/liquid phase.

Definition at line 53 of file PorousFlowFluidStateSingleComponentBase.h.

Referenced by thermophysicalProperties().


The documentation for this class was generated from the following files:
PorousFlowFluidStateBase::_empty_fsp
FluidStateProperties _empty_fsp
Empty FluidStateProperties object.
Definition: PorousFlowFluidStateBase.h:139
PorousFlowFluidStateBase::_gas_phase_number
unsigned int _gas_phase_number
Phase number of the gas phase.
Definition: PorousFlowFluidStateBase.h:125
PorousFlowFluidStateSingleComponentBase::PorousFlowFluidStateSingleComponentBase
PorousFlowFluidStateSingleComponentBase(const InputParameters &parameters)
Definition: PorousFlowFluidStateSingleComponentBase.C:21
PorousFlowFluidStateBase::_pc
const PorousFlowCapillaryPressure & _pc
Capillary pressure UserObject.
Definition: PorousFlowFluidStateBase.h:137
FluidStateProperties::density
DualReal density
Definition: PorousFlowFluidStateBase.h:42
FluidStateProperties::pressure
DualReal pressure
Definition: PorousFlowFluidStateBase.h:37
PorousFlowWaterVapor::_p_critical
const Real _p_critical
Critical pressure of water (Pa)
Definition: PorousFlowWaterVapor.h:47
FluidStateProperties::enthalpy
DualReal enthalpy
Definition: PorousFlowFluidStateBase.h:44
PorousFlowWaterVapor::_p_triple
const Real _p_triple
Triple point pressure of water (Pa)
Definition: PorousFlowWaterVapor.h:45
PorousFlowWaterVapor::_T_triple
const Real _T_triple
Triple point temperature of water (K)
Definition: PorousFlowWaterVapor.h:49
PorousFlowWaterVapor::_T_critical
const Real _T_critical
Critical temperature of water (K)
Definition: PorousFlowWaterVapor.h:51
PorousFlowFluidStateBase::_gas_fluid_component
unsigned int _gas_fluid_component
Fluid component number of the gas phase.
Definition: PorousFlowFluidStateBase.h:129
SinglePhaseFluidProperties::triplePointPressure
virtual Real triplePointPressure() const
Triple point pressure.
Definition: SinglePhaseFluidProperties.C:132
FluidStatePhaseEnum::LIQUID
SinglePhaseFluidProperties::criticalPressure
virtual Real criticalPressure() const
Critical pressure.
Definition: SinglePhaseFluidProperties.C:108
SinglePhaseFluidProperties::triplePointTemperature
virtual Real triplePointTemperature() const
Triple point temperature.
Definition: SinglePhaseFluidProperties.C:138
NS::enthalpy
const std::string enthalpy
Definition: NS.h:27
PorousFlowWaterVapor::_water_fp
const SinglePhaseFluidProperties & _water_fp
Fluid properties UserObject for water.
Definition: PorousFlowWaterVapor.h:41
PorousFlowFluidStateBase::_salt_component
const unsigned int _salt_component
Salt component index.
Definition: PorousFlowFluidStateBase.h:131
FluidStateProperties
AD data structure to pass calculated thermophysical properties.
Definition: PorousFlowFluidStateBase.h:26
PorousFlowCapillaryPressure::capillaryPressure
virtual Real capillaryPressure(Real saturation, unsigned qp=0) const
Capillary pressure is calculated as a function of true saturation.
Definition: PorousFlowCapillaryPressure.C:64
SinglePhaseFluidProperties::criticalTemperature
virtual Real criticalTemperature() const
Critical temperature.
Definition: SinglePhaseFluidProperties.C:114
PorousFlowFluidStateBase::_aqueous_phase_number
const unsigned int _aqueous_phase_number
Phase number of the aqueous phase.
Definition: PorousFlowFluidStateBase.h:123
PorousFlowFluidStateBase::_num_phases
unsigned int _num_phases
Number of phases.
Definition: PorousFlowFluidStateBase.h:119
SinglePhaseFluidProperties::vaporTemperature
virtual Real vaporTemperature(Real p) const
Vapor temperature.
Definition: SinglePhaseFluidProperties.C:212
PorousFlowFluidStateBase::_num_components
unsigned int _num_components
Number of components.
Definition: PorousFlowFluidStateBase.h:121
FluidStatePhaseEnum::TWOPHASE
FluidStateProperties::temperature
DualReal temperature
Definition: PorousFlowFluidStateBase.h:40
FluidStatePhaseEnum::GAS
SinglePhaseFluidProperties::molarMass
virtual virtual std Real molarMass() const
Fluid name.
Definition: SinglePhaseFluidProperties.C:96
FluidStateProperties::internal_energy
DualReal internal_energy
Definition: PorousFlowFluidStateBase.h:45
PorousFlowFluidStateBase::_aqueous_fluid_component
const unsigned int _aqueous_fluid_component
Fluid component number of the aqueous component.
Definition: PorousFlowFluidStateBase.h:127
PorousFlowFluidStateSingleComponentBase::_hidx
const unsigned int _hidx
Index of derivative wrt enthalpy.
Definition: PorousFlowFluidStateSingleComponentBase.h:51
FluidStateProperties::viscosity
DualReal viscosity
Definition: PorousFlowFluidStateBase.h:43
PorousFlowFluidStateSingleComponentBase::dT
const Real dT
Perturbation applied to saturation temperature to move to gas/liquid phase.
Definition: PorousFlowFluidStateSingleComponentBase.h:53
FluidStateProperties::saturation
DualReal saturation
Definition: PorousFlowFluidStateBase.h:41
PorousFlowWaterVapor::_Mh2o
const Real _Mh2o
Molar mass of water (kg/mol)
Definition: PorousFlowWaterVapor.h:43
PorousFlowFluidStateSingleComponentBase::_pidx
const unsigned int _pidx
Index of derivative wrt pressure.
Definition: PorousFlowFluidStateSingleComponentBase.h:45
NS::pressure
const std::string pressure
Definition: NS.h:25