Skip to content

Commit

Permalink
Merge pull request #536 from dustinswales/master-ncar-d1be22d
Browse files Browse the repository at this point in the history
Fix for issue 535. Plus small correction.
  • Loading branch information
climbfuji authored Dec 30, 2020
2 parents 8785df5 + 59ab3fe commit d2db535
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 31 deletions.
61 changes: 42 additions & 19 deletions physics/GFS_rrtmgp_gfdlmp_pre.F90
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@ module GFS_rrtmgp_gfdlmp_pre
use machine, only: kind_phys
use rrtmgp_aux, only: check_error_msg
use module_radiation_cloud_overlap, only: cmp_dcorr_lgth, get_alpha_exp
use rrtmgp_lw_cloud_optics, only: radliq_lwr, radliq_upr, radice_lwr, radice_upr

! Parameters
real(kind_phys), parameter :: &
reliq_def = 10.0 , & ! Default liq radius to 10 micron (used when effr_in=F)
reice_def = 50.0, & ! Default ice radius to 50 micron (used when effr_in=F)
rerain_def = 1000.0, & ! Default rain radius to 1000 micron (used when effr_in=F)
resnow_def = 250.0, & ! Default snow radius to 250 micron (used when effr_in=F)
reice_min = 10.0, & ! Minimum ice size allowed by scheme
reice_max = 150.0 ! Maximum ice size allowed by scheme

resnow_def = 250.0, & ! Default snow radius to 250 micron (used when effr_in=F)
reice_min = 10.0, & ! Minimum ice size allowed by GFDL MP scheme
reice_max = 150.0 ! Maximum ice size allowed by GFDL MP scheme
! NOTE: When using RRTMGP cloud-optics, the min/max particle size allowed are imported
! from initialization.

public GFS_rrtmgp_gfdlmp_pre_init, GFS_rrtmgp_gfdlmp_pre_run, GFS_rrtmgp_gfdlmp_pre_finalize

contains
Expand All @@ -30,9 +33,9 @@ end subroutine GFS_rrtmgp_gfdlmp_pre_init
!! \htmlinclude GFS_rrtmgp_gfdlmp_pre_run.html
!!
subroutine GFS_rrtmgp_gfdlmp_pre_run(nCol, nLev, nTracers, ncnd, i_cldliq, i_cldice, &
i_cldrain, i_cldsnow, i_cldgrpl, i_cldtot, doSWrad, doLWrad, effr_in, &
p_lev, p_lay, tv_lay, effrin_cldliq, effrin_cldice, effrin_cldrain, &
effrin_cldsnow, tracer, con_g, con_rd, &
i_cldrain, i_cldsnow, i_cldgrpl, i_cldtot, doSWrad, doLWrad, effr_in, kdt, &
do_mynnedmf, p_lev, p_lay, tv_lay, effrin_cldliq, effrin_cldice, effrin_cldrain, &
effrin_cldsnow, tracer, con_g, con_rd, doGP_cldoptics_PADE, doGP_cldoptics_LUT, &
cld_frac, cld_lwp, cld_reliq, cld_iwp, cld_reice, cld_swp, cld_resnow, cld_rwp, &
cld_rerain, precip_frac, errmsg, errflg)
implicit none
Expand All @@ -48,11 +51,15 @@ subroutine GFS_rrtmgp_gfdlmp_pre_run(nCol, nLev, nTracers, ncnd, i_cldliq, i_cld
i_cldrain, & ! Index into tracer array for cloud rain.
i_cldsnow, & ! Index into tracer array for cloud snow.
i_cldgrpl, & ! Index into tracer array for cloud groupel.
i_cldtot ! Index into tracer array for cloud total amount.
i_cldtot, & ! Index into tracer array for cloud total amount.
kdt ! Current forecast iteration
logical, intent(in) :: &
doSWrad, & ! Call SW radiation?
doLWrad, & ! Call LW radiation
effr_in ! Provide hydrometeor radii from macrophysics?
effr_in, & ! Provide hydrometeor radii from macrophysics?
do_mynnedmf, & ! Flag to activate MYNN-EDMF
doGP_cldoptics_LUT, & ! Flag to do GP cloud-optics (LUTs)
doGP_cldoptics_PADE ! (PADE approximation)
real(kind_phys), intent(in) :: &
con_g, & ! Physical constant: gravitational constant
con_rd ! Physical constant: gas-constant for dry air
Expand All @@ -69,7 +76,7 @@ subroutine GFS_rrtmgp_gfdlmp_pre_run(nCol, nLev, nTracers, ncnd, i_cldliq, i_cld
tracer ! Cloud condensate amount in layer by type ()

! Outputs
real(kind_phys), dimension(nCol,nLev),intent(out) :: &
real(kind_phys), dimension(nCol,nLev),intent(inout) :: &
cld_frac, & ! Total cloud fraction
cld_lwp, & ! Cloud liquid water path
cld_reliq, & ! Cloud liquid effective radius
Expand Down Expand Up @@ -106,14 +113,10 @@ subroutine GFS_rrtmgp_gfdlmp_pre_run(nCol, nLev, nTracers, ncnd, i_cldliq, i_cld
return
endif

! Initialize outputs
cld_lwp(:,:) = 0.0
! Initialize outputs
cld_reliq(:,:) = reliq_def
cld_iwp(:,:) = 0.0
cld_reice(:,:) = reice_def
cld_rwp(:,:) = 0.0
cld_rerain(:,:) = rerain_def
cld_swp(:,:) = 0.0
cld_resnow(:,:) = resnow_def

! ####################################################################################
Expand All @@ -137,8 +140,8 @@ subroutine GFS_rrtmgp_gfdlmp_pre_run(nCol, nLev, nTracers, ncnd, i_cldliq, i_cld
cld_rwp(iCol,iLay) = max(0., cld_condensate(iCol,iLay,3) * tem1)
cld_swp(iCol,iLay) = max(0., cld_condensate(iCol,iLay,4) * tem1)
enddo
enddo
enddo

! Particle size
do iLay = 1, nLev
do iCol = 1, nCol
Expand All @@ -151,12 +154,32 @@ subroutine GFS_rrtmgp_gfdlmp_pre_run(nCol, nLev, nTracers, ncnd, i_cldliq, i_cld
endif
enddo
enddo

! Bound effective radii for RRTMGP, LUT's for cloud-optics go from
! 2.5 - 21.5 microns for liquid clouds,
! 10 - 180 microns for ice-clouds
if (doGP_cldoptics_PADE .or. doGP_cldoptics_LUT) then
where(cld_reliq .lt. radliq_lwr) cld_reliq = radliq_lwr
where(cld_reliq .gt. radliq_upr) cld_reliq = radliq_upr
where(cld_reice .lt. radice_lwr) cld_reice = radice_lwr
where(cld_reice .gt. radice_upr) cld_reice = radice_upr
endif

! Cloud-fraction
cld_frac(1:nCol,1:nLev) = tracer(1:nCol,1:nLev,i_cldtot)
if (do_mynnedmf .and. kdt .gt. 1) then
do iLay = 1, nLev
do iCol = 1, nCol
if (tracer(iCol,iLay,i_cldrain) > 1.0e-7 .OR. tracer(iCol,iLay,i_cldsnow)>1.0e-7) then
cld_frac(iCol,iLay) = tracer(iCol,iLay,i_cldtot)
endif
enddo
enddo
else
cld_frac(1:nCol,1:nLev) = tracer(1:nCol,1:nLev,i_cldtot)
endif

! Precipitation fraction (Hack. For now use cloud-fraction)
precip_frac(1:nCol,1:nLev) = tracer(1:nCol,1:nLev,i_cldtot)
precip_frac(1:nCol,1:nLev) = cld_frac(1:nCol,1:nLev)

end subroutine GFS_rrtmgp_gfdlmp_pre_run

Expand Down
56 changes: 44 additions & 12 deletions physics/GFS_rrtmgp_gfdlmp_pre.meta
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[ccpp-table-properties]
name = GFS_rrtmgp_gfdlmp_pre
type = scheme
dependencies = rrtmgp_aux.F90, radiation_cloud_overlap.F90
dependencies = rrtmgp_aux.F90, radiation_cloud_overlap.F90, rrtmgp_lw_cloud_optics.F90

########################################################################
[ccpp-arg-table]
Expand Down Expand Up @@ -62,7 +62,39 @@
dimensions = ()
type = logical
intent = in
optional = F
optional = F
[doGP_cldoptics_PADE]
standard_name = flag_to_calc_lw_cld_optics_using_RRTMGP_PADE
long_name = logical flag to control cloud optics scheme.
units = flag
dimensions = ()
type = logical
intent = in
optional = F
[doGP_cldoptics_LUT]
standard_name = flag_to_calc_lw_cld_optics_using_RRTMGP_LUT
long_name = logical flag to control cloud optics scheme.
units = flag
dimensions = ()
type = logical
intent = in
optional = F
[do_mynnedmf]
standard_name = do_mynnedmf
long_name = flag to activate MYNN-EDMF
units = flag
dimensions = ()
type = logical
intent = in
optional = F
[kdt]
standard_name = index_of_time_step
long_name = current forecast iteration
units = index
dimensions = ()
type = integer
intent = in
optional = F
[i_cldliq]
standard_name = index_for_liquid_cloud_condensate
long_name = tracer index for cloud condensate (or liquid water)
Expand Down Expand Up @@ -208,7 +240,7 @@
dimensions = (horizontal_loop_extent,vertical_dimension)
type = real
kind = kind_phys
intent = out
intent = inout
optional = F
[cld_lwp]
standard_name = cloud_liquid_water_path
Expand All @@ -217,7 +249,7 @@
dimensions = (horizontal_loop_extent,vertical_dimension)
type = real
kind = kind_phys
intent = out
intent = inout
optional = F
[cld_reliq]
standard_name = mean_effective_radius_for_liquid_cloud
Expand All @@ -226,7 +258,7 @@
dimensions = (horizontal_loop_extent,vertical_dimension)
type = real
kind = kind_phys
intent = out
intent = inout
optional = F
[cld_iwp]
standard_name = cloud_ice_water_path
Expand All @@ -235,7 +267,7 @@
dimensions = (horizontal_loop_extent,vertical_dimension)
type = real
kind = kind_phys
intent = out
intent = inout
optional = F
[cld_reice]
standard_name = mean_effective_radius_for_ice_cloud
Expand All @@ -244,7 +276,7 @@
dimensions = (horizontal_loop_extent,vertical_dimension)
type = real
kind = kind_phys
intent = out
intent = inout
optional = F
[cld_swp]
standard_name = cloud_snow_water_path
Expand All @@ -253,7 +285,7 @@
dimensions = (horizontal_loop_extent,vertical_dimension)
type = real
kind = kind_phys
intent = out
intent = inout
optional = F
[cld_resnow]
standard_name = mean_effective_radius_for_snow_flake
Expand All @@ -262,7 +294,7 @@
dimensions = (horizontal_loop_extent,vertical_dimension)
type = real
kind = kind_phys
intent = out
intent = inout
optional = F
[cld_rwp]
standard_name = cloud_rain_water_path
Expand All @@ -271,7 +303,7 @@
dimensions = (horizontal_loop_extent,vertical_dimension)
type = real
kind = kind_phys
intent = out
intent = inout
optional = F
[cld_rerain]
standard_name = mean_effective_radius_for_rain_drop
Expand All @@ -280,7 +312,7 @@
dimensions = (horizontal_loop_extent,vertical_dimension)
type = real
kind = kind_phys
intent = out
intent = inout
optional = F
[precip_frac]
standard_name = precipitation_fraction_by_layer
Expand All @@ -289,7 +321,7 @@
dimensions = (horizontal_loop_extent,vertical_dimension)
type = real
kind = kind_phys
intent = out
intent = inout
optional = F
[errmsg]
standard_name = ccpp_error_message
Expand Down

0 comments on commit d2db535

Please sign in to comment.