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

Brine (NaCl in H2O) fluid properties as a function of pressure (Pa), temperature (K) and NaCl mass fraction. More...

#include <BrineFluidProperties.h>

Inheritance diagram for BrineFluidProperties:
[legend]

Public Member Functions

 BrineFluidProperties (const InputParameters &parameters)
 
virtual ~BrineFluidProperties ()
 
virtual std::string fluidName () const override
 Fluid name. More...
 
Real molarMass (Real xnacl) const
 Average molar mass of brine. More...
 
FPDualReal molarMass (const FPDualReal &xnacl) const
 
Real molarMassNaCl () const
 NaCl molar mass. More...
 
Real molarMassH2O () const
 H2O molar mass. More...
 
virtual Real rho_from_p_T_X (Real pressure, Real temperature, Real xnacl) const override
 
FPDualReal rho_from_p_T_X (const FPDualReal &pressure, const FPDualReal &temperature, const FPDualReal &xnacl) const
 
virtual void rho_from_p_T_X (Real pressure, Real temperature, Real xnacl, Real &rho, Real &drho_dp, Real &drho_dT, Real &drho_dx) const override
 
virtual Real mu_from_p_T_X (Real pressure, Real temperature, Real xnacl) const override
 
virtual void mu_from_p_T_X (Real pressure, Real temperature, Real xnacl, Real &mu, Real &dmu_dp, Real &dmu_dT, Real &dmu_dx) const override
 
FPDualReal h_from_p_T_X (const FPDualReal &pressure, const FPDualReal &temperature, const FPDualReal &xnacl) const
 
virtual Real h_from_p_T_X (Real pressure, Real temperature, Real xnacl) const override
 
virtual void h_from_p_T_X (Real pressure, Real temperature, Real xnacl, Real &h, Real &dh_dp, Real &dh_dT, Real &dh_dx) const override
 
virtual Real cp_from_p_T_X (Real pressure, Real temperature, Real xnacl) const override
 
FPDualReal e_from_p_T_X (const FPDualReal &pressure, const FPDualReal &temperature, const FPDualReal &xnacl) const
 
virtual Real e_from_p_T_X (Real pressure, Real temperature, Real xnacl) const override
 
virtual void e_from_p_T_X (Real pressure, Real temperature, Real xnacl, Real &e, Real &de_dp, Real &de_dT, Real &de_dx) const override
 
virtual Real k_from_p_T_X (Real pressure, Real temperature, Real xnacl) const override
 
Real vaporPressure (Real temperature, Real xnacl) const
 Brine vapour pressure From Haas, Physical properties of the coexisting phases and thermochemical properties of the H2O component in boiling NaCl solutions, Geological Survey Bulletin, 1421-A (1976). More...
 
Real haliteSolubility (Real temperature) const
 Solubility of halite (solid NaCl) in water Originally from Potter et al., A new method for determining the solubility of salts in aqueous solutions at elevated temperatures, J. More...
 
Real henryConstant (Real temperature, const std::vector< Real > &coeffs) const
 IAPWS formulation of Henry's law constant for dissolution in water (implemented in water FluidProperties userobject) More...
 
void henryConstant (Real temperature, const std::vector< Real > &coeffs, Real &Kh, Real &dKh_dT) const
 
DualReal henryConstant (const DualReal &temperature, const std::vector< Real > &coeffs) const
 
virtual const SinglePhaseFluidPropertiesgetComponent (unsigned int component) const override
 Get UserObject for specified component. More...
 
virtual void rho_mu_from_p_T_X (Real pressure, Real temperature, Real xmass, Real &rho, Real &mu) const
 Density and viscosity. More...
 
virtual void rho_mu_from_p_T_X (DualReal pressure, DualReal temperature, DualReal xmass, DualReal &rho, DualReal &mu) const
 
virtual void rho_mu_from_p_T_X (Real pressure, Real temperature, Real xmass, Real &rho, Real &drho_dp, Real &drho_dT, Real &drho_dx, Real &mu, Real &dmu_dp, Real &dmu_dT, Real &dmu_dx) const
 Density and viscosity and their derivatives wrt pressure, temperature and mass fraction. More...
 
virtual void execute () final
 
virtual void initialize () final
 
virtual void finalize () final
 
virtual void threadJoin (const UserObject &) final
 
virtual void subdomainSetup () final
 

Static Public Attributes

static const unsigned int WATER = 0
 Fluid component numbers for water and NaCl. More...
 
static const unsigned int NACL = 1
 
static const Real _R = 8.3144598
 Universal gas constant (J/mol/K) More...
 

Protected Member Functions

Real massFractionToMolalConc (Real xnacl) const
 Conversion from mass fraction to molal concentration (molality) More...
 
Real massFractionToMoleFraction (Real xnacl) const
 Conversion from mass fraction to mole fraction. More...
 
FPDualReal massFractionToMoleFraction (const FPDualReal &xnacl) const
 

Protected Attributes

const Water97FluidProperties_water97_fp
 Water97FluidProperties UserObject (for Henry's law) More...
 
const SinglePhaseFluidProperties_water_fp
 Water97FluidProperties UserObject. More...
 
const SinglePhaseFluidProperties_nacl_fp
 NaClFluidProperties UserObject. More...
 
Real _Mnacl
 Molar mass of NaCl (kg/mol) More...
 
Real _Mh2o
 Molar mass of water (H2O) (kg/mol) More...
 
bool _water_fp_derivs
 Flag to indicate whether to calculate derivatives in water_fp. More...
 
const Real _T_c2k
 Conversion of temperature from Celsius to Kelvin. More...
 
const bool _allow_imperfect_jacobians
 Flag to set unimplemented Jacobian entries to zero. More...
 
 propfunc (rho, p, T, X) propfunc(mu
 Compute a fluid property given for the state defined by three given properties. More...
 
propfunc (h, p, T, X) propfunc(cp
 
X X propfunc (e, p, T, X) propfunc(k
 
 p
 
p
 
X X p
 
 T
 
T
 
X X T
 

Detailed Description

Brine (NaCl in H2O) fluid properties as a function of pressure (Pa), temperature (K) and NaCl mass fraction.

Most properties from: Driesner, The system H2O-NaCl. Part II: Correlations for molar volume, enthalpy, and isobaric heat capacity from 0 to 1000 C, 1 to 5000 bar, and 0 to 1 Xnacl, Geochimica et Cosmochimica Acta 71, 4902-4919 (2007)

Viscosity and thermal conductivity from: Phillips et al, A technical databook for geothermal energy utilization, LbL-12810 (1981) Note: uses water thermal conductivity from IAPWS rather than the correlation given by Phillips et al.

Definition at line 38 of file BrineFluidProperties.h.

Constructor & Destructor Documentation

◆ BrineFluidProperties()

BrineFluidProperties::BrineFluidProperties ( const InputParameters &  parameters)

Definition at line 25 of file BrineFluidProperties.C.

27 {
28  // There are two possibilities to consider:
29  // 1) No water_fp has been supplied (in which case one is constructed)
30  // 2) A water_fp hase been supplied (in which case it is used)
31  // In both cases, though, a Water97FluidProperties UserObject must be added
32  // Note: this UserObject is only used to gain access to the Henry's constant
33  // formulation. All property calculations are performed using _water_fp
34  const std::string water_name = name() + ":water";
35  {
36  const std::string class_name = "Water97FluidProperties";
37  InputParameters params = _app.getFactory().getValidParams(class_name);
38  if (_tid == 0)
39  _fe_problem.addUserObject(class_name, water_name, params);
40  }
41  _water97_fp = &_fe_problem.getUserObjectTempl<Water97FluidProperties>(water_name);
42 
43  if (parameters.isParamSetByUser("water_fp"))
44  {
45  // SinglePhaseFluidPropertiesPT UserObject for water
46  _water_fp = &getUserObject<SinglePhaseFluidProperties>("water_fp");
47 
48  // Check that a water userobject has actually been supplied
49  if (_water_fp->fluidName() != "water")
50  paramError("water_fp", "A water FluidProperties UserObject must be supplied");
51  }
52  else
53  {
54  // Construct a SinglePhaseFluidProperties UserObject for water
55  _water_fp = &_fe_problem.getUserObjectTempl<SinglePhaseFluidProperties>(water_name);
56  }
57 
58  // SinglePhaseFluidProperties UserObject for NaCl
59  const std::string nacl_name = name() + ":nacl";
60  {
61  const std::string class_name = "NaClFluidProperties";
62  InputParameters params = _app.getFactory().getValidParams(class_name);
63  if (_tid == 0)
64  _fe_problem.addUserObject(class_name, nacl_name, params);
65  }
66  _nacl_fp = &_fe_problem.getUserObjectTempl<SinglePhaseFluidProperties>(nacl_name);
67 
68  // Molar mass of NaCl and H20
71 }

◆ ~BrineFluidProperties()

BrineFluidProperties::~BrineFluidProperties ( )
virtual

Definition at line 73 of file BrineFluidProperties.C.

73 {}

Member Function Documentation

◆ cp_from_p_T_X()

Real BrineFluidProperties::cp_from_p_T_X ( Real  pressure,
Real  temperature,
Real  xnacl 
) const
overridevirtual

Definition at line 352 of file BrineFluidProperties.C.

353 {
354  Real q1, q2, q10, q11, q12, q20, q21, q22, q23, q1x1, q2x1, Th;
355 
356  // The correlation requires the pressure in bar, not Pa.
357  Real pbar = pressure * 1.0e-5;
358  Real pbar2 = pbar * pbar;
359 
360  // The correlation requires mole fraction
361  Real Xnacl = massFractionToMoleFraction(xnacl);
362 
363  q11 = -32.1724 + 0.0621255 * pbar;
364  q21 = -1.69513 - 4.52781e-4 * pbar - 6.04279e-8 * pbar2;
365  q22 = 0.0612567 + 1.88082e-5 * pbar;
366 
367  q1x1 = 47.9048 - 9.36994e-3 * pbar + 6.51059e-6 * pbar2;
368  q2x1 = 0.241022 + 3.45087e-5 * pbar - 4.28356e-9 * pbar2;
369 
370  q12 = -q11 - q1x1;
371  q10 = q1x1;
372 
373  q20 = 1.0 - q21 * std::sqrt(q22);
374  q23 = q2x1 - q20 - q21 * std::sqrt(1.0 + q22);
375 
376  q1 = q10 + q11 * (1.0 - Xnacl) + q12 * (1.0 - Xnacl) * (1.0 - Xnacl);
377  q2 = q20 + q21 * std::sqrt(Xnacl + q22) + q23 * Xnacl;
378  // The temperature Th where the brine has the same isobaric heat capacity
379  // as pure water. Note: correlation uses temperature in Celcius
380  Th = q1 + q2 * (temperature - _T_c2k);
381 
382  // The brine isobaric heat capacity is then given by the isobaric heat
383  // capacity of water at temperature Th multiplied by q2
384  // Note: water isobaric heat capacity requires temperature in Kelvin
385  return q2 * _water_fp->cp_from_p_T(pressure, Th + _T_c2k);
386 }

◆ e_from_p_T_X() [1/3]

FPDualReal BrineFluidProperties::e_from_p_T_X ( const FPDualReal pressure,
const FPDualReal temperature,
const FPDualReal xnacl 
) const

◆ e_from_p_T_X() [2/3]

Real BrineFluidProperties::e_from_p_T_X ( Real  pressure,
Real  temperature,
Real  xnacl 
) const
overridevirtual

Definition at line 400 of file BrineFluidProperties.C.

401 {
402  Real enthalpy = h_from_p_T_X(pressure, temperature, xnacl);
403  Real density = rho_from_p_T_X(pressure, temperature, xnacl);
404 
405  return enthalpy - pressure / density;
406 }

◆ e_from_p_T_X() [3/3]

void BrineFluidProperties::e_from_p_T_X ( Real  pressure,
Real  temperature,
Real  xnacl,
Real &  e,
Real &  de_dp,
Real &  de_dT,
Real &  de_dx 
) const
overridevirtual

Definition at line 409 of file BrineFluidProperties.C.

416 {
417  // Initialise the AD value and derivatives
419  Moose::derivInsert(p.derivatives(), 0, 1.0);
421  Moose::derivInsert(T.derivatives(), 1, 1.0);
422  FPDualReal x = xnacl;
423  Moose::derivInsert(x.derivatives(), 2, 1.0);
424 
425  _water_fp_derivs = true;
426  FPDualReal ad_e = e_from_p_T_X(p, T, x);
427 
428  e = ad_e.value();
429  de_dp = ad_e.derivatives()[0];
430  de_dT = ad_e.derivatives()[1];
431  de_dx = ad_e.derivatives()[2];
432 }

◆ execute()

virtual void FluidProperties::execute ( )
inlinefinalvirtualinherited

Definition at line 34 of file FluidProperties.h.

34 {}

◆ finalize()

virtual void FluidProperties::finalize ( )
inlinefinalvirtualinherited

Definition at line 36 of file FluidProperties.h.

36 {}

◆ fluidName()

std::string BrineFluidProperties::fluidName ( ) const
overridevirtual

Fluid name.

Returns
"brine"

Reimplemented from MultiComponentFluidProperties.

Definition at line 92 of file BrineFluidProperties.C.

93 {
94  return "brine";
95 }

Referenced by PorousFlowBrineCO2::PorousFlowBrineCO2().

◆ getComponent()

const SinglePhaseFluidProperties & BrineFluidProperties::getComponent ( unsigned int  component) const
overridevirtual

Get UserObject for specified component.

Parameters
componentfluid component
Returns
reference to SinglePhaseFluidPropertiesPT UserObject for component

Reimplemented from MultiComponentFluidProperties.

Definition at line 76 of file BrineFluidProperties.C.

77 {
78  switch (component)
79  {
80  case WATER:
81  return *_water_fp;
82 
83  case NACL:
84  return *_nacl_fp;
85 
86  default:
87  mooseError("BrineFluidProperties::getComponent has been provided an incorrect component");
88  }
89 }

◆ h_from_p_T_X() [1/3]

FPDualReal BrineFluidProperties::h_from_p_T_X ( const FPDualReal pressure,
const FPDualReal temperature,
const FPDualReal xnacl 
) const

Definition at line 264 of file BrineFluidProperties.C.

267 {
268  FPDualReal q1, q2, q10, q11, q12, q20, q21, q22, q23, q1x1, q2x1, Th;
269 
270  // The correlation requires the pressure in bar, not Pa.
271  const FPDualReal pbar = pressure * 1.0e-5;
272  const FPDualReal pbar2 = pbar * pbar;
273 
274  // The correlation requires mole fraction
275  const FPDualReal Xnacl = massFractionToMoleFraction(xnacl);
276 
277  q11 = -32.1724 + 0.0621255 * pbar;
278  q21 = -1.69513 - 4.52781e-4 * pbar - 6.04279e-8 * pbar2;
279  q22 = 0.0612567 + 1.88082e-5 * pbar;
280 
281  q1x1 = 47.9048 - 9.36994e-3 * pbar + 6.51059e-6 * pbar2;
282  q2x1 = 0.241022 + 3.45087e-5 * pbar - 4.28356e-9 * pbar2;
283 
284  q12 = -q11 - q1x1;
285  q10 = q1x1;
286 
287  q20 = 1.0 - q21 * std::sqrt(q22);
288  q23 = q2x1 - q20 - q21 * std::sqrt(1.0 + q22);
289 
290  q1 = q10 + q11 * (1.0 - Xnacl) + q12 * (1.0 - Xnacl) * (1.0 - Xnacl);
291  q2 = q20 + q21 * std::sqrt(Xnacl + q22) + q23 * Xnacl;
292  // The temperature Th where the brine has the same enthalpy as pure water
293  // Note: correlation uses temperature in Celcius
294  Th = q1 + q2 * (temperature - _T_c2k);
295 
296  // The brine enthalpy is then given by the enthalpy of water at temperature Th
297  // Note: water enthalpy requires temperature in Kelvin
299  if (_water_fp_derivs)
300  {
301  Real h, dh_dp, dh_dT;
302  _water_fp->h_from_p_T(pressure.value(), Th.value() + _T_c2k, h, dh_dp, dh_dT);
303  enthalpy = h;
304 
305  enthalpy.derivatives() = pressure.derivatives() * dh_dp + Th.derivatives() * dh_dT;
306  }
307  else
308  enthalpy = _water_fp->h_from_p_T(pressure.value(), Th.value() + _T_c2k);
309 
310  return enthalpy;
311 }

Referenced by PorousFlowBrine::computeQpProperties(), e_from_p_T_X(), h_from_p_T_X(), PorousFlowBrine::initQpStatefulProperties(), and PorousFlowBrineCO2::liquidProperties().

◆ h_from_p_T_X() [2/3]

Real BrineFluidProperties::h_from_p_T_X ( Real  pressure,
Real  temperature,
Real  xnacl 
) const
overridevirtual

Definition at line 314 of file BrineFluidProperties.C.

315 {
316  // Initialise the AD value (no derivatives required)
319  FPDualReal x = xnacl;
320 
321  _water_fp_derivs = false;
322  return h_from_p_T_X(p, T, x).value();
323 }

◆ h_from_p_T_X() [3/3]

void BrineFluidProperties::h_from_p_T_X ( Real  pressure,
Real  temperature,
Real  xnacl,
Real &  h,
Real &  dh_dp,
Real &  dh_dT,
Real &  dh_dx 
) const
overridevirtual

Definition at line 326 of file BrineFluidProperties.C.

333 {
334  // Initialise the AD value and derivatives
336  Moose::derivInsert(p.derivatives(), 0, 1.0);
338  Moose::derivInsert(T.derivatives(), 1, 1.0);
339  FPDualReal x = xnacl;
340  Moose::derivInsert(x.derivatives(), 2, 1.0);
341 
342  _water_fp_derivs = true;
343  FPDualReal ad_h = h_from_p_T_X(p, T, x);
344 
345  h = ad_h.value();
346  dh_dp = ad_h.derivatives()[0];
347  dh_dT = ad_h.derivatives()[1];
348  dh_dx = ad_h.derivatives()[2];
349 }

◆ haliteSolubility()

Real BrineFluidProperties::haliteSolubility ( Real  temperature) const

Solubility of halite (solid NaCl) in water Originally from Potter et al., A new method for determining the solubility of salts in aqueous solutions at elevated temperatures, J.

Res. U.S. Geol. Surv., 5, 389-395 (1977). Equation describing halite solubility is repeated in Chou, Phase relations in the system NaCI-KCI-H2O. III: Solubilities of halite in vapor-saturated liquids above 445 C and redetermination of phase equilibrium properties in the system NaCI-HzO to 1000 C and 1500 bars, Geochimica et Cosmochimica Acta 51, 1965-1975 (1987). Note: this correlation is valid for 0 <= T <= 424.5 C

Parameters
temperaturetemperature (K)
Returns
halite solubility (kg/kg)

Definition at line 471 of file BrineFluidProperties.C.

472 {
473  // This correlation requires temperature in Celcius
474  Real Tc = temperature - _T_c2k;
475 
476  return (26.18 + 7.2e-3 * Tc + 1.06e-4 * Tc * Tc) / 100.0;
477 }

◆ henryConstant() [1/3]

DualReal BrineFluidProperties::henryConstant ( const DualReal &  temperature,
const std::vector< Real > &  coeffs 
) const

Definition at line 519 of file BrineFluidProperties.C.

521 {
522  Real Kh, dKh_dT;
523  henryConstant(temperature.value(), coeffs, Kh, dKh_dT);
524 
525  DualReal henry = Kh;
526  henry.derivatives() = temperature.derivatives() * dKh_dT;
527 
528  return henry;
529 }

◆ henryConstant() [2/3]

Real BrineFluidProperties::henryConstant ( Real  temperature,
const std::vector< Real > &  coeffs 
) const

IAPWS formulation of Henry's law constant for dissolution in water (implemented in water FluidProperties userobject)

Parameters
Tfluid temperature (K)
coeffsHenry's constant coefficients of gas
[out]KhHenry's constant
[out]dKh_dTderivative of Kh wrt temperature

Definition at line 504 of file BrineFluidProperties.C.

505 {
506  return _water97_fp->henryConstant(temperature, coeffs);
507 }

Referenced by henryConstant(), and PorousFlowBrineCO2::henryConstant().

◆ henryConstant() [3/3]

void BrineFluidProperties::henryConstant ( Real  temperature,
const std::vector< Real > &  coeffs,
Real &  Kh,
Real &  dKh_dT 
) const

Definition at line 510 of file BrineFluidProperties.C.

514 {
515  _water97_fp->henryConstant(temperature, coeffs, Kh, dKh_dT);
516 }

◆ initialize()

virtual void FluidProperties::initialize ( )
inlinefinalvirtualinherited

Definition at line 35 of file FluidProperties.h.

35 {}

◆ k_from_p_T_X()

Real BrineFluidProperties::k_from_p_T_X ( Real  pressure,
Real  temperature,
Real  xnacl 
) const
overridevirtual

Definition at line 435 of file BrineFluidProperties.C.

436 {
437  // Correlation requires molal concentration (mol/kg)
438  Real mol = massFractionToMolalConc(xnacl);
439  // Correlation requires temperature in C
440  Real Tc = temperature - _T_c2k;
441 
442  Real S = 100.0 * _Mnacl * mol / (1.0 + _Mnacl * mol);
443  Real lambdaw = _water_fp->k_from_p_T(pressure, temperature);
444  Real lambda = 1.0 - (2.3434e-3 - 7.924e-6 * Tc + 3.924e-8 * Tc * Tc) * S +
445  (1.06e-5 - 2.0e-8 * Tc - 1.2e-10 * Tc * Tc) * S * S;
446 
447  return lambda * lambdaw;
448 }

◆ massFractionToMolalConc()

Real BrineFluidProperties::massFractionToMolalConc ( Real  xnacl) const
protected

Conversion from mass fraction to molal concentration (molality)

Parameters
xnaclNaCl mass fraction (kg/kg)
Returns
molal concentration (mol/kg)

Definition at line 480 of file BrineFluidProperties.C.

481 {
482  return xnacl / ((1.0 - xnacl) * _Mnacl);
483 }

Referenced by k_from_p_T_X(), mu_from_p_T_X(), and vaporPressure().

◆ massFractionToMoleFraction() [1/2]

FPDualReal BrineFluidProperties::massFractionToMoleFraction ( const FPDualReal xnacl) const
protected

Definition at line 495 of file BrineFluidProperties.C.

496 {
497  // The average molar mass of brine from the mass fraction
498  FPDualReal Mbrine = molarMass(xnacl);
499  // The mole fraction is then
500  return xnacl * Mbrine / _Mnacl;
501 }

◆ massFractionToMoleFraction() [2/2]

Real BrineFluidProperties::massFractionToMoleFraction ( Real  xnacl) const
protected

Conversion from mass fraction to mole fraction.

Parameters
xnaclNaCl mass fraction (kg/kg)
Returns
mole fraction (mol/mol)

Definition at line 486 of file BrineFluidProperties.C.

487 {
488  // The average molar mass of brine from the mass fraction
489  Real Mbrine = molarMass(xnacl);
490  // The mole fraction is then
491  return xnacl * Mbrine / _Mnacl;
492 }

Referenced by cp_from_p_T_X(), h_from_p_T_X(), and rho_from_p_T_X().

◆ molarMass() [1/2]

FPDualReal BrineFluidProperties::molarMass ( const FPDualReal xnacl) const

Definition at line 98 of file BrineFluidProperties.C.

99 {
100  return 1.0 / (xnacl / _Mnacl + (1.0 - xnacl) / _Mh2o);
101 }

◆ molarMass() [2/2]

Real BrineFluidProperties::molarMass ( Real  xnacl) const

Average molar mass of brine.

Parameters
xnaclNaCl mass fraction (-)
Returns
average molar mass (kg/mol)

Definition at line 104 of file BrineFluidProperties.C.

105 {
106  return 1.0 / (xnacl / _Mnacl + (1.0 - xnacl) / _Mh2o);
107 }

Referenced by massFractionToMoleFraction(), and rho_from_p_T_X().

◆ molarMassH2O()

Real BrineFluidProperties::molarMassH2O ( ) const

H2O molar mass.

Returns
molar mass of H2O (kg/mol)

Definition at line 116 of file BrineFluidProperties.C.

117 {
118  return _Mh2o;
119 }

◆ molarMassNaCl()

Real BrineFluidProperties::molarMassNaCl ( ) const

NaCl molar mass.

Returns
molar mass of NaCl (kg/mol)

Definition at line 110 of file BrineFluidProperties.C.

111 {
112  return _Mnacl;
113 }

◆ mu_from_p_T_X() [1/2]

Real BrineFluidProperties::mu_from_p_T_X ( Real  pressure,
Real  temperature,
Real  xnacl 
) const
overridevirtual

Definition at line 211 of file BrineFluidProperties.C.

212 {
213  // Correlation requires molal concentration (mol/kg)
214  const Real mol = massFractionToMolalConc(xnacl);
215  const Real mol2 = mol * mol;
216  const Real mol3 = mol2 * mol;
217 
218  // Correlation requires temperature in C
219  const Real Tc = temperature - _T_c2k;
220 
221  const Real a = 1.0 + 0.0816 * mol + 0.0122 * mol2 + 0.128e-3 * mol3 +
222  0.629e-3 * Tc * (1.0 - std::exp(-0.7 * mol));
223 
224  const Real water_viscosity = _water_fp->mu_from_p_T(pressure, temperature);
225 
226  return a * water_viscosity;
227 }

Referenced by PorousFlowBrine::computeQpProperties(), and PorousFlowBrineCO2::liquidProperties().

◆ mu_from_p_T_X() [2/2]

void BrineFluidProperties::mu_from_p_T_X ( Real  pressure,
Real  temperature,
Real  xnacl,
Real &  mu,
Real &  dmu_dp,
Real &  dmu_dT,
Real &  dmu_dx 
) const
overridevirtual

Definition at line 230 of file BrineFluidProperties.C.

237 {
238  // Viscosity of water and derivatives wrt pressure and temperature
239  Real muw, dmuw_dp, dmuw_dT;
240  _water_fp->mu_from_p_T(pressure, temperature, muw, dmuw_dp, dmuw_dT);
241 
242  // Correlation requires molal concentration (mol/kg)
243  Real mol = massFractionToMolalConc(xnacl);
244  Real dmol_dx = 1.0 / ((1.0 - xnacl) * (1.0 - xnacl) * _Mnacl);
245  Real mol2 = mol * mol;
246  Real mol3 = mol2 * mol;
247 
248  // Correlation requires temperature in C
249  Real Tc = temperature - _T_c2k;
250 
251  Real a = 1.0 + 0.0816 * mol + 0.0122 * mol2 + 0.128e-3 * mol3 +
252  0.629e-3 * Tc * (1.0 - std::exp(-0.7 * mol));
253  Real da_dx =
254  (0.0816 + 0.0244 * mol + 3.84e-4 * mol2 + 4.403e-4 * Tc * std::exp(-0.7 * mol)) * dmol_dx;
255  Real da_dT = 0.629e-3 * (1.0 - std::exp(-0.7 * mol));
256 
257  mu = a * muw;
258  dmu_dp = a * dmuw_dp;
259  dmu_dx = da_dx * muw;
260  dmu_dT = da_dT * muw + a * dmuw_dT;
261 }

◆ propfunc() [1/3]

X X MultiComponentFluidProperties::propfunc ( ,
p  ,
T  ,
 
)
inherited

◆ propfunc() [2/3]

X MultiComponentFluidProperties::propfunc ( ,
p  ,
T  ,
 
)
inherited

◆ propfunc() [3/3]

MultiComponentFluidProperties::propfunc ( rho  ,
p  ,
T  ,
 
)
inherited

Compute a fluid property given for the state defined by three given properties.

For all functions, the first three arguments are the given properties that define the fluid state. For the three-argument variants, the desired property is the return value. The seven-argument variants also provide partial derivatives x/da, dx/db and dx/dc where x is the desired property being computed, a is the first given property, b is the second given property etc. The desired property, dx/da, dx/db and dx/dc are stored into the 4rd, 5th, 6th and 7th arguments respectively.

Properties/parameters used in these function are listed below with their units:

@begincode p pressure [Pa] T temperature [K] X solute mass fraction [-] e specific internal energy [J/kg] rho density [kg/m^3] h specific enthalpy [J/kg] mu viscosity [Pa*s] k thermal conductivity [W/(m*K)] c speed of sound [m/s] cp constant-pressure specific heat [J/K] cv constant-volume specific heat [J/K]

As an example:

@begincode // calculate desnity given pressure, temperature and solute mass fraction: auto density = your_fluid_properties_object.rho_from_p_T_X(p, T, X);

// or use the derivative variant: Real rho = 0; // density will be stored into here Real drho_dp = 0; // derivative will be stored into here Real drho_dT = 0; // derivative will be stored into here Real drho_dX = 0; // derivative will be stored into here your_fluid_properties_object.rho_from_p_T_X(p, T, X, rho, drho_dp, drho_dT, drho_dX);

Automatic differentiation (AD) support is provided through prop_from_p_T_X(DualReal p, DualReal T, DualReal X) versions of the functions where p, T and X must be ADReal/DualNumber's calculated using all AD-supporting values.

◆ rho_from_p_T_X() [1/3]

FPDualReal BrineFluidProperties::rho_from_p_T_X ( const FPDualReal pressure,
const FPDualReal temperature,
const FPDualReal xnacl 
) const

Definition at line 122 of file BrineFluidProperties.C.

125 {
126  // The correlation requires the pressure in bar, not Pa.
127  FPDualReal pbar = pressure * 1.0e-5;
128  FPDualReal pbar2 = pbar * pbar;
129  FPDualReal pbar3 = pbar2 * pbar;
130 
131  // The correlation requires mole fraction
132  const FPDualReal Xnacl = massFractionToMoleFraction(xnacl);
133 
134  const FPDualReal n11 = -54.2958 - 45.7623 * std::exp(-9.44785e-4 * pbar);
135  const FPDualReal n21 = -2.6142 - 2.39092e-4 * pbar;
136  const FPDualReal n22 = 0.0356828 + 4.37235e-6 * pbar + 2.0566e-9 * pbar2;
137  const FPDualReal n1x1 = 330.47 + 0.942876 * std::sqrt(pbar) + 0.0817193 * pbar -
138  2.47556e-8 * pbar2 + 3.45052e-10 * pbar3;
139  const FPDualReal n2x1 = -0.0370751 + 0.00237723 * std::sqrt(pbar) + 5.42049e-5 * pbar +
140  5.84709e-9 * pbar2 - 5.99373e-13 * pbar3;
141  const FPDualReal n12 = -n1x1 - n11;
142  const FPDualReal n20 = 1.0 - n21 * std::sqrt(n22);
143  const FPDualReal n23 = n2x1 - n20 - n21 * std::sqrt(1.0 + n22);
144 
145  // The temperature Tv where the brine has the same molar volume as pure water
146  // Note: correlation uses temperature in Celcius
147  const FPDualReal n1 = n1x1 + n11 * (1.0 - Xnacl) + n12 * (1.0 - Xnacl) * (1.0 - Xnacl);
148  const FPDualReal n2 = n20 + n21 * std::sqrt(Xnacl + n22) + n23 * Xnacl;
149  const FPDualReal Tv = n1 + n2 * (temperature - _T_c2k);
150 
151  // The density of water at temperature Tv
152  // Note: convert Tv to Kelvin to calculate water density
153  FPDualReal water_density;
154  if (_water_fp_derivs)
155  {
156  Real rho, drho_dp, drho_dT;
157  _water_fp->rho_from_p_T(pressure.value(), Tv.value() + _T_c2k, rho, drho_dp, drho_dT);
158  water_density = rho;
159 
160  water_density.derivatives() = pressure.derivatives() * drho_dp + Tv.derivatives() * drho_dT;
161  }
162  else
163  water_density = _water_fp->rho_from_p_T(pressure.value(), Tv.value() + _T_c2k);
164 
165  // The brine density is given by the water density scaled by the ratio of
166  // brine molar mass to pure water molar mass
167  return water_density * molarMass(xnacl) / _Mh2o;
168 }

◆ rho_from_p_T_X() [2/3]

Real BrineFluidProperties::rho_from_p_T_X ( Real  pressure,
Real  temperature,
Real  xnacl 
) const
overridevirtual

Definition at line 171 of file BrineFluidProperties.C.

172 {
173  // Initialise the AD value (no derivatives required)
176  FPDualReal x = xnacl;
177 
178  _water_fp_derivs = false;
179  FPDualReal ad_rho = this->rho_from_p_T_X(p, T, x);
180 
181  return ad_rho.value();
182 }

Referenced by PorousFlowBrine::computeQpProperties(), e_from_p_T_X(), PorousFlowBrine::initQpStatefulProperties(), PorousFlowBrineCO2::liquidProperties(), rho_from_p_T_X(), and PorousFlowBrineCO2::saturation().

◆ rho_from_p_T_X() [3/3]

void BrineFluidProperties::rho_from_p_T_X ( Real  pressure,
Real  temperature,
Real  xnacl,
Real &  rho,
Real &  drho_dp,
Real &  drho_dT,
Real &  drho_dx 
) const
overridevirtual

Definition at line 185 of file BrineFluidProperties.C.

192 {
193  // Initialise the AD value and derivatives
195  Moose::derivInsert(p.derivatives(), 0, 1.0);
197  Moose::derivInsert(T.derivatives(), 1, 1.0);
198  FPDualReal x = xnacl;
199  Moose::derivInsert(x.derivatives(), 2, 1.0);
200 
201  _water_fp_derivs = true;
202  FPDualReal ad_rho = this->rho_from_p_T_X(p, T, x);
203 
204  rho = ad_rho.value();
205  drho_dp = ad_rho.derivatives()[0];
206  drho_dT = ad_rho.derivatives()[1];
207  drho_dx = ad_rho.derivatives()[2];
208 }

◆ rho_mu_from_p_T_X() [1/3]

void MultiComponentFluidProperties::rho_mu_from_p_T_X ( DualReal  pressure,
DualReal  temperature,
DualReal  xmass,
DualReal &  rho,
DualReal &  mu 
) const
virtualinherited

Definition at line 42 of file MultiComponentFluidProperties.C.

44 {
45  rho = rho_from_p_T_X(pressure, temperature, xmass);
46  mu = mu_from_p_T_X(pressure, temperature, xmass);
47 }

◆ rho_mu_from_p_T_X() [2/3]

void MultiComponentFluidProperties::rho_mu_from_p_T_X ( Real  pressure,
Real  temperature,
Real  xmass,
Real &  rho,
Real &  drho_dp,
Real &  drho_dT,
Real &  drho_dx,
Real &  mu,
Real &  dmu_dp,
Real &  dmu_dT,
Real &  dmu_dx 
) const
virtualinherited

Density and viscosity and their derivatives wrt pressure, temperature and mass fraction.

Parameters
pressurefluid pressure (Pa)
temperaturefluid temperature (K)
xmassmass fraction (-)
[out]rhodensity (kg/m^3)
[out]drho_dpderivative of density wrt pressure
[out]drho_dTderivative of density wrt temperature
[out]drho_dxderivative of density wrt mass fraction
[out]muviscosity (Pa.s)
[out]dmu_dpderivative of viscosity wrt pressure
[out]dmu_dTderivative of viscosity wrt temperature
[out]dmu_dxderivative of viscosity wrt mass fraction

Definition at line 50 of file MultiComponentFluidProperties.C.

61 {
62  rho_from_p_T_X(pressure, temperature, xmass, rho, drho_dp, drho_dT, drho_dx);
63  mu_from_p_T_X(pressure, temperature, xmass, mu, dmu_dp, dmu_dT, dmu_dx);
64 }

◆ rho_mu_from_p_T_X() [3/3]

void MultiComponentFluidProperties::rho_mu_from_p_T_X ( Real  pressure,
Real  temperature,
Real  xmass,
Real &  rho,
Real &  mu 
) const
virtualinherited

Density and viscosity.

Parameters
pressurefluid pressure (Pa)
temperaturefluid temperature (K)
xmassmass fraction (-)
[out]rhodensity (kg/m^3)

Definition at line 34 of file MultiComponentFluidProperties.C.

36 {
37  rho = rho_from_p_T_X(pressure, temperature, xmass);
38  mu = mu_from_p_T_X(pressure, temperature, xmass);
39 }

◆ subdomainSetup()

virtual void FluidProperties::subdomainSetup ( )
inlinefinalvirtualinherited

Definition at line 39 of file FluidProperties.h.

39 {}

◆ threadJoin()

virtual void FluidProperties::threadJoin ( const UserObject &  )
inlinefinalvirtualinherited

Definition at line 38 of file FluidProperties.h.

38 {}

◆ vaporPressure()

Real BrineFluidProperties::vaporPressure ( Real  temperature,
Real  xnacl 
) const

Brine vapour pressure From Haas, Physical properties of the coexisting phases and thermochemical properties of the H2O component in boiling NaCl solutions, Geological Survey Bulletin, 1421-A (1976).

Parameters
temperaturebrine temperature (K)
xnaclsalt mass fraction (-)
Returns
brine vapour pressure (Pa)

Definition at line 451 of file BrineFluidProperties.C.

452 {
453  // Correlation requires molal concentration (mol/kg)
454  Real mol = massFractionToMolalConc(xnacl);
455  Real mol2 = mol * mol;
456  Real mol3 = mol2 * mol;
457 
458  Real a = 1.0 + 5.93582e-6 * mol - 5.19386e-5 * mol2 + 1.23156e-5 * mol3;
459  Real b = 1.1542e-6 * mol + 1.41254e-7 * mol2 - 1.92476e-8 * mol3 - 1.70717e-9 * mol * mol3 +
460  1.0539e-10 * mol2 * mol3;
461 
462  // The temperature of pure water at the same pressure as the brine is given by
463  Real th20 = std::exp(std::log(temperature) / (a + b * temperature));
464 
465  // The brine vapour pressure is then found by evaluating the saturation pressure for pure water
466  // using this effective temperature
467  return _water_fp->vaporPressure(th20);
468 }

Referenced by PorousFlowBrineCO2::solveEquilibriumMoleFractionHighTemp().

Member Data Documentation

◆ _allow_imperfect_jacobians

const bool FluidProperties::_allow_imperfect_jacobians
protectedinherited

Flag to set unimplemented Jacobian entries to zero.

Definition at line 48 of file FluidProperties.h.

Referenced by SinglePhaseFluidProperties::fluidPropError().

◆ _Mh2o

Real BrineFluidProperties::_Mh2o
protected

Molar mass of water (H2O) (kg/mol)

Definition at line 202 of file BrineFluidProperties.h.

Referenced by BrineFluidProperties(), molarMass(), molarMassH2O(), and rho_from_p_T_X().

◆ _Mnacl

Real BrineFluidProperties::_Mnacl
protected

◆ _nacl_fp

const SinglePhaseFluidProperties* BrineFluidProperties::_nacl_fp
protected

NaClFluidProperties UserObject.

Definition at line 197 of file BrineFluidProperties.h.

Referenced by BrineFluidProperties(), and getComponent().

◆ _R

const Real FluidProperties::_R = 8.3144598
staticinherited

◆ _T_c2k

const Real FluidProperties::_T_c2k
protectedinherited

◆ _water97_fp

const Water97FluidProperties* BrineFluidProperties::_water97_fp
protected

Water97FluidProperties UserObject (for Henry's law)

Definition at line 193 of file BrineFluidProperties.h.

Referenced by BrineFluidProperties(), and henryConstant().

◆ _water_fp

const SinglePhaseFluidProperties* BrineFluidProperties::_water_fp
protected

◆ _water_fp_derivs

bool BrineFluidProperties::_water_fp_derivs
mutableprotected

Flag to indicate whether to calculate derivatives in water_fp.

Definition at line 204 of file BrineFluidProperties.h.

Referenced by e_from_p_T_X(), h_from_p_T_X(), and rho_from_p_T_X().

◆ NACL

const unsigned int BrineFluidProperties::NACL = 1
static

Definition at line 172 of file BrineFluidProperties.h.

Referenced by getComponent().

◆ p [1/3]

MultiComponentFluidProperties::p
inherited

Definition at line 123 of file MultiComponentFluidProperties.h.

Referenced by e_from_p_T_X(), h_from_p_T_X(), and rho_from_p_T_X().

◆ p [2/3]

X MultiComponentFluidProperties::p
inherited

Definition at line 125 of file MultiComponentFluidProperties.h.

◆ p [3/3]

X X MultiComponentFluidProperties::p
inherited

Definition at line 127 of file MultiComponentFluidProperties.h.

◆ T [1/3]

MultiComponentFluidProperties::T
inherited

Definition at line 123 of file MultiComponentFluidProperties.h.

Referenced by e_from_p_T_X(), h_from_p_T_X(), and rho_from_p_T_X().

◆ T [2/3]

X MultiComponentFluidProperties::T
inherited

Definition at line 125 of file MultiComponentFluidProperties.h.

◆ T [3/3]

X X MultiComponentFluidProperties::T
inherited

Definition at line 127 of file MultiComponentFluidProperties.h.

◆ WATER

const unsigned int BrineFluidProperties::WATER = 0
static

Fluid component numbers for water and NaCl.

Definition at line 171 of file BrineFluidProperties.h.

Referenced by getComponent().


The documentation for this class was generated from the following files:
BrineFluidProperties::_Mh2o
Real _Mh2o
Molar mass of water (H2O) (kg/mol)
Definition: BrineFluidProperties.h:202
BrineFluidProperties::molarMass
Real molarMass(Real xnacl) const
Average molar mass of brine.
Definition: BrineFluidProperties.C:104
BrineFluidProperties::_Mnacl
Real _Mnacl
Molar mass of NaCl (kg/mol)
Definition: BrineFluidProperties.h:200
SinglePhaseFluidProperties
Common class for single phase fluid properties.
Definition: SinglePhaseFluidProperties.h:89
BrineFluidProperties::NACL
static const unsigned int NACL
Definition: BrineFluidProperties.h:172
BrineFluidProperties::_nacl_fp
const SinglePhaseFluidProperties * _nacl_fp
NaClFluidProperties UserObject.
Definition: BrineFluidProperties.h:197
BrineFluidProperties::_water_fp_derivs
bool _water_fp_derivs
Flag to indicate whether to calculate derivatives in water_fp.
Definition: BrineFluidProperties.h:204
Water97FluidProperties::henryConstant
Real henryConstant(Real temperature, const std::vector< Real > &coeffs) const
IAPWS formulation of Henry's law constant for dissolution in water From Guidelines on the Henry's con...
Definition: Water97FluidProperties.C:1866
BrineFluidProperties::henryConstant
Real henryConstant(Real temperature, const std::vector< Real > &coeffs) const
IAPWS formulation of Henry's law constant for dissolution in water (implemented in water FluidPropert...
Definition: BrineFluidProperties.C:504
FluidProperties::_T_c2k
const Real _T_c2k
Conversion of temperature from Celsius to Kelvin.
Definition: FluidProperties.h:46
FPDualReal
DualNumber< Real, DNDerivativeSize< 5 > > FPDualReal
Definition: FluidProperties.h:15
BrineFluidProperties::WATER
static const unsigned int WATER
Fluid component numbers for water and NaCl.
Definition: BrineFluidProperties.h:171
BrineFluidProperties::e_from_p_T_X
FPDualReal e_from_p_T_X(const FPDualReal &pressure, const FPDualReal &temperature, const FPDualReal &xnacl) const
Definition: BrineFluidProperties.C:389
NS::density
const std::string density
Definition: NS.h:16
NS::enthalpy
const std::string enthalpy
Definition: NS.h:27
MultiComponentFluidProperties::MultiComponentFluidProperties
MultiComponentFluidProperties(const InputParameters &parameters)
Definition: MultiComponentFluidProperties.C:20
MultiComponentFluidProperties::T
T
Definition: MultiComponentFluidProperties.h:123
Water97FluidProperties
Water (H2O) fluid properties as a function of pressure (Pa) and temperature (K) from IAPWS-IF97: Revi...
Definition: Water97FluidProperties.h:42
MultiComponentFluidProperties::p
p
Definition: MultiComponentFluidProperties.h:123
SinglePhaseFluidProperties::vaporPressure
virtual Real vaporPressure(Real T) const
Vapor pressure.
Definition: SinglePhaseFluidProperties.C:177
name
const std::string name
Definition: Setup.h:21
MaterialTensorCalculatorTools::component
Real component(const SymmTensor &symm_tensor, unsigned int index)
Definition: MaterialTensorCalculatorTools.C:16
BrineFluidProperties::rho_from_p_T_X
virtual Real rho_from_p_T_X(Real pressure, Real temperature, Real xnacl) const override
Definition: BrineFluidProperties.C:171
SinglePhaseFluidProperties::molarMass
virtual virtual std Real molarMass() const
Fluid name.
Definition: SinglePhaseFluidProperties.C:96
BrineFluidProperties::h_from_p_T_X
FPDualReal h_from_p_T_X(const FPDualReal &pressure, const FPDualReal &temperature, const FPDualReal &xnacl) const
Definition: BrineFluidProperties.C:264
BrineFluidProperties::_water97_fp
const Water97FluidProperties * _water97_fp
Water97FluidProperties UserObject (for Henry's law)
Definition: BrineFluidProperties.h:193
NS::temperature
const std::string temperature
Definition: NS.h:26
BrineFluidProperties::massFractionToMolalConc
Real massFractionToMolalConc(Real xnacl) const
Conversion from mass fraction to molal concentration (molality)
Definition: BrineFluidProperties.C:480
BrineFluidProperties::massFractionToMoleFraction
Real massFractionToMoleFraction(Real xnacl) const
Conversion from mass fraction to mole fraction.
Definition: BrineFluidProperties.C:486
BrineFluidProperties::_water_fp
const SinglePhaseFluidProperties * _water_fp
Water97FluidProperties UserObject.
Definition: BrineFluidProperties.h:195
NS::pressure
const std::string pressure
Definition: NS.h:25