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 = 3362.64537354375;
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
38 // The mixture entropy exceeds the mass-weighted component entropies at the mixture pressure
39 // by the ideal entropy of mixing, -R / M sum_i psi_i ln(psi_i), with psi_i the mole fractions
40 {
41 const Real M_steam = 0.01801488;
42 const Real M_nitrogen = 0.028012734746133888;
43 const Real M_mix = 1.0 / ((1.0 - x[0]) / M_steam + x[0] / M_nitrogen);
44 const Real psi_steam = (1.0 - x[0]) * M_mix / M_steam;
45 const Real psi_nitrogen = x[0] * M_mix / M_nitrogen;
46 const Real s_unmixed =
47 (1.0 - x[0]) * _fp_steam->s_from_p_T(p, T) + x[0] * _fp_nitrogen->s_from_p_T(p, T);
48 const Real s_mixing = -FluidProperties::_R / M_mix *
49 (psi_steam * std::log(psi_steam) + psi_nitrogen * std::log(psi_nitrogen));
50 REL_TEST(_fp_mix->s_from_p_T(p, T, x), s_unmixed + s_mixing, REL_TOL_CONSISTENCY);
51 }
52 REL_TEST(_fp_mix->c_from_p_T(p, T, x), c, REL_TOL_SAVED_VALUE);
53 REL_TEST(_fp_mix->cp_from_p_T(p, T, x), cp, REL_TOL_SAVED_VALUE);
54 REL_TEST(_fp_mix->cv_from_p_T(p, T, x), cv, REL_TOL_SAVED_VALUE);
55 REL_TEST(_fp_mix->mu_from_p_T(p, T, x), mu, REL_TOL_SAVED_VALUE);
56 REL_TEST(_fp_mix->k_from_p_T(p, T, x), k, REL_TOL_SAVED_VALUE);
57
58 // Test sound speed against thermodynamics definition:
59 // c = sqrt((dp/drho)_s) = v sqrt(-(dp/dv)_s)
60 // To compute (dp/dv)_s, we will use the following identity:
61 // (dp/dv)_s = 1 / [(dv/dp)_T - (dv/dT)_p (ds/dp)_T / (ds/dT)_p]
62 const Real rel_pert = REL_PERTURBATION;
63 const Real fpert1 = 1 + rel_pert;
64 const Real fpert2 = 1 - rel_pert;
65 const Real dvdp_T =
66 (_fp_mix->v_from_p_T(p * fpert1, T, x) - _fp_mix->v_from_p_T(p * fpert2, T, x)) /
67 (2 * rel_pert * p);
68 const Real dvdT_p =
69 (_fp_mix->v_from_p_T(p, T * fpert1, x) - _fp_mix->v_from_p_T(p, T * fpert2, x)) /
70 (2 * rel_pert * T);
71 const Real dsdp_T =
72 (_fp_mix->s_from_p_T(p * fpert1, T, x) - _fp_mix->s_from_p_T(p * fpert2, T, x)) /
73 (2 * rel_pert * p);
74 const Real dsdT_p =
75 (_fp_mix->s_from_p_T(p, T * fpert1, x) - _fp_mix->s_from_p_T(p, T * fpert2, x)) /
76 (2 * rel_pert * T);
77 const Real dpdv_s = 1.0 / (dvdp_T - dvdT_p * dsdp_T / dsdT_p);
78 const Real c_gold = v * std::sqrt(-dpdv_s);
79 REL_TEST(_fp_mix->c_from_p_T(p, T, x), c_gold, REL_TOL_DERIVATIVE);
80
81 const Real x_steam = 0.3;
82 const Real x_nitrogen = 0.7;
83
84 const Real M_steam = 0.01801488;
85 const Real M_nitrogen = 0.028012734746133888;
86 const Real M = 1.0 / (x_steam / M_steam + x_nitrogen / M_nitrogen);
87
88 const Real v_gold = FluidProperties::_R * T / (M * p);
89 REL_TEST(v, v_gold, REL_TOL_SAVED_VALUE);
90}
91
92namespace
93{
99template <typename F>
100void
101expectADDerivatives(const F & f, const Real a, const Real b, const Real x)
102{
103 DNDerivativeType da, db, dx;
104 Moose::derivInsert(da, 0, 1);
105 Moose::derivInsert(db, 1, 1);
106 Moose::derivInsert(dx, 2, 1);
107 const ADReal f_ad = f(ADReal(a, da), ADReal(b, db), std::vector<ADReal>{ADReal(x, dx)});
108 REL_TEST(f_ad, f(a, b, std::vector<Real>{x}), REL_TOL_CONSISTENCY);
109
110 const Real ha = REL_PERTURBATION * a;
111 const Real hb = REL_PERTURBATION * b;
112 const Real hx = REL_PERTURBATION * x;
113 REL_TEST(f_ad.derivatives()[0],
114 (f(a + ha, b, std::vector<Real>{x}) - f(a - ha, b, std::vector<Real>{x})) / (2 * ha),
115 REL_TOL_DERIVATIVE);
116 REL_TEST(f_ad.derivatives()[1],
117 (f(a, b + hb, std::vector<Real>{x}) - f(a, b - hb, std::vector<Real>{x})) / (2 * hb),
118 REL_TOL_DERIVATIVE);
119 REL_TEST(f_ad.derivatives()[2],
120 (f(a, b, std::vector<Real>{x + hx}) - f(a, b, std::vector<Real>{x - hx})) / (2 * hx),
121 REL_TOL_DERIVATIVE);
122}
123
129void
130expectMixtureADDerivatives(const IdealGasMixtureFluidProperties & fp,
131 const Real p,
132 const Real T,
133 const Real x)
134{
135 const Real v = fp.v_from_p_T(p, T, {x});
136 const Real e = fp.e_from_p_T(p, T, {x});
137
138 expectADDerivatives([&fp](const auto & v, const auto & e, const auto & x)
139 { return fp.T_from_v_e(v, e, x); },
140 v,
141 e,
142 x);
143 expectADDerivatives([&fp](const auto & v, const auto & e, const auto & x)
144 { return fp.p_from_v_e(v, e, x); },
145 v,
146 e,
147 x);
148 expectADDerivatives([&fp](const auto & p, const auto & rho, const auto & x)
149 { return fp.e_from_p_rho(p, rho, x); },
150 p,
151 1 / v,
152 x);
153 expectADDerivatives([&fp](const auto & p, const auto & T, const auto & x)
154 { return fp.c_from_p_T(p, T, x); },
155 p,
156 T,
157 x);
158}
159}
160
162{
163 expectMixtureADDerivatives(*_fp_mix, 100000, 400, 0.7);
164}
165
166TEST_F(IdealGasMixtureFluidPropertiesTest, deprecatedSpecificHeatRatio)
167{
168 // The deprecated specific heat ratio without pressure and temperature arguments still works for
169 // components with constant specific heats
170 const std::vector<Real> x = {0.3, 0.7};
171 REL_TEST(_fp_mix->mixtureSpecificHeatRatio(x),
172 _fp_mix->mixtureSpecificHeatRatio(100000.0, 400.0, x),
173 REL_TOL_CONSISTENCY);
174
175 // It reports an error for components with temperature-dependent specific heats
176 const std::vector<std::string> species = {"N2", "O2"};
177 const std::string name = "air";
178 const auto & air = buildNASA7Mixture(species, name);
179 EXPECT_THROW(air.mixtureSpecificHeatRatio(std::vector<Real>{0.767, 0.233}), std::exception);
180}
181
183{
184 // Reformed fuel of a solid oxide cell, with mole fractions H2O 0.35, H2 0.30, CO 0.10, CO2 0.15,
185 // CH4 0.05, and N2 0.05, at 1073.15 K (800 C). The secondary mass fractions and the reference
186 // values were computed with Cantera 3.2.0 from gri30.yaml. Cantera uses the gas constant
187 // 8.31446261815324 J/(mol K), whereas FluidProperties::_R is 8.3144598 J/(mol K). Properties
188 // proportional to the gas constant are rescaled by the ratio of the two, density by its inverse,
189 // and sound speed by its square root, so that only roundoff separates the results.
190 const std::vector<std::string> species = {"H2O", "H2", "CO", "CO2", "CH4", "N2"};
191 const std::string name = "reformate";
192 const auto & fp = buildNASA7Mixture(species, name);
193 const std::vector<Real> x = {0.03266496536638716,
194 0.1512807010437342,
195 0.3565358285737432,
196 0.04332374664128218,
197 0.0756511524284036};
198 const Real p = 1.5e5;
199 const Real T = 1073.15;
200 const Real R_ratio = FluidProperties::_R / 8.31446261815324;
201 const Real tol = 1e-12;
202
203 const Real rho = 0.311262086619508 / R_ratio;
204 const Real e = -7502142.694955811 * R_ratio;
205 REL_TEST(fp.rho_from_p_T(p, T, x), rho, tol);
206 REL_TEST(fp.e_from_p_T(p, T, x), e, tol);
207 REL_TEST(fp.cp_from_p_T(p, T, x), 2216.7883592581443 * R_ratio, tol);
208 REL_TEST(fp.cv_from_p_T(p, T, x), 1767.7281187454187 * R_ratio, tol);
209 REL_TEST(fp.c_from_p_T(p, T, x), 777.386327867082 * std::sqrt(R_ratio), tol);
210
211 // The (v, e) and (p, rho) variable sets describe the same state
212 REL_TEST(fp.T_from_v_e(1 / rho, e, x), T, REL_TOL_CONSISTENCY);
213 REL_TEST(fp.p_from_v_e(1 / rho, e, x), p, REL_TOL_CONSISTENCY);
214 REL_TEST(fp.e_from_p_rho(p, rho, x), e, REL_TOL_CONSISTENCY);
215}
216
218{
219 // The internal energy and enthalpy of ideal gases do not depend on pressure or specific volume
220 const Real p = 1e5;
221 const Real v = 1;
222
223 // Computes the temperature from the internal energy at temperatures spread geometrically between
224 // T_low and T_high, 60 intervals placing consecutive temperatures about 7% apart
225 const auto sweep = [p, v](const IdealGasMixtureFluidProperties & fp,
226 const std::vector<Real> & x,
227 const Real T_low,
228 const Real T_high)
229 {
230 const unsigned int n = 60;
231 for (const auto i : make_range(n + 1))
232 {
233 const Real T = T_low * std::pow(T_high / T_low, Real(i) / n);
234 REL_TEST(fp.T_from_v_e(v, fp.e_from_p_T(p, T, x), x), T, REL_TOL_CONSISTENCY);
235 }
236 };
237
238 // From half the highest lower end to 1.5 times the lowest upper end of the temperature ranges of
239 // the data of the components: 300 K for N2 and 3500 K for the others
240 const std::vector<std::string> reformate_species = {"H2O", "H2", "CO", "CO2", "CH4", "N2"};
241 const std::string reformate_name = "reformate";
242 const auto & reformate = buildNASA7Mixture(reformate_species, reformate_name);
243 sweep(reformate, {0.033, 0.151, 0.357, 0.043, 0.076}, 150, 5250);
244
245 // Air, with the O2 mass fraction 0.233
246 const std::vector<std::string> air_species = {"N2", "O2"};
247 const std::string air_name = "air";
248 const auto & air = buildNASA7Mixture(air_species, air_name);
249 const std::vector<Real> x_air = {0.233};
250 sweep(air, x_air, 150, 5250);
251
252 // CH4 and N2 in equal mass fractions. Started below the solution, Newton's method can overshoot
253 // to a spurious solution of the extrapolated CH4 polynomials.
254 const std::vector<std::string> methane_nitrogen_species = {"N2", "CH4"};
255 const std::string methane_nitrogen_name = "methane_nitrogen";
256 const auto & methane_nitrogen =
257 buildNASA7Mixture(methane_nitrogen_species, methane_nitrogen_name);
258 sweep(methane_nitrogen, {0.5}, 150, 5250);
259
260 // The internal energy of air, which includes the zero enthalpies of formation of N2 and O2,
261 // passes through zero near 417 K, where a convergence test relative to the target energy would
262 // demand accuracy below roundoff
263 for (const Real e : {-1e-3, -1e-6, 0.0, 1e-6, 1e-3})
264 {
265 const Real T = air.T_from_v_e(v, e, x_air);
266 ABS_TEST(
267 air.e_from_p_T(p, T, x_air), e, REL_TOL_CONSISTENCY * air.cv_from_p_T(p, T, x_air) * T);
268 }
269
270 // A NASA 7-coefficient gas, CO2, as a secondary component of nitrogen with constant specific
271 // heats; the latter has no temperature range
272 {
273 InputParameters params = _factory.getValidParams("NASA7IdealGasFluidProperties");
274 params.set<MooseEnum>("species") = "CO2";
275 _fe_problem->addUserObject("NASA7IdealGasFluidProperties", "co2", params);
276 }
277 {
278 InputParameters params = _factory.getValidParams("IdealGasMixtureFluidProperties");
279 params.set<std::vector<UserObjectName>>("component_fluid_properties") = {"fp_nitrogen", "co2"};
280 _fe_problem->addUserObject("IdealGasMixtureFluidProperties", "nitrogen_co2", params);
281 }
282 sweep(
283 _fe_problem->getUserObject<IdealGasMixtureFluidProperties>("nitrogen_co2"), {0.3}, 100, 5250);
284}
285
287{
288 // Air, with the O2 mass fraction 0.233, on each side of the midpoint temperature of the data. The
289 // temperature from (v, e) comes from a nonlinear Newton solve here, whose derivatives with
290 // respect to the internal energy and the mass fraction the automatic differentiation must carry.
291 const std::vector<std::string> species = {"N2", "O2"};
292 const std::string name = "air";
293 const auto & air = buildNASA7Mixture(species, name);
294 for (const Real T : {700.0, 1500.0})
295 expectMixtureADDerivatives(air, 100000, T, 0.233);
296}
297
299{
300 // Mixture-averaged viscosity of N2, O2, H2, and CO2 with mole fractions 0.4, 0.1, 0.3, and 0.2
301 // at 1000 K, computed with Cantera 3.2.0 from gri30.yaml, which applies the rule of Wilke to the
302 // species viscosities below. Components with these viscosities and the molar masses of Cantera
303 // reproduce it.
304 const std::vector<std::string> species = {"N2", "O2", "H2", "CO2"};
305 const std::vector<Real> molar_masses = {0.028014, 0.031998, 0.002016, 0.044009};
306 const std::vector<Real> viscosities = {
307 4.149814387750263e-05, 4.791169430728531e-05, 1.967636836557897e-05, 4.099132511194919e-05};
308 const std::vector<Real> x = {0.1343776247270284, 0.025398958508315132, 0.3696371577355955};
309 const Real mu_mix = 4.1726130812941113e-05;
310
311 std::vector<UserObjectName> component_names;
312 for (const auto i : index_range(species))
313 {
314 const std::string name = "wilke_" + species[i];
315 InputParameters params = _factory.getValidParams("IdealGasFluidProperties");
316 params.set<Real>("molar_mass") = molar_masses[i];
317 params.set<Real>("mu") = viscosities[i];
318 _fe_problem->addUserObject("IdealGasFluidProperties", name, params);
319 component_names.push_back(name);
320 }
321 InputParameters params = _factory.getValidParams("IdealGasMixtureFluidProperties");
322 params.set<std::vector<UserObjectName>>("component_fluid_properties") = component_names;
323 params.set<MooseEnum>("transport_mixing_rule") = "wilke";
324 _fe_problem->addUserObject("IdealGasMixtureFluidProperties", "wilke_mixture", params);
325 const auto & fp = _fe_problem->getUserObject<IdealGasMixtureFluidProperties>("wilke_mixture");
326
327 const Real p = 1e5;
328 const Real T = 1000;
329 REL_TEST(fp.mu_from_p_T(p, T, x), mu_mix, REL_TOL_SAVED_VALUE);
330
331 // A single component keeps its own viscosity
332 REL_TEST(fp.mu_from_p_T(p, T, {0, 0, 0}), viscosities[0], REL_TOL_SAVED_VALUE);
333}
334
336{
337 // The rule of Mason and Saxena for the thermal conductivity uses the interaction factors of the
338 // rule of Wilke for the viscosity, which depend on the component viscosities and molar masses
339 // only. Two consequences are checked: components whose thermal conductivities are proportional
340 // to their viscosities give a mixture thermal conductivity proportional to the mixture viscosity
341 // with the same factor, and components with equal viscosities and molar masses give the average
342 // of their thermal conductivities weighted by molar fraction.
343 const auto build_mixture = [this](const std::string & name,
344 const std::vector<Real> & molar_masses,
345 const std::vector<Real> & viscosities,
346 const std::vector<Real> & conductivities)
347 {
348 std::vector<UserObjectName> component_names;
349 for (const auto i : index_range(molar_masses))
350 {
351 const std::string component_name = name + "_" + std::to_string(i);
352 InputParameters params = _factory.getValidParams("IdealGasFluidProperties");
353 params.set<Real>("molar_mass") = molar_masses[i];
354 params.set<Real>("mu") = viscosities[i];
355 params.set<Real>("k") = conductivities[i];
356 _fe_problem->addUserObject("IdealGasFluidProperties", component_name, params);
357 component_names.push_back(component_name);
358 }
359 InputParameters params = _factory.getValidParams("IdealGasMixtureFluidProperties");
360 params.set<std::vector<UserObjectName>>("component_fluid_properties") = component_names;
361 params.set<MooseEnum>("transport_mixing_rule") = "wilke";
362 _fe_problem->addUserObject("IdealGasMixtureFluidProperties", name, params);
363 return &_fe_problem->getUserObject<IdealGasMixtureFluidProperties>(name);
364 };
365
366 const Real p = 1e5;
367 const Real T = 1000;
368
369 // Molar masses and viscosities of N2, O2, H2, and CO2 near 1000 K, and an arbitrary factor
370 const std::vector<Real> molar_masses = {0.028014, 0.031998, 0.002016, 0.044009};
371 const std::vector<Real> viscosities = {4.15e-05, 4.79e-05, 1.97e-05, 4.10e-05};
372 const Real factor = 1500;
373 std::vector<Real> conductivities;
374 for (const auto mu : viscosities)
375 conductivities.push_back(factor * mu);
376 const auto * proportional =
377 build_mixture("proportional", molar_masses, viscosities, conductivities);
378 const std::vector<Real> x = {0.13, 0.03, 0.37};
379 REL_TEST(proportional->k_from_p_T(p, T, x),
380 factor * proportional->mu_from_p_T(p, T, x),
381 REL_TOL_CONSISTENCY);
382
383 const auto * equal = build_mixture("equal", {0.028, 0.028}, {4e-5, 4e-5}, {0.06, 0.08});
384 REL_TEST(equal->k_from_p_T(p, T, {0.25}), 0.75 * 0.06 + 0.25 * 0.08, REL_TOL_CONSISTENCY);
385}
386
388{
389 // Air, with the O2 mass fraction 0.233, and a fuel of H2O and H2, with the H2 mass fraction
390 // 0.05, near the temperature of a solid oxide cell. The viscosity of H2O comes from the IAPWS
391 // formulation and the others from kinetic theory.
392 const std::vector<std::pair<std::vector<std::string>, Real>> mixtures = {{{"N2", "O2"}, 0.233},
393 {{"H2O", "H2"}, 0.05}};
394 for (const auto & [species, x] : mixtures)
395 {
396 const std::string name = "wilke_" + species[0] + "_" + species[1];
397 const auto & fp = buildNASA7Mixture(species, name, "wilke");
398 expectADDerivatives([&fp](const auto & p, const auto & T, const auto & x)
399 { return fp.mu_from_p_T(p, T, x); },
400 1e5,
401 1073.15,
402 x);
403 expectADDerivatives([&fp](const auto & p, const auto & T, const auto & x)
404 { return fp.k_from_p_T(p, T, x); },
405 1e5,
406 1073.15,
407 x);
408 }
409}
410
412{
413 // Binary diffusion coefficients at 1e5 Pa and 1000 K computed with Cantera 3.2.0 from
414 // gri30.yaml, which the Chapman-Enskog coefficients reproduce within 0.1% for pairs without H2O
415 const auto & fp = buildNASA7Mixture({"N2", "O2", "H2"}, "diffusion");
416 const Real p = 1e5;
417 const Real T = 1000;
418 const Real tol = 2e-3;
419 REL_TEST(fp.binaryDiffusionCoefficient(p, T, 0, 1), 0.00016508453019480936, tol);
420 REL_TEST(fp.binaryDiffusionCoefficient(p, T, 2, 0), 0.0005928256767875003, tol);
421
422 // The coefficient is symmetric in the pair
423 REL_TEST(fp.binaryDiffusionCoefficient(p, T, 0, 2),
424 fp.binaryDiffusionCoefficient(p, T, 2, 0),
425 REL_TOL_CONSISTENCY);
426
427 // The derivatives with respect to pressure (index 0) and temperature (index 1): the coefficient
428 // is inversely proportional to pressure
429 DNDerivativeType dp_dp, dT_dT;
430 Moose::derivInsert(dp_dp, 0, 1);
431 Moose::derivInsert(dT_dT, 1, 1);
432 const ADReal D_ad = fp.binaryDiffusionCoefficient(ADReal(p, dp_dp), ADReal(T, dT_dT), 0, 2);
433 const Real D = fp.binaryDiffusionCoefficient(p, T, 0, 2);
434 const Real h = REL_PERTURBATION * T;
435 REL_TEST(D_ad, D, REL_TOL_CONSISTENCY);
436 REL_TEST(D_ad.derivatives()[0], -D / p, REL_TOL_CONSISTENCY);
437 REL_TEST(D_ad.derivatives()[1],
438 (fp.binaryDiffusionCoefficient(p, T + h, 0, 2) -
439 fp.binaryDiffusionCoefficient(p, T - h, 0, 2)) /
440 (2 * h),
441 REL_TOL_DERIVATIVE);
442
443 // IdealGasFluidProperties components have no Lennard-Jones parameters
444 EXPECT_THROW(_fp_mix->binaryDiffusionCoefficient(p, T, 0, 1), std::exception);
445}
446
448{
449 // A mixture with only one component present has the entropy of that component
450 // Derivative index 0 is pressure and index 1 is temperature
451 const Real p = 1e5;
452 const Real T = 400;
453 DNDerivativeType dp_dp, dT_dT;
454 Moose::derivInsert(dp_dp, 0, 1);
455 Moose::derivInsert(dT_dT, 1, 1);
456 const ADReal p_ad(p, dp_dp);
457 const ADReal T_ad(T, dT_dT);
458 for (const auto & [x, fp] : {std::pair<Real, const IdealGasFluidProperties *>(0, _fp_steam),
459 std::pair<Real, const IdealGasFluidProperties *>(1, _fp_nitrogen)})
460 {
461 Real s, ds_dp, ds_dT;
462 fp->s_from_p_T(p, T, s, ds_dp, ds_dT);
463 REL_TEST(_fp_mix->s_from_p_T(p, T, {x}), s, REL_TOL_CONSISTENCY);
464 const ADReal s_ad = _fp_mix->s_from_p_T(p_ad, T_ad, std::vector<ADReal>{ADReal(x)});
465 REL_TEST(s_ad.derivatives()[0], ds_dp, REL_TOL_CONSISTENCY);
466 REL_TEST(s_ad.derivatives()[1], ds_dT, REL_TOL_CONSISTENCY);
467 }
468}
DualNumber< Real, DNDerivativeType, true > ADReal
SemiDynamicSparseNumberArray< Real, libMesh::dof_id_type, NWrapper< MOOSE_AD_MAX_DOFS_PER_ELEM > > DNDerivativeType
Real f(Real x)
Test function for Brents method.
const double tol
const std::vector< double > x
const double M
const double mu
const Real p
const double rho
const double T
const double v
const GeochemicalDatabaseReader db("database/moose_testdb.json", true, true, false)
TEST_F(IdealGasMixtureFluidPropertiesTest, test)
const std::string name
Definition Setup.h:21
static const Real _R
Universal gas constant (J/mol/K)
Class for fluid properties of an ideal gas mixture.
T & set(const std::string &name, bool quiet_mode=false)
void derivInsert(SemiDynamicSparseNumberArray< Real, libMesh::dof_id_type, NWrapper< N > > &derivs, libMesh::dof_id_type index, Real value)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real