https://mooseframework.inl.gov
StiffenedGasTwoPhaseFluidPropertiesTest.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
12 
14 {
15  Real p = 101325; // Pa
16 
17  /*
18  * The following reference gives the saturation state to have equal Gibbs
19  * free enthalpy between the 2 phases.
20  *
21  * Ray A. Berry, Richard Saurel, Olivier LeMetayer
22  * The discrete equation method (DEM) for fully compressible, two-phase flow
23  * in ducts of spatially varying cross-section
24  * Nuclear Engineering and Design 240 (2010) p. 3797-3818
25  *
26  * Therefore, it should be asserted that the nonlinear solver for the saturation
27  * temperature returns a state for which this is true.
28  */
29  const Real T_sat = _fp->T_sat(p);
30  // liquid
31  const Real rho_liquid = _fp_liquid->rho_from_p_T(p, T_sat);
32  const Real v_liquid = 1.0 / rho_liquid;
33  const Real e_liquid = _fp_liquid->e_from_p_rho(p, rho_liquid);
34  const Real g_liquid = _fp_liquid->g_from_v_e(v_liquid, e_liquid);
35  // vapor
36  const Real rho_vapor = _fp_vapor->rho_from_p_T(p, T_sat);
37  const Real v_vapor = 1.0 / rho_vapor;
38  const Real e_vapor = _fp_vapor->e_from_p_rho(p, rho_vapor);
39  const Real g_vapor = _fp_vapor->g_from_v_e(v_vapor, e_vapor);
40 
41  REL_TEST(g_liquid, g_vapor, 1e-5);
42 
43  // ensure that p_sat(T_sat(p)) is the inverse of T_sat(p)
44  REL_TEST(_fp->p_sat(T_sat), p, 1e-14);
45 
46  // test derivative along saturation curve using FD approximation
47  Real dT_dPsat = _fp->dT_sat_dp(p);
48  Real dp = 1e1;
49  Real dT_dPsat_fd = (_fp->T_sat(p + dp) - _fp->T_sat(p - dp)) / (2 * dp);
50 
51  EXPECT_NEAR(dT_dPsat, dT_dPsat_fd, 1e-14);
52 
53  EXPECT_NEAR(_fp->p_critical(), 22.09e6, 1e-15);
54 
55  // This value was verified to match the value from IAPWS95 fluid properties
56  REL_TEST(_fp->sigma_from_T(300.0), 0.0716859625271626, REL_TOL_SAVED_VALUE);
57 
58  {
59  const Real T = 300.0;
60  const Real T_pert = T * 1e-6;
61  const Real dsigma_dT_fd =
62  (_fp->sigma_from_T(T + T_pert) - _fp->sigma_from_T(T - T_pert)) / (2.0 * T_pert);
63  REL_TEST(_fp->dsigma_dT_from_T(T), dsigma_dT_fd, REL_TOL_DERIVATIVE);
64  }
65 
66  EXPECT_NEAR(_fp->T_triple(), _T_triple, 1e-14);
67  EXPECT_NEAR(_fp->L_fusion(), _L_fusion, 1e-14);
68 }
TEST_F(StiffenedGasTwoPhaseFluidPropertiesTest, test)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real