From charlesreid1

Cantera Overview

Cantera is a code written in C++ that can be used to perform chemical kinetic and thermodynamic calculations.

The way it does this is by providing the user with a set of building blocks, and allowing the user to piece these building blocks together to form complex kinetic/thermodynamic systems or networks

Users can interface with Cantera through C++, or through the other interfaces:

  • Matlab toolbox
  • Python
  • Fortran

Cantera Objects

Reservoir - fixed state

  • the state of the reservoir never changes
  • used to impose fixed upstream/inlet conditions
  • chemistry is frozen - so no reactions will take place

Reactor - canonical chemical reactor

  • contains some mixture of species
  • has a set of characteristics
  • e.g. T, V, P, composition, enthalpy, density, MW, etc...

Fluids - gases or liquids

Chemical Mechanisms - external files "fed" to Cantera

  • chemical mechanisms specify two things:
    • species
    • reactions
  • all thermodynamic data for species is specified (e.g. heat capacity as a polynomial function - "NASA coefficients")
  • all thermodynamic data for chemical reactions (pre-exponential factors, activation energies, etc.)

Walls - separate reactors

  • can have heat transfer via the usual mechanisms - convection, conduction, radiation
  • can have a set heating rate (a constant, or a function of time)
  • can move - due to a pressure difference, a displacement rate expression, etc.)

Flow controllers - control flow... 3 types

Mass flow controller - maintains a fixed mass flowrate
Valves - the mass flowrate is a function of $ \Delta P $
Pressure flow controller - maintains a fixed $ P $ in the reactor (think of this as a pressure relief valve)

Matlab Examples

Batch Reactor Example

How might we combine the above Cantera objects to make a batch reactor?

e.g. where would the reactor go? Where would the flow controllers go?

Any reservoirs needed? No

Any flow controllers needed? No

Reactor State 1 --> Reactor State 2

We want to know what happens when the reactor is changing from state 1 to state 2

For a constant volume reactor:

What is going into our reactor?

% Import a phase to fill the reactor with
% (The H2 combustion mechanism is contained in the file h2o2.cti, which comes with Cantera)
gas = importPhase('h2o2.cti');

What is the thermodynamic state of the material going into the reactor?

% Set the gas temperature at 1500 K
% Set the pressure at 1 atm
% Set the composition to be 2 parts hydrogen, 1 part oxygen, and 20 parts dilute, inert Argon
set(gas, 'T',1500, 'P',oneatm, 'X','H2:2, O2:1, AR:20')

How to create a batch reactor? Create a Cantera Reactor object

% We have already set the thermodynamic state of the "gas" object
% But if we wanted to, we could set it when we create the Reactor
batch = Reactor(gas);



What is the volume of the reactor if we don't specify it?
How do we specify a volume for the reactor?