def run_reacting_surface(self, xch4, tsurf, mdot, width): # Simplified version of the example 'catalytic_combustion.py' gas = ct.Solution('ptcombust-simple.cti', 'gas') surf_phase = ct.Interface('ptcombust-simple.cti', 'Pt_surf', [gas]) tinlet = 300.0 # inlet temperature comp = {'CH4': xch4, 'O2': 0.21, 'N2': 0.79} gas.TPX = tinlet, ct.one_atm, comp surf_phase.TP = tsurf, ct.one_atm # integrate the coverage equations holding the gas composition fixed # to generate a good starting estimate for the coverages. surf_phase.advance_coverages(1.) sim = ct.ImpingingJet(gas=gas, width=width, surface=surf_phase) sim.set_refine_criteria(10.0, 0.3, 0.4, 0.0) sim.inlet.mdot = mdot sim.inlet.T = tinlet sim.inlet.X = comp sim.surface.T = tsurf sim.solve(loglevel=0, auto=True) self.assertTrue(all(np.diff(sim.T) > 0)) self.assertTrue(all(np.diff(sim.Y[gas.species_index('CH4')]) < 0)) self.assertTrue(all(np.diff(sim.Y[gas.species_index('CO2')]) > 0))
def test_save_restore(self): comp = {'CH4': 0.095, 'O2': 0.21, 'N2': 0.79} self.sim = self.create_reacting_surface(comp, tsurf=900, tinlet=300, width=0.1) self.sim.inlet.mdot = 0.06 self.sim.inlet.T = 300 self.sim.inlet.X = comp self.sim.surface.T = 900 self.sim.solve(loglevel=0, auto=False) filename = self.test_work_path / "impingingjet1.yaml" self.sim.save(filename) self.surf_phase.TPX = 300, ct.one_atm, "PT(S):1" sim2 = ct.ImpingingJet(gas=self.gas, width=0.12, surface=self.surf_phase) sim2.restore(filename) self.assertArrayNear(self.sim.grid, sim2.grid) self.assertArrayNear(self.sim.Y, sim2.Y) for i in range(self.sim.surface.n_components): self.assertNear( self.sim.value("surface", i, 0), sim2.value("surface", i, 0) )
def create_reacting_surface(self, comp, tsurf, tinlet, width): gas = ct.Solution('ptcombust-simple.cti', 'gas') surf_phase = ct.Interface('ptcombust-simple.cti', 'Pt_surf', [gas]) gas.TPX = tinlet, ct.one_atm, comp surf_phase.TP = tsurf, ct.one_atm # integrate the coverage equations holding the gas composition fixed # to generate a good starting estimate for the coverages. surf_phase.advance_coverages(1.) return ct.ImpingingJet(gas=gas, width=width, surface=surf_phase)
def create_reacting_surface(self, comp, tsurf, tinlet, width): self.gas = ct.Solution("ptcombust-simple.yaml", "gas") self.surf_phase = ct.Interface("ptcombust-simple.yaml", "Pt_surf", [self.gas]) self.gas.TPX = tinlet, ct.one_atm, comp self.surf_phase.TP = tsurf, ct.one_atm # integrate the coverage equations holding the gas composition fixed # to generate a good starting estimate for the coverages. self.surf_phase.advance_coverages(1.) return ct.ImpingingJet(gas=self.gas, width=width, surface=self.surf_phase)
# Grid refinement parameters ratio = 3 slope = 0.1 curve = 0.2 prune = 0.06 # Set up the problem gas = ct.Solution(rxnmech) # set state to that of the unburned gas at the burner gas.TPX = tburner, p, comp # Create the stagnation flow object with a non-reactive surface. (To make the # surface reactive, supply a surface reaction mechanism. See example # catalytic_combustion.py for how to do this.) sim = ct.ImpingingJet(gas=gas, width=width) # set the mass flow rate at the inlet sim.inlet.mdot = mdot[0] # set the surface state sim.surface.T = tsurf sim.set_grid_min(1e-4) sim.set_refine_criteria(ratio=ratio, slope=slope, curve=curve, prune=prune) sim.set_initial_guess( products='equil') # assume adiabatic equilibrium products sim.show_solution() sim.solve(loglevel, auto=True)
# # This phase definition also references the phase 'gas' in the same input file, # which will be created and used to evaluate all thermodynamic, kinetic, and # transport properties. It is a stripped-down version of GRI-Mech 3.0. surf_phase = ct.Interface("ptcombust.yaml", "Pt_surf") surf_phase.TP = tsurf, p gas = surf_phase.adjacent["gas"] gas.TPX = tinlet, p, comp1 # integrate the coverage equations in time for 1 s, holding the gas # composition fixed to generate a good starting estimate for the coverages. surf_phase.advance_coverages(1.0) # create the object that simulates the stagnation flow, and specify an initial # grid sim = ct.ImpingingJet(gas=gas, width=width, surface=surf_phase) # Objects of class ImpingingJet have members that represent the gas inlet # ('inlet') and the surface ('surface'). Set some parameters of these objects. sim.inlet.mdot = mdot sim.inlet.T = tinlet sim.inlet.X = comp1 sim.surface.T = tsurf # Show the initial solution estimate sim.show_solution() # Solving problems with stiff chemistry coupled to flow can require a # sequential approach where solutions are first obtained for simpler problems # and used as the initial guess for more difficult problems.
# Grid refinement parameters ratio = 3 slope = 0.1 curve = 0.2 prune = 0.06 # Set up the problem gas = ct.Solution(rxnmech) # set state to that of the unburned gas at the burner gas.TPX = tburner, p, comp # Create the stagnation flow object with a non-reactive surface. (To make the # surface reactive, supply a surface reaction mechanism. See example # catalytic_combustion.py for how to do this.) sim = ct.ImpingingJet(gas=gas, grid=initial_grid) # set the mass flow rate at the inlet sim.inlet.mdot = mdot[0] # set the surface state sim.surface.T = tsurf sim.flame.set_steady_tolerances(default=tol_ss) sim.flame.set_transient_tolerances(default=tol_ts) sim.set_grid_min(1e-4) sim.energy_enabled = False sim.set_initial_guess( products='equil') # assume adiabatic equilibrium products sim.show_solution()
# # This object will be used to evaluate all surface chemical production rates. # It will be created from the interface definition 'Pt_surf' in input file # 'ptcombust.cti,' which implements the reaction mechanism of Deutschmann et # al., 1995 for catalytic combustion on platinum. # surf_phase = ct.Interface('ptcombust.cti', 'Pt_surf', [gas]) surf_phase.TP = tsurf, p # integrate the coverage equations in time for 1 s, holding the gas # composition fixed to generate a good starting estimate for the coverages. surf_phase.advance_coverages(1.0) # create the object that simulates the stagnation flow, and specify an initial # grid sim = ct.ImpingingJet(gas=gas, grid=initial_grid, surface=surf_phase) # Objects of class StagnationFlow have members that represent the gas inlet # ('inlet') and the surface ('surface'). Set some parameters of these objects. sim.inlet.mdot = mdot sim.inlet.T = tinlet sim.inlet.X = comp1 sim.surface.T = tsurf # Set error tolerances sim.flame.set_steady_tolerances(default=tol_ss) sim.flame.set_transient_tolerances(default=tol_ts) # Show the initial solution estimate sim.show_solution()