https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PorousFlowWaterVaporTest.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
16TEST_F(PorousFlowWaterVaporTest, name) { EXPECT_EQ("water-vapor", _fp->fluidStateName()); }
17
19{
20 FluidStatePhaseEnum phase_state;
21 std::vector<FluidStateProperties> fsp(2, FluidStateProperties(1));
22
23 // Single phase liquid region
24 Real p = 1.0e6;
25 Real h = 1.0e5;
26
27 const Real tol = REL_TOL_CONSISTENCY;
28
29 _fp->thermophysicalProperties(p, h, 0, phase_state, fsp);
30 EXPECT_EQ(phase_state, FluidStatePhaseEnum::LIQUID);
31
32 Real T = _water_fp->T_from_p_h(p, h);
33
34 ABS_TEST(fsp[0].density.value(), _water_fp->rho_from_p_T(p, T), tol);
35 ABS_TEST(fsp[0].viscosity.value(), _water_fp->mu_from_p_T(p, T), tol);
36 ABS_TEST(fsp[0].enthalpy.value(), h, tol);
37 // Tolerance loosened to pass on Apple M4
38 ABS_TEST(fsp[0].internal_energy.value(), _water_fp->e_from_p_T(p, T), 4 * tol);
39 ABS_TEST(fsp[0].saturation.value(), 1.0, tol);
40 ABS_TEST(fsp[0].pressure.value(), p, tol);
41
42 // Single phase gas region
43 h = 3.0e6;
44 Real pg = p + _pc->capillaryPressure(0.0);
45
46 _fp->thermophysicalProperties(p, h, 0, phase_state, fsp);
47 EXPECT_EQ(phase_state, FluidStatePhaseEnum::GAS);
48
49 T = _water_fp->T_from_p_h(pg, h);
50 ABS_TEST(fsp[1].density.value(), _water_fp->rho_from_p_T(pg, T), tol);
51 ABS_TEST(fsp[1].viscosity.value(), _water_fp->mu_from_p_T(pg, T), tol);
52 ABS_TEST(fsp[1].enthalpy.value(), h, tol);
53 ABS_TEST(fsp[1].internal_energy.value(), _water_fp->e_from_p_T(pg, T), tol);
54 ABS_TEST(fsp[1].saturation.value(), 1.0, tol);
55 ABS_TEST(fsp[1].pressure.value(), pg, tol);
56
57 // Two-phase region
58 h = 8.0e5;
59
60 _fp->thermophysicalProperties(p, h, 0, phase_state, fsp);
61 EXPECT_EQ(phase_state, FluidStatePhaseEnum::TWOPHASE);
62
63 const Real Tsat = _water_fp->vaporTemperature(p);
64 const Real dT = 1.0e-6;
65
66 // Liquid phase
67 ABS_TEST(fsp[0].density.value(), _water_fp->rho_from_p_T(p, Tsat - dT), tol);
68 ABS_TEST(fsp[0].viscosity.value(), _water_fp->mu_from_p_T(p, Tsat - dT), tol);
69 // Tolerances loosened to pass on Apple M4
70 ABS_TEST(fsp[0].enthalpy.value(), _water_fp->h_from_p_T(p, Tsat - dT), 1.5 * tol);
71 ABS_TEST(fsp[0].internal_energy.value(), _water_fp->e_from_p_T(p, Tsat - dT), 1.5 * tol);
72 ABS_TEST(fsp[0].pressure.value(), p, tol);
73
74 // Gas phase
75 pg = p + _pc->capillaryPressure(fsp[0].saturation.value());
76 ABS_TEST(fsp[1].density.value(), _water_fp->rho_from_p_T(p, Tsat + dT), tol);
77 ABS_TEST(fsp[1].viscosity.value(), _water_fp->mu_from_p_T(p, Tsat + dT), tol);
78 // Tolerances loosened to pass on Apple M4
79 ABS_TEST(fsp[1].enthalpy.value(), _water_fp->h_from_p_T(p, Tsat + dT), 5 * tol);
80 ABS_TEST(fsp[1].internal_energy.value(), _water_fp->e_from_p_T(p, Tsat + dT), 10 * tol);
81 ABS_TEST(fsp[1].pressure.value(), pg, tol);
82}
const double tol
const Real p
const double T
FluidStatePhaseEnum
Phase state enum.
TEST_F(PorousFlowWaterVaporTest, name)
Verify that the correct name is supplied.
const std::string name
Definition Setup.h:21
AD data structure to pass calculated thermophysical properties.