From cc08f0a1050e3c641f2a005b7254e74bd35a289d Mon Sep 17 00:00:00 2001 From: Grant Firl Date: Fri, 11 Mar 2022 15:46:31 -0700 Subject: [PATCH] update GFS_typedefs for SPP PR (latest main) --- scm/src/GFS_typedefs.F90 | 80 ++++++++++++++++++++++++++----- scm/src/GFS_typedefs.meta | 99 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 165 insertions(+), 14 deletions(-) diff --git a/scm/src/GFS_typedefs.F90 b/scm/src/GFS_typedefs.F90 index e9aca5e58..bcb504773 100644 --- a/scm/src/GFS_typedefs.F90 +++ b/scm/src/GFS_typedefs.F90 @@ -14,8 +14,8 @@ module GFS_typedefs implicit none - ! To ensure that these values match what's in the physics, - ! array sizes are compared during model init in GFS_rrtmg_setup_init() + ! To ensure that these values match what's in the physics, array + ! sizes are compared in the auto-generated physics caps in debug mode private :: NF_AESW, NF_AELW, NSPC, NSPC1, NF_CLDS, NF_VGAS, NF_ALBD, ntrcaerm ! from module_radiation_aerosols integer, parameter :: NF_AESW = 3 @@ -534,6 +534,11 @@ module GFS_typedefs real (kind=kind_phys), pointer :: skebu_wts (:,:) => null() ! real (kind=kind_phys), pointer :: skebv_wts (:,:) => null() ! real (kind=kind_phys), pointer :: sfc_wts (:,:) => null() ! mg, sfc-perts + real (kind=kind_phys), pointer :: spp_wts_pbl (:,:) => null() ! spp-pbl-perts + real (kind=kind_phys), pointer :: spp_wts_sfc (:,:) => null() ! spp-sfc-perts + real (kind=kind_phys), pointer :: spp_wts_mp (:,:) => null() ! spp-mp-perts + real (kind=kind_phys), pointer :: spp_wts_gwd (:,:) => null() ! spp-gwd-perts + real (kind=kind_phys), pointer :: spp_wts_rad (:,:) => null() ! spp-rad-perts !--- aerosol surface emissions for Thompson microphysics real (kind=kind_phys), pointer :: nwfa2d (:) => null() !< instantaneous water-friendly sfc aerosol source @@ -1178,6 +1183,16 @@ module GFS_typedefs ! multiple patterns. It wasn't fully coded (and wouldn't have worked ! with nlndp>1, so I just dropped it). If we want to code it properly, ! we'd need to make this dim(6,5). + logical :: do_spp ! Overall flag to turn on SPP or not + integer :: spp_pbl + integer :: spp_sfc + integer :: spp_mp + integer :: spp_rad + integer :: spp_gwd + integer :: n_var_spp + character(len=3) , pointer :: spp_var_list(:) ! dimension here must match n_var_spp in stochy_nml_def + real(kind=kind_phys), pointer :: spp_prt_list(:) ! dimension here must match n_var_spp in stochy_nml_def + !--- tracer handling character(len=32), pointer :: tracer_names(:) !< array of initialized tracers from dynamic core integer :: ntrac !< number of tracers @@ -2981,12 +2996,26 @@ subroutine coupling_create (Coupling, IM, Model) Coupling%skebu_wts = clear_val Coupling%skebv_wts = clear_val 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 endif + + !--- stochastic spp perturbation option + if (Model%do_spp) then + allocate (Coupling%spp_wts_pbl (IM,Model%levs)) + Coupling%spp_wts_pbl = clear_val + allocate (Coupling%spp_wts_sfc (IM,Model%levs)) + Coupling%spp_wts_sfc = clear_val + allocate (Coupling%spp_wts_mp (IM,Model%levs)) + Coupling%spp_wts_mp = clear_val + allocate (Coupling%spp_wts_gwd (IM,Model%levs)) + Coupling%spp_wts_gwd = clear_val + allocate (Coupling%spp_wts_rad (IM,Model%levs)) + Coupling%spp_wts_rad = clear_val + endif !--- needed for Thompson's aerosol option if(Model%imp_physics == Model%imp_physics_thompson .and. Model%ltaerosol) then @@ -3558,10 +3587,17 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & integer :: lndp_type = 0 integer :: n_var_lndp = 0 logical :: lndp_each_step = .false. + integer :: n_var_spp = 0 + integer :: spp_pbl = 0 + integer :: spp_sfc = 0 + integer :: spp_mp = 0 + integer :: spp_rad = 0 + integer :: spp_gwd = 0 + logical :: do_spp = .false. !--- aerosol scavenging factors integer, parameter :: max_scav_factors = 25 - character(len=40) :: fscav_aero(max_scav_factors) = ' ' + character(len=40) :: fscav_aero(max_scav_factors) real(kind=kind_phys) :: radar_tten_limits(2) = (/ limit_unspecified, limit_unspecified /) integer :: itime @@ -3649,6 +3685,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & cs_parm, flgmin, cgwf, ccwf, cdmbgwd, sup, ctei_rm, crtrh, & dlqf, rbcr, shoc_parm, psauras, prauras, wminras, & do_sppt, do_shum, do_skeb, & + do_spp, n_var_spp, & lndp_type, n_var_lndp, lndp_each_step, & pert_mp,pert_clds,pert_radtend, & !--- Rayleigh friction @@ -4133,7 +4170,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & !--- GFDL MP parameters Model%lgfdlmprad = lgfdlmprad -!--- Thompson,GFDL MP parameter +!--- Thompson,GFDL,NSSL MP parameter Model%lrefres = lrefres !--- land/surface model parameters @@ -4465,12 +4502,23 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & Model%lndp_type = lndp_type Model%n_var_lndp = n_var_lndp Model%lndp_each_step = lndp_each_step + Model%do_spp = do_spp + Model%n_var_spp = n_var_spp + if (Model%lndp_type/=0) then allocate(Model%lndp_var_list(Model%n_var_lndp)) allocate(Model%lndp_prt_list(Model%n_var_lndp)) Model%lndp_var_list(:) = '' Model%lndp_prt_list(:) = clear_val end if + + if (Model%do_spp) then + allocate(Model%spp_var_list(Model%n_var_spp)) + allocate(Model%spp_prt_list(Model%n_var_spp)) + Model%spp_var_list(:) = '' + Model%spp_prt_list(:) = clear_val + end if + !--- cellular automata options ! force namelist constsitency allocate(Model%vfact_ca(levs)) @@ -5825,6 +5873,7 @@ subroutine control_print(Model) print *, ' nssl_alphahl - hail shape parameter : ', Model%nssl_alphahl print *, ' nssl_hail_on - hail activation flag : ', Model%nssl_hail_on print *, ' lradar - radar refl. flag : ', Model%lradar + print *, ' lrefres : ', Model%lrefres endif if (Model%imp_physics == Model%imp_physics_mg) then print *, ' M-G microphysical parameters' @@ -6051,6 +6100,8 @@ subroutine control_print(Model) print *, ' lndp_type : ', Model%lndp_type print *, ' n_var_lndp : ', Model%n_var_lndp print *, ' lndp_each_step : ', Model%lndp_each_step + print *, ' do_spp : ', Model%do_spp + print *, ' n_var_spp : ', Model%n_var_spp print *, ' ' print *, 'cellular automata' print *, ' nca : ', Model%nca @@ -7835,9 +7886,7 @@ subroutine interstitial_setup_tracers(Interstitial, Model) endif if (Model%cplchm) then - ! Only Zhao/Carr/Sundqvist and GFDL microphysics schemes are supported - ! when coupling with chemistry. PBL diffusion of aerosols is only supported - ! for GFDL microphysics and MG microphysics. + ! Only the following microphysics schemes are supported with coupled chemistry if (Model%imp_physics == Model%imp_physics_zhao_carr) then Interstitial%nvdiff = 3 elseif (Model%imp_physics == Model%imp_physics_mg) then @@ -7848,8 +7897,14 @@ subroutine interstitial_setup_tracers(Interstitial, Model) endif elseif (Model%imp_physics == Model%imp_physics_gfdl) then Interstitial%nvdiff = 7 + elseif (Model%imp_physics == Model%imp_physics_thompson) then + if (Model%ltaerosol) then + Interstitial%nvdiff = 12 + else + Interstitial%nvdiff = 9 + endif else - write(0,*) "Only Zhao/Carr/Sundqvist and GFDL microphysics schemes are supported when coupling with chemistry" + write(0,*) "Selected microphysics scheme is not supported when coupling with chemistry" stop endif if (Interstitial%trans_aero) Interstitial%nvdiff = Interstitial%nvdiff + Model%ntchm @@ -7875,7 +7930,7 @@ subroutine interstitial_setup_tracers(Interstitial, Model) Interstitial%otspt(1:3,:) = .false. ! this is for sp.hum, ice and liquid water Interstitial%otsptflag(:) = .true. tracers = 2 - do n=2,Model%ntrac ! should this also exclude ntlnc and ntinc? + do n=2,Model%ntrac ltest = ( n /= Model%ntcw .and. n /= Model%ntiw .and. n /= Model%ntclamt .and. & n /= Model%ntrw .and. n /= Model%ntsw .and. n /= Model%ntrnc .and. & n /= Model%ntsnc .and. n /= Model%ntgl .and. n /= Model%ntgnc .and. & @@ -7889,9 +7944,8 @@ subroutine interstitial_setup_tracers(Interstitial, Model) Interstitial%otspt(tracers+1,1) = .false. Interstitial%ntk = tracers endif - if (Model%ntlnc == n .or. Model%ntinc == n .or. Model%ntrnc == n .or. Model%ntsnc == n & - .or. Model%ntgnc == n .or. Model%nthnc == n) & -! if (ntlnc == n .or. ntinc == n .or. ntrnc == n .or. ntsnc == n .or.& ! these are already excluded by first conditional + if (Model%ntlnc == n .or. Model%ntinc == n .or. Model%ntrnc == n .or. Model%ntsnc == n .or. Model%ntgnc == n) & +! if (ntlnc == n .or. ntinc == n .or. ntrnc == n .or. ntsnc == n .or.& ! ntrw == n .or. ntsw == n .or. ntgl == n) & Interstitial%otspt(tracers+1,1) = .false. if (Interstitial%trans_aero .and. Model%ntchs == n) Interstitial%itc = tracers diff --git a/scm/src/GFS_typedefs.meta b/scm/src/GFS_typedefs.meta index bcc865e9e..5298c998e 100644 --- a/scm/src/GFS_typedefs.meta +++ b/scm/src/GFS_typedefs.meta @@ -529,6 +529,7 @@ dimensions = (horizontal_loop_extent,vertical_layer_dimension) type = real kind = kind_phys + active = ( index_of_graupel_volume_in_tracer_concentration_array > 0 ) [gq0(:,:,index_of_hail_volume_in_tracer_concentration_array)] standard_name = hail_volume_of_new_state long_name = hail volume updated by physics @@ -2353,10 +2354,50 @@ type = real kind = kind_phys active = (flag_for_stochastic_skeb_option) +[spp_wts_pbl] + standard_name = spp_weights_for_pbl_scheme + long_name = spp weights for pbl scheme + units = 1 + dimensions = (horizontal_loop_extent,vertical_layer_dimension) + type = real + kind = kind_phys + active = (do_stochastically_perturbed_parameterizations) +[spp_wts_sfc] + standard_name = spp_weights_for_surface_layer_scheme + long_name = spp weights for surface layer scheme + units = 1 + dimensions = (horizontal_loop_extent,vertical_layer_dimension) + type = real + kind = kind_phys + active = (do_stochastically_perturbed_parameterizations) +[spp_wts_mp] + standard_name = spp_weights_for_microphysics_scheme + long_name = spp weights for microphysics scheme + units = 1 + dimensions = (horizontal_loop_extent,vertical_layer_dimension) + type = real + kind = kind_phys + active = (do_stochastically_perturbed_parameterizations) +[spp_wts_gwd] + standard_name = spp_weights_for_gravity_wave_drag_scheme + long_name = spp weights for gravity wave drag scheme + units = 1 + dimensions = (horizontal_loop_extent,vertical_layer_dimension) + type = real + kind = kind_phys + active = (do_stochastically_perturbed_parameterizations) +[spp_wts_rad] + standard_name = spp_weights_for_radiation_scheme + long_name = spp weights for radiation scheme + units = 1 + dimensions = (horizontal_loop_extent,vertical_layer_dimension) + type = real + kind = kind_phys + active = (do_stochastically_perturbed_parameterizations) [sfc_wts] standard_name = surface_stochastic_weights_from_coupled_process long_name = weights for stochastic surface physics perturbation - units = none + units = 1 dimensions = (horizontal_loop_extent,number_of_perturbed_land_surface_variables) type = real kind = kind_phys @@ -4763,6 +4804,12 @@ units = flag dimensions = () type = logical +[do_spp] + standard_name = do_stochastically_perturbed_parameterizations + long_name = flag for stochastic spp option + units = flag + dimensions = () + type = logical [lndp_type] standard_name = control_for_stochastic_land_surface_perturbation long_name = index for stochastic land surface perturbations type @@ -4791,6 +4838,56 @@ type = character kind = len=3 active = (control_for_stochastic_land_surface_perturbation /= 0) +[n_var_spp] + standard_name = number_of_perturbed_spp_schemes + long_name = number of perturbed spp schemes + units = count + dimensions = () + type = integer +[spp_prt_list] + standard_name =magnitude_of_spp_perturbations + long_name = magnitude of spp perturbations + units = 1 + dimensions = (number_of_spp_schemes_perturbed) + type = real + kind = kind_phys +[spp_var_list] + standard_name = perturbed_spp_schemes + long_name = perturbed spp schemes + units = none + dimensions = (number_of_spp_schemes_perturbed) + type = character + kind = len=3 +[spp_pbl] + standard_name = control_for_pbl_spp_perturbations + long_name = control for pbl spp perturbations + units = count + dimensions = () + type = integer +[spp_sfc] + standard_name = control_for_surface_layer_spp_perturbations + long_name = control for surface layer spp perturbations + units = count + dimensions = () + type = integer +[spp_mp] + standard_name = control_for_microphysics_spp_perturbations + long_name = control for microphysics spp perturbations + units = count + dimensions = () + type = integer +[spp_rad] + standard_name = control_for_radiation_spp_perturbations + long_name = control for radiation spp perturbations + units = count + dimensions = () + type = integer +[spp_gwd] + standard_name = control_for_gravity_wave_drag_spp_perturbations + long_name = control for gravity wave drag spp perturbations + units = count + dimensions = () + type = integer [ntrac] standard_name = number_of_tracers long_name = number of tracers