Sharedsupport / 2016-04-14-cantera.ipynbOpen in CoCalc
Author: William A. Stein
License: GNU General Public License v3.0
Description: Examples for support purposes.

Using Cantera in SageMathCloud

Critical: You must use the "Python 2 (Ubuntu, plain)" Jupyter kernel!

See http://www.cantera.org/docs/sphinx/html/cython/tutorial.html for a tutorial about the Python bindings.

In [1]:
import cantera as ct
In [2]:
gas1 = ct.Solution('gri30.xml')
In [3]:
gas1()
gri30: temperature 300 K pressure 101325 Pa density 0.0818891 kg/m^3 mean mol. weight 2.01588 amu 1 kg 1 kmol ----------- ------------ enthalpy 26470 5.336e+04 J internal energy -1.2109e+06 -2.441e+06 J entropy 64914 1.309e+05 J/K Gibbs function -1.9448e+07 -3.92e+07 J heat capacity c_p 14312 2.885e+04 J/K heat capacity c_v 10187 2.054e+04 J/K X Y Chem. Pot. / RT ------------- ------------ ------------ H2 1 1 -15.7173 [ +52 minor] 0 0
In [4]:
gas1.TP = 1200, 101325
In [5]:
gas1()
gri30: temperature 1200 K pressure 101325 Pa density 0.0204723 kg/m^3 mean mol. weight 2.01588 amu 1 kg 1 kmol ----------- ------------ enthalpy 1.3296e+07 2.68e+07 J internal energy 8.3462e+06 1.682e+07 J entropy 85228 1.718e+05 J/K Gibbs function -8.8978e+07 -1.794e+08 J heat capacity c_p 15378 3.1e+04 J/K heat capacity c_v 11253 2.269e+04 J/K X Y Chem. Pot. / RT ------------- ------------ ------------ H2 1 1 -17.9775 [ +52 minor] 0 0
In [ ]: