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

Diagnostic fixes to speed, dudt, and dvdt #931

Merged
merged 3 commits into from
May 31, 2019

Conversation

marshallward
Copy link
Collaborator

The speed diagnostic was incorrect on non-symmetric grids, due to missing u and v values on the west and south boundaries. This was fixed by explicitly extending loops from IscB to isc-1 and JscB to jsc-1, i.e. iterating over the same indices for both grid types.

The dudt and dvdt loops were incorrect on symmetric grids, due to pointer arrays being incorrectly 1-indexed. This did not affect non-symmetric grids, which already start at 1. But symmetric grids, which start at 0, were offsetting all values to the west (for u) or south (for v) by one, and omitting the eastmost or northmost values. The dhdt diagnostic was unaffected, since h-points are unchanged across symmetric and non-symmetric.

These commits will change the values of these diagnostics, but the dynamics are bitwise reproducible.

Recent testing showed a difference in the time derivative diagnostics
dudt, dvdt, dhdt for symmetric and non-symmetric grids.  The issue
appears to be be due to assumed 1-indexing within the
`register_time_deriv` functions of MOM_diagnostics, due to use of
pointers without explicit start index.  This was causing an error in
`calculate_derivs`, which assume standard grid indexing.

There was no error in non-symmetric mode, which assumes 1-indexing (when
global indexing is disabled, as default), but was creating off-by-one
errors in symmetric mode for the u and v time derivaties, which
typically start at 0 for the x and y axes, respectively.  The dhdt
diagnostic was unaffected, since h-points always use 1-indexing.

This also affected the dKE/dt diagnostic, since they used dudt and dvdt.

We resolve this by introducing a lower bound input argument to
`register_time_deriv` and use this to define the start index for the
various p3d pointers.

This is a minor API change which only affects the dudt, dvdt, and dhdt
diagnostics, and may change the dudt and dvdt symmetric grid diagnostics.
The speed diagnostic currently requires an interpolation of u and v onto
the h-points.  On non-symmetric grids, this was causing an error on the
west and south boundaries, since the compute loops in
`extract_surface_state` did not update the boundaries, which are used in
the speed calculation.

We resolve this by extending the loops from G%IscB, which only includes
the boundary on symmetric grids, to isc-1, which always include the
boundaries.  This assumes a nonzero halo, and that the halos of u and v
have been updated.
@marshallward
Copy link
Collaborator Author

Tests are running here: https://gitlab.gfdl.noaa.gov/ogrp/MOM6/pipelines/8178

@marshallward marshallward changed the title Diagnostic fixes to speed, dudt, and dvdt Diagnostic fixes to speed, dudt, and dvdt May 30, 2019
@marshallward
Copy link
Collaborator Author

GitLab PR tests have all passed.

@adcroft adcroft merged commit 7cfb69b into mom-ocean:dev/gfdl May 31, 2019
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.

2 participants