-
Notifications
You must be signed in to change notification settings - Fork 32
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
More thread crash improvements #417
Open
mabruzzo
wants to merge
18
commits into
cholla-hydro:dev
Choose a base branch
from
mabruzzo:more-thread-crash-improvements
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
More thread crash improvements #417
mabruzzo
wants to merge
18
commits into
cholla-hydro:dev
from
mabruzzo:more-thread-crash-improvements
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In slightly more detail, we invoke `Average_Cell_All_Fields` to get the average values from the neighbors to overwrite the value in a crashed cell or (when the `AVERAGE_SLOW_CELLS` macro is defined). - We have already been excluding any neighboring cell from this average that had crashed. - The key inovation here is that we now exclude a neighboring cell that we would consider a slow cell (when the `AVERAGE_SLOW_CELLS` macro is defined). To implement this, we pass around the SlowCellConditionCheck object, which implements methods to check whether a cell is considered slow or not. When the `AVERAGE_SLOW_CELLS` macro is defined, that method does the full check. When the macro isn't defined, the logic short-circuits and always returns that the cell isn't slow.
for more information, see https://pre-commit.ci
The dual-energy formalism now respects crashed cells in the function call `Select_Internal_Energy_ND` -> the function does not modify any cells where the cell "crashed" -> while considering the neighboring values of the crashed cells, we ignore any neighbors that "crashed" -> we also now explicitly pick advected internal energy over the internal energy computed from total energy in cases where the total energy is positive, but does not exceed kinetic energy. This was all done in preparation for Averaging Crashed Cells after
It now operates after the dual-energy formalism.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This does a bunch of things (that would be a little annoying to subdivide into separate pull requests -- but I'm happy to do that). We divide up the description of this PR into a few parts.
I have highlighted points for where feedback might be particularly useful in "important quote-blocks"
Bug Fixes
PostUpdate_Conserved_Correct_Crashed_3D
in Improving thread crash logic #406, the function to average cells, I had messed up the launch parameters. That is fixed by the current PR.1More Logging when applying "fixes"
We now start logging more information when we overwrite values. This mainly describes 2 locations
Temperature_Floor_Kernel
now describes wherever we apply a temperature floor (this helped us identify the need for the bugfixes in the preceding section)Average_Cell_All_Fields
now describes values of advected internal energy values when applying updates (cases without the dual-energy formalism are appropriately handled). It also prints out any neighbors that get omitted when we aThese changes raises the question: "Are we making the log too noisy?" In general, I don't really think so, but let's talk through the 2 cases.
Temperature_Floor_Kernel
Important
My inclination is to wait until it becomes a problem, but I could be convinced to comment-out these warnings in most cases.
Average_Cell_All_Fields
. Prior to this PR, we already logged every time this function is called. All we are doing is reporting any neighbors that can't be used by this function since that should be rare. Furthermore, if a scenario ever comes up where somebody feels that this pollutes the log, it's probably indicative of a serious simulation issue!Provide explicit behavior when
PostUpdate_Conserved_Correct_Crashed_3D
failsThe simulation now aborts if
PostUpdate_Conserved_Correct_Crashed_3D
tries to "fix" a crashed cell, but the crashed cell does not have at least 2 valid neighbors to use for averaging. The number 2 is arbitrary. I originally just wanted to implement defined behavior when there were 0 valid neighbors. But, I decided that having just 1 valid neighbor was also pretty badReorder when we apply
PostUpdate_Conserved_Correct_Crashed_3D
Finally, we also reordered
PostUpdate_Conserved_Correct_Crashed_3D
and "dual energy reconciliation."2This fixed a problem that occurs with some frequency (and was exposed by all of the preceeding fixes) in particle-based feedback simulations.
Essentially a scenario comes up where the hydrodynamic fields are seemingly valid at the start of a cycle. But, you end with a weird scenario by the end of the hydrodynamic solve (before any kind of source terms other than self-gravity). Essentially, you have a crashed cell surrounded by neighboring cells that all have a positive total energy that is exceeded by the corresponding kinetic energy.
Because the advected internal energy always seems to be reasonable in the neighboring cells seems to be reasonable, we simply apply dual-energy reconcilliation before
PostUpdate_Conserved_Correct_Crashed_3D
.Important
Should we also consider cells where density or total energy is 0 to also be crashed cells?
Important
We don't do anything special if a neighboring cell has a positive total energy that is exceeding by the corresponding cell's kinetic energy. An alternative might be to use the sum of the advected internal energy and the kinetic energy for that cell. (I'm not sure how much this actually matters).
For posterity, here are more details about the particular problem:
To be clear, this solution is a bit of a hack.3 I suspect that this scenario arises because either:
Other solutions to this particular scenario could involve Riemann/reconstruction fallback (or rewinding and taking a smaller timestep).
Footnotes
For that reason, this PR and Improving thread crash logic #406 should be merged at the same time (or they should be combined together -- whatever is easier) ↩
This refers to the canonical step of the dual-energy formalism where we might replace the advected internal energy field with the value of Etot - Kinetic and the common additional logic of subsequently replacing Etot with the advected internal energy plus the kinetic energy. ↩
While the dual-engine formalism can be used in this scenario, I don't think it is really intended to solve this kind of issue ↩