https://mooseframework.inl.gov
Functions
IdealGasMixtureFluidPropertiesTest.C File Reference

Go to the source code of this file.

Functions

 TEST_F (IdealGasMixtureFluidPropertiesTest, test)
 

Function Documentation

◆ TEST_F()

TEST_F ( IdealGasMixtureFluidPropertiesTest  ,
test   
)

Definition at line 14 of file IdealGasMixtureFluidPropertiesTest.C.

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 = (_fp_mix->v_from_p_T(p * fpert1, T, x) - _fp_mix->v_from_p_T(p * fpert2, T, x)) / (2 * rel_pert * p);
51  const Real dvdT_p = (_fp_mix->v_from_p_T(p, T * fpert1, x) - _fp_mix->v_from_p_T(p, T * fpert2, x)) / (2 * rel_pert * T);
52  const Real dsdp_T = (_fp_mix->s_from_p_T(p * fpert1, T, x) - _fp_mix->s_from_p_T(p * fpert2, T, x)) / (2 * rel_pert * p);
53  const Real dsdT_p = (_fp_mix->s_from_p_T(p, T * fpert1, x) - _fp_mix->s_from_p_T(p, T * fpert2, x)) / (2 * rel_pert * T);
54  const Real dpdv_s = 1.0 / (dvdp_T - dvdT_p * dsdp_T / dsdT_p);
55  const Real c_gold = v * std::sqrt(-dpdv_s);
56  REL_TEST(_fp_mix->c_from_p_T(p, T, x), c_gold, REL_TOL_DERIVATIVE);
57 
58  const Real x_steam = 0.3;
59  const Real x_nitrogen = 0.7;
60 
61  const Real M_steam = 0.01801488;
62  const Real M_nitrogen = 0.028012734746133888;
63  const Real M = 1.0 / (x_steam / M_steam + x_nitrogen / M_nitrogen);
64 
65  const Real v_gold = FluidProperties::_R * T / (M * p);
66  REL_TEST(v, v_gold, REL_TOL_SAVED_VALUE);
67 }
static const std::string cv
Definition: NS.h:122
static const Real _R
Universal gas constant (J/mol/K)
static const std::string cp
Definition: NS.h:121
const std::vector< double > x
static const std::string mu
Definition: NS.h:123
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const std::string v
Definition: NS.h:84
static const std::string k
Definition: NS.h:130