# openmc.WeightWindows¶

class openmc.WeightWindows(mesh, lower_ww_bounds, upper_ww_bounds=None, upper_bound_ratio=None, energy_bounds=None, particle_type='neutron', survival_ratio=3, max_lower_bound_ratio=None, max_split=10, weight_cutoff=1e-38, id=None)[source]

Mesh-based weight windows

This class enables you to specify weight window parameters that are used in a simulation. Multiple sets of weight windows can be defined for different meshes and different particles. An iterable of WeightWindows instances can be assigned to the openmc.Settings.weight_windows attribute, which is then exported to XML.

Weight window lower/upper bounds are to be specified for each combination of a mesh element and an energy bin. Thus the total number of bounds should be equal to the product of the number of mesh bins and the number of energy bins.

New in version 0.13.

Parameters
• mesh (openmc.MeshBase) – Mesh for the weight windows

• lower_ww_bounds (Iterable of Real) – A list of values for which each value is the lower bound of a weight window

• upper_ww_bounds (Iterable of Real) – A list of values for which each value is the upper bound of a weight window

• upper_bound_ratio (float) – Ratio of the lower to upper weight window bounds

• energy_bounds (Iterable of Real) – A list of values for which each successive pair constitutes a range of energies in [eV] for a single bin

• particle_type ({'neutron', 'photon'}) – Particle type the weight windows apply to

• survival_ratio (float) – Ratio of the survival weight to the lower weight window bound for rouletting

• max_lower_bound_ratio (float) – Maximum allowed ratio of a particle’s weight to the weight window’s lower bound. A factor will be applied to raise the weight window to be lower than the particle’s weight by a factor of max_lower_bound_ratio during transport if exceeded.

• max_split (int) – Maximum allowable number of particles when splitting

• weight_cutoff (float) – Threshold below which particles will be terminated

• id (int) – Unique identifier for the weight window settings. If not specified, an identifier will automatically be assigned.

Variables
• id (int) – Unique identifier for the weight window settings.

• mesh (openmc.MeshBase) – Mesh for the weight windows with dimension (ni, nj, nk)

• particle_type (str) – Particle type the weight windows apply to

• energy_bounds (Iterable of Real) – A list of values for which each successive pair constitutes a range of energies in [eV] for a single bin

• num_energy_bins (int) – Number of energy bins

• lower_ww_bounds (numpy.ndarray of float) – An array of values for which each value is the lower bound of a weight window. Shape: (ni, nj, nk, num_energy_bins) for StructuredMesh; (num_elements, num_energy_bins) for UnstructuredMesh

• upper_ww_bounds (numpy.ndarray of float) – An array of values for which each value is the upper bound of a weight window. Shape: (ni, nj, nk, num_energy_bins) for StructuredMesh; (num_elements, num_energy_bins) for UnstructuredMesh

• survival_ratio (float) – Ratio of the survival weight to the lower weight window bound for rouletting

• max_lower_bound_ratio (float) – Maximum allowed ratio of a particle’s weight to the weight window’s lower bound. (Default: 1.0)

• max_split (int) – Maximum allowable number of particles when splitting

• weight_cutoff (float) – Threshold below which particles will be terminated

classmethod from_hdf5(group, meshes)[source]

Create weight windows from HDF5 group

Parameters
• group (h5py.Group) – Group in HDF5 file

• meshes (dict) – Dictionary mapping IDs to mesh objects

Returns

A weight window object

Return type

openmc.WeightWindows

classmethod from_xml_element(elem, root)[source]

Generate weight window settings from an XML element

Parameters
Returns

Weight windows object

Return type

openmc.WeightWindows

to_xml_element()[source]

Return an XML representation of the weight window settings

Returns

element – XML element containing the weight window information

Return type

xml.etree.ElementTree.Element