-
Notifications
You must be signed in to change notification settings - Fork 8
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
Fix for internal energy scaling in PTE closure #401
Conversation
c624b35
to
9c35a24
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix! This was a subtle one.
This does bring about a larger discussion of |
at the very least for this PR, perhaps changing the |
I think this was what it was originally and it caused problems. @pdmullen can comment though. |
Maybe a few thoughts here... First, I tend to agree that there are multiple ways of handling the scaling of internal energies. As @dholladay00 argues, if we were careful, we could simply apply a shift so that the nuance of negative numbers don't bite us. @jhp-lanl on mattermost also thought about the scenario wherein the scaled internal energies summed to exactly zero, and how to best handle that situation. Lots of opportunity here. Second, just to say it aloud... this PR is fixing a bug. The bug was that the scaled internal energies could sum to |
My comment wasn't necessarily related to the new introduced parameter as it seems to do the right thing. But seeing this PR with the fact that sie's can have opposite sign at the forefront of my mind, I think we should look again at |
Sorry folks... I have reverted to my original design for this fix. In contrast to the fixed P solver implementation for example (see https://github.com/lanl/singularity-eos/blob/main/singularity-eos/closure/mixed_cell_models.hpp#L1020), when I have gone the route of simply eliminating the EDIT: Just for completeness, in my previous implementation (if anyone looks there), I missed a re-normalization. |
I think what you had originally (in this MR at least) is the right approach and I don't think you've provided enough justification for why that approach doesn't work yet. For this MR to go in, we need strong justification for why the I am strongly advocating for the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add the case that causes the PTE solver to fail in the unit tests?
https://github.com/lanl/singularity-eos/blob/main/test/test_closure_pte.cpp
The implementation in 9c35a24 contained ill-motivated, erroneous scaling and residual estimations. This was my fault... apologies; and I could have better described the flaw. The original, actual bug fix (i.e., simply eliminating I suspect that earlier we weren't on the same page about what was going on in with my failed attempt in 9c35a24. If okay with all, let's forget about that implementation and reconsider afresh the most recent commit. For this reason, I am re-triggering review requests.
Will try my luck at this tomorrow. |
Yes that was my fault. I failed to appreciate what the sum over |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved when minor change is made
Merging. LANL gitlab tests pass |
PR Summary
The total volumetric internal energy
can be a negative quantity. I believe that the internal energy scaling routines in
singularity/main
mixed_cell_models.hpp
do not respect this. For example, here: https://github.com/lanl/singularity-eos/blob/main/singularity-eos/closure/mixed_cell_models.hpp#L313, anabs
is applied to the (potentially negative)sie_total
to computeuscale
. In the case of a negativesie_total
, the sum of the resultant, scaledu[m]
can be-1
. Inside residual calculations (e.g., https://github.com/lanl/singularity-eos/blob/main/singularity-eos/closure/mixed_cell_models.hpp#L594), a positive 1 is assumed for the sum over scaled material internal energies.I believe the fix here is to just remove the
abs
(as here: c843e16). However, after some discussion with folks, this means that the sign ofuscale
can depend on the sign ofsie_tot
... an alternative choice is to introduceuscale_total = (sie_tot > 0.0) ? 1.0 : -1.0
PR Checklist
make format
command after configuring withcmake
.If preparing for a new release, in addition please check the following:
when='@main'
dependencies are updated to the release version in the package.py