-
Notifications
You must be signed in to change notification settings - Fork 62
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
Update MOM_mixed_layer_restrat.F90 #568
Update MOM_mixed_layer_restrat.F90 #568
Conversation
I think this addresses the issues raised in #532 and #542. Authorship of @amoebaliz was preserved, with @kshedstrom and myself added as co-authors. |
c945458
to
cd69215
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev/gfdl #568 +/- ##
=========================================
Coverage 37.20% 37.20%
=========================================
Files 271 271
Lines 80457 80473 +16
Branches 15002 15005 +3
=========================================
+ Hits 29932 29943 +11
- Misses 44958 44960 +2
- Partials 5567 5570 +3 ☔ View full report in Codecov by Sentry. |
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.
I seem to have changed something which let |
dd160e0
to
63136f1
Compare
The splitting of the loop to accommodate the new ANSWER_DATE caused I removed most of the explicit dimension scalings in the diag formula, which should no longer be needed since the new |
Thanks Marshall!
…On Fri, Feb 9, 2024 at 12:28 PM Marshall Ward ***@***.***> wrote:
The splitting of the loop to accommodate the new ANSWER_DATE caused
u_star3 and w_star3 to be unassigned and to lose their Z3/T3 dimensional
corrections. These have now been fixed. (They will probably be squashed,
assuming everything looks correct.)
I removed most of the explicit dimension scalings in the diag formula,
which should no longer be needed since the new cuberoot() preserves
dimensions and we don't need to accomodate it anymore. But I may have
bungled up some Z's and H's here and it may need some further review.
—
Reply to this email directly, view it on GitHub
<#568 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD6PXJHWORQ2HSVUB3PQXVTYSZMDBAVCNFSM6AAAAABDAE4SYCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZWGMYTGMRUGU>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I am kind of baffled about the dimension error here. There's a Z^3 missing somewhere, but everything else is passing, and I don't know how that is possible. I'm also unable to replicate these dimensional errors when I run locally. |
63136f1
to
4dd2e69
Compare
Dimensions of Z2/H seemed to have fixed it. I am still confused about the units of ustar, but in the context of this module I can see that it's consistent. |
This need a new review from @Hallberg-NOAA when he gets back from leave. |
|
||
lf_bodner_diag(i,j) = & | ||
0.25 * cuberoot(CS%mstar * u_star3 + CS%nstar * w_star3)**2 & | ||
/ (f2_h * max(little_h(i,j), GV%Angstrom_H)) |
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.
In order to convert this to units of [L ~> m]
, the denominator should be multiplied by (US%L_to_Z * GV%H_to_RZ* tv%SpV_avg(i,j,1))
when in fully non-Boussinesq mode or in Boussinesq mode the denominator should be multiplied by (GV%H_to_Z*US%L_to_Z)
. (Compare this with the expressions that set wpup at lines 943 and 968.) Were we to make this change here, the conversion factor at line 1814 would need to be changed to US%L_to_m
, while the units of lf_bodner_diag
on line 811 would stay as they are.
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.
I have implemented this suggestion.
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 PR should be changed in one of two ways - either to document the units of lf_bodner_diag
consistently with how the code is written, or to revise lf_bodner_diag
so that it is in the more natural units of [L ~> m]
. I would prefer the latter, as it gives a diagnostic that is much more natural in non-Boussinesq mode (i.e., it avoids using the Boussinesq reference density). There are two separate comments attached to specific lines describing each of the two (mutually exclusive) options.
d6bfdf7
to
0304fb5
Compare
I agree with @Hallberg-NOAA's second suggestion: if the Bodner lengthscale is I've made some changes based on your suggestion to move the I also moved the |
@@ -928,14 +937,20 @@ subroutine mixedlayer_restrat_Bodner(CS, G, GV, US, h, uhtr, vhtr, tv, forces, d | |||
CS%MLD_filtered_slow(i,j) = big_H(i,j) | |||
enddo ; enddo | |||
|
|||
if (allocated(tv%SpV_avg) .and. .not.(GV%Boussinesq .or. GV%semi_Boussinesq)) then | |||
uflux_rescale = US%Z_to_L * GV%RZ_to_H / tv%SpV_avg(i,j,1) |
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.
In non-Boussinesq mode, uflux_rescale is a function of i and j, and it therefore either needs to be turned into a 2-d array or calculated inside of the relevant i- and j- loops.
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.
🤦
CS%nstar * max(0., -bflux(i,j)) * BLD(i,j) ))**2, CS%min_wstar2) * & | ||
( US%Z_to_L * GV%RZ_to_H / tv%SpV_avg(i,j,1)) | ||
CS%nstar * max(0., -bflux(i,j)) * BLD(i,j) ))**2, CS%min_wstar2) & | ||
* uflux_rescale |
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.
Line 953 is not equivalent to the previous line 938 because the former was a function of i- and j-.
Adding and calculating diagnostic front length scale (lf_bodner) to mixed layer restratification code Co-authored-by: Kate Hedstrom <kshedstrom@alaska.edu> Co-authored-by: Marshall Ward <marshall.ward@noaa.gov>
Fix two issues which emerged from the Bodner length scale diagnostic after the cuberoot ANSWER_DATE was introduced. The split of the loop due to the cuberoot caused ustar to be assigned in a separate loop, leaving it uninitialized for the length scale diagnostics loop. It also had its dimensions removed. However, the whole point of the new cuberoot() function was to preserve its dimensions, so there was no need for the intermediate dimensional manipulation, and all dimensionality should be shifted to the registration. This patch removes the intermediate dimensions and also explicitly defines it as Z2/H rather than L.
The scaling of the Bodner lengthscale diagnostic is correctly restored to L in this patch. The Z2 H-1 constant is factored into the calculation of the lengthscale; I believe this represents a conversion from a [Z2 T-2]-like momentum flux to a [LH T-2]-like momentum flux. A generic `uflux_rescale` term was introduced to be used in both ld_bodner and wpup, to avoid a double division by SpV. The if-block for computation of ld_bodner was also moved outside of the loop, in order to facilitate vectorization.
42b0f4b
to
7032df3
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 pull request now looks correct to me.
|
||
! Rescale from [Z2 H-1 to L] | ||
lf_bodner_diag(i,j) = lf_bodner_diag(i,j) * uflux_rescale | ||
enddo ; enddo |
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 line has a horizontal indexing error in non-Boussinesq mode because in that case the appropriate rescaling factor is a function of (i,j)
.
This PR has passed pipeline testing at https://gitlab.gfdl.noaa.gov/ogrp/MOM6/-/pipelines/22420. |
Adding and calculating diagnostic front length scale (lf_bodner) to mixed layer restratification code