From 0beced63832408e26fe1abc31da4aff736ddd875 Mon Sep 17 00:00:00 2001 From: Grant Firl Date: Wed, 17 Jan 2024 21:46:56 -0500 Subject: [PATCH 1/9] add zero allocation for conditionally-allocated variables in GFS/CCPP_typedefs and point to Dom's branch of ccpp-framework; fix some active attribute metadata --- .gitmodules | 12 +- atmos_cubed_sphere | 2 +- ccpp/data/CCPP_typedefs.F90 | 145 +++++--- ccpp/data/CCPP_typedefs.meta | 37 +-- ccpp/data/GFS_typedefs.F90 | 623 ++++++++++++++++++++++++++++++----- ccpp/data/GFS_typedefs.meta | 131 ++++---- ccpp/framework | 2 +- 7 files changed, 720 insertions(+), 232 deletions(-) diff --git a/.gitmodules b/.gitmodules index 22c723ac1..51792af1e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,11 +1,15 @@ [submodule "atmos_cubed_sphere"] path = atmos_cubed_sphere - url = https://github.com/NOAA-GFDL/GFDL_atmos_cubed_sphere - branch = dev/emc + #url = https://github.com/NOAA-GFDL/GFDL_atmos_cubed_sphere + #branch = dev/emc + url = https://github.com/NOAA-EMC/GFDL_atmos_cubed_sphere + branch = production/AQM.v7 [submodule "ccpp/framework"] path = ccpp/framework - url = https://github.com/NCAR/ccpp-framework - branch = main + #url = https://github.com/NCAR/ccpp-framework + #branch = main + url = https://github.com/climbfuji/ccpp-framework + branch = feature/dummy_allocate_inactive [submodule "ccpp/physics"] path = ccpp/physics url = https://github.com/ufs-community/ccpp-physics diff --git a/atmos_cubed_sphere b/atmos_cubed_sphere index caba092f6..a2f504b0e 160000 --- a/atmos_cubed_sphere +++ b/atmos_cubed_sphere @@ -1 +1 @@ -Subproject commit caba092f682c9713a485e782b8f9ba6480adaca2 +Subproject commit a2f504b0e8ce6886527864d3c683e254595cb675 diff --git a/ccpp/data/CCPP_typedefs.F90 b/ccpp/data/CCPP_typedefs.F90 index 7d9351337..4383be929 100644 --- a/ccpp/data/CCPP_typedefs.F90 +++ b/ccpp/data/CCPP_typedefs.F90 @@ -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 !< @@ -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 @@ -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)) @@ -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)) @@ -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 @@ -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 @@ -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 @@ -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)) @@ -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 @@ -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 @@ -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 @@ -1772,5 +1814,4 @@ subroutine gfdl_interstitial_print(Interstitial) ! end subroutine gfdl_interstitial_print -end module CCPP_typedefs - +end module CCPP_typedefs \ No newline at end of file diff --git a/ccpp/data/CCPP_typedefs.meta b/ccpp/data/CCPP_typedefs.meta index a2d1105df..ddd67051d 100644 --- a/ccpp/data/CCPP_typedefs.meta +++ b/ccpp/data/CCPP_typedefs.meta @@ -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 @@ -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 @@ -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 @@ -1526,7 +1511,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) [oa4ss] standard_name = asymmetry_of_subgrid_orography_small_scale long_name = asymmetry of subgrid height_above_mean_sea_level small scale @@ -1534,7 +1519,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) [oc] standard_name = convexity_of_subgrid_orography long_name = convexity of subgrid height_above_mean_sea_level @@ -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 @@ -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 @@ -1648,7 +1633,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) [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 @@ -1656,7 +1641,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) [prcpmp] standard_name = lwe_thickness_of_explicit_precipitation_amount long_name = explicit precipitation (rain, ice, snow, graupel, ...) on physics timestep @@ -2596,6 +2581,7 @@ 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 @@ -2603,6 +2589,7 @@ 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 @@ -2610,6 +2597,7 @@ 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 @@ -2625,6 +2613,7 @@ 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 @@ -2632,6 +2621,7 @@ 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 @@ -2639,6 +2629,7 @@ 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 diff --git a/ccpp/data/GFS_typedefs.F90 b/ccpp/data/GFS_typedefs.F90 index 5a8368a40..286697559 100644 --- a/ccpp/data/GFS_typedefs.F90 +++ b/ccpp/data/GFS_typedefs.F90 @@ -2041,14 +2041,6 @@ module GFS_typedefs real (kind=kind_phys), pointer :: dv3_ofdcol(:) => null() !< time-averaged sfc v-momentum flux from TOFD ! !---vay-2018 UGWP-diagnostics daily mean -! - real (kind=kind_phys), pointer :: dudt_tot (:,:) => null() !< daily aver GFS_phys tend for WE-U - real (kind=kind_phys), pointer :: dvdt_tot (:,:) => null() !< daily aver GFS_phys tend for SN-V - real (kind=kind_phys), pointer :: dtdt_tot (:,:) => null() !< daily aver GFS_phys tend for Temp-re -! - real (kind=kind_phys), pointer :: du3dt_pbl(:,:) => null() !< daily aver GFS_phys tend for WE-U pbl - real (kind=kind_phys), pointer :: dv3dt_pbl(:,:) => null() !< daily aver GFS_phys tend for SN-V pbl - real (kind=kind_phys), pointer :: dt3dt_pbl(:,:) => null() !< daily aver GFS_phys tend for Temp pbl ! real (kind=kind_phys), pointer :: du3dt_ogw(:,:) => null() !< daily aver GFS_phys tend for WE-U OGW ! @@ -2098,10 +2090,6 @@ module GFS_typedefs real (kind=kind_phys), pointer :: gwp_axf(:,:) => null() ! instant jet-UGWP tend m/s/s EW real (kind=kind_phys), pointer :: gwp_ayf(:,:) => null() ! instant jet-UGWP tend m/s/s NS - real (kind=kind_phys), pointer :: uav_ugwp(:,:) => null() ! aver wind UAV from physics - real (kind=kind_phys), pointer :: tav_ugwp(:,:) => null() ! aver temp UAV from physics - real (kind=kind_phys), pointer :: du3dt_dyn(:,:) => null() ! U Tend-dynamics "In"-"PhysOut" - !--- COODRE ORO diagnostics real (kind=kind_phys), pointer :: zmtb(:) => null() ! real (kind=kind_phys), pointer :: zogw(:) => null() ! @@ -2216,6 +2204,8 @@ subroutine statein_create (Statein, IM, Model) allocate (Statein%vgrs (IM,Model%levs)) if(Model%lightning_threat) then allocate (Statein%wgrs (IM,Model%levs)) + else + allocate (Statein%wgrs (0,0)) endif allocate (Statein%qgrs (IM,Model%levs,Model%ntrac)) @@ -2289,7 +2279,10 @@ subroutine sfcprop_create (Sfcprop, IM, Model) if(Model%lkm > 0) then if(Model%iopt_lake==Model%iopt_lake_clm) then allocate (Sfcprop%clm_lakedepth(IM)) - else if(Model%iopt_lake==Model%iopt_lake_flake) then + else + allocate (Sfcprop%clm_lakedepth(0)) + endif + if(Model%iopt_lake==Model%iopt_lake_flake) then allocate (Sfcprop%h_ML (IM)) allocate (Sfcprop%t_ML (IM)) allocate (Sfcprop%t_mnw (IM)) @@ -2298,9 +2291,30 @@ subroutine sfcprop_create (Sfcprop, IM, Model) allocate (Sfcprop%t_bot1 (IM)) allocate (Sfcprop%t_bot2 (IM)) allocate (Sfcprop%c_t (IM)) + else + allocate (Sfcprop%h_ML (0)) + allocate (Sfcprop%t_ML (0)) + allocate (Sfcprop%t_mnw (0)) + allocate (Sfcprop%h_talb (0)) + allocate (Sfcprop%t_talb (0)) + allocate (Sfcprop%t_bot1 (0)) + allocate (Sfcprop%t_bot2 (0)) + allocate (Sfcprop%c_t (0)) endif allocate (Sfcprop%T_snow (IM)) allocate (Sfcprop%T_ice (IM)) + else + allocate (Sfcprop%clm_lakedepth(0)) + allocate (Sfcprop%h_ML (0)) + allocate (Sfcprop%t_ML (0)) + allocate (Sfcprop%t_mnw (0)) + allocate (Sfcprop%h_talb (0)) + allocate (Sfcprop%t_talb (0)) + allocate (Sfcprop%t_bot1 (0)) + allocate (Sfcprop%t_bot2 (0)) + allocate (Sfcprop%c_t (0)) + allocate (Sfcprop%T_snow (0)) + allocate (Sfcprop%T_ice (0)) endif allocate (Sfcprop%tsfc (IM)) @@ -2461,11 +2475,20 @@ subroutine sfcprop_create (Sfcprop, IM, Model) allocate (Sfcprop%albdifvis_ice (IM)) allocate (Sfcprop%albdirnir_ice (IM)) allocate (Sfcprop%albdifnir_ice (IM)) + else + allocate (Sfcprop%albdirvis_ice (0)) + allocate (Sfcprop%albdifvis_ice (0)) + allocate (Sfcprop%albdirnir_ice (0)) + allocate (Sfcprop%albdifnir_ice (0)) endif if (Model%lsm == Model%lsm_ruc) then allocate (Sfcprop%sfalb_lnd (IM)) allocate (Sfcprop%sfalb_ice (IM)) allocate (Sfcprop%sfalb_lnd_bck (IM)) + else + allocate (Sfcprop%sfalb_lnd (0)) + allocate (Sfcprop%sfalb_ice (0)) + allocate (Sfcprop%sfalb_lnd_bck (0)) endif allocate (Sfcprop%canopy (IM)) allocate (Sfcprop%ffmm (IM)) @@ -2549,12 +2572,37 @@ subroutine sfcprop_create (Sfcprop, IM, Model) Sfcprop%ifd = zero Sfcprop%dt_cool = zero Sfcprop%qrain = zero + else + allocate (Sfcprop%tref (0)) + allocate (Sfcprop%z_c (0)) + allocate (Sfcprop%c_0 (0)) + allocate (Sfcprop%c_d (0)) + allocate (Sfcprop%w_0 (0)) + allocate (Sfcprop%w_d (0)) + allocate (Sfcprop%xt (0)) + allocate (Sfcprop%xs (0)) + allocate (Sfcprop%xu (0)) + allocate (Sfcprop%xv (0)) + allocate (Sfcprop%xz (0)) + allocate (Sfcprop%zm (0)) + allocate (Sfcprop%xtts (0)) + allocate (Sfcprop%xzts (0)) + allocate (Sfcprop%d_conv (0)) + allocate (Sfcprop%ifd (0)) + allocate (Sfcprop%dt_cool(0)) + allocate (Sfcprop%qrain (0)) endif - if (Model%lsm == Model%lsm_noah) then + if (Model%lsm == Model%lsm_noah .or. Model%lsm == Model%lsm_noahmp .or. Model%lsm == Model%lsm_ruc) then allocate (Sfcprop%xlaixy (IM)) - allocate (Sfcprop%rca (IM)) Sfcprop%xlaixy = clear_val + else + allocate (Sfcprop%xlaixy (0)) + end if + if (Model%lsm == Model%lsm_noah) then + allocate (Sfcprop%rca (IM)) Sfcprop%rca = clear_val + else + allocate (Sfcprop%rca (0)) end if if (Model%lsm == Model%lsm_ruc .or. Model%lsm == Model%lsm_noahmp .or. & (Model%lkm>0 .and. Model%iopt_lake==Model%iopt_lake_clm)) then @@ -2569,7 +2617,17 @@ subroutine sfcprop_create (Sfcprop, IM, Model) Sfcprop%iceprv = clear_val Sfcprop%snowprv = clear_val Sfcprop%graupelprv = clear_val + else + allocate(Sfcprop%iceprv (0)) + allocate(Sfcprop%snowprv (0)) + allocate(Sfcprop%graupelprv(0)) end if + else + allocate(Sfcprop%raincprv (0)) + allocate(Sfcprop%rainncprv (0)) + allocate(Sfcprop%iceprv (0)) + allocate(Sfcprop%snowprv (0)) + allocate(Sfcprop%graupelprv(0)) end if ! Noah MP allocate and init when used ! @@ -2599,7 +2657,6 @@ subroutine sfcprop_create (Sfcprop, IM, Model) allocate (Sfcprop%stblcpxy (IM)) allocate (Sfcprop%fastcpxy (IM)) allocate (Sfcprop%xsaixy (IM)) - allocate (Sfcprop%xlaixy (IM)) allocate (Sfcprop%taussxy (IM)) allocate (Sfcprop%smcwtdxy (IM)) allocate (Sfcprop%deeprechxy (IM)) @@ -2634,7 +2691,6 @@ subroutine sfcprop_create (Sfcprop, IM, Model) Sfcprop%stblcpxy = clear_val Sfcprop%fastcpxy = clear_val Sfcprop%xsaixy = clear_val - Sfcprop%xlaixy = clear_val Sfcprop%taussxy = clear_val Sfcprop%smcwtdxy = clear_val Sfcprop%deeprechxy = clear_val @@ -2658,11 +2714,53 @@ subroutine sfcprop_create (Sfcprop, IM, Model) Sfcprop%dsnowprv = clear_val Sfcprop%dgraupelprv = clear_val + else + allocate (Sfcprop%snowxy (0)) + allocate (Sfcprop%tvxy (0)) + allocate (Sfcprop%tgxy (0)) + allocate (Sfcprop%canicexy (0)) + allocate (Sfcprop%canliqxy (0)) + allocate (Sfcprop%eahxy (0)) + allocate (Sfcprop%tahxy (0)) + allocate (Sfcprop%cmxy (0)) + allocate (Sfcprop%chxy (0)) + allocate (Sfcprop%fwetxy (0)) + allocate (Sfcprop%sneqvoxy (0)) + allocate (Sfcprop%alboldxy (0)) + allocate (Sfcprop%qsnowxy (0)) + allocate (Sfcprop%wslakexy (0)) + allocate (Sfcprop%zwtxy (0)) + allocate (Sfcprop%waxy (0)) + allocate (Sfcprop%wtxy (0)) + allocate (Sfcprop%lfmassxy (0)) + allocate (Sfcprop%rtmassxy (0)) + allocate (Sfcprop%stmassxy (0)) + allocate (Sfcprop%woodxy (0)) + allocate (Sfcprop%stblcpxy (0)) + allocate (Sfcprop%fastcpxy (0)) + allocate (Sfcprop%xsaixy (0)) + allocate (Sfcprop%taussxy (0)) + allocate (Sfcprop%smcwtdxy (0)) + allocate (Sfcprop%deeprechxy (0)) + allocate (Sfcprop%rechxy (0)) + allocate (Sfcprop%snicexy (0, 0)) + allocate (Sfcprop%snliqxy (0, 0)) + allocate (Sfcprop%tsnoxy (0, 0)) + allocate (Sfcprop%smoiseq (0, 0)) + allocate (Sfcprop%zsnsoxy (0, 0)) + + allocate(Sfcprop%draincprv (0)) + allocate(Sfcprop%drainncprv (0)) + allocate(Sfcprop%diceprv (0)) + allocate(Sfcprop%dsnowprv (0)) + allocate(Sfcprop%dgraupelprv(0)) endif if (Model%do_myjsfc .or. Model%do_myjpbl) then allocate(Sfcprop%z0base(IM)) Sfcprop%z0base = clear_val + else + allocate(Sfcprop%z0base(0)) end if allocate(Sfcprop%semisbase(IM)) @@ -2687,7 +2785,6 @@ subroutine sfcprop_create (Sfcprop, IM, Model) allocate (Sfcprop%snowfallac_ice (IM)) allocate (Sfcprop%acsnow_land (IM)) allocate (Sfcprop%acsnow_ice (IM)) - allocate (Sfcprop%xlaixy (IM)) allocate (Sfcprop%fire_heat_flux_out (IM)) allocate (Sfcprop%frac_grid_burned_out (IM)) @@ -2709,18 +2806,38 @@ subroutine sfcprop_create (Sfcprop, IM, Model) Sfcprop%snowfallac_ice = clear_val Sfcprop%acsnow_land = clear_val Sfcprop%acsnow_ice = clear_val - Sfcprop%xlaixy = clear_val Sfcprop%fire_heat_flux_out = clear_val Sfcprop%frac_grid_burned_out = clear_val ! + else + allocate (Sfcprop%wetness (0)) + allocate (Sfcprop%sh2o (0,0)) + allocate (Sfcprop%keepsmfr (0,0)) + allocate (Sfcprop%smois (0,0)) + allocate (Sfcprop%tslb (0,0)) + allocate (Sfcprop%flag_frsoil (0,0)) + allocate (Sfcprop%clw_surf_land (0)) + allocate (Sfcprop%clw_surf_ice (0)) + allocate (Sfcprop%qwv_surf_land (0)) + allocate (Sfcprop%qwv_surf_ice (0)) + allocate (Sfcprop%rhofr (0)) + allocate (Sfcprop%tsnow_land (0)) + allocate (Sfcprop%tsnow_ice (0)) + allocate (Sfcprop%snowfallac_land (0)) + allocate (Sfcprop%snowfallac_ice (0)) + allocate (Sfcprop%acsnow_land (0)) + allocate (Sfcprop%acsnow_ice (0)) + allocate (Sfcprop%fire_heat_flux_out (0)) + allocate (Sfcprop%frac_grid_burned_out (0)) end if - allocate (Sfcprop%rmol (IM )) - allocate (Sfcprop%flhc (IM )) - allocate (Sfcprop%flqc (IM )) - Sfcprop%rmol = clear_val - Sfcprop%flhc = clear_val - Sfcprop%flqc = clear_val + allocate (Sfcprop%rmol (IM )) + allocate (Sfcprop%flhc (IM )) + allocate (Sfcprop%flqc (IM )) + Sfcprop%rmol = clear_val + Sfcprop%flhc = clear_val + Sfcprop%flqc = clear_val + if (Model%do_mynnsfclay) then ! For MYNN surface layer scheme !print*,"Allocating all MYNN-sfclay variables" @@ -2738,6 +2855,13 @@ subroutine sfcprop_create (Sfcprop, IM, Model) Sfcprop%chs2 = clear_val Sfcprop%cqs2 = clear_val Sfcprop%lh = clear_val + else + allocate (Sfcprop%ustm (0)) + allocate (Sfcprop%zol (0)) + allocate (Sfcprop%mol (0)) + allocate (Sfcprop%chs2 (0)) + allocate (Sfcprop%cqs2 (0)) + allocate (Sfcprop%lh (0)) end if if (Model%imfdeepcnv == Model%imfdeepcnv_gf .or. Model%imfdeepcnv == Model%imfdeepcnv_c3) then allocate (Sfcprop%maxupmf(IM)) @@ -2746,6 +2870,10 @@ subroutine sfcprop_create (Sfcprop, IM, Model) Sfcprop%maxupmf = zero Sfcprop%conv_act = zero Sfcprop%conv_act_m = zero + else + allocate (Sfcprop%maxupmf(0)) + allocate (Sfcprop%conv_act(0)) + allocate (Sfcprop%conv_act_m(0)) end if ! CLM Lake Model variables @@ -2797,6 +2925,30 @@ subroutine sfcprop_create (Sfcprop, IM, Model) Sfcprop%lake_is_salty = zero Sfcprop%lake_cannot_freeze = zero Sfcprop%clm_lake_initialized = zero + else + allocate(Sfcprop%lake_t2m(0)) + allocate(Sfcprop%lake_q2m(0)) + allocate(Sfcprop%lake_albedo(0)) + allocate(Sfcprop%input_lakedepth(0)) + allocate(Sfcprop%lake_h2osno2d(0)) + allocate(Sfcprop%lake_sndpth2d(0)) + allocate(Sfcprop%lake_snl2d(0)) + allocate(Sfcprop%lake_snow_z3d(0,0)) + allocate(Sfcprop%lake_snow_dz3d(0,0)) + allocate(Sfcprop%lake_snow_zi3d(0,0)) + allocate(Sfcprop%lake_h2osoi_vol3d(0,0)) + allocate(Sfcprop%lake_h2osoi_liq3d(0,0)) + allocate(Sfcprop%lake_h2osoi_ice3d(0,0)) + allocate(Sfcprop%lake_tsfc(0)) + allocate(Sfcprop%lake_t_soisno3d(0,0)) + allocate(Sfcprop%lake_t_lake3d(0,0)) + allocate(Sfcprop%lake_savedtke12d(0)) + allocate(Sfcprop%lake_icefrac3d(0,0)) + allocate(Sfcprop%lake_rho0(0)) + allocate(Sfcprop%lake_ht(0)) + allocate(Sfcprop%lake_is_salty(0)) + allocate(Sfcprop%lake_cannot_freeze(0)) + allocate(Sfcprop%clm_lake_initialized(0)) endif if(Model%rrfs_sd) then @@ -2819,6 +2971,15 @@ subroutine sfcprop_create (Sfcprop, IM, Model) Sfcprop%fhist = 1. Sfcprop%coef_bb_dc = clear_val Sfcprop%fire_in = clear_val + else + allocate (Sfcprop%emdust (0)) + allocate (Sfcprop%emseas (0)) + allocate (Sfcprop%emanoc (0)) + allocate (Sfcprop%ebb_smoke_in (0)) + allocate (Sfcprop%frp_input (0)) + allocate (Sfcprop%fhist (0)) + allocate (Sfcprop%coef_bb_dc(0)) + allocate (Sfcprop%fire_in (0,0)) endif end subroutine sfcprop_create @@ -2876,6 +3037,12 @@ subroutine coupling_create (Coupling, IM, Model) Coupling%fluxlwUP_jac = clear_val Coupling%htrlw = clear_val Coupling%tsfc_radtime = clear_val + else + allocate (Coupling%fluxlwUP_radtime (0, 0)) + allocate (Coupling%fluxlwDOWN_radtime (0, 0)) + allocate (Coupling%fluxlwUP_jac (0, 0)) + allocate (Coupling%htrlw (0, 0)) + allocate (Coupling%tsfc_radtime (0)) endif if (Model%cplflx .or. Model%do_sppt .or. Model%cplchm .or. Model%ca_global .or. Model%cpllnd) then @@ -2883,6 +3050,9 @@ subroutine coupling_create (Coupling, IM, Model) allocate (Coupling%snow_cpl (IM)) Coupling%rain_cpl = clear_val Coupling%snow_cpl = clear_val + else + allocate (Coupling%rain_cpl (0)) + allocate (Coupling%snow_cpl (0)) endif if (Model%cplflx .or. Model%cplchm .or. Model%cplwav) then @@ -2892,12 +3062,17 @@ subroutine coupling_create (Coupling, IM, Model) Coupling%u10mi_cpl = clear_val Coupling%v10mi_cpl = clear_val + else + allocate (Coupling%u10mi_cpl (0)) + allocate (Coupling%v10mi_cpl (0)) endif if (Model%cplflx .or. Model%cplchm .or. Model%cpllnd) then !--- instantaneous quantities allocate (Coupling%tsfci_cpl (IM)) Coupling%tsfci_cpl = clear_val + else + allocate (Coupling%tsfci_cpl (0)) endif ! if (Model%cplwav2atm) then @@ -2907,14 +3082,39 @@ subroutine coupling_create (Coupling, IM, Model) ! Coupling%zorlwav_cpl = clear_val ! endif + ! -- additional coupling options for air quality + if (Model%cplflx .or. Model%cpllnd .or. (Model%cplaqm .and. .not.Model%cplflx)) then + allocate (Coupling%psurfi_cpl (IM)) + allocate (Coupling%nswsfci_cpl (IM)) + Coupling%psurfi_cpl = clear_val + Coupling%nswsfci_cpl = clear_val + else + allocate (Coupling%psurfi_cpl (0)) + allocate (Coupling%nswsfci_cpl (0)) + endif + + if (Model%cplflx .or. (Model%cplaqm .and. .not.Model%cplflx)) then + allocate (Coupling%dtsfci_cpl (IM)) + allocate (Coupling%dqsfci_cpl (IM)) + allocate (Coupling%t2mi_cpl (IM)) + allocate (Coupling%q2mi_cpl (IM)) + Coupling%dtsfci_cpl = clear_val + Coupling%dqsfci_cpl = clear_val + Coupling%t2mi_cpl = clear_val + Coupling%q2mi_cpl = clear_val + else + allocate (Coupling%dtsfci_cpl (0)) + allocate (Coupling%dqsfci_cpl (0)) + allocate (Coupling%t2mi_cpl (0)) + allocate (Coupling%q2mi_cpl (0)) + endif + if (Model%cplflx .or. Model%cpllnd) then allocate (Coupling%dlwsfci_cpl (IM)) allocate (Coupling%dswsfci_cpl (IM)) allocate (Coupling%dlwsfc_cpl (IM)) allocate (Coupling%dswsfc_cpl (IM)) - allocate (Coupling%psurfi_cpl (IM)) allocate (Coupling%nswsfc_cpl (IM)) - allocate (Coupling%nswsfci_cpl (IM)) allocate (Coupling%nnirbmi_cpl (IM)) allocate (Coupling%nnirdfi_cpl (IM)) allocate (Coupling%nvisbmi_cpl (IM)) @@ -2928,9 +3128,7 @@ subroutine coupling_create (Coupling, IM, Model) Coupling%dswsfci_cpl = clear_val Coupling%dlwsfc_cpl = clear_val Coupling%dswsfc_cpl = clear_val - Coupling%psurfi_cpl = clear_val Coupling%nswsfc_cpl = clear_val - Coupling%nswsfci_cpl = clear_val Coupling%nnirbmi_cpl = clear_val Coupling%nnirdfi_cpl = clear_val Coupling%nvisbmi_cpl = clear_val @@ -2939,6 +3137,20 @@ subroutine coupling_create (Coupling, IM, Model) Coupling%nnirdf_cpl = clear_val Coupling%nvisbm_cpl = clear_val Coupling%nvisdf_cpl = clear_val + else + allocate (Coupling%dlwsfci_cpl (0)) + allocate (Coupling%dswsfci_cpl (0)) + allocate (Coupling%dlwsfc_cpl (0)) + allocate (Coupling%dswsfc_cpl (0)) + allocate (Coupling%nswsfc_cpl (0)) + allocate (Coupling%nnirbmi_cpl (0)) + allocate (Coupling%nnirdfi_cpl (0)) + allocate (Coupling%nvisbmi_cpl (0)) + allocate (Coupling%nvisdfi_cpl (0)) + allocate (Coupling%nnirbm_cpl (0)) + allocate (Coupling%nnirdf_cpl (0)) + allocate (Coupling%nvisbm_cpl (0)) + allocate (Coupling%nvisdf_cpl (0)) end if if (Model%cplflx) then @@ -2988,6 +3200,12 @@ subroutine coupling_create (Coupling, IM, Model) Coupling%dtsfcin_med = clear_val Coupling%dqsfcin_med = clear_val Coupling%ulwsfcin_med = clear_val + else + allocate (Coupling%dusfcin_med (0)) + allocate (Coupling%dvsfcin_med (0)) + allocate (Coupling%dtsfcin_med (0)) + allocate (Coupling%dqsfcin_med (0)) + allocate (Coupling%ulwsfcin_med(0)) end if !--- accumulated quantities @@ -3014,35 +3232,62 @@ subroutine coupling_create (Coupling, IM, Model) !--- instantaneous quantities allocate (Coupling%dusfci_cpl (IM)) allocate (Coupling%dvsfci_cpl (IM)) - allocate (Coupling%dtsfci_cpl (IM)) - allocate (Coupling%dqsfci_cpl (IM)) allocate (Coupling%dnirbmi_cpl (IM)) allocate (Coupling%dnirdfi_cpl (IM)) allocate (Coupling%dvisbmi_cpl (IM)) allocate (Coupling%dvisdfi_cpl (IM)) allocate (Coupling%nlwsfci_cpl (IM)) - allocate (Coupling%t2mi_cpl (IM)) - allocate (Coupling%q2mi_cpl (IM)) allocate (Coupling%oro_cpl (IM)) allocate (Coupling%slmsk_cpl (IM)) Coupling%dusfci_cpl = clear_val Coupling%dvsfci_cpl = clear_val - Coupling%dtsfci_cpl = clear_val - Coupling%dqsfci_cpl = clear_val Coupling%dnirbmi_cpl = clear_val Coupling%dnirdfi_cpl = clear_val Coupling%dvisbmi_cpl = clear_val Coupling%dvisdfi_cpl = clear_val Coupling%nlwsfci_cpl = clear_val - Coupling%t2mi_cpl = clear_val - Coupling%q2mi_cpl = clear_val - Coupling%oro_cpl = clear_val !< pointer to sfcprop%oro - Coupling%slmsk_cpl = clear_val !< pointer to sfcprop%slmsk + Coupling%oro_cpl = clear_val + Coupling%slmsk_cpl = clear_val + else + allocate (Coupling%slimskin_cpl (0)) + allocate (Coupling%dusfcin_cpl (0)) + allocate (Coupling%dvsfcin_cpl (0)) + allocate (Coupling%dtsfcin_cpl (0)) + allocate (Coupling%dqsfcin_cpl (0)) + allocate (Coupling%ulwsfcin_cpl (0)) + allocate (Coupling%hsnoin_cpl (0)) + + allocate (Coupling%dusfcin_med (0)) + allocate (Coupling%dvsfcin_med (0)) + allocate (Coupling%dtsfcin_med (0)) + allocate (Coupling%dqsfcin_med (0)) + allocate (Coupling%ulwsfcin_med(0)) + + allocate (Coupling%dusfc_cpl (0)) + allocate (Coupling%dvsfc_cpl (0)) + allocate (Coupling%dtsfc_cpl (0)) + allocate (Coupling%dqsfc_cpl (0)) + allocate (Coupling%dnirbm_cpl (0)) + allocate (Coupling%dnirdf_cpl (0)) + allocate (Coupling%dvisbm_cpl (0)) + allocate (Coupling%dvisdf_cpl (0)) + allocate (Coupling%nlwsfc_cpl (0)) + + allocate (Coupling%dusfci_cpl (0)) + allocate (Coupling%dvsfci_cpl (0)) + allocate (Coupling%dnirbmi_cpl (0)) + allocate (Coupling%dnirdfi_cpl (0)) + allocate (Coupling%dvisbmi_cpl (0)) + allocate (Coupling%dvisdfi_cpl (0)) + allocate (Coupling%nlwsfci_cpl (0)) + allocate (Coupling%oro_cpl (0)) + allocate (Coupling%slmsk_cpl (0)) endif !-- cellular automata allocate (Coupling%condition(IM)) + Coupling%condition = clear_val if (Model%do_ca) then allocate (Coupling%ca1 (IM)) allocate (Coupling%ca2 (IM)) @@ -3060,7 +3305,15 @@ subroutine coupling_create (Coupling, IM, Model) Coupling%ca_shal = clear_val Coupling%ca_rad = clear_val Coupling%ca_micro = clear_val - Coupling%condition = clear_val + else + allocate (Coupling%ca1 (0)) + allocate (Coupling%ca2 (0)) + allocate (Coupling%ca3 (0)) + allocate (Coupling%ca_deep (0)) + allocate (Coupling%ca_turb (0)) + allocate (Coupling%ca_shal (0)) + allocate (Coupling%ca_rad (0)) + allocate (Coupling%ca_micro (0)) endif ! -- Aerosols coupling options @@ -3073,46 +3326,41 @@ subroutine coupling_create (Coupling, IM, Model) Coupling%ushfsfci = clear_val Coupling%pfi_lsan = clear_val Coupling%pfl_lsan = clear_val + else + allocate (Coupling%ushfsfci (0)) + allocate (Coupling%pfi_lsan (0,0)) + allocate (Coupling%pfl_lsan (0,0)) endif if (Model%cplchm .or. Model%cplflx .or. Model%cpllnd) then !--- accumulated convective rainfall allocate (Coupling%rainc_cpl (IM)) Coupling%rainc_cpl = clear_val + else + allocate (Coupling%rainc_cpl (0)) end if - ! -- additional coupling options for air quality - if (Model%cplaqm .and. .not.Model%cplflx) then - !--- outgoing instantaneous quantities - allocate (Coupling%dtsfci_cpl (IM)) - allocate (Coupling%dqsfci_cpl (IM)) - allocate (Coupling%nswsfci_cpl (IM)) - allocate (Coupling%t2mi_cpl (IM)) - allocate (Coupling%q2mi_cpl (IM)) - allocate (Coupling%psurfi_cpl (IM)) - Coupling%dtsfci_cpl = clear_val - Coupling%dqsfci_cpl = clear_val - Coupling%nswsfci_cpl = clear_val - Coupling%t2mi_cpl = clear_val - Coupling%q2mi_cpl = clear_val - Coupling%psurfi_cpl = clear_val - endif - if(Model%progsigma)then allocate(Coupling%dqdt_qmicro (IM,Model%levs)) Coupling%dqdt_qmicro = clear_val + else + allocate(Coupling%dqdt_qmicro (0,0)) endif !--- stochastic physics option if (Model%do_sppt .or. Model%ca_global) then allocate (Coupling%sppt_wts (IM,Model%levs)) Coupling%sppt_wts = clear_val + else + allocate (Coupling%sppt_wts (0,0)) endif !--- stochastic shum option if (Model%do_shum) then allocate (Coupling%shum_wts (IM,Model%levs)) Coupling%shum_wts = clear_val + else + allocate (Coupling%shum_wts (0,0)) endif !--- stochastic skeb option @@ -3122,12 +3370,17 @@ subroutine coupling_create (Coupling, IM, Model) Coupling%skebu_wts = clear_val Coupling%skebv_wts = clear_val + else + allocate (Coupling%skebu_wts (0,0)) + allocate (Coupling%skebv_wts (0,0)) endif !--- stochastic land perturbation option if (Model%lndp_type /= 0) then allocate (Coupling%sfc_wts (IM,Model%n_var_lndp)) Coupling%sfc_wts = clear_val + else + allocate (Coupling%sfc_wts (0,0)) endif !--- stochastic spp perturbation option @@ -3144,6 +3397,13 @@ subroutine coupling_create (Coupling, IM, Model) Coupling%spp_wts_rad = clear_val allocate (Coupling%spp_wts_cu_deep (IM,Model%levs)) Coupling%spp_wts_cu_deep = clear_val + else + allocate (Coupling%spp_wts_pbl (0,0)) + allocate (Coupling%spp_wts_sfc (0,0)) + allocate (Coupling%spp_wts_mp (0,0)) + allocate (Coupling%spp_wts_gwd (0,0)) + allocate (Coupling%spp_wts_rad (0,0)) + allocate (Coupling%spp_wts_cu_deep (0,0)) endif !--- needed for Thompson's aerosol option @@ -3152,6 +3412,9 @@ subroutine coupling_create (Coupling, IM, Model) allocate (Coupling%nifa2d (IM)) Coupling%nwfa2d = clear_val Coupling%nifa2d = clear_val + else + allocate (Coupling%nwfa2d (0)) + allocate (Coupling%nifa2d (0)) endif if(Model%rrfs_sd) then @@ -3180,11 +3443,26 @@ subroutine coupling_create (Coupling, IM, Model) Coupling%max_fplume = clear_val Coupling%rrfs_hwp = clear_val Coupling%rrfs_hwp_ave = clear_val + else + allocate (Coupling%ebu_smoke (0,0)) + allocate (Coupling%smoke_ext (0,0)) + allocate (Coupling%dust_ext (0,0)) + allocate (Coupling%chem3d (0,0,0)) + allocate (Coupling%ddvel (0,0)) + allocate (Coupling%wetdpc_flux(0,0)) + allocate (Coupling%wetdpr_flux(0,0)) + allocate (Coupling%drydep_flux(0,0)) + allocate (Coupling%min_fplume(0)) + allocate (Coupling%max_fplume(0)) + allocate (Coupling%rrfs_hwp (0)) + allocate (Coupling%rrfs_hwp_ave (0)) endif if (Model%imfdeepcnv == Model%imfdeepcnv_gf .or. Model%imfdeepcnv == Model%imfdeepcnv_c3) then allocate (Coupling%qci_conv (IM,Model%levs)) Coupling%qci_conv = clear_val + else + allocate (Coupling%qci_conv (0,0)) endif end subroutine coupling_create @@ -6954,6 +7232,10 @@ subroutine grid_create (Grid, IM, Model) Grid%ddy_o3 = clear_val Grid%jindx1_o3 = clear_val Grid%jindx2_o3 = clear_val + else + allocate (Grid%ddy_o3 (0)) + allocate (Grid%jindx1_o3 (0)) + allocate (Grid%jindx2_o3 (0)) endif !--- stratosphere h2o active @@ -6965,6 +7247,10 @@ subroutine grid_create (Grid, IM, Model) Grid%ddy_h = clear_val Grid%jindx1_h = clear_val Grid%jindx2_h = clear_val + else + allocate (Grid%ddy_h (0)) + allocate (Grid%jindx1_h (0)) + allocate (Grid%jindx2_h (0)) endif !--- iccn active @@ -6982,6 +7268,13 @@ subroutine grid_create (Grid, IM, Model) Grid%ddx_ci = clear_val Grid%iindx1_ci = clear_val Grid%iindx2_ci = clear_val + else + allocate (Grid%ddy_ci (0)) + allocate (Grid%jindx1_ci (0)) + allocate (Grid%jindx2_ci (0)) + allocate (Grid%ddx_ci (0)) + allocate (Grid%iindx1_ci (0)) + allocate (Grid%iindx2_ci (0)) endif !--- iaerclm active @@ -6999,6 +7292,13 @@ subroutine grid_create (Grid, IM, Model) Grid%ddx_aer = clear_val Grid%iindx1_aer = clear_val Grid%iindx2_aer = clear_val + else + allocate (Grid%ddy_aer (0)) + allocate (Grid%jindx1_aer(0)) + allocate (Grid%jindx2_aer(0)) + allocate (Grid%ddx_aer (0)) + allocate (Grid%iindx1_aer(0)) + allocate (Grid%iindx2_aer(0)) endif !--- Model%do_ugwpv1 @@ -7012,6 +7312,11 @@ subroutine grid_create (Grid, IM, Model) Grid%ddy_j2tau = clear_val Grid%jindx1_tau = clear_val Grid%jindx2_tau = clear_val + else + allocate (Grid%ddy_j1tau (0)) + allocate (Grid%ddy_j2tau (0)) + allocate (Grid%jindx1_tau (0)) + allocate (Grid%jindx2_tau (0)) endif end subroutine grid_create @@ -7038,7 +7343,13 @@ subroutine tbd_create (Tbd, IM, Model) if (Model%lrseeds) then allocate (Tbd%rseeds(IM,Model%nrstreams)) Tbd%rseeds = zero + else + allocate (Tbd%rseeds(0,0)) endif + else + allocate (Tbd%icsdsw (0)) + allocate (Tbd%icsdlw (0)) + allocate (Tbd%rseeds(0,0)) endif !--- DFI radar forcing @@ -7051,7 +7362,12 @@ subroutine tbd_create (Tbd, IM, Model) if(Model%do_cap_suppress) then allocate(Tbd%cap_suppress(IM,Model%num_dfi_radar)) Tbd%cap_suppress(:,:) = zero + else + allocate(Tbd%cap_suppress(0,0)) endif + else + allocate(Tbd%dfi_radar_tten(0,0,0)) + allocate(Tbd%cap_suppress(0,0)) endif !--- ozone and stratosphere h2o needs @@ -7100,6 +7416,9 @@ subroutine tbd_create (Tbd, IM, Model) allocate (Tbd%dsnow_cpl (IM)) Tbd%drain_cpl = clear_val Tbd%dsnow_cpl = clear_val + else + allocate (Tbd%drain_cpl (0)) + allocate (Tbd%dsnow_cpl (0)) endif if (Model%do_sppt .or. Model%ca_global) then @@ -7109,6 +7428,10 @@ subroutine tbd_create (Tbd, IM, Model) Tbd%dtdtnp = clear_val Tbd%dtotprcp = clear_val Tbd%dcnvprcp = clear_val + else + allocate (Tbd%dtdtnp (0,0)) + allocate (Tbd%dtotprcp (0)) + allocate (Tbd%dcnvprcp (0)) endif allocate (Tbd%phy_f2d (IM,Model%ntot2d)) @@ -7119,6 +7442,8 @@ subroutine tbd_create (Tbd, IM, Model) if (Model%nctp > 0 .and. Model%cscnv) then allocate (Tbd%phy_fctd (IM,Model%nctp)) Tbd%phy_fctd = clear_val + else + allocate (Tbd%phy_fctd (0,0)) endif ! if (Model%do_shoc) Tbd%phy_f3d(:,1,Model%ntot3d-1) = 3.0 @@ -7130,21 +7455,28 @@ subroutine tbd_create (Tbd, IM, Model) if (Model%imfdeepcnv == Model%imfdeepcnv_gf .or. Model%imfdeepcnv == Model%imfdeepcnv_ntiedtke .or. Model%imfdeepcnv == Model%imfdeepcnv_samf .or. Model%imfshalcnv == Model%imfshalcnv_samf .or. Model%imfdeepcnv == Model%imfdeepcnv_c3 .or. Model%imfshalcnv == Model%imfshalcnv_c3) then allocate(Tbd%prevsq(IM, Model%levs)) Tbd%prevsq = clear_val + else + allocate(Tbd%prevsq(0, 0)) endif if (Model%imfdeepcnv .ge. 0 .or. Model%imfshalcnv .ge. 0) then allocate(Tbd%ud_mf(IM, Model%levs)) Tbd%ud_mf = zero + else + allocate(Tbd%ud_mf(0, 0)) endif if (Model%imfdeepcnv == Model%imfdeepcnv_gf .or. Model%imfdeepcnv == Model%imfdeepcnv_ntiedtke .or. Model%imfdeepcnv == Model%imfdeepcnv_c3) then allocate(Tbd%forcet(IM, Model%levs)) allocate(Tbd%forceq(IM, Model%levs)) - allocate(Tbd%forcet(IM, Model%levs)) allocate(Tbd%prevst(IM, Model%levs)) Tbd%forcet = clear_val Tbd%forceq = clear_val Tbd%prevst = clear_val + else + allocate(Tbd%forcet(0, 0)) + allocate(Tbd%forceq(0, 0)) + allocate(Tbd%prevst(0, 0)) end if if (Model%imfdeepcnv == Model%imfdeepcnv_gf .or. Model%imfdeepcnv == Model%imfdeepcnv_c3) then @@ -7154,6 +7486,10 @@ subroutine tbd_create (Tbd, IM, Model) Tbd%cactiv = zero Tbd%cactiv_m = zero Tbd%aod_gf = zero + else + allocate(Tbd%cactiv(0)) + allocate(Tbd%cactiv_m(0)) + allocate(Tbd%aod_gf(0)) end if !--- MYNN variables: @@ -7180,6 +7516,17 @@ subroutine tbd_create (Tbd, IM, Model) Tbd%tsq = clear_val Tbd%qsq = clear_val Tbd%cov = clear_val + else + allocate (Tbd%cldfra_bl (0,0)) + allocate (Tbd%qc_bl (0,0)) + allocate (Tbd%qi_bl (0,0)) + allocate (Tbd%el_pbl (0,0)) + allocate (Tbd%sh3d (0,0)) + allocate (Tbd%sm3d (0,0)) + allocate (Tbd%qke (0,0)) + allocate (Tbd%tsq (0,0)) + allocate (Tbd%qsq (0,0)) + allocate (Tbd%cov (0,0)) end if ! MYJ variables @@ -7210,6 +7557,19 @@ subroutine tbd_create (Tbd, IM, Model) Tbd%phy_myj_a1u = clear_val Tbd%phy_myj_a1t = clear_val Tbd%phy_myj_a1q = clear_val + else + allocate (Tbd%phy_myj_qsfc (0)) + allocate (Tbd%phy_myj_thz0 (0)) + allocate (Tbd%phy_myj_qz0 (0)) + allocate (Tbd%phy_myj_uz0 (0)) + allocate (Tbd%phy_myj_vz0 (0)) + allocate (Tbd%phy_myj_akhs (0)) + allocate (Tbd%phy_myj_akms (0)) + allocate (Tbd%phy_myj_chkqlm (0)) + allocate (Tbd%phy_myj_elflx (0)) + allocate (Tbd%phy_myj_a1u (0)) + allocate (Tbd%phy_myj_a1t (0)) + allocate (Tbd%phy_myj_a1q (0)) end if end subroutine tbd_create @@ -7531,6 +7891,8 @@ subroutine diag_create (Diag, IM, Model) if(Model%print_diff_pgr) then allocate(Diag%old_pgr(IM)) Diag%old_pgr = clear_val + else + allocate(Diag%old_pgr(0)) endif if(Model%lightning_threat) then @@ -7540,6 +7902,10 @@ subroutine diag_create (Diag, IM, Model) Diag%ltg1_max = zero Diag%ltg2_max = zero Diag%ltg3_max = zero + else + allocate (Diag%ltg1_max(0)) + allocate (Diag%ltg2_max(0)) + allocate (Diag%ltg3_max(0)) endif !--- Radiation @@ -7638,6 +8004,8 @@ subroutine diag_create (Diag, IM, Model) allocate (Diag%tsnowpb (IM)) if (.not. Model%lsm == Model%lsm_ruc) then allocate (Diag%wet1 (IM)) + else + allocate (Diag%wet1 (0)) end if allocate (Diag%sr (IM)) allocate (Diag%tdomr (IM)) @@ -7650,11 +8018,17 @@ subroutine diag_create (Diag, IM, Model) allocate (Diag%paha (IM)) allocate (Diag%twa (IM)) allocate (Diag%pahi (IM)) + else + allocate (Diag%paha (0)) + allocate (Diag%twa (0)) + allocate (Diag%pahi (0)) endif ! F-A MP scheme if (Model%imp_physics == Model%imp_physics_fer_hires) then allocate (Diag%train (IM,Model%levs)) + else + allocate (Diag%train (0,0)) end if allocate (Diag%cldfra (IM,Model%levr+LTP)) allocate (Diag%cldfra2d (IM)) @@ -7672,13 +8046,31 @@ subroutine diag_create (Diag, IM, Model) allocate (Diag%upd_mf (IM,Model%levs)) allocate (Diag%dwn_mf (IM,Model%levs)) allocate (Diag%det_mf (IM,Model%levs)) + else + allocate (Diag%upd_mf (0,0)) + allocate (Diag%dwn_mf (0,0)) + allocate (Diag%det_mf (0,0)) endif if (Model%oz_phys_2015) then allocate(Diag%do3_dt_prd( IM, Model%levs)) allocate(Diag%do3_dt_ozmx(IM, Model%levs)) allocate(Diag%do3_dt_temp(IM, Model%levs)) allocate(Diag%do3_dt_ohoz(IM, Model%levs)) + else + allocate(Diag%do3_dt_prd( 0,0)) + allocate(Diag%do3_dt_ozmx(0,0)) + allocate(Diag%do3_dt_temp(0,0)) + allocate(Diag%do3_dt_ohoz(0,0)) endif + else + allocate(Diag%dtend(0,0,0)) + allocate(Diag%upd_mf (0,0)) + allocate(Diag%dwn_mf (0,0)) + allocate(Diag%det_mf (0,0)) + allocate(Diag%do3_dt_prd( 0,0)) + allocate(Diag%do3_dt_ozmx(0,0)) + allocate(Diag%do3_dt_temp(0,0)) + allocate(Diag%do3_dt_ohoz(0,0)) endif ! UGWP @@ -7695,20 +8087,11 @@ subroutine diag_create (Diag, IM, Model) allocate (Diag%kdis_gw (IM,Model%levs)) if (Model%ldiag_ugwp) then - allocate (Diag%du3dt_dyn (IM,Model%levs) ) - allocate (Diag%du3dt_pbl (IM,Model%levs) ) - allocate (Diag%dv3dt_pbl (IM,Model%levs) ) - allocate (Diag%dt3dt_pbl (IM,Model%levs) ) allocate (Diag%du3dt_ogw (IM,Model%levs) ) allocate (Diag%du3dt_mtb (IM,Model%levs) ) allocate (Diag%du3dt_tms (IM,Model%levs) ) allocate (Diag%du3dt_ngw (IM,Model%levs) ) allocate (Diag%dv3dt_ngw (IM,Model%levs) ) - allocate (Diag%dudt_tot (IM,Model%levs) ) - allocate (Diag%dvdt_tot (IM,Model%levs) ) - allocate (Diag%dtdt_tot (IM,Model%levs) ) - allocate (Diag%uav_ugwp (IM,Model%levs) ) - allocate (Diag%tav_ugwp (IM,Model%levs) ) allocate (Diag%dws3dt_ogw (IM,Model%levs) ) allocate (Diag%dws3dt_obl (IM,Model%levs) ) allocate (Diag%dws3dt_oss (IM,Model%levs) ) @@ -7720,10 +8103,27 @@ subroutine diag_create (Diag, IM, Model) allocate (Diag%ldu3dt_ngw (IM,Model%levs) ) allocate (Diag%ldv3dt_ngw (IM,Model%levs) ) allocate (Diag%ldt3dt_ngw (IM,Model%levs) ) + else + allocate (Diag%du3dt_ogw (0,0) ) + allocate (Diag%du3dt_mtb (0,0) ) + allocate (Diag%du3dt_tms (0,0) ) + allocate (Diag%du3dt_ngw (0,0) ) + allocate (Diag%dv3dt_ngw (0,0) ) + allocate (Diag%dws3dt_ogw (0,0) ) + allocate (Diag%dws3dt_obl (0,0) ) + allocate (Diag%dws3dt_oss (0,0) ) + allocate (Diag%dws3dt_ofd (0,0) ) + allocate (Diag%ldu3dt_ogw (0,0) ) + allocate (Diag%ldu3dt_obl (0,0) ) + allocate (Diag%ldu3dt_oss (0,0) ) + allocate (Diag%ldu3dt_ofd (0,0) ) + allocate (Diag%ldu3dt_ngw (0,0) ) + allocate (Diag%ldv3dt_ngw (0,0) ) + allocate (Diag%ldt3dt_ngw (0,0) ) endif - + + allocate (Diag%dudt_ogw (IM,Model%levs)) if (Model%do_ugwp_v1 .or. Model%ldiag_ugwp) then - allocate (Diag%dudt_ogw (IM,Model%levs)) allocate (Diag%dvdt_ogw (IM,Model%levs)) allocate (Diag%dudt_obl (IM,Model%levs)) allocate (Diag%dvdt_obl (IM,Model%levs)) @@ -7748,7 +8148,29 @@ subroutine diag_create (Diag, IM, Model) allocate (Diag%du3_ofdcol (IM) ) allocate (Diag%dv3_ofdcol (IM) ) else - allocate (Diag%dudt_ogw (IM,Model%levs)) + allocate (Diag%dvdt_ogw (0,0)) + allocate (Diag%dudt_obl (0,0)) + allocate (Diag%dvdt_obl (0,0)) + allocate (Diag%dudt_oss (0,0)) + allocate (Diag%dvdt_oss (0,0)) + allocate (Diag%dudt_ofd (0,0)) + allocate (Diag%dvdt_ofd (0,0)) + allocate (Diag%du_ogwcol (0)) + allocate (Diag%dv_ogwcol (0)) + allocate (Diag%du_oblcol (0)) + allocate (Diag%dv_oblcol (0)) + allocate (Diag%du_osscol (0)) + allocate (Diag%dv_osscol (0)) + allocate (Diag%du_ofdcol (0)) + allocate (Diag%dv_ofdcol (0)) + allocate (Diag%du3_ogwcol (0)) + allocate (Diag%dv3_ogwcol (0)) + allocate (Diag%du3_oblcol (0)) + allocate (Diag%dv3_oblcol (0)) + allocate (Diag%du3_osscol (0)) + allocate (Diag%dv3_osscol (0)) + allocate (Diag%du3_ofdcol (0)) + allocate (Diag%dv3_ofdcol (0)) endif !--- 3D diagnostics for Thompson MP / GFDL MP @@ -7781,6 +8203,17 @@ subroutine diag_create (Diag, IM, Model) allocate (Diag%sub_sqv (IM,Model%levs)) allocate (Diag%det_thl (IM,Model%levs)) allocate (Diag%det_sqv (IM,Model%levs)) + else + allocate (Diag%edmf_a (0,0)) + allocate (Diag%edmf_w (0,0)) + allocate (Diag%edmf_qt (0,0)) + allocate (Diag%edmf_thl (0,0)) + allocate (Diag%edmf_ent (0,0)) + allocate (Diag%edmf_qc (0,0)) + allocate (Diag%sub_thl (0,0)) + allocate (Diag%sub_sqv (0,0)) + allocate (Diag%det_thl (0,0)) + allocate (Diag%det_sqv (0,0)) endif if (Model%tke_budget .gt. 0) then allocate (Diag%dqke (IM,Model%levs)) @@ -7788,6 +8221,12 @@ subroutine diag_create (Diag, IM, Model) allocate (Diag%qshear (IM,Model%levs)) allocate (Diag%qbuoy (IM,Model%levs)) allocate (Diag%qdiss (IM,Model%levs)) + else + allocate (Diag%dqke (0,0)) + allocate (Diag%qwt (0,0)) + allocate (Diag%qshear (0,0)) + allocate (Diag%qbuoy (0,0)) + allocate (Diag%qdiss (0,0)) endif allocate (Diag%maxwidth (IM)) allocate (Diag%maxmf (IM)) @@ -7820,12 +8259,36 @@ subroutine diag_create (Diag, IM, Model) Diag%ktop_plume = 0 Diag%exch_h = clear_val Diag%exch_m = clear_val + else + allocate (Diag%edmf_a (0,0)) + allocate (Diag%edmf_w (0,0)) + allocate (Diag%edmf_qt (0,0)) + allocate (Diag%edmf_thl (0,0)) + allocate (Diag%edmf_ent (0,0)) + allocate (Diag%edmf_qc (0,0)) + allocate (Diag%sub_thl (0,0)) + allocate (Diag%sub_sqv (0,0)) + allocate (Diag%det_thl (0,0)) + allocate (Diag%det_sqv (0,0)) + allocate (Diag%dqke (0,0)) + allocate (Diag%qwt (0,0)) + allocate (Diag%qshear (0,0)) + allocate (Diag%qbuoy (0,0)) + allocate (Diag%qdiss (0,0)) + allocate (Diag%maxwidth (0)) + allocate (Diag%maxmf (0)) + allocate (Diag%ztop_plume(0)) + allocate (Diag%ktop_plume(0)) + allocate (Diag%exch_h (0,0)) + allocate (Diag%exch_m (0,0)) endif ! Extended diagnostics for Thompson MP if (Model%ext_diag_thompson) then allocate (Diag%thompson_ext_diag3d(IM,Model%levs,Model%thompson_ext_ndiag3d)) Diag%thompson_ext_diag3d = clear_val + else + allocate (Diag%thompson_ext_diag3d(0,0,0)) endif ! Air quality diagnostics @@ -7833,16 +8296,22 @@ subroutine diag_create (Diag, IM, Model) if (Model%cplaqm) then allocate (Diag%aod(IM)) Diag%aod = zero + else + allocate (Diag%aod(0)) end if ! Auxiliary arrays in output for debugging if (Model%naux2d>0) then allocate (Diag%aux2d(IM,Model%naux2d)) Diag%aux2d = clear_val + else + allocate (Diag%aux2d(0,0)) endif if (Model%naux3d>0) then allocate (Diag%aux3d(IM,Model%levs,Model%naux3d)) Diag%aux3d = clear_val + else + allocate (Diag%aux3d(0,0,0)) endif call Diag%rad_zero (Model) @@ -8043,8 +8512,8 @@ subroutine diag_phys_zero (Diag, Model, linit, iauwindow_center) Diag%dtdt_gw = zero Diag%kdis_gw = zero + Diag%dudt_ogw = zero if (Model%do_ugwp_v1 .or. Model%ldiag_ugwp) then - Diag%dudt_ogw = zero Diag%dvdt_ogw = zero Diag%dudt_obl = zero Diag%dvdt_obl = zero @@ -8068,24 +8537,14 @@ subroutine diag_phys_zero (Diag, Model, linit, iauwindow_center) Diag%dv3_osscol = zero Diag%du3_ofdcol = zero Diag%dv3_ofdcol = zero - else - Diag%dudt_ogw = zero end if if (Model%ldiag_ugwp) then - Diag%du3dt_pbl = zero - Diag%dv3dt_pbl = zero - Diag%dt3dt_pbl = zero Diag%du3dt_ogw = zero Diag%du3dt_mtb = zero Diag%du3dt_tms = zero Diag%du3dt_ngw = zero Diag%dv3dt_ngw = zero - Diag%dudt_tot = zero - Diag%dvdt_tot = zero - Diag%dtdt_tot = zero - Diag%uav_ugwp = zero - Diag%tav_ugwp = zero Diag%dws3dt_ogw = zero Diag%dws3dt_obl = zero Diag%dws3dt_oss = zero @@ -8097,8 +8556,6 @@ subroutine diag_phys_zero (Diag, Model, linit, iauwindow_center) Diag%ldu3dt_ngw = zero Diag%ldv3dt_ngw = zero Diag%ldt3dt_ngw = zero -!COORDE - Diag%du3dt_dyn = zero endif ! diff --git a/ccpp/data/GFS_typedefs.meta b/ccpp/data/GFS_typedefs.meta index ebaa9af7f..7c0ec7932 100644 --- a/ccpp/data/GFS_typedefs.meta +++ b/ccpp/data/GFS_typedefs.meta @@ -696,7 +696,7 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys - active = (control_for_lake_model_execution_method > 0 .and. control_for_lake_model_selection == 2) + active = (control_for_lake_model_execution_method > 0 .and. control_for_lake_model_selection == clm_lake_model_control_selection_value) [use_lake_model] standard_name = flag_for_using_lake_model long_name = flag indicating lake points using a lake model @@ -710,7 +710,7 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys - active = (control_for_lake_model_execution_method > 0 .and. control_for_lake_model_selection == 2) + active = (control_for_lake_model_execution_method > 0 .and. control_for_lake_model_selection == clm_lake_model_control_selection_value) [lake_q2m] standard_name = specific_humidity_at_2m_from_clm_lake long_name = specific humidity at 2m from clm lake @@ -718,7 +718,7 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys - active = (control_for_lake_model_execution_method > 0 .and. control_for_lake_model_selection == 2) + active = (control_for_lake_model_execution_method > 0 .and. control_for_lake_model_selection == clm_lake_model_control_selection_value) [h_ML] standard_name = mixed_layer_depth_of_lakes long_name = depth of lake mixing layer @@ -726,7 +726,7 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys - active = (control_for_lake_model_selection == 1 .and. control_for_lake_model_execution_method > 0) + active = (control_for_lake_model_selection == flake_model_control_selection_value .and. control_for_lake_model_execution_method > 0) [t_ML] standard_name = lake_mixed_layer_temperature long_name = temperature of lake mixing layer @@ -734,7 +734,7 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys - active = (control_for_lake_model_selection == 1 .and. control_for_lake_model_execution_method > 0) + active = (control_for_lake_model_selection == flake_model_control_selection_value .and. control_for_lake_model_execution_method > 0) [t_mnw] standard_name = mean_temperature_of_the_water_column long_name = thee mean temperature of the water column @@ -742,7 +742,7 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys - active = (control_for_lake_model_selection == 1 .and. control_for_lake_model_execution_method > 0) + active = (control_for_lake_model_selection == flake_model_control_selection_value .and. control_for_lake_model_execution_method > 0) [h_talb] standard_name = the_thermally_active_layer_depth_of_the_bottom_sediment long_name = the depth of the thermally active layer of the bottom sediment @@ -750,7 +750,7 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys - active = (control_for_lake_model_selection == 1 .and. control_for_lake_model_execution_method > 0) + active = (control_for_lake_model_selection == flake_model_control_selection_value .and. control_for_lake_model_execution_method > 0) [t_talb] standard_name = temperature_at_the_bottom_of_the_sediment_upper_layer long_name = the temperature at the bottom of the sediment upper layer @@ -758,7 +758,7 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys - active = (control_for_lake_model_selection == 1 .and. control_for_lake_model_execution_method > 0) + active = (control_for_lake_model_selection == flake_model_control_selection_value .and. control_for_lake_model_execution_method > 0) [t_bot1] standard_name = lake_bottom_temperature long_name = the temperature at the water-bottom sediment interface @@ -766,7 +766,7 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys - active = (control_for_lake_model_selection == 1 .and. control_for_lake_model_execution_method > 0) + active = (control_for_lake_model_selection == flake_model_control_selection_value .and. control_for_lake_model_execution_method > 0) [t_bot2] standard_name = temperature_for_bottom_layer_of_water long_name = the temperature at the lake bottom layer water @@ -774,7 +774,7 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys - active = (control_for_lake_model_selection == 1 .and. control_for_lake_model_execution_method > 0) + active = (control_for_lake_model_selection == flake_model_control_selection_value .and. control_for_lake_model_execution_method > 0) [c_t] standard_name = shape_factor_of_water_temperature_vertical_profile long_name = the shape factor of water temperature vertical profile @@ -782,7 +782,7 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys - active = (control_for_lake_model_selection == 1 .and. control_for_lake_model_execution_method > 0) + active = (control_for_lake_model_selection == flake_model_control_selection_value .and. control_for_lake_model_execution_method > 0) [T_snow] standard_name = temperature_of_snow_on_lake long_name = temperature of snow on a lake @@ -1165,7 +1165,7 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys - active = (control_for_deep_convection_scheme == identifier_for_grell_freitas_deep_convection) + active = (control_for_deep_convection_scheme == identifier_for_grell_freitas_deep_convection .or. control_for_deep_convection_scheme == identifier_for_c3_deep_convection) [conv_act] standard_name = consecutive_calls_for_grell_freitas_convection long_name = Memory counter for GF @@ -1231,6 +1231,7 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys + active = (control_for_land_surface_scheme == identifier_for_noah_land_surface_scheme) [tprcp] standard_name = nonnegative_lwe_thickness_of_precipitation_amount_on_dynamics_timestep long_name = total precipitation amount in each time step @@ -1882,6 +1883,7 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys + active = (control_for_land_surface_scheme == identifier_for_ruc_land_surface_scheme) [snowfallac_ice] standard_name = surface_snow_amount_assuming_variable_snow_density_over_ice long_name = run-total snow accumulation on the ground with variable snow density over ice @@ -1897,6 +1899,7 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys + active = (control_for_land_surface_scheme == identifier_for_ruc_land_surface_scheme) [ustm] standard_name = surface_friction_velocity_for_momentum long_name = friction velocity isolated for momentum only @@ -1928,7 +1931,6 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys - active = (flag_for_mellor_yamada_nakanishi_niino_surface_layer_scheme) [flhc] standard_name = surface_exchange_coefficient_for_heat long_name = surface exchange coefficient for heat @@ -1936,7 +1938,6 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys - active = (flag_for_mellor_yamada_nakanishi_niino_surface_layer_scheme) [flqc] standard_name = surface_exchange_coefficient_for_moisture long_name = surface exchange coefficient for moisture @@ -1944,7 +1945,6 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys - active = (flag_for_mellor_yamada_nakanishi_niino_surface_layer_scheme) [chs2] standard_name = surface_exchange_coefficient_for_heat_at_2m long_name = exchange coefficient for heat at 2 meters @@ -1997,7 +1997,7 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys - active = (control_for_land_surface_scheme == identifier_for_ruc_land_surface_scheme .or. control_for_land_surface_scheme == identifier_for_noahmp_land_surface_scheme .or. ( control_for_lake_model_execution_method > 0 .and. control_for_lake_model_selection == 2) ) + active = (control_for_land_surface_scheme == identifier_for_ruc_land_surface_scheme .or. control_for_land_surface_scheme == identifier_for_noahmp_land_surface_scheme .or. ( control_for_lake_model_execution_method > 0 .and. control_for_lake_model_selection == clm_lake_model_control_selection_value) ) [rainncprv] standard_name = lwe_thickness_of_explicit_precipitation_amount_on_previous_timestep long_name = explicit rainfall from previous timestep @@ -2005,7 +2005,7 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys - active = (control_for_land_surface_scheme == identifier_for_ruc_land_surface_scheme .or. control_for_land_surface_scheme == identifier_for_noahmp_land_surface_scheme .or. ( control_for_lake_model_execution_method > 0 .and. control_for_lake_model_selection == 2) ) + active = (control_for_land_surface_scheme == identifier_for_ruc_land_surface_scheme .or. control_for_land_surface_scheme == identifier_for_noahmp_land_surface_scheme .or. ( control_for_lake_model_execution_method > 0 .and. control_for_lake_model_selection == clm_lake_model_control_selection_value) ) [iceprv] standard_name = lwe_thickness_of_ice_precipitation_amount_on_previous_timestep long_name = ice amount from previous timestep @@ -2105,7 +2105,7 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys - active = (control_for_lake_model_selection == 2 .and. control_for_lake_model_execution_method > 0) + active = (control_for_lake_model_selection == clm_lake_model_control_selection_value .and. control_for_lake_model_execution_method > 0) [input_lakedepth] standard_name = lake_depth_before_correction long_name = lake depth_before_correction @@ -2113,7 +2113,7 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys - active = (control_for_lake_model_selection == 2 .and. control_for_lake_model_execution_method > 0) + active = (control_for_lake_model_selection == clm_lake_model_control_selection_value .and. control_for_lake_model_execution_method > 0) [lake_h2osno2d] standard_name = water_equivalent_accumulated_snow_depth_in_clm_lake_model long_name = water equiv of acc snow depth over lake in clm lake model @@ -2121,7 +2121,7 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys - active = (control_for_lake_model_selection == 2 .and. control_for_lake_model_execution_method > 0) + active = (control_for_lake_model_selection == clm_lake_model_control_selection_value .and. control_for_lake_model_execution_method > 0) [lake_sndpth2d] standard_name = actual_snow_depth_in_clm_lake_model long_name = actual acc snow depth over lake in clm lake model @@ -2129,7 +2129,7 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys - active = (control_for_lake_model_selection == 2 .and. control_for_lake_model_execution_method > 0) + active = (control_for_lake_model_selection == clm_lake_model_control_selection_value .and. control_for_lake_model_execution_method > 0) [lake_snl2d] standard_name = snow_layers_in_clm_lake_model long_name = snow layers in clm lake model (treated as integer) @@ -2137,7 +2137,7 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys - active = (control_for_lake_model_selection == 2 .and. control_for_lake_model_execution_method > 0) + active = (control_for_lake_model_selection == clm_lake_model_control_selection_value .and. control_for_lake_model_execution_method > 0) [lake_snow_z3d] standard_name = snow_level_depth_in_clm_lake_model long_name = snow level depth in clm lake model @@ -2145,7 +2145,7 @@ dimensions = (horizontal_loop_extent,snow_plus_soil_minus_one_vertical_dimension_for_clm_lake_model) type = real kind = kind_phys - active = (control_for_lake_model_selection == 2 .and. control_for_lake_model_execution_method > 0) + active = (control_for_lake_model_selection == clm_lake_model_control_selection_value .and. control_for_lake_model_execution_method > 0) [lake_snow_dz3d] standard_name = snow_level_thickness_in_clm_lake_model long_name = snow level thickness in clm lake model @@ -2153,7 +2153,7 @@ dimensions = (horizontal_loop_extent,snow_plus_soil_minus_one_vertical_dimension_for_clm_lake_model) type = real kind = kind_phys - active = (control_for_lake_model_selection == 2 .and. control_for_lake_model_execution_method > 0) + active = (control_for_lake_model_selection == clm_lake_model_control_selection_value .and. control_for_lake_model_execution_method > 0) [lake_snow_zi3d] standard_name = snow_interface_depth_in_clm_lake_model long_name = snow interface_depth in clm lake model @@ -2161,7 +2161,7 @@ dimensions = (horizontal_loop_extent,snow_plus_soil_vertical_dimension_for_clm_lake_model) type = real kind = kind_phys - active = (control_for_lake_model_selection == 2 .and. control_for_lake_model_execution_method > 0) + active = (control_for_lake_model_selection == clm_lake_model_control_selection_value .and. control_for_lake_model_execution_method > 0) [lake_h2osoi_vol3d] standard_name = volumetric_soil_water_in_clm_lake_model long_name = volumetric soil water in clm lake model @@ -2169,7 +2169,7 @@ dimensions = (horizontal_loop_extent,snow_plus_soil_minus_one_vertical_dimension_for_clm_lake_model) type = real kind = kind_phys - active = (control_for_lake_model_selection == 2 .and. control_for_lake_model_execution_method > 0) + active = (control_for_lake_model_selection == clm_lake_model_control_selection_value .and. control_for_lake_model_execution_method > 0) [lake_h2osoi_liq3d] standard_name = soil_liquid_water_content_in_clm_lake_model long_name = soil liquid water content in clm lake model @@ -2177,7 +2177,7 @@ dimensions = (horizontal_loop_extent,snow_plus_soil_minus_one_vertical_dimension_for_clm_lake_model) type = real kind = kind_phys - active = (control_for_lake_model_selection == 2 .and. control_for_lake_model_execution_method > 0) + active = (control_for_lake_model_selection == clm_lake_model_control_selection_value .and. control_for_lake_model_execution_method > 0) [lake_h2osoi_ice3d] standard_name = soil_ice_water_content_in_clm_lake_model long_name = soil ice water content in clm lake model @@ -2185,7 +2185,7 @@ dimensions = (horizontal_loop_extent,snow_plus_soil_minus_one_vertical_dimension_for_clm_lake_model) type = real kind = kind_phys - active = (control_for_lake_model_selection == 2 .and. control_for_lake_model_execution_method > 0) + active = (control_for_lake_model_selection == clm_lake_model_control_selection_value .and. control_for_lake_model_execution_method > 0) [lake_tsfc] standard_name = skin_temperature_from_lake_model long_name = skin temperature from lake model @@ -2193,7 +2193,7 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys - active = (control_for_lake_model_selection == 2 .and. control_for_lake_model_execution_method > 0) + active = (control_for_lake_model_selection == clm_lake_model_control_selection_value .and. control_for_lake_model_execution_method > 0) [lake_t_soisno3d] standard_name = soil_or_snow_layer_temperature_from_clm_lake_model long_name = soil or snow layer temperature from clm lake model @@ -2201,7 +2201,7 @@ dimensions = (horizontal_loop_extent,snow_plus_soil_minus_one_vertical_dimension_for_clm_lake_model) type = real kind = kind_phys - active = (control_for_lake_model_selection == 2 .and. control_for_lake_model_execution_method > 0) + active = (control_for_lake_model_selection == clm_lake_model_control_selection_value .and. control_for_lake_model_execution_method > 0) [lake_t_lake3d] standard_name = lake_layer_temperature_from_clm_lake_model long_name = lake layer temperature from clm lake model @@ -2209,7 +2209,7 @@ dimensions = (horizontal_loop_extent,lake_vertical_dimension_for_clm_lake_model) type = real kind = kind_phys - active = (control_for_lake_model_selection == 2 .and. control_for_lake_model_execution_method > 0) + active = (control_for_lake_model_selection == clm_lake_model_control_selection_value .and. control_for_lake_model_execution_method > 0) [lake_savedtke12d] standard_name = top_level_eddy_conductivity_from_previous_timestep_in_clm_lake_model long_name = top level eddy conductivity from previous timestep in clm lake model @@ -2217,7 +2217,7 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys - active = (control_for_lake_model_selection == 2 .and. control_for_lake_model_execution_method > 0) + active = (control_for_lake_model_selection == clm_lake_model_control_selection_value .and. control_for_lake_model_execution_method > 0) [lake_icefrac3d] standard_name = lake_fractional_ice_cover_on_clm_lake_levels long_name = lake fractional ice cover on clm lake levels @@ -2225,7 +2225,7 @@ dimensions = (horizontal_loop_extent,lake_vertical_dimension_for_clm_lake_model) type = real kind = kind_phys - active = (control_for_lake_model_selection == 2 .and. control_for_lake_model_execution_method > 0) + active = (control_for_lake_model_selection == clm_lake_model_control_selection_value .and. control_for_lake_model_execution_method > 0) [lake_ht] standard_name = test_lake_ht long_name = test_lake_ht @@ -2233,7 +2233,7 @@ units = unitless type = real kind = kind_phys - active = (control_for_lake_model_selection == 2 .and. control_for_lake_model_execution_method > 0) + active = (control_for_lake_model_selection == clm_lake_model_control_selection_value .and. control_for_lake_model_execution_method > 0) [clm_lake_initialized] standard_name = flag_for_clm_lake_initialization long_name = set to true in clm_lake_run after likeini is called for that gridpoint @@ -2241,21 +2241,21 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys - active = (control_for_lake_model_selection == 2 .and. control_for_lake_model_execution_method > 0) + active = (control_for_lake_model_selection == clm_lake_model_control_selection_value .and. control_for_lake_model_execution_method > 0) [lake_is_salty] standard_name = clm_lake_is_salty long_name = lake at this point is salty (1) or not (0) units = 1 dimensions = (horizontal_loop_extent) type = integer - active = (control_for_lake_model_selection == 2 .and. control_for_lake_model_execution_method > 0) + active = (control_for_lake_model_selection == clm_lake_model_control_selection_value .and. control_for_lake_model_execution_method > 0) [lake_cannot_freeze] standard_name = clm_lake_cannot_freeze long_name = lake at this point is so salty it cannot freeze units = 1 dimensions = (horizontal_loop_extent) type = integer - active = (control_for_lake_model_selection == 2 .and. control_for_lake_model_execution_method > 0) + active = (control_for_lake_model_selection == clm_lake_model_control_selection_value .and. control_for_lake_model_execution_method > 0) [emdust] standard_name = emission_of_dust_for_smoke long_name = emission of dust for smoke @@ -2589,7 +2589,7 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys - active = (flag_for_surface_flux_coupling .or. flag_for_air_quality_coupling) + active = (flag_for_surface_flux_coupling .or. (flag_for_air_quality_coupling .and. .not. flag_for_surface_flux_coupling)) [dqsfci_cpl] standard_name = surface_upward_latent_heat_flux_for_coupling long_name = instantaneous sfc latent heat flux @@ -2597,7 +2597,7 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys - active = (flag_for_surface_flux_coupling .or. flag_for_air_quality_coupling) + active = (flag_for_surface_flux_coupling .or. (flag_for_air_quality_coupling .and. .not. flag_for_surface_flux_coupling)) [dlwsfci_cpl] standard_name = surface_downwelling_longwave_flux_for_coupling long_name = instantaneous sfc downward lw flux @@ -2661,7 +2661,7 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys - active = (flag_for_surface_flux_coupling .or. flag_for_air_quality_coupling .or. flag_for_land_coupling) + active = (flag_for_surface_flux_coupling .or. flag_for_land_coupling .or. (flag_for_air_quality_coupling .and. .not. flag_for_surface_flux_coupling)) [nnirbmi_cpl] standard_name = surface_net_downwelling_direct_nir_shortwave_flux_for_coupling long_name = instantaneous net nir beam sfc downward sw flux @@ -2701,7 +2701,7 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys - active = (flag_for_surface_flux_coupling .or. flag_for_air_quality_coupling) + active = (flag_for_surface_flux_coupling .or. (flag_for_air_quality_coupling .and. .not. flag_for_surface_flux_coupling)) [q2mi_cpl] standard_name = specific_humidity_at_2m_for_coupling long_name = instantaneous Q2m @@ -2709,7 +2709,7 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys - active = (flag_for_surface_flux_coupling .or. flag_for_air_quality_coupling) + active = (flag_for_surface_flux_coupling .or. (flag_for_air_quality_coupling .and. .not. flag_for_surface_flux_coupling)) [u10mi_cpl] standard_name = x_wind_at_10m_for_coupling long_name = instantaneous U10m @@ -2717,7 +2717,7 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys - active = (flag_for_surface_flux_coupling .or. flag_for_ocean_wave_coupling) + active = (flag_for_surface_flux_coupling .or. flag_for_chemistry_coupling .or. flag_for_ocean_wave_coupling) [v10mi_cpl] standard_name = y_wind_at_10m_for_coupling long_name = instantaneous V10m @@ -2725,7 +2725,7 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys - active = (flag_for_surface_flux_coupling .or. flag_for_ocean_wave_coupling) + active = (flag_for_surface_flux_coupling .or. flag_for_chemistry_coupling .or. flag_for_ocean_wave_coupling) [tsfci_cpl] standard_name = surface_skin_temperature_for_coupling long_name = instantaneous sfc temperature @@ -2733,7 +2733,7 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys - active = (flag_for_surface_flux_coupling) + active = (flag_for_surface_flux_coupling .or. flag_for_chemistry_coupling .or. ) [psurfi_cpl] standard_name = surface_air_pressure_for_coupling long_name = instantaneous sfc pressure @@ -2741,7 +2741,7 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys - active = (flag_for_surface_flux_coupling .or. flag_for_air_quality_coupling .or. flag_for_land_coupling) + active = (flag_for_surface_flux_coupling .or. flag_for_land_coupling .or. (flag_for_air_quality_coupling .and. .not. flag_for_surface_flux_coupling)) [ulwsfcin_cpl] standard_name = surface_upwelling_longwave_flux_from_coupled_process long_name = surface upwelling LW flux for coupling @@ -2829,6 +2829,7 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys + active = (flag_for_surface_flux_coupling) [slimskin_cpl] standard_name = area_type_from_coupled_process long_name = sea/land/ice mask input (=0/1/2) @@ -2963,7 +2964,7 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys - active = (control_for_microphysics_scheme == identifier_for_thompson_microphysics_scheme .and. flag_for_aerosol_physics) + active = (control_for_microphysics_scheme == identifier_for_thompson_microphysics_scheme .and. (flag_for_aerosol_physics .or. do_merra2_aerosol_awareness)) [nifa2d] standard_name = tendency_of_nonhygroscopic_ice_nucleating_aerosols_at_surface_adjacent_layer long_name = instantaneous ice-friendly sfc aerosol source @@ -2971,7 +2972,7 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys - active = (control_for_microphysics_scheme == identifier_for_thompson_microphysics_scheme .and. flag_for_aerosol_physics) + active = (control_for_microphysics_scheme == identifier_for_thompson_microphysics_scheme .and. (flag_for_aerosol_physics .or. do_merra2_aerosol_awareness)) [ebu_smoke] standard_name = ebu_smoke long_name = buffer of vertical fire emission @@ -7912,7 +7913,7 @@ dimensions = (horizontal_loop_extent,vertical_layer_dimension) type = real kind = kind_phys - active = (control_for_deep_convection_scheme == identifier_for_grell_freitas_deep_convection .or. control_for_deep_convection_scheme == identifier_for_c3_deep_convection .or. control_for_deep_convection_scheme == identifier_for_new_tiedtke_deep_convection .or. control_for_deep_convection_scheme == identifer_for_scale_aware_mass_flux_deep_convection .or. control_for_shallow_convection_scheme == identifier_for_scale_aware_mass_flux_shallow_convection) + active = (control_for_deep_convection_scheme == identifier_for_grell_freitas_deep_convection .or. control_for_deep_convection_scheme == identifier_for_c3_deep_convection .or. control_for_deep_convection_scheme == identifier_for_new_tiedtke_deep_convection .or. control_for_deep_convection_scheme == identifer_for_scale_aware_mass_flux_deep_convection .or. control_for_shallow_convection_scheme == identifier_for_scale_aware_mass_flux_shallow_convection .or. control_for_shallow_convection_scheme == identifier_for_c3_shallow_convection) [cactiv] standard_name = counter_for_grell_freitas_convection long_name = convective activity memory @@ -9040,7 +9041,7 @@ dimensions = (horizontal_loop_extent,vertical_layer_dimension) type = real kind = kind_phys - active = (flag_for_tracer_diagnostics_3D) + active = (flag_for_diagnostics_3D .and. flag_for_tracer_diagnostics_3D) [dwn_mf] standard_name = cumulative_atmosphere_downdraft_convective_mass_flux long_name = cumulative downdraft mass flux @@ -9048,7 +9049,7 @@ dimensions = (horizontal_loop_extent,vertical_layer_dimension) type = real kind = kind_phys - active = (flag_for_tracer_diagnostics_3D) + active = (flag_for_diagnostics_3D .and. flag_for_tracer_diagnostics_3D) [det_mf] standard_name = cumulative_atmosphere_detrainment_convective_mass_flux long_name = cumulative detrainment mass flux @@ -9056,7 +9057,7 @@ dimensions = (horizontal_loop_extent,vertical_layer_dimension) type = real kind = kind_phys - active = (flag_for_tracer_diagnostics_3D) + active = (flag_for_diagnostics_3D .and. flag_for_tracer_diagnostics_3D) [do3_dt_prd] standard_name = ozone_tendency_due_to_production_and_loss_rate long_name = ozone tendency due to production and loss rate @@ -9064,7 +9065,7 @@ dimensions = (horizontal_loop_extent,vertical_layer_dimension) type = real kind = kind_phys - active = (flag_for_tracer_diagnostics_3D .and. flag_for_nrl_2015_ozone_scheme) + active = (flag_for_diagnostics_3D .and. flag_for_nrl_2015_ozone_scheme) [do3_dt_ozmx] standard_name = ozone_tendency_due_to_ozone_mixing_ratio long_name = ozone tendency due to ozone mixing ratio @@ -9072,7 +9073,7 @@ dimensions = (horizontal_loop_extent,vertical_layer_dimension) type = real kind = kind_phys - active = (flag_for_tracer_diagnostics_3D .and. flag_for_nrl_2015_ozone_scheme) + active = (flag_for_diagnostics_3D .and. flag_for_nrl_2015_ozone_scheme) [do3_dt_temp] standard_name = ozone_tendency_due_to_temperature long_name = ozone tendency due to temperature @@ -9080,7 +9081,7 @@ dimensions = (horizontal_loop_extent,vertical_layer_dimension) type = real kind = kind_phys - active = (flag_for_tracer_diagnostics_3D .and. flag_for_nrl_2015_ozone_scheme) + active = (flag_for_diagnostics_3D .and. flag_for_nrl_2015_ozone_scheme) [do3_dt_ohoz] standard_name = ozone_tendency_due_to_overhead_ozone_column long_name = ozone tendency due to overhead ozone column @@ -9088,7 +9089,7 @@ dimensions = (horizontal_loop_extent,vertical_layer_dimension) type = real kind = kind_phys - active = (flag_for_tracer_diagnostics_3D .and. flag_for_nrl_2015_ozone_scheme) + active = (flag_for_diagnostics_3D .and. flag_for_nrl_2015_ozone_scheme) [refl_10cm] standard_name = radar_reflectivity_10cm long_name = instantaneous refl_10cm @@ -9253,7 +9254,7 @@ dimensions = (horizontal_loop_extent,vertical_layer_dimension) type = real kind = kind_phys - active = (flag_for_mellor_yamada_nakanishi_niino_pbl_scheme .and. control_for_tke_budget_output == 1) + active = (flag_for_mellor_yamada_nakanishi_niino_pbl_scheme .and. control_for_tke_budget_output > 0) [qwt] standard_name = tke_tendency_due_to_vertical_transport long_name = tke tendency due to vertical transport and diffusion @@ -9261,7 +9262,7 @@ dimensions = (horizontal_loop_extent,vertical_layer_dimension) type = real kind = kind_phys - active = (flag_for_mellor_yamada_nakanishi_niino_pbl_scheme .and. control_for_tke_budget_output == 1) + active = (flag_for_mellor_yamada_nakanishi_niino_pbl_scheme .and. control_for_tke_budget_output > 0) [qshear] standard_name = tke_tendency_due_to_shear long_name = tke tendency due to shear @@ -9269,7 +9270,7 @@ dimensions = (horizontal_loop_extent,vertical_layer_dimension) type = real kind = kind_phys - active = (flag_for_mellor_yamada_nakanishi_niino_pbl_scheme .and. control_for_tke_budget_output == 1) + active = (flag_for_mellor_yamada_nakanishi_niino_pbl_scheme .and. control_for_tke_budget_output > 0) [qbuoy] standard_name = tke_tendency_due_to_buoyancy long_name = tke tendency due to buoyancy production or consumption @@ -9277,7 +9278,7 @@ dimensions = (horizontal_loop_extent,vertical_layer_dimension) type = real kind = kind_phys - active = (flag_for_mellor_yamada_nakanishi_niino_pbl_scheme .and. control_for_tke_budget_output == 1) + active = (flag_for_mellor_yamada_nakanishi_niino_pbl_scheme .and. control_for_tke_budget_output > 0) [qdiss] standard_name = tke_tendency_due_to_dissipation long_name = tke tendency due to the dissipation of tke @@ -9285,7 +9286,7 @@ dimensions = (horizontal_loop_extent,vertical_layer_dimension) type = real kind = kind_phys - active = (flag_for_mellor_yamada_nakanishi_niino_pbl_scheme .and. control_for_tke_budget_output == 1) + active = (flag_for_mellor_yamada_nakanishi_niino_pbl_scheme .and. control_for_tke_budget_output > 0) [maxwidth] standard_name = maximum_width_of_plumes long_name = maximum width of plumes per grid column @@ -9310,12 +9311,6 @@ type = real kind = kind_phys active = (flag_for_mellor_yamada_nakanishi_niino_pbl_scheme) -[ktop_shallow] - standard_name = k_level_of_highest_reaching_plume - long_name = k-level of highest reaching plume - units = count - dimensions = (horizontal_loop_extent) - type = integer [ktop_plume] standard_name = k_level_of_highest_plume long_name = k-level of highest plume @@ -9543,7 +9538,6 @@ dimensions = (horizontal_loop_extent,vertical_layer_dimension) type = real kind = kind_phys - active = (flag_for_ugwp_version_1 .or. flag_for_unified_gravity_wave_physics_diagnostics) [dvdt_ogw] standard_name = tendency_of_y_wind_due_to_mesoscale_orographic_gravity_wave_drag long_name = y wind tendency from meso scale ogw @@ -9767,6 +9761,7 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys + active = (flag_to_print_pgr_differences_every_timestep) [ltg1_max] standard_name = lightning_threat_index_1 long_name = lightning threat index 1 diff --git a/ccpp/framework b/ccpp/framework index 219f2e9c8..d83747953 160000 --- a/ccpp/framework +++ b/ccpp/framework @@ -1 +1 @@ -Subproject commit 219f2e9c88b7b774becac2bd1453696e105af1c4 +Subproject commit d837479537f69eb51d3499d95956f2cf972004ac From 4a92f5ddb9bdaec041b4ce3af700f67b43ed285d Mon Sep 17 00:00:00 2001 From: Grant Firl Date: Thu, 18 Jan 2024 11:44:33 -0500 Subject: [PATCH 2/9] fix metadata typo for tsfci_cpl --- ccpp/data/GFS_typedefs.meta | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ccpp/data/GFS_typedefs.meta b/ccpp/data/GFS_typedefs.meta index 7c0ec7932..01a80d7f6 100644 --- a/ccpp/data/GFS_typedefs.meta +++ b/ccpp/data/GFS_typedefs.meta @@ -2733,7 +2733,7 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys - active = (flag_for_surface_flux_coupling .or. flag_for_chemistry_coupling .or. ) + active = (flag_for_surface_flux_coupling .or. flag_for_chemistry_coupling .or. flag_for_land_coupling) [psurfi_cpl] standard_name = surface_air_pressure_for_coupling long_name = instantaneous sfc pressure From 84b5c4d90b7fab91d23f63c5a7fc8848a17fbb28 Mon Sep 17 00:00:00 2001 From: Grant Firl Date: Thu, 18 Jan 2024 12:20:28 -0500 Subject: [PATCH 3/9] remove unused GWD diagnostics from GFS_diagnostics.F90 --- ccpp/driver/GFS_diagnostics.F90 | 88 +-------------------------------- 1 file changed, 1 insertion(+), 87 deletions(-) diff --git a/ccpp/driver/GFS_diagnostics.F90 b/ccpp/driver/GFS_diagnostics.F90 index 3bbd300d5..9c1cd7da2 100644 --- a/ccpp/driver/GFS_diagnostics.F90 +++ b/ccpp/driver/GFS_diagnostics.F90 @@ -2818,10 +2818,7 @@ subroutine GFS_externaldiag_populate (ExtDiag, Model, Statein, Stateout, Sfcprop endif if (Model%ldiag_ugwp) THEN -! -! VAY-2018: Momentum and Temp-re tendencies -! du3dt_pbl dv3dt_pbl dT3dt_pbl -! + idx = idx + 1 ExtDiag(idx)%axes = 2 ExtDiag(idx)%name = 'zmtb' @@ -2899,67 +2896,6 @@ subroutine GFS_externaldiag_populate (ExtDiag, Model, Statein, Stateout, Sfcprop ExtDiag(idx)%data(nb)%var2 => IntDiag(nb)%tau_ngw(:) enddo - idx = idx + 1 - ExtDiag(idx)%axes = 3 - ExtDiag(idx)%name = 'du3dt_pbl_ugwp' - ExtDiag(idx)%desc = 'U-tendency due to PBL physics' - ExtDiag(idx)%unit = 'm/s/s' - ExtDiag(idx)%mod_name = 'gfs_phys' - allocate (ExtDiag(idx)%data(nblks)) - do nb = 1,nblks - ExtDiag(idx)%data(nb)%var3 => IntDiag(nb)%du3dt_pbl(:,:) - enddo -! -! dv3dt_pbl - idx = idx + 1 - ExtDiag(idx)%axes = 3 - ExtDiag(idx)%name = 'dv3dt_pbl_ugwp' - ExtDiag(idx)%desc = 'V-tendency due to PBL physics' - ExtDiag(idx)%unit = 'm/s/s' - ExtDiag(idx)%mod_name = 'gfs_phys' - allocate (ExtDiag(idx)%data(nblks)) - do nb = 1,nblks - ExtDiag(idx)%data(nb)%var3 => IntDiag(nb)%dv3dt_pbl(:,:) - enddo -! -! dt3dt_pbl - idx = idx + 1 - ExtDiag(idx)%axes = 3 - ExtDiag(idx)%name = 'dt3dt_pbl_ugwp' - ExtDiag(idx)%desc = 'T-tendency due to PBL physics' - ExtDiag(idx)%unit = 'K/s' - ExtDiag(idx)%mod_name = 'gfs_phys' - allocate (ExtDiag(idx)%data(nblks)) - do nb = 1,nblks - ExtDiag(idx)%data(nb)%var3 => IntDiag(nb)%dt3dt_pbl(:,:) - enddo -! -! uav_ugwp -! - idx = idx + 1 - ExtDiag(idx)%axes = 3 - ExtDiag(idx)%name = 'uav_ugwp' - ExtDiag(idx)%desc = 'U-daily mean for UGWP' - ExtDiag(idx)%unit = 'm/s' - ExtDiag(idx)%mod_name = 'gfs_phys' - allocate (ExtDiag(idx)%data(nblks)) - do nb = 1,nblks - ExtDiag(idx)%data(nb)%var3 => IntDiag(nb)%uav_ugwp(:,:) - enddo -! -! tav_ugwp -! - idx = idx + 1 - ExtDiag(idx)%axes = 3 - ExtDiag(idx)%name = 'tav_ugwp' - ExtDiag(idx)%desc = 'T-daily mean for UGWP' - ExtDiag(idx)%unit = 'K' - ExtDiag(idx)%mod_name = 'gfs_phys' - allocate (ExtDiag(idx)%data(nblks)) - do nb = 1,nblks - ExtDiag(idx)%data(nb)%var3 => IntDiag(nb)%tav_ugwp(:,:) - enddo - idx = idx + 1 ExtDiag(idx)%axes = 3 ExtDiag(idx)%name = 'du3dt_ogw' @@ -3005,28 +2941,6 @@ subroutine GFS_externaldiag_populate (ExtDiag, Model, Statein, Stateout, Sfcprop ExtDiag(idx)%data(nb)%var3 => IntDiag(nb)%du3dt_tms(:,:) enddo - idx = idx + 1 - ExtDiag(idx)%axes = 3 - ExtDiag(idx)%name = 'dudt_tot' - ExtDiag(idx)%desc = ' dudt_tot averaged E-W dycore-tendency' - ExtDiag(idx)%unit = 'm/s/s' - ExtDiag(idx)%mod_name = 'gfs_phys' - allocate (ExtDiag(idx)%data(nblks)) - do nb = 1,nblks - ExtDiag(idx)%data(nb)%var3 => IntDiag(nb)%dudt_tot(:,:) - enddo - - idx = idx + 1 - ExtDiag(idx)%axes = 3 - ExtDiag(idx)%name = 'dtdt_tot' - ExtDiag(idx)%desc = ' dtdt_tot averaged Temp dycore-tendency' - ExtDiag(idx)%unit = 'Ks' - ExtDiag(idx)%mod_name = 'gfs_phys' - allocate (ExtDiag(idx)%data(nblks)) - do nb = 1,nblks - ExtDiag(idx)%data(nb)%var3 => IntDiag(nb)%dtdt_tot(:,:) - enddo - idx = idx + 1 ExtDiag(idx)%axes = 3 ExtDiag(idx)%name = 'dudt_ogw' From 0ce8bcae2400523a6efc3da5b54cbf6d934acab5 Mon Sep 17 00:00:00 2001 From: Grant Firl Date: Thu, 18 Jan 2024 14:32:09 -0500 Subject: [PATCH 4/9] add some more zero allocations to the control DDT that were missed --- ccpp/data/GFS_typedefs.F90 | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/ccpp/data/GFS_typedefs.F90 b/ccpp/data/GFS_typedefs.F90 index 286697559..04412244d 100644 --- a/ccpp/data/GFS_typedefs.F90 +++ b/ccpp/data/GFS_typedefs.F90 @@ -4488,10 +4488,14 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & if (Model%naux2d>0) then allocate(Model%aux2d_time_avg(1:naux2d)) Model%aux2d_time_avg(1:naux2d) = aux2d_time_avg(1:naux2d) + else + allocate(Model%aux2d_time_avg(0)) end if if (Model%naux3d>0) then allocate(Model%aux3d_time_avg(1:naux3d)) Model%aux3d_time_avg(1:naux3d) = aux3d_time_avg(1:naux3d) + else + allocate(Model%aux3d_time_avg(0)) end if ! Model%fhcyc = fhcyc @@ -4719,6 +4723,8 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & do ipat=1,Model%nGases Model%active_gases_array(ipat) = '' enddo + else + allocate (Model%active_gases_array(0)) endif Model%rrtmgp_root = rrtmgp_root Model%lw_file_gas = lw_file_gas @@ -5267,6 +5273,9 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & allocate(Model%lndp_prt_list(Model%n_var_lndp)) Model%lndp_var_list(:) = '' Model%lndp_prt_list(:) = clear_val + else + allocate(Model%lndp_var_list(0)) + allocate(Model%lndp_prt_list(0)) end if if (Model%do_spp) then @@ -5276,6 +5285,10 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & Model%spp_var_list(:) = '' Model%spp_prt_list(:) = clear_val Model%spp_stddev_cutoff(:) = clear_val + else + allocate(Model%spp_var_list(0)) + allocate(Model%spp_prt_list(0)) + allocate(Model%spp_stddev_cutoff(0)) end if !--- cellular automata options @@ -5473,8 +5486,6 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & .and. Model%flag_for_dcnv_generic_tend ! Increment idtend and fill dtidx: - allocate(Model%dtend_var_labels(Model%ntracp100)) - allocate(Model%dtend_process_labels(Model%nprocess)) call allocate_dtend_labels_and_causes(Model) @@ -5660,6 +5671,9 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & endif enddo endif + else + allocate(Model%dtend_var_labels(0)) + allocate(Model%dtend_process_labels(0)) end if IF ( Model%imp_physics == Model%imp_physics_nssl2mccn ) THEN ! recognize this option for compatibility From 4dd5b363f8e1bc9df34c42b4c1768b98b2d22837 Mon Sep 17 00:00:00 2001 From: Grant Firl Date: Thu, 18 Jan 2024 21:51:16 +0000 Subject: [PATCH 5/9] update ccpp/physics submodule pointer and .gitmodules --- .gitmodules | 12 ++++++------ ccpp/physics | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.gitmodules b/.gitmodules index 51792af1e..443f0ebcb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,7 @@ [submodule "atmos_cubed_sphere"] path = atmos_cubed_sphere - #url = https://github.com/NOAA-GFDL/GFDL_atmos_cubed_sphere - #branch = dev/emc - url = https://github.com/NOAA-EMC/GFDL_atmos_cubed_sphere - branch = production/AQM.v7 + url = https://github.com/NOAA-GFDL/GFDL_atmos_cubed_sphere + branch = dev/emc [submodule "ccpp/framework"] path = ccpp/framework #url = https://github.com/NCAR/ccpp-framework @@ -12,8 +10,10 @@ branch = feature/dummy_allocate_inactive [submodule "ccpp/physics"] path = ccpp/physics - url = https://github.com/ufs-community/ccpp-physics - branch = ufs/dev + #url = https://github.com/ufs-community/ccpp-physics + #branch = ufs/dev + url = https://github.com/grantfirl/ccpp-physics + branch = feature/fix_check_all_zero_alloc [submodule "upp"] path = upp url = https://github.com/NOAA-EMC/UPP diff --git a/ccpp/physics b/ccpp/physics index a492addf8..415f71a98 160000 --- a/ccpp/physics +++ b/ccpp/physics @@ -1 +1 @@ -Subproject commit a492addf860d29d797bca488f53d39b260584924 +Subproject commit 415f71a98ba91f604ff1c063f443c67959acbd48 From 8e16345f0c36ffb31a55dff249edef6c1905b961 Mon Sep 17 00:00:00 2001 From: Grant Firl Date: Thu, 18 Jan 2024 20:05:33 -0500 Subject: [PATCH 6/9] change associated to size for a couple variables in GFS_diagnostics and add one small change to atmos_cubed_sphere --- .gitmodules | 6 ++++-- atmos_cubed_sphere | 2 +- ccpp/driver/GFS_diagnostics.F90 | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.gitmodules b/.gitmodules index 443f0ebcb..979e8770d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,7 +1,9 @@ [submodule "atmos_cubed_sphere"] path = atmos_cubed_sphere - url = https://github.com/NOAA-GFDL/GFDL_atmos_cubed_sphere - branch = dev/emc + #url = https://github.com/NOAA-GFDL/GFDL_atmos_cubed_sphere + #branch = dev/emc + url = https://github.com/grantfirl/GFDL_atmos_cubed_sphere + branch = feature/fix_check_all_zero_alloc [submodule "ccpp/framework"] path = ccpp/framework #url = https://github.com/NCAR/ccpp-framework diff --git a/atmos_cubed_sphere b/atmos_cubed_sphere index eeb4a714d..f21145ae6 160000 --- a/atmos_cubed_sphere +++ b/atmos_cubed_sphere @@ -1 +1 @@ -Subproject commit eeb4a714d946f554da6b16800da436e1ce66a092 +Subproject commit f21145ae68dce2284139f8849a00d978dfc8e643 diff --git a/ccpp/driver/GFS_diagnostics.F90 b/ccpp/driver/GFS_diagnostics.F90 index 9c1cd7da2..5e90eb700 100644 --- a/ccpp/driver/GFS_diagnostics.F90 +++ b/ccpp/driver/GFS_diagnostics.F90 @@ -931,7 +931,7 @@ subroutine GFS_externaldiag_populate (ExtDiag, Model, Statein, Stateout, Sfcprop !--- air quality diagnostics --- if (Model%cplaqm) then - if (associated(IntDiag(1)%aod)) then + if (size(IntDiag(1)%aod) > 0) then idx = idx + 1 ExtDiag(idx)%axes = 2 ExtDiag(idx)%name = 'aod' @@ -1887,7 +1887,7 @@ subroutine GFS_externaldiag_populate (ExtDiag, Model, Statein, Stateout, Sfcprop enddo endif - if(associated(Coupling(1)%htrlw)) then + if(size(Coupling(1)%htrlw) > 0) then idx = idx + 1 ExtDiag(idx)%axes = 3 ExtDiag(idx)%name = 'htrlw' From 70dc9937d496e6ae1d1324877571aae76bdef59f Mon Sep 17 00:00:00 2001 From: Grant Firl Date: Fri, 19 Jan 2024 10:28:53 -0500 Subject: [PATCH 7/9] allocate variables to zero size in stochastic_physics_wrapper.F90 --- .../stochastic_physics_wrapper.F90 | 204 +++++++++++++----- 1 file changed, 155 insertions(+), 49 deletions(-) diff --git a/stochastic_physics/stochastic_physics_wrapper.F90 b/stochastic_physics/stochastic_physics_wrapper.F90 index b76c52a39..0730de520 100644 --- a/stochastic_physics/stochastic_physics_wrapper.F90 +++ b/stochastic_physics/stochastic_physics_wrapper.F90 @@ -116,16 +116,26 @@ subroutine stochastic_physics_wrapper (GFS_Control, GFS_Data, Atm_block, ierr) write(6,*) 'call to init_stochastic_physics failed' return endif + else + allocate(xlat(0,0)) + allocate(xlon(0,0)) end if if (GFS_Control%do_sppt) then allocate(sppt_wts(1:nblks,maxblk,1:levs)) + else + allocate(sppt_wts(0,0,0)) end if if (GFS_Control%do_shum) then allocate(shum_wts(1:nblks,maxblk,1:levs)) + else + allocate(shum_wts(0,0,0)) end if if (GFS_Control%do_skeb) then allocate(skebu_wts(1:nblks,maxblk,1:levs)) allocate(skebv_wts(1:nblks,maxblk,1:levs)) + else + allocate(skebu_wts(0,0,0)) + allocate(skebv_wts(0,0,0)) end if if ( GFS_Control%do_spp ) then allocate(spp_wts(1:nblks,maxblk,1:levs,1:GFS_Control%n_var_spp)) @@ -145,6 +155,8 @@ subroutine stochastic_physics_wrapper (GFS_Control, GFS_Data, Atm_block, ierr) GFS_Control%spp_cu_deep = 1 end select end do + else + allocate(spp_wts(0,0,0,0)) end if if ( GFS_Control%lndp_type == 2 ) then allocate(sfc_wts(1:nblks,maxblk,1:GFS_Control%n_var_lndp)) @@ -159,21 +171,95 @@ subroutine stochastic_physics_wrapper (GFS_Control, GFS_Data, Atm_block, ierr) case('smc') allocate(slc (1:nblks, maxblk, lsoil)) allocate(stype (1:nblks, maxblk)) + + allocate(stc (0,0,0)) + allocate(vfrac (0,0)) + allocate(alnsf (0,0)) + allocate(alnwf (0,0)) + allocate(snoalb(0,0)) + allocate(semis (0,0)) + allocate(zorll (0,0)) case('stc') allocate(stc (1:nblks, maxblk, lsoil)) + + allocate(slc (0,0,0)) + allocate(stype (0,0)) + allocate(vfrac (0,0)) + allocate(alnsf (0,0)) + allocate(alnwf (0,0)) + allocate(snoalb(0,0)) + allocate(semis (0,0)) + allocate(zorll (0,0)) case('vgf') allocate(vfrac (1:nblks, maxblk)) + + allocate(slc (0,0,0)) + allocate(stype (0,0)) + allocate(stc (0,0,0)) + allocate(alnsf (0,0)) + allocate(alnwf (0,0)) + allocate(snoalb(0,0)) + allocate(semis (0,0)) + allocate(zorll (0,0)) case('alb') allocate(alnsf (1:nblks, maxblk)) allocate(alnwf (1:nblks, maxblk)) + + allocate(slc (0,0,0)) + allocate(stype (0,0)) + allocate(stc (0,0,0)) + allocate(vfrac (0,0)) + allocate(snoalb(0,0)) + allocate(semis (0,0)) + allocate(zorll (0,0)) case('sal') allocate(snoalb(1:nblks, maxblk)) + + allocate(slc (0,0,0)) + allocate(stype (0,0)) + allocate(stc (0,0,0)) + allocate(vfrac (0,0)) + allocate(alnsf (0,0)) + allocate(alnwf (0,0)) + allocate(semis (0,0)) + allocate(zorll (0,0)) case('emi') allocate(semis (1:nblks, maxblk)) + + allocate(slc (0,0,0)) + allocate(stype (0,0)) + allocate(stc (0,0,0)) + allocate(vfrac (0,0)) + allocate(alnsf (0,0)) + allocate(alnwf (0,0)) + allocate(snoalb(0,0)) + allocate(zorll (0,0)) case('zol') allocate(zorll (1:nblks, maxblk)) + + allocate(slc (0,0,0)) + allocate(stype (0,0)) + allocate(stc (0,0,0)) + allocate(vfrac (0,0)) + allocate(alnsf (0,0)) + allocate(alnwf (0,0)) + allocate(snoalb(0,0)) + allocate(semis (0,0)) endselect enddo + else + allocate(sfc_wts(0,0,0)) + allocate(smc (0,0,0)) + + allocate(slc (0,0,0)) + allocate(stype (0,0)) + allocate(stc (0,0,0)) + allocate(vfrac (0,0)) + allocate(alnsf (0,0)) + allocate(alnwf (0,0)) + allocate(snoalb(0,0)) + allocate(semis (0,0)) + allocate(zorll (0,0)) endif @@ -188,6 +274,8 @@ subroutine stochastic_physics_wrapper (GFS_Control, GFS_Data, Atm_block, ierr) GFS_Data(nb)%Coupling%sfc_wts(:,:) = sfc_wts(nb,1:GFS_Control%blksz(nb),:) end do deallocate(sfc_wts) + else + allocate(sfc_wts(0,0,0)) end if ! Consistency check for cellular automata if(GFS_Control%do_ca)then @@ -203,13 +291,45 @@ subroutine stochastic_physics_wrapper (GFS_Control, GFS_Data, Atm_block, ierr) allocate(ca_deep_cpl (1:nblks, maxblk)) allocate(ca_turb_cpl (1:nblks, maxblk)) allocate(ca_shal_cpl (1:nblks, maxblk)) + else + allocate(sst (0,0)) + allocate(lmsk (0,0)) + allocate(lake (0,0)) + allocate(uwind (0,0,0)) + allocate(vwind (0,0,0)) + allocate(height (0,0,0)) + allocate(condition (0,0)) + allocate(dx (0,0)) + allocate(ca_deep_cpl (0,0)) + allocate(ca_turb_cpl (0,0)) + allocate(ca_shal_cpl (0,0)) endif if(GFS_Control%ca_global)then ! Allocate contiguous arrays; no need to copy in (intent out) allocate(ca1_cpl (1:nblks, maxblk)) allocate(ca2_cpl (1:nblks, maxblk)) allocate(ca3_cpl (1:nblks, maxblk)) + else + allocate(ca1_cpl (0,0)) + allocate(ca2_cpl (0,0)) + allocate(ca3_cpl (0,0)) endif + else + allocate(sst (0,0)) + allocate(lmsk (0,0)) + allocate(lake (0,0)) + allocate(uwind (0,0,0)) + allocate(vwind (0,0,0)) + allocate(height (0,0,0)) + allocate(condition (0,0)) + allocate(dx (0,0)) + allocate(ca_deep_cpl (0,0)) + allocate(ca_turb_cpl (0,0)) + allocate(ca_shal_cpl (0,0)) + + allocate(ca1_cpl (0,0)) + allocate(ca2_cpl (0,0)) + allocate(ca3_cpl (0,0)) endif is_initialized = .true. @@ -440,60 +560,46 @@ subroutine stochastic_physics_wrapper_end (GFS_Control) type(GFS_control_type), intent(inout) :: GFS_Control + if (allocated(xlat)) deallocate(xlat) + if (allocated(xlon)) deallocate(xlon) + if (allocated(sppt_wts)) deallocate(sppt_wts) + if (allocated(shum_wts)) deallocate(shum_wts) + if (allocated(skebu_wts)) deallocate(skebu_wts) + if (allocated(skebv_wts)) deallocate(skebv_wts) + if (allocated(spp_wts)) deallocate(spp_wts) + if (allocated(sfc_wts)) deallocate(sfc_wts) + if (allocated(smc)) deallocate(smc) + if (allocated(slc)) deallocate(slc) + if (allocated(stc)) deallocate(stc) + if (allocated(stype)) deallocate(stype) + if (allocated(vfrac)) deallocate(vfrac) + if (allocated(snoalb)) deallocate(snoalb) + if (allocated(alnsf)) deallocate(alnsf) + if (allocated(alnwf)) deallocate(alnwf) + if (allocated(semis)) deallocate(semis) + if (allocated(zorll)) deallocate(zorll) + if (allocated(sst)) deallocate(sst ) + if (allocated(lmsk)) deallocate(lmsk ) + if (allocated(lake)) deallocate(lake ) + if (allocated(uwind)) deallocate(uwind ) + if (allocated(vwind)) deallocate(vwind ) + if (allocated(height)) deallocate(height ) + if (allocated(dx)) deallocate(dx ) + if (allocated(condition)) deallocate(condition ) + if (allocated(ca_deep_cpl)) deallocate(ca_deep_cpl ) + if (allocated(ca_turb_cpl)) deallocate(ca_turb_cpl ) + if (allocated(ca_shal_cpl)) deallocate(ca_shal_cpl ) + if (allocated(ca1_cpl)) deallocate(ca1_cpl ) + if (allocated(ca2_cpl)) deallocate(ca2_cpl ) + if (allocated(ca3_cpl)) deallocate(ca3_cpl ) + if (GFS_Control%do_sppt .OR. GFS_Control%do_shum .OR. GFS_Control%do_skeb .OR. (GFS_Control%lndp_type > 0) .OR. GFS_Control%do_spp) then - if (allocated(xlat)) deallocate(xlat) - if (allocated(xlon)) deallocate(xlon) - if (GFS_Control%do_sppt) then - if (allocated(sppt_wts)) deallocate(sppt_wts) - end if - if (GFS_Control%do_shum) then - if (allocated(shum_wts)) deallocate(shum_wts) - end if - if (GFS_Control%do_skeb) then - if (allocated(skebu_wts)) deallocate(skebu_wts) - if (allocated(skebv_wts)) deallocate(skebv_wts) - end if - if (GFS_Control%do_spp) then - if (allocated(spp_wts)) deallocate(spp_wts) - end if if ( GFS_Control%lndp_type == 2 ) then lsoil = -999 - if (allocated(sfc_wts)) deallocate(sfc_wts) end if - if (GFS_Control%lndp_type == 2) then - if (allocated(smc)) deallocate(smc) - if (allocated(slc)) deallocate(slc) - if (allocated(stc)) deallocate(stc) - if (allocated(stype)) deallocate(stype) - if (allocated(vfrac)) deallocate(vfrac) - if (allocated(snoalb)) deallocate(snoalb) - if (allocated(alnsf)) deallocate(alnsf) - if (allocated(alnwf)) deallocate(alnwf) - if (allocated(semis)) deallocate(semis) - if (allocated(zorll)) deallocate(zorll) - endif call finalize_stochastic_physics() - endif - if(GFS_Control%do_ca)then - if(GFS_Control%ca_sgs)then - deallocate(sst ) - deallocate(lmsk ) - deallocate(lake ) - deallocate(uwind ) - deallocate(vwind ) - deallocate(height ) - deallocate(dx ) - deallocate(condition ) - deallocate(ca_deep_cpl ) - deallocate(ca_turb_cpl ) - deallocate(ca_shal_cpl ) - endif - if(GFS_Control%ca_global)then - deallocate(ca1_cpl ) - deallocate(ca2_cpl ) - deallocate(ca3_cpl ) - endif - endif + endif + end subroutine stochastic_physics_wrapper_end end module stochastic_physics_wrapper_mod From 1ef7f721f64f7f444a8a3b2d9f6610d97ac1d337 Mon Sep 17 00:00:00 2001 From: Grant Firl Date: Fri, 19 Jan 2024 11:18:32 -0500 Subject: [PATCH 8/9] fix double allocation problem in stochastic_physics_wrapper.F90 --- .../stochastic_physics_wrapper.F90 | 41 +++++++++++-------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/stochastic_physics/stochastic_physics_wrapper.F90 b/stochastic_physics/stochastic_physics_wrapper.F90 index 0730de520..5604c944c 100644 --- a/stochastic_physics/stochastic_physics_wrapper.F90 +++ b/stochastic_physics/stochastic_physics_wrapper.F90 @@ -158,6 +158,7 @@ subroutine stochastic_physics_wrapper (GFS_Control, GFS_Data, Atm_block, ierr) else allocate(spp_wts(0,0,0,0)) end if + if ( GFS_Control%lndp_type == 2 ) then allocate(sfc_wts(1:nblks,maxblk,1:GFS_Control%n_var_lndp)) if ( (GFS_Control%lsm == GFS_Control%lsm_noah) .or. (GFS_Control%lsm == GFS_Control%lsm_noahmp)) then @@ -247,6 +248,29 @@ subroutine stochastic_physics_wrapper (GFS_Control, GFS_Data, Atm_block, ierr) allocate(semis (0,0)) endselect enddo + elseif ( GFS_Control%lndp_type == 1 ) then ! this scheme sets perts once + allocate(sfc_wts(1:nblks, maxblk, GFS_Control%n_var_lndp)) + call run_stochastic_physics(levs, GFS_Control%kdt, GFS_Control%fhour, GFS_Control%blksz, & + sppt_wts=sppt_wts, shum_wts=shum_wts, skebu_wts=skebu_wts, & + skebv_wts=skebv_wts, sfc_wts=sfc_wts, & + spp_wts=spp_wts, nthreads=nthreads) + ! Copy contiguous data back + do nb=1,nblks + GFS_Data(nb)%Coupling%sfc_wts(:,:) = sfc_wts(nb,1:GFS_Control%blksz(nb),:) + end do + !deallocate(sfc_wts) + + allocate(smc (0,0,0)) + + allocate(slc (0,0,0)) + allocate(stype (0,0)) + allocate(stc (0,0,0)) + allocate(vfrac (0,0)) + allocate(alnsf (0,0)) + allocate(alnwf (0,0)) + allocate(snoalb(0,0)) + allocate(semis (0,0)) + allocate(zorll (0,0)) else allocate(sfc_wts(0,0,0)) allocate(smc (0,0,0)) @@ -261,22 +285,7 @@ subroutine stochastic_physics_wrapper (GFS_Control, GFS_Data, Atm_block, ierr) allocate(semis (0,0)) allocate(zorll (0,0)) endif - - - if ( GFS_Control%lndp_type == 1 ) then ! this scheme sets perts once - allocate(sfc_wts(1:nblks, maxblk, GFS_Control%n_var_lndp)) - call run_stochastic_physics(levs, GFS_Control%kdt, GFS_Control%fhour, GFS_Control%blksz, & - sppt_wts=sppt_wts, shum_wts=shum_wts, skebu_wts=skebu_wts, & - skebv_wts=skebv_wts, sfc_wts=sfc_wts, & - spp_wts=spp_wts, nthreads=nthreads) - ! Copy contiguous data back - do nb=1,nblks - GFS_Data(nb)%Coupling%sfc_wts(:,:) = sfc_wts(nb,1:GFS_Control%blksz(nb),:) - end do - deallocate(sfc_wts) - else - allocate(sfc_wts(0,0,0)) - end if + ! Consistency check for cellular automata if(GFS_Control%do_ca)then if(GFS_Control%ca_sgs)then From 60eaf6f356f4e8d45e0e411349df2bad7a22f33f Mon Sep 17 00:00:00 2001 From: Grant Firl Date: Fri, 19 Jan 2024 13:23:57 -0500 Subject: [PATCH 9/9] fix another double allocation error --- .../stochastic_physics_wrapper.F90 | 72 +++---------------- 1 file changed, 10 insertions(+), 62 deletions(-) diff --git a/stochastic_physics/stochastic_physics_wrapper.F90 b/stochastic_physics/stochastic_physics_wrapper.F90 index 5604c944c..ff1e5d567 100644 --- a/stochastic_physics/stochastic_physics_wrapper.F90 +++ b/stochastic_physics/stochastic_physics_wrapper.F90 @@ -172,82 +172,30 @@ subroutine stochastic_physics_wrapper (GFS_Control, GFS_Data, Atm_block, ierr) case('smc') allocate(slc (1:nblks, maxblk, lsoil)) allocate(stype (1:nblks, maxblk)) - - allocate(stc (0,0,0)) - allocate(vfrac (0,0)) - allocate(alnsf (0,0)) - allocate(alnwf (0,0)) - allocate(snoalb(0,0)) - allocate(semis (0,0)) - allocate(zorll (0,0)) case('stc') allocate(stc (1:nblks, maxblk, lsoil)) - - allocate(slc (0,0,0)) - allocate(stype (0,0)) - allocate(vfrac (0,0)) - allocate(alnsf (0,0)) - allocate(alnwf (0,0)) - allocate(snoalb(0,0)) - allocate(semis (0,0)) - allocate(zorll (0,0)) case('vgf') allocate(vfrac (1:nblks, maxblk)) - - allocate(slc (0,0,0)) - allocate(stype (0,0)) - allocate(stc (0,0,0)) - allocate(alnsf (0,0)) - allocate(alnwf (0,0)) - allocate(snoalb(0,0)) - allocate(semis (0,0)) - allocate(zorll (0,0)) case('alb') allocate(alnsf (1:nblks, maxblk)) allocate(alnwf (1:nblks, maxblk)) - - allocate(slc (0,0,0)) - allocate(stype (0,0)) - allocate(stc (0,0,0)) - allocate(vfrac (0,0)) - allocate(snoalb(0,0)) - allocate(semis (0,0)) - allocate(zorll (0,0)) case('sal') allocate(snoalb(1:nblks, maxblk)) - - allocate(slc (0,0,0)) - allocate(stype (0,0)) - allocate(stc (0,0,0)) - allocate(vfrac (0,0)) - allocate(alnsf (0,0)) - allocate(alnwf (0,0)) - allocate(semis (0,0)) - allocate(zorll (0,0)) case('emi') allocate(semis (1:nblks, maxblk)) - - allocate(slc (0,0,0)) - allocate(stype (0,0)) - allocate(stc (0,0,0)) - allocate(vfrac (0,0)) - allocate(alnsf (0,0)) - allocate(alnwf (0,0)) - allocate(snoalb(0,0)) - allocate(zorll (0,0)) case('zol') allocate(zorll (1:nblks, maxblk)) - - allocate(slc (0,0,0)) - allocate(stype (0,0)) - allocate(stc (0,0,0)) - allocate(vfrac (0,0)) - allocate(alnsf (0,0)) - allocate(alnwf (0,0)) - allocate(snoalb(0,0)) - allocate(semis (0,0)) endselect - enddo + enddo + if (.not. allocated(slc)) allocate(slc (0,0,0)) + if (.not. allocated(stype)) allocate(stype (0,0)) + if (.not. allocated(stc)) allocate(stc (0,0,0)) + if (.not. allocated(vfrac)) allocate(vfrac (0,0)) + if (.not. allocated(alnsf)) allocate(alnsf (0,0)) + if (.not. allocated(alnwf)) allocate(alnwf (0,0)) + if (.not. allocated(snoalb)) allocate(snoalb(0,0)) + if (.not. allocated(semis)) allocate(semis (0,0)) + if (.not. allocated(zorll)) allocate(zorll (0,0)) elseif ( GFS_Control%lndp_type == 1 ) then ! this scheme sets perts once allocate(sfc_wts(1:nblks, maxblk, GFS_Control%n_var_lndp)) call run_stochastic_physics(levs, GFS_Control%kdt, GFS_Control%fhour, GFS_Control%blksz, &