Warning
This documentation is for an old version of Cantera. You can find docs for newer versions here.
Bases: cantera.onedim.FlameBase
A freely-propagating flat flame.
A domain of type FreeFlow named ‘flame’ will be created to represent the flame. The three domains comprising the stack are stored as self.inlet, self.flame, and self.outlet.
Set the initial guess for the solution. The adiabatic flame temperature and equilibrium composition are computed for the inlet gas composition. The temperature profile rises linearly over 20% of the domain width to Tad, then is flat. The mass fraction profiles are set similarly.
Bases: cantera.onedim.FlameBase
A burner-stabilized flat flame.
Parameters: |
|
---|
A domain of class AxisymmetricStagnationFlow 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.
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.
Bases: cantera.onedim.FlameBase
A counterflow diffusion flame
Parameters: |
|
---|
A domain of class AxisymmetricStagnationFlow named flame will be created to represent the flame. The three domains comprising the stack are stored as self.fuel_inlet, self.flame, and self.oxidizer_inlet.
Compute the mixture fraction based on element m
The mixture fraction is computed from the elemental mass fraction of element m, normalized by its values on the fuel and oxidizer inlets:
Parameters: | m – The element based on which the mixture fraction is computed, may be specified by name or by index |
---|
>>> f.mixture_fraction('H')
Set the initial guess for the solution. The fuel species must be specified:
>>> f.set_initial_guess(fuel='CH4')
The oxidizer and corresponding stoichiometry must be specified if it is not ‘O2’. The initial guess is generated by assuming infinitely- fast chemistry.
Solve the problem.
Parameters: |
|
---|
Return the axial strain rate of the counterflow diffusion flame in 1/s.
Parameters: |
|
---|
The parameter definition sets the method to compute the strain rate. Possible options are:
The mean axial velocity gradient in the entire domain
The maximum axial velocity gradient
The axial velocity gradient at the stoichiometric surface.
This method uses the additional keyword arguments fuel, oxidizer, and stoich.
>>> f.strain_rate('stoichiometric', fuel='H2', oxidizer='O2',
stoich=0.5)
The corresponding axial strain rate for a potential flow boundary condition at the fuel inlet.
The corresponding axial strain rate for a potential flow boundary condition at the oxidizer inlet.
Bases: cantera.onedim.FlameBase
A premixed counterflow flame
Parameters: |
|
---|
A domain of class AxisymmetricStagnationFlow named flame will be created to represent the flame. The three domains comprising the stack are stored as self.reactants, self.flame, and self.products.
Set the initial guess for the solution.
If equilibrate is True, then the products composition and temperature will be set to the equilibrium state of the reactants mixture.
Bases: cantera.onedim.FlameBase
An axisymmetric flow impinging on a surface at normal incidence.
Parameters: |
|
---|
A domain of class AxisymmetricStagnationFlow named flame will be created to represent the flow. The three domains comprising the stack are stored as self.inlet, self.flame, and self.surface.
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.
Bases: cantera._cantera._FlowBase
Pressure [Pa]
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.
A description of this domain
Determines whether or not to solve the energy equation.
The grid for this domain
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.
The name / id of this domain
Determines whether or not to include radiative heat transfer
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.set_bounds(default=(0, 1), Y=(-1.0e-5, 2.0))
Set the fixed temperature profile. This profile is used whenever the energy equation is disabled.
Parameters: |
|
---|
>>> d.set_fixed_temp_profile(array([0.0, 0.5, 1.0]),
... array([500.0, 1500.0, 2000.0])
Set the error tolerances for 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.
Set the error tolerances for 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.
Set the Solution object used for calculating transport properties.
Determines whether or not to include diffusive mass fluxes due to the Soret effect. Enabling this option works only when using the multicomponent transport model.
Return the (relative, absolute) error tolerances for a solution component.
>>> rtol, atol = d.tolerances('u')
Bases: cantera._cantera._FlowBase
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.
Pressure [Pa]
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.
A description of this domain
Determines whether or not to solve the energy equation.
The grid for this domain
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.
The name / id of this domain
Determines whether or not to include radiative heat transfer
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.set_bounds(default=(0, 1), Y=(-1.0e-5, 2.0))
Set the fixed temperature profile. This profile is used whenever the energy equation is disabled.
Parameters: |
|
---|
>>> d.set_fixed_temp_profile(array([0.0, 0.5, 1.0]),
... array([500.0, 1500.0, 2000.0])
Set the error tolerances for 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.
Set the error tolerances for 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.
Set the Solution object used for calculating transport properties.
Determines whether or not to include diffusive mass fluxes due to the Soret effect. Enabling this option works only when using the multicomponent transport model.
Return the (relative, absolute) error tolerances for a solution component.
>>> rtol, atol = d.tolerances('u')
Bases: cantera._cantera.Boundary1D
A one-dimensional outlet. An outlet imposes a zero-gradient boundary condition on the flow.
Bases: cantera._cantera.Boundary1D
A one-dimensional outlet into a reservoir.
Bases: cantera._cantera.Boundary1D
A symmetry plane.
Bases: cantera._cantera.Boundary1D
A solid surface.
Bases: object
Domain1D(name=None, *args, **kwargs)
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.
A description of this domain
The grid for this domain
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.
The name / id of this domain
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.set_bounds(default=(0, 1), Y=(-1.0e-5, 2.0))
Set the error tolerances for 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.
Set the error tolerances for 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.
Return the (relative, absolute) error tolerances for a solution component.
>>> rtol, atol = d.tolerances('u')
Bases: cantera._cantera.Domain1D
Boundary1D(_SolutionBase phase, *args, **kwargs)
Base class for boundary domains.
Parameters: | phase – The (gas) phase corresponding to the adjacent flow domain |
---|
The temperature [K] at this boundary.
Species mole fractions at this boundary. May be set as either a string or as an array.
Species mass fractions at this boundary. May be set as either a string or as an array.
The mass flow rate per unit area [kg/m^2]
Bases: object
Sim1D(domains, *args, **kwargs)
Class Sim1D 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.
Clear solver statistics.
Get the index of a domain, specified either by name or as a Domain1D object.
domains: object
Spatial profile of one component in one domain.
Parameters: |
|
---|
>>> T = 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(filename='save.xml', name='energy_off')
Save the solution in XML format.
Parameters: |
|
---|
>>> s.save(filename='save.xml', name='energy_off',
... description='solution with energy eqn. disabled')
Set the temperature used to fix the spatial location of a freely propagating flame.
Set a flat profile for one component in one domain.
Parameters: |
|
---|
>>> s.set_flat_profile(d, 'u', -3.0)
Set the minimum grid spacing on domain. If domain is None, then set the grid spacing for all domains.
Set the initial guess for the solution. Derived classes extend this function to set approximations for the temperature and composition profiles.
Set an interrupt function to be called each time that OneDim::eval is called. The signature of f is float f(float). The default interrupt function is used to trap KeyboardInterrupt exceptions so that ctrl-c can be used to break out of the C++ solver loop.
Set the maximum number of times the Jacobian will be used before it must be re-evaluated.
Parameters: |
|
---|
Set the maximum time step.
Set the minimum time step.
Set an initial estimate for a profile of one component in one domain.
Parameters: |
|
---|
>>> s.set_profile(d, 'T', [0.0, 0.2, 1.0], [400.0, 800.0, 1500.0])
Set the criteria used to refine one domain.
Parameters: |
|
---|
>>> s.set_refine_criteria(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.set_time_step(1.0e-5, [1, 2, 5, 10])
Set the factor by which the time step will be increased after a successful step, or decreased after an unsuccessful one.
Set the value of one component in one domain at one point to ‘value’.
Parameters: |
|
---|
>>> s.set(d, 3, 5, 6.7)
>>> s.set(1, 0, 5, 6.7)
>>> s.set('flow', 'T', 5, 500)
print the current solution.
Show the statistics for the last solution.
If invoked with no arguments or with a non-zero argument, the timing statistics will be printed. Otherwise, the timing will not be printed.
Solve the problem.
Parameters: |
|
---|
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._cantera.Sim1D
Base class for flames with a single flow domain
Parameters: |
|
---|
Array containing the radial pressure gradient (1/r)(dP/dr) [N/m^4] at each point. Note: This value is named ‘lambda’ in the C++ code.
Get/Set the pressure of the flame [Pa]
Array containing the temperature [K] at each grid point.
Array containing the tangential velocity gradient [1/s] at each point.
Get/Set the species mole fractions. Can be set as an array, as a dictionary, or as a string. Always returns an array:
>>> phase.X = [0.1, 0, 0, 0.4, 0, 0, 0, 0, 0.5]
>>> phase.X = {'H2':0.1, 'O2':0.4, 'AR':0.5}
>>> phase.X = 'H2:0.1, O2:0.4, AR:0.5'
>>> phase.X
array([0.1, 0, 0, 0.4, 0, 0, 0, 0, 0.5])
Returns an array of size n_species x n_points.
Get/Set the species mass fractions. Can be set as an array, as a dictionary, or as a string. Always returns an array:
>>> phase.Y = [0.1, 0, 0, 0.4, 0, 0, 0, 0, 0.5]
>>> phase.Y = {'H2':0.1, 'O2':0.4, 'AR':0.5}
>>> phase.Y = 'H2:0.1, O2:0.4, AR:0.5'
>>> phase.Y
array([0.1, 0, 0, 0.4, 0, 0, 0, 0, 0.5])
Returns an array of size n_species x n_points.
Array of species chemical potentials [J/kmol].
Returns an array of size n_species x n_points.
Get/Set the species concentrations [kmol/m^3].
Returns an array of size n_species x n_points.
Heat capacity at constant pressure [J/kg/K or J/kmol/K] depending on basis.
Returns an array of length n_points.
Specific heat capacity at constant pressure [J/kg/K].
Returns an array of length n_points.
Molar heat capacity at constant pressure [J/kmol/K].
Returns an array of length n_points.
Creation rates for each species. [kmol/m^3/s] for bulk phases or [kmol/m^2/s] for surface phases.
Returns an array of size n_species x n_points.
Heat capacity at constant volume [J/kg/K or J/kmol/K] depending on basis.
Returns an array of length n_points.
Specific heat capacity at constant volume [J/kg/K].
Returns an array of length n_points.
Molar heat capacity at constant volume [J/kmol/K].
Returns an array of length n_points.
Change in enthalpy for each reaction [J/kmol].
Returns an array of size n_reactions x n_points.
Change in entropy for each reaction [J/kmol/K].
Returns an array of size n_reactions x n_points.
Change in Gibbs free energy for each reaction [J/kmol].
Returns an array of size n_reactions x n_points.
Change in standard-state enthalpy (independent of composition) for each reaction [J/kmol].
Returns an array of size n_reactions x n_points.
Change in standard-state entropy (independent of composition) for each reaction [J/kmol/K].
Returns an array of size n_reactions x n_points.
Change in standard-state Gibbs free energy (independent of composition) for each reaction [J/kmol].
Returns an array of size n_reactions x n_points.
Density [kg/m^3 or kmol/m^3] depending on basis.
Returns an array of length n_points.
(Mass) density [kg/m^3].
Returns an array of length n_points.
Molar density [kmol/m^3].
Returns an array of length n_points.
Destruction rates for each species. [kmol/m^3/s] for bulk phases or [kmol/m^2/s] for surface phases.
Returns an array of size n_species x n_points.
Array of species electrochemical potentials [J/kmol].
Returns an array of size n_species x n_points.
Get the elemental mass fraction \(Z_{\mathrm{mass},m}\) of element \(m\) at each grid point, which is defined as:
with \(a_{m,k}\) being the number of atoms of element \(m\) in species \(k\), \(M_m\) the atomic weight of element \(m\), \(M_k\) the molecular weight of species \(k\), and \(Y_k\) the mass fraction of species \(k\).
Parameters: | m – Base element, may be specified by name or by index. |
---|
>>> phase.elemental_mass_fraction('H')
[1.0, ..., 0.0]
Get the elemental mole fraction \(Z_{\mathrm{mole},m}\) of element \(m\) at each grid point, which is defined as:
with \(a_{m,k}\) being the number of atoms of element \(m\) in species \(k\) and \(X_k\) the mole fraction of species \(k\).
Parameters: | m – Base element, may be specified by name or by index. |
---|
>>> phase.elemental_mole_fraction('H')
[1.0, ..., 0.0]
Get/Set whether or not to solve the energy equation.
Specific enthalpy [J/kg].
Returns an array of length n_points.
Molar enthalpy [J/kmol].
Returns an array of length n_points.
Specific entropy [J/kg].
Returns an array of length n_points.
Molar entropy [J/kmol/K].
Returns an array of length n_points.
Equilibrium constants in concentration units for all reactions.
Returns an array of size n_reactions x n_points.
Forward rate constants for all reactions. Units are a combination of kmol, m^3 and s, that depend on the rate expression for the reaction.
Returns an array of size n_reactions x n_points.
Forward rates of progress for the reactions. [kmol/m^3/s] for bulk phases or [kmol/m^2/s] for surface phases.
Returns an array of size n_reactions x n_points.
Gibbs free energy [J/kg or J/kmol] depending on basis.
Returns an array of length n_points.
Specific Gibbs free energy [J/kg].
Returns an array of length n_points.
Molar Gibbs free energy [J/kmol].
Returns an array of length n_points.
Array of grid point positions along the flame.
Enthalpy [J/kg or J/kmol] depending on basis.
Returns an array of length n_points.
Get the volumetric heat production rates [W/m^3] on a per-reaction basis. The sum over all reactions results in the total volumetric heat release rate. Example: C. K. Law: Combustion Physics (2006), Fig. 7.8.6
>>> f.heat_production_rates[2] # heat production rate of the 2nd reaction
Get the total volumetric heat release rate [W/m^3].
Internal energy in [J/kg or J/kmol].
Returns an array of length n_points.
Specific internal energy [J/kg].
Returns an array of length n_points.
Molar internal energy [J/kmol].
Returns an array of length n_points.
Isothermal compressibility [1/Pa].
Returns an array of length n_points.
Mixture-averaged diffusion coefficients [m^2/s] relating the mass-averaged diffusive fluxes (with respect to the mass averaged velocity) to gradients in the species mole fractions.
Returns an array of size n_species x n_points.
Mixture-averaged diffusion coefficients [m^2/s] relating the diffusive mass fluxes to gradients in the species mass fractions.
Returns an array of size n_species x n_points.
Mixture-averaged diffusion coefficients [m^2/s] relating the molar diffusive fluxes to gradients in the species mole fractions.
Returns an array of size n_species x n_points.
Net production rates for each species. [kmol/m^3/s] for bulk phases or [kmol/m^2/s] for surface phases.
Returns an array of size n_species x n_points.
Net rates of progress for the reactions. [kmol/m^3/s] for bulk phases or [kmol/m^2/s] for surface phases.
Returns an array of size n_reactions x n_points.
Array of species partial molar specific heat capacities at constant pressure [J/kmol/K].
Returns an array of size n_species x n_points.
Array of species partial molar enthalpies [J/kmol].
Returns an array of size n_species x n_points.
Array of species partial molar entropies [J/kmol/K].
Returns an array of size n_species x n_points.
Array of species partial molar internal energies [J/kmol].
Returns an array of size n_species x n_points.
Array of species partial molar volumes [m^3/kmol].
Returns an array of size n_species x n_points.
Get/Set whether or not to include radiative heat transfer
Reverse rate constants for all reactions. Units are a combination of kmol, m^3 and s, that depend on the rate expression for the reaction.
Returns an array of size n_reactions x n_points.
Reverse rates of progress for the reactions. [kmol/m^3/s] for bulk phases or [kmol/m^2/s] for surface phases.
Returns an array of size n_reactions x n_points.
Entropy [J/kg/K or J/kmol/K] depending on basis.
Returns an array of length n_points.
Set the state of the the Solution object used for calculations, self.gas, to the temperature and composition at the point with index point.
Set an initial estimate for a profile of one component.
Parameters: |
|
---|
>>> f.set_profile('T', [0.0, 0.2, 1.0], [400.0, 800.0, 1500.0])
Set the criteria used for grid refinement.
Parameters: |
|
---|
>>> f.set_refine_criteria(ratio=3.0, slope=0.1, curve=0.2, prune=0)
Get the solution at one point or for the full flame domain (if point=None) for the specified component. The component can be specified by name or index.
Get/Set whether or not to include diffusive mass fluxes due to the Soret effect. Enabling this option works only when using the multicomponent transport model.
Array of nondimensional species standard-state specific heat capacities at constant pressure at the current temperature and pressure.
Returns an array of size n_species x n_points.
Array of nondimensional species standard-state enthalpies at the current temperature and pressure.
Returns an array of size n_species x n_points.
Array of nondimensional species standard-state entropies at the current temperature and pressure.
Returns an array of size n_species x n_points.
Array of nondimensional species standard-state Gibbs free energies at the current temperature and pressure.
Returns an array of size n_species x n_points.
Array of nondimensional species standard-state internal energies at the current temperature and pressure.
Returns an array of size n_species x n_points.
Thermal conductivity. [W/m/K].
Returns an array of length n_points.
Return a one-dimensional array of the species thermal diffusion coefficients [kg/m/s].
Returns an array of size n_species x n_points.
Thermal expansion coefficient [1/K].
Returns an array of length n_points.
Array containing the velocity [m/s] normal to the flame at each point.
Viscosity [Pa-s].
Returns an array of length n_points.
Specific volume [m^3/kg or m^3/kmol] depending on basis.
Returns an array of length n_points.
Specific volume [m^3/kg].
Returns an array of length n_points.
Molar volume [m^3/kmol].
Returns an array of length n_points.
Write the velocity, temperature, density, and species profiles to a CSV file.
Parameters: |
|
---|