Warning
This documentation is for an old version of Cantera. You can find docs for newer versions here.
The classes in this package implement one-dimensional reacting flow problems.
Base class for one-dimensional domains.
Return the (lower, upper) bounds for a solution component.
>>> d.bounds('T')
(200.0, 5000.0)
Index of the component with name ‘name’
Name of the nth component.
List of the names of all components of this domain.
Integer used to reference the kernel object.
If n >= 0, return the value of the nth grid point from the left in this domain. If n is not supplied, return the entire grid.
>>> z4 = d.grid(4)
>>> z_array = d.grid()
Index of this domain in a stack. Returns -1 if this domain is not part of a stack.
Number of solution components at each grid point.
Number of grid points belonging to this domain.
convenient function to invoke other methods. Parameters that can be set:
grid, name, desc
>>> d.set(name='flame', grid=z)
Set the lower and upper bounds on the solution.
The argument list should consist of keyword/value pairs, with component names as keywords and (lower_bound, upper_bound) tuples as the values. The keyword default may be used to specify default bounds for all unspecified components. The keyword Y can be used to stand for all species mass fractions in flow domains.
>>> d.setBounds(default=(0, 1),
... Y=(-1.0e-5, 2.0))
Set the description of this domain.
Set the error tolerances. If time is present and non-zero, then the values entered will apply to the transient problem. Otherwise, they will apply to the steady-state problem.
The argument list should consist of keyword/value pairs, with component names as keywords and (rtol, atol) tuples as the values. The keyword default may be used to specify default bounds for all unspecified components. The keyword Y can be used to stand for all species mass fractions in flow domains.
>>> d.setTolerances(Y=(1.0e-5, 1.0e-9),
... default=(1.0e-7, 1.0e-12),
... time=1)
Specify the grid.
>>> d.setupGrid([0.0, 0.1, 0.2])
Return the (relative, absolute) error tolerances for a solution component.
>>> (r, a) = d.tolerances('u')
Domain type. Integer.
Clear all domains.
Clear all stacks.
Bases: Cantera.OneD.onedim.Domain1D
An axisymmetric flow domain.
In an axisymmetric flow domain, the equations solved are the similarity equations for the flow in a finite-height gap of infinite radial extent. The solution variables are
It may be shown that if the boundary conditions on these variables are independent of radius, then a similarity solution to the exact governing equations exists in which these variables are all independent of radius. This solution holds only in in low-Mach-number limit, in which case (dP/dz) = 0, and lambda is a constant. (Lambda is treated as a spatially-varying solution variable for numerical reasons, but in the final solution it is always independent of z.) As implemented here, the governing equations assume an ideal gas mixture. Arbitrary chemistry is allowed, as well as arbitrary variation of the transport properties.
Include or exclude thermal diffusion (Soret effect) when computing diffusion velocities. If withSoret is not supplied or is positive, thermal diffusion is enabled; otherwise it is disabled.
Pressure [Pa].
Set parameters. In addition to the parameters that may be set by Domain1D.set, this method can be used to set the pressure and energy flag
>>> d.set(pressure=OneAtm, energy='on')
Set the fixed temperature profile. This profile is used whenever the energy equation is disabled.
Parameters: |
|
---|
>>> d.setFixedTempProfile(array([0.0, 0.5, 1.0]),
... array([500.0, 1500.0, 2000.0])
Set the pressure [Pa]. The pressure is a constant, since the governing equations are those for the low-Mach-number limit.
Set the transport model. The argument must be a transport manager for the ‘gas’ object.
Enable or disable solving the energy equation. If invoked with no arguments or with a non-zero argument, the energy equations will be solved. If invoked with a zero argument, it will not be, and instead the temperature profiles will be held to the one specified by the call to setFixedTempProfile(). Default: energy equation enabled.
Enable or disable solving the species equations. If invoked with no arguments or with a non-zero argument, the species equations will be solved. If invoked with a zero argument, they will not be, and instead the species profiles will be held at their initial values. Default: species equations enabled.
Bases: Cantera.OneD.onedim.Stack
An axisymmetric flow impinging on a surface at normal incidence.
Parameters: |
|
---|
A domain of type AxisymmetricFlow named flow will be created to represent the flow, and one of type Surface named surface will be created to represent the surface. The three domains comprising the stack are stored as self.inlet, self.flow, and self.surface.
The temperature [K]
The radial velocity divided by radius [s^-1]
The coverages of the surface species.
Set the initial guess for the solution. If products = ‘equil’, then the equilibrium composition at the adiabatic flame temperature will be used to form the initial guess. Otherwise the inlet composition will be used.
Set parameters.
Parameters: |
|
---|
Set the state of the object representing the gas to the current solution at grid point j.
Set the minimum allowable grid spacing in a domain.
Parameters: |
|
---|
Set an initial estimate for a profile of one component in one domain.
Parameters: |
|
---|
>>> s.setProfile(d, 'T', [0.0, 0.2, 1.0], [400.0, 800.0, 1500.0])
Set the criteria used to refine one domain.
Parameters: |
|
---|
>>> s.setRefineCriteria(d, ratio=5.0, slope=0.2, curve=0.3,
... prune=0.03)
The solution for one specified component. If a point number is given, return the value of component component at this point. Otherwise, return the entire profile for this component.
Solve the problem.
Parameters: |
|
---|
The axial velocity [m/s]
Bases: Cantera.OneD.onedim.Domain1D
Base class for boundary domains.
The mass fraction of species k.
The mass flow rate per unit area [kg/m2/s
Set parameters: mdot or massflux temperature or T mole_fractions or X
Set the mass flow rate per unit area [kg/m2].
set the mole fraction values.
Set the temperature [K]
Set the temperature [K].
Bases: Cantera.OneD.onedim.Bdry1D
A one-dimensional inlet. Note that an inlet can only be a terminal domain - it must be either the leftmost or rightmost domain in a stack.
Set the spead rate, defined as the value of V = v/r at the inlet.
Bases: Cantera.OneD.onedim.Bdry1D
A one-dimensional outlet. An outlet imposes a zero-gradient boundary condition on the flow.
Bases: Cantera.OneD.onedim.Bdry1D
A one-dimensional outlet into a reservoir.
Bases: Cantera.OneD.onedim.Bdry1D
A symmetry plane.
Class Stack is a container for one-dimensional domains. It also holds the multi-domain solution vector, and controls the process of finding the solution.
Domains are ordered left-to-right, with domain number 0 at the left.
This class is largely a shadow class for C++ kernel class Sim1D.
Integer index of the domain with name ‘name’
Evaluate the residual function. If count = 0, do is ‘silently’, without adding to the function evaluation counter
Load the initial solution from each domain into the global solution vector.
Spatial profile of one component in one domain.
>>> print s.profile(flow, 'T')
Refine the grid, adding points where solution is not adequately resolved.
Set the solution vector to a previously-saved solution.
Parameters: |
|
---|
>>> s.restore(file = 'save.xml', id = 'energy_off')
Save the solution in XML format.
>>> s.save(file='save.xml', id='energy_off',
... desc='solution with energy eqn. disabled')
This is a temporary fix.
Set a flat profile for one component in one domain.
Parameters: |
|
---|
>>> s.setFlatProfile(d, 'u', -3.0)
Set the minimum allowable grid spacing in a domain.
Parameters: |
|
---|
Set the maximum number of times the Jacobian will be used before it must be re-evaluated.
Parameters: |
|
---|
Set an initial estimate for a profile of one component in one domain.
Parameters: |
|
---|
>>> s.setProfile(d, 'T', [0.0, 0.2, 1.0], [400.0, 800.0, 1500.0])
Set the criteria used to refine one domain.
Parameters: |
|
---|
>>> s.setRefineCriteria(d, ratio=5.0, slope=0.2, curve=0.3,
... prune=0.03)
Set the sequence of time steps to try when Newton fails.
Parameters: |
|
---|
>>> s.setTimeStep(1.0e-5, [1, 2, 5, 10])
Set the maximum and minimum time steps.
Set the value of one component in one domain at one point to ‘value’.
Parameters: |
|
---|
>>> s.set(d, 3, 5, 6.7)
Show the current solution. If called with no argument, the solution is printed to the screen. If a filename is supplied, it is written to the file.
>>> s.showSolution()
>>> s.showSolution('soln.txt')
Show the statistics for the last solution. If invoked with no arguments or with a non-zero argument, the timing statistics will be printed. If invoked with a zero argument, the timing will not be printed. Default: print timing enabled.
Solve the problem.
Parameters: |
|
---|
Set the factor by which the time step will be increased after a successful step, or decreased after an unsuccessful one.
>>> s.timeStepFactor(3.0)
Solution value at one point.
Parameters: |
|
---|
>>> t = s.value(flow, 'T', 6)
Internal work array value at one point. After calling eval, this array contains the values of the residual function.
Parameters: |
|
---|
>>> t = s.value(flow, 'T', 6)
Bases: Cantera.OneD.onedim.Stack
A burner-stabilized flat flame.
Parameters: |
|
---|
A domain of type AxisymmetricFlow named ‘flame’ will be created to represent the flame. The three domains comprising the stack are stored as self.burner, self.flame, and self.outlet.
Temperature profile or value at one point.
Radial velocity profile or value at one point.
Set the initial guess for the solution. The adiabatic flame temperature and equilibrium composition are computed for the burner gas composition. The temperature profile rises linearly in the first 20% of the flame to Tad, then is flat. The mass fraction profiles are set similarly.
Set parameters.
Parameters: |
|
---|
Set the state of the object representing the gas to the current solution at grid point j.
Set the minimum allowable grid spacing in a domain.
Parameters: |
|
---|
Set an initial estimate for a profile of one component in one domain.
Parameters: |
|
---|
>>> s.setProfile(d, 'T', [0.0, 0.2, 1.0], [400.0, 800.0, 1500.0])
Set the criteria used to refine one domain.
Parameters: |
|
---|
>>> s.setRefineCriteria(d, ratio=5.0, slope=0.2, curve=0.3,
... prune=0.03)
Solution component at one point, or full profile if no point specified.
Solve the problem.
Parameters: |
|
---|
Axial velocity profile or value at one point.
Bases: Cantera.OneD.onedim.Stack
A burner-stabilized flat flame.
Parameters: |
|
---|
A domain of type AxisymmetricFlow named flame will be created to represent the flame. The three domains comprising the stack are stored as self.burner, self.flame, and self.outlet.
Temperature profile or value at one point.
Radial velocity profile or value at one point.
Set the initial guess for the solution. The adiabatic flame temperature and equilibrium composition are computed for the burner gas composition. The temperature profile rises linearly in the first 20% of the flame to Tad, then is flat. The mass fraction profiles are set similarly.
Set parameters.
Parameters: |
|
---|
Set the state of the object representing the gas to the current solution at grid point j.
Set the minimum allowable grid spacing in a domain.
Parameters: |
|
---|
Set an initial estimate for a profile of one component in one domain.
Parameters: |
|
---|
>>> s.setProfile(d, 'T', [0.0, 0.2, 1.0], [400.0, 800.0, 1500.0])
Set the criteria used to refine one domain.
Parameters: |
|
---|
>>> s.setRefineCriteria(d, ratio=5.0, slope=0.2, curve=0.3,
... prune=0.03)
Solution component at one point, or full profile if no point specified.
Solve the problem.
Parameters: |
|
---|
Axial velocity profile or value at one point.
Bases: Cantera.OneD.onedim.Stack
A non-premixed counterflow flame.
The domains are:
[self.fuel_inlet, # class Inlet,
self.flame, # class AxisymmetricFlow, self.oxidizer_inlet] # class Inlet
The temperature [K]
The radial velocity divided by radius [s^-1]
Set the initial guess for the solution. The fuel species must be specified, and the oxidizer may be
>>> f.init(fuel='CH4')
The initial guess is generated by assuming infinitely-fast chemistry.
Set parameters.
Parameters: |
|
---|
Set the state of the object representing the gas to the current solution at grid point j.
Set the minimum allowable grid spacing in a domain.
Parameters: |
|
---|
Set an initial estimate for a profile of one component in one domain.
Parameters: |
|
---|
>>> s.setProfile(d, 'T', [0.0, 0.2, 1.0], [400.0, 800.0, 1500.0])
Set the criteria used to refine one domain.
Parameters: |
|
---|
>>> s.setRefineCriteria(d, ratio=5.0, slope=0.2, curve=0.3,
... prune=0.03)
The solution for one specified component. If a point number is given, return the value of component ‘component’ at this point. Otherwise, return the entire profile for this component.
Solve the problem.
Parameters: |
|
---|
The axial velocity [m/s]