Builder API

Converts NASA FORTRAN thermo.inp files → SQLite3 database.

FORTRAN Record Structure (Appendix C)

RecordContent
RECORD 1Species identification (name, comments)
RECORD 2General information (numintervals, refcode, phase, MW, ΔH°f)
RECORD 3Temperature interval definition (Tmin, Tmax, H_298→0)
RECORD 4First 5 polynomial coefficients (a₁–a₅)
RECORD 5Last 2 coefficients + integration constants (a₆, a₇, b₁, b₂)

Records 3–5 repeat for each temperature interval.

Quick Start

using Glenn

# Build from the bundled thermo.inp (shipped with the package)
builder = ThermoDBBuilder(default_inp_path(), "thermo.db")
ThermoBuilder.connect(builder)
ThermoBuilder.create_tables(builder)
ThermoBuilder.parse_and_load(builder)
ThermoBuilder.close(builder)

# Or use a custom thermo.inp
builder = ThermoDBBuilder("my_thermo.inp", "my_thermo.db")
ThermoBuilder.connect(builder)
ThermoBuilder.create_tables(builder)
ThermoBuilder.parse_and_load(builder)
ThermoBuilder.close(builder)

API Reference

Glenn.ThermoDBBuilderType
ThermoDBBuilder

Builds a SQLite database from a thermo.inp file (NASA FORTRAN format).

Example

builder = ThermoDBBuilder("thermo.inp", "thermo.db")
connect(builder)
create_tables(builder)
parse_and_load(builder)
close(builder)
source
Glenn.ThermoBuilder.parse_and_loadFunction
parse_and_load(builder::ThermoDBBuilder)

Parse the thermo.inp file and populate the database.

Reads the FORTRAN file line by line, detects record types, extracts species data, temperature intervals, and polynomial coefficients, then inserts everything into the normalized SQLite schema.

source

Parser Utilities

Glenn.ThermoBuilder.parse_floatFunction
parse_float(value::AbstractString) -> Union{Float64, Nothing}

Parse a FORTRAN-style float ('D' → 'E' notation). Returns nothing if parsing fails.

source
Glenn.ThermoBuilder.parse_species_recordFunction
parse_species_record(line::AbstractString) -> Tuple{String, String}

Extract species name (cols 1-16) and comments (cols 19-80) from RECORD 1.

Returns (species_name, comments).

source
Glenn.ThermoBuilder.parse_general_info_recordFunction
parse_general_info_record(line::AbstractString) -> Dict{String, Any}

Parse RECORD 2 – general information.

Returns a Dict with keys: num_intervals, ref_code, phase, molecular_weight, heat_of_formation.

source
Glenn.ThermoBuilder.parse_coefficients_recordFunction
parse_coefficients_record(lines::Vector{<:AbstractString}) -> Dict{String, Any}

Parse RECORDS 4-5 – polynomial coefficients.

Line 4: a₁[1:16], a₂[17:32], a₃[33:48], a₄[49:64], a₅[65:80] Line 5: a₆[1:16], a₇[17:32], (skip 33:48), b₁[49:64], b₂[65:80]

Returns a Dict with keys: a1a7, b1, b2.

source
Glenn.ThermoBuilder.is_temperature_lineFunction
is_temperature_line(line::AbstractString) -> Bool

Detect RECORD 3 (temperature interval).

A temperature line has two valid floats in cols 1-11 and 12-22 where the first is strictly less than the second.

source
Glenn.ThermoBuilder.is_coefficient_lineFunction
is_coefficient_line(line::AbstractString) -> Bool

Detect coefficient lines containing FORTRAN D notation.

Uses regex to match the standard FORTRAN double-precision format (e.g. 1.23456789D+01).

source