Cantera
K-DenseCommunityCreated by K-Dense Inc.
- Skill
- Workflow
- Science and research
- MIT
- Low risk
- Has scripts
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides a structured workflow for calculating ignition delay in closed, adiabatic, homogeneous ideal-gas reactors. It automates the execution of Cantera simulations for both constant-volume and constant-pressure conditions, providing a standardized temperature-based delay definition (global maximum of dT/dt). The tool includes built-in numerical refinement checks, conservation verification, and mechanism snapshotting to ensure reproducible results for combustion kinetics studies.
What it does
- Calculates ignition delay based on the global maximum of the temperature derivative.
- Performs automated numerical refinement using four distinct reactor runs.
- Validates conservation of mass, elements, and energy (internal energy or enthalpy).
- Generates detailed reports including mechanism hashes and normalized initial compositions.
- Exports time-series data for temperature, pressure, and species mole fractions.
- Snapshots the loaded kinetic mechanism for provenance and reproducibility.
When to use it
- When modeling closed, adiabatic, homogeneous ideal-gas ignition kinetics.
- When comparing ignition delays across different kinetic mechanisms or conditions.
- When you need to verify numerical resolution and conservation for a combustion model.
- When you require a standardized, reproducible approach to ignition delay reporting.
Advantages
- Standardized definition of ignition delay reduces ambiguity in kinetic comparisons.
- Automated refinement runs help identify numerical sensitivity to solver settings.
- Built-in conservation checks ensure physical consistency of the simulation.
- Mechanism snapshotting ensures the exact model state is preserved with the results.
Usage examples
- “Run an ignition delay calculation for a hydrogen-oxygen mixture at 1000K and 1 atm using the provided hydrogen-ignition.json configuration.”
- The agent executes the ignition_delay.py script, performs the four required refinement runs, and generates a report.json containing the calculated delay and conservation diagnostics.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/k-dense-ai/cantera/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip cantera.zip -d .agents/skills
Documentation by K-Dense Inc.
Cantera: homogeneous ignition calculations
When to use
Use for a closed, adiabatic, homogeneous ideal-gas reactor with a known kinetic mechanism, initial temperature, pressure, and mole composition. The bundled helper runs both constant volume and constant pressure cases and reports a precisely defined temperature-based delay. It is not a flame solver or a general reactor-network builder.
A calculation completing successfully establishes numerical execution, not mechanism validity for the fuel, pressure, temperature, diluent, or measured ignition observable. Read references/interpretation.md when choosing a mechanism, comparing experiments, or interpreting unresolved/two-stage ignition.
Workflow
Identify the mechanism and its validated condition range. Preserve its source, version, citation, and any modifications. Check that its phase is
ideal-gasand that every reactant, diluent, and tracked species exists. For custom YAML with imports, retain the original dependency files as well as the generated phase snapshot. Custom Python rate extensions additionally need their original code and environment for replay.Choose constant volume or constant pressure from the physical experiment. Supply K, Pa, seconds, and mole amounts explicitly.
mole_amountsis normalized to mole fractions; it is not a mass-fraction mapping. The report includes the normalized initial composition.Copy assets/hydrogen-ignition.json and change its conditions. The supplied H2/O2/Ar case uses Cantera's bundled
h2o2.yamlfor an executable numerical example; it is not a recommendation for every hydrogen experiment.Set a time horizon long enough to observe the temperature rise and the decline of the heating-rate peak. Choose output spacing fine enough to locate that peak. Set a minimum temperature rise to distinguish ignition from negligible heating or numerical noise.
Run the helper and inspect all four histories and the report. Refine again if the delay changes materially, if the maximum approaches a time boundary, or if conservation fails. Compare the temperature and tracked-species histories with the actual ignition definition.
Report the condition set, mechanism hash, reactor constraint, delay definition, output spacing, numerical changes, and scientific limits together with the delay.
Execute the tested example
From the collection root:
uv run --no-project --python 3.12 --with cantera==3.2.0 --with numpy==2.5.3 \
python skills/cantera/scripts/ignition_delay.py \
skills/cantera/assets/hydrogen-ignition.json hydrogen-resultTested on Python 3.12, Cantera 3.2.0, and NumPy 2.5.3. No external solver executable or credentials are needed. Local relative mechanism paths resolve against the configuration file directory before Cantera's built-in data search. Use a new output directory each run.
The 1000 K, 101325 Pa, H2:O2:Ar = 2:1:7 constant-volume example gives about 0.313 ms
using the stated max(dT/dt) definition. At 3 ms its temperature is approximately
2920.67 K and agrees with a separate UV equilibrium calculation. These are package
regression values, not experimental validation data.
Exact delay and refinement contract
Delay is the time of the global maximum of numpy.gradient(T, time, edge_order=2) on
a uniform output grid. It is reported only if the maximum temperature rise reaches
minimum_temperature_rise_k and the maximum is at least two sample indices from each
boundary. Otherwise delay_s is null and a status explains why. No delay beyond the
simulation horizon is extrapolated.
The helper explicitly uses Cantera 3.2's clone=True and reads evolving properties from
reactor.phase. The original Solution retains the initial state; do not read it as
the reactor's final state. ReactorNet.advance(t) requests an absolute time, and no
advance limits are configured, so the output grid remains uniform.
It runs four independent fresh reactors:
| Run | Change from configured conditions |
|---|---|
| baseline | Original settings |
| finer_output | Half output spacing, same horizon and solver controls |
| tighter_solver | Both solver tolerances divided by ten; maximum internal time step halved |
| longer_horizon | Twice the horizon with the original output spacing |
numerically_resolved requires all runs to yield delays, relative delay changes within
delay_relative_tolerance, and all conservation checks to pass. Agreement on a discrete
grid is not a statistical error bar: also report the output spacing. The baseline samples
must be between 11 and 50000, leaving room for refinement. Runtime grows with mechanism
size, stiffness, and the chosen horizon; integration failures retain Cantera's error text.
Outputs and checks
report.json: all input settings, package versions, configuration and mechanism hashes, normalized starting composition, four delay estimates, numerical changes, conservation, and mechanism thermodynamic temperature bounds.baseline.csv,finer_output.csv,tighter_solver.csv,longer_horizon.csv: time, temperature, pressure, volume, mass, total internal energy, total enthalpy, and requested species mole fractions.mechanism.yaml: a Cantera-written snapshot of the loaded phase, species, and reactions. The helper requestswrite_yaml(precision=17)and saves the exact UTF-8 bytes it hashes, without platform newline conversion. The report also hashes the located original mechanism file. Imported source dependencies are not separately hashed; the snapshot captures the loaded model. Its generated header includes a date, so the snapshot hash identifies the saved artifact and need not match between otherwise identical reruns.
Closed reactors conserve mass and elemental mass fractions. The constant-volume case
checks total internal energy; the constant-pressure case checks total enthalpy. Energy
error is divided by max(abs(initial_energy_J), 1 J). Diagnostic tolerances are mass
relative drift <1e-8, elemental absolute drift <1e-8, energy scaled drift <1e-6, species
mass-fraction sum error <1e-8, and species mass fractions >-1e-10. These checks expose
numerical issues and do not measure kinetic-model uncertainty.
Check within_thermo_temperature_range separately: it checks saved output states, not
every internal integration state. Numerical resolution does not mean species thermodynamic
fits stayed within their temperature bounds. The helper cannot assess pressure-dependent
kinetic validity from these bounds.
Scope and upstream references
The suite covers both reactor constraints, conservation, final-state agreement with independent Cantera equilibrium, nonigniting conditions, unresolved boundary maxima, refinement, snapshot replay, and invalid composition/conditions. It does not validate shock-tube heat loss, real-gas effects, surfaces, flow devices, flames, or multistage experimental ignition definitions. Build those models only with the necessary physics and their own checks; do not relabel this helper's result as one of them.
Upstream ignition example uses a species mass-fraction peak; its delay definition differs from this helper's dT/dt peak.
Files
- ATTRIBUTION.mdAdded by AutoGineer907 B
- LICENSELicence file added by AutoGineer1.0 KiB
- SKILL.md8.4 KiB
- assets/hydrogen-ignition.json416 B
- references/interpretation.md3.2 KiB
- scripts/ignition_delay.pyScript10.5 KiB
references/interpretation.md
Model selection and ignition interpretation
Match the observable
A maximum in dT/dt, a maximum in OH mole fraction, an OH* chemiluminescence onset, a fixed temperature rise, and a pressure-based delay are different observables. The helper implements only the global maximum dT/dt, guarded by a specified temperature rise. Tracked species are exported to support inspection; their maxima do not silently replace the configured definition. OH and excited OH* are distinct species and may not both exist in the mechanism.
For a species-based delay, specify mole fraction (X) or mass fraction (Y): their
peaks can differ as mixture molecular weight changes. The linked upstream shock-tube
example uses the maximum species mass fraction, while this helper exports mole fractions
and determines delay only from temperature.
Two-stage ignition may have an early weak heat-release peak and a later stronger one. The global-maximum definition selects the strongest heating peak in the modeled horizon. If the user needs first-stage delay, define and validate a separate event detector and report both. Extending the horizon can change which peak is largest; the automatic longer-horizon run checks this possibility but cannot prove no later event exists.
Numerical diagnosis
An interior derivative maximum can still be sampled coarsely. Inspect peak width, compare the finer output grid, and increase samples until the uncertainty is adequate for the intended comparison. Internal solver tolerance and output sampling are distinct: a tightly integrated trajectory can yield a poorly located derivative on a coarse output grid. The tighter-solver run also halves the allowed internal time step; its comparison therefore tests those controls together.
Unreached temperature rise means only that the threshold was not observed in this model and horizon. It does not establish nonflammability, an infinite physical delay, or a lower bound under a different ignition definition. Review conditions and extend the horizon when scientifically justified.
Species thermochemistry extrapolation can produce smooth numerical trajectories. Check the reported thermodynamic temperature interval and the mechanism's original kinetic validation sources. Small mass, energy, and element residuals do not detect a poor reaction mechanism, missing pathways, incorrect third-body efficiencies, or a wrong composition basis.
Model boundaries
The helper assumes initially 1 m3, closed adiabatic walls, ideal-gas behavior, homogeneous composition, and no reacting surfaces. Homogeneous ignition time is independent of this arbitrary initial volume in the modeled system; extensive energies and mass scale with it. Constant-pressure volume expansion is allowed, so its conserved energy is enthalpy. Constant-volume pressure rises, so comparison with a nominal constant-pressure experiment requires a different reactor setting.
Shock tubes, rapid compression machines, and engines may need measured volume histories, heat transfer, facility effects, or nonideal equations of state. Those are physics changes, not tolerance adjustments. Use the appropriate upstream reactor class or customized model and verify the additional terms before interpreting agreement with an experiment.
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs Python
The author says: Requires Python 3.12-3.14, Cantera 3.2.0, and NumPy. Installation needs network access; simulations run locally without credentials. Custom mechanisms must be available as Cantera YAML files.
Security
What our scanner noticed· Low risk
- Scripts that your agent may run
This skill includes scripts that your agent may run. Read them before you use it.
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Created by
- K-Dense Inc.
- Publisher
- K-Dense (Community)
- Source
- K-Dense-AI/scientific-agent-skills · skills/cantera · commit a25cf9e
- Licence
- MIT License (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE.md)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by K-Dense Inc. or K-Dense.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download cantera.zip