Adds option to homogenize forces and fluxes fields#1541
Conversation
breichl
commented
Nov 8, 2021
- Adds functions to do global averages on U and V grids in MOM_spatial_means
- Adds functionality to average all forcing and fluxes fields in MOM_forcing_types
- Adds flag to average all forcing and fluxes in MOM.F90
- This new feature is primarily for running in single column like configurations with the coupler, which requires perfectly equal forcing across all cells.
- Adds functions to do global averages on U and V grids in MOM_spatial_means - Adds functionality to average all forcing and fluxes fields in MOM_forcing_types - Adds flag to average all forcing and fluxes in MOM.F90 - This new feature is primarily for running in single column like configurations with the coupler, which requires perfectly equal forcing across all cells.
|
This code is meant to replace #1480 @Hallberg-NOAA let me know what you think of these changes. I still have testing and some functionality to complete, but I wanted to get your opinion on these changes compared to the original PR. One thing I'm unsure of is the best way to average ustar in the fluxes routine. In forces it is fine, since we have taux and tauy. The options I can think of so far to get the correct ustar in fluxes are (1) to recompute the fluxes ustar from forces by passing forces to the fluxes homogenization routine, (2) to add the stress information (perhaps at h-points) to fluxes structure. I also need to either add functionality to read the gustiness or add the gustiness factor into the forces control structure. |
Codecov Report
@@ Coverage Diff @@
## dev/gfdl #1541 +/- ##
============================================
- Coverage 29.15% 29.09% -0.07%
============================================
Files 239 239
Lines 71533 71698 +165
============================================
+ Hits 20855 20858 +3
- Misses 50678 50840 +162
Continue to review full report at Codecov.
|
- Adds in irho0 and sqrt that were missing in homogenize mech forcing.
|
I think that this PR is a great improvement over its predecessor, and I like the general direction it is going. There are a few comments or issues that I see with this.
|
- Correct issues in global_area_mean_u and global_area_mean_v to work with symmetric and rotated grids. - Add options to compute mean ustar or compute ustar from mean tau. - Add subroutines to replace averaging blocks in MOM_forcing_type.
breichl
left a comment
There was a problem hiding this comment.
I caught a couple formatting issues here and wanted to raise two other issues here.
| if (do_iceberg) then | ||
| call rotate_array(fluxes_in%ustar_berg, turns, fluxes%ustar_berg) | ||
| call rotate_array(fluxes_in%area_berg, turns, fluxes%area_berg) | ||
| !BGR: pretty sure the following line isn't supposed to be here. |
There was a problem hiding this comment.
I noticed this is a repeat of code above. I think it is unintentional.
| if (associated(fluxes%ustar_tidal)) & | ||
| call homogenize_field_t(fluxes%ustar_tidal, G) | ||
|
|
||
| ! TODO: tracer flux homogenization |
There was a problem hiding this comment.
I don't know if this is worth addressing before taking this PR?
|
|
||
| tmpForSumming(:,:) = 0. | ||
| do J=js,je ; do i=is,ie | ||
| tmpForSumming(i,j) = G%areaT(i,j)/max(1.e-20,& |
There was a problem hiding this comment.
In this expression, I think that we would prefer to have division at the end, or else put parentheses around the area divided by the masks, so that someone reading the code does not need to remember the order of precedence in Fortran between multiplication and division (they are the same), or whether the Fortran order of operations goes left to right or right to left. The same comment would apply in global_area_mean_u().
There was a problem hiding this comment.
The most recent code push should address this.
Thanks for the review and suggestions, @Hallberg-NOAA. I think I've fixed (1) based on our discussion offline. It now interpolates u/v point variables to tracer points and does the averaging there. I don't have a test for this yet. I've added options for (2) to either compute ustar from the mean tau or as the mean of ustar. We cannot include gustiness at this point; it could be added but would require either a new get_param or passing it to the forces module via each cap. Since it is not clear how to do it and not clear that we need it I've put that decision off for now. For (3) I've added three new subroutines to do the averaging now, which indeed reduces the file lengths. |
- Move a division and reformat alignment in MOM_spatial_means.F90. - Remove a unused parameter in MOM_forcing_type.F90 - Reformat misalignment of an "if-block" in MOM_forcing_type.F90
|
@nikizadehgfdl can you try this at some point in your workflow? It is a little different than the previous attempt, but I believe will have the same functionality. The replacement parameter to activate homogenized forcing with this code will be "HOMOGENIZE_FORCINGS = True" |