Skip to content

Commit

Permalink
remove unnecessary EnforceLimits on old state (#668)
Browse files Browse the repository at this point in the history
### Description
Immediately after a regrid, the old state `state_old_cc_` is
uninitialized (and unused, because all of the times of the regridded
levels are synchronized at that moment). Therefore, `EnforceLimits` does
not need to be called on it.

Since the old state is unused, this PR doesn't affect the simulation
evolution in any way. However, this avoids spurious FPEs from trying to
process zero or NaN values in the old state array.

### Related issues
Fixes #401.

### Checklist
_Before this pull request can be reviewed, all of these tasks should be
completed. Denote completed tasks with an `x` inside the square brackets
`[ ]` in the Markdown source below:_
- [x] I have added a description (see above).
- [x] I have added a link to any related issues see (see above).
- [x] I have read the [Contributing
Guide](https://github.com/quokka-astro/quokka/blob/development/CONTRIBUTING.md).
- [ ] I have added tests for any new physics that this PR adds to the
code.
- [ ] I have tested this PR on my local computer and all tests pass.
- [x] I have manually triggered the GPU tests with the magic comment
`/azp run`.
- [x] I have requested a reviewer for this PR.
  • Loading branch information
BenWibking authored Jul 7, 2024
1 parent f395519 commit 080145d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/RadhydroSimulation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ template <typename problem_t> void RadhydroSimulation<problem_t>::FixupState(int

// fix hydro state
HydroSystem<problem_t>::EnforceLimits(densityFloor_, pressureFloor_, speedCeiling_, tempCeiling_, tempFloor_, state_new_cc_[lev]);
HydroSystem<problem_t>::EnforceLimits(densityFloor_, pressureFloor_, speedCeiling_, tempCeiling_, tempFloor_, state_old_cc_[lev]);

// sync internal energy and total energy
HydroSystem<problem_t>::SyncDualEnergy(state_new_cc_[lev]);
}
Expand Down

0 comments on commit 080145d

Please sign in to comment.