www.mooseframework.org
PorousFlowFluidStateFlashBase.h
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 
8 #ifndef POROUSFLOWFLUIDSTATEFLASHBASE_H
9 #define POROUSFLOWFLUIDSTATEFLASHBASE_H
10 
11 #include "PorousFlowVariableBase.h"
12 
15 
16 template <>
18 
49 {
50 public:
51  PorousFlowFluidStateFlashBase(const InputParameters & parameters);
52 
53 protected:
54  virtual void initQpStatefulProperties() override;
55  virtual void computeQpProperties() override;
56 
59  {
60  Real pressure;
61  Real saturation;
64  std::vector<Real> mass_fraction;
74  std::vector<Real> dmass_fraction_dp;
75  std::vector<Real> dmass_fraction_dT;
76  std::vector<Real> dmass_fraction_dz;
77  };
78 
80  void setMaterialVectorSize() const;
81 
86  virtual void thermophysicalProperties() = 0;
87 
111  Real rachfordRice(Real x, std::vector<Real> & Ki) const;
112 
121  Real rachfordRiceDeriv(Real x, std::vector<Real> & Ki) const;
122 
131  Real vaporMassFraction(std::vector<Real> & Ki) const;
132 
134  const VariableValue & _gas_porepressure;
136  const VariableGradient & _gas_gradp_qp;
138  const unsigned int _gas_porepressure_varnum;
140  const unsigned int _pvar;
142  std::vector<const VariableValue *> _z;
144  std::vector<const VariableGradient *> _gradz_qp;
146  std::vector<unsigned int> _z_varnum;
148  std::vector<unsigned int> _zvar;
150  const unsigned int _num_z_vars;
152  const unsigned int _aqueous_phase_number;
154  const unsigned int _gas_phase_number;
156  const unsigned int _aqueous_fluid_component;
158  const unsigned int _gas_fluid_component;
160  const MaterialProperty<Real> & _temperature;
162  const MaterialProperty<RealGradient> & _gradT_qp;
164  const MaterialProperty<std::vector<Real>> & _dtemperature_dvar;
166  MaterialProperty<std::vector<std::vector<Real>>> & _mass_frac;
168  MaterialProperty<std::vector<std::vector<RealGradient>>> * _grad_mass_frac_qp;
170  MaterialProperty<std::vector<std::vector<std::vector<Real>>>> & _dmass_frac_dvar;
172  const MaterialProperty<std::vector<Real>> & _saturation_old;
173 
175  MaterialProperty<std::vector<Real>> & _fluid_density;
177  MaterialProperty<std::vector<std::vector<Real>>> & _dfluid_density_dvar;
179  MaterialProperty<std::vector<Real>> & _fluid_viscosity;
181  MaterialProperty<std::vector<std::vector<Real>>> & _dfluid_viscosity_dvar;
182 
184  const Real _T_c2k;
186  const Real _R;
188  const Real _nr_max_its;
190  const Real _nr_tol;
194  std::vector<FluidStateProperties> _fsp;
197 };
198 
199 #endif // POROUSFLOWFLUIDSTATEFLASHBASE_H
std::vector< const VariableGradient * > _gradz_qp
Gradient(s) of total mass fraction(s) of the gas component(s) (only defined at the qps) ...
void setMaterialVectorSize() const
Size material property vectors and initialise with zeros.
Real rachfordRiceDeriv(Real x, std::vector< Real > &Ki) const
Derivative of Rachford-Rice equation wrt vapor fraction.
const MaterialProperty< Real > & _temperature
Temperature.
PorousFlowFluidStateFlashBase(const InputParameters &parameters)
const MaterialProperty< std::vector< Real > > & _dtemperature_dvar
Derivative of temperature wrt PorousFlow variables.
const VariableGradient & _gas_gradp_qp
Gradient of porepressure (only defined at the qps)
MaterialProperty< std::vector< std::vector< Real > > > & _dfluid_viscosity_dvar
Derivative of the fluid viscosity for each phase wrt PorousFlow variables.
const Real _nr_tol
Tolerance for Newton-Raphson iterations.
const unsigned int _gas_porepressure_varnum
Moose variable number of the gas porepressure.
std::vector< unsigned int > _z_varnum
Moose variable number of z.
const unsigned int _pvar
PorousFlow variable number of the gas porepressure.
virtual void initQpStatefulProperties() override
const VariableValue & _gas_porepressure
Porepressure.
MaterialProperty< std::vector< std::vector< Real > > > & _dfluid_density_dvar
Derivative of the fluid density for each phase wrt PorousFlow variables.
const MaterialProperty< std::vector< Real > > & _saturation_old
Old value of saturation.
Base class for capillary pressure for multiphase flow in porous media.
MaterialProperty< std::vector< Real > > & _fluid_density
Fluid density of each phase.
MaterialProperty< std::vector< std::vector< Real > > > & _mass_frac
Mass fraction matrix.
const unsigned int _gas_fluid_component
Fluid component number of the gas phase.
const PorousFlowCapillaryPressure & _pc_uo
Capillary pressure UserObject.
std::vector< FluidStateProperties > _fsp
FluidStateProperties data structure.
std::vector< unsigned int > _zvar
PorousFlow variable number of z.
const unsigned int _aqueous_phase_number
Phase number of the aqueous phase.
Real rachfordRice(Real x, std::vector< Real > &Ki) const
Rachford-Rice equation for vapor fraction.
const Real _R
Universal gas constant (J/mol/K)
const unsigned int _num_z_vars
Number of coupled total mass fractions. Should be _num_phases - 1.
const unsigned int _gas_phase_number
Phase number of the gas phase.
bool _is_initqp
Flag to indicate whether to calculate stateful properties.
MaterialProperty< std::vector< std::vector< RealGradient > > > * _grad_mass_frac_qp
Gradient of the mass fraction matrix (only defined at the qps)
const unsigned int _aqueous_fluid_component
Fluid component number of the aqueous component.
InputParameters validParams< PorousFlowFluidStateFlashBase >()
const Real _T_c2k
Conversion from degrees Celsius to degrees Kelvin.
const Real _nr_max_its
Maximum number of iterations for the Newton-Raphson iterations.
Data structure to pass calculated thermophysical properties.
Base class for thermophysical variable materials, which assemble materials for primary variables such...
MaterialProperty< std::vector< Real > > & _fluid_viscosity
Viscosity of each phase.
std::vector< const VariableValue * > _z
Total mass fraction(s) of the gas component(s) summed over all phases.
Base class for fluid states using a persistent set of primary variables for the mutliphase, multicomponent case.
const MaterialProperty< RealGradient > & _gradT_qp
Gradient of temperature (only defined at the qps)
MaterialProperty< std::vector< std::vector< std::vector< Real > > > > & _dmass_frac_dvar
Derivative of the mass fraction matrix with respect to the Porous Flow variables. ...
Real vaporMassFraction(std::vector< Real > &Ki) const
Solves Rachford-Rice equation to provide vapor mass fraction.
virtual void thermophysicalProperties()=0
Calculates all required thermophysical properties and derivatives for each phase and fluid component...