opencr.core.rates
How the rate coefficient of a reaction is given.
A rate model describes the data, not how they are evaluated: the evaluation
(Maxwellian or any electron energy distribution, on any backend) is in
opencr.kinetics.rates. The rate of a reaction with reactants r_i
is k prod n_i (a reactant that appears twice counts twice), so k is in
s^-1 for one reactant, m^3/s for two and m^6/s for three.
depends_on names the temperature a model depends on: "electron"
(T_e, or for a non-Maxwellian distribution the effective temperature
2/3 <eps>), "ion", "gas" or "none".
The masses (kg), energies and temperatures (eV) of a rate model take an
astropy Quantity or a string such as "11604 K" as well as a number (see
plasmacoll.units). The rate coefficients themselves (Arrhenius.a,
Tabulated.values, Constant.value) are numbers in the SI unit of the
reaction’s order, which the rate model does not know.
Attributes
| Name | Description |
|---|---|
TEMPERATURES | No description. |
Classes
| Name | Description |
|---|---|
Arrhenius | k = a T^b exp(-c / T) with T in eV and k in SI. |
Constant | A rate coefficient independent of temperature, e.g. an Einstein A in s^-1. |
CrossSectionRate | A rate from a cross section averaged over a velocity distribution. |
DetailedBalance | The inverse of another reaction of the network, by detailed balance. |
Function | k(T) from a Python function of the temperature in eV (array in, array out). |
RateModel | Base class of the rate models; kind names the model in files. |
Tabulated | k(T) from a table, interpolated linearly in log k against log T. |
TEMPERATURESattributemodule attribute#
TEMPERATURES = ('electron', 'ion', 'gas', 'none')Arrheniusclassdataclass#
class Arrhenius(depends_on: str = 'electron', a: float = 0.0, b: float = 0.0, c: float = unit_field('eV', 0.0))Bases: RateModel
k = a T^b exp(-c / T) with T in eV and k in SI.
Attributes
Numerics
arrhenius
Assumptions:
- in eV, in the SI unit of the reaction’s order; is the threshold taken out before evaluation
aattributeclass attributeinstance attribute#
a: float = 0.0battributeclass attributeinstance attribute#
b: float = 0.0cattributeclass attributeinstance attribute#
c: float = unit_field('eV', 0.0)kindattributeclass attribute#
kind: str = 'arrhenius'Inherited from opencr.core.rates.RateModel
depends_onattributeclass attributeinstance attribute#
opencr.core.rates.RateModelView sourcedepends_on: str = 'electron'Constantclassdataclass#
class Constant(depends_on: str = 'none', value: float = 0.0)Bases: RateModel
A rate coefficient independent of temperature, e.g. an Einstein A in s^-1.
Attributes
| Name | Type | Description |
|---|---|---|
value | float | k in the SI unit of the reaction’s order. |
Numerics
constant
Assumptions:
- no temperature (
depends_onisnone): Einstein coefficients, wall losses, pumping
depends_onattributeclass attributeinstance attribute#
depends_on: str = 'none'kindattributeclass attribute#
kind: str = 'constant'valueattributeclass attributeinstance attribute#
value: float = 0.0CrossSectionRateclassdataclass#
class CrossSectionRate(depends_on: str = 'electron', cross_section: CrossSection | None = None, mass: float = unit_field('kg', ELECTRON_MASS), incident_mass: float | None = unit_field('kg', None))Bases: RateModel
A rate from a cross section averaged over a velocity distribution.
For electrons (depends_on="electron") the average is over the electron
energy distribution of the conditions (Maxwellian by default); otherwise over
a Maxwellian of relative velocities at the ion or gas temperature.
Attributes
| Name | Type | Description |
|---|---|---|
cross_section | CrossSection | None | The cross section (m^2) against energy (eV). |
mass | float | The reduced mass in kg of the colliding pair. |
incident_mass | float | None | For a table against the incident particle’s energy with
the target at rest (the lab frame), the incident mass in kg; the
table is looked up at E incident_mass / mass. None for a
table in the centre-of-mass frame. For electrons both agree. |
Numerics
maxwellian
lab frame
eedf
Assumptions:
- a plasmacoll
CrossSection: linear between the table points, held at the last value above, zero below the threshold - a Maxwellian of the reduced mass at , or (
depends_on); for electrons the conditions’ EEDF when it is not Maxwellian - a lab-frame table (target at rest) is read at ; a centre-of-mass table at
References:
Built from:
opencr.kinetics.rates.MaxwellianIntegralopencr.kinetics.eedf.EEDF
cross_sectionattributeclass attributeinstance attribute#
cross_section: CrossSection | None = Noneincident_massattributeclass attributeinstance attribute#
incident_mass: float | None = unit_field('kg', None)kindattributeclass attribute#
kind: str = 'cross_section'massattributeclass attributeinstance attribute#
mass: float = unit_field('kg', ELECTRON_MASS)tableproperty#
table: CrossSectionThe cross section (never None after construction).
thresholdproperty#
threshold: floatThe threshold of the cross section in eV (in its own frame).
Inherited from opencr.core.rates.RateModel
depends_onattributeclass attributeinstance attribute#
opencr.core.rates.RateModelView sourcedepends_on: str = 'electron'DetailedBalanceclassdataclass#
class DetailedBalance(depends_on: str = 'electron', forward: str = '')Bases: RateModel
The inverse of another reaction of the network, by detailed balance.
De-excitation from excitation, three-body recombination from ionization,
and any other inverse whose forward reaction has the products as
reactants and an electron on both sides or one more on the forward
product side. The evaluation (opencr.kinetics.rates) uses the
state energies and weights: the Klein-Rosseland inverse cross section for
an electron-impact excitation (valid for any energy distribution), and
the Maxwellian relation (Boltzmann, Saha) otherwise.
Attributes
| Name | Type | Description |
|---|---|---|
forward | str | The name of the forward reaction. |
Numerics
inverse
klein rosseland
Assumptions:
- the products of the weights of the forward reactants and products (), the forward energy change from the state energies
- the same number of heavy particles on both sides of the forward reaction and extra electrons among its products: Boltzmann () or Saha ()
- with a non-Maxwellian EEDF an electron-impact excitation is inverted by its Klein-Rosseland cross section; a Saha inverse uses the Maxwellian forward rate at
References:
Built from:
opencr.kinetics.rates.RateEvaluator.coefficientsopencr.kinetics.rates.inverse_cross_section
forwardattributeclass attributeinstance attribute#
forward: str = ''kindattributeclass attribute#
kind: str = 'detailed_balance'Inherited from opencr.core.rates.RateModel
depends_onattributeclass attributeinstance attribute#
opencr.core.rates.RateModelView sourcedepends_on: str = 'electron'Functionclassdataclass#
class Function(depends_on: str = 'electron', function: Callable[[np.ndarray], np.ndarray] | None = None, label: str = '', threshold: float = unit_field('eV', 0.0), file_temperatures: tuple[float, ...] = unit_field('eV', default_factory=lambda : tuple(np.geomspace(0.01, 10000.0, 241).tolist())))Bases: RateModel
k(T) from a Python function of the temperature in eV (array in, array out).
Written to files as a table on file_temperatures.
Attributes
| Name | Type | Description |
|---|---|---|
function | Callable[[np.ndarray], np.ndarray] | None | k in SI as a function of T in eV. |
label | str | What the function is, e.g. "Kramers radiative recombination". |
threshold | float | As for Tabulated, used when the function is tabulated. |
file_temperatures | tuple[float, ...] | The temperatures (eV) of the table written to files. |
Numerics
function
tabulation
Assumptions:
- is host Python code; files and the JAX backend use its table
- itself is returned, so the threshold scaling does not protect it: underflows to zero once , and so does an inverse of it
Built from:
opencr.core.rates.Tabulated
file_temperaturesattributeclass attributeinstance attribute#
file_temperatures: tuple[float, ...] = unit_field('eV', default_factory=lambda : tuple(np.geomspace(0.01, 10000.0, 241).tolist()))functionattributeclass attributeinstance attribute#
function: Callable[[np.ndarray], np.ndarray] | None = Nonekindattributeclass attribute#
kind: str = 'function'labelattributeclass attributeinstance attribute#
label: str = ''thresholdattributeclass attributeinstance attribute#
threshold: float = unit_field('eV', 0.0)tabulatemethod#
def tabulate() -> TabulatedReturn the function as a Tabulated model on file_temperatures.
to_dictmethod#
def to_dict() -> dict[str, Any]Return the function tabulated (see tabulate).
Inherited from opencr.core.rates.RateModel
depends_onattributeclass attributeinstance attribute#
opencr.core.rates.RateModelView sourcedepends_on: str = 'electron'RateModelclassdataclass#
class RateModel(depends_on: str = 'electron')Base class of the rate models; kind names the model in files.
depends_onattributeclass attributeinstance attribute#
depends_on: str = 'electron'kindattributeclass attribute#
kind: str = ''Tabulatedclassdataclass#
class Tabulated(depends_on: str = 'electron', temperatures: tuple[float, ...] = unit_field('eV', ()), values: tuple[float, ...] = (), threshold: float = unit_field('eV', 0.0))Bases: RateModel
k(T) from a table, interpolated linearly in log k against log T.
A threshold (eV) removes the Boltzmann factor before interpolating,
log(k exp(threshold / T)), which keeps the interpolation accurate at
temperatures far below a threshold. Outside the table this scaled
quantity holds its end value, so k = k_end exp(threshold / T_end - threshold / T) there.
Attributes
Numerics
interpolation
extrapolation
Order of accuracy: 2.
Assumptions:
- the order is in the table spacing in , for a smooth
- outside the table the scaled quantity holds its end value, not itself
kindattributeclass attribute#
kind: str = 'tabulated'temperaturesattributeclass attributeinstance attribute#
temperatures: tuple[float, ...] = unit_field('eV', ())thresholdattributeclass attributeinstance attribute#
threshold: float = unit_field('eV', 0.0)valuesattributeclass attributeinstance attribute#
values: tuple[float, ...] = ()Inherited from opencr.core.rates.RateModel
depends_onattributeclass attributeinstance attribute#
opencr.core.rates.RateModelView sourcedepends_on: str = 'electron'