Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Commit yaml files #768

Merged
merged 11 commits into from
Jan 7, 2020
45 changes: 5 additions & 40 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -1518,7 +1518,7 @@ cdefine('CT_USE_DEMANGLE', 'has_demangle')
config_h_build = env.Command('build/src/config.h.build',
'include/cantera/base/config.h.in',
ConfigBuilder(configh))
# This separate copy operation, which SCons will skip of config.h.build is
# This separate copy operation, which SCons will skip if config.h.build is
# unmodified, prevents unnecessary rebuilds of the precompiled header
config_h = env.Command('include/cantera/base/config.h',
'build/src/config.h.build',
Expand Down Expand Up @@ -1585,44 +1585,9 @@ for xml in mglob(env, 'data/inputs', 'xml'):
if xml.name not in convertedInputFiles:
build(env.Command(dest, xml.path, Copy('$TARGET', '$SOURCE')))

# Convert input files from Chemkin format to YAML
ck_sources = [
dict(output='gri30.yaml', input='data/inputs/gri30.inp',
thermo='data/thermo/gri30_thermo.dat',
transport='data/transport/gri30_tran.dat',
phase='gri30'),
dict(output='air.yaml', input='data/inputs/air.inp',
transport='data/transport/gri30_tran.dat',
phase='air'),
dict(output='airNASA9.yaml', input='data/inputs/airNASA9.inp',
thermo='data/thermo/airDataNASA9.dat',
phase='airNASA9'),
dict(output='h2o2.yaml', input='data/inputs/h2o2.inp',
transport='data/transport/gri30_tran.dat',
phase='ohmech'),
dict(output='silane.yaml', input='data/inputs/silane.inp')
]

for mech in ck_sources:
convertedInputFiles.add(mech['output'])
cmd = ('$python_cmd_esc interfaces/cython/cantera/ck2yaml.py'
' --quiet --no-validate --input=$SOURCE --output=$TARGET')
if 'thermo' in mech:
cmd += ' --thermo=' + mech['thermo']
if 'transport' in mech:
cmd += ' --transport=' + mech['transport']
if 'phase' in mech:
cmd += ' --name=' + mech['phase']
b = build(env.Command('build/data/{}'.format(mech['output']), mech['input'], cmd))
env.Depends(b, 'interfaces/cython/cantera/ck2yaml.py')

# preprocess input files (cti -> yaml)
for cti in mglob(env, 'data/inputs', 'cti'):
outName = os.path.splitext(cti.name)[0] + '.yaml'
if outName not in convertedInputFiles:
b = build(env.Command('build/data/{}'.format(outName), cti.path,
'$python_cmd_esc interfaces/cython/cantera/cti2yaml.py $SOURCE $TARGET'))
env.Depends(b, 'interfaces/cython/cantera/cti2yaml.py')
for yaml in mglob(env, "data", "yaml"):
dest = pjoin("build", "data", yaml.name)
build(env.Command(dest, yaml.path, Copy("$TARGET", "$SOURCE")))

if addInstallActions:
# Put headers in place
Expand Down Expand Up @@ -1890,7 +1855,7 @@ if any(target.startswith('test') for target in COMMAND_LINE_TARGETS):
test_py_int = env.Command('#build/python_local/cantera/__init__.py',
'#interfaces/python_minimal/cantera/__init__.py',
Copy('$TARGET', '$SOURCE'))
for script in ['ctml_writer', 'ck2cti']:
for script in ['ctml_writer', 'ck2cti', 'ck2yaml', 'ctml2yaml']:
s = env.Command('#build/python_local/cantera/{}.py'.format(script),
'#interfaces/cython/cantera/{}.py'.format(script),
Copy('$TARGET', '$SOURCE'))
Expand Down
81 changes: 81 additions & 0 deletions data/KOH.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
description: |-
A collection of potassium, oxygen, and hydrogen phases. Includes
charged species in addition to neutral species.

generator: cti2yaml
cantera-version: 2.5.0a3
date: Wed, 11 Dec 2019 16:59:04 -0500
input-files: [KOH.cti]

units: {length: cm, quantity: mol, activation-energy: cal/mol}

phases:
- name: KOH_plasma
thermo: ideal-gas
elements: [K, O, H, E]
species:
- nasa_gas.yaml/species: all
skip-undeclared-elements: true
state:
T: 300.0
P: 1.01325e+05
- name: K_solid
thermo: fixed-stoichiometry
elements: [K]
species:
- nasa_condensed.yaml/species: [K(cr)]
density: 0.86 g/cm^3
- name: K_liquid
thermo: fixed-stoichiometry
elements: [K]
species:
- nasa_condensed.yaml/species: [K(L)]
density: 1.0 g/cm^3
- name: KOH_a
thermo: fixed-stoichiometry
elements: [K, O, H]
species:
- nasa_condensed.yaml/species: [KOH(a)]
density: 2.04 g/cm^3
- name: KOH_b
thermo: fixed-stoichiometry
elements: [K, O, H]
species:
- nasa_condensed.yaml/species: [KOH(b)]
density: 1.0 g/cm^3
- name: KOH_liquid
thermo: fixed-stoichiometry
elements: [K, O, H]
species:
- nasa_condensed.yaml/species: [KOH(L)]
density: 1.0 g/cm^3
- name: K2O2_solid
thermo: fixed-stoichiometry
elements: [K, O]
species:
- nasa_condensed.yaml/species: [K2O2(s)]
density: 1.0 g/cm^3
- name: K2O_solid
thermo: fixed-stoichiometry
elements: [K, O]
species:
- nasa_condensed.yaml/species: [K2O(s)]
density: 1.0 g/cm^3
- name: KO2_solid
thermo: fixed-stoichiometry
elements: [K, O]
species:
- nasa_condensed.yaml/species: [KO2(s)]
density: 1.0 g/cm^3
- name: ice
thermo: fixed-stoichiometry
elements: [H, O]
species:
- nasa_condensed.yaml/species: [H2O(s)]
density: 0.917 g/cm^3
- name: liquid_water
thermo: fixed-stoichiometry
elements: [H, O]
species:
- nasa_condensed.yaml/species: [H2O(L)]
density: 1.0 g/cm^3
5 changes: 0 additions & 5 deletions data/README

This file was deleted.

182 changes: 182 additions & 0 deletions data/air.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
description: |-
Ideal gas properties of air. Includes several reactions among
the included species.

generator: ck2yaml
input-files: [air.inp, gri30_tran.dat]
cantera-version: 2.5.0a3
date: Wed, 11 Dec 2019 16:59:03 -0500

units: {length: cm, time: s, quantity: mol, activation-energy: cal/mol}

phases:
- name: air
thermo: ideal-gas
elements: [O, N, Ar]
species: [O, O2, N, NO, NO2, N2O, N2, AR]
kinetics: gas
transport: mixture-averaged
state: {T: 300.0, P: 1 atm}

species:
- name: O
composition: {O: 1}
thermo:
model: NASA7
temperature-ranges: [200.0, 1000.0, 3500.0]
data:
- [3.1682671, -3.27931884e-03, 6.64306396e-06, -6.12806624e-09, 2.11265971e-12,
2.91222592e+04, 2.05193346]
- [2.56942078, -8.59741137e-05, 4.19484589e-08, -1.00177799e-11, 1.22833691e-15,
2.92175791e+04, 4.78433864]
note: L1/90
transport:
model: gas
geometry: atom
well-depth: 80.0
diameter: 2.75
- name: O2
composition: {O: 2}
thermo:
model: NASA7
temperature-ranges: [200.0, 1000.0, 3500.0]
data:
- [3.78245636, -2.99673416e-03, 9.84730201e-06, -9.68129509e-09, 3.24372837e-12,
-1063.94356, 3.65767573]
- [3.28253784, 1.48308754e-03, -7.57966669e-07, 2.09470555e-10, -2.16717794e-14,
-1088.45772, 5.45323129]
note: TPIS89
transport:
model: gas
geometry: linear
well-depth: 107.4
diameter: 3.458
polarizability: 1.6
rotational-relaxation: 3.8
- name: N
composition: {N: 1}
thermo:
model: NASA7
temperature-ranges: [200.0, 1000.0, 6000.0]
data:
- [2.5, 0.0, 0.0, 0.0, 0.0, 5.6104637e+04, 4.1939087]
- [2.4159429, 1.7489065e-04, -1.1902369e-07, 3.0226245e-11, -2.0360982e-15,
5.6133773e+04, 4.6496096]
note: L6/88
transport:
model: gas
geometry: atom
well-depth: 71.4
diameter: 3.298
note: '*'
- name: NO
composition: {N: 1, O: 1}
thermo:
model: NASA7
temperature-ranges: [200.0, 1000.0, 6000.0]
data:
- [4.2184763, -4.638976e-03, 1.1041022e-05, -9.3361354e-09, 2.803577e-12,
9844.623, 2.2808464]
- [3.2606056, 1.1911043e-03, -4.2917048e-07, 6.9457669e-11, -4.0336099e-15,
9920.9746, 6.3693027]
note: RUS78
transport:
model: gas
geometry: linear
well-depth: 97.53
diameter: 3.621
polarizability: 1.76
rotational-relaxation: 4.0
- name: NO2
composition: {N: 1, O: 2}
thermo:
model: NASA7
temperature-ranges: [200.0, 1000.0, 6000.0]
data:
- [3.9440312, -1.585429e-03, 1.6657812e-05, -2.0475426e-08, 7.8350564e-12,
2896.6179, 6.3119917]
- [4.8847542, 2.1723956e-03, -8.2806906e-07, 1.574751e-10, -1.0510895e-14,
2316.4983, -0.11741695]
note: L7/88
transport:
model: gas
geometry: nonlinear
well-depth: 200.0
diameter: 3.5
rotational-relaxation: 1.0
note: '*'
- name: N2O
composition: {N: 2, O: 1}
thermo:
model: NASA7
temperature-ranges: [200.0, 1000.0, 6000.0]
data:
- [2.2571502, 0.011304728, -1.3671319e-05, 9.6819806e-09, -2.9307182e-12,
8741.7744, 10.757992]
- [4.8230729, 2.6270251e-03, -9.5850874e-07, 1.6000712e-10, -9.7752303e-15,
8073.4048, -2.2017207]
note: L7/88
transport:
model: gas
geometry: linear
well-depth: 232.4
diameter: 3.828
rotational-relaxation: 1.0
note: '*'
- name: N2
composition: {N: 2}
thermo:
model: NASA7
temperature-ranges: [300.0, 1000.0, 5000.0]
data:
- [3.298677, 1.4082404e-03, -3.963222e-06, 5.641515e-09, -2.444854e-12,
-1020.8999, 3.950372]
- [2.92664, 1.4879768e-03, -5.68476e-07, 1.0097038e-10, -6.753351e-15,
-922.7977, 5.980528]
note: '121286'
transport:
model: gas
geometry: linear
well-depth: 97.53
diameter: 3.621
polarizability: 1.76
rotational-relaxation: 4.0
- name: AR
composition: {Ar: 1}
thermo:
model: NASA7
temperature-ranges: [300.0, 1000.0, 5000.0]
data:
- [2.5, 0.0, 0.0, 0.0, 0.0, -745.375, 4.366]
- [2.5, 0.0, 0.0, 0.0, 0.0, -745.375, 4.366]
note: '120186'
transport:
model: gas
geometry: atom
well-depth: 136.5
diameter: 3.33

reactions:
- equation: 2 O + M <=> O2 + M # Reaction 1
type: three-body
rate-constant: {A: 1.2e+17, b: -1.0, Ea: 0.0}
efficiencies: {AR: 0.83}
- equation: N + NO <=> N2 + O # Reaction 2
rate-constant: {A: 2.7e+13, b: 0.0, Ea: 355.0}
- equation: N + O2 <=> NO + O # Reaction 3
rate-constant: {A: 9.0e+09, b: 1.0, Ea: 6500.0}
- equation: N2O + O <=> N2 + O2 # Reaction 4
rate-constant: {A: 1.4e+12, b: 0.0, Ea: 1.081e+04}
- equation: N2O + O <=> 2 NO # Reaction 5
rate-constant: {A: 2.9e+13, b: 0.0, Ea: 2.315e+04}
- equation: N2O (+M) <=> N2 + O (+M) # Reaction 6
type: falloff
low-P-rate-constant: {A: 6.37e+14, b: 0.0, Ea: 5.664e+04}
high-P-rate-constant: {A: 7.91e+10, b: 0.0, Ea: 5.602e+04}
efficiencies: {AR: 0.625}
- equation: NO + O + M <=> NO2 + M # Reaction 7
type: three-body
rate-constant: {A: 1.06e+20, b: -1.41, Ea: 0.0}
efficiencies: {AR: 0.7}
- equation: NO2 + O <=> NO + O2 # Reaction 8
rate-constant: {A: 3.9e+12, b: 0.0, Ea: -240.0}
Loading