opencr.tables
Effective-rate tables for the codes that use OpenCR’s results.
effective_rate_table solves a model on a grid of electron
temperature and density and stores named quantities
(opencr.analysis.quantities: effective rates, population and electron
cooling coefficients, line emissivities) as an xarray dataset with the
model’s provenance; EffectiveRateTable interpolates such a table,
bilinearly in ln q against ln T_e and ln n_e (end values outside),
and writes and reads it as netCDF. carafe, beamtracer and freeofcharge
take their effective rates from these tables in place of fits.
Classes
| Name | Description |
|---|---|
EffectiveRateTable | A table of quantities against T_e and n_e, interpolated in log space. |
Functions
| Name | Description |
|---|---|
effective_rate_table | Solve model on a grid of T_e (eV) and n_e (m^-3) and tabulate outputs. |
EffectiveRateTableclass#
class EffectiveRateTable(dataset: xr.Dataset)A table of quantities against T_e and n_e, interpolated in log space.
Parameters
| Name | Type | Description |
|---|---|---|
dataset | xr.Dataset | A dataset as effective_rate_table makes it. |
Numerics
bilinear
coordinates
Order of accuracy: 2.
Assumptions:
- end values outside the table ( and clipped)
- a quantity with zero or negative values (an effective loss rate, a cooling with recombination) is interpolated in instead of
- the order is in the table spacing in and
from_netcdfmethodclassmethod#
def from_netcdf(path: str | Path) -> EffectiveRateTableRead a table written by to_netcdf.
functionmethod#
def function(name: str, electron_density: float)Return T_e -> quantity at a fixed n_e, for codes whose rates depend on T_e only.
to_netcdfmethod#
def to_netcdf(path: str | Path) -> PathWrite the table to path (netCDF) and return the path.
effective_rate_tablefunction#
def effective_rate_table(model: Model, conditions: Conditions, outputs: Sequence[str], temperatures: Sequence[float] = tuple(np.geomspace(0.5, 100.0, 25)), densities: Sequence[float] = tuple(np.geomspace(1e+16, 1e+21, 11)), mode: str = 'quasi-static') -> EffectiveRateTableSolve model on a grid of T_e (eV) and n_e (m^-3) and tabulate outputs.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
model | Model | required | The model. |
conditions | Conditions | required | The conditions with the driver densities (the quasi-static quantities per driver do not depend on them for a linear network). |
outputs | Sequence[str] | required | The quantities. |
temperatures | Sequence[float] | tuple(np.geomspace(0.5, 100.0, 25)) | The electron temperatures in eV (or quantities), increasing. |
densities | Sequence[float] | tuple(np.geomspace(1e+16, 1e+21, 11)) | The electron densities in m^-3 (or quantities), increasing. |
mode | str | 'quasi-static' | The steady-state mode. |