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

makeReactionRateTable is inefficient and poorly named #1591

Open
keckler opened this issue Jan 22, 2024 · 1 comment
Open

makeReactionRateTable is inefficient and poorly named #1591

keckler opened this issue Jan 22, 2024 · 1 comment
Labels
cleanup Code/comment cleanup: Low Priority enhancement New feature or request

Comments

@keckler
Copy link
Member

keckler commented Jan 22, 2024

def makeReactionRateTable(obj, nuclides: List = None):
"""
Generate a reaction rate table for given nuclides.
Often useful in support of depletion.
.. impl:: Generate cross section table.
:id: I_ARMI_DEPL_TABLES1
:implements: R_ARMI_DEPL_TABLES
Parameters
----------
nuclides : list, optional
list of nuclide names for which to generate the cross-section table.
If absent, use all nuclides obtained by self.getNuclides().
Notes
-----
This also used to do some caching on the block level but that has been removed
and the calls to this may therefore need to be re-optimized.
See Also
--------
armi.physics.neutronics.isotopicDepletion.isotopicDepletionInterface.CrossSectionTable
"""

This function has a couple of issues.

The first is its name. The logic in this function is pretty confusing, IMO, but to my understanding it does NOT make a table of reaction rates. It makes a table of 1-group macroscopic cross sections. So the name seems confusing and/or wrong. Please, somebody correct me if I'm wrong here, because tracing this method up the tree was pretty confusing.

The second issue is the inefficiency. For n nuclides in c children of the composite (likely a block) that is passed in, this method will find the core via getAncestorWithFlags n*c times, get the XSID of the via calls to getAncestor().getMicroSuffix() block n*c times, and get the integrated MG flux via calls to getIntegratedMgFlux n*c + 1 times. Each of those operations only need to be called once for a given block. They are being done many extra times because makeReactionRateTable uses getReactionRates to do the work, but getReactionRates uses a helper method which makes all of the aforementioned duplicate calls.

This code was touched during #911 , but it appears that the mentioned inefficiencies were already in place before that, so this has been around for a while.

Kinda-not-really related to #813

@john-science john-science added enhancement New feature or request cleanup Code/comment cleanup: Low Priority labels Jan 23, 2024
@john-science
Copy link
Member

I am hoping the isotopicDepletion module will be moved out of ARMI "soon", but if not, this function could certainly use some TLC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Code/comment cleanup: Low Priority enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants