From aac9435a0e932a36f0ddeda648b6f310e9a5fd20 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Thu, 17 Jan 2013 15:30:36 +0000 Subject: [PATCH] [Cython/1D] Fixed DiffusionFlame to work with phases not containing carbon --- interfaces/cython/cantera/onedim.pyx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/interfaces/cython/cantera/onedim.pyx b/interfaces/cython/cantera/onedim.pyx index 9fbcafb78..05b2d8b73 100644 --- a/interfaces/cython/cantera/onedim.pyx +++ b/interfaces/cython/cantera/onedim.pyx @@ -1063,9 +1063,11 @@ class CounterflowDiffusionFlame(FlameBase): if stoich is None: if oxidizer == 'O2': - nH = self.gas.nAtoms(fuel, 'H') - nC = self.gas.nAtoms(fuel, 'C') - stoich = 1.0 * nC + 0.25 * nH + stoich = 0.0 + if 'H' in self.gas.elementNames: + stoich += 0.25 * self.gas.nAtoms(fuel, 'H') + if 'C' in self.gas.elementNames: + stoich += self.gas.nAtoms(fuel, 'C') else: raise Exception('oxidizer/fuel stoichiometric ratio must be ' 'specified since the oxidizer is not O2')