Skip to content

Commit c44d2f0

Browse files
chris-asheshimwellpaulromano
authored
Allow groups to be passed as sequence of floats in convert_to_multigroup (#3873)
Co-authored-by: Jonathan Shimwell <drshimwell@gmail.com> Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
1 parent 27522fe commit c44d2f0

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

openmc/model/model.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2520,7 +2520,7 @@ def _generate_material_wise_mgxs(
25202520
def convert_to_multigroup(
25212521
self,
25222522
method: str = "material_wise",
2523-
groups: str = "CASMO-2",
2523+
groups: str | Sequence[float] | openmc.mgxs.EnergyGroups = "CASMO-2",
25242524
nparticles: int = 2000,
25252525
overwrite_mgxs_library: bool = False,
25262526
mgxs_path: PathLike = "mgxs.h5",
@@ -2538,9 +2538,13 @@ def convert_to_multigroup(
25382538
----------
25392539
method : {"material_wise", "stochastic_slab", "infinite_medium"}, optional
25402540
Method to generate the MGXS.
2541-
groups : openmc.mgxs.EnergyGroups or str, optional
2542-
Energy group structure for the MGXS or the name of the group
2543-
structure (based on keys from openmc.mgxs.GROUP_STRUCTURES).
2541+
groups : openmc.mgxs.EnergyGroups, str, or sequence of float, optional
2542+
Energy group structure for the MGXS. Can be an
2543+
:class:`openmc.mgxs.EnergyGroups` object, a string name of a
2544+
predefined group structure from :data:`openmc.mgxs.GROUP_STRUCTURES`
2545+
(e.g., ``"CASMO-2"``), or a sequence of floats specifying energy
2546+
bin boundaries in eV (e.g., ``[0.0, 1e6]`` for a single group).
2547+
Defaults to ``"CASMO-2"``.
25442548
nparticles : int, optional
25452549
Number of particles to simulate per batch when generating MGXS.
25462550
overwrite_mgxs_library : bool, optional
@@ -2577,7 +2581,7 @@ def convert_to_multigroup(
25772581
Valid entries for temperature_settings are the same as the valid
25782582
entries in openmc.Settings.temperature_settings.
25792583
"""
2580-
if isinstance(groups, str):
2584+
if not isinstance(groups, openmc.mgxs.EnergyGroups):
25812585
groups = openmc.mgxs.EnergyGroups(groups)
25822586

25832587
# Do all work (including MGXS generation) in a temporary directory

0 commit comments

Comments
 (0)