A Julia interface for NIST-JANAF Thermochemical Tables
JANAF.jl is a Julia package to assist with thermochemical property lookup. It loads downloaded JANAF tables into memory for easy access and provides functions for interpolating these tables. JANAF.jl requires:
- user-downloaded JANAF tables as outlined in the installation section
- gaseous tables only, as mixed-phase tables have artifacts I have not attempted to tackle yet
I welcome pull requests and assistance from people who may actually use this, as this primarily came out of a need during a homework assignment. It is not polished.
- Install JANAF.jl by first entering package mode in the REPL with
]
, then run:
pkg> add https://github.com/duncanam/JANAF.jl.git
- Next, go to https://janaf.nist.gov/ and find the desired gas(es) you'd like to work with, such as gaseous water.
- Scroll to the bottom of the page and right click the "Download table" button, and select "Save Link As..." and save the table to the desired JANAF folder that will contain all the tables. This is only needed once per new specie.
- Now, rename the table for your liking for easy access (e.g. "H-064.txt" to "H2O.txt").
This package provides several functions. The first and foremost being a function to return a dictionary containing all the specie properties:
jd = JanafDict(path,specie_list)
where
path
is the path to the user-defined directory containing all the downloaded JANAF tablesspecie_list
is aString
array containing the names of the files that will be loaded
JANAF.jl also provides interpolation functions to return values at a desired temperature in K units. These functions include:
Cp(jd,specie,T)
: Specific heat ofspecie
at constant pressure atT
temperature in kelvin. Interpolates JanafDict given asjd
. Returns specific heat in J/K/mol.S(jd,specie,T)
: Entropy ofspecie
atT
temperature in kelvin. Interpolates JanafDict given asjd
. Returns entropy in J/K/mol.Hs(jd,specie,T)
: Sensible enthalpy ofspecie
atT
temperature in kelvin. Interpolates JanafDict given asjd
. Returns sensible enthalpy in kJ/mol. In JANAF table as H-H0(Tr).Hf(jd,specie,T)
: Standard enthalpy of formation ofspecie
atT
temperature in kelvin. Interpolates JanafDict given asjd
. Returns formation enthalpy in kJ/mol. In JANAF table as ΔfH0.Gf(jd,specie,T)
: Standard Gibbs free energy of formation ofspecie
atT
temperature in kelvin. Interpolates JanafDict given asjd
. Returns formation enthalpy in kJ/mol. In JANAF table as ΔfG0.Kf(jd,specie,T)
: Equilibrium constant ofspecie
atT
temperature in kelvin. Interpolates JanafDict given asjd
. Returns equilibrium constant in kJ/mol. In JANAF table as log(Kf), and this function returns Kf.
Here is an example of usage:
# Define path to directory of JANAF tables
path = "/home/user/janaf/"
# Define desired species in path, named as:
# N2.txt
# H2O.txt
species_list = ["N2","H2O"]
# Define JANAF dictionary
jd = JanafDict(path,species_list)
# Grab specific heat of water at a desired
# temperature, T = 457.2 K
result = Cp(jd,"H2O",457.2)
- Create an interface to automatically retrieve JANAF tables from online and download them into a user-defined location
- Add the capability to parse more than just gaseous tables
This package references NIST's JANAF thermochemical tables provided at https://janaf.nist.gov/. Table rights belong to them, and credits can be found HERE.