Skip to content

autoignition

Figure()

Class for creating ignition delay time figures with the standard layout:

  • Inverse temperature (1000/T) x-axis (bottom)
  • Log-scale IDT y-axis
  • Secondary temperature x-axis (top)

Attributes:

Name Type Description
ax_temp

Temperature axis.

ax_inv

Inverse temperature axis.

prop_groups dict[str, dict]

Property groups.

exp_props = {'linestyle': 'None', 'marker': 'o', 'capsize': 5} class-attribute instance-attribute

Default properties for errorbar plots.

sim_props = {} class-attribute instance-attribute

Default properties for all simulation line plots.

T_lim: tuple[float, float] property writable

Get/set the temperature [K] limits of the figure.

IDT_lim: tuple[float, float] property writable

Get/set the ignition delay time [s] limits of the figure.

plot_exp(T: list[float] | np.ndarray, IDT: list[float] | np.ndarray, *groups, **kwargs)

Parameters:

Name Type Description Default
T list[float] | ndarray

Temperatures [K].

required
IDT list[float] | ndarray

Ignition delay times [s].

required
*groups

Property group names.

()

plot_sim(T: list[float] | np.ndarray, IDT: list[float] | np.ndarray, *groups, **kwargs)

Parameters:

Name Type Description Default
T list[float] | ndarray

Temperatures [K].

required
IDT list[float] | ndarray

Ignition delay times [s].

required
*groups

Property group names.

()

Simulation(gas: ct.Solution | str, T: float, P: float, X: str | dict[str, float])

Parameters:

Name Type Description Default
gas Solution | str

Cantera gas phase object or filepath to mechanism.

required
T float

Temperature [K].

required
P float

Pressure [Pa].

required
X str | dict[str, float]

Species mole fractions.

required

t: npt.NDArray[np.float64] property

Reactor elapsed time [s].

T: npt.NDArray[np.float64] property

Reactor temperature history [K].

P: npt.NDArray[np.float64] property

Reactor pressure history [Pa].

run(t: float = 1)

This function returns self to support call chaining.

Parameters:

Name Type Description Default
t float

Simulation end time [s].

1

save(filepath: str) -> str

Note

If filepath doesn't end with ".yaml", it will be appended automatically.

Warning

save will overwrite an existing file with the same filepath.

Parameters:

Name Type Description Default
filepath str

Filepath to save the state data.

required

Returns:

Type Description
str

Filepath of saved state.

restore(filepath: str, mech: str) classmethod

Warning

Integrator state is not preserved; therefore, continuing a simulation from saved state data, although it will yield essentially the same results, will not exactly match a simulation ran without saving and reloading, as the integrator must take smaller steps initally.

Parameters:

Name Type Description Default
filepath str

Filepath to the saved state data in YAML format.

required
mech str

Mechanism file to reinitialize the simulation and state.

required

X(species: str) -> npt.NDArray[np.float64]

Parameters:

Name Type Description Default
species str

Name of species.

required

Returns:

Type Description
NDArray[float64]

Mole fraction history for the species.

ignition_delay_time(species: str | None = None, *, method: str = 'inflection') -> float | None

Calculates the ignition delay time from the reactor temperature history, or species mole fraction if given, using the specified method.

Note

Returns None if the ignition delay time is at the end of the simulation.

Parameters:

Name Type Description Default
species str | None

Name of species.

None
method str

Method used to calculate ignition delay time.

  • 'inflection' (max slope)
  • 'max'
'inflection'

Returns:

Type Description
float | None

Ignition delay time [s].

get_top_species(n: int | None = None, *, exclude: str | list[str] | None = None) -> list[str]

Parameters:

Name Type Description Default
n int | None

Number of species to include - all species are included by default.

None
exclude str | list[str] | None

Species to exclude.

None

Returns:

Type Description
list[str]

List of top n species by mole fraction in descending order.

SimulationPool(max_workers: int | None = None, output_dir: str | None = None, process_func: Callable[[Simulation], Any] | None = None)

Parameters:

Name Type Description Default
max_workers int | None

Maximum number of worker processes.

None
output_dir str | None

Directory to output simulation files.

None
process_func Callable[[Simulation], Any] | None

Optional function to process simulation results.

None

submit_simulation(mech: str, T: float, P: float, X, *, filename: str | None = None) -> int

Parameters:

Name Type Description Default
mech str

Filepath to Cantera mechanism.

required
T float

Temperature [K].

required
P float

Pressure [Pa].

required
X

Species mole fractions.

required
filename str | None

Name of the output simulation file (default: sim[id].yaml).

None

Returns:

Name Type Description
id int

Simulation ID number.