openmc.MGXSLibrary

class openmc.MGXSLibrary(energy_groups, num_delayed_groups=0)[source]

Multi-Group Cross Sections file used for an OpenMC simulation. Corresponds directly to the MG version of the cross_sections.xml input file.

Parameters:
Variables:
  • energy_groups (openmc.mgxs.EnergyGroups) – Energy group structure.
  • num_delayed_groups (int) – Num delayed groups
  • xsdatas (Iterable of openmc.XSdata) – Iterable of multi-Group cross section data objects
add_xsdata(xsdata)[source]

Add an XSdata entry to the file.

Parameters:xsdata (openmc.XSdata) – MGXS information to add
add_xsdatas(xsdatas)[source]

Add multiple XSdatas to the file.

Parameters:xsdatas (tuple or list of openmc.XSdata) – XSdatas to add
convert_representation(target_representation, num_polar=None, num_azimuthal=None)[source]

Produce a new XSdata object with the same data, but converted to the new representation (isotropic or angle-dependent).

This method cannot be used to change the number of polar or azimuthal bins of an XSdata object that already uses an angular representation. Finally, this method simply uses an arithmetic mean to convert from an angular to isotropic representation; no flux-weighting is applied and therefore the reaction rates will not be preserved.

Parameters:
  • target_representation ({'isotropic', 'angle'}) – Representation of the MGXS (isotropic or angle-dependent flux weighting).
  • num_polar (int, optional) – Number of equal width angular bins that the polar angular domain is subdivided into. This is required when target_representation is “angle”.
  • num_azimuthal (int, optional) – Number of equal width angular bins that the azimuthal angular domain is subdivided into. This is required when target_representation is “angle”.
Returns:

Multi-group Library with the same data as self, but represented as specified in target_representation.

Return type:

openmc.MGXSLibrary

convert_scatter_format(target_format, target_order)[source]

Produce a new MGXSLibrary object with the same data, but converted to the new scatter format and order

Parameters:
  • target_format ({'tabular', 'legendre', 'histogram'}) – Representation of the scattering angle distribution
  • target_order (int) – Either the Legendre target_order, number of bins, or number of points used to describe the angular distribution associated with each group-to-group transfer probability
Returns:

Multi-group Library with the same data as self, but with the scatter format represented as specified in target_format and target_order.

Return type:

openmc.MGXSLibrary

export_to_hdf5(filename='mgxs.h5', libver='earliest')[source]

Create an hdf5 file that can be used for a simulation.

Parameters:
  • filename (str) – Filename of file, default is mgxs.h5.
  • libver ({'earliest', 'latest'}) – Compatibility mode for the HDF5 file. ‘latest’ will produce files that are less backwards compatible but have performance benefits.
classmethod from_hdf5(filename=None)[source]

Generate an MGXS Library from an HDF5 group or file

Parameters:filename (str, optional) – Name of HDF5 file containing MGXS data. Default is None. If not provided, the value of the OPENMC_MG_CROSS_SECTIONS environmental variable will be used
Returns:Multi-group cross section data object.
Return type:openmc.MGXSLibrary
get_by_name(name)[source]

Access the XSdata objects by name

Parameters:name (str) – Name of openmc.XSdata object to obtain
Returns:result – Provides the matching XSdata object or None, if not found
Return type:openmc.XSdata or None
remove_xsdata(xsdata)[source]

Remove a xsdata from the file

Parameters:xsdata (openmc.XSdata) – XSdata to remove