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

Fixing HexBlock rotation in plotBlockDiagram #1926

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

Conversation

john-science
Copy link
Member

@john-science john-science commented Oct 4, 2024

What is the change?

  1. Fixed a bug in plotBlockDiagram().
  2. To help, I added the method HexBlock.cornersUp(), as I imagine it will be a helpful utility to have.
  3. Oh, and sorry, I changed a variable from self.HexBlock to self.hexBlock, to match our variable naming rules.

Why is the change being made?

The method plotBlockDiagram() incorrectly plots HexBlocks if they are rotated to the "corners up" rotation.

close #1421


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.

@john-science john-science added the bug Something is wrong: Highest Priority label Oct 4, 2024
@keckler
Copy link
Member

keckler commented Oct 4, 2024

First question without even looking at the code -- Can we get a picture of the correct plots?

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.

armi/reactor/tests/test_blocks.py Outdated Show resolved Hide resolved
armi/utils/plotting.py Outdated Show resolved Hide resolved
armi/utils/plotting.py Outdated Show resolved Hide resolved
@keckler
Copy link
Member

keckler commented Oct 5, 2024

@john-science Thank you for fixing those few comments. Please also note that there are a couple more things that would be good before approving this PR:

  1. Fixing HexBlock rotation in plotBlockDiagram #1926 (review)
  2. Fixing HexBlock rotation in plotBlockDiagram #1926 (comment)

Copy link
Contributor

@drewj-tp drewj-tp left a comment

Choose a reason for hiding this comment

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

I'm currently poking around grid like things and some things here overlapped

armi/reactor/blocks.py Outdated Show resolved Hide resolved
def cornersUp(self):
"""Determine if the hex shape of is corners up or flats up, in relation to the Y axis."""
if self.spatialGrid is None:
return None
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this is false-like? But returning None from a bool-like method feels weird.

Would it make more sense to return False or error here?

Copy link
Member Author

Choose a reason for hiding this comment

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

A Python None is a null value. It is just as valid to use None for a null value when a return type is an int, numpy.ndarray or bool.

Seems standard enough to return an empty value from a method.

What would you rather do? I don't want to return an error, because this does not seem like a scenario in which I want to kill a simulation.

Copy link
Member Author

Choose a reason for hiding this comment

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

hmmm

@john-science
Copy link
Member Author

@drewj-tp Well, in defense of your idea, I am still getting this:

blockDiagram27

It appears the bug for the hexagonal shaped composites was quite easy to fix. But the coordinates for the pins are just wrong from the start. (There's nothing I can do in the plotting routine to fix that.)

@john-science john-science marked this pull request as draft October 9, 2024 23:13
@john-science
Copy link
Member Author

This PR is temporarily on hold for another PR: #1947

I believe my solution in this was over-engineered to work AROUND the problem present in the other PR. Once that other PR merges, I should be able to simplify this PR.

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.

plotBlockDiagram() doesn't respect block orientation
3 participants