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

[production/RRFS.v1] Fix 'check all' using 0-sized arrays #789

2 changes: 1 addition & 1 deletion atmos_cubed_sphere
145 changes: 93 additions & 52 deletions ccpp/data/CCPP_typedefs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,6 @@ module CCPP_typedefs
integer :: nbdlw !<
integer :: nbdsw !<
real (kind=kind_phys), pointer :: ncgl(:,:) => null() !<
real (kind=kind_phys), pointer :: ncpi(:,:) => null() !<
real (kind=kind_phys), pointer :: ncpl(:,:) => null() !<
real (kind=kind_phys), pointer :: ncpr(:,:) => null() !<
real (kind=kind_phys), pointer :: ncps(:,:) => null() !<
integer :: ncstrac !<
Expand Down Expand Up @@ -367,15 +365,6 @@ module CCPP_typedefs
real (kind=kind_phys), pointer :: tracer(:,:,:) => null() !<
real (kind=kind_phys), pointer :: aerosolslw(:,:,:,:) => null() !< Aerosol radiative properties in each LW band.
real (kind=kind_phys), pointer :: aerosolssw(:,:,:,:) => null() !< Aerosol radiative properties in each SW band.
real (kind=kind_phys), pointer :: cld_frac(:,:) => null() !< Total cloud fraction
real (kind=kind_phys), pointer :: cld_lwp(:,:) => null() !< Cloud liquid water path
real (kind=kind_phys), pointer :: cld_reliq(:,:) => null() !< Cloud liquid effective radius
real (kind=kind_phys), pointer :: cld_iwp(:,:) => null() !< Cloud ice water path
real (kind=kind_phys), pointer :: cld_reice(:,:) => null() !< Cloud ice effecive radius
real (kind=kind_phys), pointer :: cld_swp(:,:) => null() !< Cloud snow water path
real (kind=kind_phys), pointer :: cld_resnow(:,:) => null() !< Cloud snow effective radius
real (kind=kind_phys), pointer :: cld_rwp(:,:) => null() !< Cloud rain water path
real (kind=kind_phys), pointer :: cld_rerain(:,:) => null() !< Cloud rain effective radius
real (kind=kind_phys), pointer :: precip_frac(:,:) => null() !< Precipitation fraction
real (kind=kind_phys), pointer :: cld_cnv_frac(:,:) => null() !< SGS convective cloud fraction
real (kind=kind_phys), pointer :: cld_cnv_lwp(:,:) => null() !< SGS convective cloud liquid water path
Expand Down Expand Up @@ -532,6 +521,8 @@ subroutine gfs_interstitial_create (Interstitial, IM, Model)
if (.not. Model%do_RRTMGP) then
! RRTMGP uses its own cloud_overlap_param
allocate (Interstitial%alpha (IM,Model%levr+LTP))
else
allocate (Interstitial%alpha (0,0))
end if
allocate (Interstitial%bexp1d (IM))
allocate (Interstitial%cd (IM))
Expand Down Expand Up @@ -758,15 +749,6 @@ subroutine gfs_interstitial_create (Interstitial, IM, Model)
allocate (Interstitial%fluxswDOWN_clrsky (IM, Model%levs+1))
allocate (Interstitial%aerosolslw (IM, Model%levs, Model%rrtmgp_nBandsLW, NF_AELW))
allocate (Interstitial%aerosolssw (IM, Model%levs, Model%rrtmgp_nBandsSW, NF_AESW))
allocate (Interstitial%cld_frac (IM, Model%levs))
allocate (Interstitial%cld_lwp (IM, Model%levs))
allocate (Interstitial%cld_reliq (IM, Model%levs))
allocate (Interstitial%cld_iwp (IM, Model%levs))
allocate (Interstitial%cld_reice (IM, Model%levs))
allocate (Interstitial%cld_swp (IM, Model%levs))
allocate (Interstitial%cld_resnow (IM, Model%levs))
allocate (Interstitial%cld_rwp (IM, Model%levs))
allocate (Interstitial%cld_rerain (IM, Model%levs))
allocate (Interstitial%precip_frac (IM, Model%levs))
allocate (Interstitial%cld_cnv_frac (IM, Model%levs))
allocate (Interstitial%cnv_cloud_overlap_param(IM, Model%levs))
Expand Down Expand Up @@ -794,7 +776,58 @@ subroutine gfs_interstitial_create (Interstitial, IM, Model)
allocate (Interstitial%vmr_ch4 (IM, Model%levs))
allocate (Interstitial%vmr_n2o (IM, Model%levs))
allocate (Interstitial%vmr_co2 (IM, Model%levs))

else
allocate (Interstitial%tracer (0,0,0))
allocate (Interstitial%tv_lay (0,0))
allocate (Interstitial%relhum (0,0))
allocate (Interstitial%qs_lay (0,0))
allocate (Interstitial%q_lay (0,0))
allocate (Interstitial%deltaZ (0,0))
allocate (Interstitial%deltaZc (0,0))
allocate (Interstitial%deltaP (0,0))
allocate (Interstitial%p_lev (0,0))
allocate (Interstitial%p_lay (0,0))
allocate (Interstitial%t_lev (0,0))
allocate (Interstitial%t_lay (0,0))
allocate (Interstitial%cloud_overlap_param (0,0))
allocate (Interstitial%precip_overlap_param (0,0))
allocate (Interstitial%fluxlwUP_allsky (0,0))
allocate (Interstitial%fluxlwDOWN_allsky (0,0))
allocate (Interstitial%fluxlwUP_clrsky (0,0))
allocate (Interstitial%fluxlwDOWN_clrsky (0,0))
allocate (Interstitial%fluxswUP_allsky (0,0))
allocate (Interstitial%fluxswDOWN_allsky (0,0))
allocate (Interstitial%fluxswUP_clrsky (0,0))
allocate (Interstitial%fluxswDOWN_clrsky (0,0))
allocate (Interstitial%aerosolslw (0,0,0,0))
allocate (Interstitial%aerosolssw (0,0,0,0))
allocate (Interstitial%precip_frac (0,0))
allocate (Interstitial%cld_cnv_frac (0,0))
allocate (Interstitial%cnv_cloud_overlap_param(0,0))
allocate (Interstitial%cld_cnv_lwp (0,0))
allocate (Interstitial%cld_cnv_reliq (0,0))
allocate (Interstitial%cld_cnv_iwp (0,0))
allocate (Interstitial%cld_cnv_reice (0,0))
allocate (Interstitial%cld_pbl_lwp (0,0))
allocate (Interstitial%cld_pbl_reliq (0,0))
allocate (Interstitial%cld_pbl_iwp (0,0))
allocate (Interstitial%cld_pbl_reice (0,0))
allocate (Interstitial%flxprf_lw (0,0))
allocate (Interstitial%flxprf_sw (0,0))
allocate (Interstitial%sfc_emiss_byband (0,0))
allocate (Interstitial%sec_diff_byband (0,0))
allocate (Interstitial%sfc_alb_nir_dir (0,0))
allocate (Interstitial%sfc_alb_nir_dif (0,0))
allocate (Interstitial%sfc_alb_uvvis_dir (0,0))
allocate (Interstitial%sfc_alb_uvvis_dif (0,0))
allocate (Interstitial%toa_src_sw (0,0))
allocate (Interstitial%toa_src_lw (0,0))
allocate (Interstitial%vmr_o2 (0,0))
allocate (Interstitial%vmr_h2o (0,0))
allocate (Interstitial%vmr_o3 (0,0))
allocate (Interstitial%vmr_ch4 (0,0))
allocate (Interstitial%vmr_n2o (0,0))
allocate (Interstitial%vmr_co2 (0,0))
end if

! UGWP common
Expand All @@ -817,6 +850,11 @@ subroutine gfs_interstitial_create (Interstitial, IM, Model)
allocate (Interstitial%dvdt_ngw (IM,Model%levs))
allocate (Interstitial%dtdt_ngw (IM,Model%levs))
allocate (Interstitial%kdis_ngw (IM,Model%levs))
else
allocate (Interstitial%dudt_ngw (0,0))
allocate (Interstitial%dvdt_ngw (0,0))
allocate (Interstitial%dtdt_ngw (0,0))
allocate (Interstitial%kdis_ngw (0,0))
end if

!-- GSL drag suite
Expand All @@ -826,6 +864,11 @@ subroutine gfs_interstitial_create (Interstitial, IM, Model)
allocate (Interstitial%ocss (IM))
allocate (Interstitial%oa4ss (IM,4))
allocate (Interstitial%clxss (IM,4))
else
allocate (Interstitial%varss (0))
allocate (Interstitial%ocss (0))
allocate (Interstitial%oa4ss (0,0))
allocate (Interstitial%clxss (0,0))
end if
!
! Allocate arrays that are conditional on physics choices
Expand All @@ -836,7 +879,13 @@ subroutine gfs_interstitial_create (Interstitial, IM, Model)
allocate (Interstitial%icemp (IM))
allocate (Interstitial%rainmp (IM))
allocate (Interstitial%snowmp (IM))
else if (Model%imp_physics == Model%imp_physics_mg) then
else
allocate (Interstitial%graupelmp (0))
allocate (Interstitial%icemp (0))
allocate (Interstitial%rainmp (0))
allocate (Interstitial%snowmp (0))
end if
if (Model%imp_physics == Model%imp_physics_mg) then
allocate (Interstitial%ncgl (IM,Model%levs))
allocate (Interstitial%ncpr (IM,Model%levs))
allocate (Interstitial%ncps (IM,Model%levs))
Expand All @@ -853,19 +902,30 @@ subroutine gfs_interstitial_create (Interstitial, IM, Model)
allocate (Interstitial%cnv_fice (IM,Model%levs))
allocate (Interstitial%cnv_ndrop (IM,Model%levs))
allocate (Interstitial%cnv_nice (IM,Model%levs))
end if
if (Model%do_shoc) then
if (.not. associated(Interstitial%qrn)) allocate (Interstitial%qrn (IM,Model%levs))
if (.not. associated(Interstitial%qsnw)) allocate (Interstitial%qsnw (IM,Model%levs))
! DH* updated version of shoc from May 22 2019 (not yet in CCPP) doesn't use qgl? remove?
if (.not. associated(Interstitial%qgl)) allocate (Interstitial%qgl (IM,Model%levs))
! *DH
allocate (Interstitial%ncpi (IM,Model%levs))
allocate (Interstitial%ncpl (IM,Model%levs))
end if
else
allocate (Interstitial%ncgl (0,0))
allocate (Interstitial%ncpr (0,0))
allocate (Interstitial%ncps (0,0))
allocate (Interstitial%qrn (0,0))
allocate (Interstitial%qsnw (0,0))
allocate (Interstitial%qgl (0,0))
allocate (Interstitial%qlcn (0,0))
allocate (Interstitial%qicn (0,0))
allocate (Interstitial%w_upi (0,0))
allocate (Interstitial%cf_upi (0,0))
allocate (Interstitial%cnv_mfd (0,0))
allocate (Interstitial%cnv_dqldt (0,0))
allocate (Interstitial%clcn (0,0))
allocate (Interstitial%cnv_fice (0,0))
allocate (Interstitial%cnv_ndrop (0,0))
allocate (Interstitial%cnv_nice (0,0))
end if
if (Model%lsm == Model%lsm_noahmp) then
allocate (Interstitial%t2mmp (IM))
allocate (Interstitial%q2mp (IM))
else
allocate (Interstitial%t2mmp (0))
allocate (Interstitial%q2mp (0))
end if
!
! Set components that do not change
Expand Down Expand Up @@ -1168,15 +1228,6 @@ subroutine gfs_interstitial_rad_reset (Interstitial, Model)
Interstitial%fluxswDOWN_clrsky = clear_val
Interstitial%aerosolslw = clear_val
Interstitial%aerosolssw = clear_val
Interstitial%cld_frac = clear_val
Interstitial%cld_lwp = clear_val
Interstitial%cld_reliq = clear_val
Interstitial%cld_iwp = clear_val
Interstitial%cld_reice = clear_val
Interstitial%cld_swp = clear_val
Interstitial%cld_resnow = clear_val
Interstitial%cld_rwp = clear_val
Interstitial%cld_rerain = clear_val
Interstitial%precip_frac = clear_val
Interstitial%cld_cnv_frac = clear_val
Interstitial%cnv_cloud_overlap_param = clear_val
Expand Down Expand Up @@ -1463,15 +1514,6 @@ subroutine gfs_interstitial_phys_reset (Interstitial, Model)
Interstitial%cnv_ndrop = clear_val
Interstitial%cnv_nice = clear_val
end if
if (Model%do_shoc) then
Interstitial%qrn = clear_val
Interstitial%qsnw = clear_val
! DH* updated version of shoc from May 22 2019 doesn't use qgl? remove?
Interstitial%qgl = clear_val
! *DH
Interstitial%ncpi = clear_val
Interstitial%ncpl = clear_val
end if
if (Model%lsm == Model%lsm_noahmp) then
Interstitial%t2mmp = clear_val
Interstitial%q2mp = clear_val
Expand Down Expand Up @@ -1772,5 +1814,4 @@ subroutine gfdl_interstitial_print(Interstitial)
!
end subroutine gfdl_interstitial_print

end module CCPP_typedefs

end module CCPP_typedefs
37 changes: 14 additions & 23 deletions ccpp/data/CCPP_typedefs.meta
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
dimensions = (horizontal_loop_extent,adjusted_vertical_layer_dimension_for_radiation)
type = real
kind = kind_phys
active = (flag_for_rrtmgp_radiation_scheme)
[bexp1d]
standard_name = perturbation_of_soil_type_b_parameter
long_name = perturbation of soil type "b" parameter
Expand Down Expand Up @@ -344,7 +345,7 @@
dimensions = (horizontal_loop_extent,4)
type = real
kind = kind_phys
active = (control_for_drag_suite_gravity_wave_drag == 3 .or. control_for_drag_suite_gravity_wave_drag == 33)
active = (control_for_drag_suite_gravity_wave_drag == 2 .or. control_for_drag_suite_gravity_wave_drag == 22 .or. control_for_drag_suite_gravity_wave_drag == 3 .or. control_for_drag_suite_gravity_wave_drag == 33)
[cmm_water]
standard_name = surface_drag_wind_speed_for_momentum_in_air_over_water
long_name = momentum exchange coefficient over water
Expand Down Expand Up @@ -1390,22 +1391,6 @@
type = real
kind = kind_phys
active = (control_for_microphysics_scheme == identifier_for_morrison_gettelman_microphysics_scheme)
[ncpi]
standard_name = local_ice_number_concentration
long_name = number concentration of ice local to physics
units = kg-1
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
active = (flag_for_shoc)
[ncpl]
standard_name = local_condesed_water_number_concentration
long_name = number concentration of condensed water local to physics
units = kg-1
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
active = (flag_for_shoc)
[ncpr]
standard_name = local_rain_number_concentration
long_name = number concentration of rain local to physics
Expand Down Expand Up @@ -1526,15 +1511,15 @@
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
active = (control_for_drag_suite_gravity_wave_drag == 3 .or. control_for_drag_suite_gravity_wave_drag == 33)
active = (control_for_drag_suite_gravity_wave_drag == 2 .or. control_for_drag_suite_gravity_wave_drag == 22 .or. control_for_drag_suite_gravity_wave_drag == 3 .or. control_for_drag_suite_gravity_wave_drag == 33)
[oa4ss]
standard_name = asymmetry_of_subgrid_orography_small_scale
long_name = asymmetry of subgrid height_above_mean_sea_level small scale
units = none
dimensions = (horizontal_loop_extent,4)
type = real
kind = kind_phys
active = (control_for_drag_suite_gravity_wave_drag == 3 .or. control_for_drag_suite_gravity_wave_drag == 33)
active = (control_for_drag_suite_gravity_wave_drag == 2 .or. control_for_drag_suite_gravity_wave_drag == 22 .or. control_for_drag_suite_gravity_wave_drag == 3 .or. control_for_drag_suite_gravity_wave_drag == 33)
[oc]
standard_name = convexity_of_subgrid_orography
long_name = convexity of subgrid height_above_mean_sea_level
Expand All @@ -1549,7 +1534,7 @@
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
active = (control_for_drag_suite_gravity_wave_drag == 3 .or. control_for_drag_suite_gravity_wave_drag == 33)
active = (control_for_drag_suite_gravity_wave_drag == 2 .or. control_for_drag_suite_gravity_wave_drag == 22 .or. control_for_drag_suite_gravity_wave_drag == 3 .or. control_for_drag_suite_gravity_wave_drag == 33)
[olyr]
standard_name = ozone_concentration_at_layer_for_radiation
long_name = ozone concentration layer
Expand Down Expand Up @@ -1617,7 +1602,7 @@
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
active = (control_for_microphysics_scheme == identifier_for_morrison_gettelman_microphysics_scheme .or. flag_for_shoc)
active = (control_for_microphysics_scheme == identifier_for_morrison_gettelman_microphysics_scheme)
[qicn]
standard_name = mass_fraction_of_convective_cloud_ice
long_name = mass fraction of convective cloud ice water
Expand Down Expand Up @@ -1648,15 +1633,15 @@
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
active = (control_for_microphysics_scheme == identifier_for_morrison_gettelman_microphysics_scheme .or. flag_for_shoc)
active = (control_for_microphysics_scheme == identifier_for_morrison_gettelman_microphysics_scheme)
[qsnw]
standard_name = local_snow_water_mixing_ratio
long_name = ratio of mass of snow water to mass of dry air plus vapor (without condensates) local to physics
units = kg kg-1
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
active = (control_for_microphysics_scheme == identifier_for_morrison_gettelman_microphysics_scheme .or. flag_for_shoc)
active = (control_for_microphysics_scheme == identifier_for_morrison_gettelman_microphysics_scheme)
[prcpmp]
standard_name = lwe_thickness_of_explicit_precipitation_amount
long_name = explicit precipitation (rain, ice, snow, graupel, ...) on physics timestep
Expand Down Expand Up @@ -2596,20 +2581,23 @@
dimensions = (horizontal_loop_extent,vertical_layer_dimension, number_of_longwave_bands)
type = real
kind = kind_phys
active = (flag_for_rrtmgp_radiation_scheme)
[aerosolslw(:,:,:,2)]
standard_name = RRTMGP_aerosol_single_scattering_albedo_for_longwave_bands_01_16
long_name = aerosol single scattering albedo for longwave bands 01-16
units = frac
dimensions = (horizontal_loop_extent,vertical_layer_dimension, number_of_longwave_bands)
type = real
kind = kind_phys
active = (flag_for_rrtmgp_radiation_scheme)
[aerosolslw(:,:,:,3)]
standard_name = RRTMGP_aerosol_asymmetry_parameter_for_longwave_bands_01_16
long_name = aerosol asymmetry parameter for longwave bands 01-16
units = none
dimensions = (horizontal_loop_extent,vertical_layer_dimension, number_of_longwave_bands)
type = real
kind = kind_phys
active = (flag_for_rrtmgp_radiation_scheme)
[aerosolssw]
standard_name = RRTMGP_aerosol_optical_properties_for_shortwave_bands_01_16
long_name = aerosol optical properties for shortwave bands 01-16
Expand All @@ -2625,20 +2613,23 @@
dimensions = (horizontal_loop_extent,vertical_layer_dimension, number_of_shortwave_bands)
type = real
kind = kind_phys
active = (flag_for_rrtmgp_radiation_scheme)
[aerosolssw(:,:,:,2)]
standard_name = RRTMGP_aerosol_single_scattering_albedo_for_shortwave_bands_01_16
long_name = aerosol single scattering albedo for shortwave bands 01-16
units = frac
dimensions = (horizontal_loop_extent,vertical_layer_dimension, number_of_shortwave_bands)
type = real
kind = kind_phys
active = (flag_for_rrtmgp_radiation_scheme)
[aerosolssw(:,:,:,3)]
standard_name = RRTMGP_aerosol_asymmetry_parameter_for_shortwave_bands_01_16
long_name = aerosol asymmetry parameter for shortwave bands 01-16
units = none
dimensions = (horizontal_loop_extent,vertical_layer_dimension, number_of_shortwave_bands)
type = real
kind = kind_phys
active = (flag_for_rrtmgp_radiation_scheme)
[precip_frac]
standard_name = precipitation_fraction_by_layer
long_name = precipitation fraction in each layer
Expand Down
Loading