Closed aprilnovak closed 1 week ago
Perhaps we could add to the element.expand
method that is called by material.add_element
. We could add a check here in the expand method to check the length of isotopes found and print a warning if len(isotopes) == 0
perhaps something like
warnings.warn(f'No naturally occurring nuclides were found for element {self.name}')
Is this issue still open? I'd love to attempt to tackle it.
I think the issue is all yours @cxtherineyu thanks for volunteering
My quick two cents. A custom Warning class should be defined so warnings can be correctly filtered by the end user instead of just calling Warnings.warn("")
. I think maybe something like: NoNaturalIsotopesWarning
Description
When adding nuclides to a material with
add_element
, OpenMC will silently do nothing if there are no natural nuclides of that element (e.g., plutonium). It would be nice if the user encountered a warning about this, because if the user was trying to do this in the first place they did not realize/recognize that there weren't actually any natural isotopes for that element.Alternatives
Print a warning if
add_element
does not add any nuclides.Compatibility
New feature, better user experience.