[Python/1D] Use initial gas composition as state of flame inlet
This eliminates the need to set the inlet temperature and composition explicitly for configurations where only one composition needs to be specified (i.e. all premixed configurations).
This commit is contained in:
parent
14b2e8f5cf
commit
27726c3072
7 changed files with 20 additions and 24 deletions
|
|
@ -17,7 +17,8 @@ tol_ts = [1.0e-4, 1.0e-13] # [rtol atol] for time stepping
|
|||
loglevel = 1 # amount of diagnostic output (0 to 8)
|
||||
refine_grid = True # 'True' to enable refinement, 'False' to disable
|
||||
|
||||
# IdealGasMix object used to compute mixture properties
|
||||
# IdealGasMix object used to compute mixture properties, set to the state of the
|
||||
# upstream fuel-air mixture
|
||||
gas = ct.Solution('h2o2.xml')
|
||||
gas.TPX = Tin, p, reactants
|
||||
|
||||
|
|
@ -26,10 +27,6 @@ f = ct.FreeFlame(gas, initial_grid)
|
|||
f.flame.set_steady_tolerances(default=tol_ss)
|
||||
f.flame.set_transient_tolerances(default=tol_ts)
|
||||
|
||||
# Set properties of the upstream fuel-air mixture
|
||||
f.inlet.T = Tin
|
||||
f.inlet.X = reactants
|
||||
|
||||
f.show_solution()
|
||||
|
||||
# Solve with the energy equation disabled
|
||||
|
|
|
|||
|
|
@ -20,9 +20,6 @@ gas = ct.Solution('h2o2.xml')
|
|||
gas.TPX = tburner, p, reactants
|
||||
|
||||
f = ct.BurnerFlame(gas, initial_grid)
|
||||
|
||||
f.burner.T = tburner
|
||||
f.burner.X = reactants
|
||||
f.burner.mdot = mdot
|
||||
|
||||
f.set_initial_guess()
|
||||
|
|
|
|||
|
|
@ -72,10 +72,8 @@ gas.TPX = tburner, p, comp
|
|||
# create the BurnerFlame object.
|
||||
f = ct.BurnerFlame(gas=gas, grid=initial_grid)
|
||||
|
||||
# set the properties at the burner
|
||||
# set the mass flow rate at the burner
|
||||
f.burner.mdot = mdot
|
||||
f.burner.X = comp
|
||||
f.burner.T = tburner
|
||||
|
||||
# read in the fixed temperature profile
|
||||
[zloc, tvalues] = getTempData('tdata.dat')
|
||||
|
|
|
|||
|
|
@ -27,10 +27,6 @@ f = ct.FreeFlame(gas, initial_grid)
|
|||
f.flame.set_steady_tolerances(default=tol_ss)
|
||||
f.flame.set_transient_tolerances(default=tol_ts)
|
||||
|
||||
# Set properties of the upstream fuel-air mixture
|
||||
f.inlet.T = Tin
|
||||
f.inlet.X = reactants
|
||||
|
||||
# Solve with the energy equation disabled
|
||||
f.energy_enabled = False
|
||||
f.set_max_jac_age(10, 10)
|
||||
|
|
|
|||
|
|
@ -37,11 +37,8 @@ gas.TPX = T_in, p, comp
|
|||
# Create the flame simulation object
|
||||
sim = ct.CounterflowPremixedFlame(gas=gas, grid=initial_grid)
|
||||
|
||||
# set the properties at the inlet
|
||||
# set the boundary flow rates
|
||||
sim.reactants.mdot = mdot_reactants
|
||||
sim.reactants.X = comp
|
||||
sim.reactants.T = T_in
|
||||
|
||||
sim.products.mdot = mdot_products
|
||||
|
||||
sim.flame.set_steady_tolerances(default=tol_ss)
|
||||
|
|
|
|||
|
|
@ -58,10 +58,8 @@ gas.TPX = tburner, p, comp
|
|||
# catalytic_combustion.py for how to do this.)
|
||||
sim = ct.ImpingingJet(gas=gas, grid=initial_grid)
|
||||
|
||||
# set the properties at the inlet
|
||||
# set the mass flow rate at the inlet
|
||||
sim.inlet.mdot = mdot[0]
|
||||
sim.inlet.X = comp
|
||||
sim.inlet.T = tburner
|
||||
|
||||
# set the surface state
|
||||
sim.surface.T = tsurf
|
||||
|
|
|
|||
|
|
@ -375,6 +375,10 @@ class FreeFlame(FlameBase):
|
|||
super(FreeFlame, self).__init__((self.inlet, self.flame, self.outlet),
|
||||
gas, grid)
|
||||
|
||||
# Setting X needs to be deferred until linked to the flow domain
|
||||
self.inlet.T = gas.T
|
||||
self.inlet.X = gas.X
|
||||
|
||||
def set_initial_guess(self):
|
||||
"""
|
||||
Set the initial guess for the solution. The adiabatic flame
|
||||
|
|
@ -422,13 +426,16 @@ class BurnerFlame(FlameBase):
|
|||
``self.outlet``.
|
||||
"""
|
||||
self.burner = Inlet1D(name='burner', phase=gas)
|
||||
self.burner.T = gas.T
|
||||
self.outlet = Outlet1D(name='outlet', phase=gas)
|
||||
self.flame = AxisymmetricStagnationFlow(gas, name='flame')
|
||||
|
||||
super(BurnerFlame, self).__init__((self.burner, self.flame, self.outlet),
|
||||
gas, grid)
|
||||
|
||||
# Setting X needs to be deferred until linked to the flow domain
|
||||
self.burner.T = gas.T
|
||||
self.burner.X = gas.X
|
||||
|
||||
def set_initial_guess(self):
|
||||
"""
|
||||
Set the initial guess for the solution. The adiabatic flame
|
||||
|
|
@ -744,7 +751,6 @@ class ImpingingJet(FlameBase):
|
|||
are stored as ``self.inlet``, ``self.flame``, and ``self.surface``.
|
||||
"""
|
||||
self.inlet = Inlet1D(name='inlet', phase=gas)
|
||||
self.inlet.T = gas.T
|
||||
self.flame = AxisymmetricStagnationFlow(gas, name='flame')
|
||||
|
||||
if surface is None:
|
||||
|
|
@ -758,6 +764,10 @@ class ImpingingJet(FlameBase):
|
|||
super(ImpingingJet, self).__init__(
|
||||
(self.inlet, self.flame, self.surface), gas, grid)
|
||||
|
||||
# Setting X needs to be deferred until linked to the flow domain
|
||||
self.inlet.T = gas.T
|
||||
self.inlet.X = gas.X
|
||||
|
||||
def set_initial_guess(self, products='inlet'):
|
||||
"""
|
||||
Set the initial guess for the solution. If products = 'equil', then
|
||||
|
|
@ -821,6 +831,9 @@ class CounterflowPremixedFlame(FlameBase):
|
|||
super(CounterflowPremixedFlame, self).__init__(
|
||||
(self.reactants, self.flame, self.products), gas, grid)
|
||||
|
||||
# Setting X needs to be deferred until linked to the flow domain
|
||||
self.reactants.X = gas.X
|
||||
|
||||
def set_initial_guess(self, equilibrate=True):
|
||||
"""
|
||||
Set the initial guess for the solution.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue