Skip to content

Commit

Permalink
Update RRMTG cloud overlap method (wrf-model#759)
Browse files Browse the repository at this point in the history
TYPE: enhancement

KEYWORDS: HWRF, RRTMG, cloud overlap

SOURCE: John Henderson and Mike Iacono (AER)

DESCRIPTION OF CHANGES: Update RRMTG cloud overlap method options
Add a namelist switch to select various methods of handling cloud overlap in RRTMG LW/SW schemes. Default (2) should give same results as previous code (without the switch)

LIST OF MODIFIED FILES:
M Registry/Registry.EM_COMMON
M Registry/Registry.NMM
M dyn_em/module_first_rk_step_part1.F
M dyn_nmm/module_PHYSICS_CALLS.F
M phys/module_ra_rrtmg_lw.F
M phys/module_ra_rrtmg_sw.F
M phys/module_radiation_driver.F

TESTS CONDUCTED: Limited WTF (cheyenne/intel, handful of cases).
Small GNU regtest on cheyenne OK.
  • Loading branch information
llpcarson committed Jan 31, 2019
1 parent e28f2aa commit fb02002
Show file tree
Hide file tree
Showing 7 changed files with 204 additions and 104 deletions.
1 change: 1 addition & 0 deletions Registry/Registry.EM_COMMON
Expand Up @@ -2194,6 +2194,7 @@ rconfig real GSMDT namelist,physics max_domains 0
rconfig integer ISFFLX namelist,physics 1 1 irh "ISFFLX" "" ""
rconfig integer IFSNOW namelist,physics 1 1 irh "IFSNOW" "" ""
rconfig integer ICLOUD namelist,physics 1 1 irh "ICLOUD" "" ""
rconfig integer cldovrlp namelist,physics 1 2 irh "cldovrlp" "1=random, 2=maximum-random, 3=maximum, 4=exponential, 5=exponential-random" ""
rconfig integer ideal_xland namelist,physics 1 1 rh "IDEAL_XLAND" "land=1(def), water=2, for ideal cases with no land-use" ""
rconfig real swrad_scat namelist,physics 1 1 irh "SWRAD_SCAT" "SCATTERING FACTOR IN SWRAD" ""
rconfig integer surface_input_source namelist,physics 1 3 irh "surface_input_source" "1=static (fractional), 2=time dependent (dominant), 3=dominant cateogry from metgrid" ""
Expand Down
1 change: 1 addition & 0 deletions Registry/Registry.NMM
Expand Up @@ -1442,6 +1442,7 @@ rconfig integer ISFFLX namelist,physics 1 1
rconfig integer ideal_xland namelist,physics 1 1 rh "IDEAL_XLAND" "land=1(def), water=2, for ideal cases with no land-use" ""
rconfig integer IFSNOW namelist,physics 1 1 irh "IFSNOW" "" ""
rconfig integer ICLOUD namelist,physics 1 1 irh "ICLOUD" "" ""
rconfig integer cldovrlp namelist,physics 1 2 irh "cldovrlp" "1=random, 2=maximum-random, 3=maximum, 4=exponential, 5=exponential-random" ""
rconfig real swrad_scat namelist,physics 1 1 irh "SWRAD_SCAT" "SCATTERING FACTOR IN SWRAD" ""
rconfig integer surface_input_source namelist,physics 1 1 irh "surface_input_source" "1=static (fractional), 2=time dependent (dominant), 3=hybrid (not yet implemented)" ""
rconfig integer num_soil_layers namelist,physics 1 5 irh "num_soil_layers" "" ""
Expand Down
1 change: 1 addition & 0 deletions dyn_em/module_first_rk_step_part1.F
Expand Up @@ -351,6 +351,7 @@ SUBROUTINE first_rk_step_part1 ( grid , config_flags &
& , CLDFRA_DP=grid%cldfra_dp & ! ckay for subgrid cloud
& , CLDFRA_SH=grid%cldfra_sh &
& , icloud_bl=config_flags%icloud_bl & !JOE: subgrid BL clouds
& , cldovrlp=config_flags%cldovrlp & ! J. Henderson AER: cldovrlp namelist value
& , qc_bl=grid%qc_bl,cldfra_bl=grid%cldfra_bl & !JOE: subgrid bl clouds
& , re_cloud=grid%re_cloud, re_ice=grid%re_ice, re_snow=grid%re_snow & ! G. Thompson
& , has_reqc=grid%has_reqc, has_reqi=grid%has_reqi, has_reqs=grid%has_reqs & ! G. Thompson
Expand Down
1 change: 1 addition & 0 deletions dyn_nmm/module_PHYSICS_CALLS.F
Expand Up @@ -449,6 +449,7 @@ SUBROUTINE RADIATION(NTSD,DT,JULDAY,JULYR,XTIME,JULIAN &
& ,SW_PHYSICS=CONFIG_FLAGS%RA_SW_PHYSICS &
& ,RADT=RADT,RA_CALL_OFFSET=GRID%RA_CALL_OFFSET &
& ,STEPRA=NRAD,ICLOUD=config_flags%ICLOUD &
& ,cldovrlp=config_flags%cldovrlp & ! J. Henderson AER: cldovrlp namelist value
& ,WARM_RAIN=WARM_RAIN &
& ,SWDOWNC=TOTSWDNC,CLDFRA=CLFR &
& ,SWUPT=SWUPT &
Expand Down
152 changes: 100 additions & 52 deletions phys/module_ra_rrtmg_lw.F
Expand Up @@ -2086,7 +2086,7 @@ module mcica_subcol_gen_lw
! Public subroutines
!------------------------------------------------------------------

subroutine mcica_subcol_lw(iplon, ncol, nlay, icld, permuteseed, irng, play, &
subroutine mcica_subcol_lw(iplon, ncol, nlay, icld, permuteseed, irng, play, hgt, &
cldfrac, ciwp, clwp, cswp, rei, rel, res, tauc, cldfmcl, &
ciwpmcl, clwpmcl, cswpmcl, reicmcl, relqmcl, resnmcl, taucmcl)

Expand All @@ -2108,6 +2108,9 @@ subroutine mcica_subcol_lw(iplon, ncol, nlay, icld, permuteseed, irng, play, &
real(kind=rb), intent(in) :: play(:,:) ! layer pressures (mb)
! Dimensions: (ncol,nlay)

real(kind=rb), intent(in) :: hgt(:,:) ! layer height (m)
! Dimensions: (ncol,nlay)

! Atmosphere/clouds - cldprop
real(kind=rb), intent(in) :: cldfrac(:,:) ! layer cloud fraction
! Dimensions: (ncol,nlay)
Expand Down Expand Up @@ -2167,7 +2170,7 @@ subroutine mcica_subcol_lw(iplon, ncol, nlay, icld, permuteseed, irng, play, &

! Return if clear sky; or stop if icld out of range
if (icld.eq.0) return
if (icld.lt.0.or.icld.gt.3) then
if (icld.lt.0.or.icld.gt.5) then
stop 'MCICA_SUBCOL: INVALID ICLD'
endif

Expand Down Expand Up @@ -2198,14 +2201,14 @@ subroutine mcica_subcol_lw(iplon, ncol, nlay, icld, permuteseed, irng, play, &
! enddo

! Generate the stochastic subcolumns of cloud optical properties for the longwave;
call generate_stochastic_clouds (ncol, nlay, nsubclw, icld, irng, pmid, cldfrac, clwp, ciwp, cswp, tauc, &
call generate_stochastic_clouds (ncol, nlay, nsubclw, icld, irng, pmid, hgt, cldfrac, clwp, ciwp, cswp, tauc, &
cldfmcl, clwpmcl, ciwpmcl, cswpmcl, taucmcl, permuteseed)

end subroutine mcica_subcol_lw


!-------------------------------------------------------------------------------------------------
subroutine generate_stochastic_clouds(ncol, nlay, nsubcol, icld, irng, pmid, cld, clwp, ciwp, cswp, tauc, &
subroutine generate_stochastic_clouds(ncol, nlay, nsubcol, icld, irng, pmid, hgt, cld, clwp, ciwp, cswp, tauc, &
cld_stoch, clwp_stoch, ciwp_stoch, cswp_stoch, tauc_stoch, changeSeed)
!-------------------------------------------------------------------------------------------------

Expand All @@ -2215,10 +2218,13 @@ subroutine generate_stochastic_clouds(ncol, nlay, nsubcol, icld, irng, pmid, cld
!
! Original code: Based on Raisanen et al., QJRMS, 2004.
!
! Modifications: Generalized for use with RRTMG and added Mersenne Twister as the default
! Modifications:
! 1) Generalized for use with RRTMG and added Mersenne Twister as the default
! random number generator, which can be changed to the optional kissvec random number generator
! with flag 'irng'. Some extra functionality has been commented or removed.
! Michael J. Iacono, AER, Inc., February 2007
! 2) Activated exponential and exponential/random cloud overlap method
! Michael J. Iacono, AER, November 2017
!
! Given a profile of cloud fraction, cloud water and cloud ice, we produce a set of subcolumns.
! Each layer within each subcolumn is homogeneous, with cloud fraction equal to zero or one
Expand All @@ -2227,12 +2233,11 @@ subroutine generate_stochastic_clouds(ncol, nlay, nsubcol, icld, irng, pmid, cld
! and obeys an overlap assumption in the vertical.
!
! Overlap assumption:
! The cloud are consistent with 4 overlap assumptions: random, maximum, maximum-random and exponential.
! The default option is maximum-random (option 3)
! The options are: 1=random overlap, 2=max/random, 3=maximum overlap, 4=exponential overlap
! This is set with the variable "overlap"
!mji - Exponential overlap option (overlap=4) has been deactivated in this version
! The exponential overlap uses also a length scale, Zo. (real, parameter :: Zo = 2500. )
! The cloud are consistent with 5 overlap assumptions: random, maximum, maximum-random, exponential and exponential random.
! The default option is maximum-random (option 2)
! The options are: 1=random overlap, 2=max/random, 3=maximum overlap, 4=exponential overlap, 5=exp/random
! This is set with the variable "overlap"
! The exponential overlap uses also a length scale, Zo. (real, parameter :: Zo = 2500. )
!
! Seed:
! If the stochastic cloud generator is called several times during the same timestep,
Expand Down Expand Up @@ -2284,6 +2289,8 @@ subroutine generate_stochastic_clouds(ncol, nlay, nsubcol, icld, irng, pmid, cld
! Column state (cloud fraction, cloud water, cloud ice) + variables needed to read physics state
real(kind=rb), intent(in) :: pmid(:,:) ! layer pressure (Pa)
! Dimensions: (ncol,nlay)
real(kind=rb), intent(in) :: hgt(:,:) ! layer height (m)
! Dimensions: (ncol,nlay)
real(kind=rb), intent(in) :: cld(:,:) ! cloud fraction
! Dimensions: (ncol,nlay)
real(kind=rb), intent(in) :: clwp(:,:) ! in-cloud liquid water path
Expand Down Expand Up @@ -2330,11 +2337,11 @@ subroutine generate_stochastic_clouds(ncol, nlay, nsubcol, icld, irng, pmid, cld
! real(kind=rb) :: mean_asmc_stoch(ncol, nlay) ! cloud asymmetry parameter

! Set overlap
integer(kind=im) :: overlap ! 1 = random overlap, 2 = maximum/random,
! 3 = maximum overlap,
! real(kind=rb), parameter :: Zo = 2500._rb ! length scale (m)
! real(kind=rb) :: zm(ncol,nlay) ! Height of midpoints (above surface)
! real(kind=rb), dimension(nlay) :: alpha=0.0_rb ! overlap parameter
integer(kind=im) :: overlap ! 1 = random overlap, 2 = maximum-random,
! 3 = maximum overlap, 4 = exponential,
! 5 = exponential-random
real(kind=rb), parameter :: Zo = 2500._rb ! length scale (m)
real(kind=rb), dimension(ncol,nlay) :: alpha ! overlap parameter

! Constants (min value for cloud fraction and cloud water and ice)
real(kind=rb), parameter :: cldmin = 1.0e-20_rb ! min cloud fraction
Expand Down Expand Up @@ -2481,39 +2488,56 @@ subroutine generate_stochastic_clouds(ncol, nlay, nsubcol, icld, irng, pmid, cld
enddo
endif

! case(4) - inactive
! ! Exponential overlap: weighting between maximum and random overlap increases with the distance.
! ! The random numbers for exponential overlap verify:
! ! j=1 RAN(j)=RND1
! ! j>1 if RND1 < alpha(j,j-1) => RAN(j) = RAN(j-1)
! ! RAN(j) = RND2
! ! alpha is obtained from the equation
! ! alpha = exp(- (Zi-Zj-1)/Zo) where Zo is a characteristic length scale


! ! compute alpha
! zm = state%zm
! alpha(:, 1) = 0.
! do ilev = 2,nlay
! alpha(:, ilev) = exp( -( zm (:, ilev-1) - zm (:, ilev)) / Zo)
! end do

! ! generate 2 streams of random numbers
! do isubcol = 1,nsubcol
! do ilev = 1,nlay
! call kissvec(seed1, seed2, seed3, seed4, rand_num)
! CDF(isubcol, :, ilev) = rand_num
! call kissvec(seed1, seed2, seed3, seed4, rand_num)
! CDF2(isubcol, :, ilev) = rand_num
! end do
! end do

! ! generate random numbers
! do ilev = 2,nlay
! where (CDF2(:, :, ilev) < spread(alpha (:,ilev), dim=1, nCopies=nsubcol) )
! CDF(:,:,ilev) = CDF(:,:,ilev-1)
! end where
! end do
case(4)
! Exponential overlap: weighting between maximum and random overlap increases with the distance.
! The random numbers for exponential overlap verify:
! j=1 RAN(j)=RND1
! j>1 if RND1 < alpha(j,j-1) => RAN(j) = RAN(j-1)
! RAN(j) = RND2
! alpha is obtained from the equation
! alpha = exp(-(Z(j)-Z(j-1))/Zo) where Zo is a characteristic length scale

! compute alpha
do i = 1, ncol
alpha(i, 1) = 0._rb
do ilev = 2,nlay
alpha(i, ilev) = exp( -( hgt (i, ilev) - hgt (i, ilev-1)) / Zo)
enddo
enddo

! generate 2 streams of random numbers
if (irng.eq.0) then
do isubcol = 1,nsubcol
do ilev = 1,nlay
call kissvec(seed1, seed2, seed3, seed4, rand_num)
CDF(isubcol, :, ilev) = rand_num
call kissvec(seed1, seed2, seed3, seed4, rand_num)
CDF2(isubcol, :, ilev) = rand_num
enddo
enddo
elseif (irng.eq.1) then
do isubcol = 1, nsubcol
do i = 1, ncol
do ilev = 1, nlay
rand_num_mt = getRandomReal(randomNumbers)
CDF(isubcol,i,ilev) = rand_num_mt
rand_num_mt = getRandomReal(randomNumbers)
CDF2(isubcol,i,ilev) = rand_num_mt
enddo
enddo
enddo
endif

! generate random numbers
do ilev = 2,nlay
where (CDF2(:, :, ilev) < spread(alpha (:,ilev), dim=1, nCopies=nsubcol) )
CDF(:,:,ilev) = CDF(:,:,ilev-1)
end where
end do

case(5)
! Exponential-random overlap:
call wrf_error_fatal("Cloud Overlap case 5: ER has not yet been implemented. Stopping...")

end select

Expand Down Expand Up @@ -10687,6 +10711,8 @@ subroutine rrtmg_lw &
! 1: Random
! 2: Maximum/random
! 3: Maximum
! 4: Exponential
! 5: Exponential/random
real(kind=rb), intent(in) :: play(:,:) ! Layer pressures (hPa, mb)
! Dimensions: (ncol,nlay)
real(kind=rb), intent(in) :: plev(:,:) ! Interface pressures (hPa, mb)
Expand Down Expand Up @@ -10927,7 +10953,8 @@ subroutine rrtmg_lw &
! icld = 1, with clouds using random cloud overlap
! icld = 2, with clouds using maximum/random cloud overlap
! icld = 3, with clouds using maximum cloud overlap (McICA only)
if (icld.lt.0.or.icld.gt.3) icld = 2
! icld = 4, with clouds using exponential cloud overlap (McICA only)
! icld = 5, with clouds using exponential/random cloud overlap (McICA only)

! Set iaer to select aerosol option
! iaer = 0, no aerosols
Expand Down Expand Up @@ -11461,6 +11488,7 @@ SUBROUTINE RRTMG_LWRAD( &
p8w, p3d, pi3d, &
dz8w, tsk, t3d, t8w, rho3d, r, g, &
icloud, warm_rain, cldfra3d, &
cldovrlp, &
lradius,iradius, &
is_cammgmp_used, &
f_ice_phy, f_rain_phy, &
Expand Down Expand Up @@ -11634,6 +11662,7 @@ SUBROUTINE RRTMG_LWRAD( &
integer :: ncol, &
nlay, &
icld, &
cldovrlp, &
inflglw, &
iceflglw, &
liqflglw
Expand All @@ -11653,6 +11682,10 @@ SUBROUTINE RRTMG_LWRAD( &
cfc22vmr, &
ccl4vmr
real, dimension( kts:nlayers ) :: o3mmr
! Add height of each layer for exponential-random cloud overlap
! This will be derived below from the dz in each layer
real, dimension( 1, kts:nlayers ) :: hgt
real :: dzsum
! For old cloud property specification for rrtm_lw
real, dimension( kts:kte ) :: clwp, &
ciwp, &
Expand Down Expand Up @@ -12046,6 +12079,8 @@ SUBROUTINE RRTMG_LWRAD( &
! Steven Cavallo, December 2010
nlay = nlayers ! Keep these indices the same

! Select cloud overlap assumption (1 = random, 2 = maximum-random, 3 = maximum, 4 = exponential, 5 = exponential-random
icld=cldovrlp ! J. Henderson AER assign namelist variable cldovrlp to existing icld

! Select cloud liquid and ice optics parameterization options
! For passing in cloud optical properties directly:
Expand All @@ -12054,7 +12089,6 @@ SUBROUTINE RRTMG_LWRAD( &
! iceflglw = 0
! liqflglw = 0
! For passing in cloud physical properties; cloud optics parameterized in RRTMG:
icld = 2
inflglw = 2
iceflglw = 3
liqflglw = 1
Expand Down Expand Up @@ -12168,6 +12202,15 @@ SUBROUTINE RRTMG_LWRAD( &
ccl4vmr(ncol,k) = ccl4
enddo

! Derive height of each layer mid-point from layer thickness.
! Needed for exponential (icld=4) and exponential-random overlap (icld=5) options only.
dzsum = 0.0
do k = kts, kte
dz = dz1d(k)
hgt(ncol,k) = dzsum + 0.5*dz
dzsum = dzsum + dz
enddo

! This section is replaced with a new method to deal with model top
if ( 1 == 0 ) then

Expand Down Expand Up @@ -12204,6 +12247,11 @@ SUBROUTINE RRTMG_LWRAD( &
do L=kte+1,nlayers,1
plev(ncol,L+1) = plev(ncol,L) - deltap
play(ncol,L) = 0.5*(plev(ncol,L) + plev(ncol,L+1))
! Fill in height array above model top to top of atmosphere using
! dz from model top layer for completeness, though this information is not
! likely to be used by the exponential-random cloud overlap method.
hgt(ncol,L) = dzsum + 0.5*dz
dzsum = dzsum + dz
enddo
! Add zero as top level. This gets the temperature max at the
! stratopause, reducing the downward flux errors in the top
Expand Down Expand Up @@ -12552,7 +12600,7 @@ SUBROUTINE RRTMG_LWRAD( &
permuteseed = 150

! Sub-column generator for McICA
call mcica_subcol_lw(iplon, ncol, nlay, icld, permuteseed, irng, play, &
call mcica_subcol_lw(iplon, ncol, nlay, icld, permuteseed, irng, play, hgt, &
cldfrac, ciwpth, clwpth, cswpth, rei, rel, res, taucld, cldfmcl, &
ciwpmcl, clwpmcl, cswpmcl, reicmcl, relqmcl, resnmcl, taucmcl)

Expand Down

0 comments on commit fb02002

Please sign in to comment.