pyopensn.xs.MultiGroupXS

class pyopensn.xs.MultiGroupXS

Multi-group cross section.

Wrapper of opensn::MultiGroupXS.

The Python API currently has two types of methods:

  • Creation/loading methods such as CreateSimpleOneGroup, LoadFromOpenSn, and LoadFromOpenMC populate an existing object.

  • Scale mutates the current object.

  • Combine returns a new cross-section object and does not mutate inputs.

static Combine(combinations: list[tuple[pyopensn.xs.MultiGroupXS, float]]) → pyopensn.xs.MultiGroupXS

Return a new combined cross-section.

Parameters:

combinations (List[Tuple[pyopensn.xs.MultiGroupXS, float]]) – List of (cross_section, density) pairs. The density values are linear weights used to combine raw cross sections.

Returns:

A new combined cross-section object. The input cross sections are not modified.

Return type:

pyopensn.xs.MultiGroupXS

Notes

Let \(d_i\) be the supplied density for cross section \(i\).

  • Raw XS terms are density-weighted sums: \(\sigma = \sum_i d_i \sigma_i\) (e.g. total, absorption, fission, transfer, production).

  • Named custom 1D XS are preserved and combined with the same density weighting.

  • Fission spectra and precursor yields are weighted by fissile density fraction so their sums remain normalized.

  • All inputs must have the same number of groups. Inputs may omit energy bounds; all supplied bounds must match per group, and the result keeps them.

  • CEPXS stopping power and energy-deposition responses are density-weighted along with the other cross sections. Particle-species energy bounds are preserved.

  • If inverse velocity is present, all inputs must have identical values.

Examples

>>> xs_1 = MultiGroupXS()
>>> xs_1.CreateSimpleOneGroup(sigma_t=1, c=0.5)
>>> xs_2 = MultiGroupXS()
>>> xs_2.CreateSimpleOneGroup(sigma_t=2, c=1./3.)
>>> combo = [
...     ( xs_1, 0.5 ),
...     ( xs_2, 3.0 )
... ]
>>> xs_combined = MultiGroupXS.Combine(combo)
CreateSimpleOneGroup(self: pyopensn.xs.MultiGroupXS, sigma_t: float, c: float, velocity: float = 0.0) → None

Populate this object with a one-group cross section.

Parameters:
  • sigma_t (float) – Total cross section.

  • c (float) – Scattering ratio.

  • velocity (float, optional) – Group velocity. If provided and positive, inverse velocity is populated with 1.0/velocity.

Notes

This method mutates self by replacing its current contents.

GetScaleFactor(self: pyopensn.xs.MultiGroupXS) → float

Get the scaling factor.

LoadFromCEPXS(self: pyopensn.xs.MultiGroupXS, file_name: str, material_id: int = 0, csda_format: bool = False, particle_order: list[str] = []) → None

Load multi-group cross sections from a CEPXS-BFP binary cross-section file.

Parameters:
  • file_name (str) – CEPXS-BFP Fortran-record binary library to load.

  • material_id (int, default=0) – Material id to load from the CEPXS library.

  • csda_format (bool, default=False) – Interpret the CEPXS rows using OpenSn’s CSDA charged-particle convention. This also imports stopping power. Both formats import energy deposition and the custom 1D XS charge_deposition used by the csda_charge_deposition field function.

  • particle_order (List[str], default=[]) – Particle species for each energy block in BXSLIB order. Valid entries are "photon", "electron", and "positron". OpenSn obtains block sizes from the energy resets in the file and supports at most one block of each type. For a single-block CSDA library, a block with nonzero stopping power is inferred as electrons. A single block with zero stopping power remains unknown so that void materials can inherit the problem species. Multi-block CSDA libraries require this argument.

Notes

Use csda_format=True together with DiscreteOrdinatesProblem(..., options={"csda_enabled": True}) for CSDA charged-particle transport.

CSDA libraries are not standard CEPXS output. Generating them requires a modified version of CEPXS; contact the OpenSn developers for more information.

This method mutates self by replacing its current contents.

LoadFromOpenMC(self: pyopensn.xs.MultiGroupXS, file_name: str, dataset_name: str, temperature: float, extra_xs_names: list[str] = []) → None

Load multi-group cross sections from an OpenMC cross-section file into this object.

Notes

This method mutates self by replacing its current contents.

LoadFromOpenSn(self: pyopensn.xs.MultiGroupXS, file_name: str) → None

Load multi-group cross sections from an OpenSn cross section input file into this object.

Format is as follows (for transfers, gprime denotes the departing group and g is the arrival group).

# Add comment lines, as needed
NUM_GROUPS ng
NUM_MOMENTS nmom

SIGMA_T_BEGIN
0 value
.
.
ng-1 value
SIGMA_T_END

SIGMA_A_BEGIN
0 value
.
.
ng-1 value
SIGMA_A_END

TRANSFER_MOMENTS_BEGIN
M_GFROM_GTO_VAL 0 0 0 value
.
M_GFROM_GTO_VAL moment gfrom gto value
.
M_GFROM_GTO_VAL nmom-1 ng-1 ng-1 value
TRANSFER_MOMENTS_END

Notes

This method mutates self by replacing its current contents.

Scale(self: pyopensn.xs.MultiGroupXS, factor: float) → None

Scale the cross sections in-place.

Notes

Scaling does not compound. Each call scales from the original baseline data. Named custom 1D XS are scaled along with the standard 1D cross-section data. CEPXS stopping power and energy-deposition responses are also scaled; energy-group bounds are unchanged.

__init__(self: pyopensn.xs.MultiGroupXS) → None

Create an empty multi-group cross section.

property chi

Get neutron fission spectrum.

custom_xs_names(self: pyopensn.xs.MultiGroupXS) → list[str]

Get a list of custom XS entries.

property energy_deposition

Get energy deposition cross section.

get_custom_xs(self: pyopensn.xs.MultiGroupXS, name: str) → memoryview

Get a custom XS vector.

has_custom_xs(self: pyopensn.xs.MultiGroupXS, name: str) → bool

Check if a custom XS is available.

property inv_velocity

Get inverse velocity.

property is_fissionable

Check if the material is fissile.

property nu_delayed_sigma_f

Get delayed neutron production due to fission.

property nu_prompt_sigma_f

Get prompt neutron production due to fission.

property nu_sigma_f

Get neutron production due to fission.

property num_groups

Get number of energy groups.

property num_precursors

Get number of precursors.

property scattering_order

Get Legendre scattering order.

property sigma_a

Get absorption cross section.

property sigma_f

Get fission cross section.

property sigma_t

Get total cross section.