5.1.1.1. spitfire.chemistry package

5.1.1.1.1. Submodules

5.1.1.1.2. spitfire.chemistry.analysis module

This module contains thermochemical analysis tools such as property evaluators and chemical explosive mode analysis, which operate generally on spitfire Library instances from time integration, flamelet tabulation, etc.

spitfire.chemistry.analysis.compute_density(mechanism, output_library)

Add the total mass density to a library (Cantera “density”), named ‘density’

Parameters:
mechanism: spitfire.chemistry.mechanism ChemicalMechanismSpec instance

the mechanism

output_library: a spitfire.chemistry.library Library instance

a library with T, Y, and either density or pressure (pressure is used if both are present)

Returns:
output_library: a spitfire.chemistry.library Library instance

the library with the ‘density’ field added

spitfire.chemistry.analysis.compute_isobaric_specific_heat(mechanism, output_library)

Add the constant-pressure specific heat capacity to a library (Cantera “cp_mass”), named ‘heat capacity cp’

Parameters:
mechanism: spitfire.chemistry.mechanism ChemicalMechanismSpec instance

the mechanism

output_library: a spitfire.chemistry.library Library instance

a library with T, Y, and either density or pressure (pressure is used if both are present)

Returns:
output_library: a spitfire.chemistry.library Library instance

the library with the ‘heat capacity cp’ field added

spitfire.chemistry.analysis.compute_isochoric_specific_heat(mechanism, output_library)

Add the constant-volume specific heat capacity to a library (Cantera “cv_mass”), named ‘heat capacity cv’

Parameters:
mechanism: spitfire.chemistry.mechanism ChemicalMechanismSpec instance

the mechanism

output_library: a spitfire.chemistry.library Library instance

a library with T, Y, and either density or pressure (pressure is used if both are present)

Returns:
output_library: a spitfire.chemistry.library Library instance

the library with the ‘heat capacity cv’ field added

spitfire.chemistry.analysis.compute_pressure(mechanism, output_library)

Add the pressure to a library (Cantera “P”), named ‘pressure’

Parameters:
mechanism: spitfire.chemistry.mechanism ChemicalMechanismSpec instance

the mechanism

output_library: a spitfire.chemistry.library Library instance

a library with T, Y, and either density or pressure (pressure is used if both are present)

Returns:
output_library: a spitfire.chemistry.library Library instance

the library with the ‘pressure’ field added

spitfire.chemistry.analysis.compute_specific_enthalpy(mechanism, output_library)

Add the total specific enthalpy to a library (Cantera “enthalpy_mass”), named ‘enthalpy’

Parameters:
mechanism: spitfire.chemistry.mechanism ChemicalMechanismSpec instance

the mechanism

output_library: a spitfire.chemistry.library Library instance

a library with T, Y, and either density or pressure (pressure is used if both are present)

Returns:
output_library: a spitfire.chemistry.library Library instance

the library with the ‘enthalpy’ field added

spitfire.chemistry.analysis.compute_viscosity(mechanism, output_library)

Add the dynamic viscosity to a library (Cantera “viscosity”), named ‘viscosity’

Parameters:
mechanism: spitfire.chemistry.mechanism ChemicalMechanismSpec instance

the mechanism

output_library: a spitfire.chemistry.library Library instance

a library with T, Y, and either density or pressure (pressure is used if both are present)

Returns:
output_library: a spitfire.chemistry.library Library instance

the library with the ‘viscosity’ field added

spitfire.chemistry.analysis.explosive_mode_analysis(mechanism, output_library, configuration='isobaric', heat_transfer='adiabatic', compute_explosion_indices=False, compute_participation_indices=False, include_secondary_mode=False)

Perform chemical explosive mode analysis across a range of states in a library.

Parameters:
mechanism: spitfire.chemistry.mechanism ChemicalMechanismSpec instance

the mechanism

output_library: a spitfire.chemistry.library Library instance

a library with T, Y, and either density or pressure (pressure is used if both are present)

configuration: str

whether to analyze the system as “isobaric” (default) or “isochoric”

heat_transfer: str

whether to analyze the system as “adiabatic” (default) or “isothermal”

compute_explosion_indices: bool

whether or not (default: False) to include explosion index analysis

compute_participation_indices: bool

whether or not (default: False) to include participation index analysis

include_secondary_mode: bool

whether or not (default: False) to include secondary explosive mode analysis

Returns:
output_library: a spitfire.chemistry.library Library instance

The library with the following fields added (if requested)

  • ‘cema-lexp1’: the primary explosive eigenvalue (always computed)

  • ‘cema-lexp2’: the secondary explosive eigenvalue (default: off)

  • ‘cema-ei1 [name]’: the primary explosion indices for species (name) or temperature (T) (default: off)

  • ‘cema-ei2 [name]’: the secondary explosion indices for species (name) or temperature (T) (default: off)

  • ‘cema-pi1 [#]’: the primary participation indices of each reaction (numbered) (default: off)

  • ‘cema-pi2 [#]’: the secondary participation indices of each reaction (numbered) (default: off)

spitfire.chemistry.analysis.get_ct_solution_array(mechanism=None, library=None)

Obtain a Cantera SolutionArray object representative of an arbitrary library

Parameters:
mechanism: spitfire.chemistry.mechanism ChemicalMechanismSpec instance

the mechanism

library: a spitfire.chemistry.library Library instance

a library with T, Y, and either density or pressure (pressure is used if both are present)

Returns:
solution_arraycantera.SolutionArray instance

a SolutionArray filled with the library data

library_shapetuple

shape of the original library

5.1.1.1.3. spitfire.chemistry.ctversion module

spitfire.chemistry.ctversion.check(qual, major, minor, patch=None)

Check cantera version, specify qualifier as one of [“pre”, “at”, “atleast”, “post”] and major/minor/patch version numbers, using None to ignore a level of precision (default for patch is None to ignore)

5.1.1.1.4. spitfire.chemistry.flamelet module

This module contains the Flamelet class that provides a high-level interface for nonpremixed flamelets, namely setting up models and solving both unsteady and steady flamelets

class spitfire.chemistry.flamelet.Flamelet(flamelet_specs=None, *args, **kwargs)

Bases: object

An API for solving flamelet equations in composing tabulated chemistry libraries

compute_ignition_delay(delta_temperature_ignition=400.0, minimum_allowable_residual=1e-12, return_solution=False, **kwargs)

Integrate in time until ignition (exceeding a specified threshold of the increase in temperature)

Parameters:
delta_temperature_ignitionfloat

how much the temperature of the reactor must have increased for ignition to have occurred, default is 400 K

minimum_allowable_residualfloat

how small the residual can be before the reactor is deemed to ‘never’ ignite, default is 1.e-12

return_solutionbool

whether or not to return the solution trajectory in addition to the ignition delay, as a tuple, (t, library)

**kwargs

Arbitrary keyword arguments - see the integrate() method documentation

compute_steady_state(tolerance=1e-06, verbose=False, use_psitc=True, newton_args=None, psitc_args=None, transient_args=None)

Solve for the steady state of this flamelet, using a number of numerical algorithms

This will first try Newton’s method, which is fast if it manages to converge. If Newton’s method fails, the pseudo-transient continuation (psitc) method is used. The psitc solver will attempt several restarts with increasingly conservative solver settings. Finally, if both Newton’s method and psitc fail, ESDIRK64 time integration with adaptive stepping is attempted.

This is meant to be a convenient interface for common usage. If it fails, try utilizing each of the steady solvers on their own with special parameters specified.

For exceptionally large mechanisms, say, > 150 species, the psitc solver can be slow, and setting use_psitc=False will bypass it when Newton’s method fails in favor of the ESDIRK solver. This is only recommended for large mechanisms.

Parameters:
tolerancefloat

residual tolerance below which the solution has converged

verbosebool

whether or not to write out status and failure messages

use_psitcbool

whether or not to use the psitc method when Newton’s method fails (if False, tries ESDIRK time stepping next)

newton_argsdict

extra arguments such as max_iterations to pass to the Newton solver

psitc_argsdict

extra arguments such as max_iterations to pass to the PsiTC solver

transient_argsdict

extra arguments such as max_iterations to pass to the ESDI RK solver

Returns:
a library containing temperature, mass fractions, and pressure over mixture fraction
property current_interior_state

Obtain the current interior (no boundary states) state vector of the flamelet, useful for initializing another flamelet object

current_mass_fraction(key)

Obtain the np.ndarray of values of a particular mass fraction after solving the steady/unsteady flamelet

property current_state

Obtain the initial full (interior + boundaries) state vector of the flamelet

property current_temperature

Obtain the np.ndarray of values of the temperature after solving the steady/unsteady flamelet

property dissipation_rate

Obtain the np.ndarray of scalar dissipation rate values

property fuel_stream

Obtain the stream associated with the fuel

property initial_interior_state

Obtain the initial interior (no boundary states) state vector of the flamelet, useful for initializing another flamelet object

initial_mass_fraction(key)

Obtain the np.ndarray of values of a particular mass fraction before solving the steady/unsteady flamelet

property initial_state

Obtain the initial full (interior + boundaries) state vector of the flamelet

property initial_temperature

Obtain the np.ndarray of values of the temperature before solving the steady/unsteady flamelet

integrate(stop_at_time=None, stop_at_steady=None, stop_criteria=None, first_time_step=1e-06, max_time_step=0.001, minimum_time_step_count=40, transient_tolerance=1e-10, write_log=False, log_rate=100, maximum_steps_per_jacobian=10, nonlinear_solve_tolerance=1e-12, linear_solver='block thomas', stepper_type=<class 'spitfire.time.methods.KennedyCarpenterS6P4Q3'>, nlsolver_type=<class 'spitfire.time.nonlinear.SimpleNewtonSolver'>, stepcontrol_type=<class 'spitfire.time.stepcontrol.PIController'>, extra_integrator_args={}, extra_stepper_args={}, extra_nlsolver_args={}, extra_stepcontrol_args={}, save_first_and_last_only=False, print_exception_on_failure=False)

Base method for flamelet integration

Parameters:
stop_at_timefloat

The final time to stop the simulation at

stop_at_steadyfloat

The tolerance at which a steady state is decided upon and stopped at

stop_criteriacallable (t, state, residual, n_steps)

Any callable that returns True when the simulation should stop

first_time_stepfloat

The time step size initially used by the time integrator

max_time_stepfloat

The maximum time step allowed by the integrator

minimum_time_step_countint

The minimum number of time steps to run, (default: 40) (helpful for slowly evolving simulations, for instance those with low starting temperatures)

transient_tolerancefloat

the target temporal error for transient integration

write_logbool

whether or not to print integration statistics and status during the simulation

log_rateint

how often to print log information

maximum_steps_per_jacobianint

maximum number of steps Spitfire allows before the Jacobian must be re-evaluated - keep low for robustness, try to increase for performance on large mechanisms

nonlinear_solve_tolerancefloat

tolerance for the nonlinear solver

linear_solverstr

which linear solver to use - only ‘block thomas’ (default, heavily recommended) or ‘superlu’ are supported

stepper_typespitfire.time.TimeStepper

which (single step) stepper method to use (optional, default: ESDIRK64)

nlsolver_typespitfire.time.NonlinearSolver

which nonlinear solver method to use (optional, default: SimpleNewtonSolver)

stepcontrol_typespitfire.time.StepControl

which time step adaptation method to use (optional, default: PIController)

extra_integrator_argsdict

any extra arguments to specify to the time integrator - arguments passed to the odesolve method

extra_stepper_argsdict

extra arguments to specify on the spitfire.time.TimeStepper object

extra_nlsolver_argsdict

extra arguments to specify on the spitfire.time.NonlinearSolver object

extra_stepcontrol_argsdict

extra arguments to specify on the spitfire.time.StepControl object

save_first_and_last_onlybool

whether or not to retain all data (False, default) or only the first and last solutions

print_exception_on_failurebool

whether or not to print an exception message on integrator/model failure (default: False)

Returns:
a library containing temperature, mass fractions, and pressure over time and mixture fraction, respectively
integrate_for_heat_loss(temperature_tolerance=0.05, steady_tolerance=0.0001, **kwargs)

Integrate a flamelet until the temperature profile is sufficiently linear. This is used to generate the heat loss dimension for flamelet libraries. Note that this will terminate the integration if a steady state is identified, which may simply indicate that the heat transfer settings were insufficient to drive the temperature to a linear enough profile.

Parameters:
temperature_tolerancefloat

tolerance for termination, where max(T) <= (1 + tolerance) max(T_oxy, T_fuel)

steady_tolerancefloat

residual tolerance below which steady state is defined

**kwargs

Arbitrary keyword arguments - see the integrate() method documentation

integrate_to_steady(steady_tolerance=0.0001, **kwargs)

Integrate a flamelet until steady state is reached

Parameters:
steady_tolerancefloat

residual tolerance below which steady state is defined

**kwargs

Arbitrary keyword arguments - see the integrate() method documentation

integrate_to_steady_after_ignition(steady_tolerance=0.0001, delta_temperature_ignition=400.0, **kwargs)

Integrate a flamelet until steady state is reached after ignition (based on temperature) has occurred. This is helpful in slowly-evolving systems whose initial residual may be lower than the prescribed tolerance.

Parameters:
steady_tolerancefloat

residual tolerance below which steady state is defined

delta_temperature_ignitionfloat

how much the temperature of the reactor must have increased for ignition to have occurred, default is 400 K

**kwargs

Arbitrary keyword arguments - see the integrate() method documentation

integrate_to_time(final_time, **kwargs)

Integrate a flamelet until it reaches a specified simulation time

Parameters:
final_timefloat

time at which integration stops

**kwargs

Arbitrary keyword arguments - see the integrate() method documentation

property iteration_count

Obtain the number of iterations needed to solve the steady flamelet (after solving…)

jac(state_interior)
jac_and_eig(state_interior)
jac_csc(state_interior)
property linear_temperature

Obtain the np.ndarray of linear temperature values

classmethod make_clustered_grid(grid_points, grid_cluster_point, grid_cluster_intensity=6.0)
make_library_from_interior_state(state_in)
property mechanism

Obtain the flamelet’s ChemicalMechanismSpec object

property mixfrac_grid

Obtain the np.ndarray of mixture fraction grid points

offset_time(delta)
property oxy_stream

Obtain the stream associated with the oxidizer

property pressure

Obtain the thermodynamic pressure

rhs(t, state_interior)
property solution_times

Obtain this reactor’s integration times

steady_solve_newton(initial_guess=None, tolerance=1e-06, max_iterations=10, max_factor_line_search=1.5, max_allowed_residual=1000000.0, min_allowable_state_var=-1e-06, norm_order=inf, log_rate=100000, verbose=True)

Use Newton’s method to solve for the steady state of this flamelet. Note that Newton’s method is unlikely to converge unless an accurate initial guess is given.

Parameters:
initial_guessnp.ndarray

the initial guess - obtain this from a Flamelet

tolerancefloat

residual tolerance below which the solution has converged

max_iterationsint

maximum number of iterations before failure is detected

max_factor_line_searchfloat

the maximum factor by which the residual is allowed to increase in the line search algorithm

max_allowed_residualfloat

the maximum allowable value of the residual

min_allowable_state_varfloat

the lowest value (negative or zero) that a state variable can take during the solution process

norm_orderint or np.inf

the order of the norm used in measuring the residual

log_rateint

how often a message about the solution status is written

verbosebool

whether to write out the solver status (log messages) or write out failure descriptions

Returns:
a tuple of a library containing temperature, mass fractions, and pressure over mixture fraction,
and the required iteration count, and whether or not the system converged,
although if convergence is not obtained, then the library and iteration count output will both be None
steady_solve_psitc(initial_guess=None, tolerance=1e-06, max_iterations=400, min_allowable_state_var=-1e-06, ds_init=1.0, ds_init_decrease=4.0, adaptive_restart=True, diffusion_factor=4.0, global_ds=False, ds_safety=0.1, ds_ramp=1.1, ds_max=10000.0, max_factor_line_search=1.5, max_allowed_residual=1000000.0, log_rate=100000, norm_order=inf, _recursion_depth=0, max_recursion_depth=20, verbose=True)

Use an adaptive pseudotransient continuation method to compute the steady state of this flamelet

Parameters:
initial_guessnp.ndarray

the initial guess - obtain this from a Flamelet

tolerancefloat

residual tolerance below which the solution has converged

max_iterationsint

maximum number of iterations before failure is detected

max_factor_line_searchfloat

the maximum factor by which the residual is allowed to increase in the line search algorithm

max_allowed_residualfloat

the maximum allowable value of the residual

min_allowable_state_varfloat

the lowest value (negative or zero) that a state variable can take during the solution process

ds_initfloat

the initial pseudo time step (default: 1.), decrease to 1e-1 or 1e-2 for more robustness

ds_init_decreasefloat

how the initial dual time step is decreased upon failure if adaptive_restart is used (default: 4)

adaptive_restartbool

whether or not the solver restarts with decreased ds_init upon failure (default: True)

diffusion_factorfloat

how strongly diffusion is weighted in the pseudo time step adaptation (default: 4) (expert parameter)

global_dsbool

whether or not to use a global pseudo time step (default: False) (setting to True not recommended)

ds_safetyfloat

the ‘safety factor’ in the pseudo time step adaptation (default: 0.1), increase for speed, decrease for robustness

ds_rampfloat

how quickly the pseudo time step is allowed to increase (default: 1.1), increase for speed, decrease for robustness

ds_maxflaot

maximum allowable value of the pseudo time step (default: 1.e4)

max_recursion_depthint

how many adaptive restarts may be attempted

norm_orderint or np.inf

the order of the norm used in measuring the residual

log_rateint

how often a message about the solution status is written

verbosebool

whether to write out the solver status (log messages) or write out failure descriptions

Returns:
a tuple of a library containing temperature, mass fractions, and pressure over mixture fraction,
and the required iteration count, whether or not the system converged, and the final minimum dual time step value,
although if convergence is not obtained, then the library and iteration count output will both be None
class spitfire.chemistry.flamelet.FlameletSpec(mech_spec=None, initial_condition=None, oxy_stream=None, fuel_stream=None, grid=None, grid_points=None, grid_type='clustered', grid_cluster_intensity=4.0, grid_cluster_point='stoichiometric', library_slice=None, max_dissipation_rate=None, stoich_dissipation_rate=None, dissipation_rate=None, dissipation_rate_form='Peters', heat_transfer='adiabatic', convection_temperature=None, radiation_temperature=None, convection_coefficient=None, radiative_emissivity=None, scale_heat_loss_by_temp_range=False, scale_convection_by_dissipation=False, use_linear_ref_temp_profile=False, rates_sensitivity_type='dense', sensitivity_transform_type='exact', include_enthalpy_flux=True, include_variable_cp=True, pressure=None)

Bases: object

Constructor: specify boundary streams, the mixture fraction grid, and terms in the flamelet equations,

including chemical source terms, dissipation, heat loss, and enthalpy equation transformation terms.

Parameters:
mech_specspitfire.chemistry.mechanism.ChemicalMechanismSpec instance

the chemical mechanism, including species thermodynamics and transport data and chemical reaction rate data

initial_conditionstr or np.ndarray

the initial state of the flamelet, either ‘equilibrium’, ‘unreacted’, ‘linear-TY’, ‘Burke-Schumann’, or the interior state vector from another flamelet (obtained with Flamelet.*_interior_state properties)

library_slicespitfire.chemistry.library.Library

obtain the mechanism, initial condition, boundary streams, and grid from a library with the “mixture_fraction” dimension

oxy_streamCantera.Quantity (a Spitfire stream) or Cantera.Solution object

the oxidizer stream (Z=0 boundary condition)

fuel_streamCantera.Quantity (a Spitfire stream) or Cantera.Solution object

the fuel stream (Z=1 boundary condition)

max_dissipation_ratefloat

the maximum dissipation rate (requires the dissipation_rate_form argument, default is ‘Peters’)

stoich_dissipation_ratefloat

the stoichiometric dissipation rate (requires the dissipation_rate_form argument, default is ‘Peters’)

dissipation_rate_formstr

the form of dissipation rate to use if the maximum or stoichiometric value is specified (‘Peters’ (default) or ‘constant’)

dissipation_ratenp.ndarray

an array of dissipation rates over mixture fraction (cannot be specified along with maximum or stoichiometric value)

gridnp.ndarray

an array of grid points locations (specifying this argument overrides other grid arguments)

grid_pointsint

the number of grid points to use (if the grid argument is not specified, this is required)

grid_typestr

the type of grid, either ‘clustered’ (default) or ‘uniform’

grid_cluster_intensityfloat

how tightly clustered grid points will be around the grid_cluster_point if grid_type is ‘clustered’ (default: 4)

grid_cluster_pointfloat

the location of grid point clustering (default is the stoichiometric mixture fraction)

heat_transferstr

whether the flamelet is ‘adiabatic’ or ‘nonadiabatic’

convection_temperaturefloat or np.ndarray

the convective heat loss reference temperature

radiation_temperaturefloat or np.ndarray

the radiation heat loss reference temperature

convection_coefficientfloat or np.ndarray

the convective heat loss coefficient

radiative_emissivityfloat or np.ndarray

the radiative heat loss coefficient

use_scaled_heat_lossbool or np.ndarray

whether or not to use a special form of reference temperature and coefficients for heat loss

include_enthalpy_fluxbool

whether or not to use a consistent formulation of the enthalpy flux (True, default) or the simpler flamelet formulation (False)

include_variable_cpbool

whether or not to include variation of the heat capacity (True, default) or use the simpler flamelet formulation (False)

rates_sensitivity_typestr

how the chemical source term Jacobian is formed, either ‘dense’ or ‘sparse’ for exact formulations or ‘no-TBAF’ which ignores third-body and falloff sensitivities. The default is ‘dense’. For large mechanisms (over 100 species) the ‘sparse’ formulation is far faster than ‘dense’, especially for mechanisms of more than 300 species.

sensitivity_transform_typestr

how the Jacobian is transformed, currently only ‘exact’ is supported

copy()
spitfire.chemistry.flamelet.compute_dissipation_rate(mixture_fraction, max_dissipation_rate=None, form='Peters', stoich_dissipation_rate=None, stoich_mixture_fraction=None)

Compute the scalar dissipation rate across mixture fraction

Parameters:
mixture_fractionarray_like

the locations of grid points in mixture fraction space

max_dissipation_ratefloat

the maximum value of the dissipation rate, must provide either this or stoich_dissipation_rate

formstr, optional

the form of the dissipation rate’s dependency on mixture fraction, defaults to ‘Peters’, which uses the form of N. Peters, Turbulent Combustion, 2000. Specifying anything else will yield a constant scalar dissipation rate.

stoich_dissipation_ratefloat

the stoichiometric value of the dissipation rate, must provide either this or max_dissipation_rate

stoich_mixture_fractionfloat

the stoichiometric value of the mixture fraction, required when using stoich_dissipation_rate

Returns:
xarray_like

the scalar dissipation rate on the given mixture fraction grid

5.1.1.1.5. spitfire.chemistry.flamelet2d module

This module contains the _Flamelet2D class that provides a high-level interface for nonpremixed three-stream flamelets. This is unsupported at the moment but it’s pretty close to being useful…

5.1.1.1.6. spitfire.chemistry.library module

This module defines containers for tabulated chemistry libraries and solution trajectories

class spitfire.chemistry.library.Dimension(name: str, values: array, log_scaled=False)

Bases: object

A class to contain details of a particular independent variable in a structured library

Constructor: specify a name and list of values

Parameters:
namestr

the name of the mechanism - hyphens and spaces may not be used here, use underscore separators

values: np.array

the values of the independent variable in the grid

property log_scaled
property max
property min
property name

Obtain the name of the independent variable

property npts
property values

Obtain the one-dimensional np.array of the specified values of this independent variable

class spitfire.chemistry.library.Library(*dimensions)

Bases: object

A container class for tabulated datasets over structured grids.

Upon constructing the Library object, the following properties are made available on the instance for each Dimension

library.[dimension_name]_name library.[dimension_name]_values library.[dimension_name]_min library.[dimension_name]_max library.[dimension_name]_npts library.[dimension_name]_grid = multidimensional meshgrid of the data

Constructor: specify the argument list of dimensions defining the grid

Parameters:
dimensionsargument list of Dimension instances and/or (name, values) tuples

the dimensions that define the grid

add_empty_property(name)
classmethod copy(library)

Shallow copy of a library into a new one

classmethod deepcopy(library)

Deep copy of a library into a new one

dim(name)

Obtain a Dimension object by name

property dim_names

Obtain the ordered list of the Dimension object names

property dims

Obtain the ordered list of the Dimension objects associated with the library

property extra_attributes

Get the extra attributes dictionary of this Library, which will be saved in the instance and in any pickle or text files. Use this to retain any random information that you might like later, such as authorship notes, dates, recommendations for use, etc.

get_empty_dataset()

Obtain an empty dataset in the shape of the grid, to enable filling one point, line, plane, etc. at a time, before then possibly setting a library property with the data

classmethod load_from_file(file_name)

Load a library from a specified file name with pickle (following save_to_file)

property props

Obtain a list of the names of properties set on the library

remap_dimension(dim_name, mapping)
remove(*quantities)

Remove quantities (argument list of strings) from the library

save_to_file(file_name)

Save a library to a specified file using pickle

save_to_text_directory(output_directory, ravel_order='F', format='%.14e')

Dump the contents of a library to a set of easy-to-process text files in a directory. Note that file names of property bulk data files will have spaces replaced by underscores. Note that the preferred method of saving data for later use with Spitfire is the save_to_file method, which dumps compressed data with pickle, Python’s native serialization tool. The Library.load_from_file method can then be used to reload data into Python, which is significantly faster than loading from text files. This method of dumping data does not natively support reloading data from the text files, and is simply meant to provide data that is easy to load in other codes (e.g., C++, Fortran, or Matlab codes).

Parameters:
output_directory: str

where to save the files (a new directory will be made, and an existing one will be removed with permission)

ravel_order: str

row-major (‘C’) or column-major (‘F’) flattening of multidimensional property arrays, default is ‘F’ for column-major, which flattens the first dimension first, second dimension second, and so on

format: str

string format for numbers sent to NumPy savetxt function, default is ‘%.14e’

scale_dimension(dim_name, multiplier)
property shape
property size
classmethod squeeze(library)

Produce a new library from another by removing dimensions with only one value, for instance after slicing, lib_new = Library.squeeze(library[:, 0]). Note that if all dimensions are removed, for instance in Library.squeeze(library[0, 1]), a dictionary of the scalar values in the following form is returned instead of a new library: {‘dimensions’: {name1: value1, name2: value2, …}, ‘properties’: {prop1: value1, …}, ‘extra_attributes’: {…}}

classmethod swapaxes(library, idx1, idx2)

Swap the dimension of index idx1 with that of idx2

exception spitfire.chemistry.library.LibraryIndexError

Bases: IndexError

5.1.1.1.7. spitfire.chemistry.mechanism module

This module facilitates loading chemical reaction mechanisms in Cantera format and mixing streams in useful ways.

exception spitfire.chemistry.mechanism.CanteraLoadError(mech_file_path, group_name, error)

Bases: Exception

class spitfire.chemistry.mechanism.ChemicalMechanismSpec(cantera_input=None, group_name='gas', cantera_solution=None, cantera_xml=None)

Bases: object

A class that loads chemical mechanisms and mixes streams.

This class facilitates some simple way of specifying the fuel and oxidizer streams for flamelets and of blending these streams to make mixtures for zero-dimensional simulations.

Constructor: specify a chemical mechanism file in cantera YAML/CTI/XML format

Parameters:
cantera_inputstr

a cantera YAML/CTI/XML file describing the thermochemistry and (optionally) transport properties

group_namestr

the phase to use (e.g. a phase with transport properties vs without, if such a split exists in the XML file)

cantera_solution: ct.Solution

a ct.Solution object to use directly (optional, if specified the xml and group name are ignored if given)

copy_stream(stream)

Make a duplicate of a stream - use this to avoid inadvertently modifying a stream by reference.

property element_stoichiometry
classmethod from_solution(solution: Solution)

Construct a ChemicalMechanismSpec directly from a cantera solution

property gas

Obtain this mechanism’s cantera Solution object

property griffon

Obtain this mechanism’s griffon PyCombustionKernels object

property group_name

Obtain the group name of the identified mechanism

property mech_data
property mech_file_path

Obtain the path of the identified mechanism’s Cantera input file specification

property mech_xml_path

Obtain the path of the identified mechanism’s XML specification

mix_for_equivalence_ratio(phi, fuel, oxy)

Mix a stream of fuel and oxidizer such that the mixture has a specified equivalence ratio.

mix_for_normalized_equivalence_ratio(normalized_phi, fuel, oxy)

Mix a stream of fuel and oxidizer such that the mixture has a specified normalized equivalence ratio.

mix_fuels_for_stoich_mixture_fraction(fuel1, fuel2, zstoich, oxy)

Mix two fuel streams for a specified stoichiometric mixture fraction given a particular oxidizer. As an example, this can be used to dilute a fuel with Nitrogen to hit a particular stoichiometric mixture fraction.

Note that it is not possible to reach all stoichiometric mixture fractions with any fuel combinations! In such a case this function will throw an error.

This function currently only supports hydrocarbon oxidation.

static mix_streams(streams, basis, constant='HP')

Mix a number of streams by mass/mole and at constant HP, TP, UV, etc. (as supported by Cantera)

Parameters:
streamslist(tuple)

a list of tuples as [(stream, amount)] where amount is the mass/moles (depending on the basis)

basisstr

whether amounts are masses (‘mass’) or moles (‘mole’)

constantstr

property pair held constant, such as HP (default), TP, UV - any combination supported by Cantera

Returns
——-
mixcantera.Quantity

the requested mixture

molecular_weight(ni)

Obtain the molecular weight of a single species from its string name or integer index

property molecular_weights
property n_reactions

Obtain the number of reactions in this chemical mechanism

property n_species

Obtain the number of species in this chemical mechanism

species_index(name)

Obtain the index of a particular species

property species_names

Obtain the names of speciesin this chemical mechanism

stoich_mass_fuel_to_oxy_ratio(fuel_stream, oxy_stream)

Get the mass ratio of fuel to oxidizer at stoichiometric conditions.

stoich_mixture_fraction(fuel_stream, oxy_stream)

Get the mixture fraction at stoichiometric conditions. Assumes C, O, and H combustion of single fuel and single oxidizer streams.

stoich_molar_fuel_to_oxy_ratio(fuel_stream, oxy_stream)

Get the molar ratio of fuel to oxidizer at stoichiometric conditions. Built-in support is included for oxidation of hydrocarbon, aluminum, and uranium.

stream(properties=None, values=None, stp_air=False)

Build a mixture of species with certain properties

Parameters:
propertiesstr

a string of keys used in building a cantera Quantity (e.g., ‘TPX’ or ‘TP’ or ‘X’, etc.)

valuestuple

the values of the properties

stp_airbool

special option to make a stream of air at standard temperature and pressure (default: False) This produces a stream of 3.74 mol N2 per mole O2 at 300 K and one atmosphere

Returns
——-
mixcantera.Quantity

a cantera Quantity object with the specified properties

5.1.1.1.8. spitfire.chemistry.reactors module

This module contains the HomogeneousReactor class that provides a high-level interface for a variety of 0-D reactors

class spitfire.chemistry.reactors.HomogeneousReactor(mech_spec, initial_mixture, configuration, heat_transfer, mass_transfer, convection_temperature=None, radiation_temperature=None, convection_coefficient=None, radiative_emissivity=None, shape_dimension_dict=None, mixing_tau=None, feed_temperature=None, feed_mass_fractions=None, feed_density=None, rates_sensitivity_type='dense', sensitivity_transform_type='exact', initial_time=0.0)

Bases: object

A class for solving zero-dimensional reactors

Constructor: specify a mechanism, initial mixture, and reactor specifications

Parameters:
mech_specspitfire.chemistry.mechanism.ChemicalMechanismSpec instance

the mechanism

initial_mixtureCantera.Quantity (a Spitfire stream) or Cantera.Solution object

the initial mixture of the reactor

configurationstr

whether the reactor is constant-volume (isochoric) or constant-pressure (isobaric)

heat_transferstr

whether the reactor is adiabatic, isothermal, or diathermal (finite-rate heat transfer by convection and/or radiation)

mass_transferstr

whether the reactor is closed or open

convection_temperaturefloat or callable

the temperature of external fluid in a diathermal reactor, either a constant or a function of time, f(t)

radiation_temperaturefloat or callable

the temperature of external radiation body of a diathermal reactor, either a constant or a function of time, f(t)

convection_coefficientfloat or callable

the convection coefficient, either a constant or a function of time, f(t)

radiative_emissivityfloat or callable

the radiative emissivity, either a constant or a function of time, f(t)

shape_dimension_dictfloat or callable

The shape and dimension of a diathermal reactor. The shape is one of ‘cube’, ‘sphere’, ‘capsule’, ‘tetrahedron’, ‘octahedron’, or ‘icosahedron’ (see wikipedia). The dimension is either the characteristic length (‘char. length’) in meters or volume (‘volume’) in cubic meters.

mixing_taufloat or callable

The mixing time of an open reactor, either a constant or a function of time, f(t)

feed_temperaturefloat or callable

the temperature of the feed stream of an open reactor, either a constant or a function of time, f(t)

feed_mass_fractionsnp.array or callable

the mass fractions of the feed stream of an open reactor, either a constant or a function of time, f(t)

feed_densityfloat or callable

the density of the feed stream of an open reactor, either a constant or a function of time, f(t)

rates_sensitivity_typestr

how the chemical source term Jacobian is formed, either ‘dense’ or ‘sparse’ for exact formulations or ‘no-TBAF’ which ignores third-body and falloff sensitivities. The default is ‘dense’. For large mechanisms (over 100 species) the ‘sparse’ formulation is far faster than ‘dense’, especially for mechanisms of more than 300 species.

sensitivity_transform_typestr

how the Jacobian is transformed for isobaric systems, currently only ‘exact’ is supported

initial_timefloat

the starting time point (in seconds) of the reactor, default to 0.0

compute_ignition_delay(delta_temperature_ignition=400.0, minimum_allowable_residual=1e-12, return_solution=False, **kwargs)

Integrate in time until ignition (exceeding a specified threshold of the increase in temperature)

Parameters:
delta_temperature_ignitionfloat

how much the temperature of the reactor must have increased for ignition to have occurred, default is 400 K

minimum_allowable_residualfloat

how small the residual can be before the reactor is deemed to ‘never’ ignite, default is 1.e-12

return_solutionbool

whether or not to return the solution trajectory in addition to the ignition delay, as a tuple, (t, library)

**kwargs

Arbitrary keyword arguments - see the integrate() method documentation

Returns:
the ignition delay of the reactor, in seconds, and optionally a library containing temperature, mass fractions, and density (isochoric) or pressure (isobaric) over time
property current_mass_fractions

Obtain this reactor’s current mass fractions

property current_pressure

Obtain this reactor’s current pressure

property current_state

Obtain this reactor’s final state vector

property current_temperature

Obtain this reactor’s current temperature

property current_time

Obtain this reactor’s current mass fractions

classmethod get_supported_reactor_shapes()

Obtain a list of supported reactor geometries

property initial_mass_fractions

Obtain this reactor’s initial mass fractions

property initial_pressure

Obtain this reactor’s initial pressure

property initial_state

Obtain this reactor’s initial state vector

property initial_temperature

Obtain this reactor’s initial temperature

property initial_time

Obtain this reactor’s initial mass fractions

integrate(stop_at_time=None, stop_at_steady=None, stop_criteria=None, first_time_step=1e-06, max_time_step=1000000.0, minimum_time_step_count=40, transient_tolerance=1e-10, write_log=False, log_rate=100, maximum_steps_per_jacobian=1, nonlinear_solve_tolerance=1e-12, linear_solver='lapack', plot=None, stepper_type=<class 'spitfire.time.methods.KennedyCarpenterS6P4Q3'>, nlsolver_type=<class 'spitfire.time.nonlinear.SimpleNewtonSolver'>, stepcontrol_type=<class 'spitfire.time.stepcontrol.PIController'>, extra_integrator_args={}, extra_stepper_args={}, extra_nlsolver_args={}, extra_stepcontrol_args={}, save_first_and_last_only=False)

Base method for reactor integration

Parameters:
stop_at_timefloat

The final time to stop the simulation at

stop_at_steadyfloat

The tolerance at which a steady state is decided upon and stopped at

stop_criteriacallable (t, state, residual, n_steps)

Any callable that returns True when the simulation should stop

first_time_stepfloat

The time step size initially used by the time integrator

max_time_stepfloat

The largest time step the time stepper is allowed to take

minimum_time_step_countint

The minimum number of time steps to run (helpful for slowly evolving simulations, for instance those with low starting temperatures)

transient_tolerancefloat

the target temporal error for transient integration

write_logbool

whether or not to print integration statistics and status during the simulation

log_rateint

how often to print log information

maximum_steps_per_jacobianint

maximum number of steps Spitfire allows before the Jacobian must be re-evaluated - keep low for robustness, try to increase for performance on large mechanisms

nonlinear_solve_tolerancefloat

tolerance for the nonlinear solver used in implicit time stepping (optional, default: 1e-12)

linear_solverstr

which linear solver to use, at the moment either ‘lapack’ (dense, direct) or ‘superlu’ (sparse, direct) are available

plotlist

List of variables (temperature and/or specific species names) to be plotted after the time integration completes. No plot is shown if a list is not provided. Temperature is plotted in the first subplot if any list of variables is provided for plotting (even if temperature is not specified in the list of variables). Species mass fractions will be plotted in a second subplot if any species names are provided in the list of variables.

stepper_typespitfire.time.TimeStepper

which (single step) stepper method to use (optional, default: ESDIRK64)

nlsolver_typespitfire.time.NonlinearSolver

which nonlinear solver method to use (optional, default: SimpleNewtonSolver)

stepcontrol_typespitfire.time.StepControl

which time step adaptation method to use (optional, default: PIController)

extra_integrator_argsdict

any extra arguments to specify to the time integrator - arguments passed to the odesolve method

extra_stepper_argsdict

extra arguments to specify on the spitfire.time.TimeStepper object

extra_nlsolver_argsdict

extra arguments to specify on the spitfire.time.NonlinearSolver object

extra_stepcontrol_argsdict

extra arguments to specify on the spitfire.time.StepControl object

save_first_and_last_onlybool

whether or not to retain all data (False, default) or only the first and last solutions

Returns:
a library containing temperature, mass fractions, and density (isochoric) or pressure (isobaric) over time
integrate_to_steady(steady_tolerance=1e-06, **kwargs)

Integrate a reactor until steady state is reached

Parameters:
steady_tolerancefloat

residual tolerance below which steady state is defined

**kwargs

Arbitrary keyword arguments - see the integrate() method documentation

Returns:
a library containing temperature, mass fractions, and density (isochoric) or pressure (isobaric) over time
integrate_to_steady_after_ignition(steady_tolerance=0.0001, delta_temperature_ignition=400.0, **kwargs)

Integrate a reactor until steady state is reached after ignition (based on temperature) has occurred. This is helpful in slowly-evolving systems whose initial residual may be lower than the prescribed tolerance.

Parameters:
steady_tolerancefloat

residual tolerance below which steady state is defined

delta_temperature_ignitionfloat

how much the temperature of the reactor must have increased for ignition to have occurred, default is 400 K

**kwargs

Arbitrary keyword arguments - see the integrate() method documentation

Returns:
a library containing temperature, mass fractions, and density (isochoric) or pressure (isobaric) over time
integrate_to_time(final_time, **kwargs)

Integrate a reactor until it reaches a specified simulation time

Parameters:
final_timefloat

time at which integration ceases

**kwargs

Arbitrary keyword arguments - see the integrate() method documentation

Returns
——-

a library containing temperature, mass fractions, and density (isochoric) or pressure (isobaric) over time

property n_reactions
property n_species

5.1.1.1.9. spitfire.chemistry.tabulation module

This module contains classes and methods for building tabulated chemistry libraries

class spitfire.chemistry.tabulation.PDFSpec(pdf='delta', scaled_variance_values=None, variance_values=None, scaled_mean_values=None, mean_values=None, convolution_spline_order=None, use_pytabprops=None, integrator_intervals=100, variance_name=None, log_scaled=False, mean_log_scaled=False, parallel_type='default')

Bases: object

Specification of a presumed PDF and integrator/spline details for a given single dimension in a library.

Parameters:
pdfstr, or custom object type

the PDF, either ‘ClipGauss’ or ‘Beta’ for TabProps methods, ‘DoubleDelta’, or any custom object that implements the set_mean(), set_variance() or set_scaled_variance(), and integrate(scipy.interpolate.interp1d) methods.

scaled_variance_valuesnp.array

array of values of the scaled variance (varies between zero and one), provide this or variance_values

variance_valuesnp.array

array of values of the variance, provide this or scaled_variance_values

scaled_mean_valuesnp.array

array of values of a scaled mean (varies between zero and one), provide this or mean_values

mean_valuesnp.array

array of values of the mean, provide this or scaled_mean_values

convolution_spline_orderInt or str

the order of the 1-D reconstruction used in the convolution integrals, default is ‘pchip’ for the BetaPDF and 3 otherwise

use_pytabpropsbool

whether to use the pytabprops Lagrange interpolants or scipy interpolants for the 1-D reconstruction models, default is False for convolution_spline_order=’pchip’ and True otherwise

integrator_intervalsInt

extra parameter provided to TabProps integrators, default 100

variance_namestr

the name of the variance dimension to be added, by default Spitfire will add “_variance” to the name of the dimension being convolved, or use “scaled_scalar_variance_mean” for “mixture_fraction”

log_scaledbool

whether or not the dimension is populated with log-scaled values, default False

mean_log_scaledbool

whether or not the means are log-scaled values, default False

parallel_typestr

parallelization options include ‘property’ for properties alone, ‘property-mean’ for means and properties, ‘property-variance’ for variances and properties, ‘full’ for means, variances, and properties, or ‘default’ which estimates the fastest option based on the pdf type

spitfire.chemistry.tabulation.apply_mixing_model(library, mixing_spec, added_suffix='_mean', num_procs=1, throw_on_integrator_failure=True, verbose=False)
Take an existing tabulated chemistry library and incorporate subgrid variation in each reaction variable with a

presumed PDF model. This requires statistical independence of the reaction variables. If a reaction variable is not included in the mixing_spec dictionary, a delta PDF is presumed for it.

Parameters:
libraryspitfire.Library

an existing library from a reaction model

mixing_specstr

a dictionary mapping reaction variable names to PDFSpec objects that describe the variable’s presumed PDF

added_suffixstr

string to add to each name, for instance ‘_mean’ if this is the first PDF convolution, or ‘’ if a successive convolution

num_procsInt

how many processors over which to distribute the parallel extinction solves

throw_on_integrator_failure: bool

whether or not (default True) to throw when convolution integrals fall outside the laminar library bounds

verbosebool

whether or not (default False) to print information about the PDF convolution

Returns:
libraryspitfire.Library instance

the library with any nontrivial variance dimensions added

spitfire.chemistry.tabulation.build_adiabatic_bs_library(flamelet_specs, verbose=True)

Build a flamelet library with the Burke-Schumann (idealized, one-step combustion) assumptions

Parameters:
flamelet_specsFlameletSpec or dictionary of arguments for a FlameletSpec

flamelet specifications

Returns:
libraryspitfire.chemistry.library.Library instance

a chemistry library with only the “mixture_fraction” dimension

spitfire.chemistry.tabulation.build_adiabatic_eq_library(flamelet_specs, verbose=True)
Build a flamelet library with the equilibrium (infinitely fast) chemistry assumption,

equivalently with Gibbs free energy minimization.

Parameters:
flamelet_specsFlameletSpec or dictionary of arguments for a FlameletSpec

flamelet specifications

Returns:
libraryspitfire.chemistry.library.Library instance

a chemistry library with only the “mixture_fraction” dimension

spitfire.chemistry.tabulation.build_adiabatic_slfm_library(flamelet_specs, diss_rate_values=array([1.00000000e-03, 2.15443469e-03, 4.64158883e-03, 1.00000000e-02, 2.15443469e-02, 4.64158883e-02, 1.00000000e-01, 2.15443469e-01, 4.64158883e-01, 1.00000000e+00, 2.15443469e+00, 4.64158883e+00, 1.00000000e+01, 2.15443469e+01, 4.64158883e+01, 1.00000000e+02]), diss_rate_ref='stoichiometric', verbose=True, solver_verbose=False, _return_intermediates=False, include_extinguished=False, diss_rate_log_scaled=True)

Build a flamelet library with an adiabatic strained laminar flamelet model

Parameters:
flamelet_specsdictionary or FlameletSpec instance

data for the mechanism, streams, mixture fraction grid, etc.

diss_rate_valuesnp.array

reference dissipation rate values in the table (note that if the flamelet extinguishes at any point, the extinguished flamelet and larger dissipation rates are not included in the library unless the include_extinguished argument is set to True)

diss_rate_refstr

the reference point of the specified dissipation rate values, either ‘stoichiometric’ or ‘maximum’

verbosebool

whether or not to show progress of the library construction

include_extinguishedbool

whether or not to include extinguished states in the output table, if encountered in the provided range of dissipation rates, off by default

diss_rate_log_scaledbool

whether or not the range of dissipation rates is logarithmically scaled

Returns:
libraryspitfire.chemistry.library.Library instance

the structured chemistry library

spitfire.chemistry.tabulation.build_nonadiabatic_defect_bs_library(flamelet_specs, n_defect_st=16, verbose=True, stoich_heatloss_multiplier=1.0)
Build a flamelet library with the Burke-Schumann chemistry assumption

and heat loss effects captured through a presumed triangular form of the enthalpy defect.

Parameters:
flamelet_specsFlameletSpec or dictionary of arguments for a FlameletSpec

flamelet specifications

n_defect_stInt

the number of stoichiometric enthalpy defect values to include in the table (default: 16)

stoich_heatloss_multiplierfloat

multiplies the stoichiometric heat loss range for tabulation determined from the difference in stoichiometric enthalpy between the cooled (linear temperature profile) and adiabatic states (default: 1.)

Returns:
libraryspitfire.chemistry.library.Library instance

a chemistry library with the “mixture_fraction” and “enthalpy_defect_stoich” dimensions

spitfire.chemistry.tabulation.build_nonadiabatic_defect_eq_library(flamelet_specs, n_defect_st=16, verbose=True, stoich_heatloss_multiplier=1.0, superad_dT=0.0, subad_dT=0.0)
Build a flamelet library with the equilibrium (infinitely fast) chemistry assumption

and heat loss effects captured through a presumed triangular form of the enthalpy defect.

Parameters:
flamelet_specsFlameletSpec or dictionary of arguments for a FlameletSpec

flamelet specifications

n_defect_stInt or dictionary

the number of stoichiometric enthalpy defect values to include in the table (default: 16) If superadiabatic states are requested, this must be a dictionary specifying the number of superadiabatic and subadiabatic states separately as {‘n_superad’:#, ‘n_subad’:#} (a zero stoichiometric enthalpy defect is always included by default).

stoich_heatloss_multiplierfloat

multiplies the stoichiometric heat loss range for tabulation determined from the difference in stoichiometric enthalpy between the cooled (linear temperature profile) and adiabatic states (default: 1.)

superad_dT: float or dictionary

superadiabatic states are added to the library when superad_dT is nonzero. Each state is generated by first raising the boundary temperatures by superad_dT/n_defect_st[‘n_superad’] and solving for the steady adiabatic state. This is repeated until the full superad_dT is reached at the boundaries relative to the original flamelet_specs state. The conserved enthalpy for the whole library is defined by the flamelet_specs adiabatic state, making the newly generated states superadiabatic. superad_dT can be specified as a dictionary {‘fuel’:#, ‘oxy’:#} to shift the boundary temperatures of the fuel and oxidizer by different amounts. (default: 0.)

subad_dT: float or dictionary

temperature difference to subtract from the pure stream temperatures before computing the transient heat loss. This defines new degenerate points for the library below the adiabatic state given by the flamelet_specs. The conserved enthalpy for the whole library is defined by the flamelet_specs adiabatic state. subad_dT can be specified as a dictionary {‘fuel’:#, ‘oxy’:#} to shift the boundary temperatures of the fuel and oxidizer by different amounts. (default: 0.)

Returns:
libraryspitfire.chemistry.library.Library instance

a chemistry library with the “mixture_fraction” and “enthalpy_defect_stoich” dimensions

spitfire.chemistry.tabulation.build_nonadiabatic_defect_steady_slfm_library(flamelet_specs, diss_rate_values=array([1.00000000e-03, 2.15443469e-03, 4.64158883e-03, 1.00000000e-02, 2.15443469e-02, 4.64158883e-02, 1.00000000e-01, 2.15443469e-01, 4.64158883e-01, 1.00000000e+00, 2.15443469e+00, 4.64158883e+00, 1.00000000e+01, 2.15443469e+01, 4.64158883e+01, 1.00000000e+02]), diss_rate_ref='stoichiometric', verbose=True, solver_verbose=False, h_stoich_spacing=10000.0, num_procs=1, integration_args=None, n_defect_st=32, enthalpy_defect_structuring_slope=0.0, diss_rate_log_scaled=True, superad_dT=0.0, subad_dT=0.0, enforce_enthalpy_defect_monotonicity=False, unstructured_data_filename=None)

Build a flamelet library with the strained laminar flamelet model including heat loss effects through the enthalpy defect, where heat loss profiles are generated through quasisteady extinction

Parameters:
flamelet_specsdictionary or FlameletSpec instance

data for the mechanism, streams, mixture fraction grid, etc.

diss_rate_valuesnp.array

reference dissipation rate values in the table (note that if the flamelet extinguishes at any point, the extinguished flamelet and larger dissipation rates are not included in the library)

diss_rate_refstr

the reference point of the specified dissipation rate values, either ‘stoichiometric’ or ‘maximum’

verbosebool

whether or not to show progress of the library construction

solver_verbosebool

whether or not to show detailed progress of sub-solvers in generating the library

h_stoich_spacingfloat

the stoichiometric enthalpy spacing used in subsampling the transient solution history of each extinction solve

n_defect_stInt or dictionary

the number of stoichiometric enthalpy defect values to include in the table (default: 32) If superadiabatic states are requested, this must be a dictionary specifying the number of superadiabatic and subadiabatic states separately as {‘n_superad’:#, ‘n_subad’:#} (a zero stoichiometric enthalpy defect is always included by default).

integration_argskwargs

extra arguments to be passed to the heat loss integration call (see Flamelet.integrate)

num_procsInt

how many processors over which to distribute the parallel extinction solves

enthalpy_defect_structuring_slopefloat

the slope (default: 0.) used in extrapolating the enthalpy defect field for structuring the library over the stoichiometric enthalpy defects

superad_dT: float or dictionary

superadiabatic states are added to the library when superad_dT is nonzero. Each state is generated by first raising the boundary temperatures by superad_dT/n_defect_st[‘n_superad’] and solving for the steady adiabatic state. This is repeated until the full superad_dT is reached at the boundaries relative to the original flamelet_specs state. The conserved enthalpy for the whole library is defined by the flamelet_specs adiabatic state, making the newly generated states superadiabatic. superad_dT can be specified as a dictionary {‘fuel’:#, ‘oxy’:#} to shift the boundary temperatures of the fuel and oxidizer by different amounts. (default: 0.)

subad_dT: float or dictionary

temperature difference to subtract from the pure stream temperatures before computing the transient heat loss. This defines new degenerate points for the library below the adiabatic state given by the flamelet_specs. The conserved enthalpy for the whole library is defined by the flamelet_specs adiabatic state. subad_dT can be specified as a dictionary {‘fuel’:#, ‘oxy’:#} to shift the boundary temperatures of the fuel and oxidizer by different amounts. (default: 0.)

enforce_enthalpy_defect_monotonicity: bool

(default: False) whether or not to force the change in enthalpy defect over its stoichiometric values to be monotonic for all mixture fraction values.

unstructured_data_filename: string

(default: None) a filename for saving the unstructured dictionary if desired. The dictionary would contain properties over mixture fraction lines for individual stoichiometric (dissipation, enthalpy defect) keys.

Returns:
libraryspitfire.chemistry.library.Library instance

the structured chemistry library

spitfire.chemistry.tabulation.build_nonadiabatic_defect_transient_slfm_library(flamelet_specs, diss_rate_values=array([1.00000000e-03, 2.15443469e-03, 4.64158883e-03, 1.00000000e-02, 2.15443469e-02, 4.64158883e-02, 1.00000000e-01, 2.15443469e-01, 4.64158883e-01, 1.00000000e+00, 2.15443469e+00, 4.64158883e+00, 1.00000000e+01, 2.15443469e+01, 4.64158883e+01, 1.00000000e+02]), diss_rate_ref='stoichiometric', verbose=True, solver_verbose=False, h_stoich_spacing=10000.0, num_procs=1, integration_args=None, n_defect_st=32, enthalpy_defect_structuring_slope=0.0, diss_rate_log_scaled=True, superad_dT=0.0, subad_dT=0.0, enforce_enthalpy_defect_monotonicity=False, unstructured_data_filename=None)

Build a flamelet library with the strained laminar flamelet model including heat loss effects through the enthalpy defect, where heat loss profiles are generated through rapid, transient extinction (as opposed to quasisteady heat loss)

Parameters:
flamelet_specsdictionary or FlameletSpec instance

data for the mechanism, streams, mixture fraction grid, etc.

diss_rate_valuesnp.array

reference dissipation rate values in the table (note that if the flamelet extinguishes at any point, the extinguished flamelet and larger dissipation rates are not included in the library)

diss_rate_refstr

the reference point of the specified dissipation rate values, either ‘stoichiometric’ or ‘maximum’

verbosebool

whether or not to show progress of the library construction

solver_verbosebool

whether or not to show detailed progress of sub-solvers in generating the library

h_stoich_spacingfloat

the stoichiometric enthalpy spacing used in subsampling the transient solution history of each extinction solve

n_defect_stInt or dictionary

the number of stoichiometric enthalpy defect values to include in the table (default: 32) If superadiabatic states are requested, this must be a dictionary specifying the number of superadiabatic and subadiabatic states separately as {‘n_superad’:#, ‘n_subad’:#} (a zero stoichiometric enthalpy defect is always included by default).

integration_argskwargs

extra arguments to be passed to the heat loss integration call (see Flamelet.integrate)

num_procsInt

how many processors over which to distribute the parallel extinction solves

enthalpy_defect_structuring_slopefloat

the slope (default: 0.) used in extrapolating the enthalpy defect field for structuring the library over the stoichiometric enthalpy defects

superad_dT: float or dictionary

superadiabatic states are added to the library when superad_dT is nonzero. Each state is generated by first raising the boundary temperatures by superad_dT/n_defect_st[‘n_superad’] and solving for the steady adiabatic state. This is repeated until the full superad_dT is reached at the boundaries relative to the original flamelet_specs state. The conserved enthalpy for the whole library is defined by the flamelet_specs adiabatic state, making the newly generated states superadiabatic. superad_dT can be specified as a dictionary {‘fuel’:#, ‘oxy’:#} to shift the boundary temperatures of the fuel and oxidizer by different amounts. (default: 0.)

subad_dT: float or dictionary

temperature difference to subtract from the pure stream temperatures before computing the transient heat loss. This defines new degenerate points for the library below the adiabatic state given by the flamelet_specs. The conserved enthalpy for the whole library is defined by the flamelet_specs adiabatic state. subad_dT can be specified as a dictionary {‘fuel’:#, ‘oxy’:#} to shift the boundary temperatures of the fuel and oxidizer by different amounts. (default: 0.)

enforce_enthalpy_defect_monotonicity: bool

(default: False) whether or not to force the change in enthalpy defect over its stoichiometric values to be monotonic for all mixture fraction values.

unstructured_data_filename: string

(default: None) a filename for saving the unstructured dictionary if desired. The dictionary would contain properties over mixture fraction lines for individual stoichiometric (dissipation, enthalpy defect) keys.

Returns:
libraryspitfire.chemistry.library.Library instance

the structured chemistry library

spitfire.chemistry.tabulation.build_unreacted_library(flamelet_specs, verbose=True)

Build a flamelet library for a nonreacting flow, with linear enthalpy and mass fraction profiles.

Parameters:
flamelet_specsFlameletSpec or dictionary of arguments for a FlameletSpec

flamelet specifications

Returns:
libraryspitfire.chemistry.library.Library instance

a chemistry library with only the “mixture_fraction” dimension

spitfire.chemistry.tabulation.require_pytabprops(method_name)

5.1.1.1.10. spitfire.chemistry.soot module

spitfire.chemistry.soot.get_soot_source_term_evaluator(library, verbose=True)

Detect the soot model used in the library and return the corresponding source term function

Parameters:
library: a spitfire.chemistry.library Library instance

a library with soot source term coefficients, computed from running tabulate_soot_source_coefficients

verbose: boolean

whether or not to print the detected soot model on a library; default True

Returns:
src_fun: function

A function for evaluating soot source terms

soot_props: list

A list of the properties needed to evaluate src_fun

spitfire.chemistry.soot.get_soot_source_term_jacobian_evaluator(library, verbose=True)

Detect the soot model used in the library and return the corresponding Jacobian function

Parameters:
library: a spitfire.chemistry.library Library instance

a library with soot source term coefficients, computed from running tabulate_soot_source_coefficients

verbose: boolean

whether or not to print the detected soot model on a library; default True

Returns:
jac_fun: function

A function for evaluating the soot source Jacobian

soot_props: list

A list of the properties needed to evaluate jac_fun

spitfire.chemistry.soot.jac_soot_src_aksit_moss(soot_number_density, soot_mass_fraction, nucl_C2H2, coag, surf_C2H2, surf_O2, surf_OH, input_mult_dict=None)

Evaluates components of the soot source Jacobian using the Aksit_Moss model for the soot_number_density (\(N_s\)) and soot_mass_fraction (\(Y_s\)) as shown below

\(\partial{S}_{N_s}/\partial{N_s} = - (11/6) \mathrm{coag} N_s^{5/6} Y_s^{1/6}\)

\(\partial{S}_{N_s}/\partial{Y_s} = - (1/6) \mathrm{coag} N_s^{11/6} Y_s^{-5/6}\)

\(\partial{S}_{Y_s}/\partial{N_s} = (1/3) (\mathrm{surf\_C2H2} - \mathrm{surf\_O2} - \mathrm{surf\_OH}) N_s^{-2/3} Y_s^{2/3}\)

\(\partial{S}_{Y_s}/\partial{Y_s} = (2/3) (\mathrm{surf\_C2H2} - \mathrm{surf\_O2} - \mathrm{surf\_OH}) N_s^{1/3} Y_s^{-1/3}\)

Parameters:
soot_number_density: float or array

a soot number density (kmol soot / kg air)

soot_mass_fraction: float or array

a soot mass fraction

nucl_C2H2: float or array

an acetylene-based nucleation coefficient (\(\mathrm{kmol}/\mathrm{m}^3/\mathrm{s}\))

coag: float or array

a coagulation coefficient (\(\mathrm{kg}^{11/6}/\mathrm{m}^3/\mathrm{s}/\mathrm{kmol}^{5/6}\))

surf_C2H2: float or array

an acetylene-based surface growth coefficient (\(\mathrm{kg}^{4/3}/\mathrm{m}^3/\mathrm{s}/\mathrm{kmol}^{1/3}\))

surf_O2: float or array

an oxygen-based oxidation coefficient (\(\mathrm{kg}^{4/3}/\mathrm{m}^3/\mathrm{s}/\mathrm{kmol}^{1/3}\))

surf_OH: float or array

a hydroxyl-based oxidation coefficient (\(\mathrm{kg}^{4/3}/\mathrm{m}^3/\mathrm{s}/\mathrm{kmol}^{1/3}\))

input_mult_dict: dictionary

a dictionary of multipliers for any of the source term coefficients present in a library. surface growth and oxidation multipliers are specified by the species name. Supported keys, showing the default unity multipliers, include {‘nucl’: 1.0, ‘coag’: 1.0, ‘cond’: 1.0, ‘surf_c2h2’: 1.0, ‘surf_o2’: 1.0, ‘surf_oh’: 1.0, ‘surf_o’: 1.0, ‘surf_a1’: 1.0}

Returns:
jac_dict: dictionary

A dictionary of the evaluated source Jacobian terms for the soot number density (‘S_Ns’) and soot mass fraction (‘S_Ys’). Keys include ‘dSNs_dNs’, ‘dSNs_dYs’, ‘dSYs_dNs’, ‘dSYs_dYs’.

spitfire.chemistry.soot.jac_soot_src_aksit_moss_benzene(soot_number_density, soot_mass_fraction, nucl_C2H2, coag, surf_C2H2, surf_O2, surf_OH, surf_A1, input_mult_dict=None)

Evaluates components of the soot source Jacobian using the Aksit_Moss_Benzene model for the soot_number_density (\(N_s\)) and soot_mass_fraction (\(Y_s\)) as shown below

\(\partial{S}_{N_s}/\partial{N_s} = - (11/6) \mathrm{coag} N_s^{5/6} Y_s^{1/6}\)

\(\partial{S}_{N_s}/\partial{Y_s} = - (1/6) \mathrm{coag} N_s^{11/6} Y_s^{-5/6}\)

\(\partial{S}_{Y_s}/\partial{N_s} = (1/3) (\mathrm{surf\_C2H2} + \mathrm{surf\_A1} - \mathrm{surf\_O2} - \mathrm{surf\_OH}) N_s^{-2/3} Y_s^{2/3}\)

\(\partial{S}_{Y_s}/\partial{Y_s} = (2/3) (\mathrm{surf\_C2H2} + \mathrm{surf\_A1} - \mathrm{surf\_O2} - \mathrm{surf\_OH}) N_s^{1/3} Y_s^{-1/3}\)

Parameters:
soot_number_density: float or array

a soot number density (kmol soot / kg air)

soot_mass_fraction: float or array

a soot mass fraction

nucl_C2H2: float or array

an acetylene-based nucleation coefficient (\(\mathrm{kmol}/\mathrm{m}^3/\mathrm{s}\))

coag: float or array

a coagulation coefficient (\(\mathrm{kg}^{11/6}/\mathrm{m}^3/\mathrm{s}/\mathrm{kmol}^{5/6}\))

surf_C2H2: float or array

an acetylene-based surface growth coefficient (\(\mathrm{kg}^{4/3}/\mathrm{m}^3/\mathrm{s}/\mathrm{kmol}^{1/3}\))

surf_O2: float or array

an oxygen-based oxidation coefficient (\(\mathrm{kg}^{4/3}/\mathrm{m}^3/\mathrm{s}/\mathrm{kmol}^{1/3}\))

surf_OH: float or array

a hydroxyl-based oxidation coefficient (\(\mathrm{kg}^{4/3}/\mathrm{m}^3/\mathrm{s}/\mathrm{kmol}^{1/3}\))

surf_A1: float or array

a benzene-based surface growth coefficient (\(\mathrm{kg}^{4/3}/\mathrm{m}^3/\mathrm{s}/\mathrm{kmol}^{1/3}\))

input_mult_dict: dictionary

a dictionary of multipliers for any of the source term coefficients present in a library. surface growth and oxidation multipliers are specified by the species name. Supported keys, showing the default unity multipliers, include {‘nucl’: 1.0, ‘coag’: 1.0, ‘cond’: 1.0, ‘surf_c2h2’: 1.0, ‘surf_o2’: 1.0, ‘surf_oh’: 1.0, ‘surf_o’: 1.0, ‘surf_a1’: 1.0}

Returns:
jac_dict: dictionary

A dictionary of the evaluated source Jacobian terms for the soot number density (‘S_Ns’) and soot mass fraction (‘S_Ys’). Keys include ‘dSNs_dNs’, ‘dSNs_dYs’, ‘dSYs_dNs’, ‘dSYs_dYs’.

spitfire.chemistry.soot.jac_soot_src_pah_alpha(soot_number_density, soot_mass_fraction, dimer_src, coag, sg, ox_O2, ox_OH, ox_O, dimer_fac=1e-06, input_mult_dict=None)

Evaluates components of the soot source Jacobian using the PAH_alpha model for the soot_number_density (\(N_s\)) and soot_mass_fraction (\(Y_s\)) as shown below

\(\partial{S}_{N_s}/\partial{N_s} = - (11/6) \mathrm{coag} N_s^{5/6} Y_s^{1/6}\)

\(\partial{S}_{N_s}/\partial{Y_s} = - (1/6) \mathrm{coag} N_s^{11/6} Y_s^{-5/6}\)

\(\partial{S}_{Y_s}/\partial{N_s} = (1/3) (\mathrm{sg} - \mathrm{ox\_O2} - \mathrm{ox\_OH} - \mathrm{ox\_O}) N_s^{-2/3} Y_s^{2/3}\)

\(\partial{S}_{Y_s}/\partial{Y_s} = (2/3) (\mathrm{sg} - \mathrm{ox\_O2} - \mathrm{ox\_OH} - \mathrm{ox\_O}) N_s^{1/3} Y_s^{-1/3}\)

Parameters:
soot_number_density: float or array

a soot number density (kmol soot / kg air)

soot_mass_fraction: float or array

a soot mass fraction

dimer_src: float or array

a PAH-based nucleation coefficient (\(\mathrm{kg}/\mathrm{m}^3/\mathrm{s}\))

coag: float or array

a coagulation coefficient (\(\mathrm{kg}^{11/6}/\mathrm{m}^3/\mathrm{s}/\mathrm{kmol}^{5/6}\))

sg: float or array

a surface growth coefficient (\(\mathrm{kg}^{4/3}/\mathrm{m}^3/\mathrm{s}/\mathrm{kmol}^{1/3}\))

ox_O2: float or array

an oxygen-based oxidation coefficient (\(\mathrm{kg}^{4/3}/\mathrm{m}^3/\mathrm{s}/\mathrm{kmol}^{1/3}\))

ox_OH: float or array

a hydroxyl-based oxidation coefficient (\(\mathrm{kg}^{4/3}/\mathrm{m}^3/\mathrm{s}/\mathrm{kmol}^{1/3}\))

ox_O: float or array

an oxygen radical-based oxidation coefficient (\(\mathrm{kg}^{4/3}/\mathrm{m}^3/\mathrm{s}/\mathrm{kmol}^{1/3}\))

dimer_fac: float or array

factor (default 1e-6) multiplying the nucleation coefficients; used to correct the model’s tendency for nucleation to dominate and over-predict soot

input_mult_dict: dictionary

a dictionary of multipliers for any of the source term coefficients present in a library. surface growth and oxidation multipliers are specified by the species name. Supported keys, showing the default unity multipliers, include {‘nucl’: 1.0, ‘coag’: 1.0, ‘cond’: 1.0, ‘surf_c2h2’: 1.0, ‘surf_o2’: 1.0, ‘surf_oh’: 1.0, ‘surf_o’: 1.0, ‘surf_a1’: 1.0}

Returns:
jac_dict: dictionary

A dictionary of the evaluated source Jacobian terms for the soot number density (‘S_Ns’) and soot mass fraction (‘S_Ys’). Keys include ‘dSNs_dNs’, ‘dSNs_dYs’, ‘dSYs_dNs’, ‘dSYs_dYs’.

spitfire.chemistry.soot.soot_src_aksit_moss(soot_number_density, soot_mass_fraction, nucl_C2H2, coag, surf_C2H2, surf_O2, surf_OH, input_mult_dict=None)

Evaluates source terms using the Aksit_Moss model for the soot_number_density (\(N_s\)) and soot_mass_fraction (\(Y_s\)) as shown below

\(\dot{S}_{N_s} = \mathrm{nucl\_C2H2} - \mathrm{coag} N_s^{11/6} Y_s^{1/6}\)

\(\dot{S}_{Y_s} = 144\mathrm{nucl\_C2H2} + (\mathrm{surf\_C2H2} - \mathrm{surf\_O2} - \mathrm{surf\_OH}) N_s^{1/3} Y_s^{2/3}\)

Parameters:
soot_number_density: float or array

a soot number density (kmol soot / kg air)

soot_mass_fraction: float or array

a soot mass fraction

nucl_C2H2: float or array

an acetylene-based nucleation coefficient (\(\mathrm{kmol}/\mathrm{m}^3/\mathrm{s}\))

coag: float or array

a coagulation coefficient (\(\mathrm{kg}^{11/6}/\mathrm{m}^3/\mathrm{s}/\mathrm{kmol}^{5/6}\))

surf_C2H2: float or array

an acetylene-based surface growth coefficient (\(\mathrm{kg}^{4/3}/\mathrm{m}^3/\mathrm{s}/\mathrm{kmol}^{1/3}\))

surf_O2: float or array

an oxygen-based oxidation coefficient (\(\mathrm{kg}^{4/3}/\mathrm{m}^3/\mathrm{s}/\mathrm{kmol}^{1/3}\))

surf_OH: float or array

a hydroxyl-based oxidation coefficient (\(\mathrm{kg}^{4/3}/\mathrm{m}^3/\mathrm{s}/\mathrm{kmol}^{1/3}\))

input_mult_dict: dictionary

a dictionary of multipliers for any of the source term coefficients present in a library. surface growth and oxidation multipliers are specified by the species name. Supported keys, showing the default unity multipliers, include {‘nucl’: 1.0, ‘coag’: 1.0, ‘cond’: 1.0, ‘surf_c2h2’: 1.0, ‘surf_o2’: 1.0, ‘surf_oh’: 1.0, ‘surf_o’: 1.0, ‘surf_a1’: 1.0}

Returns:
src_dict: dictionary

A dictionary of the evaluated source terms for the soot number density (‘S_Ns’) and soot mass fraction (‘S_Ys’) along with various contributions to those source terms including nucleation (‘S_Ns_nucl’ and ‘S_Ys_nucl’), coagulation (‘S_Ns_coag’), condensation (‘S_Ys_cond’), surface growth (‘S_Ys_c2h2’ and ‘S_Ys_a1’), and oxidation (‘S_Ys_o2’, ‘S_Ys_oh’, and ‘S_Ys_o’). Terms that aren’t relevant to the library’s soot model will be populated with zeros.

spitfire.chemistry.soot.soot_src_aksit_moss_benzene(soot_number_density, soot_mass_fraction, nucl_C2H2, coag, surf_C2H2, surf_O2, surf_OH, surf_A1, input_mult_dict=None)

Evaluates source terms using the Aksit_Moss_Benzene model for the soot_number_density (\(N_s\)) and soot_mass_fraction (\(Y_s\)) as shown below

\(\dot{S}_{N_s} = \mathrm{nucl\_C2H2} - \mathrm{coag} N_s^{11/6} Y_s^{1/6}\)

\(\dot{S}_{Y_s} = 144\mathrm{nucl\_C2H2} + (\mathrm{surf\_C2H2} + \mathrm{surf\_A1} - \mathrm{surf\_O2} - \mathrm{surf\_OH}) N_s^{1/3} Y_s^{2/3}\)

Parameters:
soot_number_density: float or array

a soot number density (kmol soot / kg air)

soot_mass_fraction: float or array

a soot mass fraction

nucl_C2H2: float or array

an acetylene-based nucleation coefficient (\(\mathrm{kmol}/\mathrm{m}^3/\mathrm{s}\))

coag: float or array

a coagulation coefficient (\(\mathrm{kg}^{11/6}/\mathrm{m}^3/\mathrm{s}/\mathrm{kmol}^{5/6}\))

surf_C2H2: float or array

an acetylene-based surface growth coefficient (\(\mathrm{kg}^{4/3}/\mathrm{m}^3/\mathrm{s}/\mathrm{kmol}^{1/3}\))

surf_O2: float or array

an oxygen-based oxidation coefficient (\(\mathrm{kg}^{4/3}/\mathrm{m}^3/\mathrm{s}/\mathrm{kmol}^{1/3}\))

surf_OH: float or array

a hydroxyl-based oxidation coefficient (\(\mathrm{kg}^{4/3}/\mathrm{m}^3/\mathrm{s}/\mathrm{kmol}^{1/3}\))

surf_A1: float or array

a benzene-based surface growth coefficient (\(\mathrm{kg}^{4/3}/\mathrm{m}^3/\mathrm{s}/\mathrm{kmol}^{1/3}\))

input_mult_dict: dictionary

a dictionary of multipliers for any of the source term coefficients present in a library. surface growth and oxidation multipliers are specified by the species name. Supported keys, showing the default unity multipliers, include {‘nucl’: 1.0, ‘coag’: 1.0, ‘cond’: 1.0, ‘surf_c2h2’: 1.0, ‘surf_o2’: 1.0, ‘surf_oh’: 1.0, ‘surf_o’: 1.0, ‘surf_a1’: 1.0}

Returns:
src_dict: dictionary

A dictionary of the evaluated source terms for the soot number density (‘S_Ns’) and soot mass fraction (‘S_Ys’) along with various contributions to those source terms including nucleation (‘S_Ns_nucl’ and ‘S_Ys_nucl’), coagulation (‘S_Ns_coag’), condensation (‘S_Ys_cond’), surface growth (‘S_Ys_c2h2’ and ‘S_Ys_a1’), and oxidation (‘S_Ys_o2’, ‘S_Ys_oh’, and ‘S_Ys_o’). Terms that aren’t relevant to the library’s soot model will be populated with zeros.

spitfire.chemistry.soot.soot_src_pah_alpha(soot_number_density, soot_mass_fraction, dimer_src, coag, sg, ox_O2, ox_OH, ox_O, dimer_fac=1e-06, input_mult_dict=None)

Evaluates source terms using the PAH_alpha model for the soot_number_density (\(N_s\)) and soot_mass_fraction (\(Y_s\)) as shown below

\(\dot{S}_{N_s} = \mathrm{dimer\_src}(\mathrm{dimer\_fac})\frac{0.5}{361.4} - \mathrm{coag} N_s^{11/6} Y_s^{1/6}\)

\(\dot{S}_{Y_s} = \mathrm{dimer\_src}(\mathrm{dimer\_fac}) + (\mathrm{sg} - \mathrm{ox\_O2} - \mathrm{ox\_OH} - \mathrm{ox\_O}) N_s^{1/3} Y_s^{2/3}\)

Parameters:
soot_number_density: float or array

a soot number density (kmol soot / kg air)

soot_mass_fraction: float or array

a soot mass fraction

dimer_src: float or array

a PAH-based nucleation coefficient (\(\mathrm{kg}/\mathrm{m}^3/\mathrm{s}\))

coag: float or array

a coagulation coefficient (\(\mathrm{kg}^{11/6}/\mathrm{m}^3/\mathrm{s}/\mathrm{kmol}^{5/6}\))

sg: float or array

a surface growth coefficient (\(\mathrm{kg}^{4/3}/\mathrm{m}^3/\mathrm{s}/\mathrm{kmol}^{1/3}\))

ox_O2: float or array

an oxygen-based oxidation coefficient (\(\mathrm{kg}^{4/3}/\mathrm{m}^3/\mathrm{s}/\mathrm{kmol}^{1/3}\))

ox_OH: float or array

a hydroxyl-based oxidation coefficient (\(\mathrm{kg}^{4/3}/\mathrm{m}^3/\mathrm{s}/\mathrm{kmol}^{1/3}\))

ox_O: float or array

an oxygen radical-based oxidation coefficient (\(\mathrm{kg}^{4/3}/\mathrm{m}^3/\mathrm{s}/\mathrm{kmol}^{1/3}\))

dimer_fac: float or array

factor (default 1e-6) multiplying the nucleation coefficients; used to correct the model’s tendency for nucleation to dominate and over-predict soot

input_mult_dict: dictionary

a dictionary of multipliers for any of the source term coefficients present in a library. surface growth and oxidation multipliers are specified by the species name. Supported keys, showing the default unity multipliers, include {‘nucl’: 1.0, ‘coag’: 1.0, ‘cond’: 1.0, ‘surf_c2h2’: 1.0, ‘surf_o2’: 1.0, ‘surf_oh’: 1.0, ‘surf_o’: 1.0, ‘surf_a1’: 1.0}

Returns:
src_dict: dictionary

A dictionary of the evaluated source terms for the soot number density (‘S_Ns’) and soot mass fraction (‘S_Ys’) along with various contributions to those source terms including nucleation (‘S_Ns_nucl’ and ‘S_Ys_nucl’), coagulation (‘S_Ns_coag’), condensation (‘S_Ys_cond’), surface growth (‘S_Ys_c2h2’ and ‘S_Ys_a1’), and oxidation (‘S_Ys_o2’, ‘S_Ys_oh’, and ‘S_Ys_o’). Terms that aren’t relevant to the library’s soot model will be populated with zeros.

spitfire.chemistry.soot.tabulate_soot_radiation_model(mechanism, input_library, modelname='linear_absorption_coefficient', input_modelargs=None, soot_density=1800.0)

Adds soot radiation properties to a library

Parameters:
mechanism: spitfire.chemistry.mechanism ChemicalMechanismSpec instance

the mechanism

input_library: a spitfire.chemistry.library Library instance

a library with T, Y, and either density or pressure (pressure is used if both are present)

modelname: str

the soot radiation model. Supported models include: ‘linear_absorption_coefficient’ (default)

input_modelargs: dictionary

a dictionary of arguments for the specified radiation model. For example, the ‘linear_absorption_coefficient’ model can take an ‘intercept’ (default: -3.75e5 1/m), ‘slope’ (default: 1735. 1/(m-K)), and ‘min_value’ (default: 0. 1/m).

soot_density: float

density of soot (default = 1800 kg/m^3)

Returns:
output_library: a spitfire.chemistry.library Library instance

The library with the following fields added

  • ‘soot_abs_coeff’: absorption coefficient

  • ‘soot_rad_source’: radiation source

spitfire.chemistry.soot.tabulate_soot_source_coefficients(mechanism, input_library, modelname, soot_leakage_fraction=1.0, verbose=True, soot_species_aliases=None, soot_density=1800.0, AMB_nucleation_factor=2.0, AMB_A1_factor=20.0)

Adds soot source term coefficients to a library

Parameters:
mechanism: spitfire.chemistry.mechanism ChemicalMechanismSpec instance

the mechanism

input_library: a spitfire.chemistry.library Library instance

a library with T, Y, and either density or pressure (pressure is used if both are present)

modelname: str

the soot kinetics model. Supported models include: ‘Aksit_Moss’, ‘Aksit_Moss_Benzene’, and ‘PAH_alpha’ (an alpha-stage model)

soot_leakage_fraction: float

the fraction of soot allowed to leak into fuel-lean regions of the flame.

verbose: bool

whether or not to print warnings/messages (default True)

soot_species_aliases: dictionary

dictionary of aliases for the soot species involved, matching the species name to its abbreviation/formula used in the mechanism. Spitfire has some common aliases it checks if none are provided.

soot_density: float

density of soot (default = 1800 kg/m^3)

AMB_nucleation_factor: float

multiplier on the ‘Aksit_Moss_Benzene’ nucleation (default 2)

AMB_A1_factor: float

multiplier on the ‘Aksit_Moss_Benzene’ A1 surface growth (default 20)

Returns:
output_library: a spitfire.chemistry.library Library instance

The library with the following fields added for species relevant to the chosen model:

  • ‘coag’: coagulation

  • ‘surf_’: surface growth or oxidation for the species following the underscore

  • ‘nucl_’: nucleation for the species following the underscore

5.1.1.1.11. spitfire.chemistry.gas_radiation module

spitfire.chemistry.gas_radiation.tabulate_gas_radiation_model(mechanism, input_library, modelname='Barlow_GreyGas')

Adds gas radiation properties to a library

Parameters:
mechanism: spitfire.chemistry.mechanism ChemicalMechanismSpec instance

the mechanism

input_library: a spitfire.chemistry.library Library instance

a library with T, Y, and either density or pressure (pressure is used if both are present)

modelname: str

the gas radiation model. Supported models include: ‘Barlow_GreyGas’ (default)

Returns:
output_library: a spitfire.chemistry.library Library instance

The library with the following fields added

  • ‘gas_abs_coeff’: absorption coefficient

  • ‘gas_rad_source’: radiation source

5.1.1.1.12. Module contents

This module contains Spitfire’s core functionality for chemistry problems.