[Python] Fixed some more incompatibilities with Python 2.6
This commit is contained in:
parent
982f9af20c
commit
9631f44d29
9 changed files with 10 additions and 10 deletions
|
|
@ -81,7 +81,7 @@ with open(csv_file, 'w') as outfile:
|
|||
writer.writerow(['phi','T (K)'] + mix.species_names)
|
||||
for i in range(npoints):
|
||||
writer.writerow([phi[i], tad[i]] + list(xeq[:,i]))
|
||||
print('Output written to {}'.format(csv_file))
|
||||
print('Output written to {0}'.format(csv_file))
|
||||
|
||||
if '--plot' in sys.argv:
|
||||
import matplotlib.pyplot as plt
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ writer.writerow(['T'] + mix.species_names)
|
|||
# loop over temperature
|
||||
for n in range(100):
|
||||
t = 350.0 + 50.0*n
|
||||
print('T = {}'.format(t))
|
||||
print('T = {0}'.format(t))
|
||||
mix.T = t
|
||||
mix.P = ct.one_atm
|
||||
mix.species_moles = "K:1.03, H2:2.12, O2:0.9"
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ def getTempData(filename):
|
|||
except Exception:
|
||||
pass
|
||||
|
||||
print('read {} temperature values.'.format(len(z)))
|
||||
print('read {0} temperature values.'.format(len(z)))
|
||||
|
||||
# convert z values into non-dimensional relative positions.
|
||||
n = len(z)
|
||||
|
|
|
|||
|
|
@ -86,9 +86,9 @@ if os.path.exists(outfile):
|
|||
for m,md in enumerate(mdot):
|
||||
sim.inlet.mdot = md
|
||||
sim.solve(loglevel,refine_grid)
|
||||
sim.save(outfile, 'mdot{}'.format(m), 'mdot = {} kg/m2/s'.format(md))
|
||||
sim.save(outfile, 'mdot{0}'.format(m), 'mdot = {0} kg/m2/s'.format(md))
|
||||
|
||||
# write the velocity, temperature, and mole fractions to a CSV file
|
||||
sim.write_csv('stflame1_{}.csv'.format(m), quiet=False)
|
||||
sim.write_csv('stflame1_{0}.csv'.format(m), quiet=False)
|
||||
|
||||
sim.show_stats()
|
||||
|
|
|
|||
|
|
@ -155,4 +155,4 @@ for n in range(NReactors):
|
|||
list(gas.X) + list(surf.coverages))
|
||||
|
||||
outfile.close()
|
||||
print("Results saved to '{}'".format(output_filename))
|
||||
print("Results saved to '{0}'".format(output_filename))
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ TPB_length_per_area = 1.0e7 # TPB length per unit area [1/m]
|
|||
|
||||
def show_coverages(s):
|
||||
"""Print the coverages for surface s."""
|
||||
print('\n{}\n'.format(s.name))
|
||||
print('\n{0}\n'.format(s.name))
|
||||
cov = s.coverages
|
||||
names = s.species_names
|
||||
for n in range(s.n_species):
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ def expand(fluid, p_final, eta):
|
|||
|
||||
|
||||
def printState(n, fluid):
|
||||
print('\n***************** State {} ******************'.format(n))
|
||||
print('\n***************** State {0} ******************'.format(n))
|
||||
print(fluid.report())
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class CanteraTest(unittest.TestCase):
|
|||
|
||||
def assertArrayNear(self, A, B, rtol=1e-8, atol=1e-12, msg=None):
|
||||
if len(A) != len(B):
|
||||
self.fail("Arrays are of different lengths ({}, {})".format(len(A), len(B)))
|
||||
self.fail("Arrays are of different lengths ({0}, {1})".format(len(A), len(B)))
|
||||
A = np.asarray(A)
|
||||
B = np.asarray(B)
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class chemkinConverterTest(utilities.CanteraTest):
|
|||
ref_s = ref.entropies_R()
|
||||
gas_s = gas.entropies_R()
|
||||
for i in range(gas.nSpecies()):
|
||||
message = ' for species {} at T = {}'.format(i, T)
|
||||
message = ' for species {0} at T = {1}'.format(i, T)
|
||||
self.assertNear(ref_cp[i], gas_cp[i], 1e-7, msg='cp'+message)
|
||||
self.assertNear(ref_h[i], gas_h[i], 1e-7, msg='h'+message)
|
||||
self.assertNear(ref_s[i], gas_s[i], 1e-7, msg='s'+message)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue