mirror of
https://github.com/Cantera/cantera.git
synced 2026-08-19 01:14:44 -05:00
Cantera.jl
A Julia interface to Cantera for chemical
kinetics, thermodynamics, and transport. It links Cantera's native libcantera
directly through the generated CLib API — it is not a reimplementation of
Cantera and has no Python dependency.
Install
Requires Julia 1.9+ and a compiled libcantera. Point the package at the
library (a directory or a full path) and the mechanism data:
export CANTERA_LIBRARY_PATH=/path/to/cantera/lib # or use a conda env
export CANTERA_DATA=/path/to/cantera/data # for gri30.yaml, etc.
The low-level CLib bindings are scaffolded by scons build and are kept up to
date by the build process.
using Pkg
Pkg.activate("interfaces/julia")
Pkg.instantiate()
Quickstart
using Cantera
gas = Solution("gri30.yaml")
set_TPX!(gas, 1000.0, one_atm, "H2:2, O2:1, N2:4")
reactor = IdealGasReactor(gas)
net = ReactorNet(reactor)
advance!(net, 1e-3)
temperature(reactor) # ignited temperature [K]
Documentation
Exported functions carry docstrings, accessible from the Julia REPL help mode
(type ? followed by the function name). See the examples/
directory for runnable usage.
Status
Experimental. This interface targets Cantera's experimental CLib backend, and APIs may change.