opencr.kinetics.rates
Rate coefficients of every reaction of a network for given conditions.
RateEvaluator prepares each reaction once and then returns the vector
of rate coefficients k_r (SI) for any Conditions,
or for many electron temperatures at once.
Cross sections, Maxwellian. plasmacoll’s cross sections are linear between
their table points and constant beyond the last one, so
k(T) = (8 / (pi mu))^1/2 (kT)^-3/2 int sigma(E) E exp(-E / kT) dE is a sum of
integrals of quadratics times an exponential, done in closed form per
segment: exact for the table, with no integration grid. Each evaluator
returns k exp(E_th / T) with the threshold E_th taken out, so that
detailed balance never forms exp(+E/T) of a tiny number.
Cross sections, any EEDF. With a non-Maxwellian
EEDF, the electron-impact rates are
(2 e / m_e)^1/2 int eps sigma F0 deps (plasmacoll.eedf_rate_coefficient)
on the distribution’s grid. Rates that are not cross sections use the
conditions’ electron temperature (2/3 <eps> from
from_eedf).
Detailed balance. The inverse of an electron-impact excitation uses the
Klein-Rosseland inverse cross section
sigma_inv(eps) = (g_l / g_u) (eps + dE) / eps sigma(eps + dE) for any
EEDF, which for a Maxwellian is the Boltzmann relation
k_inv = k (g_l / g_u) exp(dE / T) (used in closed form). An inverse with one
electron more on the forward product side (three-body recombination from
ionization) follows the Saha relation
k_inv = k (g_0 / (g_e g_+)) lambda^3 exp(dE / T) with the electron’s thermal
de Broglie volume lambda^3, at the electron temperature (the effective one
for a non-Maxwellian EEDF). dE and the weights come from the states.
Escape factors multiply the spontaneous emission rates (radiation trapping): the conditions’ value for the reaction if given, else the reaction’s own.
Arrays. Every evaluator is written against cunumpy’s xp (NumPy or
CuPy for the whole process, see opencr.backends; the optional JAX
backend passes jax.numpy in its place):
RateEvaluator.coefficients_batched evaluates all reactions at many
electron temperatures at once there, RateEvaluator.coefficients one
set of conditions, as floats on the host. A Function
rate runs on the host (its temperatures are copied there and the result
back); a non-Maxwellian EEDF is integrated on the host by plasmacoll and is
not batched.
Classes
| Name | Description |
|---|---|
MaxwellianIntegral | The exact Maxwellian average of a piecewise-linear cross section. |
RateEvaluator | Rate coefficients of a network's reactions. |
Functions
| Name | Description |
|---|---|
inverse_cross_section | Return the Klein-Rosseland inverse of an electron-impact cross section. |
MaxwellianIntegralclassdataclass#
class MaxwellianIntegral(threshold: float, mass: float, y: np.ndarray, c0: np.ndarray, c1: np.ndarray, c2: np.ndarray)The exact Maxwellian average of a piecewise-linear cross section.
Attributes
| Name | Type | Description |
|---|---|---|
threshold | float | The threshold in the centre-of-mass frame (eV). |
mass | float | The reduced mass (kg). |
y | np.ndarray | The segment boundaries above the threshold (eV), n + 1 values;
the last segment continues to infinity with a constant cross section. |
c0, | (c1, c2) | The coefficients of sigma(E) E = c0 + c1 y + c2 y^2 per
segment (n + 1 values, the last for the tail with c2 = 0). |
Numerics
maxwellian
segment
antiderivative
scaled
Order of accuracy: 2.
Assumptions:
- exact for the piecewise-linear table, plus the constant tail to infinity (); no energy grid
- the order is that of the table spacing, for a smooth cross section sampled on the table
- the threshold is taken out (), so detailed balance never forms of a tiny number; because the integral is in eV m
c0attributeinstance attribute#
c0: np.ndarrayc1attributeinstance attribute#
c1: np.ndarrayc2attributeinstance attribute#
c2: np.ndarraymassattributeinstance attribute#
mass: floatthresholdattributeinstance attribute#
threshold: floatyattributeinstance attribute#
y: np.ndarrayfrom_ratemethodclassmethod#
def from_rate(rate: CrossSectionRate) -> MaxwellianIntegralPrepare the integral of a cross-section rate model.
log_scaledmethod#
def log_scaled(temperature: Any, xp: ModuleType = xp) -> AnyReturn log(k exp(E_th / T)) with k in m^3/s at temperature (eV), on xp.
RateEvaluatorclass#
class RateEvaluator(network: ReactionNetwork)Rate coefficients of a network’s reactions.
Parameters
| Name | Type | Description |
|---|---|---|
network | ReactionNetwork | The reaction network. |
coefficientsmethod#
def coefficients(conditions: Conditions) -> np.ndarrayReturn k_r in SI for every reaction at conditions.
Numerics
scaled
inverse
boltzmann
saha
escape
Assumptions:
depends_onpicks the temperature: ( for a non-Maxwellian EEDF), (the gas temperature when not given), , or none- with a non-Maxwellian EEDF only the electron cross sections (and their Klein-Rosseland inverses) are integrated over it (
plasmacoll.eedf_rate_coefficient) - the escape factor is
Conditions.escapeby name, else the reaction’s ownescape
References:
- Klein and Rosseland, Z. Phys. 4, 46 (1921)
- Tiesinga et al., Rev. Mod. Phys. 93, 025010 (2021) (CODATA 2018)
Built from:
opencr.kinetics.rates.MaxwellianIntegralopencr.kinetics.rates.inverse_cross_section
coefficients_batchedmethod#
def coefficients_batched(conditions: Conditions, electron_temperatures: Any)Return k of shape (len(electron_temperatures), n_reactions) on xp.
Maxwellian electrons at each temperature; everything else (the heavy
temperatures, the escape factors) from conditions. The input is
copied to xp and the result stays there (xp.to_numpy brings it
back).
Raises
ValueError- A non-Maxwellian EEDF (integrated on the host only), or a temperature that is not positive.
coefficients_scanmethod#
def coefficients_scan(conditions: Conditions, electron_temperatures: np.ndarray) -> np.ndarrayReturn k of shape (len(electron_temperatures), n_reactions) on the host.
escape_factorsmethod#
def escape_factors(conditions: Conditions) -> np.ndarrayReturn the factor of every reaction: the escape factor of a line, 1 otherwise.
evaluatemethod#
def evaluate(prepared: Sequence[_Prepared], conditions: Conditions, electron_temperatures: Any, xp: ModuleType = xp) -> AnyReturn k of shape (..., n_reactions) on the namespace xp.
The core of coefficients_batched, for a given list of prepared
reactions (the JAX backend passes its own, with Function rates
tabulated) and any array namespace with the NumPy API; conditions
gives the heavy temperatures and the escape factors. The Maxwellian
integrals of all cross sections are evaluated at once
(_Stack), the thresholds and detailed-balance factors as
vectors; only Arrhenius, tabulated and function rates go one by one.
An intermediate of (..., U, S) numbers (integrals times table
points) is formed, so a long batch is better evaluated in chunks.
inverse_cross_sectionfunction#
def inverse_cross_section(cross_section: CrossSection, weight_ratio: float, energy_gap: float) -> CrossSectionReturn the Klein-Rosseland inverse of an electron-impact cross section.
sigma_inv(eps) = weight_ratio (eps + dE) / eps sigma(eps + dE) with
dE = energy_gap; the table starts just above zero energy.
Numerics
reversibility
klein rosseland
Assumptions:
- microscopic reversibility, so it holds for any electron energy distribution
- tabulated on the forward table points shifted down by , from eV
- is the cross section’s threshold (13.6-based for hydrogen); the Maxwellian path uses the state energy gap (13.598-based)
References: