From 9d5adc9db7a5ac3602d29a787a750d4865f55a1d Mon Sep 17 00:00:00 2001 From: Grant Firl Date: Wed, 17 Jul 2024 15:29:24 -0400 Subject: [PATCH 1/3] update GFS_typedefs for PR#207 --- .gitmodules | 6 ++++-- ccpp/framework | 2 +- ccpp/physics | 2 +- scm/src/GFS_typedefs.F90 | 41 ++++++++++++++++++++++++++++++++++----- scm/src/GFS_typedefs.meta | 20 +++++++++++++++++++ 5 files changed, 62 insertions(+), 9 deletions(-) diff --git a/.gitmodules b/.gitmodules index dc0798c32..265e5673c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,8 +4,10 @@ branch = main [submodule "ccpp-physics"] path = ccpp/physics - url = https://github.com/NCAR/ccpp-physics - branch = main + #url = https://github.com/NCAR/ccpp-physics + #branch = main + url = https://github.com/grantfirl/ccpp-physics + branch = ufs-dev-PR207 [submodule "CMakeModules"] path = CMakeModules url = https://github.com/noaa-emc/CMakeModules diff --git a/ccpp/framework b/ccpp/framework index ccfefcd0b..0f8232724 160000 --- a/ccpp/framework +++ b/ccpp/framework @@ -1 +1 @@ -Subproject commit ccfefcd0b426e011f94137031d5f7c2a4dda2659 +Subproject commit 0f8232724975c13289cad390c9a71fa2c6a9bff4 diff --git a/ccpp/physics b/ccpp/physics index 3a1969102..38f3f49db 160000 --- a/ccpp/physics +++ b/ccpp/physics @@ -1 +1 @@ -Subproject commit 3a19691021b779748f4b448d3f21ab381fcc6c6e +Subproject commit 38f3f49db734a345126446fc929db97358467646 diff --git a/scm/src/GFS_typedefs.F90 b/scm/src/GFS_typedefs.F90 index d1218b8da..d8fe5f446 100644 --- a/scm/src/GFS_typedefs.F90 +++ b/scm/src/GFS_typedefs.F90 @@ -703,7 +703,9 @@ module GFS_typedefs !< for use with internal file reads integer :: input_nml_file_length !< length (number of lines) in namelist for internal reads integer :: logunit - real(kind=kind_phys) :: fhzero !< hours between clearing of diagnostic buckets + real(kind=kind_phys) :: fhzero !< hours between clearing of diagnostic buckets (current bucket) + real(kind=kind_phys) :: fhzero_array(2) !< array to hold the the hours between clearing of diagnostic buckets + real(kind=kind_phys) :: fhzero_fhour(2) !< the maximum forecast length for the hours between clearing of diagnostic buckets logical :: ldiag3d !< flag for 3d diagnostic fields logical :: qdiag3d !< flag for 3d tracer diagnostic fields logical :: flag_for_gwd_generic_tend !< true if GFS_GWD_generic should calculate tendencies @@ -1121,6 +1123,7 @@ module GFS_typedefs logical :: do_gsl_drag_ls_bl !< flag for GSL drag (mesoscale GWD and blocking only) logical :: do_gsl_drag_ss !< flag for GSL drag (small-scale GWD only) logical :: do_gsl_drag_tofd !< flag for GSL drag (turbulent orog form drag only) + logical :: do_gwd_opt_psl !< flag for PSL drag (mesoscale GWD and blocking only) logical :: do_ugwp_v1 !< flag for version 1 ugwp GWD logical :: do_ugwp_v1_orog_only !< flag for version 1 ugwp GWD (orographic drag only) logical :: do_ugwp_v1_w_gsldrag !< flag for version 1 ugwp with OGWD of GSL @@ -1205,6 +1208,8 @@ module GFS_typedefs real(kind=kind_phys) :: ccwf(2) !< multiplication factor for critical cloud !< workfunction for RAS real(kind=kind_phys) :: cdmbgwd(4) !< multiplication factors for cdmb, gwd and NS gwd, tke based enhancement + real(kind=kind_phys) :: alpha_fd !< alpha coefficient for turbulent orographic form drag + real(kind=kind_phys) :: psl_gwd_dx_factor !< multiplication factors for grid spacing real(kind=kind_phys) :: sup !< supersaturation in pdf cloud when t is very low real(kind=kind_phys) :: ctei_rm(2) !< critical cloud top entrainment instability criteria !< (used if mstrat=.true.) @@ -3317,6 +3322,8 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & !--- BEGIN NAMELIST VARIABLES real(kind=kind_phys) :: fhzero = 0.0 !< hours between clearing of diagnostic buckets + real(kind=kind_phys) :: fhzero_array(1:2) = 0.0 !< array with hours between clearing of diagnostic buckets + real(kind=kind_phys) :: fhzero_fhour(1:2) = 0.0 !< the maximum forecast length for the hours between clearing of diagnostic buckets logical :: ldiag3d = .true. !< flag for 3d diagnostic fields logical :: qdiag3d = .true. !< flag for 3d tracer diagnostic fields logical :: lssav = .false. !< logical flag for storing diagnostics @@ -3638,6 +3645,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & logical :: do_gsl_drag_ls_bl = .false. !< flag for GSL drag (mesoscale GWD and blocking only) logical :: do_gsl_drag_ss = .false. !< flag for GSL drag (small-scale GWD only) logical :: do_gsl_drag_tofd = .false. !< flag for GSL drag (turbulent orog form drag only) + logical :: do_gwd_opt_psl = .false. !< flag for PSL drag (mesoscale GWD and blocking only) logical :: do_ugwp_v1 = .false. !< flag for version 1 ugwp GWD logical :: do_ugwp_v1_orog_only = .false. !< flag for version 1 ugwp GWD (orographic drag only) logical :: do_ugwp_v1_w_gsldrag = .false. !< flag for version 1 ugwp GWD (orographic drag only) @@ -3742,6 +3750,8 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & real(kind=kind_phys) :: ccwf(2) = (/1.0d0,1.0d0/) !< multiplication factor for critical cloud !< workfunction for RAS real(kind=kind_phys) :: cdmbgwd(4) = (/2.0d0,0.25d0,1.0d0,1.0d0/) !< multiplication factors for cdmb, gwd, and NS gwd, tke based enhancement + real(kind=kind_phys) :: alpha_fd = 12.0 !< alpha coefficient for turbulent orographic form drag + real(kind=kind_phys) :: psl_gwd_dx_factor = 6.0 !< multiplication factors for grid spacing real(kind=kind_phys) :: sup = 1.0 !< supersaturation in pdf cloud (IMP_physics=98) when t is very low !< or ice super saturation in SHOC (when do_shoc=.true.) real(kind=kind_phys) :: ctei_rm(2) = (/10.0d0,10.0d0/) !< critical cloud top entrainment instability criteria @@ -3987,9 +3997,9 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & NAMELIST /gfs_physics_nml/ & !--- general parameters - fhzero, ldiag3d, qdiag3d, lssav, naux2d, dtend_select, & - naux3d, aux2d_time_avg, aux3d_time_avg, fhcyc, & - thermodyn_id, sfcpress_id, & + fhzero, fhzero_array, fhzero_fhour, ldiag3d, qdiag3d, lssav, & + naux2d, dtend_select, naux3d, aux2d_time_avg, & + aux3d_time_avg, fhcyc, thermodyn_id, sfcpress_id, & !--- coupling parameters cplflx, cplice, cplocn2atm, cplwav, cplwav2atm, cplaqm, & cplchm, cpllnd, cpllnd2atm, cpl_imp_mrg, cpl_imp_dbg, & @@ -4065,6 +4075,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & gwd_opt, do_ugwp_v0, do_ugwp_v0_orog_only, & do_ugwp_v0_nst_only, & do_gsl_drag_ls_bl, do_gsl_drag_ss, do_gsl_drag_tofd, & + do_gwd_opt_psl, & do_ugwp_v1, do_ugwp_v1_orog_only, do_ugwp_v1_w_gsldrag, & ugwp_seq_update, var_ric, coef_ric_l, coef_ric_s, hurr_pbl, & do_myjsfc, do_myjpbl, & @@ -4073,7 +4084,9 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & shinhong, do_ysu, dspheat, lheatstrg, lseaspray, cnvcld, & xr_cnvcld, random_clds, shal_cnv, imfshalcnv, imfdeepcnv, & isatmedmf, do_deep, jcap, & - cs_parm, flgmin, cgwf, ccwf, cdmbgwd, sup, ctei_rm, crtrh, & + cs_parm, flgmin, cgwf, ccwf, cdmbgwd, alpha_fd, & + psl_gwd_dx_factor, & + sup, ctei_rm, crtrh, & dlqf, rbcr, shoc_parm, psauras, prauras, wminras, & do_sppt, do_shum, do_skeb, & do_spp, n_var_spp, & @@ -4206,6 +4219,11 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & Model%fn_nml = fn_nml Model%logunit = logunit Model%fhzero = fhzero + Model%fhzero_array = fhzero_array + Model%fhzero_fhour = fhzero_fhour + if( Model%fhzero_array(1) > 0. ) then + Model%fhzero = Model%fhzero_array(1) + endif Model%ldiag3d = ldiag3d Model%qdiag3d = qdiag3d if (qdiag3d .and. .not. ldiag3d) then @@ -4964,6 +4982,8 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & Model%cgwf = cgwf Model%ccwf = ccwf Model%cdmbgwd = cdmbgwd + Model%alpha_fd = alpha_fd + Model%psl_gwd_dx_factor = psl_gwd_dx_factor Model%sup = sup Model%ctei_rm = ctei_rm Model%crtrh = crtrh @@ -5011,6 +5031,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & Model%do_gsl_drag_ls_bl = do_gsl_drag_ls_bl Model%do_gsl_drag_ss = do_gsl_drag_ss Model%do_gsl_drag_tofd = do_gsl_drag_tofd + Model%do_gwd_opt_psl = do_gwd_opt_psl Model%do_ugwp_v1 = do_ugwp_v1 Model%do_ugwp_v1_orog_only = do_ugwp_v1_orog_only Model%do_ugwp_v1_w_gsldrag = do_ugwp_v1_w_gsldrag @@ -5026,6 +5047,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & Model%do_gsl_drag_tofd = .true. Model%do_gsl_drag_ss = .true. Model%do_ugwp_v1_orog_only = .false. + Model%do_gwd_opt_psl = .true. endif Model%do_myjsfc = do_myjsfc @@ -5676,6 +5698,10 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & Model%restart = restart Model%lsm_cold_start = .not. restart Model%hydrostatic = hydrostatic + if (Model%me == Model%master) then + print *,'in atm phys init, phour=',Model%phour,'fhour=',Model%fhour,'zhour=',Model%zhour,'kdt=',Model%kdt + endif + if(Model%hydrostatic .and. Model%lightning_threat) then write(0,*) 'Turning off lightning threat index for hydrostatic run.' @@ -6469,6 +6495,8 @@ subroutine control_print(Model) print *, ' nlunit : ', Model%nlunit print *, ' fn_nml : ', trim(Model%fn_nml) print *, ' fhzero : ', Model%fhzero + print *, ' fhzero_array : ', Model%fhzero_array + print *, ' fhzero_fhour : ', Model%fhzero_fhour print *, ' ldiag3d : ', Model%ldiag3d print *, ' qdiag3d : ', Model%qdiag3d print *, ' lssav : ', Model%lssav @@ -6824,6 +6852,8 @@ subroutine control_print(Model) print *, ' cgwf : ', Model%cgwf print *, ' ccwf : ', Model%ccwf print *, ' cdmbgwd : ', Model%cdmbgwd + print *, ' alpha_fd : ', Model%alpha_fd + print *, ' psl_gwd_dx_factor : ', Model%psl_gwd_dx_factor print *, ' sup : ', Model%sup print *, ' ctei_rm : ', Model%ctei_rm print *, ' crtrh : ', Model%crtrh @@ -6844,6 +6874,7 @@ subroutine control_print(Model) print *, ' do_gsl_drag_ls_bl : ', Model%do_gsl_drag_ls_bl print *, ' do_gsl_drag_ss : ', Model%do_gsl_drag_ss print *, ' do_gsl_drag_tofd : ', Model%do_gsl_drag_tofd + print *, ' do_gwd_opt_psl : ', Model%do_gwd_opt_psl print *, ' do_ugwp_v1 : ', Model%do_ugwp_v1 print *, ' do_ugwp_v1_orog_only : ', Model%do_ugwp_v1_orog_only print *, ' do_ugwp_v1_w_gsldrag : ', Model%do_ugwp_v1_w_gsldrag diff --git a/scm/src/GFS_typedefs.meta b/scm/src/GFS_typedefs.meta index 617a109e1..2e74c0e7a 100644 --- a/scm/src/GFS_typedefs.meta +++ b/scm/src/GFS_typedefs.meta @@ -5640,6 +5640,13 @@ dimensions = (4) type = real kind = kind_phys +[alpha_fd] + standard_name = alpha_coefficient_for_turbulent_orographic_form_drag + long_name = alpha coefficient for Beljaars et al turbulent orographic form drag + units = 1 + dimensions = () + type = real + kind = kind_phys [ccwf] standard_name = tunable_parameter_for_critical_cloud_workfunction_in_relaxed_arakawa_schubert_deep_convection long_name = multiplication factor for tical_cloud_workfunction @@ -7538,6 +7545,19 @@ units = flag dimensions = () type = logical +[do_gwd_opt_psl] + standard_name = do_gsl_drag_suite_with_psl_gwd_option + long_name = flag to activate PSL drag suite - mesoscale GWD and blocking + units = flag + dimensions = () + type = logical +[psl_gwd_dx_factor] + standard_name = effective_grid_spacing_of_psl_gwd_suite + long_name = multiplication of grid spacing + units = 1 + dimensions = () + type = real + kind = kind_phys [do_ugwp_v1] standard_name = flag_for_ugwp_version_1 long_name = flag to activate ver 1 CIRES UGWP From 8b9bfcf31cfdf2a7fd5a8709f30bb63027f3240f Mon Sep 17 00:00:00 2001 From: Grant Firl Date: Wed, 17 Jul 2024 17:31:01 -0400 Subject: [PATCH 2/3] fix seg-fault causing sigmab output statements --- scm/src/scm_output.F90 | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/scm/src/scm_output.F90 b/scm/src/scm_output.F90 index 3458da3c9..b41347c19 100644 --- a/scm/src/scm_output.F90 +++ b/scm/src/scm_output.F90 @@ -101,7 +101,7 @@ subroutine output_init(scm_state, physics) call NetCDF_def_var(ncid, 'time_rad', NF90_FLOAT, "model elapsed time for either LW or SW radiation variables", "s", time_rad_var_id, (/ time_rad_id /)) !> - Define the state variables - CALL output_init_state(ncid, time_inst_id, hor_dim_id, vert_dim_id, vert_dim_i_id) + CALL output_init_state(ncid, time_inst_id, hor_dim_id, vert_dim_id, vert_dim_i_id, scm_state) !> - Define the forcing variables CALL output_init_forcing(ncid, time_inst_id, hor_dim_id, vert_dim_id) @@ -165,10 +165,12 @@ subroutine output_init(scm_state, physics) !> @} end subroutine output_init -subroutine output_init_state(ncid, time_inst_id, hor_dim_id, vert_dim_id, vert_dim_i_id) +subroutine output_init_state(ncid, time_inst_id, hor_dim_id, vert_dim_id, vert_dim_i_id, scm_state) + use scm_type_defs, only: scm_state_type use NetCDF_def, only : NetCDF_def_var integer, intent(in) :: ncid, time_inst_id, hor_dim_id, vert_dim_id, vert_dim_i_id + type(scm_state_type), intent(in) :: scm_state integer :: dummy_id @@ -187,7 +189,9 @@ subroutine output_init_state(ncid, time_inst_id, hor_dim_id, vert_dim_id, vert_d call NetCDF_def_var(ncid, 'ql', NF90_FLOAT, "suspended resolved liquid cloud water on model layer centers", "kg kg-1", dummy_id, (/ hor_dim_id, vert_dim_id, time_inst_id /)) call NetCDF_def_var(ncid, 'qi', NF90_FLOAT, "suspended resolved ice cloud water on model layer centers", "kg kg-1", dummy_id, (/ hor_dim_id, vert_dim_id, time_inst_id /)) call NetCDF_def_var(ncid, 'qc', NF90_FLOAT, "suspended (resolved + SGS) total cloud water on model layer centers", "kg kg-1", dummy_id, (/ hor_dim_id, vert_dim_id, time_inst_id /)) - call NetCDF_def_var(ncid, 'sigmab', NF90_FLOAT, "updraft area fraction on model layer centers", "frac", dummy_id, (/ hor_dim_id, time_inst_id /)) + if (scm_state%sigmab_index > 0) then + call NetCDF_def_var(ncid, 'sigmab', NF90_FLOAT, "updraft area fraction at lowest model layer", "frac", dummy_id, (/ hor_dim_id, time_inst_id /)) + end if end subroutine output_init_state @@ -498,7 +502,9 @@ subroutine output_append_state(ncid, scm_state, physics) call NetCDF_put_var(ncid, "v", scm_state%state_v(:,:,1), scm_state%itt_out) call NetCDF_put_var(ncid, "ql", scm_state%state_tracer(:,:,scm_state%cloud_water_index,1), scm_state%itt_out) call NetCDF_put_var(ncid, "qi", scm_state%state_tracer(:,:,scm_state%cloud_ice_index,1), scm_state%itt_out) - call NetCDF_put_var(ncid, "sigmab", scm_state%state_tracer(:,1,scm_state%sigmab_index,1), scm_state%itt_out) + if (scm_state%sigmab_index > 0) then + call NetCDF_put_var(ncid, "sigmab", scm_state%state_tracer(:,1,scm_state%sigmab_index,1), scm_state%itt_out) + endif if (physics%model%do_mynnedmf) then call NetCDF_put_var(ncid, "qc", scm_state%state_tracer(:,:,scm_state%cloud_water_index,1) + & scm_state%state_tracer(:,:,scm_state%cloud_ice_index,1) + & From c84b3a740d3516717070331aabd640f484c73f03 Mon Sep 17 00:00:00 2001 From: Grant Firl Date: Wed, 24 Jul 2024 16:55:29 -0400 Subject: [PATCH 3/3] update ccpp/physics pointer --- .gitmodules | 6 ++---- ccpp/physics | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.gitmodules b/.gitmodules index 265e5673c..dc0798c32 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,10 +4,8 @@ branch = main [submodule "ccpp-physics"] path = ccpp/physics - #url = https://github.com/NCAR/ccpp-physics - #branch = main - url = https://github.com/grantfirl/ccpp-physics - branch = ufs-dev-PR207 + url = https://github.com/NCAR/ccpp-physics + branch = main [submodule "CMakeModules"] path = CMakeModules url = https://github.com/noaa-emc/CMakeModules diff --git a/ccpp/physics b/ccpp/physics index 38f3f49db..160aa0359 160000 --- a/ccpp/physics +++ b/ccpp/physics @@ -1 +1 @@ -Subproject commit 38f3f49db734a345126446fc929db97358467646 +Subproject commit 160aa0359cf28b7f2f05ec23f3ac2fed59afad8b