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

Improve logic for computing thermal expansion factors #1342

Merged
merged 13 commits into from
Jul 25, 2023

Conversation

albeanth
Copy link
Member

@albeanth albeanth commented Jul 12, 2023

What is the change?

The logic within axialExpansionChanger.py::ExpansionData::computeThermalExpansionFactors was prone to computing the wrong thermal expansion factors for some corner cases. This PR aims to address these use cases by adding an optional parameter that specifically calls out if the temperature change for computing the thermal expansion factors should use c.inputTemperatureInC and c.temperatureInC (i.e., if coldHeightsToHot is True) or between the "component reference temperature" and c.temperatureInC (i.e., if coldHeightsToHot is False).

Why is the change being made?

The logic for computing thermal expansion factors was error prone and could be misinterpreted.


Checklist

  • This PR has only one purpose or idea.
  • Tests have been added/updated to verify that the new/changed code works.
  • The release notes (location doc/release/0.X.rst) are up-to-date with any important changes.
  • The documentation is still up-to-date in the doc folder.
  • The dependencies are still up-to-date in setup.py.

@albeanth albeanth requested review from keckler and onufer July 12, 2023 19:17
@@ -559,12 +560,13 @@ def _determineLinked(componentA, componentB):
class ExpansionData:
"""Object containing data needed for axial expansion."""

def __init__(self, a, setFuel):
def __init__(self, a, setFuel: bool, coldHeightsToHot: bool):
Copy link
Member

Choose a reason for hiding this comment

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

doc string please and describe when coldHeightsToHot would be true and the associated setting.

Also call out that it significantly doesn't preserve mass since component is hot radial dims but heights are cold input dims

Copy link
Member Author

Choose a reason for hiding this comment

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

73c16ed

Also call out that it significantly doesn't preserve mass since component is hot radial dims but heights are cold input dims

I would prefer to add this to the docs in some capacity. #935

Copy link
Member

Choose a reason for hiding this comment

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

add in doc string too. its a big feature difference than what someone might assume. we dont want someone mis-using in a new case because the doc string doesn't call out the major pitfal

Copy link
Member Author

Choose a reason for hiding this comment

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

@@ -192,7 +193,7 @@ def setAssembly(self, a, setFuel=True):
This is useful when target components within a fuel block need to be determined on-the-fly.
"""
self.linked = AssemblyAxialLinkage(a)
self.expansionData = ExpansionData(a, setFuel)
self.expansionData = ExpansionData(a, setFuel, coldHeightsToHot)
Copy link
Member

Choose a reason for hiding this comment

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

prefer when calling to pass kwargs directly

self.expansionData = ExpansionData(a, setFuel=setFuel, coldHeightsToHot=coldHeightsToHot)

in this case if kwargs are re-ordered or one is removed you are still safe

Copy link
Member Author

Choose a reason for hiding this comment

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

@@ -666,7 +668,7 @@ class TestDetermineTargetComponent(AxialExpansionTestBase, unittest.TestCase):

def setUp(self):
AxialExpansionTestBase.setUp(self)
self.expData = ExpansionData([], None)
self.expData = ExpansionData([], True, True)
Copy link
Member

Choose a reason for hiding this comment

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

define what the variables are
self.expansionData = ExpansionData(a, setFuel=True, coldHeightsToHot=True)

Copy link
Member Author

Choose a reason for hiding this comment

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

@@ -156,6 +156,7 @@ def performThermalAxialExpansion(
tempGrid: list,
tempField: list,
setFuel: bool = True,
coldHeightsToHot: bool = False,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should add coldHeightsToHot to the docstring

Copy link
Member Author

Choose a reason for hiding this comment

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

@john-science it'd be nice if our linting would catch this. What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

@albeanth albeanth marked this pull request as draft July 17, 2023 20:09
@albeanth
Copy link
Member Author

Converting to draft while I figure out downstream merge dependencies.

Comment on lines 175 to 176
determines if thermal expansion factors should be calculated from c.inputTemperatureInC
to c.temperatureInC or some other reference temperature and c.temepratureInC
Copy link
Member

Choose a reason for hiding this comment

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

its more than that though. its not just reference temperature. its performing non mass conserving expansion to accommodate coldHeightsConsidered Hot

Copy link
Member Author

Choose a reason for hiding this comment

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

albeanth and others added 3 commits July 24, 2023 14:49
Co-authored-by: Chris Keckler <kecklerct@gmail.com>
Co-authored-by: Chris Keckler <kecklerct@gmail.com>
@albeanth albeanth marked this pull request as ready for review July 24, 2023 22:50
@keckler keckler self-requested a review July 25, 2023 16:13
@albeanth albeanth merged commit f947ea1 into terrapower:main Jul 25, 2023
11 checks passed
@albeanth albeanth deleted the fixLogicForThermExpFactors branch July 25, 2023 16:15
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.

None yet

5 participants