[1D] Provide reasonable default grid for CounterflowDiffusionFlame

This commit is contained in:
Ray Speth 2016-03-13 23:55:20 -04:00
parent 87a8419380
commit 8e81292558
6 changed files with 19 additions and 15 deletions

View file

@ -21,7 +21,7 @@ BurnerFlame
CounterflowDiffusionFlame
^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: CounterflowDiffusionFlame(gas, grid=None)
.. autoclass:: CounterflowDiffusionFlame(gas, grid=None, width=None)
CounterflowPremixedFlame
^^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -16,9 +16,7 @@ mdot_f = 0.24 # kg/m^2/s
comp_o = 'O2:0.21, N2:0.78, AR:0.01' # air composition
comp_f = 'C2H6:1' # fuel composition
# Distance between inlets is 2 cm.
# Start with an evenly-spaced 6-point grid.
initial_grid = np.linspace(0, 0.02, 6)
width = 0.02 # Distance between inlets is 2 cm
tol_ss = [1.0e-5, 1.0e-12] # [rtol, atol] for steady-state problem
tol_ts = [5.0e-4, 1.0e-11] # [rtol, atol] for time stepping
@ -34,7 +32,7 @@ gas.TP = gas.T, p
# Create an object representing the counterflow flame configuration,
# which consists of a fuel inlet on the left, the flow in the middle,
# and the oxidizer inlet on the right.
f = ct.CounterflowDiffusionFlame(gas, initial_grid)
f = ct.CounterflowDiffusionFlame(gas, width=width)
# Set the state of the two inlets
f.fuel_inlet.mdot = mdot_f

View file

@ -36,11 +36,10 @@ refine = True
# Set up an initial hydrogen-oxygen counterflow flame at 1 bar and low strain
# rate (maximum axial velocity gradient = 2414 1/s)
# Initial grid: 18mm wide, 21 points
reaction_mechanism = 'h2o2.xml'
gas = ct.Solution(reaction_mechanism)
initial_grid = np.linspace(0.0, 18e-3, 21)
f = ct.CounterflowDiffusionFlame(gas, initial_grid)
width = 18e-3 # 18mm wide
f = ct.CounterflowDiffusionFlame(gas, width=width)
# Define the operating pressure and boundary conditions
f.P = 1.e5 # 1 bar

View file

@ -29,11 +29,10 @@ if not os.path.exists(data_directory):
# Set up an initial hydrogen-oxygen counterflow flame at 1 bar and low strain
# rate (maximum axial velocity gradient = 2414 1/s)
# Initial grid: 18mm wide, 21 points
reaction_mechanism = 'h2o2.xml'
gas = ct.Solution(reaction_mechanism)
initial_grid = np.linspace(0.0, 18.e-3, 21)
f = ct.CounterflowDiffusionFlame(gas, initial_grid)
width = 18.e-3 # 18mm wide
f = ct.CounterflowDiffusionFlame(gas, width=width)
# Define the operating pressure and boundary conditions
f.P = 1.e5 # 1 bar

View file

@ -506,13 +506,18 @@ class CounterflowDiffusionFlame(FlameBase):
""" A counterflow diffusion flame """
__slots__ = ('fuel_inlet', 'flame', 'oxidizer_inlet')
def __init__(self, gas, grid=None):
def __init__(self, gas, grid=None, width=None):
"""
:param gas:
`Solution` (using the IdealGas thermodynamic model) used to
evaluate all gas properties and reaction rates.
:param grid:
Array of initial grid points
A list of points to be used as the initial grid. Not recommended
unless solving only on a fixed grid; Use the `width` parameter
instead.
:param width:
Defines a grid on the interval [0, width] with internal points
determined automatically by the solver.
A domain of class `AxisymmetricStagnationFlow` named ``flame`` will
be created to represent the flame. The three domains comprising the
@ -527,6 +532,9 @@ class CounterflowDiffusionFlame(FlameBase):
self.flame = AxisymmetricStagnationFlow(gas, name='flame')
if width is not None:
grid = np.array([0.0, 0.2, 0.4, 0.6, 0.8, 1.0]) * width
super(CounterflowDiffusionFlame, self).__init__(
(self.fuel_inlet, self.flame, self.oxidizer_inlet), gas, grid)

View file

@ -387,7 +387,7 @@ class TestDiffusionFlame(utilities.CanteraTest):
def create_sim(self, p, fuel='H2:1.0, AR:1.0', T_fuel=300, mdot_fuel=0.24,
oxidizer='O2:0.2, AR:0.8', T_ox=300, mdot_ox=0.72):
initial_grid = np.linspace(0, 0.02, 6) # m
width = 0.02 # m
tol_ss = [2.0e-5, 1.0e-11] # [rtol, atol] for steady-state problem
tol_ts = [5.0e-4, 1.0e-11] # [rtol, atol] for time stepping
@ -396,7 +396,7 @@ class TestDiffusionFlame(utilities.CanteraTest):
self.gas.TP = T_fuel, p
# Flame object
self.sim = ct.CounterflowDiffusionFlame(self.gas, initial_grid)
self.sim = ct.CounterflowDiffusionFlame(self.gas, width=width)
self.sim.flame.set_steady_tolerances(default=tol_ss)
self.sim.flame.set_transient_tolerances(default=tol_ts)