[Python/Examples] Added option to plot results for premixed twin flame
This commit is contained in:
parent
1dc7071ba6
commit
036eeb1678
1 changed files with 37 additions and 0 deletions
|
|
@ -8,6 +8,7 @@ latter simulates a jet of reactants shooting into products.
|
|||
|
||||
import cantera as ct
|
||||
import numpy as np
|
||||
import sys
|
||||
|
||||
# Differentiation function for data that has variable grid spacing Used here to
|
||||
# compute normal strain-rate
|
||||
|
|
@ -112,3 +113,39 @@ print("Peak temperature: {0:.1f} K".format(T))
|
|||
print("Strain Rate: {0:.1f} 1/s".format(K))
|
||||
print("Consumption Speed: {0:.2f} cm/s".format(Sc*100))
|
||||
oppFlame.write_csv("premixed_twin_flame.csv", quiet=False)
|
||||
|
||||
# Generate plots to see results, if user desires
|
||||
if '--plot' in sys.argv:
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
plt.figure(figsize=(8,6), facecolor='white')
|
||||
|
||||
# Axial Velocity Plot
|
||||
plt.subplot(1,2,1)
|
||||
plt.plot(oppFlame.grid, oppFlame.u, 'r', lw=2)
|
||||
plt.xlim(oppFlame.grid[0], oppFlame.grid[-1])
|
||||
plt.xlabel('Distance (m)')
|
||||
plt.ylabel('Axial Velocity (m/s)')
|
||||
|
||||
# Identify the point where the strain rate is calculated
|
||||
plt.plot(oppFlame.grid[strainRatePoint], oppFlame.u[strainRatePoint],'gs')
|
||||
plt.annotate('Strain-Rate point',
|
||||
xy=(oppFlame.grid[strainRatePoint], oppFlame.u[strainRatePoint]),
|
||||
xytext=(0.001, 0.1),
|
||||
arrowprops={'arrowstyle':'->'})
|
||||
|
||||
# Temperature Plot
|
||||
plt.subplot(1,2,2)
|
||||
plt.plot(oppFlame.grid, oppFlame.T, 'b', lw=2)
|
||||
plt.xlim(oppFlame.grid[0], oppFlame.grid[-1])
|
||||
plt.xlabel('Distance (m)')
|
||||
plt.ylabel('Temperature (K)')
|
||||
|
||||
plt.tight_layout()
|
||||
plt.show()
|
||||
|
||||
else:
|
||||
print('************')
|
||||
print('Plotting option not enabled. Re-run script with --plot to see key plots.')
|
||||
print('************')
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue