Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revisions to repair iovr=5 cloud overlap option #830

Merged
merged 5 commits into from
Jan 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 117 additions & 0 deletions physics/radiation_clouds.f
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,19 @@ subroutine progcld1 &
alpha(:,:) = 0.
endif

! Revise alpha for exponential-random cloud overlap
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is exactly the same block of code, nine times, in the same file. In a future cleanup of the code, one could make this a separate subroutine to call from the various places.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Now that Dom has opened this door, a word of explanation. My original vision for "get_alpha" was that it should define alpha for either iovr=4 (EXP) and iovr=5 (ER), and this was how I originally provided that subroutine. For some reason, get_alpha was later changed by someone to get_alpha_exp and simplified so that it only defined alpha for iovr=4. In the process the definition of alpha for iovr=5 was inadvertently dropped for RRTMG, which is the reason for the change provided by this PR. In the meantime, Dustin accounted for this discrepancy in RRTMGP by adding this code block after that model's call to get_alpha_exp. For this PR, I decided to apply Dustin's solution to RRTMG, which allowed this upgrade without also having to modify RRTMGP. I think it best at some point to revert to my original vision for get_alpha and build this block of code into that subroutine, which will have the advantage of providing the simplification that Dom mentions. However, it will mean passing iovr and cldfrac into get_alpha and then revising calls to it it accordingly.

! Decorrelate layers when a clear layer follows a cloudy layer to enforce
! random correlation between non-adjacent blocks of cloudy layers
if (iovr == 5) then
do k = 2, nLay
do i = 1, ix
if (clouds(i,k,1) == 0.0 .and. clouds(i,k-1,1) > 0.0) then
alpha(i,k) = 0.0
endif
enddo
enddo
endif

!> - Call gethml() to compute low,mid,high,total, and boundary layer
!! cloud fractions and clouds top/bottom layer indices for low, mid,
!! and high clouds. The three cloud domain boundaries are defined by
Expand Down Expand Up @@ -1272,6 +1285,19 @@ subroutine progcld2 &
alpha(:,:) = 0.
endif

! Revise alpha for exponential-random cloud overlap
! Decorrelate layers when a clear layer follows a cloudy layer to enforce
! random correlation between non-adjacent blocks of cloudy layers
if (iovr == 5) then
do k = 2, nLay
do i = 1, ix
if (clouds(i,k,1) == 0.0 .and. clouds(i,k-1,1) > 0.0) then
alpha(i,k) = 0.0
endif
enddo
enddo
endif

!> - Call gethml() to compute low,mid,high,total, and boundary layer
!! cloud fractions and clouds top/bottom layer indices for low, mid,
!! and high clouds.
Expand Down Expand Up @@ -1699,6 +1725,19 @@ subroutine progcld3 &
alpha(:,:) = 0.
endif

! Revise alpha for exponential-random cloud overlap
! Decorrelate layers when a clear layer follows a cloudy layer to enforce
! random correlation between non-adjacent blocks of cloudy layers
if (iovr == 5) then
do k = 2, nLay
do i = 1, ix
if (clouds(i,k,1) == 0.0 .and. clouds(i,k-1,1) > 0.0) then
alpha(i,k) = 0.0
endif
enddo
enddo
endif

!> -# Call gethml() to compute low,mid,high,total, and boundary layer
!! cloud fractions and clouds top/bottom layer indices for low, mid,
!! and high clouds.
Expand Down Expand Up @@ -2062,6 +2101,19 @@ subroutine progcld4 &
alpha(:,:) = 0.
endif

! Revise alpha for exponential-random cloud overlap
! Decorrelate layers when a clear layer follows a cloudy layer to enforce
! random correlation between non-adjacent blocks of cloudy layers
if (iovr == 5) then
do k = 2, nLay
do i = 1, ix
if (clouds(i,k,1) == 0.0 .and. clouds(i,k-1,1) > 0.0) then
alpha(i,k) = 0.0
endif
enddo
enddo
endif

! --- compute low, mid, high, total, and boundary layer cloud fractions
! and clouds top/bottom layer indices for low, mid, and high clouds.
! The three cloud domain boundaries are defined by ptopc. The cloud
Expand Down Expand Up @@ -2416,6 +2468,19 @@ subroutine progcld4o &
alpha(:,:) = 0.
endif

! Revise alpha for exponential-random cloud overlap
! Decorrelate layers when a clear layer follows a cloudy layer to enforce
! random correlation between non-adjacent blocks of cloudy layers
if (iovr == 5) then
do k = 2, nLay
do i = 1, ix
if (clouds(i,k,1) == 0.0 .and. clouds(i,k-1,1) > 0.0) then
alpha(i,k) = 0.0
endif
enddo
enddo
endif

!> - Call gethml() to compute low, mid, high, total, and boundary layer cloud fractions
!! and clouds top/bottom layer indices for low, mid, and high clouds.
!! The three cloud domain boundaries are defined by ptopc. The cloud
Expand Down Expand Up @@ -2792,6 +2857,19 @@ subroutine progcld5 &
alpha(:,:) = 0.
endif

! Revise alpha for exponential-random cloud overlap
! Decorrelate layers when a clear layer follows a cloudy layer to enforce
! random correlation between non-adjacent blocks of cloudy layers
if (iovr == 5) then
do k = 2, nLay
do i = 1, ix
if (clouds(i,k,1) == 0.0 .and. clouds(i,k-1,1) > 0.0) then
alpha(i,k) = 0.0
endif
enddo
enddo
endif

!> - Call gethml() to compute low,mid,high,total, and boundary layer
!! cloud fractions and clouds top/bottom layer indices for low, mid,
!! and high clouds.
Expand Down Expand Up @@ -3188,6 +3266,19 @@ subroutine progcld6 &
alpha(:,:) = 0.
endif

! Revise alpha for exponential-random cloud overlap
! Decorrelate layers when a clear layer follows a cloudy layer to enforce
! random correlation between non-adjacent blocks of cloudy layers
if (iovr == 5) then
do k = 2, nLay
do i = 1, ix
if (clouds(i,k,1) == 0.0 .and. clouds(i,k-1,1) > 0.0) then
alpha(i,k) = 0.0
endif
enddo
enddo
endif

!> - Call gethml() to compute low,mid,high,total, and boundary layer
!! cloud fractions and clouds top/bottom layer indices for low, mid,
!! and high clouds.
Expand Down Expand Up @@ -3555,6 +3646,19 @@ subroutine progcld_thompson &
alpha(:,:) = 0.
endif

! Revise alpha for exponential-random cloud overlap
! Decorrelate layers when a clear layer follows a cloudy layer to enforce
! random correlation between non-adjacent blocks of cloudy layers
if (iovr == 5) then
do k = 2, nLay
do i = 1, ix
if (clouds(i,k,1) == 0.0 .and. clouds(i,k-1,1) > 0.0) then
alpha(i,k) = 0.0
endif
enddo
enddo
endif

!> - Call gethml() to compute low,mid,high,total, and boundary layer
!! cloud fractions and clouds top/bottom layer indices for low, mid,
!! and high clouds.
Expand Down Expand Up @@ -3952,6 +4056,19 @@ subroutine progclduni &
alpha(:,:) = 0.
endif

! Revise alpha for exponential-random cloud overlap
! Decorrelate layers when a clear layer follows a cloudy layer to enforce
! random correlation between non-adjacent blocks of cloudy layers
if (iovr == 5) then
do k = 2, nLay
do i = 1, ix
if (clouds(i,k,1) == 0.0 .and. clouds(i,k-1,1) > 0.0) then
alpha(i,k) = 0.0
endif
enddo
enddo
endif

!> - Call gethml() to compute low,mid,high,total, and boundary layer
!! cloud fractions and clouds top/bottom layer indices for low, mid,
!! and high clouds.
Expand Down
54 changes: 28 additions & 26 deletions physics/radlw_main.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1363,7 +1363,8 @@ subroutine rlwinit &
! =1: maximum/random overlapping clouds !
! =2: maximum overlap cloud (isubcol>0 only) !
! =3: decorrelation-length overlap (for isubclw>0 only) !
! =4: exponential overlap cloud
! =4: exponential cloud overlap (AER) !
! =5: exponential-random cloud overlap (AER) !
! !
! ******************************************************************* !
! original code description !
Expand Down Expand Up @@ -1407,7 +1408,7 @@ subroutine rlwinit &
!
!===> ... begin here
!
if ( iovr<0 .or. iovr>4 ) then
if ( iovr<0 .or. iovr>5 ) then
print *,' *** Error in specification of cloud overlap flag', &
& ' IOVR=',iovr,' in RLWINIT !!'
stop
Expand Down Expand Up @@ -1896,6 +1897,7 @@ subroutine mcica_subcol &
! other control flags from module variables: !
! iovr : control flag for cloud overlapping method !
! =0:random; =1:maximum/random: =2:maximum; =3:decorr !
! =4:exponential; =5:exponential-random !
! !
! ===================== end of definitions ==================== !

Expand Down Expand Up @@ -2084,39 +2086,39 @@ subroutine mcica_subcol &

! --- setup 2 sets of random numbers

! call random_number ( rand2d, stat )
call random_number ( rand2d, stat )

! k1 = 0
! do k = 1, nlay
! do n = 1, ngptlw
! k1 = k1 + 1
! cdfunc(n,k) = rand2d(k1)
! enddo
! enddo
k1 = 0
do k = 1, nlay
do n = 1, ngptlw
k1 = k1 + 1
cdfunc(n,k) = rand2d(k1)
enddo
enddo

! call random_number ( rand2d, stat )
call random_number ( rand2d, stat )

! k1 = 0
! do k = 1, nlay
! do n = 1, ngptlw
! k1 = k1 + 1
! cdfun2(n,k) = rand2d(k1)
! enddo
! enddo
k1 = 0
do k = 1, nlay
do n = 1, ngptlw
k1 = k1 + 1
cdfun2(n,k) = rand2d(k1)
enddo
enddo

! --- then working upward from the surface:
! if a random number (from an independent set: cdfun2) is smaller than
! alpha, then use the previous layer's number, otherwise use a new random
! number (keep the originally assigned one in cdfunc for that layer).

! do k = 2, nlay
! k1 = k - 1
! do n = 1, ngptlw
! if ( cdfun2(n,k) < alpha(k) ) then
! cdfunc(n,k) = cdfunc(n,k1)
! endif
! enddo
! enddo
do k = 2, nlay
k1 = k - 1
do n = 1, ngptlw
if ( cdfun2(n,k) < alpha(k) ) then
cdfunc(n,k) = cdfunc(n,k1)
endif
enddo
enddo

end select

Expand Down
8 changes: 5 additions & 3 deletions physics/radsw_main.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,7 @@ subroutine rrtmg_sw_run &
endif
enddo
zcf0 = zcf0 * zcf1
else if (iovr >= 2 .and. iovr /= 4) then
else if (iovr >= 2) then
do k = 1, nlay
zcf0 = min ( zcf0, f_one-cfrac(k) ) ! used only as clear/cloudy indicator
enddo
Expand Down Expand Up @@ -1436,6 +1436,8 @@ subroutine rswinit &
! =1: maximum/random overlapping clouds !
! =2: maximum overlap cloud !
! =3: decorrelation-length overlap clouds !
! =4: exponential cloud overlap (AER) !
! =5: exponential-random cloud overlap (AER) !
! iswmode - control flag for 2-stream transfer scheme !
! =1; delta-eddington (joseph et al., 1976) !
! =2: pifm (zdunkowski et al., 1980) !
Expand Down Expand Up @@ -1467,7 +1469,7 @@ subroutine rswinit &
!
!===> ... begin here
!
if ( iovr<0 .or. iovr>4 ) then
if ( iovr<0 .or. iovr>5 ) then
print *,' *** Error in specification of cloud overlap flag', &
& ' IOVR=',iovr,' in RSWINIT !!'
stop
Expand Down Expand Up @@ -1935,7 +1937,7 @@ subroutine cldprop &
!> -# if physparam::isubcsw > 0, call mcica_subcol() to distribute
!! cloud properties to each g-point.

if ( isubcsw > 0 .and. iovr /= 4 ) then ! mcica sub-col clouds approx
if ( isubcsw > 0 ) then ! mcica sub-col clouds approx

cldf(:) = cfrac(:)
where (cldf(:) < ftiny)
Expand Down