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, technetium). 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 aren't actually any natural isotopes for that element.
I created a custom Warning class called 'NoNaturalIsotopesWarning' so warnings can be correctly filtered by the end user instead of just calling Warnings.warn("").
I added a check here in the expand method to check the length of nuclides found and print a warning if len(natural_nuclides) == 0.
Fixes # 2926
Checklist
[X] I have performed a self-review of my own code
[X] I have followed the style guidelines for Python source files (if applicable)
[X] I have added tests that prove my fix is effective or that my feature works (if applicable)
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, technetium). 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 aren't actually any natural isotopes for that element.
I created a custom Warning class called 'NoNaturalIsotopesWarning' so warnings can be correctly filtered by the end user instead of just calling Warnings.warn("").
I added a check here in the expand method to check the length of nuclides found and print a warning if
len(natural_nuclides) == 0
.Fixes # 2926
Checklist