From eca79a533280033af262aa4ca601c04f42e1889c Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Sat, 28 Feb 2015 00:24:32 +0000 Subject: [PATCH] [Examples/1D] Use uniform initial grids in flame simulation examples --- .../cython/cantera/examples/onedim/adiabatic_flame.py | 3 ++- interfaces/cython/cantera/examples/onedim/burner_flame.py | 4 ++-- .../cython/cantera/examples/onedim/flame_fixed_T.py | 8 +++----- .../cantera/examples/onedim/flamespeed_sensitivity.py | 3 ++- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/interfaces/cython/cantera/examples/onedim/adiabatic_flame.py b/interfaces/cython/cantera/examples/onedim/adiabatic_flame.py index 27c614d61..2662f4a54 100644 --- a/interfaces/cython/cantera/examples/onedim/adiabatic_flame.py +++ b/interfaces/cython/cantera/examples/onedim/adiabatic_flame.py @@ -4,13 +4,14 @@ transport properties. """ import cantera as ct +import numpy as np # Simulation parameters p = ct.one_atm # pressure [Pa] Tin = 300.0 # unburned gas temperature [K] reactants = 'H2:1.1, O2:1, AR:5' # premixed gas composition -initial_grid = [0.0, 0.001, 0.01, 0.02, 0.029, 0.03] # m +initial_grid = np.linspace(0.0, 0.03, 7) # m tol_ss = [1.0e-5, 1.0e-13] # [rtol atol] for steady-state problem tol_ts = [1.0e-4, 1.0e-13] # [rtol atol] for time stepping loglevel = 1 # amount of diagnostic output (0 to 8) diff --git a/interfaces/cython/cantera/examples/onedim/burner_flame.py b/interfaces/cython/cantera/examples/onedim/burner_flame.py index e7fccc253..6b3eb2c26 100644 --- a/interfaces/cython/cantera/examples/onedim/burner_flame.py +++ b/interfaces/cython/cantera/examples/onedim/burner_flame.py @@ -3,14 +3,14 @@ A burner-stabilized lean premixed hydrogen-oxygen flame at low pressure. """ import cantera as ct +import numpy as np p = 0.05 * ct.one_atm tburner = 373.0 mdot = 0.06 reactants = 'H2:1.5, O2:1, AR:7' # premixed gas composition -initial_grid = [0.0, 0.02, 0.04, 0.06, 0.08, 0.1, - 0.15, 0.2, 0.4, 0.49, 0.5] # m +initial_grid = np.linspace(0.0, 0.5, 10) # m tol_ss = [1.0e-5, 1.0e-13] # [rtol atol] for steady-state problem tol_ts = [1.0e-4, 1.0e-10] # [rtol atol] for time stepping loglevel = 1 # amount of diagnostic output (0 to 5) diff --git a/interfaces/cython/cantera/examples/onedim/flame_fixed_T.py b/interfaces/cython/cantera/examples/onedim/flame_fixed_T.py index 58e370179..9588473c9 100644 --- a/interfaces/cython/cantera/examples/onedim/flame_fixed_T.py +++ b/interfaces/cython/cantera/examples/onedim/flame_fixed_T.py @@ -4,7 +4,7 @@ multicomponent transport properties and a specified temperature profile. """ import cantera as ct - +import numpy as np # read temperature vs. position data from a file. # The file is assumed to have one z, T pair per line, separated by a comma. @@ -50,10 +50,8 @@ tburner = 373.7 # burner temperature mdot = 0.04 # kg/m^2/s comp = 'CH4:0.65, O2:1, N2:3.76' # premixed gas composition -# The solution domain is chosen to be 1 cm, and a point very near the -# downstream boundary is added to help with the zero-gradient boundary -# condition at this boundary. -initial_grid = [0.0, 0.0025, 0.005, 0.0075, 0.0099, 0.01] # m +# The solution domain is chosen to be 1 cm +initial_grid = np.linspace(0.0, 0.01, 6) # m tol_ss = [1.0e-5, 1.0e-9] # [rtol atol] for steady-state problem tol_ts = [1.0e-5, 1.0e-4] # [rtol atol] for time stepping diff --git a/interfaces/cython/cantera/examples/onedim/flamespeed_sensitivity.py b/interfaces/cython/cantera/examples/onedim/flamespeed_sensitivity.py index 5989616be..ae222760d 100644 --- a/interfaces/cython/cantera/examples/onedim/flamespeed_sensitivity.py +++ b/interfaces/cython/cantera/examples/onedim/flamespeed_sensitivity.py @@ -7,13 +7,14 @@ to each reaction rate constant. from __future__ import print_function import cantera as ct +import numpy as np # Simulation parameters p = ct.one_atm # pressure [Pa] Tin = 300.0 # unburned gas temperature [K] reactants = 'CH4:0.45, O2:1.0, N2:3.76' -initial_grid = [0.0, 0.01, 0.02, 0.03] # m +initial_grid = np.linspace(0, 0.03, 5) # m tol_ss = [1.0e-9, 1.0e-14] # [rtol atol] for steady-state problem tol_ts = [1.0e-5, 1.0e-14] # [rtol atol] for time stepping