Skip to content

Fix terrain YSU countergradient scaling - #3543

Closed
WeiqunZhang wants to merge 5 commits into
erf-model:developmentfrom
WeiqunZhang:Diffusion-4b
Closed

Fix terrain YSU countergradient scaling#3543
WeiqunZhang wants to merge 5 commits into
erf-model:developmentfrom
WeiqunZhang:Diffusion-4b

Conversation

@WeiqunZhang

Copy link
Copy Markdown
Collaborator

Apply the missing vertical grid factor to terrain-fitted momentum countergradient terms and document the dormant YSUNew dispatch gap.

WeiqunZhang and others added 4 commits August 4, 2026 12:32
Apply the missing vertical grid factor to terrain-fitted momentum
countergradient terms and document the dormant YSUNew dispatch gap.
@AMLattanzi
AMLattanzi requested a review from hgopalan August 5, 2026 17:13
@hgopalan

hgopalan commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

There is a discrepancy between the actual terms in the YSU paper and how the code is implemented using WRF. The term is written as d/dz ( - nut gammac) (https://www2.mmm.ucar.edu/wrf/users/physics/phys_refs/PBL/YSU.pdf). We calculate gammac ~ surface flux / pblh. We tested it for very low geostrophic wind speeds and @pressel confirmed that the results are as expected.

The Fact term already contains a dz_inv and the extra dz_inv would dilute the term with an extra dz and it should not be included.

@asalmgren

Copy link
Copy Markdown
Collaborator

@hgopalan -- Could you add a comment in the code to that effect so that next time we run a check like this it doesn't identify this as an issue again? Thx!

@hgopalan

hgopalan commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

#3486 should fix the comments section.

const int hgam_comp = (stagdir == 0) ? EddyDiff::HGAMU_v : EddyDiff::HGAMV_v;
const Real gam_hi = myhalf * (mu_turb(i,j,klo,hgam_comp) + mu_turb(i,j,klo+1,hgam_comp));
RHS_a(i,j,klo) += Fact * gfac * rhoAlpha_hi * gam_hi / met_h_zeta_hi;
RHS_a(i,j,klo) += Fact * gfac * dz_inv * rhoAlpha_hi * gam_hi / met_h_zeta_hi;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@hgopalan Shouldn't the implementations for YSU and MRF counter gradient follow the same paradigm? It appears that this differs from L137 in PR3544. Can you comment on any assumptions about the bottom flux being zero so we can rectify these two PRs?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The countergradient term is d/dz(K gammac). The gammac term is written as w'theta' / pblh. So we have only one dz_inv we should use. This one has extra and it will dilute the counter gradient further. Line 137 is correct. I was not sure what the met_h_zeta... term was and assumed it was a curvature correction.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I agree. The metric term now looks incorrect as well.

@AMLattanzi AMLattanzi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Again considering the counter gradient term:
Image

There is no second derivative, so adding a dz_inv is not correct. Finally, the met_h_zeta also looks incorrect for the same reason it should be removed from PR 3544 --- i.e., the detJ from the divergence has been moved to the RHS.

@AMLattanzi

Copy link
Copy Markdown
Collaborator

This PR is incorrect and being closed. A new PR addressing #3773 should be completed alongside merging of #3544 .

@AMLattanzi AMLattanzi closed this Aug 12, 2026
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.

4 participants