Read the NASA Polynomial dataset in raw format and parse and store the data into an .xml file.
You can find the NASA Polynomial file in thermo.txt
.
You can find some details on the NASA Polynomials at this site in addition to the Lecture 16 notes.
The NASA polynomials for specie $i$ have the form: $$ \frac{C_{p,i}}{R}= a_{i1} + a_{i2} T + a_{i3} T^2 + a_{i4} T^3 + a_{i5} T^4 $$
$$ \frac{H_{i}}{RT} = a_{i1} + a_{i2} \frac{T}{2} + a_{i3} \frac{T^2}{3} + a_{i4} \frac{T^3}{4} + a_{i5} \frac{T^4}{5} + \frac{a_{i6}}{T} $$$$ \frac{S_{i}}{R} = a_{i1} \ln(T) + a_{i2} T + a_{i3} \frac{T^2}{2} + a_{i4} \frac{T^3}{3} + a_{i5} \frac{T^4}{4} + a_{i7} $$where $a_{i1}$, $a_{i2}$, $a_{i3}$, $a_{i4}$, $a_{i5}$, $a_{i6}$, and $a_{i7}$ are the numerical coefficients supplied in NASA thermodynamic files.
thermo.txt
The first 7 numbers starting on the second line of each species entry (five of the second line and the first two of the third line) are the seven coefficients ($a_{i1}$ through $a_{i7}$, respectively) for the high-temperature range (above 1000 K, the upper boundary is specified on the first line of the species entry).
The next seven numbers are the coefficients ($a_{i1}$ through $a_{i7}$, respectively) for the low-temperature range (below 1000 K, the lower boundary is specified on the first line of the species entry).
Your final .xml file should contain the following specifications:
speciesArray
field that contains a space-separated list of all of the species present in the file.Each species contains a species
field with a name
attribute as the species name.
floatArray
field that contains comma-separated string of each coefficient.You can reference the example_thermo.xml
file for an example .xml output.
Hint: First parse the file into a Python dictionary.