Utilities and Constants#

SolutionArray(gas::Solution, n::Integer)
SolutionArray(gas::Solution)

A collection of n thermodynamic states of gas (or an empty, growable array). States are stored as temperature, pressure, and mass fractions, and are restored into gas on demand to evaluate properties.

states = SolutionArray(gas)
for t in times
    advance!(net, t)
    append!(states, gas)          # snapshot the current gas state
end
temperature(states)               # Vector of T for every stored state
write_csv(states, "history.csv")
restore!(sa::SolutionArray, i::Integer)

Restore stored state i (1-based) into the backing Solution and return it.

set_state!(sa, i; T, P, X=nothing, Y=nothing)

Set stored state i (1-based). Provide composition as mole fractions X or mass fractions Y (string or vector); if neither is given the composition is left unchanged.

extract(sa, f) -> Vector

Evaluate the scalar property function f (e.g. density, enthalpy_mass) for every stored state and return the results as a vector.

write_csv(sa::SolutionArray, path)

Write the stored states to a CSV file with columns T, P, and one column per species mass fraction.

one_atm

One standard atmosphere [Pa].

gas_constant

Universal gas constant in Cantera’s molar convention [J/kmol/K].

avogadro

Avogadro’s number [1/kmol].

cantera_version() -> String

Version string of the linked Cantera library.

git_commit() -> String

Git commit of the linked Cantera library.

add_data_directory(dir)

Add dir to the list of directories searched for Cantera input files.

suppress_thermo_warnings(flag=true)

Suppress (or re-enable) Cantera’s thermodynamic warnings.

reset_storage()

Reset all Cantera CLib storage, invalidating every existing handle.

CanteraError(msg)

Exception raised when an underlying Cantera CLib call reports an error. The message is the exception text produced by the C++ Cantera core.