Skip to content

Commit

Permalink
Round cloud-fractions to avoid McICA sampling error.
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinswales committed Dec 17, 2019
1 parent e30305d commit 5b02c9e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 6 additions & 2 deletions physics/rrtmgp_lw_cloud_sampling.F90
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ subroutine rrtmgp_lw_cloud_sampling_run(doLWrad, nCol, nLev, ipsdlw0, icseed_lw,
real(kind_phys), dimension(lw_gas_props%get_ngpt(),nLev,ncol) :: rng3D
real(kind_phys), dimension(lw_gas_props%get_ngpt()*nLev) :: rng1D
logical, dimension(ncol,nLev,lw_gas_props%get_ngpt()) :: cldfracMCICA
real(kind_phys), dimension(ncol,nLev) :: cld_frac_noSamp

! Initialize CCPP error handling variables
errmsg = ''
Expand Down Expand Up @@ -102,12 +103,15 @@ subroutine rrtmgp_lw_cloud_sampling_run(doLWrad, nCol, nLev, ipsdlw0, icseed_lw,
call random_number(rng1D,rng_stat)
rng3D(:,:,iCol) = reshape(source = rng1D,shape=[lw_gas_props%get_ngpt(),nLev])
enddo


! Test: Remove McICA sampling error by setting cloud-fraction to one.
cld_frac_noSamp = ceiling(cld_frac)

! Call McICA
select case ( iovrlw )
! Maximumn-random
case(1)
call check_error_msg('rrtmgp_lw_cloud_sampling_run',sampled_mask_max_ran(rng3D,cld_frac,cldfracMCICA))
call check_error_msg('rrtmgp_lw_cloud_sampling_run',sampled_mask_max_ran(rng3D,cld_frac_noSamp,cldfracMCICA))
end select

! Map band optical depth to each g-point using McICA
Expand Down
7 changes: 6 additions & 1 deletion physics/rrtmgp_sw_cloud_sampling.F90
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ subroutine rrtmgp_sw_cloud_sampling_run(doSWrad, nCol, nDay, nLev, ipsdsw0, idxd
real(kind_phys), dimension(sw_gas_props%get_ngpt(),nLev,ncol) :: rng3D
real(kind_phys), dimension(sw_gas_props%get_ngpt()*nLev) :: rng1D
logical, dimension(ncol,nLev,sw_gas_props%get_ngpt()) :: cldfracMCICA
real(kind_phys), dimension(ncol,nLev) :: cld_frac_noSamp

! Initialize CCPP error handling variables
errmsg = ''
Expand Down Expand Up @@ -108,11 +109,15 @@ subroutine rrtmgp_sw_cloud_sampling_run(doSWrad, nCol, nDay, nLev, ipsdsw0, idxd
rng3D(:,:,iCol) = reshape(source = rng1D,shape=[sw_gas_props%get_ngpt(),nLev])
enddo


! Test: Remove McICA sampling error by setting cloud-fraction to one.
cld_frac_noSamp = ceiling(cld_frac)

! Call McICA
select case ( iovrsw )
! Maximumn-random
case(1)
call check_error_msg('rrtmgp_sw_cloud_sampling_run',sampled_mask_max_ran(rng3D,cld_frac,cldfracMCICA))
call check_error_msg('rrtmgp_sw_cloud_sampling_run',sampled_mask_max_ran(rng3D,cld_frac_noSamp,cldfracMCICA))
end select

! Map band optical depth to each g-point using McICA
Expand Down

0 comments on commit 5b02c9e

Please sign in to comment.