-
Notifications
You must be signed in to change notification settings - Fork 345
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
Hommexx: Add doubly-periodic capability. #5481
Hommexx: Add doubly-periodic capability. #5481
Conversation
This also solves the multi-defs problem in the case of QSIZE_D == NUM_TIME_LEVELS.
* Implement doubly-periodic mode in Hommexx. * Add C++-vs-F90 tests for the F90 nhgw and bubble tests.
Previously, it was computing it according to the analytical formula. But that is not BFB in finite precision with the pressure_thickness call, which is the normal way to init dp3d in standalone tests. This was causing non-BFBness in the C++-vs-F90 test for the bubble tests. Differences in dp are at machine precision.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. At some point it would be nice to add some more "intrinsic" tests, like basic grad/curl/div identities or lapl==div(grad(u)). I forgot if they (all) hold in curved manifolds, but they could at least be tested in planar geometries.
Obv, not for this pr.
@@ -283,6 +282,10 @@ subroutine bubble_init(elem,hybrid,hvcoord,nets,nete,f) | |||
|
|||
hvcoord%hyai = ai; hvcoord%hybi = bi | |||
|
|||
do k = 1,nlev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously, it was computing it according to the analytical formula. But that is not BFB in finite precision with the pressure_thickness call, which is the normal way to init dp3d in standalone tests. This was causing non-BFBness in the C++-vs-F90 test for the bubble tests, since Hommexx's initialization assumes that dp3d is computed w.r.t. ps by the usual formula. Differences in dpm in bubble_init are at machine precision.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, my first thought was to revert it. I do not believe we should stick to dcmip wrappers code. However if that it too much to change xx init, then it is ok to keep it. i think xx init should have mimic-ed F init though (i assume it is about routine set_elem_state() ).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error, in my view, is in bubble_init. It sets up ps and dp3d in such a way that even if nothing happened in the first time step, dp3d would change (at machine precision) just due to using the standard formula in, e.g., vertical remap rather than bubble_init's computation. In contrast, all the other standalone tests use pressure_thickness for finite-precision consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no reason to use A, B in dp3d away from init, and in init it is only a convenience. I do not see it as an error, however, it is a bigger change to fix this in xx, so let's keep this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for clarity, by consistency I mean e.g. with:
E3SM/components/homme/src/theta-l/share/vertremap_mod.F90
Lines 81 to 82 in c7b8bd8
dp(:,:,k) = ( hvcoord%hyai(k+1) - hvcoord%hyai(k) )*hvcoord%ps0 + & | |
( hvcoord%hybi(k+1) - hvcoord%hybi(k) )*elem(ie)%state%ps_v(:,:,np1) |
If we want to remove a and b, it's not just an init-time issue or an Hxx issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand. At this point it is just a philosophical conversation about hybrid coefs, which we can postpone.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To ddcument this further, in Chrysalis, homme_integration shows diffs for the F90 bubble tests at machine precision level, consistent with the machine-precision change to dpm in bubble_init:
############################################################################
CPRNC returned the following RMS differences
RMS T 7.0545E-13 NORMALIZED 2.4100E-15
RMS Th 4.4738E-14 NORMALIZED 1.4912E-16
RMS ps 9.2247E-11 NORMALIZED 9.2247E-16
RMS T 8.1605E-12 NORMALIZED 2.7882E-14
RMS Th 6.1777E-12 NORMALIZED 2.0591E-14
RMS geo 4.3877E-11 NORMALIZED 5.9630E-15
############################################################################
On Ascent, optimized and debug SCREAMv1 ERS tests pass with this PR merged in and this change made to EAMxx: E3SM-Project/scream#2198. |
With the fix to SyncUtils, homme_integration passes on Chrysalis except with the expected fails:
It surprises me that more F90 nhgw tests don't diff against baselines because of fixing the executable used. Next I'll run the usual integration testing and work on merging this PR. |
e3sm_developer on Chrysalis is as expected. I'll start integration tomorrow. |
Hommexx: Add doubly-periodic capability. * Implement doubly-periodic mode in Hommexx. * Add C++-vs-F90 tests for the F90 nhgw and bubble tests. Fixes #4212. e3sm_developer and homme_integration pass except with the expected diffs and missing baselines in homme_integration. On Ascent, optimized and debug SCREAMv1 ERS tests pass with this PR merged in and this change made to EAMxx: E3SM-Project/scream#2198. [BFB] except for standalone Homme F90 bubble tests; adds new standalone Homme tests
Fixes #4212 .
[BFB] except for standalone Homme F90 bubble tests; adds new standalone Homme tests