Created
April 12, 2017 23:13
-
-
Save speth/a56344e14cc6d884a791506db844368a to your computer and use it in GitHub Desktop.
faster IonFlow test case
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
units(length='cm', time='s', quantity='mol', act_energy='cal/mol') | |
ideal_gas(name='gas', | |
elements='O H C N E', | |
species=['''gri30: H2 H O O2 OH H2O HO2 | |
H2O2 C CH CH2 CH2(S) CH3 CH4 | |
CO CO2 HCO CH2O CH3O N2''', | |
'HCO+ H3O+ E'], | |
reactions=['gri30: all', 'all'], | |
transport='Mix', | |
options=['skip_undeclared_species', 'skip_undeclared_third_bodies'], | |
initial_state=state(temperature=300.0, pressure=OneAtm)) | |
#------------------------------------------------------------------------------- | |
# Species data | |
#------------------------------------------------------------------------------- | |
species(name = 'HCO+', | |
atoms = ' H:1 C:1 O:1 E:-1 ', | |
thermo = ( | |
NASA( [ 300.00, 1000.00], [ 2.473973600E+00, 8.671559000E-03, | |
-1.003150000E-05, 6.717052700E-09, -1.787267400E-12, | |
9.914660800E+04, 8.175711870E+00] ), | |
NASA( [ 1000.00, 5000.00], [ 3.741188000E+00, 3.344151700E-03, | |
-1.239712100E-06, 2.118938800E-10, -1.370415000E-14, | |
9.888407800E+04, 2.078613570E+00] ) | |
), | |
transport=gas_transport(geom='linear', | |
diam=3.59, | |
well_depth=498.0, | |
polar=2.5, | |
rot_relax=0.0), | |
note = 'J12/70') | |
species(name = 'H3O+', | |
atoms = ' H:3 O:1 E:-1 ', | |
thermo = ( | |
NASA( [ 298.15, 1000.00], [ 3.792952700E+00, -9.108540000E-04, | |
1.163635490E-05, -1.213648870E-08, 4.261596630E-12, | |
7.075124010E+04, 1.471568560E+00] ), | |
NASA( [ 1000.00, 6000.00], [ 2.496477160E+00, 5.728449200E-03, | |
-1.839532810E-06, 2.735774390E-10, -1.540939850E-14, | |
7.097291130E+04, 7.458507790E+00] ) | |
), | |
transport=gas_transport(geom='nonlinear', | |
diam=2.605, | |
well_depth=572.4, | |
dipole=1.844, | |
polar=1.5, | |
rot_relax=2.1), | |
note = 'TPIS89') | |
species(name = 'E', | |
atoms = ' E:1 ', | |
thermo = ( | |
NASA( [ 200.00, 1000.00], [ 2.500000000E+00, 0.000000000E+00, | |
0.000000000E+00, 0.000000000E+00, 0.000000000E+00, | |
-7.453750000E+02, -1.172469020E+01] ), | |
NASA( [ 1000.00, 6000.00], [ 2.500000000E+00, 0.000000000E+00, | |
0.000000000E+00, 0.000000000E+00, 0.000000000E+00, | |
-7.453750000E+02, -1.172469020E+01] ) | |
), | |
transport=gas_transport(geom='atom', | |
diam=2.05, | |
well_depth=145.0, | |
polar=0.667, | |
rot_relax=0.0), | |
note = 'gas L10/92') | |
#------------------------------------------------------------------------------- | |
# Reaction data | |
#------------------------------------------------------------------------------- | |
reaction('CH + O => HCO+ + E', [2.51E+11, 0.0, 1700]) | |
reaction('HCO+ + H2O => H3O+ + CO', [1.51E+15, 0.0, 0.0]) | |
reaction('H3O+ + E => H2O + H', [2.29E+18, -0.5, 0.0]) | |
reaction('H3O+ + E => OH + H + H', [7.95E+21, -1.4, 0.0]) | |
reaction('H3O+ + E => H2 + OH', [1.25E+19, -0.5, 0.0]) | |
reaction('H3O+ + E => O + H2 + H', [6.0E+17, -0.3, 0.0]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cantera as ct | |
import numpy as np | |
# Simulation parameters | |
p = ct.one_atm # pressure [Pa] | |
Tin = 300.0 # unburned gas temperature [K] | |
reactants = 'CH4:0.216, O2:2' # premixed gas composition | |
width = 0.03 # 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('../methane_ion2.cti') | |
gas.TPX = Tin, p, reactants | |
# Set up flame object | |
f = ct.IonFlame(gas, width=width) | |
f.set_refine_criteria(ratio=4, slope=0.8, curve=1.0) | |
# phase one | |
f.solve(loglevel=loglevel, auto=True) | |
f.write_csv('ion0.csv', quiet=False) | |
# phase two | |
f.flame.set_solvingPhase(2) | |
f.energy_enabled = False | |
f.velocity_enabled = False | |
# Solve with Prager's ambipolar diffusion model | |
f.solve(loglevel) | |
f.write_csv('ion1.csv', quiet=False) | |
f.energy_enabled = True | |
f.velocity_enabled = True | |
f.solve(loglevel) | |
f.write_csv('ion2.csv', quiet=False) | |
# phase three | |
f.flame.set_solvingPhase(3) | |
f.poisson_enabled = True | |
# Solve with electric force | |
f.solve(loglevel) | |
f.write_csv('ion3.csv', quiet=False) | |
f.save('CH4_adiabatic.xml', 'mix', 'solution with mixture-averaged transport') | |
print('mixture-averaged flamespeed = {0:7f} m/s'.format(f.u[0])) | |
# write the velocity, temperature, density, and mole fractions to a CSV file | |
f.write_csv('CH4_adiabatic.csv', quiet=False) | |
f.write_electric_csv('CH4_adiabatic_ion.csv', quiet=False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment