diff --git a/SConstruct b/SConstruct index 9e8f23f82..ea57e8deb 100644 --- a/SConstruct +++ b/SConstruct @@ -1550,20 +1550,51 @@ for cti in mglob(env, 'data/inputs', 'cti'): build(env.Command('build/data/%s' % outName, cti.path, '$python_cmd_esc interfaces/cython/cantera/ctml_writer.py $SOURCE $TARGET')) - -# Copy input files which are not present as cti: +# Copy XML input files which are not present as cti: for xml in mglob(env, 'data/inputs', 'xml'): dest = pjoin('build','data',xml.name) 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', + transport='data/transport/gri30_tran.dat'), + dict(output='air.yaml', input='data/inputs/air.inp', + transport='data/transport/gri30_tran.dat'), + dict(output='airNASA9.yaml', input='data/inputs/airNASA9.inp', + thermo='data/thermo/airDataNASA9.dat'), + dict(output='h2o2.yaml', input='data/inputs/h2o2.inp', + transport='data/transport/gri30_tran.dat'), + 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'] + 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') + if addInstallActions: # Put headers in place headerBase = 'include/cantera' install(env.RecursiveInstall, '$inst_incdir', 'include/cantera') # Data files - install('$inst_datadir', mglob(env, 'build/data', 'cti', 'xml')) + install('$inst_datadir', mglob(env, 'build/data', 'cti', 'xml', 'yaml')) ### List of libraries needed to link to Cantera ### diff --git a/data/inputs/air.inp b/data/inputs/air.inp index 75bc01f64..05704100b 100644 --- a/data/inputs/air.inp +++ b/data/inputs/air.inp @@ -4,6 +4,41 @@ END SPECIES O O2 N NO NO2 N2O N2 AR END +THERMO ALL + 300.000 1000.000 5000.000 +O L 1/90O 1 00 00 00G 200.000 3500.000 1000.000 1 + 2.56942078E+00-8.59741137E-05 4.19484589E-08-1.00177799E-11 1.22833691E-15 2 + 2.92175791E+04 4.78433864E+00 3.16826710E+00-3.27931884E-03 6.64306396E-06 3 +-6.12806624E-09 2.11265971E-12 2.91222592E+04 2.05193346E+00 4 +O2 TPIS89O 2 00 00 00G 200.000 3500.000 1000.000 1 + 3.28253784E+00 1.48308754E-03-7.57966669E-07 2.09470555E-10-2.16717794E-14 2 +-1.08845772E+03 5.45323129E+00 3.78245636E+00-2.99673416E-03 9.84730201E-06 3 +-9.68129509E-09 3.24372837E-12-1.06394356E+03 3.65767573E+00 4 +N L 6/88N 1 0 0 0G 200.000 6000.000 1000.000 1 + 0.24159429E+01 0.17489065E-03-0.11902369E-06 0.30226245E-10-0.20360982E-14 2 + 0.56133773E+05 0.46496096E+01 0.25000000E+01 0.00000000E+00 0.00000000E+00 3 + 0.00000000E+00 0.00000000E+00 0.56104637E+05 0.41939087E+01 4 +NO RUS 78N 1O 1 0 0G 200.000 6000.000 1000.000 1 + 0.32606056E+01 0.11911043E-02-0.42917048E-06 0.69457669E-10-0.40336099E-14 2 + 0.99209746E+04 0.63693027E+01 0.42184763E+01-0.46389760E-02 0.11041022E-04 3 +-0.93361354E-08 0.28035770E-11 0.98446230E+04 0.22808464E+01 4 +NO2 L 7/88N 1O 2 0 0G 200.000 6000.000 1000.000 1 + 0.48847542E+01 0.21723956E-02-0.82806906E-06 0.15747510E-09-0.10510895E-13 2 + 0.23164983E+04-0.11741695E+00 0.39440312E+01-0.15854290E-02 0.16657812E-04 3 +-0.20475426E-07 0.78350564E-11 0.28966179E+04 0.63119917E+01 4 +N2O L 7/88N 2O 1 0 0G 200.000 6000.000 1000.000 1 + 0.48230729E+01 0.26270251E-02-0.95850874E-06 0.16000712E-09-0.97752303E-14 2 + 0.80734048E+04-0.22017207E+01 0.22571502E+01 0.11304728E-01-0.13671319E-04 3 + 0.96819806E-08-0.29307182E-11 0.87417744E+04 0.10757992E+02 4 +N2 121286N 2 G 300.000 5000.000 1000.000 1 + 0.02926640E+02 0.14879768E-02-0.05684760E-05 0.10097038E-09-0.06753351E-13 2 +-0.09227977E+04 0.05980528E+02 0.03298677E+02 0.14082404E-02-0.03963222E-04 3 + 0.05641515E-07-0.02444854E-10-0.10208999E+04 0.03950372E+02 4 +AR 120186AR 1 G 300.000 5000.000 1000.000 1 + 0.02500000E+02 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 2 +-0.07453750E+04 0.04366000E+02 0.02500000E+02 0.00000000E+00 0.00000000E+00 3 + 0.00000000E+00 0.00000000E+00-0.07453750E+04 0.04366000E+02 4 +END REACTIONS 2O+M<=>O2+M 1.200E+17 -1.000 .00 AR/.83/ diff --git a/interfaces/cython/.gitignore b/interfaces/cython/.gitignore index f919e2a5c..0601b64ab 100644 --- a/interfaces/cython/.gitignore +++ b/interfaces/cython/.gitignore @@ -2,6 +2,8 @@ cantera/*.cpp cantera/*.c cantera/data/*.cti cantera/data/*.xml +cantera/data/*.yaml +cantera/data/*.yml cantera/test/data/*.cti cantera/test/data/*.xml cantera/test/data/*.inp