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 the affect of custom isotopics on material density #1822

Merged
merged 21 commits into from
Dec 3, 2024

Conversation

jakehader
Copy link
Member

@jakehader jakehader commented Aug 14, 2024

What is the change?

This fixes some problems that were found with #1745. Those issues are described in #1818 .

Why is the change being made?

We are fixing a bug that made it into the codebase.


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
Copy link
Member

@jakehader Just a reminder of the ARMI PR policy:

Don't open until it is ready
----------------------------
.. important ::
Wait until your PR is complete to open it.

We are all extremely busy, and if a PR gets opened before it is ready I will get an email:

  • every single time you commit, and the CI passes
  • for each and every time a single CI job fails

I love the help, and the interesting in fixing the feature. But in the future, please wait until the feature is ready for final review before opening a PR.

@jakehader jakehader marked this pull request as draft August 14, 2024 17:04
@jakehader
Copy link
Member Author

@jakehader Just a reminder of the ARMI PR policy:

Don't open until it is ready
----------------------------
.. important ::
Wait until your PR is complete to open it.

We are all extremely busy, and if a PR gets opened before it is ready I will get an email:

  • every single time you commit, and the CI passes
  • for each and every time a single CI job fails

I love the help, and the interesting in fixing the feature. But in the future, please wait until the feature is ready for final review before opening a PR.

Thanks for the reminder @john-science - I put the PR here but forgot to make it a draft. This was just intended to provide some ideas for how to resolve the ticket and to put something out there to be stress tested by @keckler and others.

There are failing unit tests because I changed the construct arguments so that needs to be resolved still (probably a poor design to require case settings to build a component). Also, we will need to add more unit tests around custom Isotopics (same comment on the ticket).

@keckler
Copy link
Member

keckler commented Aug 15, 2024

I ran some tests on my FFTF model to see if this branch works. A couple points:

  1. The keff in my model increased by nearly 5000 pcm to a value that is very incorrect.
  2. The predicted isothermal temperature reactivity coefficient looks correct.
  3. The fuel density when the model is initialized to Thot is way too high (~10%).
  4. The change in density between different Thot values appears to be roughly correct, and the number of atoms is being correctly conserved.

So it seems like this change is half working. Somehow the initialized model is getting the densities very incorrect, though.

@jakehader
Copy link
Member Author

Was this fixed elsewhere @keckler?

@keckler
Copy link
Member

keckler commented Oct 30, 2024

Nope, still broken

@@ -394,6 +394,7 @@ def apply(self, material):
material.massFrac = dict(self.massFracs)
if self.density is not None:
if not isinstance(material, materials.Custom):
# TODO I think this warning should go away?
Copy link
Member

Choose a reason for hiding this comment

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

I would like a second set of eyes on the runLog statement below. I am 99% sure that that print should be removed completely, because we are now allowing for non-Custom materials to have density specified.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

The runlog appears to still be correct and applicable, as the density is not applied to material in this function if material is not a custom material per line 396. I don't recognize anywhere in the changes that the density of a library material is being set, am I missing it?

Related: I believe this was intended to explicitly call out that setting a custom density for a library material using custom isotopics is not allowed. Presumably a library material would have known, vetted properties that should not be overwritten by users in a passive way. From recollection, using custom isotopics on a library material allows the density to be set on a component specifically using the custom isotopics, but using custom isotopics to set the density for the reference material is no bueno.

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 you're right.

The thing that keeps tripping me up is the last sentence: "Only custom materials may have a density specified."

I feel like that can be reworded to make the intention more clear. Right now I read that and think that its saying "the density that you specified is doing nothing".

I'll try to rejigger a bit.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I vaguely remember struggling how to phrase this without being very wordy. Some ideas:

"Only custom materials may have a density specified using custom isotopics, though components using custom materials may have their densities changed."

"The reference density of materials in the materials library will not be changed by custom isotopics, but components with custom isotopics using a library material will use the density implied by the custom isotopics."

Copy link
Member

Choose a reason for hiding this comment

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

Alright, I updated the wording. Thanks for helping here.

@keckler keckler changed the title Strawman fix for the custom isotopics for testing. Fix the use of custom isotopics combined with a material class Dec 2, 2024
@keckler
Copy link
Member

keckler commented Dec 2, 2024

@john-science I believe that this is ready for your eyes.

In addition to the updated unit tests, I did quite a bit of offline testing with my FFTF model to convince myself that this is working properly.

@keckler keckler marked this pull request as ready for review December 2, 2024 22:27
@john-science
Copy link
Member

Random thought: I think this PR is big enough for a release note in doc/release/0.5.rst.

@terrapower terrapower deleted a comment from keckler Dec 2, 2024
@john-science john-science changed the title Fix the use of custom isotopics combined with a material class Fixing the affect of custom isotopics on material density Dec 3, 2024
@@ -186,7 +186,7 @@ def shape(self, shape):
mergeWith = yamlize.Attribute(type=str, default=None)
area = yamlize.Attribute(type=float, default=None)

def construct(self, blueprint, matMods):
def construct(self, blueprint, matMods, inputHeightsConsideredHot):
Copy link
Member

@john-science john-science Dec 3, 2024

Choose a reason for hiding this comment

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

Okay, so the variable name here is strange. Because "input heights" makes sense if this Component is part of an Assembly in some way, sure.

But Components are a very general idea of the leaf of the data model. They don't have to be in a pin-type reactor.

What do you think?

Copy link
Member

Choose a reason for hiding this comment

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

Also, maybe this new parameter should have a default value? What do you think?

Copy link
Member

@keckler keckler Dec 3, 2024

Choose a reason for hiding this comment

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

This parameter and its name are directly copied from the case setting of the same name. I tried to reflect that intention in the docstring, but maybe I could be more clear there.

When Jake put up the draft PR, he was originally passing an entire case settings object down to this level. I did away with that because I find it frustrating when I have to whip up an entire cs just for a single boolean.

So I made the name for this parameter exactly the same as the case setting whose value should be passed down here. I thought that made things simpler, but if you think it'd be more clear either (1) with a different name, or (2) if we passed the entire cs, then I am open to those options.

Copy link
Member

Choose a reason for hiding this comment

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

With respect to a default value...

I'm not sure how I feel there.

On the one hand, we could potentially make the default be the same as the default for the inputHeightsConsideredHot case setting (True). On the other hand, I really don't like that because the default on that case setting is the opposite of our typical workflow at this point in time (i.e. having axial expansion turned on).

I think my ideal solution would be if there were a way to not have to pass the value via method calls. But the only way I could conceive to do that is to store a cs on the ComponentBlueprint, and that is something I really don't want to do.

Maybe you see a clean way to get around all this?

Copy link
Member

Choose a reason for hiding this comment

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

It is definitely better to pass one value instead of the entire settings object. For sure. Nice.

I suppose "input dimensions considered hot" would have been a more accurate name for that setting. But the people who created it were definitely thinking of pin-type reactors.

doc/release/0.5.rst Outdated Show resolved Hide resolved
Co-authored-by: John Stilley <[email protected]>
@john-science john-science merged commit 68268c1 into main Dec 3, 2024
22 checks passed
@john-science john-science deleted the customIsotopicsStrawman branch December 3, 2024 21:58
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.

Use of custom isotopics with thermal expansion turned on does not correctly preserve mass
4 participants