rizer.kin.extensible_rate#

Classes#

ExtensibleElectronTemperaturePlasmaRateData

Data class to hold electron temperature data for a plasma.

ExtensibleTwoTempPlasmaRateData

Data class to hold two-temperature plasma data for a plasma.

JanevDissociativeRecombinationC2Hy

Data class to hold dissociative recombination data for a C2Hy species.

DruyvesteynRate

Data class to hold Druyvesteyn rate data for a reaction.

ReverseTwoTemperaturePlasma

Data class to hold reverse two-temperature plasma data for a plasma.

Functions#

enable_reverse_two_temperature_grid_cache(→ None)

Enable an opt-in temperature-grid cache for reverse-two-temperature-plasma rates.

disable_reverse_two_temperature_grid_cache(→ None)

Disable the reverse-two-temperature-plasma temperature-grid cache (exact path).

get_fake_reverse_reaction(→ cantera.Reaction)

Generate a fake reverse reaction for unit conversion purposes.

to_reverse_reaction_format(→ str)

to_janev_dissociative_recombination_C2Hy_format(→ str)

Module Contents#

class rizer.kin.extensible_rate.ExtensibleElectronTemperaturePlasmaRateData#

Bases: cantera.ExtensibleRateData

Data class to hold electron temperature data for a plasma.

Te: float | None = None#
update(plasma: cantera.Solution) bool#
class rizer.kin.extensible_rate.ExtensibleTwoTempPlasmaRateData#

Bases: cantera.ExtensibleRateData

Data class to hold two-temperature plasma data for a plasma.

Notes

The gas object is initialized as a copy of the plasma object. The gas object is used to compute the forward rate constants and equilibrium constants at the gas temperature and electron temperature. The gas object is used to compute the equilibrium constant for the reverse reaction. This is done since reverse reactions are not automatically created by Cantera for two-temperature plasma reactions.

Tg: float | None = None#
Te: float | None = None#
kf_Tg: numpy.ndarray#
kf_Te: numpy.ndarray#
K_eq_Tg: numpy.ndarray#
K_eq_Te: numpy.ndarray#
gas: cantera.Solution | None = None#
update(plasma: cantera.Solution) bool#

Update the two-temperature plasma data for a plasma.

rizer.kin.extensible_rate.enable_reverse_two_temperature_grid_cache(T_min: float = 300.0, T_max: float = 100000.0, n_points: int = 1000) None#

Enable an opt-in temperature-grid cache for reverse-two-temperature-plasma rates.

By default, every reactor right-hand-side call makes ExtensibleTwoTempPlasmaRateData recompute Cantera’s forward-rate and equilibrium constants for the whole reaction set at both the gas and the electron temperature – a large cost that dominates stiff transients (e.g. a re-ignition from a reflected pulse, where the solver takes thousands of tiny steps).

When enabled, the first update precomputes log10(kf(T)) and log10(K_eq(T)) on a log-spaced grid over [T_min, T_max] and thereafter interpolates them (equivalent to log-interpolating the reverse rate constant kf / K_eq). kf for the served electron-impact reactions and K_eq are temperature-only, so a fine grid reproduces the exact rates to well within a percent. Ion/neutral pressure-dependent reactions are never indexed by the reverse-rate evaluation, so gridding at the build-time pressure is safe.

Must be called before the plasma solution is first used (before integration). This is opt-in: the exact recomputation remains the default.

Parameters:
  • T_min (float, optional) – Bounds of the temperature grid, in K (default 300 to 100 000 K). The range must cover both the gas and the electron temperatures reached in the run.

  • T_max (float, optional) – Bounds of the temperature grid, in K (default 300 to 100 000 K). The range must cover both the gas and the electron temperatures reached in the run.

  • n_points (int, optional) – Number of log-spaced grid points, by default 1000.

rizer.kin.extensible_rate.disable_reverse_two_temperature_grid_cache() None#

Disable the reverse-two-temperature-plasma temperature-grid cache (exact path).

class rizer.kin.extensible_rate.JanevDissociativeRecombinationC2Hy#

Bases: cantera.ExtensibleRate

Data class to hold dissociative recombination data for a C2Hy species.

set_parameters(params: cantera.AnyMap, units)#
get_parameters(params: cantera.AnyMap)#
validate(equation, soln)#
eval(data: cantera.ExtensibleRateData) float#
class rizer.kin.extensible_rate.DruyvesteynRate#

Bases: cantera.ExtensibleRate

Data class to hold Druyvesteyn rate data for a reaction.

set_parameters(params: cantera.AnyMap, units)#
get_parameters(params: cantera.AnyMap)#
validate(equation, soln)#
eval(data: cantera.ExtensibleRateData) float#
class rizer.kin.extensible_rate.ReverseTwoTemperaturePlasma#

Bases: cantera.ExtensibleRate

Data class to hold reverse two-temperature plasma data for a plasma.

forward_equation#

Forward reaction equation.

Type:

str

T#

Temperature to use for the reverse reaction. Either Te or Tg. If a reverse reaction involves electrons, use the electron temperature. Otherwise, use the gas temperature.

Type:

str

idx_forward_reaction#

Index of the forward reaction in the gas object. None at initialization. Set to the index of the forward reaction in the gas object after the first update.

Type:

int or None

Notes

The index of the forward reaction is computed only once and stored in the idx_forward_reaction attribute.

set_parameters(params: cantera.AnyMap, units)#
get_parameters(params: cantera.AnyMap)#
validate(equation: str, plasma: cantera.Solution)#
eval(data: cantera.ExtensibleRateData) float#
rizer.kin.extensible_rate.get_fake_reverse_reaction(reaction: cantera.Reaction, gas: cantera.Solution) cantera.Reaction#

Generate a fake reverse reaction for unit conversion purposes.

For non-reversible reactions, Cantera does not automatically create reverse reactions. This function generates a synthetic reverse reaction to allow proper unit conversion of the preexponential factor A using Cantera’s rate_coeff_units method.

Parameters:
  • reaction (cantera.Reaction) – Cantera reaction object (can be forward or reversible).

  • gas (cantera.Solution) – Cantera gas object containing the reaction mechanism.

Returns:

A synthetic reverse reaction with flipped reactants and products.

Return type:

cantera.Reaction

Notes

This function creates a thermodynamically meaningless reaction (reactants and products are swapped) purely for determining the correct units of the rate constant for the reverse direction. The fake reaction is not intended for any thermodynamic calculations.

Examples

>>> import cantera as ct
>>> gas = ct.Solution("gri30.yaml")
>>> reaction = gas.reactions()[0]  # 2 O + M <=> O2 + M
>>> fake_rev = get_fake_reverse_reaction(reaction, gas)
>>> print(fake_rev.equation)
O2 + M <=> 2 O + M
rizer.kin.extensible_rate.to_reverse_reaction_format(forward_reaction: cantera.Reaction, gas: cantera.Solution, note: str) str#
rizer.kin.extensible_rate.to_janev_dissociative_recombination_C2Hy_format(equation: str, A: float, unit: str, note: str | None = None, source: str | None = None) str#