Cantera examples in the form of Jupyter notebooks. To see the rendered notebooks, browse the directories above or visit the links in the list of examples below. If you want to execute the examples on your own computer, please see the installation instructions below. If you would only like to run the examples in the cloud, click the MyBinder link below (note that your changes on MyBinder won't be saved unless you download the changed files from there).
While the examples here are still valid for Cantera 3.0, for Cantera 3.1, all of these examples have been migrated into the main repository as pure Python scripts that are then rendered by Sphinx Gallery. You can see the gallery of Python examples for the current development version of Cantera at https://cantera.org/dev/examples/python/index.html.
If you would like to contribute a new Cantera example, please write it as a pure Python example like those in https://github.com/Cantera/cantera/tree/main/samples/python and open a Pull Request to the main Cantera repository. This repository will be archived after the release of Cantera 3.1.
Freely Propagating Flame |
Strained Flames |
Continuous Stirred Tank Reactor |
Batch Reactor |
Li+ Battery OCV Calculation |
-
Basic Thermodynamics Calculations
-
Flame Simulations
-
Reactor Models
-
Electrochemistry
If you don't already have Cantera installed, refer to the instructions on the Cantera website.
If you used Conda to install Cantera (the recommended method), you will need to install Jupyter Lab into the same environment where you installed Cantera.
-
Activate the environment with the Cantera package (called
cantera
here):conda activate cantera
-
Install Jupyter Notebook into that environment
conda install jupyterlab
-
Run Jupyter Lab, which will open a browser window
jupyter lab
Otherwise, use pip
to install the Jupyter Notebook:
python -m pip install jupyterlab
Option 1: Download the zip file from GitHub and extract it to a convenient location on your computer.
Option 2: Use Git to clone this repository to a convenient location on your computer
git clone https://github.com/Cantera/cantera-jupyter.git
This repository follows the same code of conduct as the main Cantera repository. Cantera adheres to a code of conduct adapted from the Contributor Covenant code of conduct.
How do I use Cantera with Python?
An introduction to the Cantera Python interface is available here. For more advanced uses of Cantera, the complete documentation can be found here.
Can I forgo installing Cantera locally and just use Cantera in the cloud every time?
The problem with using Cantera with MyBinder is that there is no way for you to save your work. You can upload/download files in a session, but once the session is over (you close your browser window), you lose all your work. You thus cannot save your modified Jupyter notebooks.
I still can't figure something out. Who do I ask?
If you have more questions, need help with something, or have any suggestions, please visit the Cantera Google Groups Page and create a post.