Skip to content
Projects

opencr.analysis.results

The result of a steady-state solve, and what can be read from it.

A Result keeps the model, the conditions, the rate coefficients, the population equations and the densities of every state, with the solver’s report. From it: the reaction fluxes and the dominant gains and losses of a state, the lines and their photon emissivity coefficients, a synthetic spectrum, and everything as an xarray dataset (Result.to_dataset) or a NetCDF file with the model’s manifest (Result.export).

Classes

NameDescription
ResultA steady state.

Resultclass#

class Result(model: Model, conditions: Conditions, rates: np.ndarray, system: PopulationSystem, evolving: np.ndarray, report: SolverReport)

A steady state.

Attributes

NameDescription
modelThe model solved.
conditionsThe conditions.
ratesThe rate coefficient of every reaction (SI), in network order.
systemThe population equations.
evolvingThe steady densities of the evolving states (m^-3).
reportThe solver’s report.

conditionsattributeinstance attribute#

conditions = conditions

evolvingattributeinstance attribute#

evolving = np.asarray(evolving, dtype=float)

modelattributeinstance attribute#

model = model

ratesattributeinstance attribute#

rates = rates

reportattributeinstance attribute#

report = report

systemattributeinstance attribute#

system = system

electron_densityproperty#

electron_density: float

n_e in m^-3.

fluxespropertycached#

fluxes: dict[str, float]

The rate of every reaction in m^-3 s^-1, by name.

modeproperty#

mode: str

The solve: "quasi-static" or "full".

populationspropertycached#

populations: dict[str, float]

The density of every state in m^-3, by name, in network order.

reductionpropertycached#

reduction: QuasiStatic

The quasi-static reduction at these conditions (population and effective coefficients).

dominant_processesmethod#

def dominant_processes(state: str, number: int = 5) -> list[dict[str, Any]]

Return the largest gains and losses of state.

Each entry has the reaction name, its equation, the rate of change of the state (m^-3 s^-1; negative for a loss) and its fraction of the state’s total gain or total loss. Sorted by |rate|.

emissionmethod#

def emission(air: bool = False) -> xr.Dataset

Return the lines: wavelength, emissivity and power (line_table).

emission_spectrummethod#

def emission_spectrum(wavelength: np.ndarray | None = None, fwhm: float = 0.0, air: bool = False, quantity: str = 'power') -> xr.DataArray

Return a synthetic spectrum: the lines Doppler broadened at the gas temperature.

Parameters

NameTypeDefaultDescription
wavelengthnp.ndarray | NoneNoneThe grid in nm; by default 2000 points around the visible lines (350-700 nm).
fwhmfloat0.0An instrumental FWHM in nm, added in quadrature.
airboolFalseWavelengths in air.
quantitystr'power'"power" or "emissivity".

exportmethod#

def export(path: str | Path) -> Path

Write to_dataset to a NetCDF file and return its path.

photon_emissivity_coefficientsmethod#

def photon_emissivity_coefficients() -> xr.DataArray

Return PEC_d of every line per driver in m^3/s (quasi-static only).

emissivity = n_e sum_d PEC_d n_d; for atomic hydrogen the H(n=1) part is the excitation component and the H+ part the recombination one.

Numerics

pec

PECd=g Aul Cudne[m3/s],ϵ=ne∑dPECd nd\mathrm{PEC}_d = \frac{g\, A_{ul}\, C_{ud}}{n_e} \quad [\mathrm{m^3/s}], \qquad \epsilon = n_e \sum_d \mathrm{PEC}_d\, n_d

Assumptions:

  • a quasi-static solve: nu=∑dCudndn_u = \sum_d C_{ud} n_d; zero for a line whose upper state is a driver
  • for atomic hydrogen the H(n=1) part is the excitation component, the H+^+ part the recombination one

References:

Built from:

  • opencr.kinetics.effective.quasi_static
  • opencr.analysis.emission.line_table

populationmethod#

def population(state: str) -> float

Return the density of state in m^-3.

to_datasetmethod#

def to_dataset() -> xr.Dataset

Return the populations, rates, fluxes and lines as one xarray dataset.

The conditions, the solver report and the model’s manifest are in the attributes, as JSON.