Skip to content

Commit

Permalink
Cosmetic changes; fix header docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tulioricci committed Jan 7, 2024
1 parent dc8c5aa commit 4b52f64
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
2 changes: 1 addition & 1 deletion mirgecom/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
----------
Expand Down
26 changes: 12 additions & 14 deletions test/test_transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -119,26 +120,26 @@ 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
# to avoid numerical issues when Yi -> 1, we can not test the
# 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",
Expand Down Expand Up @@ -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

0 comments on commit 4b52f64

Please sign in to comment.