Skip to content
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

Merged
merged 5 commits into from
Mar 2, 2023

Conversation

ambrad
Copy link
Member

@ambrad ambrad commented Feb 28, 2023

  • Implement doubly-periodic mode in Hommexx.
  • Add C++-vs-F90 tests for the F90 nhgw and bubble tests.

Fixes #4212 .

[BFB] except for standalone Homme F90 bubble tests; adds new standalone Homme tests

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.
@ambrad ambrad added HOMME standalone issues with the standalone HOMME code that dont impact E3SM EAMxx PRs focused on capabilities for EAMxx enhancement labels Feb 28, 2023
@ambrad ambrad self-assigned this Feb 28, 2023
Copy link
Contributor

@bartgol bartgol left a 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this change?

Copy link
Member Author

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.

Copy link
Contributor

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() ).

Copy link
Member Author

@ambrad ambrad Feb 28, 2023

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.

Copy link
Contributor

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.

Copy link
Member Author

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:

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.

Copy link
Contributor

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.

Copy link
Member Author

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
############################################################################

@ambrad
Copy link
Member Author

ambrad commented Feb 28, 2023

On Ascent, optimized and debug SCREAMv1 ERS tests pass with this PR merged in and this change made to EAMxx: E3SM-Project/scream#2198.

@ambrad
Copy link
Member Author

ambrad commented Feb 28, 2023

With the fix to SyncUtils, homme_integration passes on Chrysalis except with the expected fails:

HOMMEBFB_P24.f19_g16_rx1.A.chrysalis_intel
    1 - verifyBaselineResults (Failed)
   37 - thetanh-moist-bubble (Failed) // diffs are due to bubble_init pressure_thickness commit
   38 - thetanh-dry-bubble (Failed)
   42 - preqx-nhgw-kokkos (Failed) // diff due to fixing the executable
   43 - preqx-nhgw-slice-kokkos (Failed)  // the rest are due to missing baselines
   45 - thetanh-moist-bubble-kokkos (Failed)
   46 - thetanh-dry-bubble-kokkos (Failed)
   47 - thetah-nhgw-kokkos (Failed)
   48 - thetanh-nhgw-kokkos (Failed)
   49 - thetah-nhgw-slice-kokkos (Failed)
   50 - thetanh-nhgw-slice-kokkos (Failed)
HOMME_P24.f19_g16_rx1.A.chrysalis_intel: both diffs are due to bubble_init pressure_thickness commit
   28 - thetanh-moist-bubble (Failed)
   29 - thetanh-dry-bubble (Failed)

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.

@ambrad
Copy link
Member Author

ambrad commented Mar 1, 2023

e3sm_developer on Chrysalis is as expected. I'll start integration tomorrow.

ambrad added a commit that referenced this pull request Mar 1, 2023
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
@ambrad ambrad merged commit da29aea into E3SM-Project:master Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
EAMxx PRs focused on capabilities for EAMxx enhancement HOMME standalone issues with the standalone HOMME code that dont impact E3SM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

homme planar preqx test using theta
3 participants