Closed jonlym closed 2 years ago
The following script demonstrates pMuTT's ability to write Units and Species in Cantera's YAML format in commit 222c486
import yaml
import numpy as np
from pmutt.empirical.nasa import Nasa, Nasa9, SingleNasa9
from pmutt.empirical.shomate import Shomate
from pmutt.cantera.units import Units
units = Units()
with open('test_yaml.yaml', 'w') as f_ptr:
yaml.dump(units.to_yaml_dict(), f_ptr, default_flow_style=None)
{act_energy: cal/mol, energy: cal, length: cm, mass: kg, pressure: bar, quantity: molec,
time: s}
H2O_nasa = Nasa(name='H2O',
elements={'H': 2, 'O': 1},
T_low=200., T_mid=1000., T_high=3500., n_sites=1,
a_high=np.array([3.03399249E+00,
2.17691804E-03,
-1.64072518E-07,
-9.70419870E-11,
1.68200992E-14,
-3.00042971E+04,
4.96677010E+00]),
a_low=np.array([4.19864056E+00,
-2.03643410E-03,
6.52040211E-06,
-5.48797062E-09,
1.77197817E-12,
-3.02937267E+04,
-8.49032208E-01]))
with open('test_yaml.yaml', 'a') as f_ptr:
yaml.dump(H2O_nasa.to_yaml_dict(), f_ptr, default_flow_style=None)
composition: {H: 2, O: 1}
name: H2O
sites: 1
thermo:
data:
- [4.19864056, -0.0020364341, 6.52040211e-06, -5.48797062e-09, 1.77197817e-12, -30293.7267,
-0.849032208]
- [3.03399249, 0.00217691804, -1.64072518e-07, -9.7041987e-11, 1.68200992e-14, -30004.2971,
4.9667701]
model: NASA7
temperature-ranges: [200.0, 1000.0, 3500.0]
A_nasa9 = Nasa9(name='ExampleNASA9',
elements={'C': 1, 'H': 4},
n_sites=1,
nasas=[SingleNasa9(T_low=200., T_high=1000.,
a=np.array([2.210371497E+04,
-3.818461820E+02,
6.082738360E+00,
-8.530914410E-03,
1.384646189E-05,
-9.625793620E-09,
2.519705809E-12,
7.108460860E+02,
-1.076003744E+01])),
SingleNasa9(T_low=1000., T_high=6000.,
a=np.array([5.877124060E+05,
-2.239249073E+03,
6.066949220E+00,
-6.139685500E-04,
1.491806679E-07,
-1.923105485E-11,
1.061954386E-15,
1.283210415E+04,
-1.586640027E+01])),
SingleNasa9(T_low=6000., T_high=20000.,
a=np.array([8.310139160E+08,
-6.420733540E+05,
2.020264635E+02,
-3.065092046E-02,
2.486903333E-06,
-9.705954110E-11,
1.437538881E-15,
4.938707040E+06,
-1.672099740E+03]))])
with open('test_yaml.yaml', 'a') as f_ptr:
yaml.dump(A_nasa9.to_yaml_dict(), f_ptr, default_flow_style=None)
composition: {C: 1, H: 4}
name: ExampleNASA9
sites: 1
thermo:
data:
- [22103.71497, -381.846182, 6.08273836, -0.00853091441, 1.384646189e-05, -9.62579362e-09,
2.519705809e-12, 710.846086, -10.76003744]
- [587712.406, -2239.249073, 6.06694922, -0.00061396855, 1.491806679e-07, -1.923105485e-11,
1.061954386e-15, 12832.10415, -15.86640027]
- [831013916.0, -642073.354, 202.0264635, -0.03065092046, 2.486903333e-06, -9.70595411e-11,
1.437538881e-15, 4938707.04, -1672.09974]
model: NASA9
reference-pressure: 1 bar
temperature-ranges: [200.0, 1000.0, 6000.0, 20000.0]
H2O_shomate = Shomate(name='H2O',
elements={'H': 2, 'O': 1},
T_low=500., T_high=1700.,
a=np.array([30.09200,
6.832514,
6.793435,
-2.534480,
0.082139,
-250.8810,
223.3967,
-241.8264]))
with open('test_yaml.yaml', 'a') as f_ptr:
yaml.dump(H2O_shomate.to_yaml_dict(), f_ptr, default_flow_style=None)
composition: {H: 2, O: 1}
name: H2O
sites: null
thermo:
data:
- [30.092, 6.832514, 6.793435, -2.53448, 0.082139, -250.881, 223.3967, -241.8264]
model: Shomate
temperature-ranges: [500.0, 1700.0]
OpenMKM Documentation updated with YAML syntax: https://vlachosgroup.github.io/openmkm/input
Added support for Reactions, Phases, BEPs, and Lateral Interactions in commit 2ed1df77ec9a1e98d41d7d75b40eeae36f81a830.
May require further testing once new OpenMKM version is stable.
Currently, pMuTT and OpenMKM relies on CTI files for thermodynamics and kinetics. Since Cantera supports YAML files, pMuTT and OpenMKM should be upgraded accordingly.
Additional context Refers to this issue: https://github.com/VlachosGroup/openmkm/issues/12 Cantera Documentation: https://cantera.org/documentation/dev/sphinx/html/yaml/index.html