-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add DSS before implicit solve, fix T_imp approximation and callbacks #352
Conversation
I'm not opposed to these changes, but having moved these pieces around myself, I remember just how complex some of the edge cases are, and I'm a bit uneasy about the current test situation in the code. I'd really like to fix #106 so that it's simple and clear what is being changed here. I don't want to slow down progress, so please feel free to merge if we get a green light on CI and atmos tests look fine. I'll bump the priority of fixing #106. |
c96efbb
to
3eca3b3
Compare
3eca3b3
to
ccdcbde
Compare
ccdcbde
to
96b7067
Compare
@charleskawczynski, I have made some significant changes to the PR based on our AMIP tests (see PR description for details). In particular, some of the changes may affect your work on #323, so let me know if those make sense to you. |
This changes the order in which |
Ok, in that case, can we please rename them to have |
31acf25
to
be13e01
Compare
Following an offline discussion with @charleskawczynski, I've renamed Since the keyword arguments for |
dd59823
to
a946b10
Compare
a946b10
to
9048ca6
Compare
Purpose
This PR undoes a small change that was accidentally introduced in #348. We were previously approximating the implicit tendency as
(U_after_implicit_solve - U_before_implicit_solve) / (Δt * γ)
, but in that PR I ended up changing it to(DSS(U_after_implicit_solve) - U_before_implicit_solve) / (Δt * γ)
. In the absence of roundoff error, these would be exactly identical. Unfortunately, we do not satisfyDSS(DSS(U)) == DSS(U)
at a discrete level, so they are not quite identical. Reverting to the original approximation ofT_imp
might marginally improve stability.Update: After testing this change with AMIP, we have found that the original call to DSS before the implicit solve (which was removed in #348) is still necessary, even if we fix the approximation of
T_imp
. Without this call to DSS, we are effectively including the effects of DSSingT_exp
andT_lim
on previous stages in the approximation ofT_imp
on the current stage, which is not physically meaningful and appears to hurt stability. It might also be a good idea to apply DSS on each Newton iteration (as HOMME appears to do), but this doesn't have any noticeable effect when the number of Newton iterations is small, as is currently the case for AMIP and all our other simulations. So, for now we will only apply DSS before and after the implicit solve, but we may need additional calls to DSS if we ever use more Newton iterations (e.g., with implicit EDMF).Along with the fixes to DSS and the approximation of
T_imp
, this PR now also fixes how the stage callbackspost_explicit!
andpost_implicit!
are used. Withpost_explicit!
called at the end of each stage andpost_implicit!
called before each Newton iteration, we can rename them to something likepost_stage!
andpre_newton_iteration!
(as per my comment on #323) and update ClimaAtmos accordingly. I have also updated the values oft_exp
andt_imp
that are passed to DSS and the stage callbacks, in order to accurately reflect when each of these operations is being performed.