openmc icon indicating copy to clipboard operation
openmc copied to clipboard

convert_to_multigroup to accept numbers for groups

Open jon-proximafusion opened this issue 5 months ago • 1 comments

Description

currently the model.convert_to_multigroup accepts an arguement for groups

It accepts strings and makes use of pre defined group structures. It defaults to use CASMO-2

I was wondering if we could also allow a list of numerical values directly?

I typically want to put a single bin ([0.0, 100e6]) in and there is not a predefined group structure for a single bin.

current

model.convert_to_multigroup(
        method="stochastic_slab",
        nparticles=10000,
        groups="CASMO-2",  # this is the default but can be changed to any other group structure
)

proposed option

model.convert_to_multigroup(
        method="stochastic_slab",
        nparticles=10000,
        groups=[0, 100e6]
)

Let me know if this would be an acceptable change

Alternatives

Keeping the code as it and perhaps add a single bin group structure.

Compatibility

It can continue to work in the same way and have the same default

jon-proximafusion avatar Aug 07 '25 12:08 jon-proximafusion

I think it currently accepts either a string to use a predefined group structure, or a openmc.mgxs.EnergyGroups object for that argument. The latter could be initialized with an arbitrary group structure I believe - though let me know if that's not the case!

jtramm avatar Aug 07 '25 17:08 jtramm