Skip to content

Commit

Permalink
Update gas viscosity example
Browse files Browse the repository at this point in the history
  • Loading branch information
wigging committed Jan 1, 2023
1 parent 332ac68 commit c4355ef
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions examples/gas_viscosity.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
"""

import chemics as cm
import matplotlib.pyplot as plt
import numpy as np

# Determine viscosity of gas at temperature [K]
# ----------------------------------------------------------------------------
Expand All @@ -18,33 +16,9 @@

mu_mix = cm.mu_graham([mu_h2, mu_n2, mu_ch4], [0.4, 0.1, 0.5])

# Use coefficients to plot viscosity for range of temperatures [K]
# ----------------------------------------------------------------------------

results = cm.mu_gas('CH4', 833, full=True)

mu_ch4 = results[0]
tmin = results[2]
tmax = results[3]
a, b, c, d = results[4:]

tk = np.arange(tmin, tmax + 1)
mu_ch4_tk = a + b * tk + c * (tk**2) + d * (tk**3)

# Print results
# ----------------------------------------------------------------------------

print(f'mu_n2 = {mu_n2:.2f} µP')
print(f'mu_n2 = {mu_n2/1e7:.5g} kg/(m s)')
print(f'mu_mix = {mu_mix:.2f} µP')

# Plot results
# ----------------------------------------------------------------------------

fig, ax = plt.subplots(tight_layout=True)
ax.plot(tk, mu_ch4_tk)
ax.set_xlabel('Temperature [K]')
ax.set_ylabel(r'Gas Viscosity [µP]')
ax.set_title(r'Plot of CH$_4$ viscosity vs temperature')

plt.show()

0 comments on commit c4355ef

Please sign in to comment.