Skip to content

cam6_4_091: Implement support for moving mountain gravity wave scheme in MPAS dycore #1297

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

Conversation

kuanchihwang
Copy link
Collaborator

This PR implements support for moving mountain gravity wave scheme in MPAS dycore.

The use_gw_movmtn_pbl namelist option will now default to .true. when MPAS dycore and CAM7 physics are both selected, which matches the behavior as in SE dycore.

The moving mountain gravity wave scheme needs relative vorticities at cell points as input. However, because MPAS uses staggered C-grid for spatial discretization, where wind vectors are located at edge points, it calculates relative vorticities at vertex points instead. As a result, this PR introduces a new functionality in MPAS subdriver to regrid vertex values to cell values. The regridding functionality is also generalized so that it will work with all variables at vertex points.

Subsequently, relative vorticities are passed to physics buffer during dynamics-physics coupling, after which the moving mountain gravity wave scheme can query and use them as input.

Closes #1253
Closes #1277

Additional notes about tests:

  • This PR is expected to be answer-changing for MPAS dycore with CAM7 physics, but all relevant regression tests still pass because they do not test this particular configuration.
  • I manually ran the "F2000dev" compset with MPAS dycore. I inspected and plotted the "VORT4GW" variable in physics buffer. I can confirm that relative vorticities are correctly passed to physics by visual inspection.
  • MPAS dycore has variables that are located at both cell and vertex points (e.g., absolute vorticities). I used the regridding functionality in this PR to calculate absolute vorticities at cell points, and compared the results with the values calculated internally by MPAS. The global maximum absolute error is in the order of $10^{-19}$, which shows that the implementation is provably correct.

@kuanchihwang
Copy link
Collaborator Author

I do not have the permission to either assign myself or request reviews. Tagging @PeterHjortLauritzen and @mgduda to take a look at this PR to ensure scientific correctness.

@mgduda
Copy link
Collaborator

mgduda commented Apr 21, 2025

I do not have the permission to either assign myself or request reviews. Tagging @PeterHjortLauritzen and @mgduda to take a look at this PR to ensure scientific correctness.

Thanks for the tag! I've just added myself and @PeterHjortLauritzen as reviewers.

@cacraigucar cacraigucar requested a review from nusbaume April 22, 2025 18:26
@PeterHjortLauritzen
Copy link
Collaborator

PeterHjortLauritzen commented Apr 24, 2025

Thank you for implementing this!

As a sanity check I ran an SE CAM7 regression test:

./create_test --output-root /glade/derecho/scratch/pel/ --project P93300042 ERP_D_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_intel.cam-outfrq9s

And "hacked" an MPAS CAM7 regression test:

./create_test --output-root /glade/derecho/scratch/pel/ --project P93300042 ERS_Ln9_P288x1.mpasa120_mpasa120.F2000climo.derecho_intel.cam-outfrq9s_mpasa120

with

./xmlchange CAM_CONFIG_OPTS="-phys CAM7"

and I had to change dust scheme due to an error message:

dust_emis_method = 'Zender_2003'

Note that this run uses L32. I ran the MPAS test for 5 days to avoid any spin-up issues.

Here is VORT4GW for time-step 9 for SE (left) comparred to day 5 for MPAS (right) using same countour interval [-0.0003,0.0003] in the surface level:

Screenshot 2025-04-24 at 9 58 30 AM

Same as above but for top level and top level minus 1, respectively:

Screenshot 2025-04-24 at 10 07 15 AM

Screenshot 2025-04-24 at 10 07 36 AM

The latter two plots seem to show sponge layer damping differences.

In all I think the VORT4GW is scientifically correct. PR approved!

Copy link
Collaborator

@PeterHjortLauritzen PeterHjortLauritzen left a comment

Choose a reason for hiding this comment

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

Looks great ... thank you!

We really need a CAM7 (L58) low top regression test for MPAS. Something like this one:

ERP_D_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_intel.cam-outfrq9s

Would you be willing to add that to this PR? (Jesse and/or Cheryl can help you out if you have questions)

This could save some CPU cycles.
Copy link
Collaborator

@nusbaume nusbaume left a comment

Choose a reason for hiding this comment

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

Thanks @kuanchihwang! I just had one ChangeLog update reminder, but otherwise the PR looks good to me!

Copy link
Collaborator

@cacraigucar cacraigucar left a comment

Choose a reason for hiding this comment

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

This is the reminder (more to me than to you) that a regression test needs to be added or an existing one needs to be modified to test this new feature.

@kuanchihwang
Copy link
Collaborator Author

@cacraigucar I pushed 9fd166e to add a new test for CAM7 low top with MPAS dynamical core. It is an ERS (Exact Restart from Startup) test with the "FHISTC_LTso" compset [1].

The test is quite heavy to run, requiring ~15 minutes of wall time on 128 CPU cores and ~110 GB of memory, so I did not configure it on Izumi.

Let me know if you have other review comments!

@cacraigucar
Copy link
Collaborator

@cacraigucar I pushed 9fd166e to add a new test for CAM7 low top with MPAS dynamical core. It is an ERS (Exact Restart from Startup) test with the "FHISTC_LTso" compset [1].

The test is quite heavy to run, requiring ~15 minutes of wall time on 128 CPU cores and ~110 GB of memory, so I did not configure it on Izumi.

Let me know if you have other review comments!

@kuanchihwang - We typically try to run most of our testing at the coarsest grids and only have a very few at the "realistic" grids. Could this test use your mpasa480_mpasa480 grid instead?

@kuanchihwang
Copy link
Collaborator Author

@cacraigucar CTSM is active in the "FHISTC_LTso" compset. Unfortunately, CTSM does not provide the "flanduse_timeseries" input data [1] for MPAS on the "mpasa480_mpasa480" grid.

Attempting to configure such test will result in an error that shows "No default value found for flanduse_timeseries. Are defaults provided for this resolution and land mask?".

@cacraigucar
Copy link
Collaborator

@cacraigucar CTSM is active in the "FHISTC_LTso" compset. Unfortunately, CTSM does not provide the "flanduse_timeseries" input data [1] for MPAS on the "mpasa480_mpasa480" grid.

Attempting to configure such test will result in an error that shows "No default value found for flanduse_timeseries. Are defaults provided for this resolution and land mask?".

@ekluzek and/or @adamrher - I believe we need to have a CTSM supporting dataset for the mpasa480_mpasa480 grid. Is it possible for us to get this?

@ekluzek
Copy link

ekluzek commented May 2, 2025

@cacraigucar we didn't provide support for a landuse.timeseries file for mpas480 as it isn't in the list in this file:

https://docs.google.com/spreadsheets/d/1Osq56e423CF107zhoNQ0VS7-iH_JXLF9AtCvBdXyfJ4

But, if needed we can add it.

For your testing you might just add the following to user_nl_clm for your tests:

flanduse_timeseries = ' '

@adamrher
Copy link

adamrher commented May 3, 2025

@ekluzek does setting flanduse_timeseries to ' ' tell the model to grab all the surface properties from the fsurdat file?

If so, I think it's fine to do this for testing purposes.

@ekluzek
Copy link

ekluzek commented May 3, 2025

@ekluzek does setting flanduse_timeseries to ' ' tell the model to grab all the surface properties from the fsurdat file?

If so, I think it's fine to do this for testing purposes.

Yes, exactly. It'll just keep surface properties fixed at whatever the fsurdat file has. For testing you probably aren't testing the whole historical period for example. And it just means that if you do run the whole historical period the surface will stay with 1850 conditions. And that's not likely to be a problem for the things you care about in testing CAM.

Also test on Izumi.
For testing purposes, it is fine to set `flanduse_timeseries` to ''. This causes
CTSM to keep surface properties fixed at those specified in `fsurdat`.
@kuanchihwang
Copy link
Collaborator Author

kuanchihwang commented May 5, 2025

@cacraigucar

  1. As discussed above, I pushed 729ca63 to work around missing input data for CTSM on mpasa480 grid.
  2. I pushed bd8f971 to change the test to run on mpasa480 grid instead. As a result, the test requirements have reduced to ~5 minutes of wall time on 128 CPU cores and ~55 GB of memory, which we can now afford to run on Izumi as well.

@cacraigucar cacraigucar changed the title Implement support for moving mountain gravity wave scheme in MPAS dycore cam6_4_091: Implement support for moving mountain gravity wave scheme in MPAS dycore May 7, 2025
@kuanchihwang kuanchihwang merged commit 66d132b into ESCOMP:cam_development May 8, 2025
2 checks passed
@kuanchihwang kuanchihwang deleted the staging/mpas-dycore-mov-mtn-gw branch May 8, 2025 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Tag
Development

Successfully merging this pull request may close these issues.

7 participants