Python Interface

The Python API provides a convenient way to interact with the program through Python, while maintaining the performance of the underlying Fortran code. No unit conversions are performed by default; inputs and outputs are in the documented CEA units, and users are responsible for converting as needed. Use the conversion factors in cea.units when working across unit systems.

Mixture

The Mixture class is used to define a mixture of product or reactant species. It allows the user to specify the composition of the mixture and provides methods to compute thermodynamic curve fit properties. The instances of this class are then passed as inputs to the available solver classes (e.g., EqSolver, RocketSolver, ShockSolver, or DetonationSolver).

class cea.Mixture
species_names

Get list of species names in the mixture.

Returns:

Species names

Return type:

list of str

EqSolver

class cea.EqSolver
max_equations

Maximum number of equations in system; num_elements + num_condensed + (1 for TP/TV problems, 2 otherwise).

Returns:

Maximum equations

Return type:

int

num_condensed

Number of condensed phase species.

Returns:

Number of condensed species

Return type:

int

num_elements

Number of chemical elements.

Returns:

Number of elements

Return type:

int

num_gas

Number of gas phase species.

Returns:

Number of gas species

Return type:

int

num_products

Number of product species.

Returns:

Number of products

Return type:

int

num_reactants

Number of reactant species.

Returns:

Number of reactants

Return type:

int

EqSolution

class cea.EqSolution
M

Molecular weight, gasses only (1/n).

Returns:

Molecular weight (1/n)

Return type:

float

MW

Molecular weight, including condensed species.

Returns:

Molecular weight

Return type:

float

P

Pressure in bar.

Returns:

Pressure

Return type:

float

Pr_eq

Equilibrium Prandtl number.

Returns:

Equilibrium Prandtl number

Return type:

float

Pr_fr

Frozen Prandtl number.

Returns:

Frozen Prandtl number

Return type:

float

T

Temperature in K.

Returns:

Temperature

Return type:

float

conductivity_eq

Equilibrium thermal conductivity in mu W/(cm·K).

Returns:

Equilibrium thermal conductivity

Return type:

float

conductivity_fr

Frozen thermal conductivity in mu W/(cm·K).

Returns:

Frozen thermal conductivity

Return type:

float

converged

Convergence status of the solution.

Returns:

True if solution converged, False otherwise

Return type:

bool

cp

Equilibrium specific heat at constant pressure in kJ/(kg·K).

Returns:

Equilibrium cp (alias for cp_eq)

Return type:

float

cp_eq

Equilibrium specific heat at constant pressure in kJ/(kg·K).

Returns:

Equilibrium cp

Return type:

float

cp_fr

Frozen specific heat at constant pressure in kJ/(kg·K).

Returns:

Frozen cp

Return type:

float

cv

Equilibrium specific heat at constant volume in kJ/(kg·K).

Returns:

Equilibrium Cv (alias for cv_eq)

Return type:

float

cv_eq

Equilibrium specific heat at constant volume in kJ/(kg·K).

Returns:

Equilibrium cv

Return type:

float

cv_fr

Frozen specific heat at constant volume in kJ/(kg·K).

Returns:

Frozen cv

Return type:

float

density

Density in kg/m³.

Returns:

Density

Return type:

float

energy

Specific internal energy in kJ/kg.

Returns:

Specific internal energy

Return type:

float

enthalpy

Specific enthalpy in kJ/kg.

Returns:

Specific enthalpy

Return type:

float

entropy

Specific entropy in kJ/(kg·K).

Returns:

Specific entropy

Return type:

float

gamma_s

Isentropic specific heat ratio.

Returns:

Specific heat ratio

Return type:

float

gibbs_energy

Specific Gibbs energy in kJ/kg.

Returns:

Specific Gibbs energy

Return type:

float

ln_nj

Natural logarithm of gas phase species concentrations (gasses only). NOTE: ln_nj /= log(nj) because nj is truncated for trace species, while ln_nj preserves small amounts.

Returns:

Log concentrations for gas species

Return type:

np.ndarray

mass_fractions

Species mass fractions.

Returns:

Dictionary mapping species names to mass fractions

Return type:

dict

mole_fractions

Species mole fractions.

Returns:

Dictionary mapping species names to mole fractions

Return type:

dict

n

Total moles.

Returns:

Total moles

Return type:

float

nj

Species concentrations (kg-mol of species j per kg of mixture).

Returns:

Concentrations for each species

Return type:

np.ndarray

viscosity

Viscosity in micropoise (mu P).

Returns:

Viscosity

Return type:

float

volume

Specific volume in m³/kg.

Returns:

Specific volume

Return type:

float

RocketSolver

class cea.RocketSolver
num_condensed

Number of condensed phase species.

Returns:

Number of condensed species

Return type:

int

num_elements

Number of chemical elements.

Returns:

Number of elements

Return type:

int

num_gas

Number of gas phase species.

Returns:

Number of gas species

Return type:

int

num_products

Number of product species.

Returns:

Number of products

Return type:

int

num_reactants

Number of reactant species.

Returns:

Number of reactants

Return type:

int

RocketSolution

class cea.RocketSolution
Isp

Specific impulse at each station in m/s.

Returns:

Specific impulse array

Return type:

np.ndarray

Isp_vacuum

Vacuum specific impulse at each station in m/s.

Returns:

Vacuum specific impulse array

Return type:

np.ndarray

M

Molecular weight (1/n) (gasses only) at each station.

Returns:

Molecular weight array

Return type:

np.ndarray

MW

Molecular weight (including condensed species) at each station.

Returns:

Molecular weight array

Return type:

np.ndarray

Mach

Mach number at each station.

Returns:

Mach number array

Return type:

np.ndarray

P

Pressure at each station in bar.

Returns:

Pressure array

Return type:

np.ndarray

Pr_eq

Equilibrium Prandtl number.

Returns:

Equilibrium Prandtl number

Return type:

float

Pr_fr

Frozen Prandtl number.

Returns:

Frozen Prandtl number

Return type:

float

T

Temperature at each station in K.

Returns:

Temperature array

Return type:

np.ndarray

ae_at

Area ratio (Ae/At) at each station.

Returns:

Area ratio array

Return type:

np.ndarray

c_star

Characteristic velocity in m/s.

Returns:

Characteristic velocity array

Return type:

np.ndarray

coefficient_of_thrust

Thrust coefficient at each station.

Returns:

Thrust coefficient array

Return type:

np.ndarray

conductivity_eq

Equilibrium thermal conductivity in mu W/(cm·K).

Returns:

Equilibrium thermal conductivity

Return type:

float

conductivity_fr

Frozen thermal conductivity in mu W/(cm·K).

Returns:

Frozen thermal conductivity

Return type:

float

converged

Convergence status of the solution.

Returns:

True if solution converged, False otherwise

Return type:

bool

cp

Equilibrium specific heat at constant pressure in kJ/(kg·K).

Returns:

Equilibrium cp array (alias for cp_eq)

Return type:

np.ndarray

cp_eq

Equilibrium specific heat at constant pressure in kJ/(kg·K).

Returns:

Equilibrium cp array

Return type:

np.ndarray

cp_fr

Frozen specific heat at constant pressure in kJ/(kg·K).

Returns:

Frozen cp array

Return type:

np.ndarray

cv

Equilibrium specific heat at constant volume in kJ/(kg·K).

Returns:

Equilibrium cv array (alias for cv_eq)

Return type:

np.ndarray

cv_eq

Equilibrium specific heat at constant volume in kJ/(kg·K).

Returns:

Equilibrium cv array

Return type:

np.ndarray

cv_fr

Frozen specific heat at constant volume in kJ/(kg·K).

Returns:

Frozen cv array

Return type:

np.ndarray

density

Density at each station in kg/m³.

Returns:

Density array

Return type:

np.ndarray

energy

Specific internal energy at each station in kJ/kg.

Returns:

Specific internal energy array

Return type:

np.ndarray

enthalpy

Specific enthalpy at each station in kJ/kg.

Returns:

Specific enthalpy array

Return type:

np.ndarray

entropy

Specific entropy at each station in kJ/(kg·K).

Returns:

Specific entropy array

Return type:

np.ndarray

gamma_s

Isentropic exponent gamma_s at each station.

Returns:

Isentropic exponent gamma_s array

Return type:

np.ndarray

gibbs_energy

Specific Gibbs energy at each station in kJ/kg.

Returns:

Specific Gibbs energy array

Return type:

np.ndarray

ln_nj

Natural logarithm of gas phase species concentrations at each station (gasses only). NOTE: ln_nj /= log(nj) because nj is truncated for trace species, while ln_nj preserves small amounts.

Returns:

2D array of log concentrations (stations × gas species)

Return type:

np.ndarray

mass_fractions

Species mass fractions at each station.

Returns:

Dictionary mapping species names to 2D arrays (stations × species)

Return type:

dict

mole_fractions

Species mole fractions at each station.

Returns:

Dictionary mapping species names to 2D arrays (stations × species)

Return type:

dict

n

Total moles at each station.

Returns:

Total moles array

Return type:

np.ndarray

nj

Species concentrations (kg-mol of species j per kg of mixture) at each station.

Returns:

2D array of concentrations (stations × species)

Return type:

np.ndarray

num_pts

Number of calculation points (stations).

Returns:

Number of stations

Return type:

int

sonic_velocity

Sonic velocity at each station in m/s.

Returns:

Sonic velocity array

Return type:

np.ndarray

viscosity

Viscosity in millipoise (mu P).

Returns:

Viscosity

Return type:

float

volume

Specific volume at each station in m³/kg.

Returns:

Specific volume array

Return type:

np.ndarray

ShockSolver

class cea.ShockSolver
num_condensed

Number of condensed phase species.

Returns:

Number of condensed species

Return type:

int

num_elements

Number of chemical elements.

Returns:

Number of elements

Return type:

int

num_gas

Number of gas phase species.

Returns:

Number of gas species

Return type:

int

num_products

Number of product species.

Returns:

Number of products

Return type:

int

num_reactants

Number of reactant species.

Returns:

Number of reactants

Return type:

int

ShockSolution

class cea.ShockSolution
M

Molecular weight (1/n) at each shock state.

Returns:

Molecular weight (1/n) array [initial, incident, reflected (if applicable)]

Return type:

np.ndarray

M21

Mach number ratio across the incident shock (M2/M1).

Returns:

Mach number ratio across the incident shock

Return type:

float

M52

Mach number ratio across the reflected shock (M5/M2).

Returns:

Mach number ratio across the reflected shock

Return type:

float

MW

Molecular weight (including condensed species) at each shock state in kg/kmol.

Returns:

Molecular weight array [initial, incident, reflected (if applicable)]

Return type:

np.ndarray

Mach

Mach number at each shock state.

Returns:

Mach number array [initial, incident, reflected (if applicable)]

Return type:

np.ndarray

P

Pressure at each shock state in bar.

Returns:

Pressure array [initial, incident, reflected (if applicable)]

Return type:

np.ndarray

P21

Pressure ratio across the incident shock (P2/P1).

Returns:

Pressure ratio across the incident shock

Return type:

float

P52

Pressure ratio across the reflected shock (P5/P2).

Returns:

Pressure ratio across the reflected shock

Return type:

float

Pr_eq

Equilibrium Prandtl number at each shock state.

Returns:

Equilibrium Prandtl number array [initial, incident, reflected (if applicable)]

Return type:

np.ndarray

Pr_fr

Frozen Prandtl number at each shock state.

Returns:

Frozen Prandtl number array [initial, incident, reflected (if applicable)]

Return type:

np.ndarray

T

Temperature at each shock state in K.

Returns:

Temperature array [initial, incident, reflected (if applicable)]

Return type:

np.ndarray

T21

Temperature ratio across the incident shock (T2/T1).

Returns:

Temperature ratio across the incident shock

Return type:

float

T52

Temperature ratio across the reflected shock (T5/T2).

Returns:

Temperature ratio across the reflected shock

Return type:

float

conductivity_eq

Equilibrium thermal conductivity at each shock state in mu W/(cm·K).

Returns:

Equilibrium thermal conductivity array [initial, incident, reflected (if applicable)]

Return type:

np.ndarray

conductivity_fr

Frozen thermal conductivity at each shock state in mu W/(cm·K).

Returns:

Frozen thermal conductivity array [initial, incident, reflected (if applicable)]

Return type:

np.ndarray

converged

Convergence status of the solution.

Returns:

True if solution converged, False otherwise

Return type:

bool

cp

Equilibrium specific heat at constant pressure at each shock state in kJ/(kg·K).

Returns:

Equilibrium C_p array (alias for cp_eq) [initial, incident, reflected (if applicable)]

Return type:

np.ndarray

cp_eq

Equilibrium specific heat at constant pressure at each shock state in kJ/(kg·K).

Returns:

Equilibrium C_p array [initial, incident, reflected (if applicable)]

Return type:

np.ndarray

cp_fr

Frozen specific heat at constant pressure at each shock state in kJ/(kg·K).

Returns:

Frozen C_p array [initial, incident, reflected (if applicable)]

Return type:

np.ndarray

cv

Equilibrium specific heat at constant volume at each shock state in kJ/(kg·K).

Returns:

Equilibrium C_v array (alias for cv_eq) [initial, incident, reflected (if applicable)]

Return type:

np.ndarray

cv_eq

Equilibrium specific heat at constant volume at each shock state in kJ/(kg·K).

Returns:

Equilibrium C_v array [initial, incident, reflected (if applicable)]

Return type:

np.ndarray

cv_fr

Frozen specific heat at constant volume at each shock state in kJ/(kg·K).

Returns:

Frozen C_v array [initial, incident, reflected (if applicable)]

Return type:

np.ndarray

density

Density at each shock state in kg/m³.

Returns:

Density array [initial, incident, reflected (if applicable)]

Return type:

np.ndarray

energy

Specific internal energy at each shock state in kJ/kg.

Returns:

Specific internal energy array [initial, incident, reflected (if applicable)]

Return type:

np.ndarray

enthalpy

Specific enthalpy at each shock state in kJ/kg.

Returns:

Specific enthalpy array [initial, incident, reflected (if applicable)]

Return type:

np.ndarray

entropy

Specific entropy at each shock state in kJ/(kg·K).

Returns:

Specific entropy array [initial, incident, reflected (if applicable)]

Return type:

np.ndarray

gamma_s

Isentropic exponent gamma_s at each shock state.

Returns:

Isentropic exponent gamma_s array [initial, incident, reflected (if applicable)]

Return type:

np.ndarray

gibbs_energy

Gibbs energy at each shock state in kJ/kg.

Returns:

Gibbs energy array [initial, incident, reflected (if applicable)]

Return type:

np.ndarray

ln_nj

Natural logarithm of gas phase species concentrations at each station (gasses only). NOTE: ln_nj /= log(nj) because nj is truncated for trace species, while ln_nj preserves small amounts.

Returns:

2D array of log concentrations (index × gas species)

Return type:

np.ndarray

mass_fractions

Species mass fractions at each station.

Returns:

Dictionary mapping species names to 2D arrays (index × species)

Return type:

dict

mole_fractions

Species mole fractions at each station.

Returns:

Dictionary mapping species names to 2D arrays (index × species)

Return type:

dict

n

Total moles at each station.

Returns:

Total moles array

Return type:

np.ndarray

nj

Species concentrations (kg-mol of species j per kg of mixture) at each index.

Returns:

2D array of concentrations (index × species)

Return type:

np.ndarray

rho12

Density ratio across the incident shock (ρ2/ρ1).

Returns:

Density ratio across the incident shock

Return type:

float

rho52

Density ratio across the reflected shock (ρ5/ρ2).

Returns:

Density ratio across the reflected shock

Return type:

float

sonic_velocity

Sonic velocity at each shock state in m/s.

Returns:

Sonic velocity array [initial, incident, reflected (if applicable)]

Return type:

np.ndarray

u5_p_v2

Velocity of the reflected shock wave in m/s.

Returns:

u5 + v2

Return type:

float

v2

Velocity at the incident shock state in m/s.

Returns:

Velocity at the incident shock state

Return type:

float

velocity

Velocity at each shock state in m/s.

Returns:

Velocity array [initial, incident, reflected (if applicable)]

Return type:

np.ndarray

viscosity

Viscosity at each shock state in micropoise (mu P).

Returns:

Viscosity array [initial, incident, reflected (if applicable)]

Return type:

np.ndarray

volume

Specific volume at each shock state in m³/kg.

Returns:

Specific volume array [initial, incident, reflected (if applicable)]

Return type:

np.ndarray

DetonationSolver

class cea.DetonationSolver
num_condensed

Number of condensed phase species.

Returns:

Number of condensed species

Return type:

int

num_elements

Number of chemical elements.

Returns:

Number of elements

Return type:

int

num_gas

Number of gas phase species.

Returns:

Number of gas species

Return type:

int

num_products

Number of product species.

Returns:

Number of products

Return type:

int

num_reactants

Number of reactant species.

Returns:

Number of reactants

Return type:

int

DetonationSolution

class cea.DetonationSolution
H1

Initial specific enthalpy in kJ/kg.

Returns:

Enthalpy

Return type:

float

M

Molecular weight (1/n) (gasses only) of detonation products in kg/kmol.

Returns:

Molecular weight of detonation products

Return type:

float

M1

Initial molecular weight (1/n).

Returns:

Molecular weight

Return type:

float

MW

Molecular weight (including condensed species) of detonation products in kg/kmol.

Returns:

Molecular weight of detonation products including condensed species

Return type:

float

M_M1

Molecular weight ratio M/M1.

Returns:

Molecular weight ratio of detonation products to initial molecular weight

Return type:

float

Mach

Detonation Mach number.

Returns:

Mach number of the detonation wave

Return type:

float

P

Detonation pressure in bar.

Returns:

Pressure of detonation products

Return type:

float

P1

Initial pressure in bar.

Returns:

Pressure

Return type:

float

P_P1

Pressure ratio P/P1.

Returns:

Pressure ratio of detonation products to initial pressure

Return type:

float

Pr_eq

Equilibrium Prandtl number.

Returns:

Equilibrium Prandtl number

Return type:

float

Pr_fr

Frozen Prandtl number.

Returns:

Frozen Prandtl number

Return type:

float

T

Detonation temperature in K.

Returns:

Temperature of detonation products

Return type:

float

T1

Initial temperature in K.

Returns:

Temperature

Return type:

float

T_T1

Temperature ratio T/T1.

Returns:

Temperature ratio of detonation products to initial temperature

Return type:

float

conductivity_eq

Equilibrium thermal conductivity in mu W/(cm·K).

Returns:

Equilibrium thermal conductivity

Return type:

float

conductivity_fr

Frozen thermal conductivity in mu W/(cm·K).

Returns:

Frozen thermal conductivity

Return type:

float

converged

Convergence status of the solution.

Returns:

True if solution converged, False otherwise

Return type:

bool

cp_eq

Equilibrium specific heat at constant pressure in kJ/(kg·K).

Returns:

Equilibrium specific heat at constant pressure

Return type:

float

cp_fr

Frozen specific heat at constant pressure in kJ/(kg·K).

Returns:

Frozen specific heat at constant pressure

Return type:

float

cv_eq

Equilibrium specific heat at constant volume in kJ/(kg·K).

Returns:

Equilibrium specific heat at constant volume

Return type:

float

cv_fr

Frozen specific heat at constant volume in kJ/(kg·K).

Returns:

Frozen specific heat at constant volume

Return type:

float

density

Detonation density in kg/m³.

Returns:

Density of detonation products

Return type:

float

energy

Detonation specific internal energy in kJ/kg.

Returns:

Specific internal energy of detonation products

Return type:

float

enthalpy

Detonation specific enthalpy in kJ/kg.

Returns:

Specific enthalpy of detonation products

Return type:

float

entropy

Detonation specific entropy in kJ/(kg·K).

Returns:

Specific entropy of detonation products

Return type:

float

gamma1

Initial isentropic exponent gamma_1.

Returns:

Isentropic exponent

Return type:

float

gamma_s

Detonation isentropic exponent gamma_s.

Returns:

Isentropic exponent of the detonation products

Return type:

float

gibbs_energy

Detonation Gibbs energy in kJ/kg.

Returns:

Gibbs energy of detonation products

Return type:

float

ln_nj

Natural logarithm of gas phase species concentrations (gasses only). NOTE: ln_nj /= log(nj) because nj is truncated for trace species, while ln_nj preserves small amounts.

Returns:

Log concentrations for gas species

Return type:

np.ndarray

mass_fractions

Species mass fractions.

Returns:

Dictionary mapping species names to mass fractions

Return type:

dict

mole_fractions

Species mole fractions.

Returns:

Dictionary mapping species names to mole fractions

Return type:

dict

n

Total moles.

Returns:

Total moles

Return type:

float

nj

Species concentrations (kg-mol of species j per kg of mixture).

Returns:

Concentrations for each species

Return type:

np.ndarray

rho_rho1

Density ratio ρ/ρ1.

Returns:

Density ratio of detonation products to initial density

Return type:

float

sonic_velocity

Detonation sonic velocity in m/s.

Returns:

Sonic velocity of the detonation products

Return type:

float

sonic_velocity1

Initial sonic velocity in m/s.

Returns:

Sonic velocity

Return type:

float

velocity

Detonation velocity in m/s.

Returns:

Velocity of the detonation wave

Return type:

float

viscosity

Viscosity in micropoise (mu P).

Returns:

Viscosity

Return type:

float