From 1057d2073182628e790c70df0a42f812687ff340 Mon Sep 17 00:00:00 2001 From: bangshiuh Date: Sat, 13 May 2017 20:55:51 -0400 Subject: [PATCH] [1D] Fix IonFlow docstrings and simplify testIonFlame --- AUTHORS | 1 + .../cython/cantera/examples/onedim/ion_flame.py | 4 +--- interfaces/cython/cantera/onedim.py | 4 ++-- interfaces/cython/cantera/test/test_onedim.py | 12 ++---------- 4 files changed, 6 insertions(+), 15 deletions(-) diff --git a/AUTHORS b/AUTHORS index 3ed35d694..968d4e296 100644 --- a/AUTHORS +++ b/AUTHORS @@ -6,6 +6,7 @@ tracker. Philip Berndt Victor Brunini, Sandia National Laboratory +Bang-Shiuh Chen, Purdue University Steven Decaluwe, Colorado School of Mines Thomas Fiala, Technische Universität München David Fronczek diff --git a/interfaces/cython/cantera/examples/onedim/ion_flame.py b/interfaces/cython/cantera/examples/onedim/ion_flame.py index ead8d4ad4..44e463c07 100644 --- a/interfaces/cython/cantera/examples/onedim/ion_flame.py +++ b/interfaces/cython/cantera/examples/onedim/ion_flame.py @@ -1,6 +1,5 @@ """ -A freely-propagating, premixed hydrogen flat flame with multicomponent -transport properties. +A freely-propagating, premixed methane-air flat flame with charged species. """ import cantera as ct @@ -39,4 +38,3 @@ print('mixture-averaged flamespeed = {0:7f} m/s'.format(f.u[0])) # write the velocity, temperature, density, and mole fractions to a CSV file f.write_csv('CH4_adiabatic.csv', quiet=False) - diff --git a/interfaces/cython/cantera/onedim.py b/interfaces/cython/cantera/onedim.py index 6766af21c..8147c9e37 100644 --- a/interfaces/cython/cantera/onedim.py +++ b/interfaces/cython/cantera/onedim.py @@ -543,7 +543,7 @@ class IonFlame(FreeFlame): @property def poisson_enabled(self): - """ Get/Set whether or not to solve the energy equation.""" + """ Get/Set whether or not to solve the Poisson's equation.""" return self.flame.poisson_enabled @poisson_enabled.setter @@ -552,7 +552,7 @@ class IonFlame(FreeFlame): @property def velocity_enabled(self): - """ Get/Set whether or not to solve the energy equation.""" + """ Get/Set whether or not to solve the velocity.""" return self.flame.velocity_enabled @velocity_enabled.setter diff --git a/interfaces/cython/cantera/test/test_onedim.py b/interfaces/cython/cantera/test/test_onedim.py index 20caba67b..8d21ae8b8 100644 --- a/interfaces/cython/cantera/test/test_onedim.py +++ b/interfaces/cython/cantera/test/test_onedim.py @@ -870,23 +870,15 @@ class TestIonFlame(utilities.CanteraTest): # stage one self.sim.solve(loglevel=0, auto=True) - T1 = self.sim.T[-1] # stage two self.sim.solve(loglevel=0, stage=2, enable_energy=False) # stage two self.sim.solve(loglevel=0, stage=2, enable_energy=True) - Electron2 = self.sim.value(self.sim.flame, 'E', self.sim.flame.n_points-1) #stage three self.sim.solve(loglevel=0, stage=3, enable_energy=True) - Electron3 = self.sim.value(self.sim.flame, 'E', self.sim.flame.n_points-1) - T3 = self.sim.T[-1] - # check Temperature at outlet - self.assertNear(T1, T3, 1e-3) - self.assertNotEqual(T1, T3) - # check Electron concentration at outlet - self.assertNear(Electron2, Electron3, 1e-13) - self.assertNotEqual(Electron2, Electron3) + # Regression test + self.assertNear(min(self.sim.E) / max(self.sim.E), -5.0765, 1e-3)