QuickStart¶
Note
Python 3.8 and 3.9 on Windows have been problematic and are not fully supported.
Python 3.8 64 bit and 3.9 64 bit on Windows has been made to work by using the new os.add_dll_directory command to locate MinGW DLL libraries, however, 32 bit python 3.8 and 3.9 are not yet supported.
Install Numpy & Matplotlib¶
Because RocketCEA depends on f2py to compile the FORTRAN NASA CEA code and f2py is part of numpy , numpy will need to be installed.
RocketCEA also makes use of the matplotlib package for creating plots.
To install numpy and matplotlib, give the commands:
pip install numpy
pip install matplotlib
OR perhaps...
pip install --upgrade numpy
pip install --upgrade matplotlib
Some Linux systems may require:
sudo pip install numpy
sudo pip install matplotlib
Install Compiler¶
Using f2py to compile FORTRAN requires a FORTRAN compiler. I recommend using gfortran on all platforms so that there are no FORTRAN incompatibilities between platforms.
Each operating system has its own approach to install gfortran
Click: Install gfortran to see install instructions for a few platforms that I have tested.
Important
Windows users MUST put MinGW into environment PATH variable. (see: Windows PATH)
C:MinGWmingw64bin OR C:MinGWmingw32bin
and
C:MinGWmingw64lib OR C:MinGWmingw32lib
Install RocketCEA¶
After the above installs have been accomplished, the easiest way to install RocketCEA is:
pip install rocketcea
OR on Linux
sudo pip install rocketcea
OR perhaps
pip install --user rocketcea
Try a quick test of the install by pasting the following into a command terminal:
python -c "from rocketcea.cea_obj import CEA_Obj; C=CEA_Obj(oxName='LOX', fuelName='LH2'); print(C.get_Isp())"
should result in:
374.30361765576265
Windows Batch File¶
RockeCEA on Windows can be problematic. Often the problem is in the PATH environment variable where the wrong files are found for the intended install, and even more often it is because the proper compiler build tools are not available.
The Windows batch file below addresses both of those problems.
For compile issues, the batch file uses pipwin. This means that you need to trust Unofficial Windows Binaries for Python Extension Packages.
The batch file makes the PATH as simple as possible so that only the 64 bit MinGW files and desired python files are found.
Note that the batch file assumes that python 3.8 64 bit is the python version installed at D:\Python38_64 and that MinGW 64 bit is installed at C:\MinGW\mingw64\bin and C:\MinGW\mingw64\lib. You will need to edit the batch file for your situation.
Note that it also uninstalls rocketcea in case bad files are left from previous attempts.
You will need to edit the hard-coded paths to your own location of python and MinGW.
Copy and paste the batch file code below into an editor
Edit the hard-coded paths to your own location of python and MinGW (i.e. change D:\Python38_64 and C:\MinGW\mingw64)
Save the file to D:\Python38_64\RUN_SETUP_BUILD_WIN64.BAT (or your python directory)
Open a command prompt terminal and navigate to that directory, for example “cd D:\Python38_64”
Give the command RUN_SETUP_BUILD_WIN64.BAT
rem =============== RUN_SETUP_BUILD_WIN64.BAT ================
rem set python path variable (Default is Python 3.8 64 bit)
SET "MYPYTHONPATH=D:\Python38_64"
rem Make sure that PATH is as simple as possible
set PATH=C:\MinGW\mingw64\bin;C:\MinGW\mingw64\lib;%MYPYTHONPATH%;%MYPYTHONPATH%\Scripts
pip uninstall -y rocketcea
pip install pipwin
pipwin install future
pipwin install numpy
pipwin install scipy
pipwin install kiwisolver
pipwin install pillow
pipwin install matplotlib
pip install rocketcea
rem Test the compiled module
python -c "from rocketcea.cea_obj import CEA_Obj; C=CEA_Obj(oxName='LOX', fuelName='LH2'); print(C.get_Isp())"
Note
If you have already installed some of the packages (e.g. numpy or matplotlib) you may want to comment out those pipwin statements.
Getting Help¶
After installing with pip
, there should be a launch command line program called rocketcea or, on Windows, rocketcea.exe.
From a terminal or command prompt window simply type:
rocketcea
Your browser will launch with these RocketCEA help pages.
Running RocketCEA¶
Any use of RocketCEA begins with an import statement and an instance of CEA_obj:
from rocketcea.cea_obj import CEA_Obj
C = CEA_Obj( oxName='LOX', fuelName='LH2')
In the above example, LOX and LH2 are called out, but any propellants on the Propellants page can be used.
There are a large number of examples included in this document
For instance, look at LOX/LH2 Performance on the Standard Examples page.
To run an example, highlight the source code with your mouse, right click the highlighted code and select Copy. Paste that code into your text editor and save it to a python file.(for example D:\rocketcea\example_1.py).
Example files can be run with the command:
python example1.py
Or, in many text editors hitting the F5 key will execute the code.
Note
RocketCEA is compiled with the mingw and mingw-w64 gfortran compilers using default f2py options giving a “shared” *.pyd file that requires mingw libraries at run time.
If you see the error: Import Error: DLL load failed: The specified module could not be found
You may need to install the MinGW Compiler Suite and perhaps even recompile RocketCEA in order
for RocketCEA to work (see below)
On Windows, make sure the environment PATH variable is set properly (see: Windows PATH)
Test The Install¶
Paste the following code into your text editor and save it to your test folder as basic_cea.py (for example, D:\rocketcea\basic_cea.py):
from rocketcea.cea_obj import CEA_Obj
C = CEA_Obj( oxName='LOX', fuelName='LH2')
for mr in range(2,9):
print(mr, C.get_Isp(Pc=100.0, MR=mr, eps=40.0) )
At the command prompt, give the command:
python basic_cea.py
If you see the following output:
(2, 424.3597085736007)
(3, 445.44434236555196)
(4, 453.13271951921837)
(5, 453.240429182719)
(6, 448.190232998362)
(7, 438.74340042907266)
(8, 424.6998266323161)
Great… you are good to go.
If not, see the information below.
Google Colaboratory¶
If you are having trouble installing RocketCEA on your system, RocketCEA can be run on Google Colaboratory (either python3 or python2).
Colaboratory is a free Jupyter notebook environment that requires no setup and runs entirely in the cloud.
After creating a Colaboratory notebook, install RocketCEA.:
!pip install RocketCEA

If Needed, install libgfortran3:
!apt-get install libgfortran3

Create a python script to run RocketCEA:
%%file chk_cea.py
from rocketcea.cea_obj import CEA_Obj
C = CEA_Obj( oxName='LOX', fuelName='LH2')
for mr in range(2,9):
print(mr, C.get_Isp(Pc=100.0, MR=mr, eps=40.0) )

And then run the file:
!python chk_cea.py

Colab plots work with RocketCEA as well.
