Calculator API
High-level interface for calculating thermochemical properties.
Types
Glenn.ThermoProperties — Type
ThermoPropertiesImmutable struct holding calculated thermochemical properties at a given temperature. All values in SI units: Cp, S° → J/(mol·K); H° → J/mol.
Fields
temperature::Float64: Temperature (K)cp::Float64: Heat capacity (J/(mol·K))h_relative::Float64: Enthalpy relative to 0 K (J/mol)s::Float64: Absolute entropy (J/(mol·K))temp_min::Float64: Lower bound of valid interval (K)temp_max::Float64: Upper bound of valid interval (K)species_name::String: Species namephase::String: Phase ("gas" or "condensed")
Glenn.Calculator — Type
CalculatorHigh-level interface for calculating thermochemical properties. Wraps a ThermoDB connection.
Call without arguments to use the bundled thermo.db: calc = Calculator()
Functions
Glenn.ThermoCalculator.default_db_path — Function
default_db_path() -> StringReturn the path to the bundled thermo.db shipped with the package.
Glenn.ThermoCalculator.default_inp_path — Function
default_inp_path() -> StringReturn the path to the bundled thermo.inp shipped with the package.
Used as the default input for ThermoDBBuilder when rebuilding the database.
Glenn.ThermoCalculator.get_available_species — Function
get_available_species(calc::Calculator, pattern::AbstractString=""; exact_match::Bool=false) -> Vector{SpeciesInfo}Return a list of available species, optionally filtered by name pattern.
If exact_match=false (default), performs a substring search. Use exact_match=true for case-insensitive exact match — only the species whose name matches the pattern exactly is returned (e.g. $"N2"$ returns only N₂, not Be₃N₂).
Glenn.ThermoCalculator.calculate_properties — Function
calculate_properties(calc::Calculator, species_id::Int, T::Float64)
-> ThermoPropertiesCalculate thermochemical properties at a given temperature.
Returns a ThermoProperties struct with Cp, H°, S° and metadata.
Throws SpeciesNotFoundError if the species ID is invalid. Throws TemperatureOutOfRangeError if T is outside all valid intervals.
calculate_properties(calc::Calculator, species_id::Int,
T_range::AbstractVector{<:Real}) -> Vector{ThermoProperties}Vectorized: calculate thermochemical properties for multiple temperatures.
Loads coefficients once from the database and evaluates the polynomial for each temperature in memory — much faster than calling the scalar version in a loop.
Throws SpeciesNotFoundError if the species ID is invalid. Skips temperatures outside valid intervals (returns only valid results).
Glenn.ThermoCalculator.calculate_formation_enthalpy — Function
calculate_formation_enthalpy(calc::Calculator, species_id::Int) -> Union{Float64, Nothing}Return the enthalpy of formation at 298.15 K (J/mol).
Returns nothing if the species exists but has no formation enthalpy data. Throws SpeciesNotFoundError if the species ID is invalid.
Glenn.ThermoCalculator.calculate_enthalpy_change — Function
calculate_enthalpy_change(calc::Calculator, species_id::Int,
T1::Float64, T2::Float64) -> Float64Calculate ΔH = H(T2) - H(T1) for a species (J/mol).
Throws on invalid species or out-of-range temperatures.
Glenn.ThermoCalculator.get_properties_range — Function
get_properties_range(calc::Calculator, species_id::Int,
T_range::AbstractVector{<:Real}) -> Vector{ThermoProperties}Calculate thermochemical properties over a range of temperatures.
Delegates to the vectorized calculate_properties for efficiency.
Constants
Glenn.ThermoDatabase.R_UNIVERSAL — Constant
const R_UNIVERSALUniversal Gas Constant in J/(mol·K). Source: CODATA 2018.