One-dimensional Reacting Flows#

Caution

The MATLAB toolbox is an experimental part of the Cantera API 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.

Composite Domains#

CounterFlowDiffusionFlame#

class ct.oneD.CounterFlowDiffusionFlame(left, flow, right, oxidizer)#

Bases: ct.oneD.Sim1D

Create a counter flow diffusion flame stack.

>> flame = ct.oneD.CounterFlowDiffusionFlame(left, flow, right, oxidizer)
Parameters:
  • leftct.oneD.Inlet object representing the left (‘fuel’) inlet boundary.

  • flowct.oneD.AxisymmetricFlow object representing the flow domain.

  • rightct.oneD.Inlet object representing the right (‘oxidizer’) inlet boundary.

  • oxidizer – String representing the oxidizer species. Most commonly O2.

Flow Domains#

FreeFlow#

class ct.oneD.FreeFlow(phase[, name])#

Bases: ct.oneD.Flow

Create a free flow domain.

>> m = ct.oneD.FreeFlow(phase, name)
Parameters:
  • phase – Instance of class ct.Solution.

  • name – String, ID of the flow.

UnstrainedFlow#

class ct.oneD.UnstrainedFlow(phase[, name])#

Bases: ct.oneD.Flow

Create an unstrained flow domain.

>> m = ct.oneD.UnstrainedFlow(phase, name)
Parameters:
  • phase – Instance of class ct.Solution.

  • name – String, ID of the flow.

Returns:

Instance of class ct.oneD.UnstrainedFlow.

Constructor

AxisymmetricFlow#

class ct.oneD.AxisymmetricFlow(phase[, name])#

Bases: ct.oneD.Flow

Create an axisymmetric flow domain.

>> m = ct.oneD.AxisymmetricFlow(phase, name)
Parameters:
  • phase – Instance of class ct.Solution.

  • name – String, ID of the flow.

Boundaries#

Inlet#

class ct.oneD.Inlet(phase[, name])#

Bases: ct.oneD.Boundary

Create an inlet domain.

>> m = ct.oneD.Inlet(phase, name)

Note that an inlet can only be a terminal domain - it must be either the leftmost or rightmost domain in a stack.

Parameters:
  • phase – Instance of class ct.Solution.

  • name – String name of the inlet.

Property Summary
X#

Mole fractions.

Outlet#

class ct.oneD.Outlet(phase[, name])#

Bases: ct.oneD.Boundary

Create an outlet domain.

>> m = ct.oneD.Outlet(phase, name)
Parameters:
  • phase – Instance of class ct.Solution.

  • name – String ID of the outlet.

OutletRes#

class ct.oneD.OutletRes(phase[, name])#

Bases: ct.oneD.Boundary

Create an outlet reservoir domain.

>> m = ct.oneD.OutletRes(phase, name)
Parameters:
  • phase – Instance of class ct.Solution.

  • name – String ID of the outlet reservoir.

SymmetryPlane#

class ct.oneD.SymmetryPlane(phase[, name])#

Bases: ct.oneD.Boundary

Create a symmetry plane domain.

>> m = ct.oneD.SymmetryPlane(phase, name)
Parameters:
  • phase – Instance of class ct.Solution.

  • name – String ID of the symmetry plane.

Returns:

Instance of class ct.oneD.SymmetryPlane.

Constructor

Surface#

class ct.oneD.Surface(phase[, name])#

Bases: ct.oneD.Boundary

Create a surface domain.

>> m = ct.oneD.Surface(phase, name)
Parameters:
  • phase – Instance of class ct.Solution.

  • name – String ID of surface

ReactingSurface#

class ct.oneD.ReactingSurface(phase[, name])#

Bases: ct.oneD.Boundary

Create a reacting surface domain.

>> m = ct.oneD.ReactingSurface(surface_mech, name)
Parameters:
  • surface_mech – Instance of class ct.Interface defining the surface reaction mechanism to be used.

  • name – String ID of the reacting surface.

Property Summary
coverageEnabled#

Set bounds on the solution components.

>> d.coverageEnabled = flag
Parameters:

flag – Boolean flag indicating whether coverage equations are enabled.

Base Classes#

Domain#

class ct.oneD.Domain#

Bases: handle

Domain Class.

Base class for objects representing boundaries and flow domains. The constructor is called by derived classes and cannot be used directly.

Parameters:
  • type

    String type of domain. Possible values are:
    • axisymmetric-flow

    • free-flow

    • inlet

    • outlet

    • reacting-surface

    • surface

    • symmetry-plane

    • outlet-reservoir

  • phase – Instance of ct.Solution or ct.Interface.

  • id – String ID of the domain.

Property Summary
domainID#

ID of the domain

domainIndex#

Integer denoting the location of the domain, beginning with 1 at the left.

domainType#

String denoting the domain type.

nComponents#

Number of state components at each grid point.

nPoints#

Number of grid points in the domain.

phase#

The Solution object used to represent the contents of this domain.

Method Summary
bounds(component)#

Get the (lower, upper) bounds for a solution component.

>> b = d.bounds(component)
Parameters:

component – String name of the component for which the bounds are returned.

Returns:

\(1\times 2\) vector of the lower and upper bounds.

componentIndex(name)#

Index of a component given its name.

>>n = d.componentIndex(name)
Parameters:

name – String name of the component to look up. If a numeric value is passed, it will be returned.

Returns:

Index of the component, or input numeric value.

componentName(index)#

Name of a component given its index.

>> n = d.componentName(index)
Parameters:

index – Integer or vector of integers of component names to get.

Returns:

Cell array of component names.

delete()#

Delete the ct.oneD.Domain object.

info(rows, width)#

Print a concise summary of a Domain.

>> d.info()

Parameters:
  • rows – Maximum number of rendered rows; defaults to 10.

  • width – Maximum width of rendered output; default adjusts to terminal width.

setBounds(component, lower, upper)#

Set bounds on the solution components.

>> d.setBounds(component, lower, upper)
Parameters:
  • component – String, component to set the bounds on.

  • lower – Lower bound.

  • upper

setSteadyTolerances(rtol, atol, component)#

Set the steady-state tolerances.

>>d.setSteadyTolerances(rtol, atol, component)
Parameters:
  • rtol – Relative tolerance.

  • atol – Absolute tolerance.

  • component – String or cell array of strings of component values whose tolerances should be set. If 'default' is specified, the tolerance of all components will be set.

setTransientTolerances(rtol, atol, component)#

Set the transient tolerances.

>> d.setTransientTolerances(rtol, atol, component)
Parameters:
  • rtol – Relative tolerance.

  • atol – Absolute tolerance.

  • component – String or cell array of strings of component values whose tolerances should be set. If 'default' is specified, the tolerance of all components will be set.

tolerances(component)#

Return the (relative, absolute) error tolerances for a solution component.

>> tol = d.tolerances(component)
Parameters:

component – String name of the component for which the bounds are returned.

Returns:

\(1\times 2\) vector of the relative and absolute error tolerances.

updateState(loc)#

Set state of associated phase to specified location.

Boundary#

class ct.oneD.Boundary#

Bases: ct.oneD.Domain

Boundary Class.

Base class for objects representing domain boundaries. The constructor is called by derived classes and cannot be used directly.

Parameters:
  • type

    String type of Boundary. Possible values are:
    • inlet

    • outlet

    • reacting-surface

    • surface

    • symmetry-plane

    • outlet-reservoir

  • phase – Instance of class ct.Solution or ct.Interface.

  • name – String, ID of the flow.

Property Summary
T#

Boundary temperature [K].

massFlux#

The mass flux [kg/s/m²] in the domain.

Method Summary
massFraction(k)#

Get the mass fraction of a species given its integer index.

>> y = d.massFraction(k)

This method returns the mass fraction of species k, where k is the integer index of the species in the flow domain to which the boundary domain is attached.

Parameters:

k – Integer species index.

Returns:

Mass fraction of species.

value(component)#

Get the value of a component at a boundary.

>> d.value(component)
Parameters:

component – String component for which the solution is desired.

Returns:

Value of the component in domain d.

Sim1D#

class ct.oneD.Sim1D(domains)#

Bases: handle

Sim1D Class.

>> s = ct.oneD.Sim1D(domains)

A Sim1D object is a container for one-dimensional domains, which are instances of ct.oneD.Domain. The domains are of two types - extended domains, and connector domains.

See also: ct.oneD.Domain

Parameters:

domains – Cell array of instances of ct.oneD.Domain and its subclasses.

Property Summary
domains#

Domain instances contained within the ct.oneD.Sim1D object.

stID#

ID of the Sim1D object.

Method Summary
delete()#

Delete the ct.oneD.Sim1D object.

domainIndex(name)#

The index of a domain in a Sim1D given its name.

>> n = s.domainIndex(name)
Parameters:

name – If double, the value is :returned. Otherwise, the name is looked up and its index is :returned.

Returns:

Index of domain.

getInitialSoln()#

Get the initial solution.

restore(fname, id)#

Restore a previously-saved solution.

>> s.restore(fname, id)

This method can be used to provide an initial guess for the solution.

See also: save

Parameters:
  • fname – File name of an YAML or HDF file containing solution information.

  • id – ID of the element that should be restored.

save(fname, id, desc, overwrite)#

Save a solution to a file.

>> s.save(fname, id, desc)

The output file is in a format that can be used by restore

Parameters:
  • fname – File name where YAML or HDL file should be written.

  • id – ID to be assigned to the file element when it is written.

  • desc – Description to be written to the output file.

  • overwrite – Force overwrite if file/name exists; optional (default=false)

setFixedTemperature(T)#

Set the temperature used to fix the spatial location of a freely propagating flame.

>> s.setFixedTemperature(T)
Parameters:

T – Temperature [K] to be set.

setGridMin(domain, gridmin)#

Set the minimum grid spacing on domain.

>> s.setGridMin(domain, gridmin)
Parameters:
  • domain – Integer ID of the domain.

  • gridmin – Minimum grid spacing [m].

setMaxJacAge(ss_age, ts_age)#

Set the number of times the Jacobian will be used before it is recomputed.

>> s.setMaxJacAge(ss_age, ts_age)
Parameters:
  • ss_age – Maximum age of the Jacobian for steady state analysis.

  • ts_age – Maximum age of the Jacobian for transient analysis. If not specified, defaults to ‘ss_age’.

setTimeStep(stepsize, steps)#

Specify a sequence of time steps.

>> s.setTimeStep(stepsize, steps)
Parameters:
  • stepsize – Initial step size [s].

  • steps – Vector of number of steps to take before re-attempting solution of steady-state problem. For example, steps = [1, 2, 5, 10] would cause one timestep to be taken first time the steady-state solution attempted. If this failed, two time steps would be taken.

show()#

Show all domains.

solve(loglevel, refineGrid)#

Solve the problem.

>> s.solve(loglevel, refineGrid)
Parameters:
  • loglevel – Integer flag controlling the amount of diagnostic output. Zero suppresses all output, and 5 produces very verbose output.

  • refineGrid – Integer, 1 to allow grid refinement, 0 to disallow.

writeStats()#

Print statistics for the current solution.

>> s.writeStats

Prints a summary of the number of function and Jacobian evaluations for each grid, and the CPU time spent on each one.