Fixed a lot of docstrings and turned 0/1 outputs into boolean.

This commit is contained in:
ssun30 2023-02-24 19:37:52 -05:00 committed by Ray Speth
parent af9107a678
commit 7f7a0fa34c
53 changed files with 578 additions and 674 deletions

View File

@ -4,12 +4,11 @@ classdef AxisymmetricFlow < Domain1D
% >> m = AxisymmetricFlow(gas, id)
%
% :param gas:
% Instance of class :mat:class:`Solution`
% Instance of class :mat:class:`Solution`.
% :param id:
% String, ID of the flow
% String, ID of the flow.
% :return:
% Instance of class :mat:class:`AxisymmetricFlow`.
%
methods

View File

@ -23,7 +23,6 @@ classdef CounterFlowDiffusionFlame < Sim1D
% :return:
% Instance of :mat:class:`CounterFlowDiffusionFlame` object
% representing the left inlet, flow, and right inlet.
%
methods

View File

@ -5,20 +5,19 @@ classdef Domain1D < handle
%
% :param a:
% String type of domain. Possible values are:
% `StagnationFlow`
% `AxisymmetricFlow`
% `Inlet1D`
% `Surf1D`
% `Symm1D`
% `Outlet1D`
% `ReactingSurface`
% `OutletRes`
%
% - `StagnationFlow`
% - `AxisymmetricFlow`
% - `Inlet1D`
% - `Surf1D`
% - `Symm1D`
% - `Outlet1D`
% - `ReactingSurface`
% - `OutletRes`
% :param b:
% Instance of class :mat:class:`Solution` (for ``a == 1``)
% or :mat:class:`Interface` (for ``a == 6``). Not used for
% all other valid values of ``a``.
%
% Instance of :mat:class:`Solution` (for ``a == 'StagnationFlow`` or
% ``a = 'AxisymmetricFlow'``) or :mat:class:`Interface`
% (for ``a == 'ReactingSurface'``).
% Not used for all other valid values of ``a``.
properties (SetAccess = immutable)
@ -36,83 +35,83 @@ classdef Domain1D < handle
properties (SetAccess = protected)
% Domain index.
% Domain index. ::
%
% i = d.domainIndex
% >> i = d.domainIndex
%
% :param d:
% Instance of class :mat:class:`Domain1D`
% Instance of class :mat:class:`Domain1D`.
% :return:
% Integer flag denoting the location of the domain,
% beginning with 1 at the left.
domainIndex
% Type of the domain. ::
%
% Type of the domain.
%
% i = d.domainType
% >> i = d.domainType
%
% :param d:
% Instance of class :mat:class:`Domain1D`
% Instance of class :mat:class:`Domain1D`.
% :return:
% Integer flag denoting the domain type.
domainType
% Determines whether a domain is a flow. ::
%
% Determines whether a domain is a flow.
%
% a = d.isFlow
% >> a = d.isFlow
%
% :param d:
% Instance of class :mat:class:`Domain1D`
% Instance of class :mat:class:`Domain1D`.
% :return:
% 1 if the domain is a flow domain, and 0 otherwise.
% True if the domain is a flow domain, and false otherwise.
isFlow
% Determines whether a domain is an inlet. ::
%
% Determines whether a domain is an inlet.
%
% a = d.isInlet
% >> a = d.isInlet
%
% :param d:
% Instance of class :mat:class:`Domain1D`
% Instance of class :mat:class:`Domain1D`.
% :return:
% 1 if the domain is an inlet, and 0 otherwise.
% True if the domain is an inlet, and false otherwise.
isInlet
% Determines if a domain is a surface. ::
%
% Determines if a domain is a surface.
%
% a = d.isSurface
% >> a = d.isSurface
%
% :param d:
% Instance of class :mat:class:`Domain1D`
% Instance of class :mat:class:`Domain1D`.
% :return:
% 1 if the domain is a surface, and 0 otherwise.
% True if the domain is a surface, and false otherwise.
isSurface
% Mass flux. ::
%
% Mass flux.
%
% mdot = d.massFlux
% >> mdot = d.massFlux
%
% :param d:
% Instance of class :mat:class:`Domain1D`
% Instance of class :mat:class:`Domain1D`.
% :return:
% The mass flux in the domain.
massFlux
% Number of components. ::
%
% Number of components.
%
% n = d.nComponents
% >> n = d.nComponents
%
% :param d:
% Instance of class :mat:class:`Domain1D`
% Instance of class :mat:class:`Domain1D`.
% :return:
% Number of variables at each grid point
% Number of variables at each grid point.
nComponents
% Get the number of grid points. ::
%
% Get the number of grid points.
%
% n = d.nPoints
% >> n = d.nPoints
%
% :param d:
% Instance of class :mat:class:`Domain1D`
% Instance of class :mat:class:`Domain1D`.
% :return:
% Integer number of grid points.
nPoints
@ -151,8 +150,7 @@ classdef Domain1D < handle
if strcmp(a, 'StagnationFlow')
if isa(b, 'Solution')
d.domainID = ctFunc('stflow_new', ...
b.tpID, b.kinID, b.trID, 1);
d.domainID = ctFunc('stflow_new', b.tpID, b.kinID, b.trID, 1);
else
error('Wrong argument type. Expecting instance of class Solution.');
end
@ -160,8 +158,7 @@ classdef Domain1D < handle
elseif strcmp(a, 'AxisymmetricFlow')
if isa(b, 'Solution')
d.domainID = ctFunc('stflow_new', ...
b.tpID, b.kinID, b.trID, 2);
d.domainID = ctFunc('stflow_new', b.tpID, b.kinID, b.trID, 2);
else
error('Wrong argument type. Expecting instance of class Solution.');
end
@ -170,8 +167,7 @@ classdef Domain1D < handle
if isa(b, 'Interface')
d.domainID = ctFunc('reactingsurf_new');
ctFunc('reactingsurf_setkineticsmgr', ...
d.domainID, b.kinID);
ctFunc('reactingsurf_setkineticsmgr', d.domainID, b.kinID);
else
error('Wrong argument type. Expecting instance of class Interface.');
end
@ -196,52 +192,52 @@ classdef Domain1D < handle
%% Domain1D Utility Methods
function d = disableEnergy(d)
% Disable the energy equation.
% Disable the energy equation. ::
%
% d.disableEnergy
% >> d.disableEnergy
%
% :param d:
% Instance of class :mat:class:`Domain1D`
%
% Instance of class :mat:class:`Domain1D`.
disp(' ');
disp('Disabling the energy equation...');
ctFunc('stflow_solveEnergyEqn', d.domainID, 0);
end
function d = enableEnergy(d)
% Enable the energy equation.
% Enable the energy equation. ::
%
% d.enableEnergy
% >> d.enableEnergy
%
% :param d:
% Instance of class :mat:class:`Domain1D`
%
% Instance of class :mat:class:`Domain1D`.
disp(' ');
disp('Enabling the energy equation...');
ctFunc('stflow_solveEnergyEqn', d.domainID, 1);
end
function d = disableSoret(d)
% Disable the diffusive mass fluxes due to the Soret effect.
% Disable the diffusive mass fluxes due to the Soret effect. ::
%
% d.disableSoret
% >> d.disableSoret
%
% :param d:
% Instance of class :mat:class:`Domain1D`
%
% Instance of class :mat:class:`Domain1D`.
disp(' ');
disp('Disabling the Soret effect...');
ctFunc('stflow_enableSoret', d.domainID, 0);
end
function d = enableSoret(d)
% Enable the diffusive mass fluxes due to the Soret effect.
% Enable the diffusive mass fluxes due to the Soret effect. ::
%
% d.enableSoret
% >> d.enableSoret
%
% :param d:
% Instance of class :mat:class:`Domain1D`
%
% Instance of class :mat:class:`Domain1D`.
disp(' ');
disp('Disabling the Soret effect...');
ctFunc('stflow_enableSoret', d.domainID, 1);
@ -250,15 +246,14 @@ classdef Domain1D < handle
%% Domain Get Methods
function b = bounds(d, component)
% Get the (lower, upper) bounds for a solution component.
% Get the (lower, upper) bounds for a solution component. ::
%
% b = d.bounds(componoent)
% >> b = d.bounds(componoent)
%
% :param component:
% String name of the component for which the bounds are
% returned.
% String name of the component for which the bounds are returned.
% :return:
% 1x2 Vector of the lower and upper bounds.
% :math:`1\times 2` vector of the lower and upper bounds.
n = d.componentIndex(component);
lower = ctFunc('domain_lowerBound', d.domainID, n);
@ -267,13 +262,12 @@ classdef Domain1D < handle
end
function n = componentIndex(d, name)
% Index of a component given its name. ::
%
% Index of a component given its name.
%
% n = d.componentIndex(name)
% >>n = d.componentIndex(name)
%
% :param d:
% Instance of class :mat:class:`Domain1D`
% Instance of class :mat:class:`Domain1D`.
% :param name:
% String name of the component to look up. If a numeric value
% is passed, it will be returned.
@ -283,8 +277,7 @@ classdef Domain1D < handle
if isa(name, 'double')
n = name;
else
n = ctFunc('domain_componentIndex', ...
d.domainID, name);
n = ctFunc('domain_componentIndex', d.domainID, name);
if n >= 0
n = n + 1;
@ -299,16 +292,14 @@ classdef Domain1D < handle
end
function s = componentName(d, index)
% Name of a component given its index. ::
%
% Name of a component given its index.
%
% n = d.componentName(index)
% >> n = d.componentName(index)
%
% :param d:
% Instance of class :mat:class:`Domain1D`
% Instance of class :mat:class:`Domain1D`.
% :param index:
% Integer or vector of integers of component names
% to get.
% Integer or vector of integers of component names to get.
% :return:
% Cell array of component names.
@ -341,10 +332,9 @@ classdef Domain1D < handle
end
function zz = gridPoints(d, n)
% Grid points from a domain. ::
%
% Grid points from a domain.
%
% zz = d.gridPoints(n)
% >> zz = d.gridPoints(n)
%
% :param d:
% Instance of class 'Domain1D'.
@ -376,31 +366,19 @@ classdef Domain1D < handle
function a = get.isFlow(d)
t = d.domainType;
% See Domain1D.h for definitions of constants.
if t < 100
a = 1;
else a = 0;
end
a = t < 100;
end
function a = get.isInlet(d)
t = d.domainType;
% See Domain1D.h for definitions of constants.
if t == 104
a = 1;
else a = 0;
end
a = t == 104;
end
function a = get.isSurface(d)
t = d.domainType;
% See Domain1D.h for definitions of constants.
if t == 102
a = 1;
else a = 0;
end
a = t == 102;
end
function mdot = get.massFlux(d)
@ -408,21 +386,20 @@ classdef Domain1D < handle
end
function y = massFraction(d, k)
% Get the mass fraction of a species given its integer index. ::
%
% Get the mass fraction of a species given its integer index.
%
% y = d.massFraction(k)
% >> 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.
%
% :param d:
% Instance of class :mat:class:`Domain1D`
% Instance of class :mat:class:`Domain1D`.
% :param k:
% Integer species index
% Integer species index.
% :return:
% Mass fraction of species
% Mass fraction of species.
if d.domainIndex == 0
error('No flow domain attached!')
@ -444,17 +421,15 @@ classdef Domain1D < handle
end
function tol = tolerances(d, component)
%
% Return the (relative, absolute) error tolerances for a
% solution component.
% solution component. ::
%
% tol = d.tolerances(component)
% >> tol = d.tolerances(component)
%
% :param component:
% String name of the component for which the bounds are
% returned.
% String name of the component for which the bounds are returned.
% :return:
% 1x2 Vector of the relative and absolute error tolerances.
% :math:`1\times 2` vector of the relative and absolute error tolerances.
n = d.componentIndex(component);
rerr = ctFunc('domain_rtol', d.domainID, n);
@ -473,38 +448,34 @@ classdef Domain1D < handle
%% Domain Set Methods
function setBounds(d, component, lower, upper)
% Set bounds on the solution components.
% Set bounds on the solution components. ::
%
% d.setBounds(component, lower, upper)
% >> d.setBounds(component, lower, upper)
%
% :param d:
% Instance of class 'Domain1D'.
% Instance of class :mat:class:`Domain1D`.
% :param component:
% String, component to set the bounds on.
% :param lower:
% Lower bound.
% :param upper:
% Upper bound.
%
n = d.componentIndex(component);
ctFunc('domain_setBounds', d.domainID, n - 1, lower, upper);
end
function setCoverageEqs(d, onoff)
% Set bounds on the solution components.
% Set bounds on the solution components. ::
%
% d.setBounds(component, lower, upper)
% >> d.setCoverageEqn(onoff)
%
% :param d:
% Instance of class :mat:class:`Domain1D`
% :param component:
% String, component to set the bounds on
% :param lower:
% Lower bound
% :param upper:
% Upper bound
%
% :param onoff:
% String, one of ``'on'`` or ``'yes'`` to turn solving
% the coverage equations on. One of ``'off'`` or ``'no'``
% to turn off the coverage equations.
if ~strcmp(d.type, 'ReactingSurface')
error('Wrong domain type. Expected a reacting surface domain.');
end
@ -529,21 +500,20 @@ classdef Domain1D < handle
end
function setFixedTempProfile(d, profile)
% Set a fixed temperature profile.
% Set a fixed temperature profile. ::
%
% d.setFixedTempProfile(profile)
% >> d.setFixedTempProfile(profile)
%
% Set the temperature profile to use when the
% energy equation is not being solved. The profile must be entered
% as an array of positions / temperatures, which may be in rows or
% columns.
% Set the temperature profile to use when the energy equation
% is not being solved. The profile must be entered as an array of
% positions / temperatures, which may be in rows or columns.
%
% :param d:
% Instance of class :mat:class:`Domain1D`
% Instance of class :mat:class:`Domain1D`.
% :param profile:
% n x 2 or 2 x n array of ``n`` points at which the temperature
% is specified.
%
% :math:`n\times 2` or :math:`2\times n` array of ``n`` points
% at which the temperature is specified.
sz = size(profile);
if sz(1) == 2
@ -560,61 +530,61 @@ classdef Domain1D < handle
end
function setID(d, id)
% Set the ID tag for a domain.
% Set the ID tag for a domain. ::
%
% d.setID(id)
% >> d.setID(id)
%
% :param d:
% Instance of class :mat:class:`Domain1D`
% Instance of class :mat:class:`Domain1D`.
% :param id:
% String ID to assign
%
% String ID to assign.
ctFunc('domain_setID', d.domainID, id);
end
function setMassFlowRate(d, mdot)
% Set the mass flow rate.
% Set the mass flow rate. ::
%
% d.setMassFlowRate(mdot)
% >> d.setMassFlowRate(mdot)
%
% :param d:
% Instance of class :mat:class:`Domain1D`
% Instance of class :mat:class:`Domain1D`.
% :param mdot:
% Mass flow rate
%
% Mass flow rate.
ctFunc('bdry_setMdot', d.domainID, mdot);
end
function setMoleFractions(d, x)
% Set the mole fractions.
% Set the mole fractions. ::
%
% d.setMoleFractions(x)
% >> d.setMoleFractions(x)
%
% :param d:
% Instance of class :mat:class:`Domain1D`
% Instance of class :mat:class:`Domain1D`.
% :param x:
% String specifying the species and mole fractions in
% the format ``'SPEC:X,SPEC2:X2'``.
%
ctFunc('bdry_setMoleFractions', d.domainID, x);
end
function setSteadyTolerances(d, component, rtol, atol)
% Set the steady-state tolerances.
% Set the steady-state tolerances. ::
%
% d.setSteadyTolerances(component, rtol, atol)
% >>d.setSteadyTolerances(component, rtol, atol)
%
% :param d:
% Instance of class :mat:class:`Domain1D`
% Instance of class :mat:class:`Domain1D`.
% :param 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.
% :param rtol:
% Relative tolerance
% Relative tolerance.
% :param atol:
% Absolute tolerance
%
% Absolute tolerance.
if strcmp(component, 'default')
nc = d.nComponents;
@ -628,34 +598,32 @@ classdef Domain1D < handle
for ii = 1:nc
n = d.componentIndex(component{ii});
ctFunc('domain_setSteadyTolerances', ...
d.domainID, n, rtol, atol);
ctFunc('domain_setSteadyTolerances', d.domainID, n, rtol, atol);
end
else
n = d.componentIndex(component);
ctFunc('domain_setSteadyTolerances', ...
d.domainID, n, rtol, atol);
ctFunc('domain_setSteadyTolerances', d.domainID, n, rtol, atol);
end
end
function setTransientTolerances(d, component, rtol, atol)
% Set the transient tolerances.
% Set the transient tolerances. ::
%
% d.setTransientTolerances(component, rtol, atol)
% >> d.setTransientTolerances(component, rtol, atol)
%
% :param d:
% Instance of class :mat:class:`Domain1D`
% Instance of class :mat:class:`Domain1D`.
% :param 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.
% :param rtol:
% Relative tolerance
% Relative tolerance.
% :param atol:
% Absolute tolerance
%
% Absolute tolerance.
if strcmp(component, 'default')
nc = d.nComponents;
@ -682,26 +650,26 @@ classdef Domain1D < handle
end
function setTransport(d, itr)
% Set the solution object used for calculating transport properties.
% Set the solution object used for calculating transport properties. ::
%
% d.setTransport(itr)
% >> d.setTransport(itr)
%
% :param itr:
% ID of the solution object for which transport properties
% are calculated.
%
ctFunc('stflow_setTransport', d.domainID, itr);
end
function setupGrid(d, grid)
% Set up the solution grid.
% Set up the solution grid. ::
%
% d.setupGrid(grid)
% >> d.setupGrid(grid)
%
% :param d:
% Instance of class :mat:class:`Domain1D`
% Instance of class :mat:class:`Domain1D`.
% :param grid:
%
% The grid for this domain.
ctFunc('domain_setupGrid', d.domainID, numel(grid), grid);
end

View File

@ -4,13 +4,13 @@ classdef FreeFlame < Domain1D
% >> m = FreeFlame(gas, id)
%
% :param gas:
% Instance of class :mat:class:`Solution`
% Instance of class :mat:class:`Solution`.
% :param id:
% String, ID of the flow
% String, ID of the flow.
% :return:
% Instance of class :mat:class:`FreeFlame` representing
% a freely propagating, adiabatic flame.
%
methods
function m = FreeFlame(gas, id)

View File

@ -10,7 +10,6 @@ classdef Inlet < Domain1D
% String name of the inlet.
% :return:
% Instance of class :mat:class:`Inlet`.
%
methods

View File

@ -7,7 +7,6 @@ classdef Outlet < Domain1D
% String ID of the outlet.
% :return:
% Instance of :mat:class:`Outlet`.
%
methods

View File

@ -7,7 +7,6 @@ classdef OutletRes < Domain1D
% String ID of the outlet reservoir.
% :return:
% Instance of :mat:class:`OutletRes`.
%
methods

View File

@ -4,7 +4,7 @@ classdef Sim1D < handle
% >> s = Sim1D(domains)
%
% A Sim1D object is a container for one-dimensional domains,
% which are instances of class Domain1D. The domains are of two
% which are instances of :mat:class:`Domain1D`. The domains are of two
% types - extended domains, and connector domains.
%
% See also: :mat:class:`Domain1D`
@ -13,13 +13,12 @@ classdef Sim1D < handle
% Cell array of instances of :mat:class:`Domain1D` and its subclasses.
% :return:
% Instance of class :mat:class:`Sim1D`.
%
properties (SetAccess = immutable)
stID % ID of the Sim1D object.
domains % Domain instances contained within the Sim1D object.
domains % Domain instances contained within the :mat:class:`Sim1D` object.
end
@ -72,18 +71,17 @@ classdef Sim1D < handle
end
function plotSolution(s, domain, component)
% Plot a specified solution component.
% Plot a specified solution component. ::
%
% s.plotSolution(domain, component)
% >> s.plotSolution(domain, component)
%
% :param s:
% Instance of class 'Sim1D'.
% Instance of class :mat:class:`Sim1D`.
% :param domain:
% Name of domain from which the component should be
% retrieved.
% :param component:
% Name of the component to be plotted.
%
n = s.stackIndex(domain);
d = s.domains{n};
@ -95,44 +93,42 @@ classdef Sim1D < handle
end
function restore(s, fname, id)
% Restore a previously-saved solution.
% Restore a previously-saved solution. ::
%
% s.restore(fname, id)
% >> s.restore(fname, id)
%
% This method can be used to provide an initial guess for the solution.
%
% See also: :mat:class:`save`
%
% :param s:
% Instance of class :mat:class:`Sim1D`
% Instance of class :mat:class:`Sim1D`.
% :param fname:
% File name of an XML file containing solution information
% File name of an YAML or HDF file containing solution information.
% :param id:
% ID of the element that should be restored
%
% ID of the element that should be restored.
ctFunc('sim1D_restore', s.stID, fname, id)
end
function saveSoln(s, fname, id, desc)
% Save a solution to a file.
% Save a solution to a file. ::
%
% s.saveSoln(fname, id, desc)
% >> s.saveSoln(fname, id, desc)
%
% The output file is in a format that
% can be used by :mat:class:`restore`
% The output file is in a format that can be used by :mat:class:`restore`
%
% :param s:
% Instance of class :mat:class:`Sim1D`
% Instance of class :mat:class:`Sim1D`.
% :param fname:
% File name where XML file should be written
% File name where YAML or HDL file should be written.
% :param id:
% ID to be assigned to the XML element when it is
% written
% ID to be assigned to the file element when it is written.
% :param desc:
% Description to be written to the output file
%
% Description to be written to the output file.
if nargin == 1
fname = 'soln.xml';
fname = 'soln.yaml';
id = 'solution';
desc = '--';
elseif nargin == 2
@ -146,23 +142,21 @@ classdef Sim1D < handle
end
function x = solution(s, domain, component)
% Get a solution component in one domain.
% Get a solution component in one domain. ::
%
% s.solution(domain, component)
% >> s.solution(domain, component)
%
% :param s:
% Instance of class 'Sim1D'.
% Instance of class :mat:class:`Sim1D`.
% :param domain:
% String name of the domain from which the solution is
% desired.
% String name of the domain from which the solution is desired.
% :param component:
% String component for which the solution is desired. If
% omitted, solution for all of the components will be
% :returned in an 'nPoints' x 'nComponnts' array.
% String component for which the solution is desired. If omitted,
% solution for all of the components will be returned in
% an :math:`nPoints \times nComponnts` array.
% :return:
% Either an 'nPoints' x 1 vector, or 'nPoints' x
% 'nCOmponents' array.
%
% Either an :math:`nPoints \times 1` vector, or
% :math:`nPoints \times nComponents` array.
idom = s.stackIndex(domain);
d = s.domains{idom};
@ -173,8 +167,7 @@ classdef Sim1D < handle
x = zeros(1, np);
for n = 1:np
x(n) = ctFunc('sim1D_value', s.stID, ...
idom - 1, icomp - 1, n - 1);
x(n) = ctFunc('sim1D_value', s.stID, idom - 1, icomp - 1, n - 1);
end
else
@ -184,8 +177,7 @@ classdef Sim1D < handle
for m = 1:nc
for n = 1:np
x(m, n) = ctFunc('sim1D_value', s.stID, ...
idom - 1, m - 1, n - 1);
x(m, n) = ctFunc('sim1D_value', s.stID, idom - 1, m - 1, n - 1);
end
end
@ -195,35 +187,31 @@ classdef Sim1D < handle
end
function solve(s, loglevel, refineGrid)
% Solve the problem.
% Solve the problem. ::
%
% s.solve(loglevel, refineGrid)
% >> s.solve(loglevel, refineGrid)
%
% :param s:
% Instance of class 'Sim1D'.
% Instance of class :mat:class:`Sim1D`.
% :param loglevel:
% Integer flag controlling the amount of diagnostic output.
% Zero supresses all output, and 5 produces very verbose
% output.
% Zero supresses all output, and 5 produces very verbose output.
% :param refineGrid:
% Integer, 1 to allow grid refinement, 0 to disallow.
%
ctFunc('sim1D_solve', s.stID, loglevel, refineGrid);
end
function writeStats(s)
% Print statistics for the current solution.
% Print statistics for the current solution. ::
%
% s.writeStats
% >> s.writeStats
%
% Prints a summary of the number of function and
% Jacobian evaluations for each grid, and the CPU time spent on
% each one.
% Prints a summary of the number of function and Jacobian evaluations
% for each grid, and the CPU time spent on each one.
%
% :param s:
% Instance of class :mat:class:`Sim1D`
%
% Instance of class class :mat:class:`Sim1D`
ctFunc('sim1D_writeStats', s.stID, 1);
end
@ -237,12 +225,12 @@ classdef Sim1D < handle
end
function n = stackIndex(s, name)
% The index of a domain in a Sim1D given its name.
% The index of a domain in a Sim1D given its name. ::
%
% n = s.stackIndex(name)
% >> n = s.stackIndex(name)
%
% :param s:
% Instance of class 'Sim1D'.
% Instance of class :mat:class:`Sim1D`.
% :param name:
% If double, the value is :returned. Otherwise, the name is
% looked up and its index is :returned.
@ -265,17 +253,16 @@ classdef Sim1D < handle
end
function z = grid(s, name)
% Get the grid in one domain.
% Get the grid in one domain. ::
%
% z = s.grid(name)
% >> z = s.grid(name)
%
% :param s:
% Instance of class :mat:class:`Sim1D`
% Instance of class :mat:class:`Sim1D`.
% :param name:
% Name of the domain for which the grid
% should be retrieved.
% Name of the domain for which the grid should be retrieved.
% :return:
% The grid in domain name
% The grid in domain name.
n = s.stackIndex(name);
d = s.domains{n};
@ -283,17 +270,20 @@ classdef Sim1D < handle
end
function r = resid(s, domain, rdt, count)
% Get the residuals.
% Evaluate the multi-domain residual function. ::
%
% r = s.resid(domain, rdt, count)
% >> r = s.resid(domain, rdt, count)
%
% :param s:
% Instance of class 'Sim1D'.
% Instance of class :mat:class:`Sim1D`.
% :param domain:
% Name of the domain.
% :param rdt:
% Reciprocal of the time step. If omitted, the default value is used.
% :param count:
% Set to zero to omit this call from the statistics.
% :return:
% The multi-domain residual function.
if nargin == 2
rdt = 0.0;
@ -312,8 +302,7 @@ classdef Sim1D < handle
for m = 1:nc
for n = 1:np
r(m, n) = ctFunc('sim1D_workValue', ...
s.stID, idom - 1, m - 1, n - 1);
r(m, n) = ctFunc('sim1D_workValue', s.stID, idom - 1, m - 1, n - 1);
end
end
@ -324,13 +313,12 @@ classdef Sim1D < handle
function setFixedTemperature(s, T)
% Set the temperature used to fix the spatial location of a
% freely propagating flame.
% freely propagating flame. ::
%
% s.setFixedTemperature(T)
% >> s.setFixedTemperature(T)
%
% :param T:
% Double Temperature to be set. Unit: K.
%
if T <= 0
error('temperature must be positive');
@ -340,52 +328,48 @@ classdef Sim1D < handle
end
function setFlatProfile(s, domain, comp, v)
% Set a component to a value across the entire domain.
% Set a component to a value across the entire domain. ::
%
% s.setFlatProfile(domain, comp, v)
% >> s.setFlatProfile(domain, comp, v)
%
% :param s:
% Instance of class 'Sim1D'.
% Instance of class :mat:class:`Sim1D`.
% :param domain:
% Integer ID of the domain.
% :param comp:
% Component to be set.
% :param v:
% Double value to be set.
%
ctFunc('sim1D_setFlatProfile', s.stID, ...
domain - 1, comp - 1, v);
ctFunc('sim1D_setFlatProfile', s.stID, domain - 1, comp - 1, v);
end
function setGridMin(s, domain, gridmin)
% Set the minimum grid spacing on domain.
% Set the minimum grid spacing on domain. ::
%
% s.setGridMin(domain, gridmin)
% >> s.setGridMin(domain, gridmin)
%
% :param domain:
% Integer ID of the domain.
% :param gridmin:
% Double minimum grid spacing.
%
ctFunc('sim1D_setGridMin', s.stID, domain - 1, gridmin);
end
function setMaxJacAge(s, ss_age, ts_age)
% Set the number of times the Jacobian will be used before it
% is recomputed.
% is recomputed. ::
%
% s.setMaxJacAge(ss_age, ts_age)
% >> s.setMaxJacAge(ss_age, ts_age)
%
% :param s:
% Instance of class 'Sim1D'.
% Instance of class :mat:class:`Sim1D`.
% :param ss_age:
% Maximum age of the Jacobian for steady state analysis.
% :param ts_age:
% Maximum age of the Jacobian for transient analysis. If not
% specified, defaults to 'ss_age'.
%
if nargin == 2
ts_age = ss_age;
@ -395,9 +379,9 @@ classdef Sim1D < handle
end
function setProfile(s, name, comp, p)
% Specify a profile for one component,
% Specify a profile for one component. ::
%
% s.setProfile(name, comp, p)
% >> s.setProfile(name, comp, p)
%
% The solution vector values for this component will be
% linearly interpolated from the discrete function defined by
@ -408,13 +392,15 @@ classdef Sim1D < handle
% called at any time, but is usually used to set the initial
% guess for the solution.
%
% Example (assuming 's' is an instance of class 'Sim1D'):
% Example (assuming 's' is an instance of class :mat:class:`Sim1D`):
% >> zr = [0.0, 0.1, 0.2, 0.4, 0.8, 1.0];
%
% >> v = [500, 650, 700, 730, 800, 900];
%
% >> s.setProfile(1, 2, [zr, v]);
%
% :param s:
% Instance of class 'Sim1D'.
% Instance of class :mat:class:`Sim1D`.
% :param name:
% Domain name.
% :param comp:
@ -423,7 +409,6 @@ classdef Sim1D < handle
% n x 2 array, whose columns are the relative (normalized)
% positions and the component values at those points. The
% number of positions 'n' is arbitrary.
%
if isa(name, 'double')
n = name;
@ -463,26 +448,23 @@ classdef Sim1D < handle
end
function setRefineCriteria(s, n, ratio, slope, curve, prune)
% Set the criteria used to refine the grid.
% Set the criteria used to refine the grid. ::
%
% s.setRefineCriteria(n, ratio, slope, curve, prune)
% >> s.setRefineCriteria(n, ratio, slope, curve, prune)
%
% :param s:
% Instance of class 'Sim1D'.
% Instance of class :mat:class:`Sim1D`.
% :param ratio:
% Maximum size ratio between adjacent cells.
% :param slope:
% Maximum relative difference in value between adjacent
% points.
% Maximum relative difference in value between adjacent points.
% :param curve:
% Maximum relative difference in slope between adjacent
% cells.
% Maximum relative difference in slope between adjacent cells.
% :param prune:
% Minimum value for slope or curve for which points will be
% retained or curve value is below prune for all components,
% it will be deleted, unless either neighboring point is
% already marked for deletion.
%
if nargin < 3
ratio = 10.0;
@ -505,41 +487,39 @@ classdef Sim1D < handle
end
function setTimeStep(s, stepsize, steps)
% Specify a sequence of time steps.
% Specify a sequence of time steps. ::
%
% s.setTimeStep(stepsize, steps)
% >> s.setTimeStep(stepsize, steps)
%
% :param stepsize:
% Initial step size.
% :param 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 time
% step to be taken first time the steady-state solution
% attempted. If this failed, two time steps would be taken.
%
% 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.
ctFunc('sim1D_TimeStep', s.stID, ...
stepsize, length(steps), steps);
ctFunc('sim1D_TimeStep', s.stID, stepsize, length(steps), steps);
end
function setValue(s, n, comp, localPoints, v)
% Set the value of a single entry in the solution vector.
% Set the value of a single entry in the solution vector. ::
%
% s.setValue(n, comp, localPoints, v)
% >> s.setValue(n, comp, localPoints, v)
%
% Example (assuming 's' is an instance of class 'Sim1D'):
% Example (assuming 's' is an instance of class :mat:class:`Sim1D`) ::
%
% setValue(s, 3, 5, 1, 5.6);
% >> s.setValue(3, 5, 1, 5.6);
%
% This sets component 5 at the leftmost point (local point 1)
% in domain 3 to the value 5.6. Note that the local index
% always begins at 1 at the left of each domain, independent of
% the global index of the point, wchih depends on the location
% of this domain in the Sim1D object.
% of this domain in the class :mat:class:`Sim1D` object.
%
% :param s:
% Instance of class 'Sim1D'.
% Instance of class :mat:class:`Sim1D`.
% :param n:
% Domain number.
% :param comp:
@ -548,10 +528,8 @@ classdef Sim1D < handle
% Local index of the grid point in the domain.
% :param v:
% Value to be set.
%
ctFunc('sim1D_setValue', s.stID, ...
n - 1, comp - 1, localPoints - 1, v);
ctFunc('sim1D_setValue', s.stID, n - 1, comp - 1, localPoints - 1, v);
end
end

View File

@ -11,7 +11,6 @@ classdef Surface < Domain1D
% :return:
% Instance of class :mat:class:`Surface` representing a
% non-reacting or reacting surface.
%
methods

View File

@ -7,7 +7,6 @@ classdef SymmPlane < Domain1D
% String ID of the symmetry plane.
% :return:
% Instance of class :mat:class:`SymmPlane`.
%
methods

View File

@ -16,7 +16,7 @@ function c = CarbonDioxide()
% Cantera C++ source code documentation.
%
% :return:
% Instance of class :mat:class:`Solution`
%
% Instance of class :mat:class:`Solution`.
c = Solution('liquidvapor.yaml', 'carbon-dioxide');
end

View File

@ -18,7 +18,7 @@ function h = HFC134a()
% Cantera C++ source code documentation.
%
% :return:
% Instance of class :mat:class:`Solution`
%
% Instance of class :mat:class:`Solution`.
h = Solution('liquidvapor.yaml', 'HFC-134a');
end

View File

@ -16,7 +16,7 @@ function h = Heptane
% Cantera C++ source code documentation.
%
% :return:
% Instance of class :mat:class:`Solution`
%
% Instance of class :mat:class:`Solution`.
h = Solution('liquidvapor.yaml', 'heptane');
end

View File

@ -16,7 +16,7 @@ function h = Hydrogen()
% Cantera C++ source code documentation.
%
% :return:
% Instance of class :mat:class:`Solution`
%
% Instance of class :mat:class:`Solution`.
h = Solution('liquidvapor.yaml', 'hydrogen');
end

View File

@ -6,21 +6,17 @@ classdef Interface < handle & ThermoPhase & Kinetics
% See `ideal-surface <https://cantera.org/documentation/docs-2.6/sphinx/html/yaml/phases.html#sec-yaml-ideal-surface>`__
% and `Declaring adjacent phases <https://cantera.org/tutorials/yaml/phases.html#declaring-adjacent-phases>`__.
%
% :param src:
% YAML file containing the interface or edge phase.
% :param id:
% Name of the interface or edge phase in the YAML file.
% :param p1:
% Adjoining phase to the interface.
% :param p2:
% Adjoining phase to the interface.
% :param p3:
% Adjoining phase to the interface.
% :param p4:
% Adjoining phase to the interface.
% :param varagin:
% Variable number of inputs consisting of the following:
% - src: YAML file containing the interface or edge phase.
% - id: Name of the interface or edge phase in the YAML file.
% Optional:
% - p1: 1st Adjoining phase to the interface.
% - p2: 2nd Adjoining phase to the interface.
% - p3: 3rd Adjoining phase to the interface.
% - p4: 4th Adjoining phase to the interface.
% :return:
% Instance of class :mat:class:`Interface`
%
% Instance of class :mat:class:`Interface`.
properties (SetAccess = public)
@ -37,25 +33,18 @@ classdef Interface < handle & ThermoPhase & Kinetics
methods
%% Interface Class Constructor
function s = Interface(src, id, p1, p2, p3, p4)
function s = Interface(varargin)
% Create an :mat:class:`Interface` object.
ctIsLoaded;
src = varargin{1};
id = varargin{2};
t = ThermoPhase(src, id);
s@ThermoPhase(src, id);
if nargin == 2
args = {};
elseif nargin == 3
args = {p1};
elseif nargin == 4
args = {p1, p2};
elseif nargin == 5
args = {p1, p2, p3};
elseif nargin == 6
args = {p1, p2, p3, p4};
end
args = varargin(3:end);
s@Kinetics(t, src, id, args{:});

View File

@ -29,9 +29,9 @@ classdef Kinetics < handle
% Standard state gibbs free energy of reaction. Unit: J/kmol-K.
deltaStandardGibbs
% Equilibrium constants for all reactions.
% Equilibrium constants for all reactions. ::
%
% k = kin.equilibriumConstants
% >> k = kin.equilibriumConstants
%
% :return:
% A column vector of the equilibrium constants for all
@ -44,9 +44,9 @@ classdef Kinetics < handle
reverseRateConstants % Reverse reaction rate constants for all reactions.
% Get the mass production rates of the species.
% Get the mass production rates of the species. ::
%
% ydot = kin.massProdRate
% >> ydot = kin.massProdRate
%
% Evaluates the source term :math:`\dot{\omega}_k M_k /\rho`
%
@ -94,25 +94,20 @@ classdef Kinetics < handle
% - ph:
% An instance of class :mat:class:`ThermoPhase` representing the
% phase in which reactions occur.
%
% - src:
% Input string of YAML file name.
% Optional:
% - id:
% ID of the phase to import as specified in the input file.
%
% - neighbor1:
% Instance of class :mat:class:`ThermoPhase` or
% :mat:class:`Solution` representing the 1st neighboring phase.
%
% - neighbor2:
% Instance of class :mat:class:`ThermoPhase` or
% :mat:class:`Solution` representing the 2nd neighboring phase.
%
% - neighbor3:
% Instance of class :mat:class:`ThermoPhase` or
% :mat:class:`Solution` representing the 3rd neighboring phase.
%
% - neighbor4:
% Instance of class :mat:class:`ThermoPhase` or
% :mat:class:`Solution` representing the 4th neighboring phase.
@ -150,7 +145,9 @@ classdef Kinetics < handle
%% Get scalar attributes
function n = kineticsSpeciesIndex(kin, name, phase)
% Get the species index of a species of a phase in the Kinetics class.
% Get the species index of a species of a phase in the Kinetics class. ::
%
% >> n = kin.kineticsSpeciesIndex(name, phase)
%
% :param name:
% String name of the species.
@ -163,11 +160,12 @@ classdef Kinetics < handle
end
function n = multiplier(kin, irxn)
% Get the multiplier for reaction rate of progress.
% Get the multiplier for reaction rate of progress. ::
%
% >> n = kin.multiplier(irxn)
%
% :param irxn:
% Integer reaction number for which the multiplier is
% desired.
% Integer reaction number for which the multiplier is desired.
% :return:
% Multiplier of the rate of progress of reaction irxn.
@ -187,7 +185,9 @@ classdef Kinetics < handle
end
function n = phaseIndex(kin, phase)
% The index of a specific phase.
% The index of a specific phase. ::
%
% >> n = kin.phaseIndex(phase)
%
% :param phase:
% String name of the phase.
@ -198,9 +198,9 @@ classdef Kinetics < handle
end
function rxn = reactionEquation(kin, irxn)
% Reaction equation of a reaction
% Reaction equation of a reaction. ::
%
% rxn = kin.reactionEqn(irxn)
% >> rxn = kin.reactionEqn(irxn)
%
% :param irxn:
% Integer index of the reaction.
@ -213,7 +213,9 @@ classdef Kinetics < handle
%% Get reaction array attributes
function n = reactantStoichCoeffs(kin, species, rxns)
% Reactant stoichiometric coefficients.
% Reactant stoichiometric coefficients. ::
%
% >> n = kin.reactantStoichCoeffs(species, rxns)
%
% :param species:
% Species indices for which reactant stoichiometric
@ -264,7 +266,9 @@ classdef Kinetics < handle
end
function n = productStoichCoeffs(kin, species, rxns)
% Product stoichiometric coefficients.
% Product stoichiometric coefficients. ::
%
% >> n = kin.productStoichCoeffs(species, rxns)
%
% :param species:
% Species indices for which product stoichiometric
@ -309,7 +313,9 @@ classdef Kinetics < handle
end
function n = netStoichCoeffs(kin, species, rxns)
% Net stoichiometric coefficients.
% Net stoichiometric coefficients. ::
%
% >> n = kin.netStoichCoeffs(species, rxns)
%
% :param species:
% Species indices for which net stoichiometric coefficients
@ -350,9 +356,9 @@ classdef Kinetics < handle
end
function n = isReversible(kin, i)
% An array of flags indicating reversibility of a reaction.
% An array of flags indicating reversibility of a reaction. ::
%
% n = kin.isReversible(i)
% >> n = kin.isReversible(i)
%
% :param i:
% Integer reaction number.
@ -487,9 +493,9 @@ classdef Kinetics < handle
%% Kinetics Set Methods
function kin = setMultiplier(kin, irxn, v)
% Set the multiplier for the reaction rate of progress.
% Set the multiplier for the reaction rate of progress. ::
%
% kin.setMultiplier(irxn, v)
% >> kin.setMultiplier(irxn, v)
%
% :param irxn:
% Integer vector reaction numbers for which the multiplier
@ -497,7 +503,6 @@ classdef Kinetics < handle
% :param v:
% Value by which the reaction rate of progress should be
% multiplied.
%
if nargin == 2
v = irxn;
@ -516,13 +521,12 @@ classdef Kinetics < handle
end
function advanceCoverages(kin, dt)
% Advance the surface coveages forward in time
% Advance the surface coveages forward in time. ::
%
% kin.advanceCoverages(dt)
% >> kin.advanceCoverages(dt)
%
% :param dt:
% Time interval by which the coverages should be advanced.
%
ctFunc('kin_advanceCoverages', kin.kinID, dt);
end

View File

@ -13,7 +13,7 @@ function m = Methane()
% University, 1979. Print.
%
% :return:
% Instance of class :mat:class:`Solution`
%
% Instance of class :mat:class:`Solution`.
m = Solution('liquidvapor.yaml', 'methane');
end

View File

@ -13,7 +13,7 @@ function n = Nitrogen()
% University, 1979. Print.
%
% :return:
% Instance of class :mat:class:`Solution`
%
% Instance of class :mat:class:`Solution`.
n = Solution('liquidvapor.yaml', 'nitrogen');
end

View File

@ -13,7 +13,7 @@ function o = Oxygen()
% University, 1979. Print.
%
% :return:
% Instance of class :mat:class:`Solution`
%
% Instance of class :mat:class:`Solution`.
o = Solution('liquidvapor.yaml', 'oxygen');
end

View File

@ -30,11 +30,9 @@ classdef Solution < handle & ThermoPhase & Kinetics & Transport
% its methods are inherited from these classes. These are:
%
% * class :mat:class:`ThermoPhase`:
% composition information and thermodynamic properties
% * class :mat:class:`Kinetics`:
% homogeneous kinetics
% * class :mat:class:`Transport`:
% transport properties
% composition information and thermodynamic properties.
% * class :mat:class:`Kinetics`: homogeneous kinetics.
% * class :mat:class:`Transport`: transport properties.
%
% See also: :mat:class:`ThermoPhase`, :mat:class:`Kinetics`, :mat:class:`Transport`
%
@ -46,8 +44,7 @@ classdef Solution < handle & ThermoPhase & Kinetics & Transport
% String, transport modeling. Possible values are ``'default'``, ``'None'``,
% ``'Mix'``, or ``'Multi'``. If not specified, ``'default'`` is used.
% :return:
% Instance of class :mat:class:`Solution`
%
% Instance of class :mat:class:`Solution`.
properties (Access = private)
tp

View File

@ -57,9 +57,9 @@ classdef ThermoPhase < handle
%
% :param tp:
% Instance of class :mat:class:`ThermoPhase` (or another
% object that derives from ThermoPhase)
% object that derives from ThermoPhase).
% :return:
% Scalar double mean molecular weight. Units: kg/kmol
% Scalar double mean molecular weight. Units: kg/kmol.
meanMolecularWeight
molarDensity % Molar basis density. Units: kmol/m^3.
@ -98,7 +98,7 @@ classdef ThermoPhase < handle
% Instance of class :mat:class:`ThermoPhase` (or another
% object that derives from ThermoPhase).
% :return:
% Vector of species chemical potentials. Units: J/kmol
% Vector of species chemical potentials. Units: J/kmol.
chemicalPotentials
% Basis-dependent specific heat at constant volume.
@ -121,11 +121,10 @@ classdef ThermoPhase < handle
%
% :param tp:
% Instance of class :mat:class:`ThermoPhase` (or another
% object that derives from ThermoPhase)
% object that derives from ThermoPhase).
% :return:
% Vector of standard-state species enthalpies
% divided by RT, where R is the universal gas
% constant and T is the temperature. For gaseous species, these
% Vector of standard-state species enthalpies constant
% and T is the temperature. For gaseous species, these
% values are ideal gas enthalpies.
enthalpies_RT
@ -148,9 +147,9 @@ classdef ThermoPhase < handle
%
% :param tp:
% Instance of class :mat:class:`ThermoPhase` (or another
% object that derives from ThermoPhase)
% object that derives from ThermoPhase).
% :return:
% Vector of maximum temperatures of all species
% Vector of maximum temperatures of all species.
maxTemp
% Minimum temperature of the parameter fits ::
@ -166,9 +165,9 @@ classdef ThermoPhase < handle
%
% :param tp:
% Instance of class :mat:class:`ThermoPhase` (or another
% object that derives from ThermoPhase)
% object that derives from ThermoPhase).
% :return:
% Vector of minimum temperatures of all species
% Vector of minimum temperatures of all species.
minTemp
refPressure % Reference pressure for standard-state. Units: Pa.
@ -218,9 +217,9 @@ classdef ThermoPhase < handle
%
% :param tp:
% Instance of class :mat:class:`ThermoPhase` (or another
% class derived from ThermoPhase)
% class derived from ThermoPhase).
% :return:
% The speed of sound. Units: m/s
% The speed of sound. Units: m/s.
soundSpeed
% All species names ::
@ -229,9 +228,9 @@ classdef ThermoPhase < handle
%
% :param tp:
% Instance of class :mat:class:`ThermoPhase` (or another
% class derived from ThermoPhase)
% class derived from ThermoPhase).
% :return:
% Cell array of strings of all of the species names
% Cell array of strings of all of the species names.
speciesNames
thermalExpansionCoeff % Thermal expansion coefficient. Units: 1/K.
@ -581,18 +580,18 @@ classdef ThermoPhase < handle
% The elemental mass fraction in a gas object is calculated using
% the following equation:
%
% elMassFrac = sum of nAtoms(k, m)*Mel(m)*Y(k)/mw(k)
% .. math:: elMassFrac = \sum_{1}^{nSpecies} \frac{nAtoms(k, m)*Mel(m)*Y(k)}{mw(k)}
%
% where nAtoms(k, m) is the number of atoms of element 'm', in
% species 'k'; Mel(m) is the atomic weight of element 'm'; Y(k)
% is the mass fraction of species 'k'; and mw(k) is the
% molecular weight of species 'k'.
% where :math:`nAtoms(k, m)` is the number of atoms of element :math:`m` in
% species :math:`k`; :math:`Mel(m)` is the atomic weight of
% element :math:`m`; :math:`Y(k)` is the mass fraction of
% species :math:`k`; and :math:`mw(k)` is the molecular weight of
% species :math:`k`.
%
% :param tp:
% Object representing the gas, instance of class :mat:class:`Solution`,
% and an ideal gas. The state of this object should be set to an
% estimate of the gas state before calling elementalMassFraction.
%
% estimate of the gas state before calling `elementalMassFraction`.
% :param element:
% String representing the element name.
% :return:

View File

@ -135,25 +135,30 @@ classdef Transport < handle
%% Transport Set Methods
function setParameters(tr, type, k, p)
% Set the parameters.
% Set the parameters. ::
%
% tr.setParameters(type, k, p)
% >> tr.setParameters(type, k, p)
%
% :param type: Specifies the type of parameters to set
% 0 : Diffusion coefficient
% 1 : Thermal Conductivity
% The rest are currently unused.
% :param k: Species index to set the parameters on
% :param p: Vector of parameters. The length of the vector varies with
% the parameterization
% :param type:
% Specifies the type of parameters to set:
%
% - 0 : Diffusion coefficient
% - 1 : Thermal Conductivity
%
% The rest are currently unused.
% :param k:
% Species index to set the parameters on.
% :param p:
% Vector of parameters. The length of the vector varies with
% the parameterization.
ctFunc('trans_setParameters', tr.trID, type, k, p);
end
function setThermalConductivity(tr, lam)
% Set the thermal conductivity.
% Set the thermal conductivity. ::
%
% tr.setThermalConductivity(lam)
% >> tr.setThermalConductivity(lam)
%
% :param lam:
% Thermal conductivity in W/(m-K).

View File

@ -16,7 +16,7 @@ function w = Water()
% Cantera C++ source code documentation.
%
% :return:
% Instance of class :mat:class:`Solution`
%
% Instance of class :mat:class:`Solution`.
w = Solution('liquidvapor.yaml', 'water');
end

View File

@ -5,6 +5,6 @@ function r = FaradayConstant
%
% :return:
% The Faraday constant in C/kmol-e.
%
r = 96485336.4595687;
end

View File

@ -5,6 +5,6 @@ function r = GasConstant
%
% :return:
% The universal gas constant in J/kmol-K.
%
r = 8314.4621;
end

View File

@ -5,6 +5,6 @@ function p = OneAtm
%
% :return:
% One atmosphere in Pascals.
%
p = 101325.0;
end

View File

@ -58,12 +58,11 @@ classdef Func < handle
% * ``'composite'``
% * ``'periodic'``
% :param n:
% Number of parameters required for the functor
% Number of parameters required for the functor.
% :param p:
% Vector of parameters
% Vector of parameters.
% :return:
% Instance of class :mat:class:`Func`
%
% Instance of class :mat:class:`Func`.
ctIsLoaded;
@ -152,17 +151,16 @@ classdef Func < handle
end
function b = subsref(a, s)
% Redefine subscripted references for functors.
% Redefine subscripted references for functors. ::
%
% b = a.subsref(s)
% >> b = a.subsref(s)
%
% :param a:
% Instance of class :mat:class:`Func`
% Instance of class :mat:class:`Func`.
% :param s:
% Value at which the function should be evaluated.
% :return:
% Returns the value of the function evaluated at ``s``
%
% Returns the value of the function evaluated at ``s``.
if length(s) > 1
aa = eval(['a.', s(1).subs]);
@ -185,15 +183,15 @@ classdef Func < handle
end
function s = char(f)
% Get the formatted string to display the function.
% Get the formatted string to display the function. ::
%
% s = f.char
% >> s = f.char
%
% :param f:
% Instance of class :mat:class:`Func`
% Instance of class :mat:class:`Func`.
% :return:
% Formatted string displaying the function
%
% Formatted string displaying the function.
if strcmp(f.typ, 'sum')
s = ['(' (f.f1.char) ') + (' f.f2.char ')'];
elseif strcmp(f.typ, 'diff')

View File

@ -1,15 +1,14 @@
classdef fplus < Func
% Fplus - Get a functor representing the sum of two input functors. ::
% Get a functor representing the sum of two input functors. ::
%
% >> f = fplus(a, b)
%
% :param a:
% Instance of class :mat:class:`Func`
% Instance of class :mat:class:`Func`.
% :param b:
% Instance of class :mat:class:`Func`
% Instance of class :mat:class:`Func`.
% :return:
% Instance of class :mat:class:`fplus`
%
% Instance of class :mat:class:`fplus`.
methods

View File

@ -1,15 +1,15 @@
classdef frdivide < Func
% Frdivide - Get a functor representing the ratio of two input functors. ::
% Get a functor representing the ratio of two input functors. ::
%
% >> f = frdivide(a, b)
%
% :param a:
% Instance of class :mat:class:`Func`
% Instance of class :mat:class:`Func`.
% :param b:
% Instance of class :mat:class:`Func`
% Instance of class :mat:class:`Func`.
% :return:
% Instance of class :mat:class:`frdivide`
%
% Instance of class :mat:class:`frdivide`.
methods
function f = frdivide(a, b)

View File

@ -1,15 +1,15 @@
classdef ftimes < Func
% Ftimes - Get a functor representing the product of two input functors. ::
% Get a functor representing the product of two input functors. ::
%
% >> f = ftimes(a, b)
%
% :param a:
% Instance of class :mat:class:`Func`
% Instance of class :mat:class:`Func`.
% :param b:
% Instance of class :mat:class:`Func`
% Instance of class :mat:class:`Func`.
% :return:
% Instance of class :mat:class:`ftimes`
%
% Instance of class :mat:class:`ftimes`.
methods
function f = ftimes(a, b)

View File

@ -1,19 +1,18 @@
classdef gaussian < Func
% Gaussian - Create a Gaussian :mat:class:`Func` instance. ::
% Create a Gaussian :mat:class:`Func` instance. ::
%
% >> f = gaussian(peak, center, width)
%
% :param peak:
% The peak value
% The peak value.
% :param center:
% Value of x at which the peak is located
% Value of x at which the peak is located.
% :param width:
% Full width at half-maximum. The value of the
% function at center +/- (width)/2 is one-half
% the peak value
% Full width at half-maximum. The value of the function
% at center +/- (width)/2 is one-half the peak value.
% :return:
% Instance of class :mat:class:`gaussian`
%
% Instance of class :mat:class:`gaussian`.
methods
function f = gaussian(peak, center, width)

View File

@ -1,5 +1,5 @@
classdef polynom < Func
% Polynom - Create a polynomial :mat:class:`Func` instance. ::
% Create a polynomial :mat:class:`Func` instance. ::
%
% >> f = polynom(coeffs)
%
@ -8,14 +8,14 @@ classdef polynom < Func
%
% .. code-block:: matlab
%
% polynom([-2 6 3]) %3x^2 + 6.0x - 2
% polynom([1.0 -2.5 0 0 2]) %2x^4 - 2.5x + 1
% polynom([-2 6 3]) % 3x^2 + 6.0x - 2
% polynom([1.0 -2.5 0 0 2]) % 2x^4 - 2.5x + 1
%
% :param coeffs:
% Vector of polynomial coefficients
% Vector of polynomial coefficients.
% :return:
% Instance of class :mat:class:`polynom`
%
% Instance of class :mat:class:`polynom`.
methods
function f = polynom(coeffs)

View File

@ -4,14 +4,13 @@ classdef Mixture < handle
% >> m = Mixture(phases)
%
% Class :mat:class:`Mixture` represents mixtures of one or more phases of matter.
% To construct a mixture, supply a cell array of phases and
% mole numbers::
% To construct a mixture, supply a cell array of phases and mole numbers ::
%
% >> gas = Solution('gas.yaml');
% >> graphite = Solution('graphite.yaml');
% >> mix = Mixture({gas, 1.0; graphite, 0.1});
%
% Phases may also be added later using the addPhase method::
% Phases may also be added later using the addPhase method ::
%
% >> water = Solution('water.yaml');
% >> mix.addPhase(water, 3.0);
@ -30,9 +29,9 @@ classdef Mixture < handle
% objects whenever it requires phase properties.
%
% :param phases:
% Cell array of phases and mole numbers
% Cell array of phases and mole numbers.
% :return:
% Instance of class :mat:class:`Mixture`
% Instance of class :mat:class:`Mixture`.
%
properties (SetAccess = immutable)
@ -48,16 +47,16 @@ classdef Mixture < handle
phases % Phases in the mixture
% Number of atoms of an element in a mixture.
% Number of atoms of an element in a mixture. ::
%
% n = m.nAtoms(e)
% >> n = m.nAtoms(e)
%
% :param m:
% Instance of class :mat:class:`Mixture`
% Instance of class :mat:class:`Mixture`.
% :param e:
% Index of element
% Index of element.
% :return:
% Number of atoms for element e
% Number of atoms for element e.
%
% Note: In keeping with the conventions used by Matlab, the
% indices start from 1 instead of 0 as in Cantera C++ and
@ -70,77 +69,75 @@ classdef Mixture < handle
nSpecies % Number of species in a mixture.
% Index of an element.
% Index of an element. ::
%
% n = m.elementIndex(name)
% >> n = m.elementIndex(name)
%
% :param m:
% Instance of class :mat:class:`Mixture`
% Instance of class :mat:class:`Mixture`.
% :param name:
% Name of the element whose index is desired
% Name of the element whose index is desired.
% :return:
% Index of element with name ``name``
% Index of element with name ``name``.
%
% Note: In keeping with the conventions used by Matlab, the
% indices start from 1 instead of 0 as in Cantera C++ and
% Python interfaces.
elementIndex
% Number of moles of an element in a mixture. ::
%
% Number of moles of an element in a mixture.
%
% moles = m.elementMoles(e)
% >> moles = m.elementMoles(e)
%
% :param m:
% Instance of class :mat:class:`Mixture`
% Instance of class :mat:class:`Mixture`.
% :param e:
% Integer element number.
% :return:
% Moles of element number 'e'. If input 'e' is empty, return
% moles of every element in the mixture. Unit: kmol.
elementMoles
% Index of a species in a mixture. ::
%
% Index of a species in a mixture.
%
% n = m.speciesIndex(k, p)
% >> n = m.speciesIndex(k, p)
%
% :param m:
% Instance of class :mat:class:`Mixture`
% Instance of class :mat:class:`Mixture`.
% :param name:
% Name of the speces whose index is desired
% Name of the speces whose index is desired.
% :return:
% Index of species with name ``name``
% Index of species with name ``name``.
%
% Note: In keeping with the conventions used by Matlab, the
% indices start from 1 instead of 0 as in Cantera C++ and
% Python interfaces.
speciesIndex
% Number of moles of a species in a mixture. ::
%
% Number of moles of a species in a mixture.
%
% moles = m.speciesMoles(k)
% >> moles = m.speciesMoles(k)
%
% :param m:
% Instance of class :mat:class:`Mixture`
% Instance of class :mat:class:`Mixture`.
% :param k:
% Integer species number.
% :return:
% Moles of species number 'k'. If input 'k' is empty, return
% moles of every species in the mixture. Unit: kmol.
%
speciesMoles
% Number of moles of a phase in a mixture. ::
%
% Number of moles of a phase in a mixture.
%
% moles = m.phaseMoles(n)
% >> moles = m.phaseMoles(n)
%
% :param m:
% Instance of class :mat:class:`Mixture`
% Instance of class :mat:class:`Mixture`.
% :param n:
% Integer phase number.
% :return:
% Moles of element number 'n'. If input 'n' is empty, return
% moles of every element in the mixture. Unit: kmol.
%
phaseMoles
chemPotentials % Chemical potentials of species in the mixture. Units: J/kmol.
@ -215,19 +212,19 @@ classdef Mixture < handle
end
function addPhase(m, phase, moles)
% Add a phase to a mixture.
% Add a phase to a mixture. ::
%
% addPhase(self, phase, moles)
% >> m.addPhase(phase, moles)
%
% :param self:
% Instance of class :mat:class:`Mixture` to which phases should be
% added
% :param m:
% Instance of class :mat:class:`Mixture` to which phases
% should be added.
% :param phase:
% Instance of class :mat:class:`ThermoPhase` which should be added
% Instance of class :mat:class:`ThermoPhase` which should be added.
% :param moles:
% Number of moles of the ``phase`` to be added to this mixture.
% Units: kmol
%
% Units: kmol.
if ~isa(phase, 'ThermoPhase')
error('Phase object of wrong type.');
end
@ -348,38 +345,38 @@ classdef Mixture < handle
end
function setPhaseMoles(m, n, moles)
% Set the number of moles of a phase in a mixture.
% Set the number of moles of a phase in a mixture. ::
%
% m.setPhaseMoles(n, moles)
% >> m.setPhaseMoles(n, moles)
%
% :param m:
% Instance of class :mat:class:`Mixture`
% Instance of class :mat:class:`Mixture`.
% :param n:
% Phase number in the input
% Phase number in the input.
% :param moles:
% Number of moles to add. Units: kmol
%
% Number of moles to add. Units: kmol.
calllib(ct, 'mix_setPhaseMoles', m.mixID, n - 1, moles);
end
function setSpeciesMoles(m, moles)
% Set the moles of the species.
% Set the moles of the species. ::
%
% m.setSpeciesMoles(moles)
% >> m.setSpeciesMoles(moles)
%
% Set the moles of the species in kmol. The moles may
% be specified either as a string, or as an vector. If a vector is
% used, it must be dimensioned at least as large as the total number
% Set the moles of the species in kmol. The moles may be specified
% either as a string, or as an vector. If a vector is used,
% it must be dimensioned at least as large as the total number
% of species in the mixture. Note that the species may belong to any
% phase, and unspecified species are set to zero. ::
%
% >> mix.setSpeciesMoles('C(s):1.0, CH4:2.0, O2:0.2');
%
% :param m:
% Instance of class :mat:class:`Mixture`
% Instance of class :mat:class:`Mixture`.
% :param moles:
% Vector or string specifying the moles of species
%
% Vector or string specifying the moles of species.
if isa(moles, 'double')
l = length(moles);
calllib(ct, 'mix_setMoles', m.mixID, l, moles);
@ -392,16 +389,16 @@ classdef Mixture < handle
end
function r = equilibrate(m, XY, err, maxsteps, maxiter, loglevel)
% Set the mixture to a state of chemical equilibrium.
% Set the mixture to a state of chemical equilibrium. ::
%
% m.equilibrate(XY, err, maxsteps, maxiter, loglevel)
% >> m.equilibrate(XY, err, maxsteps, maxiter, loglevel)
%
% This method uses a version of the VCS algorithm to find the
% composition that minimizes the total Gibbs free energy of the
% mixture, subject to element conservation constraints. For a
% description of the theory, see Smith and Missen, "Chemical
% Reaction Equilibrium." The VCS algorithm is implemented in
% Cantera kernel class MultiPhaseEquil.
% Cantera kernel class `MultiPhaseEquil`.
%
% The VCS algorithm solves for the equilibrium composition for
% specified temperature and pressure. If any other property pair
@ -413,7 +410,7 @@ classdef Mixture < handle
% >> mix.equilibrate('TP', 1.0e-6, 500)
%
% :param m:
% Instance of class :mat:class:`Mixture`
% Instance of class :mat:class:`Mixture`.
% :param XY:
% Two-letter string specifying the two properties to hold
% fixed. Currently, ``'TP'``, ``'HP'``, ``'TV'``, and ``'SP'`` are
@ -435,8 +432,8 @@ classdef Mixture < handle
% Set to a value > 0 to write diagnostic output.
% Larger values generate more detailed information.
% :return:
% The error in the solution
%
% The error in the solution.
if nargin < 6
loglevel = 0;
end

View File

@ -16,10 +16,9 @@ classdef ConstPressureReactor < Reactor
% See also: :mat:class:`Reactor`
%
% :param contents:
% Cantera :mat:class:`Solution` to be set as the contents of the
% reactor
% Cantera :mat:class:`Solution` to be set as the contents of the reactor.
% :return:
% Instance of class :mat:class:`ConstPressureReactor`
% Instance of class :mat:class:`ConstPressureReactor`.
methods

View File

@ -17,11 +17,9 @@ classdef FlowDevice < handle
% :param typ:
% Type of :mat:class:`FlowDevice` to be created. ``typ='MassFlowController'``
% for :mat:class:`MassFlowController`, ``typ='PressureController'`` for
% :mat:class:`PressureController` and ``typ='Valve'`` for
% :mat:class:`Valve`
% :mat:class:`PressureController`, and ``typ='Valve'`` for :mat:class:`Valve`.
% :return:
% Instance of class :mat:class:`FlowDevice`
%
% Instance of class :mat:class:`FlowDevice`.
properties (SetAccess = immutable)
@ -31,22 +29,22 @@ classdef FlowDevice < handle
end
properties (SetAccess = public)
%
% Upstream object of type :mat:class:`Reactor` or :mat:class:`Reservoir`.
upstream
%
% Downstream object of type :mat:class:`Reactor` or :mat:class:`Reservoir`.
downstream
%
% The mass flow rate through the :mat:class:`FlowDevice` at the current time.
%
% The setter method can either take a double value or a function represented by
% an instance of :mat:class:`Func`.
massFlowRate
%
% Valve coefficient in kg/Pa-s.
%
% The mass flow rate [kg/s] is computed from the expression
% The mass flow rate [kg/s] is computed from the expression:
%
% .. math:: \dot{m} = K(P_{upstream} - P_{downstream})
%
@ -84,19 +82,19 @@ classdef FlowDevice < handle
%% Utility Methods
function install(f, upstream, downstream)
% Install a flow device between reactors or reservoirs.
% Install a flow device between reactors or reservoirs. ::
%
% f.install(upstream, downstream)
% >> f.install(upstream, downstream)
%
% :param f:
% Instance of class :mat:class:`FlowDevice` to install
% Instance of class :mat:class:`FlowDevice` to install.
% :param upstream:
% Upstream :mat:class:`Reactor` or :mat:class:`Reservoir`
% Upstream :mat:class:`Reactor` or :mat:class:`Reservoir`.
% :param downstream:
% Downstream :mat:class:`Reactor` or :mat:class:`Reservoir`
% Downstream :mat:class:`Reactor` or :mat:class:`Reservoir`.
% :return:
% Instance of class :mat:class:`FlowDevice`
%
% Instance of class :mat:class:`FlowDevice`.
if nargin == 3
if ~isa(upstream, 'Reactor') || ~isa(downstream, 'Reactor')
@ -137,16 +135,16 @@ classdef FlowDevice < handle
end
function setMaster(f, d)
% Set the Master flow device used to compute this device's mass
% flow rate.
% Set the Master flow device used to compute this device's
% mass flow rate. ::
%
% f.setMaster(d)
% >> f.setMaster(d)
%
% :param f:
% Instance of class :mat:class:`MassFlowController`
% Instance of class :mat:class:`MassFlowController`.
% :param mf:
% Instance of class :mat:class:`Func`
%
% Instance of class :mat:class:`Func`.
if strcmp(f.type, 'PressureController')
k = ctFunc('flowdev_setMaster', f.id, d);
else

View File

@ -14,10 +14,9 @@ classdef FlowReactor < Reactor
% See also: :mat:class:`Reactor`
%
% :param contents:
% Cantera :mat:class:`Solution` to be set as the contents of the
% reactor
% Cantera :mat:class:`Solution` to be set as the contents of the reactor.
% :return:
% Instance of class :mat:class:`FlowReactor`
% Instance of class :mat:class:`FlowReactor`.
methods

View File

@ -3,10 +3,11 @@ classdef IdealGasConstPressureReactor < Reactor
%
% >> r = IdealGasConstPressureReactor(contents)
%
% An IdealGasConstPressureReactor is an instance of class Reactor where the
% pressure is held constant. The volume is not a state variable, but
% instead takes on whatever value is consistent with holding the pressure
% constant. Additionally, its governing equations are specialized for the
% An :mat:class:`IdealGasConstPressureReactor` is an instance of
% :mat:class:`Reactor` where the pressure is held constant.
% The volume is not a state variable, but instead takes on
% whatever value is consistent with holding the pressure constant.
% Additionally, its governing equations are specialized for the
% ideal gas equation of state (and do not work correctly with other
% thermodynamic models). Examples:
%
@ -15,13 +16,12 @@ classdef IdealGasConstPressureReactor < Reactor
% r1 = IdealGasConstPressureReactor % an empty reactor
% r2 = IdealGasConstPressureReactor(gas) % a reactor containing a gas
%
% See also: :mat:class:`Reactor`
% See also: :mat:class:`Reactor`
%
% :param contents:
% Cantera :mat:class:`Solution` to be set as the contents of the
% reactor
% Cantera :mat:class:`Solution` to be set as the contents of the reactor.
% :return:
% Instance of class :mat:class:`IdealGasConstPressureReactor`
% Instance of class :mat:class:`IdealGasConstPressureReactor`.
methods

View File

@ -3,9 +3,9 @@ classdef IdealGasReactor < Reactor
%
% >> r = IdealGasReactor(contents)
%
% An IdealGasReactor is an instance of class Reactor where the governing
% equations are specialized for the ideal gas equation of state (and do not
% work correctly with other thermodynamic models). Examples:
% An :mat:class:`IdealGasReactor` is an instance of :mat:class:`Reactor` where
% the governing equations are specialized for the ideal gas equation of state
% (and do not work correctly with other thermodynamic models). Examples:
%
% .. code-block:: matlab
%
@ -15,10 +15,9 @@ classdef IdealGasReactor < Reactor
% See also: :mat:class:`Reactor`
%
% :param contents:
% Cantera :mat:class:`Solution` to be set as the contents of the
% reactor
% Cantera :mat:class:`Solution` to be set as the contents of the reactor.
% :return:
% Instance of class :mat:class:`IdealGasReactor`
% Instance of class :mat:class:`IdealGasReactor`.
methods

View File

@ -14,12 +14,11 @@ classdef MassFlowController < FlowDevice
% see also: :mat:class:`FlowDevice`, :mat:class:`Valve`
%
% :param upstream:
% Upstream :mat:class:`Reactor` or :mat:class:`Reservoir`
% Upstream :mat:class:`Reactor` or :mat:class:`Reservoir`.
% :param downstream:
% Downstream :mat:class:`Reactor` or :mat:class:`Reservoir`
% Downstream :mat:class:`Reactor` or :mat:class:`Reservoir`.
% :return:
% Instance of class :mat:class:`FlowDevice`
%
% Instance of class :mat:class:`FlowDevice`.
methods

View File

@ -3,25 +3,24 @@ classdef Reactor < handle
%
% >> r = Reactor(content, typ)
%
% A 'Reactor' object simulates a perfectly-stirred reactor. It
% has a time-dependent tstate, and may be coupled to other
% A :mat:class:`Reactor` object simulates a perfectly-stirred reactor.
% It has a time-dependent tstate, and may be coupled to other
% reactors through flow lines or through walls that may expand
% or contract and/orconduct heat.
%
% :param contents:
% Instance of class 'Solution' representing the contents of
% Instance of :mat:class:`Solution` representing the contents of
% the reactor.
% :param typ:
% Character array of reactor type. Options are:
% 'Reservoir'
% 'Reactor'
% 'FlowReactor'
% 'ConstPressureReactor'
% 'IdealGasReactor'
% 'IdealGasConstPressureReactor'
% - `Reservoir`
% - `Reactor`
% - `FlowReactor`
% - `ConstPressureReactor`
% - `IdealGasReactor`
% - `IdealGasConstPressureReactor`
% :return:
% Instance of class 'Reactor'.
%
% Instance of :mat:class:`Reactor`.
properties (SetAccess = immutable)
@ -33,71 +32,70 @@ classdef Reactor < handle
properties (SetAccess = public)
contents
%
% Density of the reactor contents at the end of the last call to
% 'advance' or 'step'. Unit: kg/m^3.
% "advance" or "step". Unit: kg/m^3.
D
%
% Pressure of the reactor contents at the end of the last call to
% 'advance' or 'step'. Unit: K.
% "advance" or "step". Unit: K.
P
%
% Mass of the reactor contents at the end of the last call to
% 'advance' or 'step'. Unit: kg.
% "advance" or "step". Unit: kg.
M
%
% Mass specific enthalpy of the reactor contents at the end of the last call to
% 'advance' or 'step'. Unit: J/kg.
% "advance" or "step". Unit: J/kg.
H
%
% Mass specific internal energy of the reactor contents at the end of the last call to
% 'advance' or 'step'. Unit: J/kg.
% Mass specific internal energy of the reactor contents at the end of the last call to "advance" or "step". Unit: J/kg.
U
%
% Temperature of the reactor contents at the end of the last call to
% 'advance' or 'step'. Unit: K.
% "advance" or "step". Unit: K.
T
%
% Volume of the reactor contents at the end of the last call to
% 'advance' or 'step'. Unit: m^3.
% "advance" or "step". Unit: m^3.
V
%
% Mass fractions of the reactor contents at the end of the last call to
% 'advance' or 'step'.
% "advance" or "step".
Y
% Enable or disable changing reactor composition by reactions. ::
%
% Enable or disable changing reactor composition by reactions.
%
% r.chemistry = flag
% >> r.chemistry = flag
%
% If the chemistry is disabled, then the reactor composition is
% constant. The parameter should be the string "on" to enable
% the species equaionts, or "off" to disable it.
%
% By default, Reactor objects are created with the species
% By default, :mat:class:`Reactor` objects are created with the species
% equations enabled if there are reactions present in the
% mechanism file, and disabled otherwise.
%
% :param r:
% Instance of class 'Reactor'.
% Instance of :mat:class:`Reactor`.
% :param flag:
% String, either "on" or "off" to enable or disable chemical
% reactions, respectively.
chemistry
% Enable or disable solving the energy equation. ::
%
% Enable or disable solving the energy equation.
%
% r.energy = flag
% >> r.energy = flag
%
% If the energy equation is disabled, then the reactor
% temperature is constant. The parameter should be the string
% "on" to enable the energy equation, or "off" to disable it.
%
% By default, Reactor objects are created with the energy
% equation enabled, so usually this method
% By default, :mat:class:`Reactor` objects are created with the energy
% equation enabled, so usually this method.
%
% :param r:
% Instance of class 'Reactor'.
% Instance of :mat:class:`Reactor`.
% :param flag:
% String, either "on" or "off" to enable or disable chemical
% reactions, respectively.
@ -158,13 +156,12 @@ classdef Reactor < handle
function addSensitivityReaction(r, m)
% Specifies that the sensitivity of the state variables with
% respect to reaction m should be computed. The reactor must be
% part of a network first.
% part of a network first. ::
%
% r.addSensitivityReaction(m)
% >> r.addSensitivityReaction(m)
%
% :param m:
% Index number of reaction.
%
ctFunc('reactor_addSensitivityReaction', r.id, m);
end

View File

@ -3,17 +3,14 @@ classdef ReactorNet < handle
%
% >> r = ReactorNet(reactors)
%
% A 'ReactorNet' object is a container that holds one or more
% 'Reactor' objects in a network. 'ReactorNet' objects are used
% to simultaneously advance the state of one or more coupled
% reactors.
% A :mat:class:`ReactorNet` object is a container that holds one or more
% :mat:class:`Reactor` objects in a network. :mat:class:`ReactorNet` objects
% are used to simultaneously advance the state of one or more coupled reactors.
%
% :param reactors:
% Instance of class 'Reactor' or a cell array of instance of
% 'Reactor'.
% An instance of or a cell array of instances of class :mat:class:`Reactor`.
% :return:
% Instance of class 'ReactorNet'.
%
% Instance of class :mat:class:`ReactorNet`.
properties (SetAccess = immutable)
id
@ -21,9 +18,9 @@ classdef ReactorNet < handle
properties (SetAccess = protected)
% Internal time step in s.
% Internal time step in s. ::
%
% t = r.dt
% >> t = r.dt
%
% The integrator used to integrate the ODEs (CVODE) takes
% variable-size steps, chosen so that a specified error
@ -31,12 +28,12 @@ classdef ReactorNet < handle
% rapidly changing, the time step becomes smaller to resolve
% the solution.
dt
%
% Current time in s.
% The setter method sets the time at which integration should be
% restarted, using the current state as the initial condition.
time
%
% Max time step in s.
%
% The integrator chooses a step size based on the desired error
@ -46,7 +43,6 @@ classdef ReactorNet < handle
% integrator may choose a timestep that is too large, which
% leads to numerical problems later. Use thismethod to set an
% upper bound on the timestep.
%
maxTimeStep
atol % Absolute error tolerance.
@ -95,11 +91,11 @@ classdef ReactorNet < handle
%% ReactorNet Utility Methods
function advance(r, tout)
% Advance the state of the reactor network in time.
% Advance the state of the reactor network in time. ::
%
% r.advance(tout)
% >> r.advance(tout)
%
% Method 'advance' integrates the system of ODEs that determine
% Method `advance` integrates the system of ODEs that determine
% the rate of change of the volume, the mass of each species,
% and the total energy for each reactor. The integration is
% carried out from the current time to "tout". (Note: "tout" is
@ -108,7 +104,6 @@ classdef ReactorNet < handle
%
% :param tout:
% End time of the integration. Unit: s.
%
ctFunc('reactornet_advance', r.id, tout);
end
@ -120,29 +115,28 @@ classdef ReactorNet < handle
end
function set.maxTimeStep(r, maxstep)
% Set the maximum time step.
% Set the maximum time step. ::
%
% r.setMaxTimeStep(maxstep)
% >> r.setMaxTimeStep(maxstep)
%
% The integrator chooses a step size based on the desired error
% tolerance and the rate at which the solution is changing.
% In some cases, the solution changes very slowly at first,
% then very rapidly (ifnition problems). In such cases, the
% then very rapidly (ignition problems). In such cases, the
% integrator may choose a timestep that is too large, which
% leads to numerical problems later. Use thismethod to set an
% upper bound on the timestep.
%
% :param maxstep:
% Scalar max time step.
%
ctFunc('reactornet_setMaxTimeStep', r.id, maxstep);
end
function setSensitivityTolerances(r, rerr, aerr)
% Set the error tolerance for sensitivity analysis.
% Set the error tolerance for sensitivity analysis. ::
%
% r.setSensitivityTOlerances(rerr, aerr)
% >> r.setSensitivityTOlerances(rerr, aerr)
%
% :param rerr:
% Scalar relative error tolerance.
@ -181,10 +175,10 @@ classdef ReactorNet < handle
end
function s = sensitivity(r, component, p, rxtr)
% Sensitivity of the solution variable c in reactor
% rxtr with respect to the parameter p.
% Sensitivity of the solution variable `c` in reactor `rxtr`
% with respect to the parameter `p` ::
%
% s = r.sensitivity(component, p, rxtr)
% >> s = r.sensitivity(component, p, rxtr)
%
% :param component:
% String name of variable.

View File

@ -12,21 +12,18 @@ classdef ReactorSurface < handle
%
% Note: all of the arguments are optional and can be activated
% after initial construction by using the various methods of
% the 'ReactorSurface' class.
% the :mat:class:`ReactorSurface` class.
%
% :param surf:
% Surface reaction mechanisms for the left-facing surface.
% This must bean instance of class 'Kinetics', or of a class
% derived from 'Kinetics', such as 'Interface'.
% :param reactor:
% Instance of class 'Reactor' to be used as the adjacent
% bulk phase.
% Instance of class 'Reactor' to be used as the adjacent bulk phase.
% :param area:
% The area of the surface in m^2. Defaults to 1.0 m^2 if not
% specified.
% The area of the surface in m^2. Defaults to 1.0 m^2 if not specified.
% :return:
% Instance of class 'ReactorSurface'.
%
% Instance of class :mat:class:`ReactorSurface`.
properties (SetAccess = immutable)
surfID
@ -97,9 +94,9 @@ classdef ReactorSurface < handle
function addSensitivityReaction(s, m)
% Specifies that the sensitivity of the state variables with
% respect to reaction m should be computed. The surface must be
% installed on a reactor and part of a network first.
% installed on a reactor and part of a network first. ::
%
% s.addSensitivityReaction(m)
% >> s.addSensitivityReaction(m)
%
% :param m:
% Index number of reaction.

View File

@ -1,11 +1,11 @@
classdef Reservoir < Reactor
% Create a Reservoir object. ::
% Create a :mat:class:`Reservoir` object. ::
%
% >> r = Reservoir(contents)
%
% A :mat:class:`Reservoir` is an instance of class :mat:class:`Reactor`
% configured so that its intensive state is constant in time. A
% reservoir may be thought of as infinite in extent, perfectly mixed,
% configured so that its intensive state is constant in time. A reservoir
% may be thought of as infinite in extent, perfectly mixed,
% and non-reacting, so that fluid may be extracted or added without
% changing the composition or thermodynamic state. Note that even
% if the reaction mechanism associated with the fluid in the
@ -20,11 +20,9 @@ classdef Reservoir < Reactor
% See also: :mat:class:`Reactor`
%
% :param contents:
% Cantera :mat:class:`Solution` to be set as the contents of the
% reactor
% Cantera :mat:class:`Solution` to be set as the contents of the reactor.
% :return:
% Instance of class :mat:class:`Reactor`
%
% Instance of class :mat:class:`Reactor`.
methods

View File

@ -24,11 +24,11 @@ classdef Valve < FlowDevice
% see also: :mat:class:`FlowDevice`, :mat:class:`MassFlowController`
%
% :param upstream:
% Upstream 'Reactor' or 'Reservoir'.
% Upstream reactor or reservoir.
% :param downstream:
% Downstream 'Reactor' or 'Reservoir.
% Downstream Reactor or reservoir.
% :return:
% Instance of class 'FlowDevice'.
% Instance of class :mat:class:`FlowDevice`.
methods

View File

@ -14,7 +14,7 @@ classdef Wall < handle
% the acceleration or displacement, that is specified. The wall
% velocity is computed from:
%
% v = K(P_left - P_right) + v_0(t),
% .. math:: v = K(P_{left} - P_{right}) + v_0(t),
%
% where K is a non-negative constant, and v_0 is a specified
% function of time. The velocity is positive if the wall is
@ -22,7 +22,7 @@ classdef Wall < handle
%
% The heat flux through the wall is computed from:
%
% q = U(T_left - T_right) + q_0(t),
% .. math:: q = U(T_{left} - T_{right}) + q_0(t),
%
% where U is the overall heat transfer coefficient for
% conduction/convection, and q_0 is a specified function of
@ -32,17 +32,16 @@ classdef Wall < handle
% Note: the Wall class constructor only assign default values
% to various properties. The user could specify those properties
% after initial construction by using the various methods of
% the 'Wall' class.
% the Wall class.
%
% :param l:
% Instance of class 'Reactor' to be used as the bulk phase
% Instance of class :mat:class:`Reactor` to be used as the bulk phase
% on the left side of the wall.
% :param r:
% Instance of class 'Reactor' to be used as the bulk phase
% Instance of class :mat:class:`Reactor` to be used as the bulk phase
% on the right side of the wall.
% :return:
% Instance of class 'Wall'.
%
% Instance of class :mat:class:`Wall`.
properties (SetAccess = immutable)
@ -65,18 +64,18 @@ classdef Wall < handle
heatTransferCoeff % Heat transfer coefficient in W/(m^2-K).
emissivity % Non-dimensional emissivity.
expansionRateCoeff % Expansion rate coefficient in m/(s-Pa).
%
% Heat flux in W/m^2.
%
% Must be set by an instance of class 'Func', which allows the
% Must be set by an instance of :mat:class:`Func`, which allows the
% heat flux to be an arbitrary function of time. It is possible
% to specify a constant heat flux by using the polynomial
% functor with only the first term specified.
heatFlux
%
% Velocity in m/s.
%
% Must be set by an instance of class 'Func', which allows the
% Must be set by an instance of :mat:class:`Func`, which allows the
% velocity to be an arbitrary function of time. It is possible
% to specify a constant velocity by using the polynomial
% functor with only the first term specified.

View File

@ -1,6 +1,6 @@
function ctCleanUp()
% Delete all stored Cantera objects and reclaim memory.
%
ctIsLoaded;
classList = {'Domain1D', 'Sim1D', 'Func', 'Kinetics', ...

View File

@ -7,7 +7,7 @@ function d = ctDataDirectories()
%
% :return:
% Cell array with strings representing the data file search directories
%
ctIsLoaded;
buflen = calllib(ct, 'ct_getDataDirectories', 0, '', ';');
aa = char(ones(1, buflen));

View File

@ -1,6 +1,5 @@
function e = ctGetErr()
% Get the error message from a Cantera error.
%
try
e = ctString('ct_getCanteraError');

View File

@ -5,7 +5,7 @@ function v = ctGitCommit()
%
% :return:
% A string containing the Git commit hash for the current version of Cantera.
%
ctIsLoaded;
v = ctString('ct_getGitCommit');
end

View File

@ -1,6 +1,6 @@
function ctLoad()
% Load the Cantera C Library into Memory
%
if ispc
ctName = '/Lib/cantera_shared.dll';
elseif ismac

View File

@ -1,6 +1,6 @@
function ctUnload()
% Unload the Cantear C Library from the Memory
%
if libisloaded(ctLib)
ctCleanUp;
unloadlibrary(ctLib);

View File

@ -5,7 +5,7 @@ function v = ctVersion()
%
% :return:
% A string containing the Cantera version.
%
ctIsLoaded;
v = ctString('ct_getCanteraVersion');
end

View File

@ -65,7 +65,7 @@ for i = 1:20
gas.TPX = {t, p, x};
surf_phase.advanceCoverages(10.0);
r = surf_phase.netProdRates;
carbon_dot = r(iC + 1);
carbon_dot = r(iC);
mdot = mw * carbon_dot;
rate = mdot / dbulk.D;
xx = [xx; x(ih)];