Performance Portable Opacity and Emissivity library for simulation codes
singularity-opac provides a uniform API for all opacity models, in two forms: frequency-dependent, and frequency-averaged (Plank or Rosseland means), and separately for absorption and scattering opacities.
For frequency-dependent absorption opacities, the following functions are provided
(here,
| Function | Expression | Description | Units |
|---|---|---|---|
| AbsorptionCoefficient | Absorption coefficient | ||
| AngleAveragedAbsorptionCoefficient | Absorption coefficient averaged over solid angle | ||
| EmissivityPerNuOmega | Frequency- and angle-dependent emissivity | ||
| EmissivityPerNu | Frequency-dependent emissivity | ||
| Emissivity | Total emissivity | ||
| NumberEmissivity | Total number emissivity | ||
| ThermalDistributionOfTNu | Specific intensity of thermal distribution | ||
| DThermalDistributionOfTNuDT | Temperature derivative of specific intensity of thermal distribution | ||
| ThermalDistributionOfT | Frequency- and angle-integrated intensity of thermal distribution | ||
| ThermalNumberDistributionOfT | Frequency- and angle-integrated intensity of thermal distribution | ||
| EnergyDensityFromTemperature | Radiation energy density | ||
| TemperatureFromEnergyDensity | Radiation temperature | ||
| NumberDensityFromTemperature | Radiation number density |
with the following function signatures:
AbsorptionCoefficient(density, temperature, frequency)
AngleAveragedAbsorptionCoefficient(density, temperature, frequency)
EmissivityPerNuOmega(density, temperature, frequency)
EmissivityPerNu(density, temperature, frequency)
Emissivity(density, temperature)
NumberEmissivity(density, temperature)
ThermalDistributionOfTNu(temperature, frequency)
DThermalDistribtuionOfTNuDT(temperature, frequency)
ThermalDistributionOfT(temperature)
ThermalNumberDistributionOfT(temperature)
EnergyDensityFromTemperature(temperature)
TemperatureFromEnergyDensity(radiation energy density)
NumberDensityFromTemperature(temperature)
For mean absorption opacities, the following functions are provided.
Mean opacities compute frequency-averaged (Planck or Rosseland) absorption
coefficients over one or more energy groups. When ngroups=1 with group bounds
[0, ∞), mean opacities reduce to traditional gray opacities. For ngroups>1,
they provide multigroup radiation transport capabilities.
| Function | Expression | Description | Units |
|---|---|---|---|
| PlankMeanAbsorptionCoefficient | Planck mean absorption coefficient (gray, ngroups=1) | ||
| RosselandMeanAbsorptionCoefficient | Rosseland mean absorption coefficient (gray, ngroups=1) | ||
| PlanckGroupAbsorptionCoefficient | Planck-weighted absorption coefficient in a frequency group | ||
| RosselandGroupAbsorptionCoefficient | Rosseland-weighted absorption coefficient in a frequency group | ||
| AbsorptionCoefficient |
|
Absorption coefficient (gray or group) | |
| Emissivity | Total emissivity | ||
| GroupOfNu | Group index containing a given frequency | dimensionless | |
| PlanckGroupAbsorptionCoefficientFromNu | Planck-weighted group coefficient selected by frequency | ||
| RosselandGroupAbsorptionCoefficientFromNu | Rosseland-weighted group coefficient selected by frequency | ||
| AbsorptionCoefficientFromNu | Group coefficient selected by frequency |
with the following function signatures:
ngroups()
PlanckMeanAbsorptionCoefficient(density, temperature)
RosselandMeanAbsorptionCoefficient(density, temperature)
PlanckGroupAbsorptionCoefficient(density, temperature, group index)
RosselandGroupAbsorptionCoefficient(density, temperature, group index)
AbsorptionCoefficient(density, temperature, gmode [Planck, Rosseland])
AbsorptionCoefficient(density, temperature, group index, gmode [Planck, Rosseland])
Emissivity(density, temperature)
GroupOfNu(frequency)
PlanckGroupAbsorptionCoefficientFromNu(density, temperature, frequency)
RosselandGroupAbsorptionCoefficientFromNu(density, temperature, frequency)
AbsorptionCoefficientFromNu(density, temperature, frequency, gmode [Planck, Rosseland])
Mean absorption opacities can either be constructed from a frequency-dependent
opacity model plus user-provided group bounds, or loaded directly from
precomputed Spiner tables of group Planck and Rosseland opacities. The direct
table-backed path does not require singularity-opac to recompute opacity
integrals, but it must include explicit group bounds. Mean opacities
always carry group bounds, and the convention is half-open groups
[nu_g, nu_{g+1}), with the final upper bound included in the last group.
If you want singularity-opac to interpret a group as extending to infinity,
then the final entry of the group bounds array must literally be IEEE
positive infinity, not just a very large finite cutoff. In C++, that means
using std::numeric_limits<Real>::infinity(), while in Python that would
typically be float("inf") or numpy.inf. In an HDF/Spiner table, that same
IEEE +infinity value must appear in the final element of the "group bounds"
dataset. Likewise, a lower tail group [0, nu_1) is represented by setting
the first bound to 0.. A very large finite number is still interpreted as a
finite bound.
For frequency-dependent scattering opacities, the following functions are provided
| Function | Expression | Description | Units |
|---|---|---|---|
| TotalCrossSection | Scattering cross section | ||
| DifferentialCrossSection | Differential scattering cross section | ||
| TotalScatteringCoefficient | Scattering coefficient |
with the following function signatures:
TotalCrossSection(density, temperature, frequency)
DifferentialCrossSection(density, temperature, frequency, cos(theta))
TotalScatteringCoefficient(density, temperature, frequency)
For mean scattering opacities, the following functions are provided:
| Function | Expression | Description | Units |
|---|---|---|---|
| PlanckMeanScatteringCoefficient | Planck mean scattering coefficient | ||
| RosselandMeanScatteringCoefficient | Rosseland mean scattering coefficient |
with the following function signatures:
PlanckMeanScatteringCoefficient(density, temperature)
RosselandMeanScatteringCoefficient(density, temperature)
Note that ThermalDistributionOfTNu is the per-steradian Planck function B_\nu, so
\int B_\nu d\nu = (c / 4 \pi) a T^4, while
ThermalDistributionOfT = 4 \pi \int B_\nu d\nu = c a T^4. Therefore the
thermal radiation energy density is
u = (4 \pi / c) \int B_\nu d\nu = (1 / c) ThermalDistributionOfT = a T^4, and the
thermal radiation number density is
n = (1 / c) ThermalNumberDistributionOfT.
Opacity variant constructors are specific to the opacity model being requested; consult the source code for individual opacities.
Internally singularity-opac always uses CGS units, as in the above table. However, arbitrary units are supported through the units modifier, which accepts
function argument inputs in the arbitrary unit system, and returns the result from the function in those same arbitrary units. For example, a gray absorption opacity in non-cgs units specified by time_unit, mass_unit, length_unit, and temp_unit conversion factors from code to CGS units (e.g. mass_cgs = mass_unit * mass_code)
is created as
photons::Opacity noncgs_opacity = photons::NonCGSUnits<photons::Gray>(
photons::Gray(kappa), time_unit, mass_unit, length_unit, temp_unit);
Note that neutrino opacity functions also include electron fraction and RadiationType species arguments.
Frequency-dependent emissition and absorption functions do not currently support angle dependence.
A struct of runtime physical constants is provided for optional consistency with internal operations by the
GetRuntimePhysicalConstants() method.
At its most basic:
git clone --recursive git@github.com:lanl/singularity-opac.git
cd singularity-opac
mkdir bin
cd bin
cmake ..
makeThen, in the singularity-opac root directory:
mkdir -p bin
cd bin
cmake -DSINGULARITY_BUILD_TESTS=ON ..
make -j
make testA number of options are avaialable for compiling:
| Option | Default | Comment |
|---|---|---|
| SINGULARITY_BUILD_TESTS | OFF | Build test infrastructure. |
| SINGULARITY_USE_HDF5 | ON | Enables HDF5. Required for Spiner opacities. |
| SINGULARITY_KOKKOS_IN_TREE | OFF | Force cmake to use Kokkos source included in tree. |
© 2021-2026. Triad National Security, LLC. All rights reserved. This program was produced under U.S. Government contract 89233218CNA000001 for Los Alamos National Laboratory (LANL), which is operated by Triad National Security, LLC for the U.S. Department of Energy/National Nuclear Security Administration. All rights in the program are reserved by Triad National Security, LLC, and the U.S. Department of Energy/National Nuclear Security Administration. The Government is granted for itself and others acting on its behalf a nonexclusive, paid-up, irrevocable worldwide license in this material to reproduce, prepare derivative works, distribute copies to the public, perform publicly and display publicly, and to permit others to do so.