https://mooseframework.inl.gov
IdealRealGasMixtureFluidPropertiesTest.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 #include <cstdlib>
13 
15 {
16  // save this setting so that it can be restored later
17  const bool original_throw_on_warning = Moose::_throw_on_warning;
19 
20  Real T = 400.;
21  Real p = 100000.;
22  std::vector<Real> x = {0.9};
23 
24  // pure fluids
25  const Real rho_nitrogen = _fp_nitrogen->rho_from_p_T(p, T);
26  const Real rho_steam = _fp_steam->rho_from_p_T(p, T);
27  REL_TEST(rho_nitrogen, 0.84228968026683726, REL_TOL_SAVED_VALUE);
28  REL_TEST(rho_steam, 0.61493738819320221, REL_TOL_SAVED_VALUE);
29 
30  // rho(p,T)
31  const Real rho_mix = _fp_mix->rho_from_p_T(p, T, x);
32  REL_TEST(rho_mix, 0.88183704292782583, REL_TOL_SAVED_VALUE);
33  VAPOR_MIX_DERIV_TEST(_fp_mix->rho_from_p_T, p, T, x, REL_TOL_DERIVATIVE);
34 
35  // v(p,T)
36  const Real v_mix = _fp_mix->v_from_p_T(p, T, x);
37  REL_TEST(v_mix, 1.1339963636363655, REL_TOL_SAVED_VALUE);
38  VAPOR_MIX_DERIV_TEST(_fp_mix->v_from_p_T, p, T, x, REL_TOL_DERIVATIVE);
39 
41  const Real e_mix = _fp_mix->e_from_p_T(p, T, x);
42  REL_TEST(e_mix, 523068.96363636368, REL_TOL_SAVED_VALUE);
43  VAPOR_MIX_DERIV_TEST(_fp_mix->e_from_p_T, p, T, x, REL_TOL_DERIVATIVE);
44  // e(p,rho)
45  REL_TEST(_fp_mix->e_from_p_rho(p, rho_mix, x), e_mix, REL_TOL_CONSISTENCY);
46  VAPOR_MIX_DERIV_TEST(_fp_mix->e_from_p_rho, p, rho_mix, x, REL_TOL_DERIVATIVE);
47  // e(T,v)
48  REL_TEST(_fp_mix->e_from_T_v(T, v_mix, x), e_mix, REL_TOL_CONSISTENCY);
49  VAPOR_MIX_DERIV_TEST(_fp_mix->e_from_T_v, T, v_mix, x, REL_TOL_DERIVATIVE);
50 
51  // p(v,e)
52  REL_TEST(_fp_mix->p_from_v_e(v_mix, e_mix, x), p, REL_TOL_CONSISTENCY);
53  VAPOR_MIX_DERIV_TEST(_fp_mix->p_from_v_e, v_mix, e_mix, x, REL_TOL_DERIVATIVE);
54  // p(T,v)
55  REL_TEST(_fp_mix->p_from_T_v(T, v_mix, x), p, REL_TOL_CONSISTENCY);
56  VAPOR_MIX_DERIV_TEST(_fp_mix->p_from_T_v, T, v_mix, x, REL_TOL_DERIVATIVE);
57 
58  // T(v,e)
59  REL_TEST(_fp_mix->T_from_v_e(v_mix, e_mix, x), T, REL_TOL_CONSISTENCY);
60  VAPOR_MIX_DERIV_TEST(_fp_mix->T_from_v_e, v_mix, e_mix, x, REL_TOL_DERIVATIVE);
61  // T(p,v)
62  REL_TEST(_fp_mix->T_from_p_v(p, v_mix, x), T, REL_TOL_CONSISTENCY);
63  VAPOR_MIX_DERIV_TEST(_fp_mix->T_from_p_v, p, v_mix, x, REL_TOL_DERIVATIVE);
64 
65  // c(p,T)
66  const Real c_mix = _fp_mix->c_from_p_T(p, T, x);
67  REL_TEST(c_mix, 418.49693534182865, REL_TOL_SAVED_VALUE);
68  VAPOR_MIX_DERIV_TEST(_fp_mix->c_from_p_T, p, T, x, REL_TOL_DERIVATIVE);
69  // c(v,e)
70  REL_TEST(_fp_mix->c_from_v_e(v_mix, e_mix, x), c_mix, REL_TOL_CONSISTENCY);
71  VAPOR_MIX_DERIV_TEST(_fp_mix->c_from_v_e, v_mix, e_mix, x, REL_TOL_DERIVATIVE);
72 
74  const Real s_mix = _fp_mix->s_from_p_T(p, T, x);
75  REL_TEST(s_mix, 700.961535541455, REL_TOL_SAVED_VALUE);
76  VAPOR_MIX_DERIV_TEST(_fp_mix->s_from_p_T, p, T, x, REL_TOL_DERIVATIVE);
77  // s(T,v)
78  REL_TEST(_fp_mix->s_from_T_v(T, v_mix, x), s_mix, REL_TOL_CONSISTENCY);
79  VAPOR_MIX_DERIV_TEST(_fp_mix->s_from_T_v, T, v_mix, x, REL_TOL_DERIVATIVE);
80 
81  // cp(p,T)
82  const Real cp_mix = _fp_mix->cp_from_p_T(p, T, x);
83  REL_TEST(cp_mix, 1083.6715000000002, REL_TOL_SAVED_VALUE);
84  VAPOR_MIX_DERIV_TEST(_fp_mix->cp_from_p_T, p, T, x, REL_TOL_DERIVATIVE);
85  // cp(T,v)
86  REL_TEST(_fp_mix->cp_from_T_v(T, v_mix, x), cp_mix, REL_TOL_CONSISTENCY);
87  VAPOR_MIX_DERIV_TEST(_fp_mix->cp_from_T_v, T, v_mix, x, REL_TOL_DERIVATIVE);
88 
89  // cv(p,T)
90  const Real cv_mix = _fp_mix->cv_from_p_T(p, T, x);
91  REL_TEST(cv_mix, 771.82250000000022, REL_TOL_SAVED_VALUE);
92  VAPOR_MIX_DERIV_TEST(_fp_mix->cv_from_p_T, p, T, x, REL_TOL_DERIVATIVE);
93  // cv(T,v)
94  REL_TEST(_fp_mix->cv_from_T_v(T, v_mix, x), cv_mix, REL_TOL_CONSISTENCY);
95  VAPOR_MIX_DERIV_TEST(_fp_mix->cv_from_T_v, T, v_mix, x, REL_TOL_DERIVATIVE);
96 
97  // mu(p,T)
98  const Real mu_mix = _fp_mix->mu_from_p_T(p, T, x);
99  REL_TEST(mu_mix, 2.089269788624648e-05, REL_TOL_SAVED_VALUE);
100  VAPOR_MIX_DERIV_TEST(_fp_mix->mu_from_p_T, p, T, x, REL_TOL_DERIVATIVE);
101  // mu(T,v)
102  REL_TEST(_fp_mix->mu_from_T_v(T, v_mix, x), mu_mix, REL_TOL_CONSISTENCY);
103  VAPOR_MIX_DERIV_TEST(_fp_mix->mu_from_T_v, T, v_mix, x, REL_TOL_DERIVATIVE);
104 
105  // k(p,T)
106  const Real k_mix = _fp_mix->k_from_p_T(p, T, x);
107  REL_TEST(k_mix, 0.0319250086967551, REL_TOL_SAVED_VALUE);
108  VAPOR_MIX_DERIV_TEST(_fp_mix->k_from_p_T, p, T, x, REL_TOL_DERIVATIVE);
109  // k(T,v)
110  REL_TEST(_fp_mix->k_from_T_v(T, v_mix, x), k_mix, REL_TOL_CONSISTENCY);
111  VAPOR_MIX_DERIV_TEST(_fp_mix->k_from_T_v, T, v_mix, x, REL_TOL_DERIVATIVE);
112 
113  // Compare calculations with a state-of-the-art mixture model. Note these are
114  // not expected to be exactly the same, so very loose tolerances must be used.
115  // mu and k are not available in the state-of-the-art mixture model.
116  T = 360.;
117  p = 100000.;
118  x[0] = 0.5;
119  REL_TEST(_fp_mix->rho_from_p_T(p, T, x), 0.7362935, 0.115554);
120  REL_TEST(_fp_mix->v_from_p_T(p, T, x), 1.3581540, 0.103585);
121  REL_TEST(_fp_mix->e_from_p_T(p, T, x), 1380586.9, 0.023648);
122  REL_TEST(_fp_mix->c_from_p_T(p, T, x), 428.1928, 0.017535);
123  REL_TEST(_fp_mix->cp_from_p_T(p, T, x), 1479.7114, 0.146444);
124  REL_TEST(_fp_mix->cv_from_p_T(p, T, x), 1090.5912, 0.183001);
125 
126  // restore original setting
127  Moose::_throw_on_warning = original_throw_on_warning;
128 }
TEST_F(IdealRealGasMixtureFluidPropertiesTest, test)
const std::vector< double > x
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
bool _throw_on_warning