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

Add vertical remap feature #6

Merged

Conversation

cbegeman
Copy link
Collaborator

@cbegeman cbegeman commented Jul 15, 2021

This PR adds the option for vertical Lagrangian remapping (VLR). The idea behind VLR is to allow the vertical interfaces between layers to evolve in a Lagrangian fashion, bypassing the Eulerian vertical advection scheme and removing the vertical CFL limit. The layer interfaces are then remapped to a target grid every interval of timesteps. Griffies et al. (2020) provides an overview of VLR.

This development includes the following features:

  • A new vertical remapping module mpas_ocn_vertical_remap.F
  • Adds PPR library as a submodule https://github.com/dengwirda/PPR, used to perform conservative remapping
  • Config options for remapping: the order of remapping, the remapping interval, the remapping limiter
  • A diagnostic output file containing remapping-related variables
  • Computation of the Eulerian vertical velocity, which is nonzero at timesteps at which regridding and remapping occur
  • Vertical tracer advection budget terms must be computed after this Eulerian vertical velocity is computed. Thus, for the remapping case this computation is performed (as usual) in ocn_tracer_advection_mono_tend, where the vertical terms are zero, and repeated in diagnostics after remapping, where these terms may be nonzero.
  • As noted below, roughly 20% of runtime is spent remapping when remapping occurs every timestep. However, in most realistic cases remapping at intervals of 3-5 timesteps are acceptable, reducing performance decreases to ~5%.
  • VLR is currently only supported for split-explicit time integrator
  • Regridding is hard-coded as z-star. Support for alternate grids is planned.

@cbegeman cbegeman force-pushed the ocn/add-vertical-remap-feature branch 4 times, most recently from c6198ed to 8a26320 Compare July 23, 2021 00:34
@cbegeman
Copy link
Collaborator Author

cbegeman commented Aug 3, 2021

For the baroclinic channel test case, vertical remap solution is very similar to the flux-form vertical advection scheme after 12h, with 3-5% increase in run time on 4 cores:

  • max difference in sa field (constant): 1e-13
  • max difference in pt field: 1e-2
  • max difference in uNormal field: 1e-2
  • max difference in ssh field: 1e-4 (right panel below)
  • left panel shows the diasurface velocity which should be 0, w=-div(hu)+dh_lagrangian computed in diagnostics
    vert_remap_baroclinic_channel

@cbegeman cbegeman force-pushed the ocn/add-vertical-remap-feature branch 2 times, most recently from 379bd73 to 94ba6d9 Compare August 31, 2021 00:29
@cbegeman cbegeman force-pushed the ocn/add-vertical-remap-feature branch from 2665a0c to af336d2 Compare October 21, 2021 18:13
@cbegeman cbegeman force-pushed the ocn/add-vertical-remap-feature branch 3 times, most recently from 527084c to 3e8a3ff Compare February 1, 2022 19:48
@xylar
Copy link
Collaborator

xylar commented Feb 1, 2022

@cbegeman, would it be helpful if I update E3SM-Ocean-Discussion/master to match E3SM/master so you don't see a bunch of extraneous commits here?

@xylar xylar changed the base branch from master to alternate February 1, 2022 20:07
@xylar xylar changed the base branch from alternate to master February 1, 2022 20:07
@xylar
Copy link
Collaborator

xylar commented Feb 1, 2022

I changed the base (target) of the PR to alternate and changed it back to master, and it looks fine now.

@cbegeman
Copy link
Collaborator Author

cbegeman commented Feb 1, 2022

@xylar Great, thanks!

@cbegeman cbegeman force-pushed the ocn/add-vertical-remap-feature branch 2 times, most recently from 3a0ed1f to b9acbef Compare February 2, 2022 23:26
@cbegeman
Copy link
Collaborator Author

cbegeman commented Feb 3, 2022

Tracer budgets were tested with the isomip_plus/5km/z-star/Ocean0 case. Shown below are temperature budget terms after 1 day integration. Note that only the black terms corresponding to activeTracerVerticalAdvectionTendency and activeTracerVerticalAdvectionTopFlux are computed differently in the VLR case.
sections_remap_tend
sections_remap_topflux1_z

@cbegeman cbegeman force-pushed the ocn/add-vertical-remap-feature branch from b9acbef to 406076e Compare February 3, 2022 01:20
@cbegeman
Copy link
Collaborator Author

cbegeman commented Feb 3, 2022

For both baroclinic_channel/4km/rpe_test and isomip_plus/2km/z-star/Ocean0/performance cases, 90% of the remap time was spent in the rmap_1d ppr call. Both cases spend 20% of total simulation time remapping, when remapping occurs every timestep.

This suggests future performance work should focus on ppr routines themselves and/or exploring batch inputs to rmap_1d (currently there is one call to rmap_1d per cell/edge).

@xylar
Copy link
Collaborator

xylar commented Feb 3, 2022

@cbegeman, in terms of testing fraction of the runtime use in remapping, the pefromance test case from ISOMIP+ might actually be a little too short. It might be worth running more time steps (say 10x the default) and seeing if the remapping is still a tiny fraction of the runtime. I could imagine that might account for some of the difference between the RPE test and ISOMIP+ -- a smaller fraction of the total time is spent just in initialization and such when you run many more time steps.

@cbegeman cbegeman force-pushed the ocn/add-vertical-remap-feature branch from 406076e to 3aa9ec5 Compare February 3, 2022 18:48
@cbegeman
Copy link
Collaborator Author

cbegeman commented Feb 3, 2022

@cbegeman, in terms of testing fraction of the runtime use in remapping, the pefromance test case from ISOMIP+ might actually be a little too short. It might be worth running more time steps (say 10x the default) and seeing if the remapping is still a tiny fraction of the runtime. I could imagine that might account for some of the difference between the RPE test and ISOMIP+ -- a smaller fraction of the total time is spent just in initialization and such when you run many more time steps.

Thanks for pointing that out. I ran it for 10 days and remapping now takes about 20% of the run time, consistent with the other test case.

@cbegeman
Copy link
Collaborator Author

cbegeman commented Feb 3, 2022

Following discussion with @dengwirda and @xylar we have decided not to support VLR for RK4.

VLR for RK4, implemented here, has demonstrated instabilities after a few timesteps for both baroclinic_channel and internal_wave test cases.

@cbegeman cbegeman force-pushed the ocn/add-vertical-remap-feature branch 2 times, most recently from eb7397b to 63f448e Compare February 4, 2022 16:28
…Project#4988)

Align E3SM with fates api 22.1 and api 23.
Update the optical parameters in the fates parameter
file (https://github.com/ESCOMP/CTSM/releases/tag/ctsm5.1.dev084) and
the additional of logic in elmfates_interfaceMod to set the decomposition type via a new decomp_method parameter.

[non-BFB] for FATES
@cbegeman cbegeman force-pushed the ocn/add-vertical-remap-feature branch 3 times, most recently from d44aa01 to 6e34a3d Compare June 27, 2022 20:38
xylar and others added 22 commits June 27, 2022 14:39
- Add config option to turn remap on/off
- Add config option for advection, remap order
- Add config option for target grid
- Only call vert_transport_top if advection_method is flux-form
- Construct opts for remapping using config options
- vertAleTransportTop = 0 so no vertical velocity during
  momentum solve
- Add computation of vertVelocity from lagrangian
  layerThickness to diagnostics routines
- Add option for WENO slope limiter
- Fixup config name for vertical tracer adv order
- Add option for remapping every interval number of timesteps
- Update namelist entries
- Add checks on config options
@cbegeman cbegeman force-pushed the ocn/add-vertical-remap-feature branch from 6e34a3d to e30698f Compare June 27, 2022 20:39
@xylar xylar merged commit 62b021e into E3SM-Ocean-Discussion:master Jul 1, 2022
mark-petersen pushed a commit that referenced this pull request May 31, 2023
cee/15.0.0 with GPU MPI buffers can crash in a system lib like this:

#4  0x00007fffe159e35b in (anonymous namespace)::do_free_with_callback(void*, void (*)(void*)) [clone .constprop.0] () from /opt/cray/pe/cce/15.0.0/cce/x86_64/lib/libtcmalloc_minimal.so.1
#5  0x00007fffe15a8f16 in tc_free () from /opt/cray/pe/cce/15.0.0/cce/x86_64/lib/libtcmalloc_minimal.so.1
#6  0x00007fffe99c2bcd in _dlerror_run () from /lib64/libdl.so.2
#7  0x00007fffe99c2481 in dlopen@@GLIBC_2.2.5 () from /lib64/libdl.so.2
#8  0x00007fffea7bce42 in _ad_cray_lock_init () from /opt/cray/pe/lib64/libmpi_cray.so.12
#9  0x00007fffed7eb37a in call_init.part () from /lib64/ld-linux-x86-64.so.2
#10 0x00007fffed7eb496 in _dl_init () from /lib64/ld-linux-x86-64.so.2
#11 0x00007fffed7dc58a in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
#12 0x0000000000000001 in ?? ()
#13 0x00007fffffff42e7 in ?? ()
#14 0x0000000000000000 in ?? ()

Work around this by using cee/14.0.3.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.