# set the properties at the burner f.burner.set(massflux=mdot, mole_fractions=comp, temperature=tburner) f.set(tol=tol_ss, tol_time=tol_ts) f.setMaxJacAge(5, 10) f.set(energy='off') f.init() f.showSolution() f.solve(loglevel, refine_grid) f.setRefineCriteria(ratio=200.0, slope=0.0502, curve=0.1) f.set(energy='on') f.solve(loglevel, refine_grid) f.save('flame1.xml') f.showSolution() # write the velocity, temperature, and mole fractions to a CSV file z = f.flame.grid() T = f.T() u = f.u() V = f.V() fcsv = open('flame1.csv', 'w') writeCSV(fcsv, ['z (m)', 'u (m/s)', 'V (1/s)', 'T (K)', 'rho (kg/m3)'] + list(gas.speciesNames())) for n in range(f.flame.nPoints()): f.setGasState(n) writeCSV(fcsv, [z[n], u[n], V[n], T[n], gas.density()] + list(gas.moleFractions()))
f.set(tol=tol_ss, tol_time=tol_ts) # show the initial estimate for the solution f.showSolution() # don't solve the energy equation f.set(energy='off') # first solve the flame with mixture-averaged transport properties f.setRefineCriteria(ratio=3.0, slope=0.3, curve=1) f.setMaxJacAge(50, 50) f.setTimeStep(1.0e-5, [1, 2, 5, 10, 20]) f.solve(loglevel, refine_grid) f.save('ch4_flame_fixed_T.xml', 'mixav', 'solution with mixture-averaged transport') print '\n\n switching to multicomponent transport...\n\n' gas.switchTransportModel('Multi') f.flame.setTransportModel(gas) f.setRefineCriteria(ratio=3.0, slope=0.1, curve=0.2) f.solve(loglevel, refine_grid) f.save('ch4_flame_fixed_T.xml', 'multi', 'solution with multicomponent transport') # write the velocity, temperature, density, and mole fractions to a CSV file z = f.flame.grid() T = f.T() u = f.u() V = f.V()
f = BurnerFlame(gas=gas, grid=initial_grid) # set the properties at the burner f.burner.set(massflux=mdot, mole_fractions=comp, temperature=tburner) f.set(tol=tol_ss, tol_time=tol_ts) f.showSolution() f.set(energy='off') f.setRefineCriteria(ratio=10.0, slope=1, curve=1) f.setMaxJacAge(50, 50) f.setTimeStep(1.0e-5, [1, 2, 5, 10, 20]) f.solve(loglevel, refine_grid) f.save('ch4_flame1.xml', 'no_energy', 'solution with the energy equation disabled') f.set(energy='on') f.setRefineCriteria(ratio=3.0, slope=0.1, curve=0.2) f.solve(loglevel, refine_grid) f.save('ch4_flame1.xml', 'energy', 'solution with the energy equation enabled') gas.switchTransportModel('Multi') f.flame.setTransportModel(gas) f.solve(loglevel, refine_grid) f.save( 'ch4_flame1.xml', 'energy_multi', 'solution with the energy equation enabled and multicomponent transport') f.flame.enableSoret() f.solve(loglevel, refine_grid) f.save(
# set the properties at the burner f.burner.set(massflux = mdot, mole_fractions = comp, temperature = tburner) f.set(tol = tol_ss, tol_time = tol_ts) f.setMaxJacAge(5, 10) f.set(energy = 'off') f.init() f.showSolution() f.solve(loglevel, refine_grid) f.setRefineCriteria(ratio = 200.0, slope = 0.0502, curve = 0.1) f.set(energy = 'on') f.solve(loglevel,refine_grid) f.save('flame1.xml') f.showSolution() # write the velocity, temperature, and mole fractions to a CSV file z = f.flame.grid() T = f.T() u = f.u() V = f.V() fcsv = open('flame1.csv','w') writeCSV(fcsv, ['z (m)', 'u (m/s)', 'V (1/s)', 'T (K)', 'rho (kg/m3)'] + list(gas.speciesNames())) for n in range(f.flame.nPoints()): f.setGasState(n) writeCSV(fcsv, [z[n], u[n], V[n], T[n], gas.density()] +list(gas.moleFractions()))
f.set(tol = tol_ss, tol_time = tol_ts) # show the initial estimate for the solution f.showSolution() # don't solve the energy equation f.set(energy = 'off') # first solve the flame with mixture-averaged transport properties f.setRefineCriteria(ratio = 3.0, slope = 0.3, curve = 1) f.setMaxJacAge(50, 50) f.setTimeStep(1.0e-5, [1, 2, 5, 10, 20]) f.solve(loglevel, refine_grid) f.save('ch4_flame_fixed_T.xml','mixav', 'solution with mixture-averaged transport') print '\n\n switching to multicomponent transport...\n\n' gas.switchTransportModel('Multi') f.flame.setTransportModel(gas) f.setRefineCriteria(ratio = 3.0, slope = 0.1, curve = 0.2) f.solve(loglevel, refine_grid) f.save('ch4_flame_fixed_T.xml','multi', 'solution with multicomponent transport') # write the velocity, temperature, density, and mole fractions to a CSV file z = f.flame.grid() T = f.T() u = f.u() V = f.V()
f = BurnerFlame(gas = gas, grid = initial_grid) # set the properties at the burner f.burner.set(massflux = mdot, mole_fractions = comp, temperature = tburner) f.set(tol = tol_ss, tol_time = tol_ts) f.showSolution() f.set(energy = 'off') f.setRefineCriteria(ratio = 10.0, slope = 1, curve = 1) f.setMaxJacAge(50, 50) f.setTimeStep(1.0e-5, [1, 2, 5, 10, 20]) f.solve(loglevel, refine_grid) f.save('ch4_flame1.xml','no_energy', 'solution with the energy equation disabled') f.set(energy = 'on') f.setRefineCriteria(ratio = 3.0, slope = 0.1, curve = 0.2) f.solve(loglevel, refine_grid) f.save('ch4_flame1.xml','energy', 'solution with the energy equation enabled') gas.switchTransportModel('Multi') f.flame.setTransportModel(gas) f.solve(loglevel, refine_grid) f.save('ch4_flame1.xml','energy_multi', 'solution with the energy equation enabled and multicomponent transport') f.flame.enableSoret() f.solve(loglevel, refine_grid) f.save('ch4_flame1.xml','energy_multi_soret',