Sie sind auf Seite 1von 19

# AE 210 Gasdynamics

Introduction to cantera

Srisha Rao M V

## Department of Aerospace Engineering

Indian Institute of Science (IISc)
Bangalore

## January 15, 2018

Introduction to Outline
cantera

Introduction
Srisha Rao M V About cantera
January 15, 2018 cantera structure
Introduction
How is it relevant?
Using Cantera
Solvers in cantera

Using Cantera
Sample plots to highlight difference
Few important classes
Few useful functions
Importance of equilibrate function
Resources

2
Introduction to Introduction
cantera

Srisha Rao M V
• Cantera is an open-source chemical kinetics software used for solving
January 15, 2018
chemically reacting laminar flows developed by Prof. Dave Goodwin of
Introduction
California Institute of Technology
cantera structure
How is it relevant?
• The source code is written in C++ but it can be used from Python and
Solvers in cantera
Matlab, or in applications written in C++ and Fortran 90
Using Cantera
• More details can be found on Cantera official website
• The instructions to install on various OS can be read on Cantera
Installation Instruction

3
Introduction to Introduction
cantera
cantera structure

Srisha Rao M V

## January 15, 2018

Introduction
cantera structure
How is it relevant?
Solvers in cantera

Using Cantera

## Courtesy: "Introduction to Cantera" by David G. Goodwin, California Institute of Technology

4
Introduction to Introduction
cantera
How is it relevant?

Srisha Rao M V

## January 15, 2018

• One of the essence of this course is to make you familiar with real gas
Introduction effects at least to a certain extent
cantera structure
How is it relevant?
• Real gas effects include variation in thermodynamic properties (like Cp ,
Solvers in cantera
CV etc..) and transport properties (like viscosity)
Using Cantera
• Expect assignments on estimating the deviation of calculated
parameters using ideal gas relations with reference to those using real
gas model.

5
Introduction to Introduction
cantera
Solvers in cantera

## • The element potential ’ChemEquil’ solver

Srisha Rao M V • single-phase solutions.
January 15, 2018
• ”non-stoichiometric” solver (meaning that every intermediate state is a
valid chemical equilibrium state, but does not necessarily satisfy the
Introduction
element constraints)
cantera structure • converge faster
How is it relevant?
Solvers in cantera
• The ’VCS’ chemical equilibrium solver
Using Cantera
• set a mixture containing one or more phases to a state of chemical
equilibrium.
• ”stoichiometric” solver (meaning that every intermediate state satisfies the
element constraints but is not a state of chemical equilibrium)
• It implements the VCS algorithm, described in Smith and Missen,
”Chemical Reaction Equilibrium”.
• robust
You can find a detailed tutorial on "Chemical Reaction Stoichiometry" by Missen & Smith
6
Introduction to Using Cantera
cantera
Sample plots to highlight difference
C p Variation of Air as function of Temperature
1350

## Srisha Rao M V Specific heat capacity at constant pressure [J/kg/K]. 1300

January 15, 2018

1250
Introduction

Using Cantera
Sample plots to 1200
highlight difference
Few important
classes
Few useful functions 1150
Importance of
equilibrate function
Resources
1100

1050

1000
0 1000 2000 3000 4000 5000 6000
Temperature [k]
7
Introduction to Using Cantera
cantera
Sample plots to highlight difference
C v Variation of Air as function of Temperature
1050

## Srisha Rao M V Specific heat capacity at constant volume [J/kg/K]. 1000

January 15, 2018

950
Introduction

Using Cantera
Sample plots to 900
highlight difference
Few important
classes
Few useful functions 850
Importance of
equilibrate function
Resources
800

750

700
0 1000 2000 3000 4000 5000 6000
Temperature [k]
8
Introduction to Using Cantera
cantera
Sample plots to highlight difference
Gamma variation of Air as function of Temperature
1.42

## January 15, 2018

1.38
Introduction
Specific heat ratio

## Using Cantera 1.36

Sample plots to
highlight difference
Few important 1.34
classes
Few useful functions
Importance of
equilibrate function
1.32
Resources

1.3

1.28

1.26
0 1000 2000 3000 4000 5000 6000
Temperature [k]
9
Introduction to Using Cantera
cantera
Few important classes

Solution
Srisha Rao M V

## January 15, 2018

• constructs a Solution object
Introduction • Parameters:
Using Cantera • src – Input string of CTI or
Sample plots to
highlight difference CTML file name. example
Few important
classes • id – ID of the phase to import
Few useful functions gas =Solution(’gri30.cti’, ’gas’)
Importance of as specified in the CTML or CTI
equilibrate function
Resources file.
• trans – String, transport
modeling.
• Returns:
• Instance of class Solution()

10
Introduction to Using Cantera
cantera
Few important classes

Srisha Rao M V
importPhase
January 15, 2018

Introduction
• To import a phase from a CTI file
Using Cantera • Syntax : importPhase(file, name)
example
Sample plots to gas = importPhase(’gas.cti’);
highlight difference
Few important
• Parameters:
classes
Few useful functions • file – CTI file containing phase Note: importPhase is deprecated and may not be accessible
Importance of
equilibrate function definition solution() can be used as an alternative
Resources
• name – Name of the phase
• Returns:
• Instance of class Solution()

11
Introduction to Using Cantera
cantera
Few important classes

## Srisha Rao M V Mixture

January 15, 2018

example
Introduction • mixtures of one or more phases gas = importPhase(’gas.cti’);
Using Cantera
Sample plots to
of matter. graphite =
highlight difference
Few important • Parameters: importPhase(’graphite.cti’);
classes
Few useful functions • phases – Cell array of phases mix = Mixture(gas, 1.0; graphite,
Importance of
equilibrate function
Resources
and mole numbers 0.1);
• Returns:
• Instance of class Mixture()

12
Introduction to Using Cantera
cantera
Few useful functions
To specify gas state
Function set()
Srisha Rao M V

## January 15, 2018 • Pressure P

Introduction • Temperature T
An example of set function
Using Cantera
Sample plots to
• Specific volume V gas1 =
highlight difference
Few important • Mass density Rho importPhase(’Wang_highT.cti’);
classes
Few useful functions
Importance of
• Mass fractions Y set(gas1,’Temperature’,300,
equilibrate function
Resources
• Mole fractions X
’Pressure’,101325,
’MoleFractions’,
• Enthalpy H
’AR:0.0096,O2:0.2095,N2:0.7809’);
• Entropy S
• Internal energy U
Note: All the above parameters are mass-specific.

13
Introduction to To retrive a thermodynamic property Using Cantera
cantera
Few useful functions
Use the corresponding function
To get the following properties
Srisha Rao M V • Pressure P • P = pressure(gas);
January 15, 2018
• Temperature T • T =temperature(gas);
Introduction
• specific heat at constant pressure • Cp = cp_mass(gas);
Using Cantera
Sample plots to • specific heat at constant volume • Cv = cv_mass(gas);
highlight difference
Few important
classes • Mass fractions Y • Y = massFractions(gas);
Few useful functions
Importance of
equilibrate function • Mole fractions X • X = moleFractions(gas);
Resources

## • Specific enthalpy h • h = enthalpy_mass(gas);

• Specific entropy s • s = entropy_mass(gas);
• Specific internal energy u • u = intEnergy_mass(gas);
Note: All the above parameters are reported in SI units by default

## You can find More such functions on Thermodynamics properties page

14
Introduction to Using Cantera
cantera
Few useful functions
To set a gas mixture to a state of chemical equilibrium
equilibrate(self, XY, solver, double rtol, int maxsteps, int maxiter)
• Parameters:
Srisha Rao M V
• self – Instance of class Mixture()
January 15, 2018
• XY - A two-letter string, which must be one of the set:
Introduction [’TP’,’TV’,’HP’,’SP’,’SV’,’UV’]
Using Cantera • solver - Specifies the equilibrium solver to use. May be one of the
Sample plots to
highlight difference
following:
Few important
classes
• element potential - A fast solver using the element potential method
Few useful functions • gibbs - A slower but more robust Gibbs minimization solver
Importance of
equilibrate function • vcs - The VCS non-ideal equilibrium solver
Resources
• auto - The element potential solver will be tried first, then if it fails the gibbs
solver will be tried
• rtol - The relative error tolerance.
• maxsteps - Maximum number of steps in composition to take to find a
converged solution.
• maxiter - This specifies the number of outer iterations on T or P when
15 some property pair other than TP is specified (only for ’gibbs’)
Introduction to Using Cantera
cantera
Importance of equilibrate function
C p Variation of Air as function of Temperature
1350
Frozen flow
Reacting flow(incorporates Equilibrate function)

## January 15, 2018

Specific heat capacity at constant pressure [J/kg/K].

1250
Introduction

Using Cantera
Sample plots to 1200
highlight difference
Few important
classes
Few useful functions
1150
Importance of
equilibrate function
Resources

1100

1050

1000
0 1000 2000 3000 4000 5000 6000
Temperature [k]
16
Introduction to Using Cantera
cantera
Importance of equilibrate function
C v Variation of Air as function of Temperature
1050
Frozen flow
Reacting flow(incorporates Equilibrate function)

## January 15, 2018

Specific heat capacity at constant volume [J/kg/K].

950
Introduction

Using Cantera
Sample plots to 900
highlight difference
Few important
classes
Few useful functions
850
Importance of
equilibrate function
Resources

800

750

700
0 1000 2000 3000 4000 5000 6000
Temperature [k]
17
Introduction to Using Cantera
cantera
Importance of equilibrate function
Gamma variation of Air as function of Temperature
1.42
Frozen flow
Reacting flow(incorporates Equilibrate function)

1.4
Srisha Rao M V

## January 15, 2018

1.38

Introduction
1.36
Using Cantera
Specific heat ratio

Sample plots to
highlight difference
Few important 1.34
classes
Few useful functions
Importance of
equilibrate function 1.32
Resources

1.3

1.28

1.26
0 1000 2000 3000 4000 5000 6000
Temperature [k]
18
Introduction to Using Cantera
cantera
Resources

Srisha Rao M V

## January 15, 2018

• You can find an extensive tutorial on cantera by CERFACS
Introduction • You can find the examples included with the Cantera Matlab Toolbox
Using Cantera
Sample plots to
here in MATLAB Examples
highlight difference
Few important
classes
• You can find the examples and tutorials for using cantera in Python
Few useful functions
Importance of
environment here in PYTHON Examples
equilibrate function
Resources • you can also download SDToolbox for Shock and detonation coding
application

19