Skip to content

Commit

Permalink
[1D] fix file output if radiation_enabled=True
Browse files Browse the repository at this point in the history
  • Loading branch information
ischoegl committed Mar 18, 2021
1 parent e70371a commit deffc7f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion interfaces/cython/cantera/onedim.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ cdef class Sim1D:
else:
other_cols[e] = self.profile(dom, e)
if self.radiation_enabled:
other_cols['qdot'] = self.radiative_heat_loss
other_cols['qdot'] = self.flame.radiative_heat_loss

return states, other_cols, meta

Expand Down
14 changes: 14 additions & 0 deletions interfaces/cython/cantera/test/test_onedim.py
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,13 @@ def test_mixture_averaged_rad(self, saveReference=False):
rtol=1e-2, atol=1e-8, xtol=1e-2)
self.assertFalse(bad, bad)

filename = pjoin(self.test_work_dir, 'DiffusionFlameTest-h2-mix-rad.csv')
self.sim.write_csv(filename) # check output
self.assertTrue(os.path.exists(filename))
csv_data = np.genfromtxt(filename, dtype=float, delimiter=',', names=True)
self.assertIn('qdot', csv_data.dtype.names)
os.remove(filename)

def test_strain_rate(self):
# This doesn't test that the values are correct, just that they can be
# computed without error
Expand Down Expand Up @@ -987,6 +994,13 @@ def test_mixture_averaged(self, saveReference=False):
rtol=1e-2, atol=1e-8, xtol=1e-2)
self.assertFalse(bad, bad)

filename = pjoin(self.test_work_dir, 'CounterflowPremixedFlame-h2-mix.csv')
sim.write_csv(filename) # check output
self.assertTrue(os.path.exists(filename))
csv_data = np.genfromtxt(filename, dtype=float, delimiter=',', names=True)
self.assertNotIn('qdot', csv_data.dtype.names)
os.remove(filename)

def run_case(self, phi, T, width, P):
gas = ct.Solution('h2o2.xml')
gas.TPX = T, P * ct.one_atm, {'H2':phi, 'O2':0.5, 'AR':2}
Expand Down

0 comments on commit deffc7f

Please sign in to comment.