Skip to content

Commit fcd0924

Browse files
committed
Merge branch 'ufs/dev' into feature/rad-fix_gjf
2 parents 56e66e6 + bca8f11 commit fcd0924

File tree

21 files changed

+863
-690
lines changed

21 files changed

+863
-690
lines changed

.github/workflows/ci_fv3_ccpp_prebuild.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ jobs:
5454
run: |
5555
cd /home/runner/work/ccpp-physics/ccpp-physics/fv3atm/ccpp/
5656
mkdir -p /home/runner/work/ccpp-physics/ccpp-physics/fv3atm/bin/ccpp/physics/physics/
57-
./framework/scripts/ccpp_prebuild.py --config config/ccpp_prebuild_config.py
57+
./framework/scripts/ccpp_prebuild.py --config config/ccpp_prebuild_config_fv3.py

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ target_link_libraries(ccpp_physics PUBLIC w3emc::w3emc_d
199199
NetCDF::NetCDF_Fortran
200200
)
201201
#add FMS for FV3 only
202-
if(FV3)
202+
if(FV3 OR MPAS)
203203
target_link_libraries(ccpp_physics PUBLIC fms)
204204
endif()
205205

physics/CONV/SAMF/samfdeepcnv.f

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ subroutine samfdeepcnv_run (im,km,first_time_step,restart, &
8282
& islimsk,garea,dot,ncloud,hpbl,ud_mf,dd_mf,dt_mf,cnvw,cnvc, &
8383
& QLCN, QICN, w_upi, cf_upi, CNV_MFD, &
8484
& CNV_DQLDT,CLCN,CNV_FICE,CNV_NDROP,CNV_NICE,mp_phys,mp_phys_mg,&
85-
& clam,c0s,c1,betal,betas,evef,pgcon,asolfac, &
85+
& clam,c0s,c1,betal,betas,evef,pgcon,asolfac,cscale, &
8686
& do_ca, ca_closure, ca_entr, ca_trigger, nthresh,ca_deep, &
8787
& rainevap,sigmain,sigmaout,omegain,omegaout,betadcu,betamcu, &
8888
& betascu,maxMF,do_mynnedmf,sigmab_coldstart,errmsg,errflg)
@@ -97,7 +97,7 @@ subroutine samfdeepcnv_run (im,km,first_time_step,restart, &
9797
integer, intent(in) :: islimsk(:)
9898
real(kind=kind_phys), intent(in) :: cliq, cp, cvap, eps, epsm1, &
9999
& fv, grav, hvap, rd, rv, t0c
100-
real(kind=kind_phys), intent(in) :: delt
100+
real(kind=kind_phys), intent(in) :: delt, cscale
101101
real(kind=kind_phys), intent(in) :: psp(:), delp(:,:), &
102102
& prslp(:,:), garea(:), hpbl(:), dot(:,:), phil(:,:)
103103
real(kind=kind_phys), dimension(:), intent(in) :: fscav
@@ -219,7 +219,7 @@ subroutine samfdeepcnv_run (im,km,first_time_step,restart, &
219219
! parameters for prognostic sigma closure
220220
real(kind=kind_phys) omega_u(im,km),zdqca(im,km),tmfq(im,km),
221221
& omegac(im),zeta(im,km),dbyo1(im,km),sigmab(im),qadv(im,km),
222-
& sigmaoutx(im),tentr(im,km)
222+
& tentr(im,km)
223223
real(kind=kind_phys) gravinv,invdelt,sigmind,sigminm,sigmins
224224
parameter(sigmind=0.01,sigmins=0.03,sigminm=0.01)
225225
logical flag_shallow, flag_mid
@@ -3467,24 +3467,16 @@ subroutine samfdeepcnv_run (im,km,first_time_step,restart, &
34673467
endif
34683468
enddo
34693469
c
3470-
!
3471-
if(progsigma)then
3472-
do i = 1, im
3473-
sigmaoutx(i)=max(sigmaout(i,1),0.0)
3474-
sigmaoutx(i)=min(sigmaoutx(i),1.0)
3475-
enddo
3476-
endif
3477-
c
34783470
!> - Calculate convective cloud water.
34793471
do k = 1, km
34803472
do i = 1, im
34813473
if (cnvflg(i) .and. rn(i) > 0.) then
34823474
if (k >= kbcon(i) .and. k < ktcon(i)) then
34833475
cnvw(i,k) = cnvwt(i,k) * xmb(i) * dt2
34843476
if(progsigma)then
3485-
cnvw(i,k) = cnvw(i,k) * sigmaoutx(i)
3477+
cnvw(i,k) = cnvw(i,k) * cscale
34863478
else
3487-
cnvw(i,k) = cnvw(i,k) * sigmagfm(i)
3479+
cnvw(i,k) = cnvw(i,k) * cscale
34883480
endif
34893481
endif
34903482
endif

physics/CONV/SAMF/samfdeepcnv.meta

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,14 @@
188188
type = real
189189
kind = kind_phys
190190
intent = in
191+
[cscale]
192+
standard_name = multiplicative_tuning_parameter_for_convective_cloud_water
193+
long_name = multiplicative tuning parameter for convective cloud_water
194+
units = none
195+
dimensions = ()
196+
type = real
197+
kind = kind_phys
198+
intent = in
191199
[delt]
192200
standard_name = timestep_for_physics
193201
long_name = physics time step

physics/CONV/SAMF/samfshalcnv.f

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ subroutine samfshalcnv_run(im,km,itc,ntc,cliq,cp,cvap, &
5555
& t0c,delt,ntk,ntr,delp,first_time_step,restart, &
5656
& tmf,qmicro,progsigma,progomega, &
5757
& prslp,psp,phil,tkeh,qtr,prevsq,q,q1,t1,u1,v1,fscav, &
58-
& rn,kbot,ktop,kcnv,islimsk,garea, &
58+
& rn,kbot,ktop,kcnv,islimsk,garea,cscale, &
5959
& dot,ncloud,hpbl,ud_mf,dt_mf,cnvw,cnvc, &
6060
& clam,c0s,c1,evef,pgcon,asolfac,hwrf_samfshal, &
6161
& sigmain,sigmaout,omegain,omegaout,betadcu,betamcu,betascu, &
@@ -71,7 +71,7 @@ subroutine samfshalcnv_run(im,km,itc,ntc,cliq,cp,cvap, &
7171
real(kind=kind_phys), intent(in) :: cliq, cp, cvap, &
7272
& eps, epsm1, fv, grav, hvap, rd, rv, t0c, betascu, betadcu, &
7373
& betamcu
74-
real(kind=kind_phys), intent(in) :: delt
74+
real(kind=kind_phys), intent(in) :: delt, cscale
7575
real(kind=kind_phys), intent(in) :: psp(:), delp(:,:), &
7676
& prslp(:,:), garea(:), hpbl(:), dot(:,:), phil(:,:), &
7777
& tmf(:,:,:), q(:,:)
@@ -167,7 +167,7 @@ subroutine samfshalcnv_run(im,km,itc,ntc,cliq,cp,cvap, &
167167
! parameters for prognostic sigma closure
168168
real(kind=kind_phys) omega_u(im,km),zdqca(im,km),tmfq(im,km),
169169
& omegac(im),zeta(im,km),dbyo1(im,km),
170-
& sigmab(im),qadv(im,km),sigmaoutx(im)
170+
& sigmab(im),qadv(im,km)
171171
real(kind=kind_phys) gravinv,dxcrtas,invdelt,sigmind,sigmins,
172172
& sigminm
173173
logical flag_shallow,flag_mid
@@ -2441,23 +2441,16 @@ subroutine samfshalcnv_run(im,km,itc,ntc,cliq,cp,cvap, &
24412441
endif
24422442
enddo
24432443
c
2444-
if(progsigma)then
2445-
do i = 1, im
2446-
sigmaoutx(i)=max(sigmaout(i,1),0.0)
2447-
sigmaoutx(i)=min(sigmaoutx(i),1.0)
2448-
enddo
2449-
endif
2450-
24512444
c convective cloud water
24522445
do k = 1, km
24532446
do i = 1, im
24542447
if (cnvflg(i)) then
24552448
if (k >= kbcon(i) .and. k < ktcon(i)) then
24562449
cnvw(i,k) = cnvwt(i,k) * xmb(i) * dt2
24572450
if (progsigma) then
2458-
cnvw(i,k) = cnvw(i,k) * sigmaoutx(i)
2451+
cnvw(i,k) = cnvw(i,k) * cscale
24592452
else
2460-
cnvw(i,k) = cnvw(i,k) * sigmagfm(i)
2453+
cnvw(i,k) = cnvw(i,k) * cscale
24612454
endif
24622455
endif
24632456
endif

physics/CONV/SAMF/samfshalcnv.meta

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,14 @@
188188
type = real
189189
kind = kind_phys
190190
intent = in
191+
[cscale]
192+
standard_name = multiplicative_tuning_parameter_for_convective_cloud_water
193+
long_name = multiplicative tuning parameter for convective cloud water
194+
units = none
195+
dimensions = ()
196+
type = real
197+
kind = kind_phys
198+
intent = in
191199
[delt]
192200
standard_name = timestep_for_physics
193201
long_name = physics time step
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
!>\file GFS_rad_time_vary.mpas.F90
2+
!! Contains code related to GFS radiation suite setup (radiation part of time_vary_step)
3+
module GFS_rad_time_vary
4+
implicit none
5+
6+
private
7+
8+
public GFS_rad_time_vary_timestep_init
9+
10+
contains
11+
12+
!> This module contains code related to GFS radiation setup.
13+
14+
!> \section arg_table_GFS_rad_time_vary_timestep_init Argument Table
15+
!! \htmlinclude GFS_rad_time_vary_timestep_init.html
16+
!!
17+
subroutine GFS_rad_time_vary_timestep_init (lrseeds, rseeds, lslwr, lsswr, isubc_lw, &
18+
isubc_sw, icsdsw, icsdlw, sec, kdt, ipsd0, ipsdlim, errmsg, errflg)
19+
use mersenne_twister, only: random_setseed, random_index, random_stat
20+
use machine, only: kind_phys
21+
use radcons, only: con_100
22+
implicit none
23+
24+
! Interface variables
25+
logical, intent(in) :: lrseeds
26+
integer, intent(in), optional :: rseeds(:,:)
27+
integer, intent(in) :: isubc_lw, isubc_sw, kdt
28+
integer, intent(in) :: ipsd0, ipsdlim
29+
logical, intent(in) :: lslwr, lsswr
30+
integer, intent(inout), optional :: icsdsw(:), icsdlw(:)
31+
real(kind_phys), intent(in) :: sec
32+
character(len=*), intent(out) :: errmsg
33+
integer, intent(out) :: errflg
34+
35+
! Local variables
36+
type (random_stat) :: stat
37+
integer :: ix, j, i, ipseed, ixx
38+
integer, allocatable, dimension(:) :: numrdm
39+
40+
! Initialize CCPP error handling variables
41+
errmsg = ''
42+
errflg = 0
43+
44+
if (lsswr .or. lslwr) then
45+
!--- set up random seed index in a reproducible way for entire cubed-sphere face (lat-lon grid)
46+
if ((isubc_lw==2) .or. (isubc_sw==2)) then
47+
!NRL If random seeds supplied by NEPTUNE
48+
if(lrseeds) then
49+
do ix=1,size(icsdsw)
50+
icsdsw(ix) = rseeds(ix,1)
51+
icsdlw(ix) = rseeds(ix,2)
52+
enddo
53+
else
54+
allocate(numrdm(size(icsdlw)*2))
55+
ipseed = mod(nint(con_100*sqrt(sec)), ipsdlim) + 1 + ipsd0
56+
call random_setseed (ipseed, stat)
57+
call random_index (ipsdlim, numrdm, stat)
58+
59+
ixx = 1
60+
do ix=1,size(icsdsw)*2,2
61+
icsdsw(ixx) = numrdm(ix)
62+
icsdlw(ixx) = numrdm(ix+1)
63+
ixx = ixx + 1
64+
enddo
65+
deallocate(numrdm)
66+
end if ! lrseeds
67+
endif ! isubc_lw and isubc_sw
68+
endif ! lsswr or lslwr
69+
70+
end subroutine GFS_rad_time_vary_timestep_init
71+
72+
end module GFS_rad_time_vary
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
[ccpp-table-properties]
2+
name = GFS_rad_time_vary
3+
type = scheme
4+
relative_path = ../../
5+
dependencies = hooks/machine.F,Radiation/mersenne_twister.f,Radiation/RRTMG/radcons.f90
6+
7+
########################################################################
8+
[ccpp-arg-table]
9+
name = GFS_rad_time_vary_timestep_init
10+
type = scheme
11+
[lrseeds]
12+
standard_name = do_host_provided_random_seeds
13+
long_name = flag to use host-provided random seeds
14+
units = flag
15+
dimensions = ()
16+
type = logical
17+
intent = in
18+
[rseeds]
19+
standard_name = random_number_seeds_from_host
20+
long_name = random number seeds from host
21+
units = none
22+
dimensions = (horizontal_dimension, number_of_host_provided_random_number_streams)
23+
type = integer
24+
intent = in
25+
optional = True
26+
[lslwr]
27+
standard_name = flag_for_calling_longwave_radiation
28+
long_name = logical flags for lw radiation calls
29+
units = flag
30+
dimensions = ()
31+
type = logical
32+
intent = in
33+
[lsswr]
34+
standard_name = flag_for_calling_shortwave_radiation
35+
long_name = logical flags for sw radiation calls
36+
units = flag
37+
dimensions = ()
38+
type = logical
39+
intent = in
40+
[isubc_lw]
41+
standard_name = flag_for_lw_clouds_sub_grid_approximation
42+
long_name = flag for lw clouds sub-grid approximation
43+
units = flag
44+
dimensions = ()
45+
type = integer
46+
intent = in
47+
[isubc_sw]
48+
standard_name = flag_for_sw_clouds_grid_approximation
49+
long_name = flag for sw clouds sub-grid approximation
50+
units = flag
51+
dimensions = ()
52+
type = integer
53+
intent = in
54+
[icsdsw]
55+
standard_name = random_number_seed_for_mcica_shortwave
56+
long_name = random seeds for sub-column cloud generators sw
57+
units = none
58+
dimensions = (horizontal_dimension)
59+
type = integer
60+
intent = inout
61+
optional = True
62+
[icsdlw]
63+
standard_name = random_number_seed_for_mcica_longwave
64+
long_name = random seeds for sub-column cloud generators lw
65+
units = none
66+
dimensions = (horizontal_dimension)
67+
type = integer
68+
intent = inout
69+
optional = True
70+
[sec]
71+
standard_name = forecast_time_in_seconds
72+
long_name = seconds elapsed since model initialization
73+
units = s
74+
dimensions = ()
75+
type = real
76+
kind = kind_phys
77+
intent = in
78+
[kdt]
79+
standard_name = index_of_timestep
80+
long_name = current forecast iteration
81+
units = index
82+
dimensions = ()
83+
type = integer
84+
intent = in
85+
[ipsd0]
86+
standard_name = initial_seed_for_mcica
87+
long_name = initial permutaion seed for mcica radiation
88+
units = 1
89+
dimensions = ()
90+
type = integer
91+
intent = in
92+
[ipsdlim]
93+
standard_name = limit_for_initial_seed_for_mcica
94+
long_name = limit for initial permutaion seed for mcica radiation
95+
units = 1
96+
dimensions = ()
97+
type = integer
98+
intent = in
99+
[errmsg]
100+
standard_name = ccpp_error_message
101+
long_name = error message for error handling in CCPP
102+
units = none
103+
dimensions = ()
104+
type = character
105+
kind = len=*
106+
intent = out
107+
[errflg]
108+
standard_name = ccpp_error_code
109+
long_name = error code for error handling in CCPP
110+
units = 1
111+
dimensions = ()
112+
type = integer
113+
intent = out
114+

physics/PBL/SATMEDMF/mfscuq.f

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ 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,
19-
!The following flag is for SA-3D-TKE (kyf)
20-
& sa3dtke)
18+
& tcdo,qcdo,ucdo,vcdo,xlamdeq,a1)
2119
!
2220
use machine , only : kind_phys
2321
use funcphys , only : fpvs
@@ -33,7 +31,6 @@ subroutine mfscuq(im,ix,km,kmscu,ntcw,ntrac1,delt,
3331
integer krad(im), mrad(im)
3432
!
3533
logical cnvflg(im)
36-
logical sa3dtke !flag for SA-3D-TKE scheme (kyf)
3734
real(kind=kind_phys) delt
3835
real(kind=kind_phys) q1(ix,km,ntrac1),t1(ix,km),
3936
& u1(ix,km), v1(ix,km),
@@ -430,16 +427,6 @@ subroutine mfscuq(im,ix,km,kmscu,ntcw,ntrac1,delt,
430427
endif
431428
enddo
432429
!
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-
!
443430
!> - Compute scale-aware function based on
444431
!! Arakawa and Wu (2013) \cite arakawa_and_wu_2013
445432
!
@@ -460,6 +447,9 @@ subroutine mfscuq(im,ix,km,kmscu,ntcw,ntrac1,delt,
460447
do i = 1, im
461448
if(cnvflg(i) .and.
462449
& (k >= mrad(i) .and. k < krad(i))) then
450+
if (sigma(i) > ra1(i)) then
451+
xmfd(i,k) = sigma(i) * xmfd(i,k) / ra1(i)
452+
endif
463453
xmfd(i,k) = scaldfunc(i) * xmfd(i,k)
464454
dz = zl(i,k+1) - zl(i,k)
465455
xmmx = dz / dt2

0 commit comments

Comments
 (0)