Fix consistency of precomputed quantities for Rosenbrock #305
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.
Purpose
This PR fixes a bug in the Rosenbrock timestepper that results in inconsistent precomputed quantities in ClimaAtmos.
Since the first stage of an
s
-stage timestepping scheme is typically the same as the final state of the previous timestep, we can chose to updatep
based on each of the stagesU_1--U_s
, or we can choose to update it based on the stagesU_2--U_s
and the final stateu
. The Rosenbrock timestepper is currently using the first option, whereas the ARK methods use the second option. With the first option, the value ofp
between timesteps is not consistent with the value ofu
, since it did not get updated whenu
was computed and still has the value fromU_s
(for FSAL timesteppers,u = U_s
, but SSPKnoth is not FSAL). The second option fixes this issue, so the Rosenbrock timestepper needs to be updated to use it.Also, our computation for
p
modifies the state by updating the boundary face values ofu_3
. With the first option, only the intermediate stages get updated, and the final stateu
is left with unconstrained boundary face values ofu_3
. This has resulted in nonsensical surface velocities in ClimaAtmos simulations with topography (these velocities do not seem to be used for any tendencies or diagnostics, which is why they have gone unnoticed for some time).