Skip to content

Commit 57dd80c

Browse files
committed
Merge branch 'combo_20250625' of https://github.com/grantfirl/ccpp-physics into ufs-dev-PR295
2 parents 90cae2d + ef272c1 commit 57dd80c

14 files changed

Lines changed: 1563 additions & 38 deletions

CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,12 @@ target_include_directories(ccpp_physics PUBLIC
196196
target_link_libraries(ccpp_physics PRIVATE MPI::MPI_Fortran)
197197
target_link_libraries(ccpp_physics PUBLIC w3emc::w3emc_d
198198
sp::sp_d
199-
NetCDF::NetCDF_Fortran)
199+
NetCDF::NetCDF_Fortran
200+
)
201+
#add FMS for FV3 only
202+
if(FV3)
203+
target_link_libraries(ccpp_physics PUBLIC fms)
204+
endif()
200205

201206
# Define where to install the library
202207
install(TARGETS ccpp_physics

physics/CONV/C3/cu_c3_driver.F90

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,9 @@ subroutine cu_c3_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
657657
enddo
658658
do i = its,itf
659659
if(mconv(i).lt.0.)mconv(i)=0.
660-
if((dx(i)<6500.).and.do_mynnedmf.and.(maxMF(i).gt.0.))ierr(i)=555
660+
if(do_mynnedmf) then
661+
if((dx(i)<6500.).and.(maxMF(i).gt.0.))ierr(i)=555
662+
endif
661663
enddo
662664
!$acc end kernels
663665
if (dx(its)<6500.) then

physics/GWD/cires_ugwpv1_oro.F90

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,8 @@ subroutine orogw_v1 (im, km, imx, me, master, dtp, kdt, do_tofd, &
222222
dusfc(i) = 0.0
223223
dvsfc(i) = 0.0
224224
ipt(i) = 0
225-
enddo
225+
enddo
226+
zlwb(:) = 0.0
226227

227228
! ---- for lm and gwd calculation points
228229
!cires_ugwp_initialize.F90: real, parameter :: hpmax=2400.0, hpmin=25.0

physics/GWD/cires_ugwpv1_triggers.F90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ subroutine get_spectra_tau_okw(nw, im, levs, trig_okw, xlatd, sinlat, coslat, t
298298
if (dmax >= tlim_okw) kex = kex+1
299299
do k=klow+1, ktop
300300
dtot = abs(trig_okw(i,k))
301-
if (dtot >= tlim_fgf ) kex = kex+1
301+
if (dtot >= tlim_okw ) kex = kex+1
302302
if ( dtot > dmax) then
303303
klev(i) = k
304304
dmax = dtot

physics/GWD/ecmwf_ngw.F90

Lines changed: 956 additions & 0 deletions
Large diffs are not rendered by default.

physics/GWD/ugwpv1_gsldrag.F90

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ module ugwpv1_gsldrag
4343
use cires_ugwpv1_module, only: cires_ugwpv1_init, ngwflux_update, calendar_ugwp
4444
use cires_ugwpv1_module, only: knob_ugwp_version, cires_ugwp_dealloc, tamp_mpa
4545
use cires_ugwpv1_solv2, only: cires_ugwpv1_ngw_solv2
46+
! use cires_ugwpv1_solv2, only: cires_ugwpv1_ngw_solv2, ecmwf_ngw
47+
use ecmwf_ngw, only: ecmwf_ngw_emc
48+
4649
use cires_ugwpv1_oro, only: orogw_v1
4750

4851
use drag_suite, only: drag_suite_run, drag_suite_psl
@@ -70,7 +73,8 @@ subroutine ugwpv1_gsldrag_init ( &
7073
con_pi, con_rerth, con_p0, &
7174
con_g, con_omega, con_cp, con_rd, con_rv,con_fvirt, &
7275
do_ugwp,do_ugwp_v0, do_ugwp_v0_orog_only, do_gsl_drag_ls_bl, &
73-
do_gsl_drag_ss, do_gsl_drag_tofd, do_ugwp_v1, &
76+
do_gsl_drag_ss, do_gsl_drag_tofd, do_ngw_ec, do_ugwp_v1, &
77+
!! do_gsl_drag_ss, do_gsl_drag_tofd, do_ugwp_v1, &
7478
do_ugwp_v1_orog_only, do_ugwp_v1_w_gsldrag, errmsg, errflg)
7579

7680
use ugwp_common
@@ -94,9 +98,10 @@ subroutine ugwpv1_gsldrag_init ( &
9498
real(kind=kind_phys), intent (in) :: con_g, con_cp, con_rd, con_rv, con_omega, con_fvirt
9599
logical, intent (in) :: do_ugwp
96100

97-
logical, intent (in) :: do_ugwp_v0, do_ugwp_v0_orog_only, &
98-
do_gsl_drag_ls_bl, do_gsl_drag_ss, &
99-
do_gsl_drag_tofd, do_ugwp_v1, &
101+
logical, intent (in) :: do_ugwp_v0, do_ugwp_v0_orog_only, &
102+
do_gsl_drag_ls_bl, do_gsl_drag_ss, &
103+
!! do_gsl_drag_tofd, do_ugwp_v1, &
104+
do_gsl_drag_tofd, do_ugwp_v1, do_ngw_ec, &
100105
do_ugwp_v1_orog_only,do_ugwp_v1_w_gsldrag
101106

102107
character(len=*), intent (in) :: fn_nml2
@@ -302,7 +307,7 @@ subroutine ugwpv1_gsldrag_run(me, master, im, levs, ak, bk, ntrac, lonr, dtp,
302307
fhzero, kdt, ldiag3d, lssav, flag_for_gwd_generic_tend, do_gsl_drag_ls_bl, &
303308
do_gsl_drag_ss, do_gsl_drag_tofd, &
304309
do_gwd_opt_psl, psl_gwd_dx_factor, &
305-
do_ugwp_v1, do_ugwp_v1_orog_only, &
310+
do_ngw_ec, do_ugwp_v1, do_ugwp_v1_orog_only, &
306311
do_ugwp_v1_w_gsldrag, gwd_opt, do_tofd, ldiag_ugwp, ugwp_seq_update, &
307312
cdmbgwd, alpha_fd, jdat, nmtvr, hprime, oc, theta, sigma, gamma, &
308313
elvmax, clx, oa4, varss,oc1ss,oa4ss,ol4ss, dx, xlat, xlat_d, sinlat, coslat, &
@@ -356,7 +361,7 @@ subroutine ugwpv1_gsldrag_run(me, master, im, levs, ak, bk, ntrac, lonr, dtp,
356361
! flags for choosing combination of GW drag schemes to run
357362

358363
logical, intent (in) :: do_gsl_drag_ls_bl, do_gsl_drag_ss, do_gsl_drag_tofd
359-
logical, intent (in) :: do_ugwp_v1, do_ugwp_v1_orog_only, do_tofd
364+
logical, intent (in) :: do_ugwp_v1, do_ngw_ec, do_ugwp_v1_orog_only, do_tofd
360365
logical, intent (in) :: ldiag_ugwp, ugwp_seq_update
361366
logical, intent (in) :: do_ugwp_v1_w_gsldrag ! combination of ORO and NGW schemes
362367

@@ -698,10 +703,21 @@ subroutine ugwpv1_gsldrag_run(me, master, im, levs, ak, bk, ntrac, lonr, dtp,
698703
call ngwflux_update(me, master, im, levs, kdt, ddd_ugwp,curdate, &
699704
tau_amf, xlat_d, sinlat,coslat, rain, tau_ngw)
700705

701-
call cires_ugwpv1_ngw_solv2(me, master, im, levs, kdt, dtp, &
706+
if (do_ngw_ec) then
707+
708+
call ecmwf_ngw_emc(me, master, im, levs, kdt, dtp, dx, &
709+
tau_ngw, tgrs, ugrs, vgrs, q1, prsl, prsi, &
710+
zmet, zmeti,prslk, xlat_d, sinlat, coslat, &
711+
dudt_ngw, dvdt_ngw, dtdt_ngw, kdis_ngw, zngw)
712+
else
713+
714+
call cires_ugwpv1_ngw_solv2(me, master, im, levs, kdt, dtp, &
702715
tau_ngw, tgrs, ugrs, vgrs, q1, prsl, prsi, &
703716
zmet, zmeti,prslk, xlat_d, sinlat, coslat, &
704717
dudt_ngw, dvdt_ngw, dtdt_ngw, kdis_ngw, zngw)
718+
719+
endif
720+
705721
!
706722
! => con_g, con_cp, con_rd, con_rv, con_omega, con_pi, con_fvirt
707723
!

physics/GWD/ugwpv1_gsldrag.meta

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = ugwpv1_gsldrag
33
type = scheme
44
dependencies = ../hooks/machine.F,drag_suite.F90
5-
dependencies = cires_ugwpv1_module.F90,cires_ugwpv1_triggers.F90,cires_ugwpv1_initialize.F90,cires_ugwpv1_solv2.F90
5+
dependencies = cires_ugwpv1_module.F90,cires_ugwpv1_triggers.F90,cires_ugwpv1_initialize.F90,cires_ugwpv1_solv2.F90,ecmwf_ngw.F90
66
dependencies = cires_ugwpv1_sporo.F90,cires_ugwpv1_oro.F90
77
########################################################################
88
[ccpp-arg-table]
@@ -218,6 +218,13 @@
218218
dimensions = ()
219219
type = logical
220220
intent = in
221+
[do_ngw_ec]
222+
standard_name = flag_for_ngw_ec
223+
long_name = flag to activate ecmwf ngwd
224+
units = flag
225+
dimensions = ()
226+
type = logical
227+
intent = in
221228
[do_ugwp_v1]
222229
standard_name = flag_for_ugwp_version_1
223230
long_name = flag to activate ver 1 CIRES UGWP
@@ -417,6 +424,13 @@
417424
type = real
418425
kind = kind_phys
419426
intent = in
427+
[do_ngw_ec]
428+
standard_name = flag_for_ngw_ec
429+
long_name = flag to activate ecmwf ngwd
430+
units = flag
431+
dimensions = ()
432+
type = logical
433+
intent = in
420434
[do_ugwp_v1]
421435
standard_name = flag_for_ugwp_version_1
422436
long_name = flag to activate ver 1 CIRES UGWP

physics/Interstitials/UFS_SCM_NEPTUNE/sfcsub.F

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3093,8 +3093,11 @@ subroutine subst(data,imax,jmax,dlon,dlat,ijordr)
30933093
enddo
30943094
enddo
30953095
else
3096-
do i=1,imax
3097-
data(imax-i+1,jj) = work(i,j)
3096+
do j=1,jmax
3097+
jj = jmax - j + 1
3098+
do i=1,imax
3099+
data(imax-i+1,jj) = work(i,j)
3100+
enddo
30983101
enddo
30993102
endif
31003103
else

physics/PBL/SATMEDMF/mfscuq.f

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ subroutine mfscuq(im,ix,km,kmscu,ntcw,ntrac1,delt,
1515
& cnvflg,zl,zm,q1,t1,u1,v1,plyr,pix,
1616
& thlx,thvx,thlvx,gdx,thetae,
1717
& krad,mrad,radmin,buo,wush,tkemean,vez0fun,xmfd,
18-
& tcdo,qcdo,ucdo,vcdo,xlamdeq,a1)
18+
& tcdo,qcdo,ucdo,vcdo,xlamdeq,a1,
19+
!The following flag is for SA-3D-TKE (kyf)
20+
& sa3dtke)
1921
!
2022
use machine , only : kind_phys
2123
use funcphys , only : fpvs
@@ -31,6 +33,7 @@ subroutine mfscuq(im,ix,km,kmscu,ntcw,ntrac1,delt,
3133
integer krad(im), mrad(im)
3234
!
3335
logical cnvflg(im)
36+
logical sa3dtke !flag for SA-3D-TKE scheme (kyf)
3437
real(kind=kind_phys) delt
3538
real(kind=kind_phys) q1(ix,km,ntrac1),t1(ix,km),
3639
& u1(ix,km), v1(ix,km),
@@ -427,6 +430,16 @@ subroutine mfscuq(im,ix,km,kmscu,ntcw,ntrac1,delt,
427430
endif
428431
enddo
429432
!
433+
!> - Set updraft fraction to 0 when using SA-3D-TKE scheme (kyf)
434+
!! Scale-aware capability is done with pfnl in satmedmfvdifq.F
435+
!! Zhu et al. (2025)
436+
!
437+
if (sa3dtke) then
438+
do i = 1, im
439+
sigma(i) = 0.
440+
enddo
441+
endif
442+
!
430443
!> - Compute scale-aware function based on
431444
!! Arakawa and Wu (2013) \cite arakawa_and_wu_2013
432445
!

0 commit comments

Comments
 (0)