Skip to main content

Module magic

Module magic 

Source
Expand description

MAGIC weight-window generation.

Derives MCNP weight-window lower bounds from an MCNP mesh tally:

max_val[g]  = max over all volume elements of flux[ve][g]
ww[ve][g]   = null_value                       if rel_error[ve][g] > tolerance
            = flux[ve][g] / (2 * max_val[g])   otherwise

Defaults: tolerance = 0.5, null_value = 0.0. The comparison against the tolerance is strict (>), so a cell whose error equals the tolerance keeps its scaled value.

Following the legacy mesh-tag convention, the output also carries the single maximum energy bound for total/single-bin tallies (or e_bounds[1:] for multi-group tallies) in MagicOutput::e_upper_bounds, plus the tag names the data would be stored under (ww_n, n_e_upper_bounds, …) in MagicOutput::ww_tag_name / MagicOutput::e_upper_bounds_tag_name.

If every flux feeding one energy bin is non-positive, the normalization would divide by zero; Error::ZeroMaxFlux is returned rather than emitting inf/nan.

Structs§

MagicOutput
Output of the MAGIC algorithm — the data written to mesh tags in legacy workflows.
MagicParams
MAGIC tuning parameters.

Enums§

MagicSelection
Which tally arrays feed the MAGIC algorithm.

Functions§

magic
Run MAGIC on the energy-integrated totals of a tally with default parameters (tolerance = 0.5, null_value = 0.0).
magic_with
Run MAGIC on a tally with explicit array selection and parameters.