Repository navigation
Updates in the OMD GFS PBL and Convection models with 3D TTE-based EDMF Turbulent Mixing Scheme, Cold Pool Parameterization, and Mixed Scheme for Subgrid-Scale Convective Fluxes in Convective Clouds + #405 + #408 + #414 - #403
ChristianBoyer-NOAA wants to merge 17 commits into
Conversation
… the SAMF deep and shallow convection schemes
|
We checked conservation of the new horizontal diffusion in a C96
The amounts are small, but a diffusion term should conserve exactly. Building the face fluxes from |
@pera-noaa The original code for 3D TKE developed by Ping Zhu et al. (2025) applied horizontal turbulent diffusion only to momentum and TKE. In this PR, we extended the horizontal turbulent diffusion to temperature, moisture, and all the tracers. Ideally, horizontal diffusion should be applied on the same height (z) surface. But in this PR, it is applied in the terrain-following sigma surface and so would be somewhat erroneous especially over steep mountain. This could cause the conservation issue you've found. Currently, we don't know how to apply it on z-surface. If the conservation issue is serious, we had better remove the horizontal turbulent diffusion for the scalar variables. For the time being, we will modify it as an optional. |
|
Thank you for this work! I have two concerns regarding the decision to automatically disable the CA scheme when the alternative cold-pool parameterization is activated. Namelist configuration: I would prefer that we do not overwrite a user-specified namelist option within the Fortran code. If coldpool and do_ca are currently considered mutually exclusive, I suggest adding a check that aborts with an informative error message when both are enabled, asking the user to select one or the other. This would make the configuration requirements explicit rather than silently changing the user's settings. Scientific justification: The CA scheme has previously demonstrated improvements in MJO prediction, whereas, from my understanding, the current cold-pool implementation has not yet demonstrated comparable improvements in overall forecast skill. It therefore seems somewhat counterintuitive to automatically disable CA in favor of a parameterization that is still under development. I recognize that the two schemes may interfere with one another in their current formulations, but I think we should be careful not to imply that the cold-pool parameterization is necessarily a replacement for CA cold pool representation. As we discussed, future work could combine the two. Perhaps the PR description could more explicitly state that this is an initial implementation intended for further development and evaluation, and that additional work (potentially through subsequent PRs) will be needed to demonstrate improvements in the forecast applications mentioned here, particularly for the MJO and hurricanes. I am supportive of introducing new capabilities for exploring convective organization, but I think it is important to distinguish between adding a research capability and establishing that it improves forecast performance. |
@lisa-bengtsson Following your suggestion, we will modify the code and the PR description |
|
Thanks @JongilHan66. The leak isn't from using sigma surfaces, and diffusing on z surfaces would leak the same way. It comes from applying the fluxes to mixing ratios: neighbouring columns hold different air mass ( |
@pera-noaa Currently, horizontal diffusion of q (d(K dq/dx)/dx, where K is eddy diffusivity) is computed as (1/dx(i)) [K(i+.5) (q(i+1)-q(i))/dx(i+.5) - K(i-.5) (q(i)-q(i-1))/dx(i-.5)]. Do you mean "mass-weighted" diffusion by d (K/dp d (q dp)/dx)/dx where dp is delp (layer pressure thickness)? Then it would be computed as (1/dx(i)) [K/dp(i+.5) (q(i+1) dp(i+1)-q(i) dp(i))/dx(i+.5) - K/dp(i-.5) (q(i) dp(i)-q(i-1) dp(i-1))/dx(i-.5)]. |
|
@JongilHan66 Not quite, my wording was unclear. Keep your form and change two things: multiply with |
@pera-noaa Yes, your proposal makes more sense and I've already modified them in your proposed way. |
…h mass-weighting to conserve the scalar field after horizontal diffusion. Also, includes changes from ccpp PRs 405, 408 and 414
@pera-noaa This PR(#403) has been updated along with mass-weighted horizontal eddy diffusion discretization for scalar fields. Could you check if the leak from conservation is significantly reduced when you have a chance? |
| & crtlame, crtlamd | ||
| ! | ||
| ! real(kind=kind_phys) detad | ||
| ! real(kind=conv_wp) detad |
There was a problem hiding this comment.
I was curious why this, and other lines with real(kind_phys), weren't already changed to real(conv_wp) - but it looks like that is all commented code that is not used. Maybe it would be better to just clean out? @rhaesung ?
There was a problem hiding this comment.
Agreed! If they're not being used, let's just clean them out. Thanks, @lisa-bengtsson!
There was a problem hiding this comment.
I was curious why this, and other lines with real(kind_phys), weren't already changed to real(conv_wp) - but it looks like that is all commented code that is not used. Maybe it would be better to just clean out? @rhaesung ?
@lisa-bengtsson While detad is not used, I'd like to keep them with commented out for future consideration.
| & ' select one or the other' | ||
| errflg = 1 | ||
| return | ||
| endif |
There was a problem hiding this comment.
When trying to compile this code - I get an error here. It seems that the compiler doesn't like (*(a)) as the format in a .f file?
There was a problem hiding this comment.
When trying to compile this code - I get an error here. It seems that the compiler doesn't like (*(a)) as the format in a .f file?
@lisa-bengtsson In the update, write(errmsg,'((a))') => print,
There was a problem hiding this comment.
The earlier compile error was likely caused by exceeding column 72, not (*(a)) (which is already used earlier in this file).
To follow CCPP logging standards instead of print*, we can format it within 72 columns:
if (coldpool .and. do_ca) then
write(errmsg, '(*(a))')
& 'Currently both are not allowed to be enabled;',
& ' select one or the other'
errflg = 1
return
endif| dp = 1000.0_conv_wp * del(i,k+1) | ||
| dellaq(i,k+1) = dellaq(i,k+1) - edto(i) | ||
| & * etad(i,k) * tem1 * real(grav, kind=conv_wp)/dp | ||
| & * etad(i,k) * qo(i,k) * real(grav, kind=conv_wp)/dp |
There was a problem hiding this comment.
The compiler also fails here:
I think you need to split the expression across additional continuation lines to comply with the 72-column limit for fixed-form Fortran. The " /dp" extended beyond column 72 and is ignored by the compiler.
There was a problem hiding this comment.
The compiler also fails here: I think you need to split the expression across additional continuation lines to comply with the 72-column limit for fixed-form Fortran. The " /dp" extended beyond column 72 and is ignored by the compiler.
@lisa-bengtsson Corrected that line not to extend beyond column 72
| ucp(i) = 0._conv_wp | ||
| vcp(i) = 0._conv_wp |
There was a problem hiding this comment.
| ucp(i) = 0._conv_wp | |
| vcp(i) = 0._conv_wp | |
| ucp(i) = 0._kind_phys | |
| vcp(i) = 0._kind_phys |
| if (tem > 0._conv_wp) then | ||
| ptem1 = ptem - ukdcp(i) | ||
| ptem1 = max(ptem1, 0._conv_wp) | ||
| ucp(i) = min(tem, ptem1) |
There was a problem hiding this comment.
| ucp(i) = min(tem, ptem1) | |
| ucp(i) = real(min(tem, ptem1), kind=kind_phys) |
| else | ||
| ptem1 = -ptem - ukdcp(i) | ||
| ptem1 = min(ptem1, 0._conv_wp) | ||
| ucp(i) = max(tem, ptem1) |
There was a problem hiding this comment.
| ucp(i) = max(tem, ptem1) | |
| ucp(i) = real(max(tem, ptem1), kind=kind_phys) |
| if (tem1 > 0._conv_wp) then | ||
| ptem1 = ptem - vkdcp(i) | ||
| ptem1 = max(ptem1, 0._conv_wp) | ||
| vcp(i) = min(tem1, ptem1) |
There was a problem hiding this comment.
| vcp(i) = min(tem1, ptem1) | |
| vcp(i) = real(min(tem1, ptem1), kind=kind_phys) |
| else | ||
| ptem1 = -ptem - vkdcp(i) | ||
| ptem1 = min(ptem1, 0._conv_wp) | ||
| vcp(i) = max(tem1, ptem1) |
There was a problem hiding this comment.
| vcp(i) = max(tem1, ptem1) | |
| vcp(i) = real(max(tem1, ptem1), kind=kind_phys) |
| !> - Calculate additional trigger condition of the convective inhibition (CIN) according to Han et al.'s (2017) \cite han_et_al_2017 equation 13. | ||
| do i = 1, im | ||
| if(cnvflg(i)) then | ||
| cina(i) = 0. |
There was a problem hiding this comment.
| cina(i) = 0. | |
| cina(i) = 0._conv_wp |
| do i = 1, im | ||
| tem = real(buoyexcs(i,k), kind=conv_wp) | ||
| & + dellabu(i,k) * dt2 | ||
| ptem = 1. + dt2 / taucp |
There was a problem hiding this comment.
| ptem = 1. + dt2 / taucp | |
| ptem = 1._conv_wp + dt2 / taucp |
| ! & (k > kb(i) .and. k < ktcon(i))) then | ||
| ! if(k > kb(i) .and. k < ktcon(i)) then | ||
| ! if(k >= kbcon(i) .and. k < ktcon(i)) then | ||
| dz = zo(i,k+1) - zi(i,k-1) |
| name = samfshalcnv | ||
| type = scheme | ||
| dependencies = ../../tools/funcphys.f90,../../hooks/machine.F,samfaerosols.F,../progsigma_calc.f90,../progomega_calc.f90,mo_conv_kind.F90 | ||
| dependencies = ../../tools/funcphys.f90,../../hooks/machine.F,samfaerosols.F,../progsigma_calc.f90,../progomega_calc.f90 |
There was a problem hiding this comment.
Please revert this. This is needed for 32-bit precision builds.
| def4q(i,k,1) = def_4(i,k,ntqv) | ||
| def4q(i,k,1) = def_4(i,k,ntqv) |
There was a problem hiding this comment.
@rhaesung Thanks!! We are correcting them following your comments.
rhaesung
left a comment
There was a problem hiding this comment.
Looks good to me, thanks!
|
Hi Christian, I've been testing your PR in a global coupled configuration (C1152), but I'm encountering segmentation faults in RRTMG radiation, even with coldpool = .false.. Would you mind syncing your branch with the latest upstream develop? I'd like to check out the updated PR and rebuild to see whether that resolves the issue. Thanks! |
Hi Lisa, The branch should be synced with the latest upstream develop now. Hopefully that will help with the RRTMG segmentation fault. Thanks, |
|
Thank you! I will give it a try! |
| & clam,c0s,c1,betal,betas,evef,pgcon,asolfac,cscale, & | ||
| & do_ca, ca_closure, ca_entr, ca_trigger, nthresh,ca_deep, & | ||
| & rainevap,sigmain,sigmaout,omegain,omegaout,betadcu,betamcu, & | ||
| & betascu,lbb1,lbb2,lbb3,dt_decay,maxMF,do_mynnedmf, & |
There was a problem hiding this comment.
Christian, I think when you synced updstream, the dt_decay that was cleaned out in a previous PR was accidentally re-introduced here. You can remove it here and in samfdeepcnv.meta. It is not declared after this so the compile fails.
There was a problem hiding this comment.
Thanks, Lisa! I just pushed the fixes removing dt_decay and adding shallow_veto(im) back in.
| real(kind=conv_wp) gravinv,invdelt,sigmind,sigminm,sigmins, | ||
| & wc_min, wc_eff | ||
| logical flag_shallow, flag_mid, shallow_veto(im) | ||
| logical flag_shallow, flag_mid |
There was a problem hiding this comment.
shallow_veto(im) should still be included here. (I think this also got accidentally removed in the merge)
…nd samfdeepcnv.meta to resolve reviewer comments
|
@JongilHan66 Sorry for the slow reply. We put your updated C96
So one change closes it. Drop the three divisions by hdt(i,k) = def_3(i,k)/del(i,k)
hdq(i,k,n) = def4q(i,k,n)/del(i,k)then A smaller point: your stencil differences fx(i,j) = 0.25*(dku3d_e(i-1,j,k)+dku3d_e(i,j,k))*(delp(i-1,j,k)+delp(i,j,k))*(q(i,j)-q(i-1,j))*dy(i,j)/dxc(i,j)
fy(i,j) = 0.25*(dku3d_e(i,j-1,k)+dku3d_e(i,j,k))*(delp(i,j-1,k)+delp(i,j,k))*(q(i,j)-q(i,j-1))*dx(i,j)/dyc(i,j)
div(i,j) = rarea(i,j)*(fx(i+1,j)-fx(i,j)+fy(i,j+1)-fy(i,j))These ran in our build (ufs-weather-model 3d2331e with #403 as of 23 Oct), with your |
@pera-noaa What are dxc(i,j) and dyc(i,j)? 1/dxc(i,j)=1/dyc(i,j)=rarea(i,j)? |
|
@JongilHan66 Not quite. All four are in Whichever metric you use, the face-flux form conserves; what closes the leak is dividing by |
|
@pera-noaa Thanks!! In the update, following your suggestion we will drop the divisions by delp in diff3d, and divide by del in satmedmfvdifq. We will keep stencil differences q·dx as their impact would be very small. |
| ! tem=2.0*def_3(i,k) | ||
| tem=def_3(i,k) | ||
| ! tem=min(tem,1.0) | ||
| tem=hdq(i,k,ntke) |
There was a problem hiding this comment.
@JongilHan66 Found by reading the code, not in a run: this adds hdq(i,k,ntke) whenever sa3dtke is on, but hdq is a local array that is only filled when sa3dtke .and. hdiffq (L535–547), so with hdiffq off the TKE gets uninitialised memory. Guarding it as the other hdq uses are would fix it (zeroing hdq at entry would too):
| tem=hdq(i,k,ntke) | |
| tem = 0. | |
| if(hdiffq) tem=hdq(i,k,ntke) |
|
@pera-noaa Thanks!! fixed. |
|
@pera-noaa Since we want to have horizontal diffusion even when hdiffq=.false., while we keep tem=hdq(i,k,ntke) we modified initial assignment of hdq in satmedmfdifq.F as |
@pera-noaa Correction: Since we want to have horizontal diffusion even when hdiffq=.false. => Since we want to have horizontal diffusion for the TKE even when hdiffq=.false. |
Description of Changes:
PR submitted on behalf of @JongilHan66
The current GFS 1D scale-aware (SA) TTE-EDMF scheme is extended to the 3D-SA TTE-EDMF scheme by replacing 3D TKE with 3D TTE. The horizontal turbulent diffusion is modified: the horizontal mixing length is now scaled directly to the vertical mixing length, replacing the previous formulation based on horizontal grid size. In addition, horizontal turbulent eddy diffusion—previously restricted to momentum and TKE—now applies across all scalar prognostic variables, including temperature, moisture, hydrometeors, passive tracers, momentum, and TTE. To have scalar field conservation after horizontal diffusion, mass-weighted diffusion computation is applied for scalar fields (temperature, moisture, cloud condensate, tracers, etc.). Ideally, horizontal diffusion should be applied on the height surface. In this PR, however, it is applied in the terrain-following sigma surface and so can be somewhat erroneous especially over steep mountain. Horizontal diffusion for the scalar fields is set to be optional.
Properly representing cold pools (CPs; dense, cold air masses formed by the downdrafts of precipitating cumulus clouds) within numerical weather prediction models has long been a challenge. By spreading horizontally, the cold pool's leading edge, known as the gust front, acts as a local lifting mechanism, forcing warm, moist air upward to generate secondary convective cells and organize larger systems. Neglecting the thermodynamic and momentum effects of these features, particularly their interaction with the boundary layer structure and the free atmosphere, can lead to significant systematic biases in the simulation of organized mesoscale convection and the diurnal cycle of precipitation. We integrate the CP parameterization developed by Freitas et al. (2024) into the NCEP Global Forecast System (GFS) with a modification. This implementation is coupled with the GFS deep convection and PBL schemes. The CP depth far behind the leading edge (D), used to compute gust front horizontal speed, was reduced from 2 km to 500 m. Concurrently, the density current head depth used for calculating vertical velocity at the CP leading edge was increased to approximately 2D. The modified scheme restricts the CP influence strictly to enhanced convection triggering. It removes convection intensity enhancement, eliminating additional source terms for buoyancy, moisture, and updraft velocity. This is an initial implementation intended for further development and evaluation, and that additional work (potentially through subsequent PRs) will be needed to demonstrate improvements in the forecast applications mentioned here, particularly for the MJO and hurricanes. The CP parameterization and the Cellular Automata (CA) scheme may interfere with one another in their current formulations as both attempt to promote secondary cell generation and larger system organization. Currently, one or the other (not both) are set to be activated. We plan to combine the two in the future.
A mixed subgrid-scale turbulent flux scheme is introduced into the GFS based on Moeng et al. (2010), incorporating an auxiliary subgrid vertical flux known as the "Leonard term" (Leonard 1974; Moeng et al. 2010). The Leonard term accounts for subgrid-scale turbulent fluxes originating from near-grid-scale unresolved eddies—the largest subgrid eddies with scales comparable to the model's horizontal grid resolution. Applied primarily to mitigate subgrid flux underestimation, this formulation is most effective at kilometer-scale, convection-permitting, or cloud-resolving resolutions (Moeng et al. 2010; Verrelle et al. 2017; Hanley et al. 2019). In the current implementation, the Leonard term calculation is embedded directly within the convection schemes rather than the Planetary Boundary Layer (PBL) scheme.
The changes from the PR#405, PR#408, and PR#414 submitted by Ash Pera are included into this PR. Also, totflg is removed from the SAMF convection schemes.
Tests Conducted:
Regression test suite was run on Ursa.
Dependencies:
Issue (optional):
Fixes issue: ufs-community/ufs-weather-model#3401
Fixes issue: #401
Contributors (optional):
@JongilHan66