From bad94ac8fe58f05e0f9eb543c1f565f211fa3395 Mon Sep 17 00:00:00 2001 From: Grant Firl Date: Wed, 19 Nov 2025 12:19:55 -0500 Subject: [PATCH 1/3] add n_diag_buckets to 2 diag variables --- .gitmodules | 6 ++++-- ccpp/physics | 2 +- scm/src/GFS_typedefs.F90 | 14 +++++++++----- scm/src/GFS_typedefs.meta | 10 ++++++++-- scm/src/scm_output.F90 | 8 ++++---- 5 files changed, 26 insertions(+), 14 deletions(-) diff --git a/.gitmodules b/.gitmodules index dc0798c32..8dbbd8dcc 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 = NRL_combo_20251119 [submodule "CMakeModules"] path = CMakeModules url = https://github.com/noaa-emc/CMakeModules diff --git a/ccpp/physics b/ccpp/physics index 7b87cff37..8e3337f2f 160000 --- a/ccpp/physics +++ b/ccpp/physics @@ -1 +1 @@ -Subproject commit 7b87cff37e5407b32543b8e614caa0509b7ca24d +Subproject commit 8e3337f2fb3dc76e0634b2172ba250ac23e5aa7f diff --git a/scm/src/GFS_typedefs.F90 b/scm/src/GFS_typedefs.F90 index 9840fc923..9dafe7f6b 100644 --- a/scm/src/GFS_typedefs.F90 +++ b/scm/src/GFS_typedefs.F90 @@ -726,6 +726,7 @@ module GFS_typedefs integer :: logunit integer :: latidxprnt integer :: ipr + integer :: n_diag_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 @@ -2009,7 +2010,7 @@ module GFS_typedefs real (kind=kind_phys), pointer :: dtsfc (:) => null() !< sensible heat flux (w/m2) real (kind=kind_phys), pointer :: dqsfc (:) => null() !< latent heat flux (w/m2) real (kind=kind_phys), pointer :: totprcp(:) => null() !< accumulated total precipitation (kg/m2) - real (kind=kind_phys), pointer :: totprcpb(:) => null() !< accumulated total precipitation in bucket(kg/m2) + real (kind=kind_phys), pointer :: totprcpb(:,:) => null() !< accumulated total precipitation in bucket(kg/m2) real (kind=kind_phys), pointer :: gflux (:) => null() !< groud conductive heat flux real (kind=kind_phys), pointer :: dlwsfc (:) => null() !< time accumulated sfc dn lw flux ( w/m**2 ) real (kind=kind_phys), pointer :: ulwsfc (:) => null() !< time accumulated sfc up lw flux ( w/m**2 ) @@ -2025,7 +2026,7 @@ module GFS_typedefs real (kind=kind_phys), pointer :: dvgwd (:) => null() !< vertically integrated v change by OGWD real (kind=kind_phys), pointer :: psmean (:) => null() !< surface pressure (kPa) real (kind=kind_phys), pointer :: cnvprcp(:) => null() !< accumulated convective precipitation (kg/m2) - real (kind=kind_phys), pointer :: cnvprcpb(:) => null() !< accumulated convective precipitation in bucket (kg/m2) + real (kind=kind_phys), pointer :: cnvprcpb(:,:) => null() !< accumulated convective precipitation in bucket (kg/m2) real (kind=kind_phys), pointer :: spfhmin(:) => null() !< minimum specific humidity real (kind=kind_phys), pointer :: spfhmax(:) => null() !< maximum specific humidity real (kind=kind_phys), pointer :: u10mmax(:) => null() !< maximum u-wind @@ -4467,6 +4468,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, & Model%fn_nml = fn_nml Model%logunit = logunit Model%latidxprnt = 1 + Model%n_diag_buckets = 1 Model%fhzero = fhzero Model%fhzero_array = fhzero_array Model%fhzero_fhour = fhzero_fhour @@ -6862,6 +6864,7 @@ subroutine control_print(Model) print *, ' fhzero : ', Model%fhzero print *, ' fhzero_array : ', Model%fhzero_array print *, ' fhzero_fhour : ', Model%fhzero_fhour + print *, ' n_diag_buckets : ', Model%n_diag_buckets print *, ' ldiag3d : ', Model%ldiag3d print *, ' qdiag3d : ', Model%qdiag3d print *, ' lssav : ', Model%lssav @@ -8080,11 +8083,12 @@ end subroutine label_dtend_cause subroutine diag_create (Diag, Model) class(GFS_diag_type) :: Diag type(GFS_control_type), intent(in) :: Model - integer :: IM + integer :: IM, ndb logical, save :: linit logical :: have_pbl, have_dcnv, have_scnv, have_mp, have_oz_phys IM = Model%ncols + ndb = Model%n_diag_buckets if(Model%print_diff_pgr) then allocate (Diag%old_pgr(IM)) @@ -8127,7 +8131,7 @@ subroutine diag_create (Diag, Model) allocate (Diag%dtsfc (IM)) allocate (Diag%dqsfc (IM)) allocate (Diag%totprcp (IM)) - allocate (Diag%totprcpb(IM)) + allocate (Diag%totprcpb(ndb,IM)) allocate (Diag%gflux (IM)) allocate (Diag%dlwsfc (IM)) allocate (Diag%ulwsfc (IM)) @@ -8142,7 +8146,7 @@ subroutine diag_create (Diag, Model) allocate (Diag%dvgwd (IM)) allocate (Diag%psmean (IM)) allocate (Diag%cnvprcp (IM)) - allocate (Diag%cnvprcpb(IM)) + allocate (Diag%cnvprcpb(ndb,IM)) allocate (Diag%spfhmin (IM)) allocate (Diag%spfhmax (IM)) allocate (Diag%u10mmax (IM)) diff --git a/scm/src/GFS_typedefs.meta b/scm/src/GFS_typedefs.meta index e4ec17eb7..d0159fcd3 100644 --- a/scm/src/GFS_typedefs.meta +++ b/scm/src/GFS_typedefs.meta @@ -3525,6 +3525,12 @@ units = index dimensions = () type = integer +[n_diag_buckets] + standard_name = number_of_diagnostic_buckets + long_name = number of diagnostic bucket reset periods + units = count + dimensions = () + type = integer [ldiag3d] standard_name = flag_for_diagnostics_3D long_name = flag for 3d diagnostic fields @@ -9254,7 +9260,7 @@ standard_name = accumulated_lwe_thickness_of_precipitation_amount_in_bucket long_name = accumulated total precipitation in bucket units = m - dimensions = (horizontal_dimension) + dimensions = (number_of_diagnostic_buckets,horizontal_dimension) type = real kind = kind_phys [toticeb] @@ -9445,7 +9451,7 @@ standard_name = cumulative_lwe_thickness_of_convective_precipitation_amount_in_bucket long_name = cumulative convective precipitation in bucket units = m - dimensions = (horizontal_dimension) + dimensions = (number_of_diagnostic_buckets,horizontal_dimension) type = real kind = kind_phys [spfhmin] diff --git a/scm/src/scm_output.F90 b/scm/src/scm_output.F90 index 3b1559573..efba47ae5 100644 --- a/scm/src/scm_output.F90 +++ b/scm/src/scm_output.F90 @@ -788,16 +788,16 @@ subroutine output_append_diag_avg(ncid, scm_state, physics) call output_append_tendency(ncid, physics, physics%Model%dtidx(physics%Model%index_of_y_wind,physics%Model%index_of_process_physics), "dv_dt_phys", scm_state%itt_diag, inverse_n_diag*inverse_dt) call output_append_tendency(ncid, physics, physics%Model%dtidx(physics%Model%index_of_y_wind,physics%Model%index_of_process_non_physics), "dv_dt_nonphys", scm_state%itt_diag, inverse_n_diag*inverse_dt) - call NetCDF_put_var(ncid, "tprcp_accum", physics%Diag%totprcpb(:), scm_state%itt_diag, inverse_n_diag) + call NetCDF_put_var(ncid, "tprcp_accum", physics%Diag%totprcpb(1,:), scm_state%itt_diag, inverse_n_diag) call NetCDF_put_var(ncid, "ice_accum", physics%Diag%toticeb(:), scm_state%itt_diag, inverse_n_diag) call NetCDF_put_var(ncid, "snow_accum", physics%Diag%totsnwb(:), scm_state%itt_diag, inverse_n_diag) call NetCDF_put_var(ncid, "graupel_accum", physics%Diag%totgrpb(:), scm_state%itt_diag, inverse_n_diag) - call NetCDF_put_var(ncid, "conv_prcp_accum", physics%Diag%cnvprcpb(:), scm_state%itt_diag, inverse_n_diag) - call NetCDF_put_var(ncid, "tprcp_rate_accum", physics%Diag%totprcpb(:), scm_state%itt_diag, inverse_n_diag*inverse_dt) + call NetCDF_put_var(ncid, "conv_prcp_accum", physics%Diag%cnvprcpb(1,:), scm_state%itt_diag, inverse_n_diag) + call NetCDF_put_var(ncid, "tprcp_rate_accum", physics%Diag%totprcpb(1,:), scm_state%itt_diag, inverse_n_diag*inverse_dt) call NetCDF_put_var(ncid, "ice_rate_accum", physics%Diag%toticeb(:), scm_state%itt_diag, inverse_n_diag*inverse_dt) call NetCDF_put_var(ncid, "snow_rate_accum", physics%Diag%totsnwb(:), scm_state%itt_diag, inverse_n_diag*inverse_dt) call NetCDF_put_var(ncid, "graupel_rate_accum", physics%Diag%totgrpb(:), scm_state%itt_diag, inverse_n_diag*inverse_dt) - call NetCDF_put_var(ncid, "conv_prcp_rate_accum", physics%Diag%cnvprcpb(:), scm_state%itt_diag, inverse_n_diag*inverse_dt) + call NetCDF_put_var(ncid, "conv_prcp_rate_accum", physics%Diag%cnvprcpb(1,:), scm_state%itt_diag, inverse_n_diag*inverse_dt) end subroutine output_append_diag_avg From 76e5cf93e988e79c6d79210b00de715df6f35421 Mon Sep 17 00:00:00 2001 From: Grant Firl Date: Wed, 19 Nov 2025 15:14:35 -0500 Subject: [PATCH 2/3] fix array order for diagnostic buckets --- scm/src/GFS_typedefs.F90 | 4 ++-- scm/src/GFS_typedefs.meta | 4 ++-- scm/src/scm_output.F90 | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/scm/src/GFS_typedefs.F90 b/scm/src/GFS_typedefs.F90 index 9dafe7f6b..5f8af233d 100644 --- a/scm/src/GFS_typedefs.F90 +++ b/scm/src/GFS_typedefs.F90 @@ -8131,7 +8131,7 @@ subroutine diag_create (Diag, Model) allocate (Diag%dtsfc (IM)) allocate (Diag%dqsfc (IM)) allocate (Diag%totprcp (IM)) - allocate (Diag%totprcpb(ndb,IM)) + allocate (Diag%totprcpb(IM,ndb)) allocate (Diag%gflux (IM)) allocate (Diag%dlwsfc (IM)) allocate (Diag%ulwsfc (IM)) @@ -8146,7 +8146,7 @@ subroutine diag_create (Diag, Model) allocate (Diag%dvgwd (IM)) allocate (Diag%psmean (IM)) allocate (Diag%cnvprcp (IM)) - allocate (Diag%cnvprcpb(ndb,IM)) + allocate (Diag%cnvprcpb(IM,ndb)) allocate (Diag%spfhmin (IM)) allocate (Diag%spfhmax (IM)) allocate (Diag%u10mmax (IM)) diff --git a/scm/src/GFS_typedefs.meta b/scm/src/GFS_typedefs.meta index d0159fcd3..bb171ab93 100644 --- a/scm/src/GFS_typedefs.meta +++ b/scm/src/GFS_typedefs.meta @@ -9260,7 +9260,7 @@ standard_name = accumulated_lwe_thickness_of_precipitation_amount_in_bucket long_name = accumulated total precipitation in bucket units = m - dimensions = (number_of_diagnostic_buckets,horizontal_dimension) + dimensions = (horizontal_dimension,number_of_diagnostic_buckets) type = real kind = kind_phys [toticeb] @@ -9451,7 +9451,7 @@ standard_name = cumulative_lwe_thickness_of_convective_precipitation_amount_in_bucket long_name = cumulative convective precipitation in bucket units = m - dimensions = (number_of_diagnostic_buckets,horizontal_dimension) + dimensions = (horizontal_dimension,number_of_diagnostic_buckets) type = real kind = kind_phys [spfhmin] diff --git a/scm/src/scm_output.F90 b/scm/src/scm_output.F90 index efba47ae5..c8f8b022b 100644 --- a/scm/src/scm_output.F90 +++ b/scm/src/scm_output.F90 @@ -788,16 +788,16 @@ subroutine output_append_diag_avg(ncid, scm_state, physics) call output_append_tendency(ncid, physics, physics%Model%dtidx(physics%Model%index_of_y_wind,physics%Model%index_of_process_physics), "dv_dt_phys", scm_state%itt_diag, inverse_n_diag*inverse_dt) call output_append_tendency(ncid, physics, physics%Model%dtidx(physics%Model%index_of_y_wind,physics%Model%index_of_process_non_physics), "dv_dt_nonphys", scm_state%itt_diag, inverse_n_diag*inverse_dt) - call NetCDF_put_var(ncid, "tprcp_accum", physics%Diag%totprcpb(1,:), scm_state%itt_diag, inverse_n_diag) + call NetCDF_put_var(ncid, "tprcp_accum", physics%Diag%totprcpb(:,1), scm_state%itt_diag, inverse_n_diag) call NetCDF_put_var(ncid, "ice_accum", physics%Diag%toticeb(:), scm_state%itt_diag, inverse_n_diag) call NetCDF_put_var(ncid, "snow_accum", physics%Diag%totsnwb(:), scm_state%itt_diag, inverse_n_diag) call NetCDF_put_var(ncid, "graupel_accum", physics%Diag%totgrpb(:), scm_state%itt_diag, inverse_n_diag) - call NetCDF_put_var(ncid, "conv_prcp_accum", physics%Diag%cnvprcpb(1,:), scm_state%itt_diag, inverse_n_diag) - call NetCDF_put_var(ncid, "tprcp_rate_accum", physics%Diag%totprcpb(1,:), scm_state%itt_diag, inverse_n_diag*inverse_dt) + call NetCDF_put_var(ncid, "conv_prcp_accum", physics%Diag%cnvprcpb(:,1), scm_state%itt_diag, inverse_n_diag) + call NetCDF_put_var(ncid, "tprcp_rate_accum", physics%Diag%totprcpb(:,1), scm_state%itt_diag, inverse_n_diag*inverse_dt) call NetCDF_put_var(ncid, "ice_rate_accum", physics%Diag%toticeb(:), scm_state%itt_diag, inverse_n_diag*inverse_dt) call NetCDF_put_var(ncid, "snow_rate_accum", physics%Diag%totsnwb(:), scm_state%itt_diag, inverse_n_diag*inverse_dt) call NetCDF_put_var(ncid, "graupel_rate_accum", physics%Diag%totgrpb(:), scm_state%itt_diag, inverse_n_diag*inverse_dt) - call NetCDF_put_var(ncid, "conv_prcp_rate_accum", physics%Diag%cnvprcpb(1,:), scm_state%itt_diag, inverse_n_diag*inverse_dt) + call NetCDF_put_var(ncid, "conv_prcp_rate_accum", physics%Diag%cnvprcpb(:,1), scm_state%itt_diag, inverse_n_diag*inverse_dt) end subroutine output_append_diag_avg From 632cbd3e25b5d040dff39fc46ad421f9dc7a5f41 Mon Sep 17 00:00:00 2001 From: Grant Firl Date: Fri, 21 Nov 2025 14:58:00 -0500 Subject: [PATCH 3/3] update ccpp/physics --- .gitmodules | 6 ++---- ccpp/physics | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.gitmodules b/.gitmodules index 8dbbd8dcc..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 = NRL_combo_20251119 + 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 8e3337f2f..3f7c5aba5 160000 --- a/ccpp/physics +++ b/ccpp/physics @@ -1 +1 @@ -Subproject commit 8e3337f2fb3dc76e0634b2172ba250ac23e5aa7f +Subproject commit 3f7c5aba5a7cb2041eb7f8d3c106c468bb959505