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

Momentum budget terms multiplied by fractional layer-thicknesses #1163

Merged
merged 27 commits into from
Jul 29, 2020

Conversation

hmkhatri
Copy link
Contributor

@hmkhatri hmkhatri commented Jul 18, 2020

New diagnostics, i.e. momentum budget terms (PFu/PFv, CAu/CAv etc.) multiplied by fractional layer thicknesses have been added for momentum budget analysis. Fractional thicknesses are already computed in the barotropic step. These fractional thicknesses are now returned in the btstep subroutine call in the MOM_dynamics_split_RK2 file and are used across different modules to compute required diagnostics.

These depth-integrated budget term diagnostics would be useful in studying barotropic momentum and vorticity budgets, and the depth-integrated budget terms are also implemented in the diagnostics.

@ashao @StephenGriffies @Hallberg-NOAA Could you please review it?

…ed. In these, differet budget terms multiplied by fractional layer thicknesses are saved. Thus, these terms can be added over the whole to obtain the barotropic momentum budget. 'btstep' subroutine in MOM_barotropic module is modified to return fractional thicknesses. Pressure force accelaration multiplied by fractional thickness as diagnostics are added in this commit.
…ative vorticity and gradient of kinetic energy
…y allocated if any of the relevant diagnostics are called.
@codecov-commenter
Copy link

codecov-commenter commented Jul 18, 2020

Codecov Report

Merging #1163 into dev/gfdl will decrease coverage by 0.13%.
The diff coverage is 42.11%.

Impacted file tree graph

@@             Coverage Diff              @@
##           dev/gfdl    #1163      +/-   ##
============================================
- Coverage     46.08%   45.95%   -0.14%     
============================================
  Files           214      224      +10     
  Lines         69399    70428    +1029     
============================================
+ Hits          31984    32363     +379     
- Misses        37415    38065     +650     
Impacted Files Coverage Δ
...g_src/external/GFDL_ocean_BGC/FMS_coupler_util.F90 0.00% <0.00%> (ø)
...fig_src/external/GFDL_ocean_BGC/generic_tracer.F90 0.00% <0.00%> (ø)
...c/external/GFDL_ocean_BGC/generic_tracer_utils.F90 0.00% <0.00%> (ø)
config_src/external/ODA_hooks/kdtree.f90 0.00% <0.00%> (ø)
config_src/external/ODA_hooks/ocean_da_core.F90 0.00% <0.00%> (ø)
config_src/external/ODA_hooks/ocean_da_types.F90 0.00% <0.00%> (ø)
config_src/external/ODA_hooks/write_ocean_obs.F90 0.00% <0.00%> (ø)
config_src/solo_driver/MESO_surface_forcing.F90 0.00% <0.00%> (ø)
config_src/solo_driver/MOM_driver.F90 68.72% <ø> (ø)
config_src/solo_driver/user_surface_forcing.F90 0.00% <0.00%> (ø)
... and 150 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update df33724...b5b3030. Read the comment docs.

@hmkhatri hmkhatri changed the title Momentum budget terms multiplied by factional layer thicknesses Momentum budget terms multiplied by fractional layer-thicknesses Jul 18, 2020
@StephenGriffies
Copy link
Contributor

Thanks for this pull request @hmkhatri.

We spoke about it during the MOM6 developers meeting today, 20 July 2020. @Hallberg-NOAA and @adcroft are happy with the 2d diagnostics. However, they wish to comment out the 3d diagnostics given that we do not know the proper remapping grid option and to retain these diagnostics might confuse future users/developers.

Given that we might need to have these diagnostics for debugging in the future, we recommend commenting them and putting a note in the code at each comment. At some point in the near future, after multiple applications of these diagnostics over some months, then we can remove the commented code. But for the meantime, we should just leave the code but have it commented.

Please make these changes and update your pull request, at which point we will run through the regression tests and move forward with bringing this code into the main trunk.

Thanks again! This is a good step forward with making MOM6 an analyst-friendly code.

… we do not the proper grid remapping option.
@hmkhatri
Copy link
Contributor Author

@StephenGriffies Thanks. I agree that the remapping option could be an issue in 3D diagnostics. As suggested, I have commented 3D diagnostics and put a note in all relevant places.

Copy link
Collaborator

@Hallberg-NOAA Hallberg-NOAA left a comment

Choose a reason for hiding this comment

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

This PR is getting close to where it needs to be, and it will be a valuable addition when it does get there.

However, there are still a few changes that are needed. First, this is still failing some of the the Travis tests, as indicated by the test report toward the bottom of https://github.com/NOAA-GFDL/MOM6/pull/1163. Looking into the details, there are a couple of new variables that are not being described in dOxygen comments, and some of the new line lengths exceed the 120 character MOM6 limit. Fixing these should not be difficult.

Travis is also reporting that the checksums in the files with all diagnostics have changed, but this is acceptable because this commit is introducing new diagnostics and these checksums are supposed to change.

In addition, there are some allocate statements for pointers (hf_rvxu_2d, hv_rvxv_2d, hf_gKEv_2d, and hf_gKEu_2d at least) that do not have corresponding deallocate statements, which could lead to a memory leak. Because these arrays are not used outside of CorAdCalc, they do not need to be pointers - they could be allocatable arrays. Also, since these are only 2-d, the memory-footprint consequences of making these into automatically allocated arrays (like KEx in the same file) would not be too bad. Please look at these and all the other pointers that are being allocated as a part of this commit to make sure that we are not introducing any memory leaks.

I look forward to seeing the updated version with these minor corrections that we can pull onto dev/gfdl. @hmkhatri, I can help guide you through these fixes if any of this is not clear.

@StephenGriffies
Copy link
Contributor

Thanks @Hallberg-NOAA for your careful review. These changes should be straightforward.

@hmkhatri
Copy link
Contributor Author

Thanks for the detailed comments @Hallberg-NOAA. I do not understand what you mean by "dOxygen comments".

I will change 2D arrays from pointer style to allocatable local arrays and deallocate them after use. Just to be sure, I should use the following style and deallocate after use, right?

real, allocatable, dimension(:,:) :: array_u
allocate(array_u(G%IsdB:G%IedB,G%jsd:G%jed))
if (allocated(array_u)) deallocate(array_u)

@StephenGriffies
Copy link
Contributor

Take a look here for documentation of MOM6 code

https://github.com/NOAA-GFDL/MOM6/wiki

In particular, see this page for Doxygen

https://github.com/NOAA-GFDL/MOM6/wiki/Doxygen

@hmkhatri
Copy link
Contributor Author

@Hallberg-NOAA @StephenGriffies Thanks for the comments. I have implemented the suggested changes. All 3D diagnostics are now commented. For 2D diagnostics, allocatable arrays are used for initialization and these arrays are deallocated after the post-data step. All lines are under 120 characters in length.

@adcroft
Copy link
Collaborator

adcroft commented Jul 27, 2020

Copy link
Collaborator

@Hallberg-NOAA Hallberg-NOAA left a comment

Choose a reason for hiding this comment

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

Thank you for the revisions to this PR. They have neatly addressed all of the previous issues, and I am now happy to approve this PR.

@Hallberg-NOAA
Copy link
Collaborator

This passed pipeline testing at https://gitlab.gfdl.noaa.gov/ogrp/MOM6/-/pipelines/10886 . It changes the contents of the MOM_parameter_doc files, so there will need to be an update to MOM6-examples after this PR is resolved on the MOM6 repository.

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.

5 participants