https://mooseframework.inl.gov
Functions
BrineFluidPropertiesTest.C File Reference

Go to the source code of this file.

Functions

 TEST_F (BrineFluidPropertiesTest, fluidName)
 Test that the fluid name is correctly returned. More...
 
 TEST_F (BrineFluidPropertiesTest, molarMass)
 Test that the molar masses are correctly returned. More...
 
 TEST_F (BrineFluidPropertiesTest, getComponent)
 Test that the correct fluid component userobject is returned. More...
 
 TEST_F (BrineFluidPropertiesTest, vapor)
 Verify calculation of brine vapor pressure using data 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...
 
 TEST_F (BrineFluidPropertiesTest, solubility)
 Verify calculation of halite solubility using data from Bodnar et al, Synthetic fluid inclusions in natural quartz, III. More...
 
 TEST_F (BrineFluidPropertiesTest, properties)
 Verify calculation of brine properties. More...
 
 TEST_F (BrineFluidPropertiesTest, derivatives)
 Verify calculation of the derivatives of all properties by comparing with finite differences. More...
 
 TEST_F (BrineFluidPropertiesTest, combined)
 Verify that the methods that return multiple properties in one call return identical values as the individual methods. More...
 

Function Documentation

◆ TEST_F() [1/8]

TEST_F ( BrineFluidPropertiesTest  ,
fluidName   
)

Test that the fluid name is correctly returned.

Definition at line 19 of file BrineFluidPropertiesTest.C.

19 { EXPECT_EQ(_fp->fluidName(), "brine"); }

◆ TEST_F() [2/8]

TEST_F ( BrineFluidPropertiesTest  ,
molarMass   
)

Test that the molar masses are correctly returned.

Definition at line 24 of file BrineFluidPropertiesTest.C.

25 {
26  ABS_TEST(_fp->molarMassH2O(), 18.015e-3, REL_TOL_CONSISTENCY);
27  ABS_TEST(_fp->molarMassNaCl(), 58.443e-3, REL_TOL_CONSISTENCY);
28 
29  // Molar mass of water with salt mass fraction 0.1
30  const Real x = 0.1;
31  const Real M = 1.0 / (x / _fp->molarMassNaCl() + (1.0 - x) / _fp->molarMassH2O());
32  ABS_TEST(_fp->molarMass(x), M, REL_TOL_CONSISTENCY);
33 }
const std::vector< double > x
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ TEST_F() [3/8]

TEST_F ( BrineFluidPropertiesTest  ,
getComponent   
)

Test that the correct fluid component userobject is returned.

Definition at line 38 of file BrineFluidPropertiesTest.C.

39 {
40  auto & water_fp = _fp->getComponent(BrineFluidProperties::WATER);
41  auto & nacl_fp = _fp->getComponent(BrineFluidProperties::NACL);
42 
43  EXPECT_EQ(water_fp.fluidName(), "water");
44  EXPECT_EQ(nacl_fp.fluidName(), "nacl");
45 }
static const unsigned int NACL
static const unsigned int WATER
Fluid component numbers for water and NaCl.

◆ TEST_F() [4/8]

TEST_F ( BrineFluidPropertiesTest  ,
vapor   
)

Verify calculation of brine vapor pressure using data 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).

Definition at line 53 of file BrineFluidPropertiesTest.C.

54 {
55  REL_TEST(_fp->vaporPressure(473.15, 0.185), 1.34e6, 1.0e-2);
56  REL_TEST(_fp->vaporPressure(473.15, 0.267), 1.21e6, 1.0e-2);
57  REL_TEST(_fp->vaporPressure(473.15, 0.312), 1.13e6, 1.0e-2);
58 }

◆ TEST_F() [5/8]

TEST_F ( BrineFluidPropertiesTest  ,
solubility   
)

Verify calculation of halite solubility using data from Bodnar et al, Synthetic fluid inclusions in natural quartz, III.

Determination of phase equilibrium properties in the system H2O-NaCl to 1000C and 1500 bars, Geocehmica et Cosmochemica Acta, 49, 1861-1873 (1985). Note that the average of the range quoted has been used for each point.

Definition at line 67 of file BrineFluidPropertiesTest.C.

68 {
69  REL_TEST(_fp->haliteSolubility(659.65), 0.442, 2.0e-2);
70  REL_TEST(_fp->haliteSolubility(818.65), 0.6085, 2.0e-2);
71  REL_TEST(_fp->haliteSolubility(903.15), 0.7185, 2.0e-2);
72 }

◆ TEST_F() [6/8]

TEST_F ( BrineFluidPropertiesTest  ,
properties   
)

Verify calculation of brine properties.

Experimental density values from Pitzer et al, Thermodynamic properties of aqueous sodium chloride solution, Journal of Physical and Chemical Reference Data, 13, 1-102 (1984)

Experimental viscosity values from Phillips et al, Viscosity of NaCl and other solutions up to 350C and 50MPa pressures, LBL-11586 (1980)

Thermal conductivity values from Ozbek and Phillips, Thermal conductivity of aqueous NaCl solutions from 20C to 330C, LBL-9086 (1980)

It is difficult to compare enthalpy and cp with experimental data, so instead we recreate the data presented in Figures 11 and 12 of Driesner, The system H2O-NaCl. Part II: Correlations for molar volume, enthalpy, and isobaric heat capacity from 0 to 1000 C, 1 to 500 bar, and 0 to 1 Xnacl, Geochimica et Cosmochimica Acta 71, 4902-4919 (2007)

Definition at line 92 of file BrineFluidPropertiesTest.C.

93 {
94  // Pressure, temperature and NaCl mass fraction for tests
95  Real p0 = 20.0e6;
96  Real p1 = 40.0e6;
97  Real T0 = 323.15;
98  Real T1 = 473.15;
99  Real x0 = 0.1047;
100  Real x1 = 0.2261;
101 
102  // Density
103  REL_TEST(_fp->rho_from_p_T_X(p0, T0, x0), 1068.52, 1.0e-2);
104  REL_TEST(_fp->rho_from_p_T_X(p0, T1, x0), 959.27, 1.0e-2);
105  REL_TEST(_fp->rho_from_p_T_X(p1, T1, x1), 1065.58, 1.0e-2);
106 
107  // Viscosity
108  REL_TEST(_fp->mu_from_p_T_X(p0, T0, x0), 679.8e-6, 2.0e-2);
109  REL_TEST(_fp->mu_from_p_T_X(p0, T1, x0), 180.0e-6, 2.0e-2);
110  REL_TEST(_fp->mu_from_p_T_X(p1, T1, x1), 263.1e-6, 2.0e-2);
111 
112  // Thermal conductivity
113  REL_TEST(_fp->k_from_p_T_X(p0, T0, x0), 0.630, 4.0e-2);
114  REL_TEST(_fp->k_from_p_T_X(p0, T1, x0), 0.649, 4.0e-2);
115  REL_TEST(_fp->k_from_p_T_X(p1, T1, x1), 0.633, 4.0e-2);
116 
117  // Enthalpy
118  p0 = 10.0e6;
119  T0 = 573.15;
120 
121  REL_TEST(_fp->e_from_p_T_X(p0, T0, 0.0), 1330.0e3, 1.0e-2);
122  REL_TEST(_fp->e_from_p_T_X(p0, T0, 0.2), 1100.0e3, 1.0e-2);
123  REL_TEST(_fp->e_from_p_T_X(p0, T0, 0.364), 970.0e3, 1.0e-2);
124 
125  // cp
126  p0 = 17.9e6;
127  x0 = 0.01226;
128 
129  REL_TEST(_fp->cp_from_p_T_X(p0, 323.15, x0), 4.1e3, 1.0e-2);
130  REL_TEST(_fp->cp_from_p_T_X(p0, 473.15, x0), 4.35e3, 1.0e-2);
131  REL_TEST(_fp->cp_from_p_T_X(p0, 623.15, x0), 8.1e3, 1.0e-2);
132 }
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ TEST_F() [7/8]

TEST_F ( BrineFluidPropertiesTest  ,
derivatives   
)

Verify calculation of the derivatives of all properties by comparing with finite differences.

Definition at line 138 of file BrineFluidPropertiesTest.C.

139 {
140  Real p = 1.0e6;
141  Real T = 350.0;
142  Real x = 0.1047;
143 
144  // Finite differencing parameters
145  Real dp = 1.0e-2;
146  Real dT = 1.0e-4;
147  Real dx = 1.0e-8;
148 
149  // Density
150  Real drho_dp_fd =
151  (_fp->rho_from_p_T_X(p + dp, T, x) - _fp->rho_from_p_T_X(p - dp, T, x)) / (2.0 * dp);
152  Real drho_dT_fd =
153  (_fp->rho_from_p_T_X(p, T + dT, x) - _fp->rho_from_p_T_X(p, T - dT, x)) / (2.0 * dT);
154  Real drho_dx_fd =
155  (_fp->rho_from_p_T_X(p, T, x + dx) - _fp->rho_from_p_T_X(p, T, x - dx)) / (2.0 * dx);
156 
157  Real rho = 0.0, drho_dp = 0.0, drho_dT = 0.0, drho_dx = 0.0;
158  _fp->rho_from_p_T_X(p, T, x, rho, drho_dp, drho_dT, drho_dx);
159 
160  ABS_TEST(rho, _fp->rho_from_p_T_X(p, T, x), REL_TOL_CONSISTENCY);
161  REL_TEST(drho_dp, drho_dp_fd, 1.0e-5);
162  REL_TEST(drho_dT, drho_dT_fd, 1.0e-6);
163  REL_TEST(drho_dx, drho_dx_fd, 1.0e-6);
164 
165  // Enthalpy
166  Real dh_dp_fd = (_fp->h_from_p_T_X(p + dp, T, x) - _fp->h_from_p_T_X(p - dp, T, x)) / (2.0 * dp);
167  Real dh_dT_fd = (_fp->h_from_p_T_X(p, T + dT, x) - _fp->h_from_p_T_X(p, T - dT, x)) / (2.0 * dT);
168  Real dh_dx_fd = (_fp->h_from_p_T_X(p, T, x + dx) - _fp->h_from_p_T_X(p, T, x - dx)) / (2.0 * dx);
169 
170  Real h = 0.0, dh_dp = 0.0, dh_dT = 0.0, dh_dx = 0.0;
171  _fp->h_from_p_T_X(p, T, x, h, dh_dp, dh_dT, dh_dx);
172 
173  ABS_TEST(h, _fp->h_from_p_T_X(p, T, x), 1.2 * REL_TOL_CONSISTENCY);
174  REL_TEST(dh_dp, dh_dp_fd, 1.0e-4);
175  REL_TEST(dh_dT, dh_dT_fd, 1.0e-6);
176  REL_TEST(dh_dx, dh_dx_fd, 1.0e-6);
177 
178  // Internal energy
179  Real de_dp_fd = (_fp->e_from_p_T_X(p + dp, T, x) - _fp->e_from_p_T_X(p - dp, T, x)) / (2.0 * dp);
180  Real de_dT_fd = (_fp->e_from_p_T_X(p, T + dT, x) - _fp->e_from_p_T_X(p, T - dT, x)) / (2.0 * dT);
181  Real de_dx_fd = (_fp->e_from_p_T_X(p, T, x + dx) - _fp->e_from_p_T_X(p, T, x - dx)) / (2.0 * dx);
182 
183  Real e = 0.0, de_dp = 0.0, de_dT = 0.0, de_dx = 0.0;
184  _fp->e_from_p_T_X(p, T, x, e, de_dp, de_dT, de_dx);
185 
186  ABS_TEST(e, _fp->e_from_p_T_X(p, T, x), 1.2 * REL_TOL_CONSISTENCY);
187  REL_TEST(de_dp, de_dp_fd, 1.0e-3);
188  REL_TEST(de_dT, de_dT_fd, 1.0e-6);
189  REL_TEST(de_dx, de_dx_fd, 1.0e-6);
190 
191  // Viscosity
192  Real dmu_dp_fd =
193  (_fp->mu_from_p_T_X(p + dp, T, x) - _fp->mu_from_p_T_X(p - dp, T, x)) / (2.0 * dp);
194  Real dmu_dT_fd =
195  (_fp->mu_from_p_T_X(p, T + dT, x) - _fp->mu_from_p_T_X(p, T - dT, x)) / (2.0 * dT);
196  Real dmu_dx_fd =
197  (_fp->mu_from_p_T_X(p, T, x + dx) - _fp->mu_from_p_T_X(p, T, x - dx)) / (2.0 * dx);
198  Real mu = 0.0, dmu_dp = 0.0, dmu_dT = 0.0, dmu_dx = 0.0;
199  _fp->mu_from_p_T_X(p, T, x, mu, dmu_dp, dmu_dT, dmu_dx);
200 
201  ABS_TEST(mu, _fp->mu_from_p_T_X(p, T, x), REL_TOL_CONSISTENCY);
202  REL_TEST(dmu_dp, dmu_dp_fd, 1.0e-3);
203  REL_TEST(dmu_dT, dmu_dT_fd, 1.0e-6);
204  REL_TEST(dmu_dx, dmu_dx_fd, 1.0e-6);
205 
206  // Verify that derivatives wrt x are defined when x = 0
207  x = 0.0;
208 
209  // Density
210  _fp->rho_from_p_T_X(p, T, x, rho, drho_dp, drho_dT, drho_dx);
211  drho_dx_fd = (_fp->rho_from_p_T_X(p, T, x + dx) - _fp->rho_from_p_T_X(p, T, x)) / dx;
212 
213  REL_TEST(drho_dx, drho_dx_fd, 1.0e-3);
214 
215  // Enthalpy
216  _fp->h_from_p_T_X(p, T, x, h, dh_dp, dh_dT, dh_dx);
217  dh_dx_fd = (_fp->h_from_p_T_X(p, T, x + dx) - _fp->h_from_p_T_X(p, T, x)) / dx;
218 
219  REL_TEST(dh_dx, dh_dx_fd, 1.0e-3);
220 
221  // Internal energy
222  _fp->e_from_p_T_X(p, T, x, e, de_dp, de_dT, de_dx);
223  de_dx_fd = (_fp->e_from_p_T_X(p, T, x + dx) - _fp->e_from_p_T_X(p, T, x)) / dx;
224 
225  REL_TEST(de_dx, de_dx_fd, 1.0e-3);
226 
227  // Viscosity
228  dmu_dx_fd = (_fp->mu_from_p_T_X(p, T, x + dx) - _fp->mu_from_p_T_X(p, T, x)) / dx;
229  _fp->mu_from_p_T_X(p, T, x, mu, dmu_dp, dmu_dT, dmu_dx);
230 
231  REL_TEST(dmu_dx, dmu_dx_fd, 1.0e-3);
232 }
const std::vector< double > x
static const std::string mu
Definition: NS.h:123
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ TEST_F() [8/8]

TEST_F ( BrineFluidPropertiesTest  ,
combined   
)

Verify that the methods that return multiple properties in one call return identical values as the individual methods.

Definition at line 238 of file BrineFluidPropertiesTest.C.

239 {
240  const Real tol = REL_TOL_SAVED_VALUE;
241  const Real p = 1.0e6;
242  const Real T = 350.0;
243  const Real x = 0.1047;
244 
245  // Single property methods
246  Real rho, drho_dp, drho_dT, drho_dx, mu, dmu_dp, dmu_dT, dmu_dx;
247  _fp->rho_from_p_T_X(p, T, x, rho, drho_dp, drho_dT, drho_dx);
248  _fp->mu_from_p_T_X(p, T, x, mu, dmu_dp, dmu_dT, dmu_dx);
249 
250  // Combined property methods
251  Real rho2, mu2;
252  _fp->rho_mu_from_p_T_X(p, T, x, rho2, mu2);
253 
254  ABS_TEST(rho, rho2, tol);
255  ABS_TEST(mu, mu2, tol);
256 
257  // Combined property method with derivatives
258  Real drho2_dp, drho2_dT, drho2_dx, dmu2_dp, dmu2_dT, dmu2_dx;
259  _fp->rho_mu_from_p_T_X(
260  p, T, x, rho2, drho2_dp, drho2_dT, drho2_dx, mu2, dmu2_dp, dmu2_dT, dmu2_dx);
261 
262  ABS_TEST(rho, rho2, tol);
263  ABS_TEST(mu, mu2, tol);
264  ABS_TEST(drho_dp, drho2_dp, tol);
265  ABS_TEST(drho_dT, drho2_dT, tol);
266  ABS_TEST(drho_dx, drho2_dx, tol);
267  ABS_TEST(mu, mu2, tol);
268  ABS_TEST(dmu_dp, dmu2_dp, tol);
269  ABS_TEST(dmu_dT, dmu2_dT, tol);
270  ABS_TEST(dmu_dx, dmu2_dx, tol);
271 }
const double tol
const std::vector< double > x
static const std::string mu
Definition: NS.h:123
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real