https://mooseframework.inl.gov
Loading...
Searching...
No Matches
LinearFluidPropertiesTest.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 const Real p = 1e5;
16 const Real T = 300;
17
18 const Real rho_from_p_T = _fp->rho_from_p_T(p, T);
19 const Real rho = rho_from_p_T;
20
21 const Real h_from_p_T = _fp->h_from_p_T(p, T);
22 const Real h = h_from_p_T;
23
24 const Real e_from_p_rho = _fp->e_from_p_rho(p, rho);
25 const Real e = e_from_p_rho;
26
27 const Real v = 1 / rho;
28
29 // p
30 REL_TEST(_fp->p_from_v_e(v, e), p, REL_TOL_CONSISTENCY);
31 // TODO: REL_TEST(_fp->p_from_h_s(h, s), p, REL_TOL_CONSISTENCY);
32 NOT_IMPLEMENTED_TEST_VALUE(_fp->p_from_h_s);
33 DERIV_TEST(_fp->p_from_v_e, v, e, REL_TOL_DERIVATIVE);
34 // TODO: DERIV_TEST(_fp->p_from_h_s, h, s, REL_TOL_DERIVATIVE);
35 NOT_IMPLEMENTED_TEST_DERIV(_fp->p_from_h_s);
36
37 // T
38 REL_TEST(_fp->T_from_v_e(v, e), T, REL_TOL_CONSISTENCY);
39 DERIV_TEST(_fp->T_from_v_e, v, e, REL_TOL_DERIVATIVE);
40
41 // rho
42 // TODO: REL_TEST(rho_from_p_T, rho_saved, REL_TOL_SAVED_VALUE);
43 // TODO: REL_TEST(_fp->rho_from_p_s(p, s), rho_from_p_T, REL_TOL_CONSISTENCY);
44 NOT_IMPLEMENTED_TEST_VALUE(_fp->rho_from_p_s);
45 DERIV_TEST(_fp->rho_from_p_T, p, T, REL_TOL_DERIVATIVE);
46 // TODO: DERIV_TEST(_fp->rho_from_p_s, p, s, REL_TOL_DERIVATIVE);
47 NOT_IMPLEMENTED_TEST_DERIV(_fp->rho_from_p_s);
48
49 // e
50 REL_TEST(_fp->e_from_p_T(p, T), e, REL_TOL_CONSISTENCY);
51 REL_TEST(_fp->e_from_p_rho(p, rho), e, REL_TOL_CONSISTENCY);
52 REL_TEST(_fp->e_from_v_h(v, h), e, REL_TOL_CONSISTENCY);
53 DERIV_TEST(_fp->e_from_p_T, p, T, 1e-5);
54 DERIV_TEST(_fp->e_from_p_rho, p, rho, 1e-5);
55 DERIV_TEST(_fp->e_from_v_h, v, h, REL_TOL_DERIVATIVE);
56
57 // c
58 // TODO: const Real c = _fp->c_from_v_e(v, e);
59 // TODO: REL_TEST(c, c_saved, REL_TOL_SAVED_VALUE);
60 DERIV_TEST(_fp->c_from_v_e, v, e, REL_TOL_DERIVATIVE);
61
62 // cp
63 const Real cp = _fp->cp_from_v_e(v, e);
64 REL_TEST(cp, 1000, REL_TOL_SAVED_VALUE);
65 DERIV_TEST(_fp->cp_from_v_e, v, e, REL_TOL_DERIVATIVE);
66
67 // cv
68 const Real cv = _fp->cv_from_v_e(v, e);
69 REL_TEST(cv, 1000, REL_TOL_SAVED_VALUE);
70 DERIV_TEST(_fp->cv_from_v_e, v, e, REL_TOL_DERIVATIVE);
71
72 // mu
73 const Real mu = _fp->mu_from_v_e(v, e);
74 REL_TEST(mu, 0.3, REL_TOL_SAVED_VALUE);
75
76 // k
77 const Real k = _fp->k_from_v_e(v, e);
78 REL_TEST(k, 0.89, REL_TOL_SAVED_VALUE);
79
80 // s
81 // TODO: REL_TEST(s, s_saved, REL_TOL_SAVED_VALUE);
82 // TODO: REL_TEST(_fp->s_from_h_p(h, p), s, REL_TOL_CONSISTENCY);
83 NOT_IMPLEMENTED_TEST_VALUE(_fp->s_from_p_T);
84 NOT_IMPLEMENTED_TEST_VALUE(_fp->s_from_v_e);
85 NOT_IMPLEMENTED_TEST_VALUE(_fp->s_from_h_p);
86 // TODO: DERIV_TEST(_fp->s_from_v_e, p, rho, REL_TOL_DERIVATIVE);
87 // TODO: DERIV_TEST(_fp->s_from_h_p, h, p, REL_TOL_DERIVATIVE);
88 NOT_IMPLEMENTED_TEST_DERIV(_fp->s_from_p_T);
89 NOT_IMPLEMENTED_TEST_DERIV(_fp->s_from_v_e);
90 NOT_IMPLEMENTED_TEST_DERIV(_fp->s_from_h_p);
91
92 // g
93 // TODO: REL_TEST(_fp->g_from_v_e(v, e), g_saved, REL_TOL_SAVED_VALUE);
94 NOT_IMPLEMENTED_TEST_VALUE(_fp->g_from_v_e);
95
96 // h
97 REL_TEST(h, 1000100, REL_TOL_SAVED_VALUE);
98 DERIV_TEST(_fp->h_from_p_T, p, T, 5e-3);
99
100 // beta
101 const Real beta = _fp->beta_from_p_T(p, T);
102 REL_TEST(beta, 123, REL_TOL_SAVED_VALUE);
103
104 // molar mass
105 try
106 {
107 _fp->molarMass();
108 }
109 catch (const std::exception & x)
110 {
111 std::string msg(x.what());
112 EXPECT_TRUE(msg.find("not implemented") != std::string::npos);
113 }
114
115 // Pr
116 const Real Pr = _fp->Pr(rho, T);
117 REL_TEST(Pr, (1000 * 0.3) / 0.89, REL_TOL_SAVED_VALUE);
118}
const std::vector< double > x
const double mu
const Real p
const double rho
const double T
const double v
TEST_F(LinearFluidPropertiesTest, test)