Merge pull request #1 from DLR-Institute-of-Future-Fuels/binary_database_feature
Binary database feature: This feature alows reading the thermdynamic data from a binary file to minimize memory usage and loading time.
This commit is contained in:
commit
ab87df8b83
4
.flake8
4
.flake8
|
@ -13,7 +13,9 @@ exclude =
|
|||
build,
|
||||
dist,
|
||||
.conda,
|
||||
tests/autogenerated_*
|
||||
tests/autogenerated_*,
|
||||
.venv,
|
||||
venv
|
||||
|
||||
# Enable specific plugins or options
|
||||
# Example: Enabling flake8-docstrings
|
||||
|
|
|
@ -15,30 +15,29 @@ jobs:
|
|||
python-version: ["3.10", 3.11, 3.12, 3.13]
|
||||
|
||||
steps:
|
||||
# Step 1: Check out the code from the repository
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Step 2: Set up Python
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
# Step 3: Install dependencies
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install -e .[dev]
|
||||
|
||||
# Step 4: Lint with flake8
|
||||
- name: Prepare data and compile thermo database
|
||||
run: |
|
||||
python thermo_data/combine_data.py thermo_data/combined_data.yaml thermo_data/nasa9*.yaml thermo_data/nasa9*.xml
|
||||
python thermo_data/compile_to_bin.py thermo_data/combined_data.yaml src/gaspype/data/therm_data.bin
|
||||
|
||||
- name: Lint code with flake8
|
||||
run: flake8
|
||||
|
||||
# Step 5: Check types with mypy
|
||||
- name: Type checking with mypy
|
||||
run: mypy
|
||||
|
||||
# Step 6: Run tests
|
||||
- name: Run tests with pytest
|
||||
run: pytest
|
|
@ -10,3 +10,7 @@ __pycache__
|
|||
tests/autogenerated_*.py
|
||||
docs/build/
|
||||
docs/source/modules.md
|
||||
venv/
|
||||
.venv/
|
||||
thermo_data/combined_data.yaml
|
||||
src/gaspype/data/therm_data.bin
|
||||
|
|
|
@ -13,7 +13,6 @@ classifiers = [
|
|||
"Operating System :: OS Independent",
|
||||
]
|
||||
dependencies = [
|
||||
"pyyaml>=6.0.1",
|
||||
"numpy>2.0.0",
|
||||
"scipy>1.12.0",
|
||||
]
|
||||
|
@ -30,7 +29,7 @@ build-backend = "setuptools.build_meta"
|
|||
where = ["src"]
|
||||
|
||||
[tool.setuptools.package-data]
|
||||
gaspype = ["data/*.yaml"]
|
||||
gaspype = ["data/therm_data.bin"]
|
||||
|
||||
[project.optional-dependencies]
|
||||
dev = [
|
||||
|
@ -39,6 +38,7 @@ dev = [
|
|||
"pytest",
|
||||
"pandas",
|
||||
"cantera",
|
||||
"pyyaml>=6.0.1",
|
||||
"types-PyYAML",
|
||||
"scipy-stubs"
|
||||
]
|
||||
|
|
|
@ -2,9 +2,9 @@ import numpy as np
|
|||
from numpy.typing import NDArray
|
||||
from typing import Literal, Sequence, Callable, Any, TypeVar, Iterator, overload
|
||||
from math import log as ln, ceil, exp
|
||||
import yaml
|
||||
from scipy.optimize import minimize, root
|
||||
from scipy.linalg import null_space
|
||||
from gaspype._phys_data import atomic_weights, db_reader
|
||||
import re
|
||||
import pkgutil
|
||||
|
||||
|
@ -14,15 +14,9 @@ FloatArray = NDArray[NDFloat]
|
|||
|
||||
_T = TypeVar('_T', 'fluid', 'elements')
|
||||
|
||||
|
||||
def _get_data(path: str) -> Any:
|
||||
data = pkgutil.get_data(__name__, path)
|
||||
assert data is not None
|
||||
return yaml.safe_load(data)
|
||||
|
||||
|
||||
_atomic_weights = _get_data('data/atomic_prop.yaml')['atomic_weights']['data']
|
||||
_species_data = {s['name']: s for s in _get_data('data/therm_prop.yaml')['species']}
|
||||
data = pkgutil.get_data(__name__, 'data/therm_data.bin')
|
||||
assert data is not None, 'Could not load thermodynamic data'
|
||||
species_db = db_reader(data)
|
||||
|
||||
kB = 1.380649e-23 # J/K
|
||||
NA = 6.02214076e23 # 1/mol
|
||||
|
@ -82,21 +76,22 @@ def species(pattern: str = '*', element_names: str | list[str] = [], use_regex:
|
|||
elements = set(element_names)
|
||||
|
||||
for el in elements:
|
||||
assert el in _atomic_weights, f'element {el} unknown'
|
||||
assert el in atomic_weights, f'element {el} unknown'
|
||||
|
||||
if not use_regex:
|
||||
el_pattern = '|'.join([el for el in _atomic_weights.keys()])
|
||||
el_pattern = '|'.join([el for el in atomic_weights.keys()])
|
||||
pattern = pattern.replace('*', '.*')
|
||||
pattern = pattern.replace('#', '\\d*')
|
||||
pattern = pattern.replace('$', '(' + el_pattern + ')')
|
||||
pattern = '^' + pattern + '(,.*)?$'
|
||||
|
||||
return sorted(list(
|
||||
[
|
||||
s['name'] for s in _species_data.values()
|
||||
if re.fullmatch(pattern, s['name']) and
|
||||
(len(elements) == 0 or set(s['composition'].keys()).issubset(elements))
|
||||
]))
|
||||
if element_names == []:
|
||||
return [sn for sn in species_db.names if re.fullmatch(pattern, sn)]
|
||||
else:
|
||||
return [
|
||||
s.name for s in species_db
|
||||
if re.fullmatch(pattern, s.name) and
|
||||
(len(elements) == 0 or set(s.composition.keys()).issubset(elements))]
|
||||
|
||||
|
||||
def set_solver(solver: Literal['gibs minimization', 'system of equations']) -> None:
|
||||
|
@ -162,17 +157,17 @@ class fluid_system:
|
|||
self._t_offset = int(t_min)
|
||||
self.species = species
|
||||
self.active_species = species
|
||||
element_compositions: list[dict[str, float]] = list()
|
||||
element_compositions: list[dict[str, int]] = list()
|
||||
|
||||
for i, s in enumerate(species):
|
||||
if s not in _species_data:
|
||||
species_data = species_db.read(s)
|
||||
if not species_data:
|
||||
raise Exception(f'Species {s} not found')
|
||||
element_compositions.append(_species_data[s]['composition'])
|
||||
element_compositions.append(species_data.composition)
|
||||
|
||||
data = _species_data[s]['thermo']
|
||||
assert data['model'] == 'NASA9'
|
||||
assert species_data.model == 9, 'Only NASA9 polynomials are supported'
|
||||
|
||||
for t1, t2, a in zip(data['temperature-ranges'][:-1], data['temperature-ranges'][1:], data['data']):
|
||||
for t1, t2, a in zip(species_data.t_range[:-1], species_data.t_range[1:], species_data.data):
|
||||
|
||||
for j, T in enumerate(temperature_base_points):
|
||||
if t2 >= T >= t1:
|
||||
|
@ -193,7 +188,7 @@ class fluid_system:
|
|||
self.elements: list[str] = sorted(list(set(k for ac in element_compositions for k in ac.keys())))
|
||||
self.array_species_elements = np.array([[ec[el] if el in ec else 0.0 for el in self.elements] for ec in element_compositions])
|
||||
|
||||
self.array_atomic_mass = np.array([_atomic_weights[el] for el in self.elements]) * 1e-3 # kg/mol
|
||||
self.array_atomic_mass = np.array([atomic_weights[el] for el in self.elements]) * 1e-3 # kg/mol
|
||||
self.array_molar_mass: FloatArray = np.sum(self.array_atomic_mass * self.array_species_elements, axis=-1) # kg/mol
|
||||
|
||||
self.array_stoichiometric_coefficients: FloatArray = np.array(null_space(self.array_species_elements.T), dtype=NDFloat).T
|
||||
|
@ -315,7 +310,7 @@ class fluid:
|
|||
|
||||
self.array_composition: FloatArray = comp_array
|
||||
self.total: FloatArray | float = np.sum(self.array_composition, axis=-1, dtype=NDFloat)
|
||||
self.array_fractions = self.array_composition / (np.expand_dims(self.total, -1) + _epsy)
|
||||
self.array_fractions: FloatArray = self.array_composition / (np.expand_dims(self.total, -1) + _epsy)
|
||||
self.shape: _Shape = self.array_composition.shape[:-1]
|
||||
self.fs = fs
|
||||
self.array_elemental_composition: FloatArray = np.dot(self.array_composition, fs.array_species_elements)
|
||||
|
@ -899,7 +894,7 @@ def _equilibrium_eq(fs: fluid_system, element_composition: FloatArray, t: float,
|
|||
|
||||
return (np.hstack([eq_resid, ab_resid]), np.concatenate([j_eq, j_ab], axis=0))
|
||||
|
||||
ret = root(residuals, logn_start, jac=True, tol=1e-30) # type: ignore
|
||||
ret = root(residuals, logn_start, jac=True, tol=1e-30)
|
||||
n = np.exp(np.array(ret['x'], dtype=NDFloat))
|
||||
|
||||
return n * el_max
|
||||
|
|
|
@ -0,0 +1,137 @@
|
|||
import struct
|
||||
from typing import Generator, Iterator
|
||||
|
||||
|
||||
class SpeciesData():
|
||||
"""Class to hold the physical data for a species.
|
||||
Attributes:
|
||||
comp: Dictionary of species composition with element symbols as keys and their counts as values.
|
||||
model: Number of polynomial coefficients used in the model.
|
||||
ref_string: Reference string for the data source.
|
||||
t_range: List of temperatures nodes marking intervals.
|
||||
data: List of lists containing physical data for each temperature interval.
|
||||
"""
|
||||
|
||||
def __init__(self, name: str, comp: dict[str, int], model: int, ref: str, t_range: list[float], data: list[list[float]]):
|
||||
self.name = name
|
||||
self.composition: dict[str, int] = comp
|
||||
self.model: int = model
|
||||
self.ref_string: str = ref
|
||||
self.t_range: list[float] = t_range
|
||||
self.data: list[list[float]] = data
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return (f"Name: {self.name}\n" +
|
||||
f"Composition: {self.composition}\n" +
|
||||
f"Model: {self.model}\n" +
|
||||
f"Reference: {self.ref_string}\n" +
|
||||
f"Temperatures: {self.t_range}\n" +
|
||||
f"Data: {self.data}".replace('),', '),\n'))
|
||||
|
||||
|
||||
class db_reader():
|
||||
"""Class to read and parse the binary gas phase species database.
|
||||
|
||||
Attributes:
|
||||
names: An iterator over the names of species in the database.
|
||||
"""
|
||||
|
||||
header_len = 8
|
||||
|
||||
def __init__(self, inp_data: bytes):
|
||||
""" Initializes the database reader with binary data.
|
||||
Args:
|
||||
inp_data: The binary data of the gas phase species database.
|
||||
"""
|
||||
assert inp_data[:4] == b'gapy', 'Unknown data format'
|
||||
self._bin_data = inp_data
|
||||
self._name_count = struct.unpack('<I', self._bin_data[4:8])[0]
|
||||
species_names = self._bin_data[db_reader.header_len:(db_reader.header_len + self._name_count)].decode('ASCII').split(' ')
|
||||
self._index = {s: i for i, s in enumerate(species_names)}
|
||||
|
||||
@property
|
||||
def names(self) -> Iterator[str]:
|
||||
return iter(self._index.keys())
|
||||
|
||||
def __iter__(self) -> Generator[SpeciesData, None, None]:
|
||||
return (d for d in (self.read(species) for species in self._index.keys()) if d is not None)
|
||||
|
||||
def __contains__(self, name: str) -> bool:
|
||||
""" Checks if a species name is present in the database.
|
||||
Args:
|
||||
name: The name of the species to check.
|
||||
|
||||
Returns:
|
||||
bool: True if the species name is present
|
||||
"""
|
||||
return name in self._index
|
||||
|
||||
def __getitem__(self, name: str) -> SpeciesData:
|
||||
species_data = self.read(name)
|
||||
assert species_data, f"Species '{name}' not found in the database."
|
||||
return species_data
|
||||
|
||||
def read(self, name: str) -> SpeciesData | None:
|
||||
""" Reads the physical data for a given species name from the binary data.
|
||||
Args:
|
||||
name (str): The name of the species to read data for.
|
||||
|
||||
Returns:
|
||||
phys_data: An instance of the phys_data class containing the physical data.
|
||||
"""
|
||||
if name not in self._index:
|
||||
return None
|
||||
|
||||
head_offset = self._name_count + db_reader.header_len + self._index[name] * db_reader.header_len
|
||||
|
||||
head = struct.unpack('<I4B', self._bin_data[head_offset:head_offset + db_reader.header_len])
|
||||
|
||||
offset = head[0]
|
||||
composition_count = head[1]
|
||||
model = head[2]
|
||||
temperature_count = head[3]
|
||||
ref_string_len = head[4]
|
||||
|
||||
td_data_num = (temperature_count - 1) * model
|
||||
data_len = composition_count * 3 + (temperature_count + td_data_num) * 4 + ref_string_len
|
||||
|
||||
format_string = '<' + '2sB' * composition_count + f'{temperature_count}f{td_data_num}f{ref_string_len}s'
|
||||
|
||||
bindat = struct.unpack(format_string, self._bin_data[offset:offset + data_len])
|
||||
comp = {bindat[i * 2].strip().decode('ASCII'): bindat[i * 2 + 1] for i in range(composition_count)}
|
||||
|
||||
noffs = composition_count * 2
|
||||
t_range = list(bindat[noffs:noffs + temperature_count])
|
||||
|
||||
noffs += temperature_count
|
||||
data = [list(bindat[(noffs + i * model):(noffs + (i + 1) * model)]) for i in range(temperature_count - 1)]
|
||||
ref = bindat[-1].decode('utf-8')
|
||||
|
||||
return SpeciesData(name, comp, model, ref, t_range, data)
|
||||
|
||||
|
||||
"""
|
||||
Atomic weights values are used from CIAAW.
|
||||
when a single value is given. Available online at
|
||||
http://www.ciaaw.org/atomic-weights.htm
|
||||
When a range of values is given in the CIAAW table, the "conventional
|
||||
atomic weight" from the IUPAC Periodic Table is used. Available
|
||||
online at https://iupac.org/wp-content/uploads/2018/12/IUPAC_Periodic_Table-01Dec18.pdf
|
||||
"""
|
||||
atomic_weights = {'H': 1.008, 'He': 4.002602, 'Li': 6.94, 'Be': 9.0121831, 'B': 10.81, 'C': 12.011,
|
||||
'N': 14.007, 'O': 15.999, 'F': 18.998403163, 'Ne': 20.1797, 'Na': 22.98976928,
|
||||
'Mg': 24.305, 'Al': 26.9815384, 'Si': 28.085, 'P': 30.973761998, 'S': 32.06,
|
||||
'Cl': 35.45, 'Ar': 39.95, 'K': 39.0983, 'Ca': 40.078, 'Sc': 44.955908,
|
||||
'Ti': 47.867, 'V': 50.9415, 'Cr': 51.9961, 'Mn': 54.938043, 'Fe': 55.845,
|
||||
'Co': 58.933194, 'Ni': 58.6934, 'Cu': 63.546, 'Zn': 65.38, 'Ga': 69.723,
|
||||
'Ge': 72.63, 'As': 74.921595, 'Se': 78.971, 'Br': 79.904, 'Kr': 83.798,
|
||||
'Rb': 85.4678, 'Sr': 87.62, 'Y': 88.90584, 'Zr': 91.224, 'Nb': 92.90637,
|
||||
'Mo': 95.95, 'Ru': 101.07, 'Rh': 102.90549, 'Pd': 106.42, 'Ag': 107.8682,
|
||||
'Cd': 112.414, 'In': 114.818, 'Sn': 118.71, 'Sb': 121.76, 'Te': 127.6,
|
||||
'I': 126.90447, 'Xe': 131.293, 'Cs': 132.90545196, 'Ba': 137.327, 'La': 138.90547,
|
||||
'Ce': 140.116, 'Pr': 140.90766, 'Nd': 144.242, 'Sm': 150.36, 'Eu': 151.964,
|
||||
'Gd': 157.25, 'Tb': 158.925354, 'Dy': 162.5, 'Ho': 164.930328, 'Er': 167.259,
|
||||
'Tm': 168.934218, 'Yb': 173.045, 'Lu': 174.9668, 'Hf': 178.49, 'Ta': 180.94788,
|
||||
'W': 183.84, 'Re': 186.207, 'Os': 190.23, 'Ir': 192.217, 'Pt': 195.084,
|
||||
'Au': 196.96657, 'Hg': 200.592, 'Tl': 204.38, 'Pb': 207.2, 'Bi': 208.9804,
|
||||
'Th': 232.0377, 'Pa': 231.03588, 'U': 238.02891}
|
|
@ -1,90 +0,0 @@
|
|||
atomic_weights:
|
||||
data:
|
||||
Ag: 107.8682
|
||||
Al: 26.9815384
|
||||
Ar: 39.95
|
||||
As: 74.921595
|
||||
Au: 196.96657
|
||||
B: 10.81
|
||||
Ba: 137.327
|
||||
Be: 9.0121831
|
||||
Bi: 208.9804
|
||||
Br: 79.904
|
||||
C: 12.011
|
||||
Ca: 40.078
|
||||
Cd: 112.414
|
||||
Ce: 140.116
|
||||
Cl: 35.45
|
||||
Co: 58.933194
|
||||
Cr: 51.9961
|
||||
Cs: 132.90545196
|
||||
Cu: 63.546
|
||||
Dy: 162.5
|
||||
Er: 167.259
|
||||
Eu: 151.964
|
||||
F: 18.998403163
|
||||
Fe: 55.845
|
||||
Ga: 69.723
|
||||
Gd: 157.25
|
||||
Ge: 72.63
|
||||
H: 1.008
|
||||
He: 4.002602
|
||||
Hf: 178.49
|
||||
Hg: 200.592
|
||||
Ho: 164.930328
|
||||
I: 126.90447
|
||||
In: 114.818
|
||||
Ir: 192.217
|
||||
K: 39.0983
|
||||
Kr: 83.798
|
||||
La: 138.90547
|
||||
Li: 6.94
|
||||
Lu: 174.9668
|
||||
Mg: 24.305
|
||||
Mn: 54.938043
|
||||
Mo: 95.95
|
||||
N: 14.007
|
||||
Na: 22.98976928
|
||||
Nb: 92.90637
|
||||
Nd: 144.242
|
||||
Ne: 20.1797
|
||||
Ni: 58.6934
|
||||
O: 15.999
|
||||
Os: 190.23
|
||||
P: 30.973761998
|
||||
Pa: 231.03588
|
||||
Pb: 207.2
|
||||
Pd: 106.42
|
||||
Pr: 140.90766
|
||||
Pt: 195.084
|
||||
Rb: 85.4678
|
||||
Re: 186.207
|
||||
Rh: 102.90549
|
||||
Ru: 101.07
|
||||
S: 32.06
|
||||
Sb: 121.76
|
||||
Sc: 44.955908
|
||||
Se: 78.971
|
||||
Si: 28.085
|
||||
Sm: 150.36
|
||||
Sn: 118.71
|
||||
Sr: 87.62
|
||||
Ta: 180.94788
|
||||
Tb: 158.925354
|
||||
Te: 127.6
|
||||
Th: 232.0377
|
||||
Ti: 47.867
|
||||
Tl: 204.38
|
||||
Tm: 168.934218
|
||||
U: 238.02891
|
||||
V: 50.9415
|
||||
W: 183.84
|
||||
Xe: 131.293
|
||||
Y: 88.90584
|
||||
Yb: 173.045
|
||||
Zn: 65.38
|
||||
Zr: 91.224
|
||||
note: Atomic weights values are used from CIAAW.when a single value is given. Available
|
||||
online athttp://www.ciaaw.org/atomic-weights.htmWhen a range of values is given
|
||||
in the CIAAW table, the "conventionalatomic weight" from the IUPAC Periodic Table
|
||||
is used. Availableonline at https://iupac.org/wp-content/uploads/2018/12/IUPAC_Periodic_Table-01Dec18.pdf
|
File diff suppressed because it is too large
Load Diff
|
@ -1,562 +0,0 @@
|
|||
prefixes:
|
||||
- symbol: 'y'
|
||||
name: yocto
|
||||
value: 1.0e-24
|
||||
- symbol: z
|
||||
name: zepto
|
||||
value: 1.0e-21
|
||||
- symbol: a
|
||||
name: atto
|
||||
value: 1.0e-18
|
||||
- symbol: f
|
||||
name: femto
|
||||
value: 1.0e-15
|
||||
- symbol: p
|
||||
name: pico
|
||||
value: 1.0e-12
|
||||
- symbol: 'n'
|
||||
name: nano
|
||||
value: 1.0e-9
|
||||
- symbol: µ
|
||||
name: micro
|
||||
value: 1.0e-6
|
||||
- symbol: m
|
||||
name: milli
|
||||
value: 1.0e-3
|
||||
- symbol: c
|
||||
name: centi
|
||||
value: 1.0e-2
|
||||
- symbol: d
|
||||
name: deci
|
||||
value: 1.0e-2
|
||||
- symbol: da
|
||||
name: deca
|
||||
value: 1.0e+1
|
||||
- symbol: h
|
||||
name: hecto
|
||||
value: 1.0e+2
|
||||
- symbol: k
|
||||
name: kilo
|
||||
value: 1.0e+3
|
||||
- symbol: M
|
||||
name: mega
|
||||
value: 1.0e+6
|
||||
- symbol: G
|
||||
name: giga
|
||||
value: 1.0e+9
|
||||
- symbol: T
|
||||
name: tera
|
||||
value: 1.0e+12
|
||||
- symbol: P
|
||||
name: peta
|
||||
value: 1.0e+15
|
||||
- symbol: E
|
||||
name: exa
|
||||
value: 1.0e+18
|
||||
- symbol: Z
|
||||
name: zetta
|
||||
value: 1.0e+21
|
||||
- symbol: 'Y'
|
||||
name: yotta
|
||||
value: 1.0e+24
|
||||
|
||||
units:
|
||||
- symbol: Pa
|
||||
alt_identifier: [pascal]
|
||||
si_base_unit:
|
||||
kg: 1
|
||||
m: -1
|
||||
s: -2
|
||||
typical_si_prefixes: [m, h, k, M, G]
|
||||
si_factor: 1.0
|
||||
usage: [pressure, strain]
|
||||
|
||||
- symbol: 'N'
|
||||
alt_identifier: [newton]
|
||||
si_base_unit:
|
||||
kg: 1
|
||||
m: 1
|
||||
s: -2
|
||||
typical_si_prefixes: [m, k, M, G]
|
||||
si_factor: 1.0
|
||||
usage: [force]
|
||||
|
||||
- symbol: lbf
|
||||
alt_identifier: [pound]
|
||||
si_base_unit:
|
||||
kg: 1
|
||||
m: 1
|
||||
s: -2
|
||||
si_factor: 4.4482
|
||||
usage: [force]
|
||||
|
||||
- symbol: dyn
|
||||
alt_identifier: [dyne]
|
||||
si_base_unit:
|
||||
kg: 1
|
||||
m: 1
|
||||
s: -2
|
||||
typical_si_prefixes: []
|
||||
si_factor: 1.0e-5
|
||||
usage: [force]
|
||||
|
||||
- symbol: atm
|
||||
alt_identifier: [atmosphere]
|
||||
si_base_unit:
|
||||
kg: 1
|
||||
m: -1
|
||||
s: -2
|
||||
typical_si_prefixes: []
|
||||
si_factor: 101325.0
|
||||
usage: [pressure]
|
||||
|
||||
- symbol: t
|
||||
alt_identifier: [ton]
|
||||
si_base_unit:
|
||||
kg: 1
|
||||
typical_si_prefixes: []
|
||||
si_factor: 1000.0
|
||||
usage: [mass]
|
||||
|
||||
- symbol: u
|
||||
alt_identifier: [atomic mass unit]
|
||||
si_base_unit:
|
||||
kg: 1
|
||||
typical_si_prefixes: []
|
||||
si_factor: 1.66053906660e-27
|
||||
usage: [mass]
|
||||
|
||||
- symbol: g
|
||||
alt_identifier: [gram]
|
||||
si_base_unit:
|
||||
kg: 1
|
||||
typical_si_prefixes: [k]
|
||||
si_factor: 0.001
|
||||
usage: [mass]
|
||||
|
||||
- symbol: bar
|
||||
alt_identifier: [bar]
|
||||
si_base_unit:
|
||||
kg: 1
|
||||
m: -1
|
||||
s: -2
|
||||
typical_si_prefixes: []
|
||||
si_factor: 100000.0
|
||||
usage: [pressure]
|
||||
|
||||
- symbol: kgf
|
||||
alt_identifier: [kilogram-force]
|
||||
si_base_unit:
|
||||
kg: 1
|
||||
m: 1
|
||||
s: -2
|
||||
typical_si_prefixes: []
|
||||
si_factor: 9.80665
|
||||
usage: [force]
|
||||
|
||||
- symbol: psi
|
||||
alt_identifier: [pound-force per square inch]
|
||||
si_base_unit:
|
||||
kg: 1
|
||||
m: -1
|
||||
s: -2
|
||||
typical_si_prefixes: []
|
||||
si_factor: 6894.75729
|
||||
usage: [pressure]
|
||||
|
||||
- symbol: oz
|
||||
alt_identifier: [ounce]
|
||||
si_base_unit:
|
||||
kg: 1
|
||||
typical_si_prefixes: []
|
||||
si_factor: 0.0283495
|
||||
usage: [mass]
|
||||
|
||||
- symbol: carat
|
||||
alt_identifier: [carat]
|
||||
si_base_unit:
|
||||
kg: 1
|
||||
typical_si_prefixes: []
|
||||
si_factor: 0.0002
|
||||
usage: [mass]
|
||||
|
||||
- symbol: grain
|
||||
alt_identifier: [grain]
|
||||
si_base_unit:
|
||||
kg: 1
|
||||
typical_si_prefixes: []
|
||||
si_factor: 0.00006479891
|
||||
usage: [mass]
|
||||
|
||||
- symbol: torr
|
||||
alt_identifier: [torr, mmHg]
|
||||
si_base_unit:
|
||||
kg: 1
|
||||
m: -1
|
||||
s: -2
|
||||
typical_si_prefixes: []
|
||||
si_factor: 133.322
|
||||
usage: [pressure]
|
||||
|
||||
- symbol: mol
|
||||
alt_identifier: [mole]
|
||||
si_base_unit:
|
||||
mol: 1
|
||||
typical_si_prefixes: [m, k]
|
||||
si_factor: 1.0
|
||||
usage: [amount of substance]
|
||||
|
||||
- symbol: m
|
||||
alt_identifier: [meter]
|
||||
si_base_unit:
|
||||
m: 1
|
||||
typical_si_prefixes: [p, 'n', µ, m, c, d, k]
|
||||
si_factor: 1.0
|
||||
usage: [length]
|
||||
|
||||
- symbol: mm
|
||||
alt_identifier: [millimeter]
|
||||
si_base_unit:
|
||||
m: 1
|
||||
typical_si_prefixes: []
|
||||
si_factor: 0.001
|
||||
usage: [length]
|
||||
|
||||
- symbol: in
|
||||
alt_identifier: [inch]
|
||||
si_base_unit:
|
||||
m: 1
|
||||
typical_si_prefixes: []
|
||||
si_factor: 0.0254
|
||||
usage: [length]
|
||||
|
||||
- symbol: ft
|
||||
alt_identifier: [foot]
|
||||
si_base_unit:
|
||||
m: 1
|
||||
typical_si_prefixes: []
|
||||
si_factor: 0.3048
|
||||
usage: [length]
|
||||
|
||||
- symbol: yd
|
||||
alt_identifier: [yard]
|
||||
si_base_unit:
|
||||
m: 1
|
||||
typical_si_prefixes: []
|
||||
si_factor: 0.9144
|
||||
usage: [length]
|
||||
|
||||
- symbol: mi
|
||||
alt_identifier: [mile]
|
||||
si_base_unit:
|
||||
m: 1
|
||||
typical_si_prefixes: []
|
||||
si_factor: 1609.34
|
||||
usage: [length]
|
||||
|
||||
- symbol: m²
|
||||
alt_identifier: [square meter]
|
||||
si_base_unit:
|
||||
m: 2
|
||||
typical_si_prefixes: []
|
||||
si_factor: 1.0
|
||||
usage: [area]
|
||||
|
||||
- symbol: cm²
|
||||
alt_identifier: [square centimeter]
|
||||
si_base_unit:
|
||||
m: 2
|
||||
typical_si_prefixes: []
|
||||
si_factor: 1.0e+4
|
||||
usage: [area]
|
||||
|
||||
- symbol: mm²
|
||||
alt_identifier: [square millimeter]
|
||||
si_base_unit:
|
||||
m: 2
|
||||
typical_si_prefixes: []
|
||||
si_factor: 1.0e+6
|
||||
usage: [area]
|
||||
|
||||
- symbol: km²
|
||||
alt_identifier: [square kilometer]
|
||||
si_base_unit:
|
||||
m: 2
|
||||
typical_si_prefixes: []
|
||||
si_factor: 1.0e-6
|
||||
usage: [area]
|
||||
|
||||
- symbol: ac
|
||||
alt_identifier: [acre]
|
||||
si_base_unit:
|
||||
m: 2
|
||||
typical_si_prefixes: []
|
||||
si_factor: 4046.86
|
||||
usage: [area]
|
||||
|
||||
- symbol: ha
|
||||
alt_identifier: [hectare]
|
||||
si_base_unit:
|
||||
m: 2
|
||||
typical_si_prefixes: []
|
||||
si_factor: 10000.0
|
||||
usage: [area]
|
||||
|
||||
- symbol: l
|
||||
alt_identifier: [liter]
|
||||
si_base_unit:
|
||||
m: 3
|
||||
typical_si_prefixes: ['n', µ, m, c, d, h]
|
||||
si_factor: 0.001
|
||||
usage: [volume]
|
||||
|
||||
- symbol: m³
|
||||
alt_identifier: [cubic meter]
|
||||
si_base_unit:
|
||||
m: 3
|
||||
typical_si_prefixes: []
|
||||
si_factor: 1.0
|
||||
usage: [volume]
|
||||
|
||||
- symbol: cm³
|
||||
alt_identifier: [cubic centimeter]
|
||||
si_base_unit:
|
||||
m: 3
|
||||
typical_si_prefixes: []
|
||||
si_factor: 1.0e+6
|
||||
usage: [volume]
|
||||
|
||||
- symbol: dm³
|
||||
alt_identifier: [cubic decimeter]
|
||||
si_base_unit:
|
||||
m: 3
|
||||
typical_si_prefixes: []
|
||||
si_factor: 1.0e+3
|
||||
usage: [volume]
|
||||
|
||||
- symbol: mm³
|
||||
alt_identifier: [cubic millimeter]
|
||||
si_base_unit:
|
||||
m: 3
|
||||
typical_si_prefixes: []
|
||||
si_factor: 1.0e+9
|
||||
usage: [volume]
|
||||
|
||||
- symbol: km³
|
||||
alt_identifier: [cubic kilometer]
|
||||
si_base_unit:
|
||||
m: 3
|
||||
typical_si_prefixes: []
|
||||
si_factor: 1.0e-9
|
||||
usage: [volume]
|
||||
|
||||
- symbol: gal
|
||||
alt_identifier: [gallon]
|
||||
si_base_unit:
|
||||
m: 3
|
||||
typical_si_prefixes: []
|
||||
si_factor: 0.00378541
|
||||
usage: [volume]
|
||||
|
||||
- symbol: K
|
||||
alt_identifier: [kelvin]
|
||||
si_base_unit:
|
||||
K: 3
|
||||
typical_si_prefixes: [m]
|
||||
si_factor: 1.0
|
||||
usage: [temperature]
|
||||
|
||||
- symbol: C
|
||||
alt_identifier: [celsius]
|
||||
si_base_unit:
|
||||
K: 3
|
||||
typical_si_prefixes: [m]
|
||||
si_factor: 1.0
|
||||
offset: 273.15
|
||||
usage: [temperature]
|
||||
|
||||
- symbol: F
|
||||
alt_identifier: [fahrenheit]
|
||||
si_base_unit:
|
||||
K: 1
|
||||
typical_si_prefixes: []
|
||||
si_factor: 0.5555555555
|
||||
offset: 255.372222
|
||||
usage: [temperature]
|
||||
|
||||
- symbol: R
|
||||
alt_identifier: [rankine]
|
||||
si_base_unit:
|
||||
K: 1
|
||||
typical_si_prefixes: []
|
||||
si_factor: 0.5555555555
|
||||
offset: 0
|
||||
usage: [temperature]
|
||||
|
||||
- symbol: V
|
||||
alt_identifier: [volt]
|
||||
si_base_unit:
|
||||
kg: 1
|
||||
m: 2
|
||||
K: -3
|
||||
A: -1
|
||||
typical_si_prefixes: ['n', µ, m, k, M]
|
||||
si_factor: 0.55555555555555
|
||||
usage: [voltage]
|
||||
|
||||
- symbol: A
|
||||
alt_identifier: [ampere]
|
||||
si_base_unit:
|
||||
A: 1
|
||||
typical_si_prefixes: [p, 'n', µ, m, k]
|
||||
si_factor: 0.555555555555555
|
||||
usage: [current]
|
||||
|
||||
- symbol: Barrer
|
||||
alt_identifier: [barrer]
|
||||
si_base_unit:
|
||||
mol: 1
|
||||
s: 1
|
||||
kg: -1
|
||||
typical_si_prefixes: []
|
||||
si_factor: 3.35e-16
|
||||
usage: [permeability]
|
||||
|
||||
- symbol: C
|
||||
alt_identifier: [coulomb]
|
||||
si_base_unit:
|
||||
s: 1
|
||||
A: 1
|
||||
typical_si_prefixes: []
|
||||
si_factor: 1.0
|
||||
usage: [charge]
|
||||
|
||||
- symbol: Ah
|
||||
alt_identifier: [ampere-hour, amp-hour]
|
||||
si_base_unit:
|
||||
s: 1
|
||||
A: 1
|
||||
typical_si_prefixes: [m]
|
||||
si_factor: 3600.0
|
||||
usage: [charge]
|
||||
|
||||
- symbol: F
|
||||
alt_identifier: [farad]
|
||||
si_base_unit:
|
||||
kg: -1
|
||||
m: -2
|
||||
s: 4
|
||||
A: 2
|
||||
typical_si_prefixes: [p, 'n', µ, m]
|
||||
si_factor: 1.0
|
||||
usage: [capacitance]
|
||||
|
||||
- symbol: S
|
||||
alt_identifier: [siemens, moh]
|
||||
si_base_unit:
|
||||
kg: -1
|
||||
m: -2
|
||||
s: 3
|
||||
A: 2
|
||||
typical_si_prefixes: [µ, m]
|
||||
si_factor: 1.0
|
||||
usage: [conductance]
|
||||
|
||||
- symbol: Ω
|
||||
alt_identifier: [ohm]
|
||||
si_base_unit:
|
||||
kg: 11
|
||||
m: 2
|
||||
s: -3
|
||||
A: -2
|
||||
typical_si_prefixes: [m, k, M, G]
|
||||
si_factor: 1.0
|
||||
usage: [resistance]
|
||||
|
||||
- symbol: s
|
||||
alt_identifier: [second, sec]
|
||||
si_base_unit:
|
||||
s: 1
|
||||
typical_si_prefixes: ['n', µ, m]
|
||||
si_factor: 1
|
||||
usage: [time]
|
||||
|
||||
- symbol: min
|
||||
alt_identifier: [minute]
|
||||
si_base_unit:
|
||||
s: 1
|
||||
typical_si_prefixes: []
|
||||
si_factor: 60
|
||||
usage: [time]
|
||||
|
||||
- symbol: h
|
||||
alt_identifier: [hour]
|
||||
si_base_unit:
|
||||
s: 1
|
||||
typical_si_prefixes: []
|
||||
si_factor: 3600
|
||||
usage: [time]
|
||||
|
||||
- symbol: d
|
||||
alt_identifier: [day]
|
||||
si_base_unit:
|
||||
s: 1
|
||||
typical_si_prefixes: []
|
||||
si_factor: 86400
|
||||
usage: [time]
|
||||
|
||||
- symbol: wk
|
||||
alt_identifier: [week]
|
||||
si_base_unit:
|
||||
s: 1
|
||||
typical_si_prefixes: []
|
||||
si_factor: 604800
|
||||
usage: [time]
|
||||
|
||||
- symbol: yr
|
||||
alt_identifier: [year]
|
||||
si_base_unit:
|
||||
s: 1
|
||||
typical_si_prefixes: []
|
||||
si_factor: 31557600
|
||||
usage: [time]
|
||||
|
||||
- symbol: J
|
||||
alt_identifier: [joule]
|
||||
si_base_unit:
|
||||
kg: 1
|
||||
m: 2
|
||||
s: -2
|
||||
typical_si_prefixes: ['n', µ, m, k, M, G, T, P]
|
||||
si_factor: 1
|
||||
usage: [energy]
|
||||
|
||||
- symbol: cal
|
||||
alt_identifier: [calorie]
|
||||
si_base_unit:
|
||||
kg: 1
|
||||
m: 2
|
||||
s: -2
|
||||
typical_si_prefixes: [k]
|
||||
si_factor: 4.184
|
||||
usage: [energy]
|
||||
|
||||
- symbol: Wh
|
||||
alt_identifier: [watt-hour]
|
||||
si_base_unit:
|
||||
kg: 1
|
||||
m: 2
|
||||
s: -2
|
||||
typical_si_prefixes: [m, k, M, G, T]
|
||||
si_factor: 3600
|
||||
usage: [energy]
|
||||
|
||||
- symbol: eV
|
||||
alt_identifier: [electronvolt]
|
||||
si_base_unit:
|
||||
kg: 1
|
||||
m: 2
|
||||
s: -2
|
||||
typical_si_prefixes: [k, M]
|
||||
si_factor: 1.602176634e-19
|
||||
usage: [energy]
|
|
@ -0,0 +1,19 @@
|
|||
from gaspype._phys_data import db_reader
|
||||
|
||||
|
||||
def test_db_reader():
|
||||
with open('src/gaspype/data/therm_data.bin', 'rb') as f:
|
||||
db = db_reader(f.read())
|
||||
|
||||
assert 'HCl' in db
|
||||
assert 'TEST' not in db
|
||||
assert db['HCl'].name == 'HCl'
|
||||
assert db['CH4'].composition == {'C': 1, 'H': 4}
|
||||
assert db['H2O'].model == 9
|
||||
|
||||
for species in db:
|
||||
print(species.name)
|
||||
assert species.model == 9
|
||||
assert len(species.name) > 0
|
||||
assert len(species.composition) > 0
|
||||
assert any(el in species.name for el in species.composition.keys())
|
|
@ -0,0 +1,66 @@
|
|||
# Data preparation
|
||||
Gaspype uses a binary format for thermodynamic data to minimize memory usage and startup time.
|
||||
|
||||
## Combine and prepare data
|
||||
To prepare the data from YAML and XML sources:
|
||||
|
||||
``` bash
|
||||
python combine_data.py combined_data.yaml nasa9*.yaml nasa9*.xml
|
||||
```
|
||||
General Syntax is: ```python combine_data.py OUTPUT_YAML_FILE INPUT_FILE_PATTERN_1 INPUT_FILE_PATTERN_2 ...```
|
||||
|
||||
Example output format for a single file entry:
|
||||
``` yaml
|
||||
- name: HCl
|
||||
composition: {Cl: 1, H: 1}
|
||||
thermo:
|
||||
model: NASA9
|
||||
temperature-ranges: [200.0, 1000.0, 6000.0]
|
||||
data:
|
||||
- [20625.88287, -309.3368855, 5.27541885, -0.00482887422, 6.1957946e-06, -3.040023782e-09, 4.91679003e-13, -10677.82299, -7.309305408]
|
||||
- [915774.951, -2770.550211, 5.97353979, -0.000362981006, 4.73552919e-08, 2.810262054e-12, -6.65610422e-16, 5674.95805, -16.42825822]
|
||||
note: Gurvich,1989 pt1 p186 pt2 p93. [tpis89]
|
||||
```
|
||||
|
||||
Compile ```combined_data.yaml``` to the binary gaspype format:
|
||||
``` bash
|
||||
python compile_to_bin.py combined_data.yaml ../src/gaspype/data/therm_data.bin
|
||||
```
|
||||
General syntax is: ```python compile_to_bin.py YAML_INPUT_FILE BINARY_OUTPUT_FILE```
|
||||
|
||||
The binary format is structured like this, it uses little-endian and IEEE 754 floats:
|
||||
```
|
||||
[4 Byte magic number: 'gapy']
|
||||
[8 Byte: 32 Bit integer for length of all species names (NAMES_LENGTH)]
|
||||
[NAMES_LENGTH Bytes: ASCII encoded string with all species names separated by space]
|
||||
[Index
|
||||
[For each species
|
||||
[4 Bytes: 32 Bit uint with offset of species data in file]
|
||||
[1 Byte: 8 Bit uint with number of elements]
|
||||
[1 Byte: 8 Bit uint for polygon length, value = 9]
|
||||
[1 Byte: 8 Bit uint for number of temperature supporting points (NUM_TEMPS)]
|
||||
[1 Byte: 8 Bit uint for length of reference string (REF_LEN)]
|
||||
]
|
||||
]
|
||||
[Data
|
||||
[For each species
|
||||
[For each species element
|
||||
[2 Byte: element name in ASCII, 0x20 padded]
|
||||
[1 Byte: 8 Bit uint for number of atoms]
|
||||
]
|
||||
[For Range(NUM_TEMPS)
|
||||
[4 Byte: 32 Bit float with temperature supporting point]
|
||||
]
|
||||
[For Range(NUM_TEMPS - 1)
|
||||
[36 Bytes: 9 x 32 Bit float with NASA9-Polynomial for a temperature interval]
|
||||
]
|
||||
[REF_LEN Bytes: ASCII string of the data reference]
|
||||
]
|
||||
]
|
||||
```
|
||||
|
||||
## Notes
|
||||
- Original source of the data compilation: https://ntrs.nasa.gov/citations/20020085330
|
||||
- nasa9_*.yaml files are exported from https://cearun.grc.nasa.gov/ThermoBuild/ and
|
||||
converted with ck2yaml (https://cantera.org/stable/userguide/thermobuild.html)
|
||||
- nasa9polynomials.xml is from: https://github.com/guillemborrell/thermopy/tree/master/databases
|
|
@ -0,0 +1,80 @@
|
|||
import yaml
|
||||
import xml.etree.ElementTree as ET
|
||||
import glob
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
output_file = sys.argv[1]
|
||||
input_files = sys.argv[2:]
|
||||
|
||||
inp_therm_prop: list[dict] = []
|
||||
|
||||
for glop_filter in input_files:
|
||||
for file_name in glob.glob(glop_filter):
|
||||
print(f'Processing file: {file_name}...')
|
||||
if file_name.endswith('.xml'):
|
||||
inp_therm_prop += get_xml_data(file_name)
|
||||
else:
|
||||
with open(file_name, 'r') as f:
|
||||
inp_therm_prop += yaml.safe_load(f)['species']
|
||||
|
||||
therm_prop = []
|
||||
added_species_names: set[str] = set()
|
||||
|
||||
for species in inp_therm_prop:
|
||||
name = species['name']
|
||||
assert isinstance(name, str)
|
||||
for element in species['composition']:
|
||||
name = name.replace(element.upper(), element)
|
||||
if name not in added_species_names and 'E' not in species['composition']:
|
||||
species['name'] = name
|
||||
therm_prop.append(species)
|
||||
added_species_names.add(name)
|
||||
|
||||
with open(output_file, 'w') as f:
|
||||
f.write('species:\n')
|
||||
for species in sorted(therm_prop, key=lambda s: s['name']):
|
||||
f.write('\n- ' + yaml.dump({'name': species['name']}, default_flow_style=False))
|
||||
f.write(f' composition: {yaml.dump(species["composition"], default_flow_style=True)}')
|
||||
f.write(' thermo:\n')
|
||||
f.write(f' model: {species["thermo"]["model"]}\n')
|
||||
f.write(f' temperature-ranges: {yaml.dump(species["thermo"]["temperature-ranges"], default_flow_style=True)}')
|
||||
f.write(' data:\n')
|
||||
for d in species['thermo']['data']:
|
||||
f.write(f' - {d}\n')
|
||||
f.write(' ' + yaml.dump({'note': species['thermo']['note']}, default_flow_style=False))
|
||||
|
||||
print('Added: ', ', '.join(sorted(added_species_names)))
|
||||
|
||||
|
||||
def get_xml_data(file_name: str) -> list[dict]:
|
||||
xml_data_list: list[dict] = []
|
||||
tree = ET.parse(file_name)
|
||||
root = tree.getroot()
|
||||
for i, child in enumerate(root):
|
||||
|
||||
elements = {el[0]: int(el[1]) for c in child.find('elements').findall('element') for el in c.items()}
|
||||
|
||||
values_temp = [tr for tr in child.findall('T_range')]
|
||||
t_ranges = [float(v.attrib['Tlow']) for v in values_temp] + [float(values_temp[-1].attrib['Thigh'])]
|
||||
data = [[float(v.text) for v in tr] for tr in values_temp]
|
||||
|
||||
is_gas = child.find('condensed').text == 'False'
|
||||
|
||||
if is_gas:
|
||||
xml_data_list.append({
|
||||
'name': child.attrib['inp_file_name'],
|
||||
'composition': elements,
|
||||
'thermo': {
|
||||
'model': 'NASA9',
|
||||
'temperature-ranges': t_ranges,
|
||||
'data': data,
|
||||
'note': child.find('comment').text
|
||||
}
|
||||
})
|
||||
return xml_data_list
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1,71 @@
|
|||
import yaml
|
||||
import struct
|
||||
import sys
|
||||
import os
|
||||
|
||||
|
||||
def main():
|
||||
input_file = sys.argv[1]
|
||||
output_file = sys.argv[2]
|
||||
|
||||
assert not output_file.endswith('.yml') and not output_file.endswith('.yaml'), 'Binary output file should not have yaml-extension'
|
||||
|
||||
with open(input_file) as f:
|
||||
data = yaml.safe_load(f)
|
||||
|
||||
data = list({v['name']: v for v in data['species']}.values())
|
||||
|
||||
species_names = ' '.join(s['name'] for s in data)
|
||||
|
||||
header_len = 8
|
||||
|
||||
offset = 8 + len(species_names) + len(data) * header_len
|
||||
|
||||
header_list = []
|
||||
body_list = []
|
||||
added_list = set()
|
||||
|
||||
for dat in data:
|
||||
if dat['name'] not in added_list:
|
||||
|
||||
composition_count = len(dat['composition'])
|
||||
model = {'NASA9': 9}[dat['thermo']['model']]
|
||||
temperatures = dat['thermo']['temperature-ranges']
|
||||
ref_string = dat['thermo']['note'].encode('utf-8')
|
||||
header = struct.pack('<I4B', offset, composition_count, model, len(temperatures), len(ref_string))
|
||||
|
||||
assert len(header) == header_len
|
||||
|
||||
header_list.append(header)
|
||||
|
||||
composition = [el for k, v in dat['composition'].items() for el in [k.ljust(2).encode('ASCII'), v]]
|
||||
data_vals = [d for darr in dat['thermo']['data'] for d in darr[:model]]
|
||||
|
||||
assert len(dat['thermo']['data']) == len(temperatures) - 1, f"Temperature data length mismatch for {dat['name']}."
|
||||
|
||||
if any(len(d) != model for d in dat['thermo']['data']):
|
||||
print(f"Warning: Data length mismatch for {dat['name']}. Expected {model} coefficients, got {len(dat['thermo']['data'][0])}.")
|
||||
|
||||
format_string = '<' + '2sB' * composition_count + f'{len(temperatures)}f{len(data_vals)}f{len(ref_string)}s'
|
||||
|
||||
body = struct.pack(format_string, *(composition + temperatures + data_vals + [ref_string]))
|
||||
body_list.append(body)
|
||||
|
||||
offset += len(body)
|
||||
added_list.add(dat['name'])
|
||||
|
||||
# Ensure the output directory exists
|
||||
os.makedirs(os.path.dirname(output_file), exist_ok=True)
|
||||
|
||||
with open(output_file, 'wb') as f:
|
||||
f.write(b'gapy')
|
||||
f.write(struct.pack('<I', len(species_names)))
|
||||
f.write(species_names.encode('ASCII'))
|
||||
for dat in header_list:
|
||||
f.write(dat)
|
||||
for dat in body_list:
|
||||
f.write(dat)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,293 @@
|
|||
generator: ck2yaml
|
||||
input-files: [mythermo_si.txt]
|
||||
cantera-version: 3.0.1
|
||||
date: Sun, 04 Aug 2024 14:04:08 +0000
|
||||
|
||||
units: {length: cm, time: s, quantity: mol, activation-energy: cal/mol}
|
||||
|
||||
species:
|
||||
- name: H
|
||||
composition: {H: 1}
|
||||
thermo:
|
||||
model: NASA9
|
||||
temperature-ranges: [200.0, 1000.0, 6000.0, 2.0e+04]
|
||||
data:
|
||||
- [0.0, 0.0, 2.5, 0.0, 0.0, 0.0, 0.0, 2.547370801e+04, -0.446682853]
|
||||
- [60.7877425, -0.1819354417, 2.500211817, -1.226512864e-07, 3.73287633e-11,
|
||||
-5.68774456e-15, 3.410210197e-19, 2.547486398e+04, -0.448191777]
|
||||
- [2.173757694e+08, -1.312035403e+05, 33.991742, -3.81399968e-03, 2.432854837e-07,
|
||||
-7.69427554e-12, 9.64410563e-17, 1.067638086e+06, -274.2301051]
|
||||
note: D0(H2):Herzberg,1970. Moore,1972. Gordon,1999. [g 6/97]
|
||||
- name: HO2
|
||||
composition: {H: 1, O: 2}
|
||||
thermo:
|
||||
model: NASA9
|
||||
temperature-ranges: [200.0, 1000.0, 6000.0]
|
||||
data:
|
||||
- [-7.59888254e+04, 1329.383918, -4.67738824, 0.02508308202, -3.006551588e-05,
|
||||
1.895600056e-08, -4.82856739e-12, -5873.35096, 51.9360214]
|
||||
- [-1.810669724e+06, 4963.19203, -1.039498992, 4.56014853e-03, -1.061859447e-06,
|
||||
1.144567878e-10, -4.76306416e-15, -3.20081719e+04, 40.6685092]
|
||||
note: Hf:Hills,1984 & NASA data. Jacox,1998 p153. [g 4/02]
|
||||
- name: H2
|
||||
composition: {H: 2}
|
||||
thermo:
|
||||
model: NASA9
|
||||
temperature-ranges: [200.0, 1000.0, 6000.0, 2.0e+04]
|
||||
data:
|
||||
- [4.07832321e+04, -800.918604, 8.21470201, -0.01269714457, 1.753605076e-05,
|
||||
-1.20286027e-08, 3.36809349e-12, 2682.484665, -30.43788844]
|
||||
- [5.60812801e+05, -837.150474, 2.975364532, 1.252249124e-03, -3.74071619e-07,
|
||||
5.9366252e-11, -3.6069941e-15, 5339.82441, -2.202774769]
|
||||
- [4.96688412e+08, -3.147547149e+05, 79.8412188, -8.41478921e-03, 4.75324835e-07,
|
||||
-1.371873492e-11, 1.605461756e-16, 2.488433516e+06, -669.572811]
|
||||
note: Ref-Elm. Gurvich,1978 pt1 p103 pt2 p31. [tpis78]
|
||||
- name: H2O
|
||||
composition: {H: 2, O: 1}
|
||||
thermo:
|
||||
model: NASA9
|
||||
temperature-ranges: [200.0, 1000.0, 6000.0]
|
||||
data:
|
||||
- [-3.94796083e+04, 575.573102, 0.931782653, 7.22271286e-03, -7.34255737e-06,
|
||||
4.95504349e-09, -1.336933246e-12, -3.30397431e+04, 17.24205775]
|
||||
- [1.034972096e+06, -2412.698562, 4.64611078, 2.291998307e-03, -6.83683048e-07,
|
||||
9.42646893e-11, -4.82238053e-15, -1.384286509e+04, -7.97814851]
|
||||
note: Hf:Cox,1989. Woolley,1987. TRC(10/88) tuv25. [g 8/89]
|
||||
- name: H2O2
|
||||
composition: {H: 2, O: 2}
|
||||
thermo:
|
||||
model: NASA9
|
||||
temperature-ranges: [200.0, 1000.0, 6000.0]
|
||||
data:
|
||||
- [-9.27953358e+04, 1564.748385, -5.97646014, 0.0327074452, -3.93219326e-05,
|
||||
2.509255235e-08, -6.46504529e-12, -2.494004728e+04, 58.7717418]
|
||||
- [1.489428027e+06, -5170.82178, 11.2820497, -8.04239779e-05, -1.818383769e-08,
|
||||
6.94726559e-12, -4.8278319e-16, 1.418251038e+04, -46.5085566]
|
||||
note: Hf:Gurvich,1989 pt1 p127. Gurvich,1978 pt1 p121. [g 6/99]
|
||||
- name: O
|
||||
composition: {O: 1}
|
||||
thermo:
|
||||
model: NASA9
|
||||
temperature-ranges: [200.0, 1000.0, 6000.0, 2.0e+04]
|
||||
data:
|
||||
- [-7953.6113, 160.7177787, 1.966226438, 1.01367031e-03, -1.110415423e-06,
|
||||
6.5175075e-10, -1.584779251e-13, 2.840362437e+04, 8.40424182]
|
||||
- [2.619020262e+05, -729.872203, 3.31717727, -4.28133436e-04, 1.036104594e-07,
|
||||
-9.43830433e-12, 2.725038297e-16, 3.39242806e+04, -0.667958535]
|
||||
- [1.779004264e+08, -1.082328257e+05, 28.10778365, -2.975232262e-03,
|
||||
1.854997534e-07, -5.79623154e-12, 7.191720164e-17, 8.89094263e+05,
|
||||
-218.1728151]
|
||||
note: D0(O2):Brix,1954. Moore,1976. Gordon,1999. [g 5/97]
|
||||
- name: OH
|
||||
composition: {O: 1, H: 1}
|
||||
thermo:
|
||||
model: NASA9
|
||||
temperature-ranges: [200.0, 1000.0, 6000.0, 2.0e+04]
|
||||
data:
|
||||
- [-1998.85899, 93.0013616, 3.050854229, 1.529529288e-03, -3.157890998e-06,
|
||||
3.31544618e-09, -1.138762683e-12, 2991.214235, 4.67411079]
|
||||
- [1.017393379e+06, -2509.957276, 5.11654786, 1.30529993e-04, -8.28432226e-08,
|
||||
2.006475941e-11, -1.556993656e-15, 2.019640206e+04, -11.01282337]
|
||||
- [2.847234193e+08, -1.859532612e+05, 50.082409, -5.14237498e-03, 2.875536589e-07,
|
||||
-8.22881796e-12, 9.56722902e-17, 1.468393908e+06, -402.355558]
|
||||
note: 'D0(H-OH): Ruscic,2002. Gurvich,1978 pt1 p110 pt2 p37. [g 4/02]'
|
||||
- name: O2
|
||||
composition: {O: 2}
|
||||
thermo:
|
||||
model: NASA9
|
||||
temperature-ranges: [200.0, 1000.0, 6000.0, 2.0e+04]
|
||||
data:
|
||||
- [-3.42556342e+04, 484.700097, 1.119010961, 4.29388924e-03, -6.83630052e-07,
|
||||
-2.0233727e-09, 1.039040018e-12, -3391.45487, 18.4969947]
|
||||
- [-1.037939022e+06, 2344.830282, 1.819732036, 1.267847582e-03, -2.188067988e-07,
|
||||
2.053719572e-11, -8.19346705e-16, -1.689010929e+04, 17.38716506]
|
||||
- [4.9752943e+08, -2.866106874e+05, 66.9035225, -6.16995902e-03, 3.016396027e-07,
|
||||
-7.4214166e-12, 7.27817577e-17, 2.293554027e+06, -553.062161]
|
||||
note: Ref-Elm. Gurvich,1989 pt1 p94 pt2 p9. [tpis89]
|
||||
- name: O3
|
||||
composition: {O: 3}
|
||||
thermo:
|
||||
model: NASA9
|
||||
temperature-ranges: [200.0, 1000.0, 6000.0]
|
||||
data:
|
||||
- [-1.282314507e+04, 589.821664, -2.547496763, 0.02690121526, -3.52825834e-05,
|
||||
2.312290922e-08, -6.04489327e-12, 1.348368701e+04, 38.5221858]
|
||||
- [-3.86966248e+07, 1.023344994e+05, -89.615516, 0.0370614497, -4.13763874e-06,
|
||||
-2.725018591e-10, 5.24818811e-14, -6.51791818e+05, 702.910952]
|
||||
note: Gurvich,1989 pt1 p101 pt2 p15. [g 8/01]
|
||||
- name: Si
|
||||
composition: {Si: 1}
|
||||
thermo:
|
||||
model: NASA9
|
||||
temperature-ranges: [200.0, 1000.0, 6000.0, 2.0e+04]
|
||||
data:
|
||||
- [98.3614081, 154.6544523, 1.87643667, 1.320637995e-03, -1.529720059e-06,
|
||||
8.95056277e-10, -1.95287349e-13, 5.26351031e+04, 9.69828888]
|
||||
- [-6.16929885e+05, 2240.683927, -0.444861932, 1.710056321e-03, -4.10771416e-07,
|
||||
4.55888478e-11, -1.889515353e-15, 3.95355876e+04, 26.79668061]
|
||||
- [-9.28654894e+08, 5.44398989e+05, -120.6739736, 0.01359662698, -7.60649866e-07,
|
||||
2.149746065e-11, -2.474116774e-16, -4.29379212e+06, 1086.382839]
|
||||
note: Hf:Cox,1989. NIST data version1.1 [Online]1997. Gordon,1999. [g
|
||||
8/97]
|
||||
- name: SiH
|
||||
composition: {Si: 1, H: 1}
|
||||
thermo:
|
||||
model: NASA9
|
||||
temperature-ranges: [200.0, 1000.0, 6000.0]
|
||||
data:
|
||||
- [-6426.6763, 74.1725121, 3.9734916, -4.14940888e-03, 1.022918384e-05,
|
||||
-8.59238636e-09, 2.567093743e-12, 4.2817458e+04, 2.24693715]
|
||||
- [4.04208649e+05, -2364.796524, 7.62749914, -2.496591233e-03, 1.10843641e-06,
|
||||
-1.943991955e-10, 1.136251507e-14, 5.70473768e+04, -24.48054429]
|
||||
note: Gurvich,1991 pt1 p257 pt2 p234. [tpis91]
|
||||
- name: SiH2
|
||||
composition: {Si: 1, H: 2}
|
||||
thermo:
|
||||
model: NASA9
|
||||
temperature-ranges: [200.0, 1000.0, 6000.0]
|
||||
data:
|
||||
- [-2.063863564e+04, 330.58622, 2.099271145, 3.54253937e-03, 3.37887667e-06,
|
||||
-5.38384562e-09, 2.081191273e-12, 3.011784298e+04, 12.8233357]
|
||||
- [4.62403937e+06, -1.14343611e+04, 12.6488087, 9.1148995e-04, -8.76661154e-07,
|
||||
1.646297357e-10, -9.96509037e-15, 1.072475101e+05, -66.0607807]
|
||||
note: Gurvich,1991 pt1 p260. Fredin,1985. Dubois,1968. [g 3/01]
|
||||
- name: SiH3
|
||||
composition: {Si: 1, H: 3}
|
||||
thermo:
|
||||
model: NASA9
|
||||
temperature-ranges: [200.0, 1000.0, 6000.0]
|
||||
data:
|
||||
- [4341.14282, 227.7185085, 0.650825035, 0.01221438558, -4.34760427e-06,
|
||||
-1.774916828e-09, 1.184191367e-12, 2.259993826e+04, 19.68347482]
|
||||
- [6.05632122e+05, -4721.25406, 13.29129523, -1.256824868e-03, 2.68828594e-07,
|
||||
-3.010741582e-11, 1.370945857e-15, 4.97442064e+04, -61.405031]
|
||||
note: Gurvich,1991 pt1 p261 pt2 p236. [g 3/99]
|
||||
- name: SiH4
|
||||
composition: {Si: 1, H: 4}
|
||||
thermo:
|
||||
model: NASA9
|
||||
temperature-ranges: [200.0, 1000.0, 6000.0]
|
||||
data:
|
||||
- [7.87299329e+04, -552.608705, 2.498944303, 0.01442118274, -8.46710731e-06,
|
||||
2.726164641e-09, -5.43675437e-13, 6269.66906, 4.96546183]
|
||||
- [1.29037874e+06, -7813.39978, 18.28851664, -1.975620946e-03, 4.15650215e-07,
|
||||
-4.59674561e-11, 2.072777131e-15, 4.76688795e+04, -98.0169746]
|
||||
note: Silane. Gurvich,1991 pt1 p263 pt 2 p237. [tpis91]
|
||||
- name: SiO
|
||||
composition: {Si: 1, O: 1}
|
||||
thermo:
|
||||
model: NASA9
|
||||
temperature-ranges: [200.0, 1000.0, 6000.0]
|
||||
data:
|
||||
- [-4.72277105e+04, 806.313764, -1.636976133, 0.01454275546, -1.723202046e-05,
|
||||
1.04239734e-08, -2.559365273e-12, -1.666585903e+04, 33.557957]
|
||||
- [-1.765134162e+05, -31.9917709, 4.47744193, 4.59176471e-06, 3.55814315e-08,
|
||||
-1.327012559e-11, 1.613253297e-15, -1.35084236e+04, -0.838695733]
|
||||
note: Gurvich,1991 pt1 p247 pt2 p227 [tpis91]
|
||||
- name: SiO2
|
||||
composition: {Si: 1, O: 2}
|
||||
thermo:
|
||||
model: NASA9
|
||||
temperature-ranges: [200.0, 1000.0, 6000.0]
|
||||
data:
|
||||
- [-3.36294878e+04, 473.407892, 0.2309770671, 0.01850230806, -2.242786671e-05,
|
||||
1.364981554e-08, -3.35193503e-12, -4.22648749e+04, 22.95803206]
|
||||
- [-1.464031193e+05, -626.144106, 7.96456371, -1.854119096e-04, 4.09521467e-08,
|
||||
-4.69720676e-12, 2.17805428e-16, -3.79183477e+04, -20.45285414]
|
||||
note: Gurvich,1991 pt1 p256 pt2 p233. [tpis91]
|
||||
- name: Si2
|
||||
composition: {Si: 2}
|
||||
thermo:
|
||||
model: NASA9
|
||||
temperature-ranges: [200.0, 1000.0, 6000.0]
|
||||
data:
|
||||
- [1.237596221e+04, -102.4904376, 4.35484852, 1.281063335e-03, -2.531991623e-06,
|
||||
2.265694244e-09, -7.00129014e-13, 6.90694285e+04, 3.2511252]
|
||||
- [1.370060657e+06, -4207.06004, 9.33743289, -2.749217168e-03, 9.58634596e-07,
|
||||
-1.372449748e-10, 6.7650281e-15, 9.51088454e+04, -31.6838519]
|
||||
note: Gurvich,1991 pt1 p240 pt2 p225. [tpis91]
|
||||
- name: Si3
|
||||
composition: {Si: 3}
|
||||
thermo:
|
||||
model: NASA9
|
||||
temperature-ranges: [200.0, 1000.0, 6000.0]
|
||||
data:
|
||||
- [-1.114208177e+04, 157.5785843, 2.486135003, 0.01631637255, -2.208240021e-05,
|
||||
1.372008287e-08, -3.2623307e-12, 7.32825385e+04, 15.88081347]
|
||||
- [-1.699395561e+06, 4697.81538, 2.618198124, 1.959082075e-03, -2.581160603e-07,
|
||||
6.10344486e-12, 6.08630924e-16, 4.27791681e+04, 25.86540384]
|
||||
note: Gurvich,1991 pt1 p246 pt2 p226. [g 7/95]
|
||||
- name: H2O(cr)
|
||||
composition: {H: 2, O: 1}
|
||||
thermo:
|
||||
model: NASA9
|
||||
temperature-ranges: [200.0, 273.15]
|
||||
data:
|
||||
- [-4.02677748e+05, 2747.887946, 57.3833663, -0.826791524, 4.41308798e-03,
|
||||
-1.054251164e-05, 9.69449597e-09, -5.53031499e+04, -190.2572063]
|
||||
note: Ice. Gordon,1982. [g11/99]
|
||||
- name: H2O(L)
|
||||
composition: {H: 2, O: 1}
|
||||
thermo:
|
||||
model: NASA9
|
||||
temperature-ranges: [273.15, 373.15, 600.0]
|
||||
data:
|
||||
- [1.326371304e+09, -2.448295388e+07, 1.879428776e+05, -767.899505,
|
||||
1.761556813, -2.151167128e-03, 1.092570813e-06, 1.101760476e+08, -9.77970097e+05]
|
||||
- [1.263631001e+09, -1.680380249e+07, 9.27823479e+04, -272.237395, 0.447924376,
|
||||
-3.91939743e-04, 1.425743266e-07, 8.11317688e+07, -5.13441808e+05]
|
||||
note: Liquid. Cox,1989. Haar,1984. Keenan,1984. Stimson,1969. [g 8/01]
|
||||
- name: Si(cr)
|
||||
composition: {Si: 1}
|
||||
thermo:
|
||||
model: NASA9
|
||||
temperature-ranges: [200.0, 298.15, 1690.0]
|
||||
data:
|
||||
- [-2.323538208e+04, 0.0, 2.10202168, 1.809220552e-03, 0.0, 0.0, 0.0,
|
||||
-785.063521, -10.38427318]
|
||||
- [-5.23255974e+04, 0.0, 2.850169415, 3.97516697e-04, 0.0, 0.0, 0.0,
|
||||
-1042.947234, -14.38964187]
|
||||
note: Cubic. Ref-Elm. Gurvich,1991 pt1 p236 pt2 p220. [tpis91]
|
||||
- name: Si(L)
|
||||
composition: {Si: 1}
|
||||
thermo:
|
||||
model: NASA9
|
||||
temperature-ranges: [1690.0, 6000.0]
|
||||
data:
|
||||
- [0.0, 0.0, 3.271389414, 0.0, 0.0, 0.0, 0.0, 4882.66711, -13.26611073]
|
||||
note: Liquid. Ref-Elm. Gurvich,1991 pt1 p236 pt2 p220. [tpis91]
|
||||
- name: SiO2(a-qz)
|
||||
composition: {Si: 1, O: 2}
|
||||
thermo:
|
||||
model: NASA9
|
||||
temperature-ranges: [200.0, 848.0]
|
||||
data:
|
||||
- [-5.7768955e+05, 7214.66111, -31.45730294, 0.0741217715, -8.67007782e-06,
|
||||
-1.080461312e-07, 8.31632491e-11, -1.462398375e+05, 184.2424399]
|
||||
note: Alpha-quartz,hexagonal. Gurvich,1991 pt1 p250 pt2 p228. [tpis91]
|
||||
- name: SiO2(b-qz)
|
||||
composition: {Si: 1, O: 2}
|
||||
thermo:
|
||||
model: NASA9
|
||||
temperature-ranges: [848.0, 1200.0]
|
||||
data:
|
||||
- [2.317635074e+04, 0.0, 7.026511484, 1.241925261e-03, 0.0, 0.0, 0.0,
|
||||
-1.117012474e+05, -35.80751356]
|
||||
note: Beta-quartz,hexagonal. Gurvich,1991 pt1 p250 pt2 p228. [tpis91]
|
||||
- name: SiO2(b-crt)
|
||||
composition: {Si: 1, O: 2}
|
||||
thermo:
|
||||
model: NASA9
|
||||
temperature-ranges: [1200.0, 1996.0]
|
||||
data:
|
||||
- [-5.356419079e+05, 0.0, 9.331036946, -7.306503931e-04, 3.339944266e-07,
|
||||
0.0, 0.0, -1.134326721e+05, -49.98768383]
|
||||
note: Beta-cristobalite,cubic. Gurvich,1991 pt1 p250 pt2 p228. [tpis91]
|
||||
- name: SiO2(L)
|
||||
composition: {Si: 1, O: 2}
|
||||
thermo:
|
||||
model: NASA9
|
||||
temperature-ranges: [1996.0, 6000.0]
|
||||
data:
|
||||
- [0.0, 0.0, 10.04268442, 0.0, 0.0, 0.0, 0.0, -1.140002976e+05, -55.54279592]
|
||||
note: Liquid. Gurvich,1991 pt1 p250 pt2 p228. [tpis91]
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue