Modernizing a Zero- and Quasi-Dimensional HCCI Engine Simulator: LLM-Assisted Migration from Legacy MATLAB to Python with Combustion Insights from Detailed Kinetics

Legacy combustion simulation codes written in MATLAB or Fortran hold years of validated engineering work, but they are hard to share, tied to commercial licenses, and difficult to connect to modern Python tools. This paper describes engine_simulator, an open-source Python package for zero-dimensional (0D) single-zone and quasi-dimensional (QD) multi-zone simulation of Homogeneous Charge Compression Ignition (HCCI) engines, built by migrating legacy MATLAB code with the help of large language models (LLMs). It documents how the LLMs were used, where they worked well, and where human review was needed. The simulator couples Cantera chemical kinetics with a Woschni wall heat transfer correlation and an Adiabatic Core (AC) phenomenological model fitted to the multi-zone results. With wall heat transfer switched off, the multi-zone and single-zone models agree to every digit reported, as the formulation requires. With it switched on, thermal stratification at 10 zones lowers the peak burn rate by 26% compared with the single-zone model. Going from 10 to 40 zones lowers peak pressure by less than 1.5% but lowers the peak pressure rise rate by 36 to 40%. A 33-species skeletal mechanism and a 312-species gasoline surrogate agree on early phasing once matched, but differ by more than a factor of three in peak burn rate. These results describe the model as built, with an uncalibrated wall heat transfer correlation, and are not measurements of a real engine. The AC model predicts combustion phasing in under a millisecond, with R² from 0.80 to 0.97 on the simulations it was fitted to. The code, a Streamlit GUI, tutorial notebooks, and a 50-test suite are available at https://github.com/prasadshingne/engine_simulator (release v1.0.0, Cantera 3.1.0).

Authors

Publication Details

Journal
Zenodo (CERN European Organization for Nuclear Research)
Published
2026-11-13
DOI
https://doi.org/10.5281/zenodo.24205161
Primary Topic
Advanced Combustion Engine Technologies
Type
preprint
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
NOV
preprint

Modernizing a Zero- and Quasi-Dimensional HCCI Engine Simulator: LLM-Assisted Migration from Legacy MATLAB to Python with Combustion Insights from Detailed Kinetics

Prasad Shingne
Zenodo (CERN European Organization for Nuclear Research)
Advanced Combustion Engine Technologies
preprint

Modernizing a Zero- and Quasi-Dimensional HCCI Engine Simulator: LLM-Assisted Migration from Legacy MATLAB to Python with Combustion Insights from Detailed Kinetics

Prasad Shingne
preprint en

Abstract

Legacy combustion simulation codes written in MATLAB or Fortran hold years of validated engineering work, but they are hard to share, tied to commercial licenses, and difficult to connect to modern Python tools. This paper describes engine_simulator, an open-source Python package for zero-dimensional (0D) single-zone and quasi-dimensional (QD) multi-zone simulation of Homogeneous Charge Compression Ignition (HCCI) engines, built by migrating legacy MATLAB code with the help of large language models (LLMs). It documents how the LLMs were used, where they worked well, and where human review was needed. The simulator couples Cantera chemical kinetics with a Woschni wall heat transfer correlation and an Adiabatic Core (AC) phenomenological model fitted to the multi-zone results. With wall heat transfer switched off, the multi-zone and single-zone models agree to every digit reported, as the formulation requires. With it switched on, thermal stratification at 10 zones lowers the peak burn rate by 26% compared with the single-zone model. Going from 10 to 40 zones lowers peak pressure by less than 1.5% but lowers the peak pressure rise rate by 36 to 40%. A 33-species skeletal mechanism and a 312-species gasoline surrogate agree on early phasing once matched, but differ by more than a factor of three in peak burn rate. These results describe the model as built, with an uncalibrated wall heat transfer correlation, and are not measurements of a real engine. The AC model predicts combustion phasing in under a millisecond, with R² from 0.80 to 0.97 on the simulations it was fitted to. The code, a Streamlit GUI, tutorial notebooks, and a 50-test suite are available at https://github.com/prasadshingne/engine_simulator (release v1.0.0, Cantera 3.1.0).

Zenodo (CERN European Organization for Nuclear Research)
Affordable and clean energy
Advanced Combustion Engine Technologies
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon