rizer.kin.reverse_reaction_builder#

Module for computing reverse reaction rate constants using detailed balance and Gibbs free energy.

This module provides utilities to:

  • Generate fake reverse reactions for non-reversible reactions in Cantera.

  • Calculate reverse rate constants via the equilibrium constant derived from Gibbs free energy.

  • Convert rate constants between Cantera’s SI units and (cm³/mol/s/K).

  • Fit Arrhenius parameters to computed rate constants.

Key formula used for reverse rate constant calculation:

\[k_b = \frac{k_f}{K_{eq}}\]

where:

  • \(k_b\): backward rate constant

  • \(k_f\): forward rate constant

  • \(K_{eq}\): equilibrium constant

The equilibrium constant is computed from Gibbs free energy:

\[K_{eq} = \exp\left(-\frac{\Delta G}{R T}\right)\]

where:

  • \(\Delta G\): Gibbs free energy change

  • \(R\): universal gas constant

  • \(T\): temperature

For two-temperature plasma reactions, in equilibrium, the electron temperature is equal to the gas temperature, and the rate constant is computed using the above formula.

Then, the Arrhenius parameters are fitted to the computed rate constants using least squares. Here’s the modified Arrhenius expression used for fitting:

\[k(T) = A T^b \exp\left(-\frac{E_a}{T}\right)\]

where:

  • \(k(T)\): rate constant at temperature \(T\)

  • \(A\): pre-exponential factor

  • \(b\): temperature exponent

  • \(E_a\): activation energy

Functions:

  • get_fake_reverse_reaction(reaction, gas): Generate a fake reverse reaction for unit conversion.

  • get_unit_of_A_inverse(reaction, gas): Get the unit of the rate constant A for the inverse reaction.

  • calculate_reverse_reaction_constant_via_delta_r_g(…): Compute reverse rate constant via Gibbs free energy.

  • convert_rate_constant_to_cm3_mol_s_K(rate_constant): Convert rate constant to (cm³/mol/s/K).

Attributes#

Functions#

get_fake_reverse_reaction(→ cantera.Reaction)

Get the fake reverse reaction.

get_unit_of_A_inverse(→ str)

Get the unit of the rate constant A for the inverse reaction.

calculate_reverse_reaction_constant_via_delta_r_g(, ...)

Calculate Reverse reaction coefficient.

convert_rate_constant_to_cm3_mol_s_K(→ dict[str, ...)

Convert the rate constant from Cantera (SI unit + kmol) to cm3/mol/s/K.

Module Contents#

rizer.kin.reverse_reaction_builder.logger#
rizer.kin.reverse_reaction_builder.u#
rizer.kin.reverse_reaction_builder.get_fake_reverse_reaction(reaction: cantera.Reaction, gas: cantera.Solution) cantera.Reaction#

Get the fake reverse reaction.

Parameters:
  • reaction (ct.Reaction) – Cantera reaction.

  • gas (ct.Solution) – Cantera gas object.

Returns:

Fake reverse reaction.

Return type:

ct.Reaction

Notes

For reactions that are only forwards, Cantera does not create a reverse reaction (which is the normal behaviour). However, to convert the preexponential factor A in the correct unit, this code uses Cantera function rate_coeff_units, which is a method of ct.Reaction. Therefore, this function exists to have a fake reverse reaction in order to use it later to convert to the correct unit.

rizer.kin.reverse_reaction_builder.get_unit_of_A_inverse(reaction: cantera.Reaction, gas: cantera.Solution) str#

Get the unit of the rate constant A for the inverse reaction.

Parameters:
  • reaction (ct.Reaction) – Cantera reaction.

  • gas (ct.Solution) – Cantera gas object.

Returns:

Unit of the rate constant A for the inverse reaction.

Return type:

str

rizer.kin.reverse_reaction_builder.calculate_reverse_reaction_constant_via_delta_r_g(reaction: cantera.reaction.Reaction | str, gas: cantera.Solution, initial_composition: str, temperatures_array: numpy.ndarray = np.linspace(300, 20000), plot: bool = False, return_all: bool = False) numpy.ndarray | tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray]#

Calculate Reverse reaction coefficient.

Calculate reverse reaction coefficient based on the computation of the Gibbs free energy.

Parameters:
  • reaction (ct.reaction.Reaction | str) – Reaction for which the reverse rate constant should be calculated.

  • gas (ct.Solution) – Cantera gas object.

  • initial_composition (str) – Initial composition of the gas, e.g. “CH4:1” or “O2:0.21, N2:0.79”.

  • temperatures_array (np.ndarray, optional) – Array of temperatures at which the rate constant should be computed, by default np.linspace(300, 20000).

  • plot (bool, optional) – If True, plot the computed rate constants, by default False.

  • return_all (bool, optional) – If True, return all computed rate constants, by default False.

Returns:

Array of computed reverse rate constants. Values are like Cantera, so it uses m^3, kmol, s. If return_all is True, return all computed rate constants.

Return type:

np.ndarray | tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]

rizer.kin.reverse_reaction_builder.convert_rate_constant_to_cm3_mol_s_K(rate_constant: dict[str, float | str]) dict[str, float | str]#

Convert the rate constant from Cantera (SI unit + kmol) to cm3/mol/s/K.

Parameters:

rate_constant (dict[str, float]) – Rate constant with keys ‘A’, ‘b’, ‘Ea’. ‘A’ is in (m3/kmol)^order/s, ‘b’ is dimensionless, ‘Ea’ is in J/mol.

Returns:

Rate constant with keys ‘A’, ‘b’, ‘Ea’. ‘A’ is in (cm3/mol)^order/s, ‘b’ is dimensionless, ‘Ea’ is in K.

Return type:

dict[str, float]

rizer.kin.reverse_reaction_builder.plot = False#