Skip to content

Commit

Permalink
[Python/Examples] Rename 'gri3' to more generic 'gas'
Browse files Browse the repository at this point in the history
  • Loading branch information
speth committed Jul 9, 2016
1 parent 001b7e9 commit b4f2f82
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
14 changes: 7 additions & 7 deletions interfaces/cython/cantera/examples/reactors/reactor1.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

import cantera as ct

gri3 = ct.Solution('gri30.xml')
gri3.TPX = 1001.0, ct.one_atm, 'H2:2,O2:1,N2:4'
r = ct.IdealGasConstPressureReactor(gri3)
gas = ct.Solution('gri30.xml')
gas.TPX = 1001.0, ct.one_atm, 'H2:2,O2:1,N2:4'
r = ct.IdealGasConstPressureReactor(gas)

sim = ct.ReactorNet([r])
time = 0.0
states = ct.SolutionArray(gri3, extra=['t'])
states = ct.SolutionArray(gas, extra=['t'])

print('%10s %10s %10s %14s' % ('t [s]','T [K]','P [Pa]','u [J/kg]'))
for n in range(100):
Expand All @@ -33,15 +33,15 @@
plt.xlabel('Time (ms)')
plt.ylabel('Temperature (K)')
plt.subplot(2, 2, 2)
plt.plot(states.t, states.X[:,gri3.species_index('OH')])
plt.plot(states.t, states.X[:,gas.species_index('OH')])
plt.xlabel('Time (ms)')
plt.ylabel('OH Mole Fraction')
plt.subplot(2, 2, 3)
plt.plot(states.t, states.X[:,gri3.species_index('H')])
plt.plot(states.t, states.X[:,gas.species_index('H')])
plt.xlabel('Time (ms)')
plt.ylabel('H Mole Fraction')
plt.subplot(2, 2, 4)
plt.plot(states.t, states.X[:,gri3.species_index('H2')])
plt.plot(states.t, states.X[:,gas.species_index('H2')])
plt.xlabel('Time (ms)')
plt.ylabel('H2 Mole Fraction')
plt.tight_layout()
Expand Down
10 changes: 5 additions & 5 deletions interfaces/cython/cantera/examples/reactors/reactor2.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@
env = ct.Reservoir(ct.Solution('air.xml'))

# use GRI-Mech 3.0 for the methane/air mixture, and set its initial state
gri3 = ct.Solution('gri30.xml')
gri3.TP = 500.0, 0.2 * ct.one_atm
gri3.set_equivalence_ratio(1.1, 'CH4:1.0', 'O2:2, N2:7.52')
gas = ct.Solution('gri30.xml')
gas.TP = 500.0, 0.2 * ct.one_atm
gas.set_equivalence_ratio(1.1, 'CH4:1.0', 'O2:2, N2:7.52')

# create a reactor for the methane/air side
r2 = ct.IdealGasReactor(gri3)
r2 = ct.IdealGasReactor(gas)

#-----------------------------------------------------------------------------
# Now couple the reactors by defining common walls that may move (a piston) or
Expand All @@ -68,7 +68,7 @@
csvfile.writerow(['time (s)','T1 (K)','P1 (Bar)','V1 (m3)',
'T2 (K)','P2 (Bar)','V2 (m3)'])
states1 = ct.SolutionArray(ar, extra=['t', 'V'])
states2 = ct.SolutionArray(gri3, extra=['t', 'V'])
states2 = ct.SolutionArray(gas, extra=['t', 'V'])

for n in range(n_steps):
time += 4.e-4
Expand Down
6 changes: 3 additions & 3 deletions interfaces/cython/cantera/examples/reactors/sensitivity1.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

import cantera as ct

gri3 = ct.Solution('gri30.xml')
gas = ct.Solution('gri30.xml')
temp = 1500.0
pres = ct.one_atm

gri3.TPX = temp, pres, 'CH4:0.1, O2:2, N2:7.52'
r = ct.IdealGasConstPressureReactor(gri3, name='R1')
gas.TPX = temp, pres, 'CH4:0.1, O2:2, N2:7.52'
r = ct.IdealGasConstPressureReactor(gas, name='R1')
sim = ct.ReactorNet([r])

# enable sensitivity with respect to the rates of the first 10
Expand Down

0 comments on commit b4f2f82

Please sign in to comment.