Skip to content

Aquaplanet external gravity wave#187

Closed
jeremy-lilly wants to merge 25 commits into
E3SM-Project:mainfrom
jeremy-lilly:aquaplanet-external-gravity-wave
Closed

Aquaplanet external gravity wave#187
jeremy-lilly wants to merge 25 commits into
E3SM-Project:mainfrom
jeremy-lilly:aquaplanet-external-gravity-wave

Conversation

@jeremy-lilly
Copy link
Copy Markdown
Contributor

This PR creates a new ocean task for testing the temporal convergence rate of time-stepping schemes in MPAS-O. The case is that of a simple external gravity wave on an aquaplant. The normal velocity is initialized to zero and the layer thickness is initialized as a Gaussian bump.

The user selects a time-stepping scheme and a series of time-steps to run the test. The first listed time-step will be used to produce a reference solution that other runs will be compared to.

The PR also implements a version of the task for LTS schemes, in particular for the new FB-LTS scheme from this PR: E3SM-Project/E3SM#6224. Convergence plots produced by this task for FB-LTS are given below.

convergence_layerThickness
convergence_normalVelocity

Note that the external gravity wave case was chosen so as to have as few terms in the tendencies as possible -- because of this, both the LTS and FB-LTS schemes show their "true" order of convergence, rather than the first order convergence caused by the operator splitting that both the LTS and FB-LTS codes implement.

Checklist

  • User's Guide has been updated
  • Developer's Guide has been updated
  • API documentation in the Developer's Guide (api.md) has any new or modified class, method and/or functions listed
  • Documentation has been built locally and changes look as expected
  • Testing comment in the PR documents testing used to verify the changes
  • New tests have been added to a test suite

@mark-petersen mark-petersen added ocean Related to the ocean component E3SM PR required The polaris changes won't work with the current E3SM-Project submodule and require an update labels Mar 11, 2024
@mark-petersen
Copy link
Copy Markdown
Contributor

mark-petersen commented Mar 11, 2024

@jeremy-lilly thanks for your work on this, it looks beautiful! Could you add a documentation page to the user's guide, similar to this?
https://github.com/E3SM-Project/polaris/blob/main/docs/users_guide/ocean/tasks/inertial_gravity_wave.md
Also, it is best if the history is just simple commits on some recent branchpoint from main. It looks like you pulled from main here. Could you fix that?

@mark-petersen
Copy link
Copy Markdown
Contributor

Trying it out:

./configure_polaris_envs.py  --conda /usr/projects/climate/mpeterse/miconda3
source load_dev_polaris_0.3.0-alpha.1_chicoma-cpu_gnu_mpich.sh
polaris list
...
  45: ocean/spherical/icos/ext_grav_wav_local_time_step
  46: ocean/spherical/icos/ext_grav_wav_global_time_step
  47: ocean/spherical/qu/ext_grav_wav_local_time_step
  48: ocean/spherical/qu/ext_grav_wav_global_time_step

polaris setup -p ~/repos/E3SM/lts-fb-jer-pr/components/mpas-ocean -w $r/230311_polaris_ext_grav_wave -n 45 46 47 48

salloc -N 1 -t 2:0:0 --qos=debug --reservation=debug --account=t24_coastal_ocean
source load_dev_polaris_0.3.0-alpha.1_chicoma-cpu_gnu_mpich.sh
cd $r/230311_polaris_ext_grav_wave
polaris serial

This worked similarly on chicoma, perlmutter, and chrysalis. I am using a compiled executable from E3SM-Project/E3SM#6224.

Output is as follows:

(dev_polaris_0.3.0-alpha.1) pm:230311_ltsfb_test_polaris$ polaris serial
ocean/spherical/icos/ext_grav_wav_local_time_step
  * step: icos_base_mesh_120km
          execution:        SUCCESS
          runtime:          0:00:40
  * step: icos_init_120km_local_time_step
          execution:        SUCCESS
          runtime:          0:00:01
  * step: icos_init_lts_120km_local_time_step
          execution:        SUCCESS
          runtime:          0:00:15
  * step: icos_forward_120km_local_time_step_10s
          execution:        SUCCESS
          runtime:          0:01:17
  * step: icos_forward_120km_local_time_step_120s
          execution:        SUCCESS
          runtime:          0:00:13
  * step: icos_forward_120km_local_time_step_240s
          execution:        SUCCESS
          runtime:          0:00:25
  * step: icos_forward_120km_local_time_step_480s
          execution:        SUCCESS
          runtime:          0:00:44
  * step: analysis
          execution:        SUCCESS
          runtime:          0:00:07
  task execution:   SUCCESS
  task runtime:     0:03:42
ocean/spherical/icos/ext_grav_wav_global_time_step
  * step: icos_base_mesh_120km
          already completed
  * step: icos_init_120kmglobal_time_step
          execution:        SUCCESS
          runtime:          0:00:00
  * step: icos_forward_120km_global_time_step_10s
          execution:        SUCCESS
          runtime:          0:01:17
  * step: icos_forward_120km_global_time_step_120s
          execution:        SUCCESS
          runtime:          0:00:17
  * step: icos_forward_120km_global_time_step_240s
          execution:        SUCCESS
          runtime:          0:00:12
  * step: icos_forward_120km_global_time_step_480s
          execution:        SUCCESS
          runtime:          0:00:15
  * step: analysis
          execution:        SUCCESS
          runtime:          0:00:07
  task execution:   SUCCESS
  task runtime:     0:02:08
ocean/spherical/qu/ext_grav_wav_local_time_step
  * step: qu_base_mesh_120km
          execution:        SUCCESS
          runtime:          0:00:17
  * step: qu_init_120km_local_time_step
          execution:        SUCCESS
          runtime:          0:00:00
  * step: qu_init_lts_120km_local_time_step
          execution:        SUCCESS
          runtime:          0:00:15
  * step: qu_forward_120km_local_time_step_10s
          execution:        SUCCESS
          runtime:          0:01:18
  * step: qu_forward_120km_local_time_step_120s
          execution:        SUCCESS
          runtime:          0:00:12
  * step: qu_forward_120km_local_time_step_240s
          execution:        SUCCESS
          runtime:          0:00:17
  * step: qu_forward_120km_local_time_step_480s
          execution:        SUCCESS
          runtime:          0:00:08
  * step: analysis
          execution:        SUCCESS
          runtime:          0:00:06
  task execution:   SUCCESS
  task runtime:     0:02:34
ocean/spherical/qu/ext_grav_wav_global_time_step
  * step: qu_base_mesh_120km
          already completed
  * step: qu_init_120kmglobal_time_step
          execution:        SUCCESS
          runtime:          0:00:00
  * step: qu_forward_120km_global_time_step_10s
          execution:        SUCCESS
          runtime:          0:01:14
  * step: qu_forward_120km_global_time_step_120s
          execution:        SUCCESS
          runtime:          0:00:11
  * step: qu_forward_120km_global_time_step_240s
          execution:        SUCCESS
          runtime:          0:00:08
  * step: qu_forward_120km_global_time_step_480s
          execution:        SUCCESS
          runtime:          0:00:07
  * step: analysis
          execution:        SUCCESS
          runtime:          0:00:04
  task execution:   SUCCESS
  task runtime:     0:01:45
Task Runtimes:
0:03:42 PASS ocean/spherical/icos/ext_grav_wav_local_time_step
0:02:08 PASS ocean/spherical/icos/ext_grav_wav_global_time_step
0:02:34 PASS ocean/spherical/qu/ext_grav_wav_local_time_step
0:01:45 PASS ocean/spherical/qu/ext_grav_wav_global_time_step
Total runtime: 0:10:17
PASS: All passed successfully!

with plots identical to those above. Beautiful!

Comment thread docs/users_guide/quick_start.md
Copy link
Copy Markdown
Collaborator

@xylar xylar left a comment

Choose a reason for hiding this comment

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

@jeremy-lilly, this looks great! The main thing I noticed is that documentation is missing. Please ping me to review again once that gets added.

In the meantime, a few other small comments.

Comment thread polaris/ocean/convergence/convergence.cfg Outdated
Comment on lines +152 to +155
dt_btr_scaling = section.getfloat('dt_btr_scaling')
dt_btr = self.dt / dt_btr_scaling
btr_dt_str = get_time_interval_string(seconds=dt_btr *
self.resolution)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't think we can make this change without also updating any test cases that already use the split time stepping to use this approach. Maybe none are so far in which case maybe this will be fine.

Copy link
Copy Markdown
Contributor Author

@jeremy-lilly jeremy-lilly May 9, 2025

Choose a reason for hiding this comment

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

I didn't originally add this, and I'll admit I'm a little lost as to where it is used/needed. Maybe best to address this part when we merge/rebase to account for any cases that were added in the last year?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Okay, let's see what a rebase turns up. Hopefully, you don't need to make any framework-level changes like this one. If you do, the issue remains that we'll have to make sure other test cases aren't affected.

Copy link
Copy Markdown
Collaborator

@cbegeman cbegeman left a comment

Choose a reason for hiding this comment

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

Fantastic work here! I made a few comments and suggestions. Don't feel like you have to do all the things I suggested if you don't have the time. Also, I made most of the comments before Xylar posted his, so pardon any conflicting messaging there!

I ran the non-LTS case successfully with E3SM master.

Many of the suggestions have to do with making the convergence framework changes a bit more intuitive since we originally wrote the code for space and time convergence together. It will be great to have the option to evaluate time convergence separately with your changes.

Comment thread polaris/ocean/convergence/analysis.py Outdated
Comment thread polaris/ocean/convergence/analysis.py Outdated
error.append(error_res)
else:
for i in range(1, len(dts)):
mesh_name = resolution_to_subdir(resolutions[0])
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this implying that when dts is specified, we are evaluating convergence in time only (and all steps must use the mesh at resolutions[0])? If so, I think we should put in some safeguards so that this function cannot be used incorrectly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You are correct -- I added a note about this to the definition of dts to the docstring. Off of the top of my head, I'm not sure how to further safeguard against this being misused, but I'm happy to add something if anyone has ideas.

Comment thread polaris/ocean/convergence/analysis.py Outdated
Comment thread polaris/ocean/convergence/forward.py Outdated
Comment thread polaris/ocean/tasks/external_gravity_wave/forward_global_time_step.yaml Outdated
@@ -0,0 +1,81 @@
omega:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It can be nice to have one file forward.yaml that has the config options common to both global and local time stepping and then either/both of forward_global_time_step.yaml and forward_local_time_step.yaml that contain the options that are specific to each.

Copy link
Copy Markdown
Contributor Author

@jeremy-lilly jeremy-lilly May 9, 2025

Choose a reason for hiding this comment

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

Agreed! Would you be able to point me to an example of where this is done for another test case? Thanks!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This example from a draft PR of mine is close to what I have in mind:

self.add_yaml_file('polaris.ocean.tasks.drying_slope',
'forward.yaml')
options = dict()
if coord_type == 'single_layer':
self.add_yaml_file('polaris.ocean.config', 'single_layer.yaml')

Comment thread polaris/ocean/tasks/external_gravity_wave/init.py Outdated
Comment thread polaris/ocean/tasks/external_gravity_wave/lts_regions.py Outdated
Comment thread polaris/ocean/tasks/external_gravity_wave/lts_regions.py
@jeremy-lilly
Copy link
Copy Markdown
Contributor Author

@xylar, @cbegeman, @mark-petersen -- thank you all for your comments and suggestions! Just wanted to let you know that I saw these and that they are on my to-do list, but I might not get to them right away. I will ping everyone when ready for a second look : ) Thanks!

@jeremy-lilly jeremy-lilly force-pushed the aquaplanet-external-gravity-wave branch from 7ce4884 to 03c72f0 Compare March 15, 2024 23:11
@xylar
Copy link
Copy Markdown
Collaborator

xylar commented May 9, 2025

@jeremy-lilly, I know you're a busy guy but I'm wondering if this is something we should revive after more than a year or if it should go into draft mode to indicate that it needs more time.

@jeremy-lilly
Copy link
Copy Markdown
Contributor Author

Hey @xylar, thanks for the reminder about this! I took some time to address most of the remaining comments. I'll close the ones I think are handled and leave comments on others.

Before getting too much further, do you prefer that we rebase this PR on to the current head of main, or or do you prefer that we merge the two branches?

@xylar
Copy link
Copy Markdown
Collaborator

xylar commented May 9, 2025

@jeremy-lilly, I would much prefer a rebase. Thanks for checking on that. A lot has changed in a year so let me know if you run into problems you can't quite figure out. I would imagine @cbegeman may also be up for helping out, and she would be a good resource since she wrote most of the convergence infrastructure.

Co-authored-by: Carolyn Begeman <cbegeman@lanl.gov>
@cbegeman
Copy link
Copy Markdown
Collaborator

@jeremy-lilly Yes, happy to help. Let me know if there are questions that come up that I can help answer during/after the rebase.

@jeremy-lilly
Copy link
Copy Markdown
Contributor Author

@xylar, @cbegeman, I did a local rebase, but since so much has changed in the underlying Polaris infrastructure and this PR makes a lot of changes to the infrastructure, I think the easiest thing will be to close this PR and rebuild the test case on top of modern Polaris. I've started that process here, and I'll open a new PR when it is ready.

@xylar
Copy link
Copy Markdown
Collaborator

xylar commented May 14, 2025

Yes, I could imagine that being easier.

@jeremy-lilly jeremy-lilly mentioned this pull request May 23, 2025
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

E3SM PR required The polaris changes won't work with the current E3SM-Project submodule and require an update ocean Related to the ocean component

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants