Repository navigation
Conversation
With diff_opt = 2 each horizontal derivative is taken at constant height, d/dX = m_x (d/dx - zx d/dz), so the slope (zx) term carries the same map factor as the flat x derivative. horizontal_diffusion_u_2, _v_2 and _s do this, but horizontal_diffusion_w_2 multiplied both slope terms by msfty. On lat-lon grids (msftx = 1/cos(lat), msfty = 1) the zx part of the w slope correction was too small by cos(lat). Put msftx on the zx term and msfty on the zy term; projections with msftx = msfty change only in rounding.
Collaborator
|
The (delayed) regression test results: |
dudhia
previously approved these changes
Dec 4, 2026
dudhia
left a comment
Collaborator
There was a problem hiding this comment.
affects lat/long where dx /= dy.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TYPE: bug fix
KEYWORDS: horizontal diffusion, diff_opt 2, map factor, w, slope term, lat-lon, global
SOURCE: Mark I. Richardson (Aeolis Research)
DESCRIPTION OF CHANGES:
Problem:
With diff_opt = 2 each horizontal derivative is taken on a constant-height surface, d/dX = m_x (d/dx - zx d/dz), so the slope (zx) correction must carry the same map factor as the flat x derivative. horizontal_diffusion_u_2, horizontal_diffusion_v_2 and horizontal_diffusion_s do this (msfux/msfvx/msftx on the zx term, msfuy/msfvy/msfty on the zy term), but horizontal_diffusion_w_2 multiplies both slope terms by msfty, so the zx part of the w slope correction has the y map factor. On lat-lon grids (msftx = 1/cos(lat), msfty = 1) that part is too small by cos(lat): half at 60 degrees latitude. The scalars were fixed in c38cfce (#266) and u and v in f854c25 (#368); w was left out. Details in #2453.
Solution:
Factor rdz out and put msftx on the zx term and msfty on the zy term, the same form as the u, v and scalar routines. Projections with msftx = msfty (Lambert, polar stereographic, Mercator) change only in rounding; idealized cases with map factors of 1, hydrostatic runs (w diagnosed) and diff_opt = 1 are unchanged.
ISSUE:
Fixes #2453
LIST OF MODIFIED FILES:
M dyn_em/module_diffusion_em.F
TESTS CONDUCTED:
RELEASE NOTE: With diff_opt = 2 on latitude-longitude grids, the slope correction of the horizontal diffusion of w now uses the x map factor on its x part, as the u, v and scalar terms already do; w diffusion over terrain at high latitude changes, other projections and hydrostatic runs are unchanged.