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

Fluid properties of Brine. More...

#include <PorousFlowBrine.h>

Inheritance diagram for PorousFlowBrine:
[legend]

Public Member Functions

 PorousFlowBrine (const InputParameters &parameters)
 

Protected Member Functions

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

Protected Attributes

const bool _compute_rho_mu
 If true, this Material will compute density and viscosity, and their derivatives. More...
 
const bool _compute_internal_energy
 If true, this Material will compute internal energy and its derivatives. More...
 
const bool _compute_enthalpy
 If true, this Material will compute enthalpy and its derivatives. More...
 
MaterialProperty< Real > *const _density
 Fluid phase density at the qps or nodes. More...
 
MaterialProperty< Real > *const _ddensity_dp
 Derivative of fluid density wrt phase pore pressure at the qps or nodes. More...
 
MaterialProperty< Real > *const _ddensity_dT
 Derivative of fluid density wrt temperature at the qps or nodes. More...
 
MaterialProperty< Real > *const _viscosity
 Fluid phase viscosity at the nodes or qps. More...
 
MaterialProperty< Real > *const _dviscosity_dp
 Derivative of fluid phase viscosity wrt pressure at the nodes or qps. More...
 
MaterialProperty< Real > *const _dviscosity_dT
 Derivative of fluid phase viscosity wrt temperature at the nodes or qps. More...
 
MaterialProperty< Real > *const _internal_energy
 Fluid phase internal_energy at the qps or nodes. More...
 
MaterialProperty< Real > *const _dinternal_energy_dp
 Derivative of fluid internal_energy wrt phase pore pressure at the qps or nodes. More...
 
MaterialProperty< Real > *const _dinternal_energy_dT
 Derivative of fluid internal_energy wrt temperature at the qps or nodes. More...
 
MaterialProperty< Real > *const _enthalpy
 Fluid phase enthalpy at the qps or nodes. More...
 
MaterialProperty< Real > *const _denthalpy_dp
 Derivative of fluid enthalpy wrt phase pore pressure at the qps or nodes. More...
 
MaterialProperty< Real > *const _denthalpy_dT
 Derivative of fluid enthalpy wrt temperature at the qps or nodes. More...
 
const BrineFluidProperties_brine_fp
 Brine Fluid properties UserObject. More...
 
const SinglePhaseFluidPropertiesPT_water_fp
 Water Fluid properties UserObject. More...
 
const VariableValue & _xnacl
 NaCl mass fraction at the qps or nodes. More...
 
const MaterialProperty< std::vector< Real > > & _porepressure
 Pore pressure at the nodes or quadpoints. More...
 
const MaterialProperty< Real > & _temperature
 Fluid temperature at the nodes or quadpoints. More...
 
const VariableName _pressure_variable_name
 Name of (dummy) pressure primary variable. More...
 
const VariableName _temperature_variable_name
 Name of (dummy) temperature primary variable. More...
 
const Real _t_c2k
 Conversion from degrees Celsius to degrees Kelvin. More...
 
const Real _R
 Universal gas constant. More...
 
const unsigned int _phase_num
 Phase number of fluid. More...
 
const std::string _phase
 Stringified fluid phase number. More...
 

Detailed Description

Fluid properties of Brine.

Provides density, viscosity, derivatives wrt pressure and temperature at the quadpoints or nodes

Definition at line 23 of file PorousFlowBrine.h.

Constructor & Destructor Documentation

PorousFlowBrine::PorousFlowBrine ( const InputParameters &  parameters)

Definition at line 25 of file PorousFlowBrine.C.

26  : PorousFlowFluidPropertiesBase(parameters),
27  _compute_rho_mu(getParam<bool>("compute_density_and_viscosity")),
28  _compute_internal_energy(getParam<bool>("compute_internal_energy")),
29  _compute_enthalpy(getParam<bool>("compute_enthalpy")),
31  ? (_nodal_material
32  ? &declareProperty<Real>("PorousFlow_fluid_phase_density_nodal" + _phase)
33  : &declareProperty<Real>("PorousFlow_fluid_phase_density_qp" + _phase))
34  : nullptr),
37  ? (_nodal_material
38  ? &declarePropertyDerivative<Real>(
39  "PorousFlow_fluid_phase_density_nodal" + _phase, _pressure_variable_name)
40  : &declarePropertyDerivative<Real>("PorousFlow_fluid_phase_density_qp" + _phase,
42  : nullptr),
45  ? (_nodal_material
46  ? &declarePropertyDerivative<Real>("PorousFlow_fluid_phase_density_nodal" +
47  _phase,
49  : &declarePropertyDerivative<Real>("PorousFlow_fluid_phase_density_qp" + _phase,
51  : nullptr),
52 
54  ? (_nodal_material
55  ? &declareProperty<Real>("PorousFlow_viscosity_nodal" + _phase)
56  : &declareProperty<Real>("PorousFlow_viscosity_qp" + _phase))
57  : nullptr),
59  ? (_nodal_material
60  ? &declarePropertyDerivative<Real>(
61  "PorousFlow_viscosity_nodal" + _phase, _pressure_variable_name)
62  : &declarePropertyDerivative<Real>("PorousFlow_viscosity_qp" + _phase,
64  : nullptr),
67  ? (_nodal_material
68  ? &declarePropertyDerivative<Real>("PorousFlow_viscosity_nodal" + _phase,
70  : &declarePropertyDerivative<Real>("PorousFlow_viscosity_qp" + _phase,
72  : nullptr),
73 
76  ? (_nodal_material
77  ? &declareProperty<Real>("PorousFlow_fluid_phase_internal_energy_nodal" + _phase)
78  : &declareProperty<Real>("PorousFlow_fluid_phase_internal_energy_qp" + _phase))
79  : nullptr),
81  ? (_nodal_material
82  ? &declarePropertyDerivative<Real>(
83  "PorousFlow_fluid_phase_internal_energy_nodal" + _phase,
85  : &declarePropertyDerivative<Real>(
86  "PorousFlow_fluid_phase_internal_energy_qp" + _phase,
88  : nullptr),
90  ? (_nodal_material
91  ? &declarePropertyDerivative<Real>(
92  "PorousFlow_fluid_phase_internal_energy_nodal" + _phase,
94  : &declarePropertyDerivative<Real>(
95  "PorousFlow_fluid_phase_internal_energy_qp" + _phase,
97  : nullptr),
98 
100  ? (_nodal_material
101  ? &declareProperty<Real>("PorousFlow_fluid_phase_enthalpy_nodal" + _phase)
102  : &declareProperty<Real>("PorousFlow_fluid_phase_enthalpy_qp" + _phase))
103  : nullptr),
106  ? (_nodal_material
107  ? &declarePropertyDerivative<Real>(
108  "PorousFlow_fluid_phase_enthalpy_nodal" + _phase, _pressure_variable_name)
109  : &declarePropertyDerivative<Real>("PorousFlow_fluid_phase_enthalpy_qp" + _phase,
111  : nullptr),
114  ? (_nodal_material
115  ? &declarePropertyDerivative<Real>("PorousFlow_fluid_phase_enthalpy_nodal" +
116  _phase,
118  : &declarePropertyDerivative<Real>("PorousFlow_fluid_phase_enthalpy_qp" + _phase,
120  : nullptr),
121 
122  _xnacl(_nodal_material ? coupledNodalValue("xnacl") : coupledValue("xnacl"))
123 {
124  // BrineFluidProperties UserObject
125  std::string brine_name = name() + ":brine";
126  {
127  std::string class_name = "BrineFluidProperties";
128  InputParameters params = _app.getFactory().getValidParams(class_name);
129  _fe_problem.addUserObject(class_name, brine_name, params);
130  }
131  _brine_fp = &_fe_problem.getUserObject<BrineFluidProperties>(brine_name);
132 
133  // Water properties UserObject
135 }
const VariableName _temperature_variable_name
Name of (dummy) temperature primary variable.
MaterialProperty< Real > *const _dviscosity_dp
Derivative of fluid phase viscosity wrt pressure at the nodes or qps.
MaterialProperty< Real > *const _denthalpy_dp
Derivative of fluid enthalpy wrt phase pore pressure at the qps or nodes.
MaterialProperty< Real > *const _dviscosity_dT
Derivative of fluid phase viscosity wrt temperature at the nodes or qps.
const VariableName _pressure_variable_name
Name of (dummy) pressure primary variable.
const BrineFluidProperties * _brine_fp
Brine Fluid properties UserObject.
MaterialProperty< Real > *const _ddensity_dp
Derivative of fluid density wrt phase pore pressure at the qps or nodes.
const bool _compute_enthalpy
If true, this Material will compute enthalpy and its derivatives.
Brine (NaCl in H2O) fluid properties as a function of pressure (Pa), temperature (K) and NaCl mass fr...
MaterialProperty< Real > *const _denthalpy_dT
Derivative of fluid enthalpy wrt temperature at the qps or nodes.
MaterialProperty< Real > *const _viscosity
Fluid phase viscosity at the nodes or qps.
const SinglePhaseFluidPropertiesPT * _water_fp
Water Fluid properties UserObject.
MaterialProperty< Real > *const _dinternal_energy_dT
Derivative of fluid internal_energy wrt temperature at the qps or nodes.
const std::string _phase
Stringified fluid phase number.
const bool _compute_rho_mu
If true, this Material will compute density and viscosity, and their derivatives. ...
const bool _compute_internal_energy
If true, this Material will compute internal energy and its derivatives.
MaterialProperty< Real > *const _internal_energy
Fluid phase internal_energy at the qps or nodes.
MaterialProperty< Real > *const _ddensity_dT
Derivative of fluid density wrt temperature at the qps or nodes.
PorousFlowFluidPropertiesBase(const InputParameters &parameters)
MaterialProperty< Real > *const _density
Fluid phase density at the qps or nodes.
virtual const SinglePhaseFluidPropertiesPT & getComponent(unsigned int component) const override
Get UserObject for specified component.
MaterialProperty< Real > *const _dinternal_energy_dp
Derivative of fluid internal_energy wrt phase pore pressure at the qps or nodes.
const VariableValue & _xnacl
NaCl mass fraction at the qps or nodes.
MaterialProperty< Real > *const _enthalpy
Fluid phase enthalpy at the qps or nodes.
static const unsigned int WATER
Fluid component numbers for water and NaCl.

Member Function Documentation

void PorousFlowBrine::computeQpProperties ( )
overrideprotectedvirtual

Reimplemented from PorousFlowFluidPropertiesBase.

Definition at line 152 of file PorousFlowBrine.C.

153 {
154  const Real Tk = _temperature[_qp] + _t_c2k;
155 
156  if (_compute_rho_mu)
157  {
158  // Density and derivatives wrt pressure and temperature at the nodes
159  Real rho, drho_dp, drho_dT, drho_dx;
161  _porepressure[_qp][_phase_num], Tk, _xnacl[_qp], rho, drho_dp, drho_dT, drho_dx);
162  (*_density)[_qp] = rho;
163  (*_ddensity_dp)[_qp] = drho_dp;
164  (*_ddensity_dT)[_qp] = drho_dT;
165 
166  // Viscosity and derivatives wrt pressure and temperature at the nodes.
167  // Note that dmu_dp = dmu_drho * drho_dp
168  Real mu, dmu_drho, dmu_dT, dmu_dx;
169  // Viscosity calculation requires water density
170  Real rhow, drhow_dp, drhow_dT;
171  _water_fp->rho_dpT(_porepressure[_qp][_phase_num], Tk, rhow, drhow_dp, drhow_dT);
172  _brine_fp->mu_drhoTx(rhow, Tk, _xnacl[_qp], drhow_dT, mu, dmu_drho, dmu_dT, dmu_dx);
173  (*_viscosity)[_qp] = mu;
174  (*_dviscosity_dp)[_qp] = dmu_drho * drhow_dp;
175  (*_dviscosity_dT)[_qp] = dmu_dT;
176  }
177 
178  // Internal energy and derivatives wrt pressure and temperature at the nodes
180  {
181  Real e, de_dp, de_dT, de_dx;
182  _brine_fp->e_dpTx(_porepressure[_qp][_phase_num], Tk, _xnacl[_qp], e, de_dp, de_dT, de_dx);
183  (*_internal_energy)[_qp] = e;
184  (*_dinternal_energy_dp)[_qp] = de_dp;
185  (*_dinternal_energy_dT)[_qp] = de_dT;
186  }
187 
188  // Enthalpy and derivatives wrt pressure and temperature at the nodes
189  if (_compute_enthalpy)
190  {
191  Real h, dh_dp, dh_dT, dh_dx;
192  _brine_fp->h_dpTx(_porepressure[_qp][_phase_num], Tk, _xnacl[_qp], h, dh_dp, dh_dT, dh_dx);
193  (*_enthalpy)[_qp] = h;
194  (*_denthalpy_dp)[_qp] = dh_dp;
195  (*_denthalpy_dT)[_qp] = dh_dT;
196  }
197 }
virtual void rho_dpTx(Real pressure, Real temperature, Real xnacl, Real &rho, Real &drho_dp, Real &drho_dT, Real &drho_dx) const override
Density and its derivatives wrt pressure, temperature and mass fraction.
const BrineFluidProperties * _brine_fp
Brine Fluid properties UserObject.
virtual void rho_dpT(Real pressure, Real temperature, Real &rho, Real &drho_dp, Real &drho_dT) const =0
Density and its derivatives wrt pressure and temperature.
const bool _compute_enthalpy
If true, this Material will compute enthalpy and its derivatives.
virtual void h_dpTx(Real pressure, Real temperature, Real xnacl, Real &h, Real &dh_dp, Real &dh_dT, Real &dh_dx) const override
Enthalpy and derivatives wrt pressure, temperature and mass fraction.
const unsigned int _phase_num
Phase number of fluid.
const SinglePhaseFluidPropertiesPT * _water_fp
Water Fluid properties UserObject.
const bool _compute_rho_mu
If true, this Material will compute density and viscosity, and their derivatives. ...
const bool _compute_internal_energy
If true, this Material will compute internal energy and its derivatives.
virtual void mu_drhoTx(Real water_density, Real temperature, Real xnacl, Real dwater_density_dT, Real &mu, Real &dmu_drho, Real &dmu_dT, Real &dmu_dx) const override
Dynamic viscosity and its derivatives wrt density, temperature and mass fraction. ...
const VariableValue & _xnacl
NaCl mass fraction at the qps or nodes.
const MaterialProperty< Real > & _temperature
Fluid temperature at the nodes or quadpoints.
virtual void e_dpTx(Real pressure, Real temperature, Real xnacl, Real &e, Real &de_dp, Real &de_dT, Real &de_dx) const override
Internal energy and its derivatives wrt pressure, temperature and mass fraction.
const Real _t_c2k
Conversion from degrees Celsius to degrees Kelvin.
const MaterialProperty< std::vector< Real > > & _porepressure
Pore pressure at the nodes or quadpoints.
void PorousFlowBrine::initQpStatefulProperties ( )
overrideprotectedvirtual

Definition at line 138 of file PorousFlowBrine.C.

139 {
140  if (_compute_rho_mu)
141  (*_density)[_qp] =
144  (*_internal_energy)[_qp] =
145  _brine_fp->e(_porepressure[_qp][_phase_num], _temperature[_qp] + _t_c2k, _xnacl[_qp]);
146  if (_compute_enthalpy)
147  (*_enthalpy)[_qp] =
148  _brine_fp->h(_porepressure[_qp][_phase_num], _temperature[_qp] + _t_c2k, _xnacl[_qp]);
149 }
const BrineFluidProperties * _brine_fp
Brine Fluid properties UserObject.
const bool _compute_enthalpy
If true, this Material will compute enthalpy and its derivatives.
virtual Real rho(Real pressure, Real temperature, Real xnacl) const override
Density.
const unsigned int _phase_num
Phase number of fluid.
const bool _compute_rho_mu
If true, this Material will compute density and viscosity, and their derivatives. ...
virtual Real e(Real pressure, Real temperature, Real xnacl) const override
Internal energy.
const bool _compute_internal_energy
If true, this Material will compute internal energy and its derivatives.
virtual Real h(Real pressure, Real temperature, Real xnacl) const override
Enthalpy.
const VariableValue & _xnacl
NaCl mass fraction at the qps or nodes.
const MaterialProperty< Real > & _temperature
Fluid temperature at the nodes or quadpoints.
const Real _t_c2k
Conversion from degrees Celsius to degrees Kelvin.
const MaterialProperty< std::vector< Real > > & _porepressure
Pore pressure at the nodes or quadpoints.

Member Data Documentation

const BrineFluidProperties* PorousFlowBrine::_brine_fp
protected

Brine Fluid properties UserObject.

Definition at line 78 of file PorousFlowBrine.h.

Referenced by computeQpProperties(), initQpStatefulProperties(), and PorousFlowBrine().

const bool PorousFlowBrine::_compute_enthalpy
protected

If true, this Material will compute enthalpy and its derivatives.

Definition at line 39 of file PorousFlowBrine.h.

Referenced by computeQpProperties(), and initQpStatefulProperties().

const bool PorousFlowBrine::_compute_internal_energy
protected

If true, this Material will compute internal energy and its derivatives.

Definition at line 36 of file PorousFlowBrine.h.

Referenced by computeQpProperties(), and initQpStatefulProperties().

const bool PorousFlowBrine::_compute_rho_mu
protected

If true, this Material will compute density and viscosity, and their derivatives.

Definition at line 33 of file PorousFlowBrine.h.

Referenced by computeQpProperties(), and initQpStatefulProperties().

MaterialProperty<Real>* const PorousFlowBrine::_ddensity_dp
protected

Derivative of fluid density wrt phase pore pressure at the qps or nodes.

Definition at line 45 of file PorousFlowBrine.h.

MaterialProperty<Real>* const PorousFlowBrine::_ddensity_dT
protected

Derivative of fluid density wrt temperature at the qps or nodes.

Definition at line 48 of file PorousFlowBrine.h.

MaterialProperty<Real>* const PorousFlowBrine::_density
protected

Fluid phase density at the qps or nodes.

Definition at line 42 of file PorousFlowBrine.h.

MaterialProperty<Real>* const PorousFlowBrine::_denthalpy_dp
protected

Derivative of fluid enthalpy wrt phase pore pressure at the qps or nodes.

Definition at line 72 of file PorousFlowBrine.h.

MaterialProperty<Real>* const PorousFlowBrine::_denthalpy_dT
protected

Derivative of fluid enthalpy wrt temperature at the qps or nodes.

Definition at line 75 of file PorousFlowBrine.h.

MaterialProperty<Real>* const PorousFlowBrine::_dinternal_energy_dp
protected

Derivative of fluid internal_energy wrt phase pore pressure at the qps or nodes.

Definition at line 63 of file PorousFlowBrine.h.

MaterialProperty<Real>* const PorousFlowBrine::_dinternal_energy_dT
protected

Derivative of fluid internal_energy wrt temperature at the qps or nodes.

Definition at line 66 of file PorousFlowBrine.h.

MaterialProperty<Real>* const PorousFlowBrine::_dviscosity_dp
protected

Derivative of fluid phase viscosity wrt pressure at the nodes or qps.

Definition at line 54 of file PorousFlowBrine.h.

MaterialProperty<Real>* const PorousFlowBrine::_dviscosity_dT
protected

Derivative of fluid phase viscosity wrt temperature at the nodes or qps.

Definition at line 57 of file PorousFlowBrine.h.

MaterialProperty<Real>* const PorousFlowBrine::_enthalpy
protected

Fluid phase enthalpy at the qps or nodes.

Definition at line 69 of file PorousFlowBrine.h.

MaterialProperty<Real>* const PorousFlowBrine::_internal_energy
protected

Fluid phase internal_energy at the qps or nodes.

Definition at line 60 of file PorousFlowBrine.h.

const std::string PorousFlowMaterialBase::_phase
protectedinherited

Stringified fluid phase number.

Definition at line 36 of file PorousFlowMaterialBase.h.

const unsigned int PorousFlowMaterialBase::_phase_num
protectedinherited
const MaterialProperty<std::vector<Real> >& PorousFlowFluidPropertiesBase::_porepressure
protectedinherited
const VariableName PorousFlowFluidPropertiesBase::_pressure_variable_name
protectedinherited

Name of (dummy) pressure primary variable.

Definition at line 38 of file PorousFlowFluidPropertiesBase.h.

const Real PorousFlowFluidPropertiesBase::_R
protectedinherited

Universal gas constant.

Definition at line 47 of file PorousFlowFluidPropertiesBase.h.

const Real PorousFlowFluidPropertiesBase::_t_c2k
protectedinherited
const MaterialProperty<Real>& PorousFlowFluidPropertiesBase::_temperature
protectedinherited
const VariableName PorousFlowFluidPropertiesBase::_temperature_variable_name
protectedinherited

Name of (dummy) temperature primary variable.

Definition at line 41 of file PorousFlowFluidPropertiesBase.h.

MaterialProperty<Real>* const PorousFlowBrine::_viscosity
protected

Fluid phase viscosity at the nodes or qps.

Definition at line 51 of file PorousFlowBrine.h.

const SinglePhaseFluidPropertiesPT* PorousFlowBrine::_water_fp
protected

Water Fluid properties UserObject.

Definition at line 81 of file PorousFlowBrine.h.

Referenced by computeQpProperties(), and PorousFlowBrine().

const VariableValue& PorousFlowBrine::_xnacl
protected

NaCl mass fraction at the qps or nodes.

Definition at line 84 of file PorousFlowBrine.h.

Referenced by computeQpProperties(), and initQpStatefulProperties().


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