Repository navigation
Sync old/new-time state before ComputeDt to fix Boussinesq forcing - #209
Merged
Merged
Conversation
and thus the computed dt on restart and regrid. ComputeDt calls compute_vel_forces_on_level, which uses both the old and new tracer fields for m_use_boussinesq. Previously, immediately after a restart (old-time fields aren't saved to checkpoints) or a regrid (new LevelData arrays start uninitialized) ComputeDt could read bad tracer_o data. Moving the fillpatch + copy-new-to-old block to the top of Advance and InitialIterations ensures old and new are both good before ComputeDt. Note this changes the adaptive dt for boussinesq. However, the dt is now computed with the same velocity forcing that is used to compute the advective velocity. This also ensures that copy_from_*_temperature checks m_use_temperature before trying to copy an mf that might not be defined.
asalmgren
approved these changes
Aug 20, 2026
This file contains hidden or 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
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.
use of uninitialized tracer_o on restart and regrid.
ComputeDt calls compute_vel_forces_on_level, which uses both the old and new tracer fields for m_use_boussinesq. Previously, immediately after a restart (old-time fields aren't saved to checkpoints) or a regrid (new LevelData arrays start uninitialized) ComputeDt could read bad tracer_o data. Moving the fillpatch + copy-new-to-old block to the top of Advance and InitialIterations ensures old and new are both good before ComputeDt.
Note this changes the adaptive dt for boussinesq. However, the dt is now computed with the same velocity forcing that is used to compute the advective velocity.
This also ensures that copy_from_*_temperature checks m_use_temperature before trying to copy an mf that might not be defined.