From 4b52f64d4878e20bd53adf543c1f5ab9c085fe8e Mon Sep 17 00:00:00 2001 From: Tulio Date: Sat, 6 Jan 2024 18:10:50 -0600 Subject: [PATCH] Cosmetic changes; fix header docs --- mirgecom/transport.py | 2 +- test/test_transport.py | 26 ++++++++++++-------------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/mirgecom/transport.py b/mirgecom/transport.py index 9260488fb..8d7a7137b 100644 --- a/mirgecom/transport.py +++ b/mirgecom/transport.py @@ -339,7 +339,7 @@ class MixtureAveragedTransport(TransportModel): def __init__(self, pyrometheus_mech, alpha=0.6, factor=1.0, lewis=None, epsilon=1e-4, singular_diffusivity=1e-6): - r"""Initialize power law coefficients and parameters. + r"""Initialize mixture averaged transport coefficients and parameters. Parameters ---------- diff --git a/test/test_transport.py b/test/test_transport.py index 8e0414619..da6ede531 100644 --- a/test/test_transport.py +++ b/test/test_transport.py @@ -100,14 +100,15 @@ def inf_norm(x): for pressin in ([0.25, 1.0]): for tempin in ([300.0, 600.0, 900.0, 1200.0, 1500.0, 1800.0, 2100.0]): - print(f"Testing (t,P) = ({tempin}, {pressin})") + cantera_soln.TP = tempin, pressin*cantera.one_atm + print(f"Testing (T, P) = ({cantera_soln.T}, {cantera_soln.P})") # Loop over each individual species by making a single-species mixture for i, name in enumerate(cantera_soln.species_names): - cantera_soln.TP = tempin, pressin*cantera.one_atm cantera_soln.Y = name + ":1" can_t, can_rho, can_y = cantera_soln.TDY + can_p = cantera_soln.P tin = can_t * ones rhoin = can_rho * ones yin = can_y * ones @@ -119,17 +120,18 @@ def inf_norm(x): fluid_state = make_fluid_state(cv, gas_model, tin) + assert inf_norm(fluid_state.temperature - tempin)/tempin < 1e-12 + assert inf_norm(fluid_state.pressure - can_p)/can_p < 1e-12 + # Viscosity mu = fluid_state.tv.viscosity mu_ct = cantera_soln.species_viscosities - err_mu = inf_norm(mu - mu_ct[i]) - assert err_mu < 1.0e-12 + assert inf_norm(mu) - mu_ct[i] < 1.0e-12 # Thermal conductivity kappa = fluid_state.tv.thermal_conductivity kappa_ct = cantera_soln.thermal_conductivity - err_kappa = inf_norm(kappa - kappa_ct) - assert err_kappa < 1.0e-12 + assert inf_norm(kappa - kappa_ct) < 1.0e-12 # NOTE: Individual species are exercised in Pyrometheus. # Since the transport model enforce a singular-species case @@ -137,8 +139,7 @@ def inf_norm(x): # individual species diffusivity. However, this tests that # the single-species case is enforced correctly. diff = fluid_state.tv.species_diffusivity - err_diff = inf_norm(diff[i] - sing_diff) - assert err_diff < 1.0e-15 + assert inf_norm(diff[i] - sing_diff) < 1.0e-15 # prescribe an actual mixture cantera_soln.set_equivalence_ratio(phi=1.0, fuel="H2:1", @@ -170,18 +171,15 @@ def inf_norm(x): # Viscosity mu = fluid_state.tv.viscosity mu_ct = cantera_soln.viscosity - err_mu = inf_norm(mu - mu_ct) - assert err_mu < 1.0e-12 + assert inf_norm(mu - mu_ct) < 1.0e-12 # Thermal conductivity kappa = fluid_state.tv.thermal_conductivity kappa_ct = cantera_soln.thermal_conductivity - err_kappa = inf_norm(kappa - kappa_ct) - assert err_kappa < 1.0e-12 + assert inf_norm(kappa - kappa_ct) < 1.0e-12 # Species diffusivities diff = fluid_state.tv.species_diffusivity diff_ct = cantera_soln.mix_diff_coeffs for i in range(nspecies): - err_diff = inf_norm(diff[i] - diff_ct[i]) - assert err_diff < 1.0e-11 + assert inf_norm(diff[i] - diff_ct[i]) < 1.0e-11