MATLAB Toolbox Documentation#
Caution
The MATLAB toolbox is an experimental part of Cantera and may be changed without notice. It includes breaking changes from the legacy MATLAB API. While almost all features of the legacy MATLAB API are implemented, the toolbox does not include all functionality available for the C++ and Python interfaces.
The experimental MATLAB toolbox for Cantera is currently in preview and replaces the
legacy MATLAB toolbox that was discontinued after Cantera 3.0. The
replacement introduces modern MATLAB object-oriented programming structure and syntax,
while replacing a custom-compiled MEX interface with MATLAB’s
clibgen to
automatically wrap functions exposed by Cantera CLib.
Note
For current information on the state of the experimental MATLAB toolbox, refer to GitHub issues and enhancement requests, specifically:
Installation instructions are provided in
interfaces/matlab/README.md
within the Cantera source code.
Objects Representing Phases#
The most frequently used class in Cantera is the Solution. It can
represent a mixture of gases, a liquid solution, or a solid solution and provides access
to the solution’s thermodynamic, kinetic, and transport properties. The
Interface class represents surfaces formed by two adjacent phases or
edges where three phases meet. Several special constructors are
provided to instantiate Solution objects that implement pure fluid
equations of state for certain substances.
Thermodynamic Properties#
Class ThermoPhase is one of the base classes for
Solution objects. It represents the intensive thermodynamic state using
one of the phase thermodynamic models implemented by
Cantera and provides methods for computing thermodynamic properties.
The Mixture class provides an interface for computing equilibrium
properties of mixtures composed of multiple phases.
Chemical Kinetics#
Class Kinetics is a base class of Solution that
provides access to reaction rates of progress,
species production rates, and other quantities pertaining to a reaction mechanism.
Transport Properties#
Class Transport is a base class of Solution that
provides access to transport properties such as viscosity and species diffusivities,
using one of the available transport models.
Zero-Dimensional Reactor Networks#
A reactor network consists of one or more interconnected reactors. Several reactor types
are implemented by classes derived from Reactor, each with its
own set of governing equations.
Reactors can be connected to each other and upstream or downstream
Reservoirs using Valves,
MassFlowControllers, and Walls, which
introduce additional terms to the governing equations.
Heterogeneous reactions are handled by ReactorSurface.
Time integration of reactor networks is handled by the ReactorNet
class.
One-dimensional Reacting Flows#
A 1D simulation in Cantera is set up as a flow
domain—instances of Flow and its
subclasses—surrounded by two boundary
domains built from subclasses of
Boundary that define inlet/outlet boundary conditions.
These domain objects are combined in a Sim1D object that manages
the numerical solution. A specialization CounterFlowDiffusionFlame
handles setup and initial condition definitions for diffusion flame simulations.
Physical Constants#
Cantera provides definitions for a number of frequently used physical constants. The values are consistent with the 2018 CODATA recommendations.
Utilities#
The Matlab interface also includes a number of other methods for controlling interactions with the Cantera C++ library, getting information about the C++ library, and working with other global library state.