-
Notifications
You must be signed in to change notification settings - Fork 90
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
Extending axial expansion classes #1920
Conversation
Use early `return` statements to dedent the function. Renamed to `areAxiallyLinked` to be a bit more declarative, even though this function lives in the axial expansion routine. Add some type hints
The values in the linkage dictionaries on `AssemblyAxialLinkage` were lists of two items where the position meant something: `0` for linked item below the current thing, and `1` for linked item above the current thing. Some functionality was based on `links[1] is not None` which is not super readable unless you're familiar with what's going on. This introduces a small data class with two attributes: `lower` and `upper` such that `links.lower is links[0]` and `links.upper is links[1]`. This improves readability and extensibility by making a more explicit and declarative thing. The position-based getters and setters are retained and tested. The class is "templated" with a `typing.Generic[typing.TypeVar]` that could be either `Block` or `Component`. This is because the the two linked dictionaries on the `AssemblyAxialLinkage` class only differ based on the types of their values. We still need to know lower/upper as determined by the values, but for the block link dict we want blocks and then components from the component link dict.
Also rename componentLst to components in setExpansionFactors in an effort to remove type names from variable names
Single method that iterate over all blocks in an assembly and then all components in each block is now broken across a per-block method and a per-component method. This distinction will also allow subclasses to provide specific expansion methods on a more granular level.
The getSolidComponents produces a list which may not be needed in all situations. Lots of usage of getSolidComponents was for iteration, e.g., `for c in getSolidComponents(b)` where producing an iterable is sufficient.
Move docstring to class definition and outside `__init__` for consistency.
Useful for testing what you get is what you expect. Tests added to this effect. Renamed an internal variable from `componentWFlag` to `candidates` because the name implied `componentWFlag` was a single component when it was a (potentially empty) list of components. Finally, bring out the setting of the target component to a separate method. This is useful for subclasses that may need custom logic to determine their target component, but want to perform the same actions on the setter.
Useful for subclasses to override. Calls back to existing function for small code change.
This implementation an O(N^2) iteration where each block also iterates over all blocks in the assembly. The use of itertools.chain and itertools.islice provide a more efficient and streamlined iteration look. The call signature is for a `Sequence[Block]` which could just as easily be `Assembly`. We can't use just `Iterable[Block]` because we need to perform multiple iterations on the object at once. And things like a generator may get consumed part way through the iteration. And for testing, passing a list of blocks gets the same behavior as passing one assembly. Tests for zero blocks, one block, and multiple blocks added.
armi/reactor/converters/axialExpansionChanger/assemblyAxialLinkage.py
Outdated
Show resolved
Hide resolved
armi/reactor/converters/axialExpansionChanger/assemblyAxialLinkage.py
Outdated
Show resolved
Hide resolved
Co-authored-by: Tony Alberti <[email protected]>
…e' into drewj/improve-assem-axial-linkage * origin/drewj/improve-assem-axial-linkage: Apply suggestions from code review
Only really provided for back compatability with the existing list API. But this is far enough down the axial expansion API, which already has dubious widespread usage, that we're okay removing this unceremoniously.
@john-science this PR is apart of a larger downstream internal change, so please hold off on merging this. thank you! |
…xial-linkage * origin/main: Removing defunct comment from getPinCoordinates (#1931)
Co-authored-by: Tony Alberti <[email protected]>
…-axial-linkage' into drewj/improve-assem-axial-linkage * refs/remotes/origin/drewj/improve-assem-axial-linkage: Black Update armi/reactor/converters/tests/test_axialExpansionChanger.py
…xial-linkage * origin/main: New plugin hook for before reactor construction (#1945) Removing DoseResultsMapper (#1952) Adding logic so HexAssemblies are hexagonal (#1935) Adding Block.getInputHeight (#1927) Removing Assembly.doubleResolution (#1951) Adding DeprecationWarning for HistoryTrackerInterface (#1950) Removing tabulate as a dependency (#1948)
…xial-linkage * origin/main: Loading some ARMI DBs without the App that created them (#1917) Revert "Revert "Updating cluster settings (#1958)" (#1965)" (#1969) Allowing users to define flag names with digits (#1966) Revert "Updating cluster settings (#1958)" (#1965) Updating cluster settings (#1958) Reducing warnings while building the docs (#1959) Moving anl-afci-177 test files to their own directory (#1957)
Holler when you guys want this merged. I see it is doubly approved. |
This is getting run on additional downstream testing. If all goes well, it should be good to go today. I'll ping you when we're ready. |
@drewj-tp I see this as approved, and we have a release coming up. Any status on when this might get merged? |
Same status as yesterday. Blocked by downstream testing going awry. @drewj-tp, @mgjarrett, and myself need to troubleshoot today. |
…xial-linkage * origin/main: Ensuring reaction rate parameters are set after calc (#1971)
bump |
I think today's the day! |
* main: Fixing HexBlock docstrings (#1981) Removing a duplicate hex rotation impl tag (#1979) Avoiding closing plots that are meant to be interactive (#1978) Ensuring HexBlock.rotate updates child spatial locators (#1943) Add new memory runLog info to memoryProfiler.py (#1970) Fixing various doc build issues (#1974) Hiding sphinx-needs warnings during doc build (#1973) Fixing warnings in CLI startup (#1972)
* main: Extending axial expansion classes (#1920)
What is the change?
A handful of improvements to allow subclasses of axial expansion things more control. A general theme was to take large methods and break them up so subclasses can override at their discretion.
Some documentation has been added to axial expansion related classes. It's by no means complete, nor to the level of #935. But as I fumbled through the code and got helped from @albeanth, I added what I could to the docstrings.
Why is the change being made?
I am working on features internally that need more control over performing axial expansion that require these changes.
Closes #1453
Closes #1918
Checklist
doc
folder.pyproject.toml
.