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

Add New Component Axial Linking Approach #1376

Draft
wants to merge 29 commits into
base: main
Choose a base branch
from

Conversation

albeanth
Copy link
Member

@albeanth albeanth commented Aug 7, 2023

What is the change?

Closes #769. A request was made to improve the axial linking logic to take advantage of the block grids system in ARMI. This PR aims to accomplish that. While previous behavior is maintained, there are several changes:

  1. AssemblyAxialLinkage::_getLinkedComponents now allows for multiple component axial linkage. Any components with multiple linkages are resolved in AxialExpansionChanger::retrieveLinkedComponent.
  2. AxialExpansionChanger::retrieveLinkedComponent accounts for 3 cases to try and resolve the multiple axial linkage. See test_axialExpansionChanger.py::TestRetriveAxialLinkage for details.
  3. Tests have been added and modified to account for new grid block behavior.
    i. A block grid was added to armi/tests/detailedAxialExpansion/refSmallCoreGrid.yaml
    ii. Additional complexity was added to the simple assembly defined in test_blockBlueprints.py.

Why is the change being made?

To support a user request for downstream analyses.


Checklist

  • This PR has only one purpose or idea.
  • Tests have been added/updated to verify that the new/changed code works.
  • The code style follows good practices.
  • The commit message(s) follow good practices. Keckler let me know that commit history isn't important, so the world gets the working branch!

Now need to do something with them....
- axial exp changer starting to account for block grids.
- works when lattices have different numbers of pins.
- need to change for case when pins are the same number in the grid (this should generate linking problems)
- still requires all pinned blocks to have the same number of pin groupings
- but can now use the spatial locators of components to resolve multiple axial linkage
- uses a smarter grid-based approach. Score!
- needs cleanup + unit testing
- also make it a class method to include self.a (instead of parent.parent....)
- during axial expansion choose the component which will be used for expansion.
- all tests pass. Need to add aditional testing for coverage, improve docstrings, and see if logic optimization is available
- add testing to cover complexities
@albeanth albeanth requested a review from keckler August 7, 2023 22:55
@albeanth albeanth changed the title Add new comp axial link mthd Add New Component Axial Linking Approach Aug 7, 2023
Copy link
Member

@keckler keckler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks very good. I like that your new test provides a good blueprint for somebody to implement this in their model.

I think the only thing that requires real attention is that I think the logic no longer tests if the components are solids. It'd be great if you could check on that.


Notes
-----
3 cases are considered, see test_axialExpansionChanger.py::TestRetriveAxialLinkage for details.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it could be more helpful to the user if this were reversed, i.e. put the description in this docstring and then reference it from the test docstring. People rarely look at docstrings for tests, so having the bulk of the description here instead seems to make more sense.

Comment on lines +342 to +346
maxCompZtop = 0.0
for otherC in linkedComponents:
if otherC.ztop > maxCompZtop:
linked = otherC
maxCompZtop = otherC.ztop
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
maxCompZtop = 0.0
for otherC in linkedComponents:
if otherC.ztop > maxCompZtop:
linked = otherC
maxCompZtop = otherC.ztop
linked = max(linkedComponents, key=lambda c: c.ztop)

I think that accomplishes the same thing you're doing here.

self.linkedComponents[c] = lstLinkedC

if lstLinkedC[0] is None:
if AssemblyAxialLinkage._determineLinked(c, otherC):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Genuinely curious -- is there a strong benefit to using AssemblyAxialLinkage._determineLinked() as compared to self._determineLinked() here?

component to compare and see if is linked to componentA
Notes
-----
If componentA and componentB are both solids and the same type, geometric overlap can be checked via
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think your change lost the check on whether the components are solids or not. Am I wrong about that?

Comment on lines +579 to +580
# check for common indices between components. If either component has indices within its counterpart,
# then they are candidates to be linked and overlap should be checked.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just thinking out loud here... It seems like this logic will not allow for partial-length fuel rods, if I'm reading it correctly. That's not an issue for me right now, but just trying to consider common cases (partial-length rods are common in BWRs).

@@ -19,3 +19,26 @@ core:
IC IC MC OC
AF IC IC PC SH
symmetry: third periodic

fourPin:
# geom: hex
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# geom: hex

@keckler
Copy link
Member

keckler commented Oct 9, 2023

I pushed some changes to this branch so that the axial expansion changer can properly handle blocks that don't have any solid components. This was leading to issues with assemblies accidentally changing overall height, which is not supposed to happen (the DUMMY block is supposed to compress to allow for the overall assembly height to remain unchanged).

I also added a test on this fix.

@keckler
Copy link
Member

keckler commented Oct 9, 2023

I do not know why this branch is now seeing some test failures in the bookkeeping module. I do not see any errors when I run those tests locally with 3.9, and I did not make any changes related to the bookkeeping module.

@keckler
Copy link
Member

keckler commented Oct 10, 2023

Okay, after some offline discussion with @albeanth , the changes that I mentioned in the comment above have been rolled back. Instead of trying to handle them, we are explicitly going to block users from having blocks in their assemblies that don't have any solid components in them. In such scenarios, it is unclear how the axial expansion should be performed and so we just disallow it. The exceptions to this are:

  1. The dummy block
  2. An assembly with no solid components at all is allowed.

I added the appropriate logic and an associated test.

if len(solidCompsInBlock) == 0:
raise InputError(
f"Assembly {self.linked.a} is constructed improperly for use with the axial expansion changer.\n"
"Consider using the assemFlagsToSkipAxialExpansion case setting."
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's give a little more detail so users don't have to dig into the source code. E.g. "...is constructed improperly for use with the axial expansion changer; i.e., assemblies cannot have intermediate blocks void of a solid component. Consider using....

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well ideally there would be some documentation that outlines how to use the axial expansion capability ;-)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hah! Yeah yeah.... very true....

@albeanth albeanth mentioned this pull request Oct 18, 2023
8 tasks
@albeanth
Copy link
Member Author

@keckler a subtle hint hint you want this sooner than later, eh? 😄

@keckler
Copy link
Member

keckler commented Feb 25, 2024

I can't run my model without this branch, so at the very least I needed to get the merge conflicts resolved. But yes, sooner is better!

@albeanth
Copy link
Member Author

I will carve some out time this week to restart this effort. I know John would like to see this PR gone too!

@albeanth
Copy link
Member Author

Note to self: check in on BOL parameters on fuel. They're currently at the block-level and this change may break the validity of those parameters. They may need to get shifted to the components.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Resolving axial component linkages for blocks with multiple identical component definitions
2 participants