https://mooseframework.inl.gov
Loading...
Searching...
No Matches
IdealGasMixtureFluidPropertiesTest.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 "FluidProperties.h"
13
15{
16 Real T = 400;
17 Real p = 100000;
18 std::vector<Real> x = {0.7};
19
20 const Real v = 1.38490747936373;
21 const Real rho = 0.7220698962933115;
22 const Real e = 1.995566878921797e+06;
23 const Real s = 3129.64317643634;
24 const Real c = 442.127817187648;
25 const Real cp = 1187.64406714542;
26 const Real cv = 841.417197304492;
27 const Real mu = 1.863687329029527e-05;
28 const Real k = 0.0304142253602899;
29
30 REL_TEST(_fp_mix->p_from_v_e(v, e, x), p, REL_TOL_SAVED_VALUE);
31 REL_TEST(_fp_mix->T_from_v_e(v, e, x), T, REL_TOL_SAVED_VALUE);
32 REL_TEST(_fp_mix->v_from_p_T(p, T, x), v, REL_TOL_SAVED_VALUE);
33 REL_TEST(_fp_mix->rho_from_p_T(p, T, x), rho, REL_TOL_SAVED_VALUE);
34 REL_TEST(_fp_mix->e_from_p_T(p, T, x), e, REL_TOL_SAVED_VALUE);
35 REL_TEST(_fp_mix->e_from_p_rho(p, rho, x), e, REL_TOL_SAVED_VALUE);
36 REL_TEST(_fp_mix->s_from_p_T(p, T, x), s, REL_TOL_SAVED_VALUE);
37 REL_TEST(_fp_mix->c_from_p_T(p, T, x), c, REL_TOL_SAVED_VALUE);
38 REL_TEST(_fp_mix->cp_from_p_T(p, T, x), cp, REL_TOL_SAVED_VALUE);
39 REL_TEST(_fp_mix->cv_from_p_T(p, T, x), cv, REL_TOL_SAVED_VALUE);
40 REL_TEST(_fp_mix->mu_from_p_T(p, T, x), mu, REL_TOL_SAVED_VALUE);
41 REL_TEST(_fp_mix->k_from_p_T(p, T, x), k, REL_TOL_SAVED_VALUE);
42
43 // Test sound speed against thermodynamics definition:
44 // c = sqrt((dp/drho)_s) = v sqrt(-(dp/dv)_s)
45 // To compute (dp/dv)_s, we will use the following identity:
46 // (dp/dv)_s = 1 / [(dv/dp)_T - (dv/dT)_p (ds/dp)_T / (ds/dT)_p]
47 const Real rel_pert = REL_PERTURBATION;
48 const Real fpert1 = 1 + rel_pert;
49 const Real fpert2 = 1 - rel_pert;
50 const Real dvdp_T =
51 (_fp_mix->v_from_p_T(p * fpert1, T, x) - _fp_mix->v_from_p_T(p * fpert2, T, x)) /
52 (2 * rel_pert * p);
53 const Real dvdT_p =
54 (_fp_mix->v_from_p_T(p, T * fpert1, x) - _fp_mix->v_from_p_T(p, T * fpert2, x)) /
55 (2 * rel_pert * T);
56 const Real dsdp_T =
57 (_fp_mix->s_from_p_T(p * fpert1, T, x) - _fp_mix->s_from_p_T(p * fpert2, T, x)) /
58 (2 * rel_pert * p);
59 const Real dsdT_p =
60 (_fp_mix->s_from_p_T(p, T * fpert1, x) - _fp_mix->s_from_p_T(p, T * fpert2, x)) /
61 (2 * rel_pert * T);
62 const Real dpdv_s = 1.0 / (dvdp_T - dvdT_p * dsdp_T / dsdT_p);
63 const Real c_gold = v * std::sqrt(-dpdv_s);
64 REL_TEST(_fp_mix->c_from_p_T(p, T, x), c_gold, REL_TOL_DERIVATIVE);
65
66 const Real x_steam = 0.3;
67 const Real x_nitrogen = 0.7;
68
69 const Real M_steam = 0.01801488;
70 const Real M_nitrogen = 0.028012734746133888;
71 const Real M = 1.0 / (x_steam / M_steam + x_nitrogen / M_nitrogen);
72
73 const Real v_gold = FluidProperties::_R * T / (M * p);
74 REL_TEST(v, v_gold, REL_TOL_SAVED_VALUE);
75}
const std::vector< double > x
const double M
const double mu
const Real p
const double rho
const double T
const double v
TEST_F(IdealGasMixtureFluidPropertiesTest, test)
static const Real _R
Universal gas constant (J/mol/K)