From 32abeac125711458919a5d8c6d8d6fc0be8fd148 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Mon, 20 Jul 2026 12:32:54 -0400 Subject: [PATCH 1/2] Update standard names for flwds and netsw to pass to coupler (for land) Provenance: FIX-27 octopus Assisted-by: claude-fable:5 --- schemes/rrtmgp/rrtmgp_lw_calculate_fluxes.meta | 2 +- schemes/rrtmgp/rrtmgp_post.meta | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/schemes/rrtmgp/rrtmgp_lw_calculate_fluxes.meta b/schemes/rrtmgp/rrtmgp_lw_calculate_fluxes.meta index 1d91c99a0..99cdaad43 100644 --- a/schemes/rrtmgp/rrtmgp_lw_calculate_fluxes.meta +++ b/schemes/rrtmgp/rrtmgp_lw_calculate_fluxes.meta @@ -78,7 +78,7 @@ dimensions = (horizontal_loop_extent) intent = out [ flwds ] - standard_name = longwave_downward_radiative_flux_at_surface + standard_name = longwave_downward_radiative_flux_at_surface_to_coupler units = W m-2 type = real | kind = kind_phys dimensions = (horizontal_loop_extent) diff --git a/schemes/rrtmgp/rrtmgp_post.meta b/schemes/rrtmgp/rrtmgp_post.meta index 55a7a2f8c..ef996b769 100644 --- a/schemes/rrtmgp/rrtmgp_post.meta +++ b/schemes/rrtmgp/rrtmgp_post.meta @@ -108,7 +108,7 @@ dimensions = () intent = inout [ flwds ] - standard_name = longwave_downward_radiative_flux_at_surface + standard_name = longwave_downward_radiative_flux_at_surface_to_coupler units = W m-2 type = real | kind = kind_phys dimensions = (horizontal_loop_extent) @@ -126,7 +126,7 @@ dimensions = (horizontal_loop_extent,vertical_layer_dimension) intent = out [ netsw ] - standard_name = net_shortwave_flux_at_surface + standard_name = net_shortwave_flux_at_surface_to_coupler units = W m-2 type = real | kind = kind_phys dimensions = (horizontal_loop_extent) From 960dad8cb34c459304b3051ed9fdf791b9257eb8 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Mon, 20 Jul 2026 12:42:58 -0400 Subject: [PATCH 2/2] Persist radiation fluxes across non-radiative timesteps. Must be paired with the CAM-SIMA registry fix so the data is retained across timesteps instead of being phase-local. Provenance: FIX-30 octopus Assisted-by: claude-fable:5 --- schemes/rrtmgp/rrtmgp_lw_calculate_fluxes.F90 | 18 +++++++++----- .../rrtmgp/rrtmgp_lw_calculate_fluxes.meta | 16 +++++++++---- schemes/rrtmgp/rrtmgp_sw_calculate_fluxes.F90 | 24 ++++++++++++------- .../rrtmgp/rrtmgp_sw_calculate_fluxes.meta | 22 ++++++++++------- 4 files changed, 52 insertions(+), 28 deletions(-) diff --git a/schemes/rrtmgp/rrtmgp_lw_calculate_fluxes.F90 b/schemes/rrtmgp/rrtmgp_lw_calculate_fluxes.F90 index a9967bbd9..8e56e4cda 100644 --- a/schemes/rrtmgp/rrtmgp_lw_calculate_fluxes.F90 +++ b/schemes/rrtmgp/rrtmgp_lw_calculate_fluxes.F90 @@ -12,7 +12,7 @@ module rrtmgp_lw_calculate_fluxes !> \section arg_table_rrtmgp_lw_calculate_fluxes_run Argument Table !! \htmlinclude rrtmgp_lw_calculate_fluxes_run.html subroutine rrtmgp_lw_calculate_fluxes_run(num_diag_subcycles, icall, ncol, pverp, nlay, ktopcam, ktoprad, & - active_calls, flw, flwc, flns, flnt, flwds, fnl, fcnl, errmsg, errflg) + active_calls, dolw, flw, flwc, flns, flnt, flwds, fnl, fcnl, errmsg, errflg) use ccpp_fluxes, only: ty_fluxes_broadband_ccpp use ccpp_fluxes_byband, only: ty_fluxes_byband_ccpp @@ -27,14 +27,15 @@ subroutine rrtmgp_lw_calculate_fluxes_run(num_diag_subcycles, icall, ncol, pverp integer, intent(in) :: ktopcam ! Index in host model arrays of top level (layer or interface) at which RRTMGP is active integer, intent(in) :: ktoprad ! Index in RRTMGP array corresponding to top layer or interface of host model arrays logical, intent(in) :: active_calls(:) ! Logical array of flags for whether a specified subcycle is active + logical, intent(in) :: dolw ! Flag for whether to perform longwave calculation type(ty_fluxes_byband_ccpp), intent(in) :: flw ! Longwave all-sky flux object type(ty_fluxes_broadband_ccpp), intent(in) :: flwc ! Longwave clear-sky flux object ! Output variables - real(kind_phys), intent(out) :: fnl(:,:) ! Longwave net radiative flux [W m-2] - real(kind_phys), intent(out) :: fcnl(:,:) ! Longwave net radiative clear-sky flux [W m-2] - real(kind_phys), intent(out) :: flns(:) ! Longwave net upward flux at surface [W m-2] - real(kind_phys), intent(out) :: flnt(:) ! Longwave net outgoing flux at model top [W m-2] - real(kind_phys), intent(out) :: flwds(:) ! Longwave downward radiative flux at surface [W m-2] + real(kind_phys), intent(inout) :: fnl(:,:) ! Longwave net radiative flux [W m-2] + real(kind_phys), intent(inout) :: fcnl(:,:) ! Longwave net radiative clear-sky flux [W m-2] + real(kind_phys), intent(inout) :: flns(:) ! Longwave net upward flux at surface [W m-2] + real(kind_phys), intent(inout) :: flnt(:) ! Longwave net outgoing flux at model top [W m-2] + real(kind_phys), intent(inout) :: flwds(:) ! Longwave downward radiative flux at surface [W m-2] ! CCPP error handling variables @@ -47,6 +48,11 @@ subroutine rrtmgp_lw_calculate_fluxes_run(num_diag_subcycles, icall, ncol, pverp errmsg = '' errflg = 0 + ! Persist fluxes from the last radiation timestep in non-radiation timesteps: + if (.not. dolw) then + return + end if + diag_index = num_diag_subcycles - icall + 1 ! Don't do anything if this subcycle is inactive diff --git a/schemes/rrtmgp/rrtmgp_lw_calculate_fluxes.meta b/schemes/rrtmgp/rrtmgp_lw_calculate_fluxes.meta index 99cdaad43..4fe6167c1 100644 --- a/schemes/rrtmgp/rrtmgp_lw_calculate_fluxes.meta +++ b/schemes/rrtmgp/rrtmgp_lw_calculate_fluxes.meta @@ -53,6 +53,12 @@ type = logical dimensions = (number_of_diagnostic_subcycles) intent = in +[ dolw ] + standard_name = do_longwave_radiation + units = flag + type = logical + dimensions = () + intent = in [ flw ] standard_name = longwave_all_sky_flux_object_for_RRTMGP units = none @@ -70,31 +76,31 @@ units = W m-2 type = real | kind = kind_phys dimensions = (horizontal_loop_extent) - intent = out + intent = inout [ flnt ] standard_name = longwave_net_outgoing_flux_at_model_top units = W m-2 type = real | kind = kind_phys dimensions = (horizontal_loop_extent) - intent = out + intent = inout [ flwds ] standard_name = longwave_downward_radiative_flux_at_surface_to_coupler units = W m-2 type = real | kind = kind_phys dimensions = (horizontal_loop_extent) - intent = out + intent = inout [ fnl ] standard_name = longwave_net_radiative_flux units = W m-2 type = real | kind = kind_phys dimensions = (horizontal_loop_extent, vertical_interface_dimension) - intent = out + intent = inout [ fcnl ] standard_name = longwave_net_radiative_clear_sky_flux units = W m-2 type = real | kind = kind_phys dimensions = (horizontal_loop_extent, vertical_interface_dimension) - intent = out + intent = inout [ errmsg ] standard_name = ccpp_error_message units = none diff --git a/schemes/rrtmgp/rrtmgp_sw_calculate_fluxes.F90 b/schemes/rrtmgp/rrtmgp_sw_calculate_fluxes.F90 index 83f374532..25a65488a 100644 --- a/schemes/rrtmgp/rrtmgp_sw_calculate_fluxes.F90 +++ b/schemes/rrtmgp/rrtmgp_sw_calculate_fluxes.F90 @@ -12,7 +12,7 @@ module rrtmgp_sw_calculate_fluxes !> \section arg_table_rrtmgp_sw_calculate_fluxes_run Argument Table !! \htmlinclude rrtmgp_sw_calculate_fluxes_run.html subroutine rrtmgp_sw_calculate_fluxes_run(num_diag_subcycles, icall, ncol, pverp, nlay, nday, idxday, ktopcam, ktoprad, & - active_calls, fsw, fswc, fns, fcns, fsns, fsnt, soll, sols, solld, solsd, errmsg, errflg) + active_calls, dosw, fsw, fswc, fns, fcns, fsns, fsnt, soll, sols, solld, solsd, errmsg, errflg) use ccpp_fluxes, only: ty_fluxes_broadband_ccpp use ccpp_fluxes_byband, only: ty_fluxes_byband_ccpp @@ -29,17 +29,18 @@ subroutine rrtmgp_sw_calculate_fluxes_run(num_diag_subcycles, icall, ncol, pverp integer, intent(in) :: ktoprad ! Index in RRTMGP array corresponding to top layer or interface of host model arrays integer, intent(in) :: idxday(:) ! Daytime points indices logical, intent(in) :: active_calls(:) ! Logical array of flags for whether a specified subcycle is active + logical, intent(in) :: dosw ! Flag for whether to perform shortwave calculation type(ty_fluxes_byband_ccpp), intent(in) :: fsw ! Shortwave all-sky flux object type(ty_fluxes_broadband_ccpp), intent(in) :: fswc ! Shortwave clear-sky flux object ! Output variables - real(kind_phys), intent(out) :: fns(:,:) ! Shortwave net radiative flux [W m-2] - real(kind_phys), intent(out) :: fcns(:,:) ! Shortwave net radiative clear-sky flux [W m-2] - real(kind_phys), intent(out) :: fsns(:) ! Shortwave net upward flux at surface [W m-2] - real(kind_phys), intent(out) :: fsnt(:) ! Shortwave net outgoing flux at model top [W m-2] - real(kind_phys), intent(out) :: soll(:) ! Direct solar radiative flux at surface >= 700nm [W m-2] - real(kind_phys), intent(out) :: sols(:) ! Direct solar radiative flux at surface < 700nm [W m-2] - real(kind_phys), intent(out) :: solld(:) ! Diffuse solar radiative flux at surface >= 700nm [W m-2] - real(kind_phys), intent(out) :: solsd(:) ! Diffuse solar radiative flux at surface < 700nm [W m-2] + real(kind_phys), intent(inout) :: fns(:,:) ! Shortwave net radiative flux [W m-2] + real(kind_phys), intent(inout) :: fcns(:,:) ! Shortwave net radiative clear-sky flux [W m-2] + real(kind_phys), intent(inout) :: fsns(:) ! Shortwave net upward flux at surface [W m-2] + real(kind_phys), intent(inout) :: fsnt(:) ! Shortwave net outgoing flux at model top [W m-2] + real(kind_phys), intent(inout) :: soll(:) ! Direct solar radiative flux at surface >= 700nm [W m-2] + real(kind_phys), intent(inout) :: sols(:) ! Direct solar radiative flux at surface < 700nm [W m-2] + real(kind_phys), intent(inout) :: solld(:) ! Diffuse solar radiative flux at surface >= 700nm [W m-2] + real(kind_phys), intent(inout) :: solsd(:) ! Diffuse solar radiative flux at surface < 700nm [W m-2] ! CCPP error handling variables @@ -55,6 +56,11 @@ subroutine rrtmgp_sw_calculate_fluxes_run(num_diag_subcycles, icall, ncol, pverp errmsg = '' errflg = 0 + ! Persist fluxes from the last radiation timestep in non-radiation timesteps: + if (.not. dosw) then + return + end if + diag_index = num_diag_subcycles - icall + 1 ! Don't do anything if this subcycle is inactive diff --git a/schemes/rrtmgp/rrtmgp_sw_calculate_fluxes.meta b/schemes/rrtmgp/rrtmgp_sw_calculate_fluxes.meta index 709d48ec8..14e50f3ed 100644 --- a/schemes/rrtmgp/rrtmgp_sw_calculate_fluxes.meta +++ b/schemes/rrtmgp/rrtmgp_sw_calculate_fluxes.meta @@ -65,6 +65,12 @@ type = logical dimensions = (number_of_diagnostic_subcycles) intent = in +[ dosw ] + standard_name = do_shortwave_radiation + units = flag + type = logical + dimensions = () + intent = in [ fsw ] standard_name = shortwave_all_sky_flux_object_for_RRTMGP units = none @@ -82,49 +88,49 @@ units = W m-2 type = real | kind = kind_phys dimensions = (horizontal_loop_extent, vertical_interface_dimension) - intent = out + intent = inout [ fcns ] standard_name = shortwave_net_radiative_clear_sky_flux units = W m-2 type = real | kind = kind_phys dimensions = (horizontal_loop_extent, vertical_interface_dimension) - intent = out + intent = inout [ fsns ] standard_name = shortwave_net_upward_flux_at_surface units = W m-2 type = real | kind = kind_phys dimensions = (horizontal_loop_extent) - intent = out + intent = inout [ fsnt ] standard_name = shortwave_net_outgoing_flux_at_model_top units = W m-2 type = real | kind = kind_phys dimensions = (horizontal_loop_extent) - intent = out + intent = inout [ soll ] standard_name = direct_solar_radiative_flux_at_surface_ge_700nm_to_coupler units = W m-2 type = real | kind = kind_phys dimensions = (horizontal_loop_extent) - intent = out + intent = inout [ sols ] standard_name = direct_solar_radiative_flux_at_surface_lt_700nm_to_coupler units = W m-2 type = real | kind = kind_phys dimensions = (horizontal_loop_extent) - intent = out + intent = inout [ solld ] standard_name = diffuse_solar_radiative_flux_at_surface_ge_700nm_to_coupler units = W m-2 type = real | kind = kind_phys dimensions = (horizontal_loop_extent) - intent = out + intent = inout [ solsd ] standard_name = diffuse_solar_radiative_flux_at_surface_lt_700nm_to_coupler units = W m-2 type = real | kind = kind_phys dimensions = (horizontal_loop_extent) - intent = out + intent = inout [ errmsg ] standard_name = ccpp_error_message units = none