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

Fix units for MEKE advection #1039

Merged
merged 5 commits into from
Dec 2, 2019
Merged

Fix units for MEKE advection #1039

merged 5 commits into from
Dec 2, 2019

Conversation

adcroft
Copy link
Collaborator

@adcroft adcroft commented Dec 2, 2019

Three commits:

  • Fix for units in the advection term for MEKE. Explanation in aac71f5.
  • Removed some old commented-out code.
  • Cleanup of comments and additional comments for clarification of units for some terms.

- Code was passing dimensional testing because a conversion factor
  was included to obtain the right units for the advective flux terms.
  The origin of the unit problem was in the rate of inter-column exchange
  (baroHu and baroHv) which were in units of [H L2] and should have been
  in units of [R Z L2]:
  - [H L2 ~> m3 or kg] so differs between Boussinesq and non-Boussinesq;
  - [R Z L2 ~> kg] for both modes.
- This commit moves the conversion to the summation for the barotropic
  exchange, removes the previous scaling factors, and updates the
  relevant comments.
- Closes #1036
- Removed commented code snippet that was out-of-date w.r.t. to the
  current code and completely misleading.
- Cleaned up/added comments annotating units.
@adcroft
Copy link
Collaborator Author

adcroft commented Dec 2, 2019

@@ -266,7 +265,7 @@ subroutine step_forward_MEKE(MEKE, h, SN_u, SN_v, visc, dt, G, GV, US, CS, hu, h
enddo ; enddo
do i=is-1,ie+1
I_mass(i,j) = 0.0
if (mass(i,j) > 0.0) I_mass(i,j) = 1.0 / mass(i,j)
if (mass(i,j) > 0.0) I_mass(i,j) = 1.0 / mass(i,j) ! [m2 kg-1]
Copy link
Collaborator

Choose a reason for hiding this comment

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

The correct units in the comment here should be '[R-1 Z-1 ~> m2 kg-1]'

Inv_K4_max = 64.0 * sdt * ((G%dx_Cv(i,J)*G%IdyCv(i,J)) * max(G%IareaT(i,j), G%IareaT(i,j+1)))**2
if (K4_here*Inv_K4_max > 0.3) K4_here = 0.3 / Inv_K4_max

! Here the units of MEKE_vflux are [kg m-2 L4 T-3].
Copy link
Collaborator

Choose a reason for hiding this comment

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

The correct units here are '[R Z L4 T-3 ~> kg m2 s-3]'

!### I think that for dimensional consistency, this should be:
! advFac = GV%H_to_RZ * CS%MEKE_advection_factor / sdt
advFac = US%kg_m3_to_R*GV%H_to_Z * CS%MEKE_advection_factor / dt
advFac = CS%MEKE_advection_factor / sdt ! [T-1]
Copy link
Collaborator

Choose a reason for hiding this comment

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

The units here should have the converted units, as '[T-1 ~> s-1]'

MEKE_vflux(i,J) = ((K4_here * (G%dx_Cv(i,J)*G%IdyCv(i,J))) * &
((2.0*mass(i,j)*mass(i,j+1)) / ((mass(i,j)+mass(i,j+1)) + mass_neglect)) ) * &
(del2MEKE(i,j+1) - del2MEKE(i,j))
enddo ; enddo
! Store tendency arising from the bi-harmonic in del4MEKE
! Store change in MEKE arising from the bi-harmonic in del4MEKE [L2 T-2].
Copy link
Collaborator

Choose a reason for hiding this comment

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

The units here should have the converted MKS units, as '[L2 T-2 ~> m2 s-2]'

@codecov-io
Copy link

codecov-io commented Dec 2, 2019

Codecov Report

❗ No coverage uploaded for pull request base (dev/gfdl@0e0f6e9). Click here to learn what that means.
The diff coverage is 50%.

Impacted file tree graph

@@             Coverage Diff             @@
##             dev/gfdl    #1039   +/-   ##
===========================================
  Coverage            ?   45.12%           
===========================================
  Files               ?      212           
  Lines               ?    62509           
  Branches            ?        0           
===========================================
  Hits                ?    28206           
  Misses              ?    34303           
  Partials            ?        0
Impacted Files Coverage Δ
src/parameterizations/lateral/MOM_MEKE.F90 70.18% <50%> (ø)

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 0e0f6e9...7a404fe. Read the comment docs.

@adcroft
Copy link
Collaborator Author

adcroft commented Dec 2, 2019

Yes - these are all because of a bad merge.

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.

I agree that these changes are the best approach to addressing the previously noted dimensional inconsistency with the advective MEKE fluxes.

@Hallberg-NOAA Hallberg-NOAA merged commit bfa303d into mom-ocean:dev/gfdl Dec 2, 2019
@adcroft adcroft deleted the fix-units-for-meke-advection branch December 3, 2019 14:44
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.

3 participants