Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix out of date assumption on AZS IDs for "natural nuclides" #2049

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

albeanth
Copy link
Member

@albeanth albeanth commented Jan 9, 2025

What is the change?

An error was found in a downstream ARMI application that I believe originates in the "byAAAZZZSId" nuclides listing within ARMI.

  1. When ARMI is initialized, the full list of known isotopes to ARMI, as well as fictitious dummy and lumped fission product "nuclides", are added here.
    def factory():
    """
    Reads data files to instantiate the :py:class:`INuclides <INuclide>`.
    Reads NIST, MC**2 and burn chain data files to instantiate the :py:class:`INuclides <INuclide>`.
    Also clears and fills in the
    :py:data:`~armi.nucDirectory.nuclideBases.instances`,
    :py:data:`byName`, :py:attr:`byLabel`, :py:data:`byMcc3IdEndfbVII0`, and
    :py:data:`byMcc3IdEndfbVII1` module attributes. This method is automatically run upon
    loading the module, hence it is not usually necessary to re-run it unless there is a
    change to the data files, which should not happen during run time, or a *bad*
    :py:class`INuclide` is created.
    Notes
    -----
    This cannot be run more than once. NuclideBase instances are used throughout the ARMI
    ecosystem and are even class attributes in some cases. Re-instantiating them would orphan
    any existing ones and break everything.
    """
    if len(instances) != 0:
    raise RuntimeError(
    "Nuclides are already initialized and cannot be re-initialized unless "
    "`nuclideBases.destroyGlobalNuclides` is called first."
    )
    addNuclideBases()
    __addNaturalNuclideBases()
    __addDummyNuclideBases()
    __addLumpedFissionProductNuclideBases()
  2. The real and "natural" nuclides are populated into byMcnpId and byAAAZZZSId here.
    byMcnpId[nuclide.getMcnpId()] = nuclide
    byAAAZZZSId[nuclide.getAAAZZZSId()] = nuclide
  3. The real nuclides are populated correctly. However, the AZS IDs for natural nuclides are not populated correctly for Carbon and Vanadium as the assumptions made in here are invalid for ENDF VII.1 (per @aaronjamesreynolds).
    def getAAAZZZSId(self):
    """Gets the AAAZZZS ID for a few elements.
    Notes
    -----
    the natural nuclides 'C' and 'V' do not have isotopic nuclide data for MC2 so sometimes they tag along in the
    list of active nuclides. This method is designed to fail in the same as if there was not getAAAZZZSId method
    defined.
    """
    if self.element.symbol == "C":
    return "120060"
    elif self.element.symbol == "V":
    return "510230"
    else:
    return None
    .
  4. This assumption leads to the following snippet returning the wrong thing:
import armi
from armi.nucDirectory.nuclideBases import byAAAZZZSId
if __name__ == "__main__":
    armi.configure()
    byAAAZZZSId("120060") # should return C12, however it returns "natural" C
    byAAAZZZDIs("510230") # should return V51, however it returns "natural" V

Why is the change being made?

Being able to retrieve isotopic information for C12 and V51 is important.


Checklist

  • The release notes have been updated if necessary.
  • The documentation is still up-to-date in the doc folder.
  • The dependencies are still up-to-date in pyproject.toml.

do not create AZS IDs for "natural isotopes" nor ficticious lumped or dummy isotopes
@albeanth albeanth added the bug Something is wrong: Highest Priority label Jan 9, 2025
@albeanth albeanth requested a review from john-science January 9, 2025 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is wrong: Highest Priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant