def test_ion_profile(self): reactants = 'CH4:0.216, O2:2' p = ct.one_atm Tin = 300 width = 0.03 # IdealGasMix object used to compute mixture properties self.gas = ct.Solution('ch4_ion.cti') self.gas.TPX = Tin, p, reactants self.sim = ct.IonFlame(self.gas, width=width) self.sim.set_refine_criteria(ratio=4, slope=0.8, curve=1.0) # stage one self.sim.solve(loglevel=0, auto=True) # stage two self.sim.solve(loglevel=0, stage=2, enable_energy=False) # stage two self.sim.solve(loglevel=0, stage=2, enable_energy=True) #stage three self.sim.solve(loglevel=0, stage=3, enable_energy=True) # Regression test self.assertNear(min(self.sim.E) / max(self.sim.E), -5.0765, 1e-3)
def test_ion_profile(self): reactants = 'CH4:0.216, O2:2' p = ct.one_atm Tin = 300 width = 0.03 # IdealGasMix object used to compute mixture properties self.gas = ct.Solution('ch4_ion.cti') self.gas.TPX = Tin, p, reactants self.sim = ct.IonFlame(self.gas, width=width) self.sim.set_refine_criteria(ratio=4, slope=0.8, curve=1.0) # Ionized species may require tighter absolute tolerances self.sim.flame.set_steady_tolerances(Y=(1e-4, 1e-12)) self.sim.transport_model = 'Ion' # stage one self.sim.solve(loglevel=0, auto=True) #stage two self.sim.solve(loglevel=0, stage=2, enable_energy=True) # Regression test self.assertNear(max(self.sim.E), 131.9956, 1e-3)
import numpy as np # Simulation parameters p = ct.one_atm # pressure [Pa] Tin = 300.0 # unburned gas temperature [K] reactants = 'CH4:1, O2:2, N2:7.52' # premixed gas composition width = 0.05 # m loglevel = 1 # amount of diagnostic output (0 to 8) # IdealGasMix object used to compute mixture properties, set to the state of the # upstream fuel-air mixture gas = ct.Solution('gri30_ion.xml') gas.TPX = Tin, p, reactants # Set up flame object f = ct.IonFlame(gas, width=width) f.set_refine_criteria(ratio=3, slope=0.06, curve=0.12) f.show_solution() # stage one f.solve(loglevel=loglevel, auto=True) # stage two f.solve(loglevel=loglevel, stage=2, enable_energy=False) f.solve(loglevel=loglevel, stage=2, enable_energy=True) # stage three f.solve(loglevel=loglevel, stage=3, enable_energy=True) f.save('CH4_adiabatic.xml', 'mix', 'solution with mixture-averaged transport') f.show_solution()