-
Notifications
You must be signed in to change notification settings - Fork 57
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
Calculating online self-attraction and loading with spherical harmonic transforms #210
Calculating online self-attraction and loading with spherical harmonic transforms #210
Conversation
Codecov Report
@@ Coverage Diff @@
## dev/gfdl #210 +/- ##
============================================
- Coverage 37.20% 37.11% -0.10%
============================================
Files 262 263 +1
Lines 72871 73062 +191
Branches 13619 13644 +25
============================================
+ Hits 27112 27114 +2
- Misses 40743 40929 +186
- Partials 5016 5019 +3
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
29cfa68
to
3f37f14
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an important new contribution to MOM6, and it is substantially complete and correct. I can envision a number of extensions or refinement to these new capabilities, but for now I think that this should be accepted into MOM6 as it is.
This is an initial step to add the functionality of calculating self-attraction and loading (SAL) with the spherical harmonic transform (SHT) method. The code in this commit is a direction translation and adoption of the "parallel SAL" from MPAS-Ocean model developed at the Department of Energy's Los Alamos National Laboratory (Barton et al. (2022) and Brus et al. (2022)). This commit serves as an "MVP" so that the MPAS-Ocean algorithm is functional in MOM6. Further refactor, optimization and documentation should be put in place. * A new module MOM_spherical_harmonics is introduced to house precomputed coefficients used for SHT. * New subroutines are added in module MOM_tidal_forcing for calculating SAL with the SHT method.
The actual calculation of SHT is stripped out of the tidal SAL subroutine to make module MOM_spherical_harmonics self-contained. * Forward and inverse spherical harmonic transform calculations are imported from MOM_tidal_forcing module, as two new subroutines are in module MOM_spherical_harmonics. This generalization allows the spherical harmonic transforms to applications other than SSH based SAL. * The main loops in the two new subroutine are also simplified. * Child variables in the control structure for SHT are now private. * The associated Legendre polynomials in the diagonal (n=m) is now precomputed and stored, rather than recalculating at every step. This does not have the memory cost as fully precomputing all the polynomials, but still reduces some repeat calculations. The performance appears to be improved with this change. * SAL calculation is simplified as forward transform, scaling and inverse transform. * A few variables names inherited from MPAS-O are changed.
* A new module is introduced with the sole purpose of storing Love numbers. This makes module MOM_tidal_forcing less chunkier and easier to read. * A new function in module MOM_spherical_harmonics is introduced to calculate the starting index of the first element for each order m, replacing a previous function of a similar purpose but a bit more complicated.
* Option to do reproducing sums for forward spherical harmonic transform is added, which is controlled by a runtime parameter. * New timers are added to monitor the performance of the more expensive global sum.
* Associated Legendre polynomials calculation is vectorized. * Some redundant variables are removed. * Fix filename suffix for module MOM_spherical_harmonics
* In MOM_tidal_forcing module, spherical harmonic coefficients (for SAL) are now parts of tidal_forcing_CS to avoid repeated allocations. The same applies to the Love number scaling factors. * Allocations for arrays used for reproducing sums are moved to subroutine spherical_harmonics_init in the MOM_spherical_harmonics module.
* Documentations are added for all modules related to SHT SAL. References from the MPAS-O group will need to be updated once they are published. * Variables names are shortened and changed to follow MOM6 style. (from camel to snake) * Change RhoE and RhoW in Love number scaling to runtime parameters * Correct a bug in a_recur size * Local arrays in SHT subroutines are properly initialized.
* Love number scaling coefficients multiplication is re-ordered to avoid ambiguity and to follow MOM6 style. * Coefficients for Pmm is simplified. Both changes introduce bit-wise level answer change to previous SHT SAL related unpublished commits. * Patches for Doxygen
3f37f14
to
2c81958
Compare
This PR has passed pipeline testing at https://gitlab.gfdl.noaa.gov/ogrp/MOM6/-/pipelines/17073. All answers in existing test cases are bitwise identical, but there is a new runtime parameter, so the MOM_parameter_doc files have changed. |
This PR adds the functionality of computing tidal self-attraction and loading (SAL) with spherical harmonic transforms (SHT). This is a loose adoption of the same functionality from the Model for Prediction Across Scales (MPAS)-Ocean developed by Los Alamos National Laboratory and University of Michigan (Barton et al. (2022) and Brus et al. (2022)).
The SAL term is calculated in a "brute-force" way by directly calculating the spherical harmonic transforms.
Two new modules are introduced.
MOM_spherical_harmonics
is a self-contained module to include all functions related to SHT, instead of embedded in the tidal module. It gives the flexibility to use SHT for any field.MOM_load_love_number
contains only a hard-code 4x1441 data array. This setup makes sure the tidal module is not getting overly inflated.One module is modified.
Module
MOM_tidal_forcing
is modified for obvious reasons. At the moment, SAL calculation (either the scalar approximation or the added SHT methods) is embedded in the tidal forcing module. It would probably make sense to separate them out in the future, as the SAL effect is not necessarily limited to tides.