Skip to content

Commit

Permalink
Bug fix for decomposition tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinswales committed Nov 10, 2021
1 parent f63c8a3 commit 0a545c6
Showing 1 changed file with 1 addition and 36 deletions.
37 changes: 1 addition & 36 deletions physics/rrtmgp_sw_cloud_sampling.F90
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,6 @@ subroutine rrtmgp_sw_cloud_sampling_run(doSWrad, nCol, nDay, nLev, idxday, iovr,
! Allocate space RRTMGP DDTs [nday,nLev,nGpt]
call check_error_msg('rrtmgp_sw_cloud_sampling_run', &
sw_optical_props_clouds%alloc_2str(nday, nLev, sw_gas_props))
sw_optical_props_clouds%tau(:,:,:) = 0._kind_phys
sw_optical_props_clouds%ssa(:,:,:) = 1._kind_phys
sw_optical_props_clouds%g(:,:,:) = 0._kind_phys

! Change random number seed value for each radiation invocation (isubc_sw =1 or 2).
if(isubc_sw == 1) then ! advance prescribed permutation seed
Expand All @@ -99,7 +96,7 @@ subroutine rrtmgp_sw_cloud_sampling_run(doSWrad, nCol, nDay, nLev, idxday, iovr,
enddo
elseif (isubc_sw == 2) then ! use input array of permutaion seeds
do iday = 1, nday
ipseed_sw(iday) = icseed_sw(iday)
ipseed_sw(iday) = icseed_sw(idxday(iday))
enddo
endif

Expand All @@ -121,12 +118,6 @@ subroutine rrtmgp_sw_cloud_sampling_run(doSWrad, nCol, nDay, nLev, idxday, iovr,
endif
enddo

do iday=1,nday
call random_setseed(ipseed_sw(iday),rng_stat)
call random_number(rng2D,rng_stat)
rng3D(:,:,iday) = reshape(source = rng2D,shape=[sw_gas_props%get_ngpt(),nLev])
enddo

! Cloud overlap.
! Maximum-random, random, or maximum cloud overlap
if (iovr == iovr_maxrand .or. iovr == iovr_max .or. iovr == iovr_rand) then
Expand Down Expand Up @@ -164,26 +155,6 @@ subroutine rrtmgp_sw_cloud_sampling_run(doSWrad, nCol, nDay, nLev, idxday, iovr,
! Allocate space RRTMGP DDTs [nday,nLev,nGpt]
call check_error_msg('rrtmgp_sw_cloud_sampling_run', &
sw_optical_props_precip%alloc_2str( nday, nLev, sw_gas_props))

! Change random number seed value for each radiation invocation (isubc_sw =1 or 2).
if(isubc_sw == 1) then ! advance prescribed permutation seed
do iday = 1, nday
ipseed_sw(iday) = sw_gas_props%get_ngpt() + iday
enddo
elseif (isubc_sw == 2) then ! use input array of permutaion seeds
do iday = 1, nday
ipseed_sw(iday) = icseed_sw(iday)
enddo
endif

! No need to call RNG second time for now, just use the same seeds for precip as clouds.
!! Call RNG. Mersennse Twister accepts 1D array, so loop over columns and collapse along G-points
!! and layers. ([nGpts,nLev,nDay]-> [nGpts*nLev]*nDay)
!do iday=1,nday
! call random_setseed(ipseed_sw(iday),rng_stat)
! call random_number(rng1D,rng_stat)
! rng3D(:,:,iday) = reshape(source = rng1D,shape=[sw_gas_props%get_ngpt(),nLev])
!enddo

! Precipitation overlap
! Maximum-random, random or maximum precipitation overlap
Expand All @@ -192,12 +163,6 @@ subroutine rrtmgp_sw_cloud_sampling_run(doSWrad, nCol, nDay, nLev, idxday, iovr,
endif
! Exponential decorrelation length overlap
if (iovr == iovr_dcorr) then
!! Generate second RNG
!do iday=1,nday
! call random_setseed(ipseed_sw(iday),rng_stat)
! call random_number(rng1D,rng_stat)
! rng3D2(:,:,iday) = reshape(source = rng1D,shape=[sw_gas_props%get_ngpt(),nLev])
!enddo
call sampled_mask(rng3D, precip_frac(idxday(1:nDay),:), precipfracSAMP, &
overlap_param = precip_overlap_param(idxday(1:nDay),1:nLev-1),&
randoms2 = rng3D2)
Expand Down

0 comments on commit 0a545c6

Please sign in to comment.