openmc.mgxs.EnergyGroups

class openmc.mgxs.EnergyGroups(group_edges)[source]

An energy group structure used for multigroup cross-sections.

Parameters

group_edges (Iterable of float or str) –

The energy group boundaries in [eV] or the name of the group structure (Must be a valid key in the openmc.mgxs.GROUP_STRUCTURES dictionary).

Changed in version 0.14.0: Changed to allow a string specifying the group structure name.

Variables
  • group_edges (np.ndarray) – The energy group boundaries in [eV]

  • num_groups (int) – The number of energy groups

can_merge(other)[source]

Determine if energy groups can be merged with another.

Parameters

other (openmc.mgxs.EnergyGroups) – EnergyGroups to compare with

Returns

Whether the energy groups can be merged

Return type

bool

get_condensed_groups(coarse_groups)[source]

Return a coarsened version of this EnergyGroups object.

This method merges together energy groups in this object into wider energy groups as defined by the list of groups specified by the user, and returns a new, coarse EnergyGroups object.

Parameters

coarse_groups (Iterable of 2-tuple) – The energy groups of interest - a list of 2-tuples, each directly corresponding to one of the new coarse groups. The values in the 2-tuples are upper/lower energy groups used to construct a new coarse group. For example, if [(1,2), (3,4)] was used as the coarse groups, fine groups 1 and 2 would be merged into coarse group 1 while fine groups 3 and 4 would be merged into coarse group 2.

Returns

A coarsened version of this EnergyGroups object.

Return type

openmc.mgxs.EnergyGroups

Raises

ValueError – If the group edges have not yet been set.

get_group(energy)[source]

Returns the energy group in which the given energy resides.

Parameters

energy (float) – The energy of interest in eV

Returns

The energy group index, starting at 1 for the highest energies

Return type

Integral

Raises

ValueError – If the group edges have not yet been set.

get_group_bounds(group)[source]

Returns the energy boundaries for the energy group of interest.

Parameters

group (int) – The energy group index, starting at 1 for the highest energies

Returns

The low and high energy bounds for the group in eV

Return type

2-tuple

Raises

ValueError – If the group edges have not yet been set.

get_group_indices(groups='all')[source]

Returns the array indices for one or more energy groups.

Parameters

groups (str, tuple) – The energy groups of interest - a tuple of the energy group indices, starting at 1 for the highest energies (default is ‘all’)

Returns

The ndarray array indices for each energy group of interest

Return type

numpy.ndarray

Raises

ValueError – If the group edges have not yet been set, or if a group is requested that is outside the bounds of the number of energy groups.

merge(other)[source]

Merge this energy groups with another.

Parameters

other (openmc.mgxs.EnergyGroups) – EnergyGroups to merge with

Returns

merged_groups – EnergyGroups resulting from the merge

Return type

openmc.mgxs.EnergyGroups