From charlesreid1

(Created page with "Some scattered notes on Cantera gas objects. For a multicomponent mixture of gas containing N components, the thermochemical state of the gas can be specified by specifying N+1 ...")
 
No edit summary
Line 1: Line 1:
Some scattered notes on Cantera gas objects.
Some scattered notes on Cantera gas objects.
=Specifying Thermochemical State=


For a multicomponent mixture of gas containing N components, the thermochemical state of the gas can be specified by specifying N+1 thermodynamic variables.  
For a multicomponent mixture of gas containing N components, the thermochemical state of the gas can be specified by specifying N+1 thermodynamic variables.  
Line 26: Line 28:
g.set(P=OneAtm, Rho=0.10)
g.set(P=OneAtm, Rho=0.10)
</source>
</source>
=Code=
==Python Interface==
The Python interface implements the set() method in the following file:
<code>/path/to/cantera/interfaces/python/Cantera/set.py</code>
The set() method is a wrapper function to methods that individually set thermodynamic property, like setTemperature() or setDensity().


[[Category:Cantera]]
[[Category:Cantera]]

Revision as of 22:32, 22 January 2014

Some scattered notes on Cantera gas objects.

Specifying Thermochemical State

For a multicomponent mixture of gas containing N components, the thermochemical state of the gas can be specified by specifying N+1 thermodynamic variables.

The gas state can be specified using the set method, which takes a couple of keywords for specifying which variable you wish to set. The following parameters are mass-specific, meaning they are specified per unit mass:

  • Pressure P
  • Temperature T
  • Specific volume V
  • Mass density Rho
  • Mass fractions Y
  • Mole fractions X
  • Enthalpy H
  • Entropy S
  • Internal energy U

(Note that if composition is not specified, it remains unchanged.)

These keywords can be used with the phase set method,

from Cantera import *

g = GRI30()

g.set(X="H2:1.0, CO2:3.0", T=298.15, P=OneAtm)
g.set(P=OneAtm, Rho=0.10)

Code

Python Interface

The Python interface implements the set() method in the following file:

/path/to/cantera/interfaces/python/Cantera/set.py

The set() method is a wrapper function to methods that individually set thermodynamic property, like setTemperature() or setDensity().