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 component density Tests #818

Merged
merged 1 commit into from
Aug 5, 2022
Merged

add component density Tests #818

merged 1 commit into from
Aug 5, 2022

Conversation

onufer
Copy link
Member

@onufer onufer commented Aug 5, 2022

Description

  • revert renames of applyHotHeightDensityReduction, and applyMaterialMassFracsToNumberDensities from recent PR
    • Justification: the old names are correct enough and we prefer a stable API
  • add getMassDensity() function to components
  • adding component density/mass tests for expansion
  • add test demonstrating that construction of components programmatically isn't the same as through blueprints

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 are up-to-date with any bug fixes or new features.
  • The documentation is still up-to-date in the doc folder.
  • The dependencies are still up-to-date in setup.py.

Comment on lines +339 to +346
# This should be equal, but block construction calls applyHotHeightDensityReduction
# while programmatic construction allows components to exist in a state where
# their density is not consistent with material density.
self.assertNotAlmostEqual(
clad.getMassDensity(),
programaticClad.getMassDensity(),
delta=biggerDelta,
)
Copy link
Member Author

Choose a reason for hiding this comment

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

We probably want to fix this. it is documented in #819


# when comparing to 3D density, the comparison is not quite correct.
# We need a bigger delta, this will be investigated/fixed in another PR
biggerDelta = 0.001 # g/cc
Copy link
Member Author

Choose a reason for hiding this comment

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

The fact that we need this is indicative of a bug. Thankfully the differences are very minor.
#820

@john-science
Copy link
Member

I love it when people add tests! Reviewing now.

@john-science
Copy link
Member

I would be curious to know how this problem relates to this docstring:

def density(self, Tk: float = None, Tc: float = None) -> float:
"""
Return density that preserves mass when thermally expanded in 2D.
Warning
-------
This density will not agree with the component density since this method only expands in 2 dimensions.
The component has been manually expanded axially with the manually entered block hot height.

This has been in our codebase for at least 3 years.

@onufer
Copy link
Member Author

onufer commented Aug 5, 2022

@john-science, that doc string indicates that until you fix it it will be off by axial expansion factor. but its not exactly off axial expansion factor, and that is the problem.. It should agree exactly with this one, but it doesn't

armi.materials.density3:
component density should be in agreement with this density

Copy link
Member

@john-science john-science left a comment

Choose a reason for hiding this comment

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

I love it when people add more tests.

These two kind of "prove a negative", which is unusual. But they are still really helpful to have around.

@onufer onufer merged commit ba5e306 into main Aug 5, 2022
@john-science john-science deleted the addMoreComponentDenistyTests branch August 5, 2022 21:05
scottyak pushed a commit to scottyak/armi that referenced this pull request Oct 27, 2022
- revert renames of applyHotHeightDensityReduction, and applyMaterialMassFracsToNumberDensities
- add getMassDensity() function to components
@onufer onufer mentioned this pull request May 17, 2023
7 tasks
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

2 participants