Skip to content

Commit 702918e

Browse files
jimmielinHaipeng Linhplin-ucar
authored
Persist LW/SW fluxes across non-radiation timesteps (ESCOMP#426)
Tag name (The PR title should also include the tag name): Originator(s): @jimmielin Description (include issue title and the keyword ['closes', 'fixes', 'resolves'] and issue number): - Companion PR to ESCOMP/CAM-SIMA#527 - Persists LW/SW fluxes even in non-radiation timesteps consistent with CAM - Fixes standard name (missing `_to_coupler`) from post-interstitial List all namelist files that were added or changed: List all files eliminated and why: List all files added and what they do: List all existing files that have been modified, and describe the changes: (Helpful git command: `git diff --name-status main...<your_branch_name>`) ``` M schemes/rrtmgp/rrtmgp_lw_calculate_fluxes.F90 M schemes/rrtmgp/rrtmgp_lw_calculate_fluxes.meta M schemes/rrtmgp/rrtmgp_sw_calculate_fluxes.F90 M schemes/rrtmgp/rrtmgp_sw_calculate_fluxes.meta - Persists LW/SW fluxes even in non-radiation timesteps consistent with CAM M schemes/rrtmgp/rrtmgp_post.meta - add _to_coupler suffix to standard name to pass the fluxes to the coupler. ``` List all automated tests that failed, as well as an explanation for why they weren't fixed: Is this an answer-changing PR? If so, is it a new physics package, algorithm change, tuning change, etc? If yes to the above question, describe how this code was validated with the new/modified features: --------- Co-authored-by: Haipeng Lin <hplin+github@ucar.edu> Co-authored-by: Haipeng Lin <hplin@ucar.edu>
1 parent d3dcffa commit 702918e

5 files changed

Lines changed: 55 additions & 31 deletions

File tree

schemes/rrtmgp/rrtmgp_lw_calculate_fluxes.F90

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module rrtmgp_lw_calculate_fluxes
1212
!> \section arg_table_rrtmgp_lw_calculate_fluxes_run Argument Table
1313
!! \htmlinclude rrtmgp_lw_calculate_fluxes_run.html
1414
subroutine rrtmgp_lw_calculate_fluxes_run(num_diag_subcycles, icall, ncol, pverp, nlay, ktopcam, ktoprad, &
15-
active_calls, flw, flwc, flns, flnt, flwds, fnl, fcnl, errmsg, errflg)
15+
active_calls, dolw, flw, flwc, flns, flnt, flwds, fnl, fcnl, errmsg, errflg)
1616

1717
use ccpp_fluxes, only: ty_fluxes_broadband_ccpp
1818
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
2727
integer, intent(in) :: ktopcam ! Index in host model arrays of top level (layer or interface) at which RRTMGP is active
2828
integer, intent(in) :: ktoprad ! Index in RRTMGP array corresponding to top layer or interface of host model arrays
2929
logical, intent(in) :: active_calls(:) ! Logical array of flags for whether a specified subcycle is active
30+
logical, intent(in) :: dolw ! Flag for whether to perform longwave calculation
3031
type(ty_fluxes_byband_ccpp), intent(in) :: flw ! Longwave all-sky flux object
3132
type(ty_fluxes_broadband_ccpp), intent(in) :: flwc ! Longwave clear-sky flux object
3233
! Output variables
33-
real(kind_phys), intent(out) :: fnl(:,:) ! Longwave net radiative flux [W m-2]
34-
real(kind_phys), intent(out) :: fcnl(:,:) ! Longwave net radiative clear-sky flux [W m-2]
35-
real(kind_phys), intent(out) :: flns(:) ! Longwave net upward flux at surface [W m-2]
36-
real(kind_phys), intent(out) :: flnt(:) ! Longwave net outgoing flux at model top [W m-2]
37-
real(kind_phys), intent(out) :: flwds(:) ! Longwave downward radiative flux at surface [W m-2]
34+
real(kind_phys), intent(inout) :: fnl(:,:) ! Longwave net radiative flux [W m-2]
35+
real(kind_phys), intent(inout) :: fcnl(:,:) ! Longwave net radiative clear-sky flux [W m-2]
36+
real(kind_phys), intent(inout) :: flns(:) ! Longwave net upward flux at surface [W m-2]
37+
real(kind_phys), intent(inout) :: flnt(:) ! Longwave net outgoing flux at model top [W m-2]
38+
real(kind_phys), intent(inout) :: flwds(:) ! Longwave downward radiative flux at surface [W m-2]
3839

3940

4041
! CCPP error handling variables
@@ -47,6 +48,11 @@ subroutine rrtmgp_lw_calculate_fluxes_run(num_diag_subcycles, icall, ncol, pverp
4748
errmsg = ''
4849
errflg = 0
4950

51+
! Persist fluxes from the last radiation timestep in non-radiation timesteps:
52+
if (.not. dolw) then
53+
return
54+
end if
55+
5056
diag_index = num_diag_subcycles - icall + 1
5157

5258
! Don't do anything if this subcycle is inactive

schemes/rrtmgp/rrtmgp_lw_calculate_fluxes.meta

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@
5353
type = logical
5454
dimensions = (number_of_diagnostic_subcycles)
5555
intent = in
56+
[ dolw ]
57+
standard_name = do_longwave_radiation
58+
units = flag
59+
type = logical
60+
dimensions = ()
61+
intent = in
5662
[ flw ]
5763
standard_name = longwave_all_sky_flux_object_for_RRTMGP
5864
units = none
@@ -70,31 +76,31 @@
7076
units = W m-2
7177
type = real | kind = kind_phys
7278
dimensions = (horizontal_loop_extent)
73-
intent = out
79+
intent = inout
7480
[ flnt ]
7581
standard_name = longwave_net_outgoing_flux_at_model_top
7682
units = W m-2
7783
type = real | kind = kind_phys
7884
dimensions = (horizontal_loop_extent)
79-
intent = out
85+
intent = inout
8086
[ flwds ]
81-
standard_name = longwave_downward_radiative_flux_at_surface
87+
standard_name = longwave_downward_radiative_flux_at_surface_to_coupler
8288
units = W m-2
8389
type = real | kind = kind_phys
8490
dimensions = (horizontal_loop_extent)
85-
intent = out
91+
intent = inout
8692
[ fnl ]
8793
standard_name = longwave_net_radiative_flux
8894
units = W m-2
8995
type = real | kind = kind_phys
9096
dimensions = (horizontal_loop_extent, vertical_interface_dimension)
91-
intent = out
97+
intent = inout
9298
[ fcnl ]
9399
standard_name = longwave_net_radiative_clear_sky_flux
94100
units = W m-2
95101
type = real | kind = kind_phys
96102
dimensions = (horizontal_loop_extent, vertical_interface_dimension)
97-
intent = out
103+
intent = inout
98104
[ errmsg ]
99105
standard_name = ccpp_error_message
100106
units = none

schemes/rrtmgp/rrtmgp_post.meta

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
dimensions = ()
109109
intent = inout
110110
[ flwds ]
111-
standard_name = longwave_downward_radiative_flux_at_surface
111+
standard_name = longwave_downward_radiative_flux_at_surface_to_coupler
112112
units = W m-2
113113
type = real | kind = kind_phys
114114
dimensions = (horizontal_loop_extent)
@@ -126,7 +126,7 @@
126126
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
127127
intent = out
128128
[ netsw ]
129-
standard_name = net_shortwave_flux_at_surface
129+
standard_name = net_shortwave_flux_at_surface_to_coupler
130130
units = W m-2
131131
type = real | kind = kind_phys
132132
dimensions = (horizontal_loop_extent)

schemes/rrtmgp/rrtmgp_sw_calculate_fluxes.F90

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module rrtmgp_sw_calculate_fluxes
1212
!> \section arg_table_rrtmgp_sw_calculate_fluxes_run Argument Table
1313
!! \htmlinclude rrtmgp_sw_calculate_fluxes_run.html
1414
subroutine rrtmgp_sw_calculate_fluxes_run(num_diag_subcycles, icall, ncol, pverp, nlay, nday, idxday, ktopcam, ktoprad, &
15-
active_calls, fsw, fswc, fns, fcns, fsns, fsnt, soll, sols, solld, solsd, errmsg, errflg)
15+
active_calls, dosw, fsw, fswc, fns, fcns, fsns, fsnt, soll, sols, solld, solsd, errmsg, errflg)
1616

1717
use ccpp_fluxes, only: ty_fluxes_broadband_ccpp
1818
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
2929
integer, intent(in) :: ktoprad ! Index in RRTMGP array corresponding to top layer or interface of host model arrays
3030
integer, intent(in) :: idxday(:) ! Daytime points indices
3131
logical, intent(in) :: active_calls(:) ! Logical array of flags for whether a specified subcycle is active
32+
logical, intent(in) :: dosw ! Flag for whether to perform shortwave calculation
3233
type(ty_fluxes_byband_ccpp), intent(in) :: fsw ! Shortwave all-sky flux object
3334
type(ty_fluxes_broadband_ccpp), intent(in) :: fswc ! Shortwave clear-sky flux object
3435
! Output variables
35-
real(kind_phys), intent(out) :: fns(:,:) ! Shortwave net radiative flux [W m-2]
36-
real(kind_phys), intent(out) :: fcns(:,:) ! Shortwave net radiative clear-sky flux [W m-2]
37-
real(kind_phys), intent(out) :: fsns(:) ! Shortwave net upward flux at surface [W m-2]
38-
real(kind_phys), intent(out) :: fsnt(:) ! Shortwave net outgoing flux at model top [W m-2]
39-
real(kind_phys), intent(out) :: soll(:) ! Direct solar radiative flux at surface >= 700nm [W m-2]
40-
real(kind_phys), intent(out) :: sols(:) ! Direct solar radiative flux at surface < 700nm [W m-2]
41-
real(kind_phys), intent(out) :: solld(:) ! Diffuse solar radiative flux at surface >= 700nm [W m-2]
42-
real(kind_phys), intent(out) :: solsd(:) ! Diffuse solar radiative flux at surface < 700nm [W m-2]
36+
real(kind_phys), intent(inout) :: fns(:,:) ! Shortwave net radiative flux [W m-2]
37+
real(kind_phys), intent(inout) :: fcns(:,:) ! Shortwave net radiative clear-sky flux [W m-2]
38+
real(kind_phys), intent(inout) :: fsns(:) ! Shortwave net upward flux at surface [W m-2]
39+
real(kind_phys), intent(inout) :: fsnt(:) ! Shortwave net outgoing flux at model top [W m-2]
40+
real(kind_phys), intent(inout) :: soll(:) ! Direct solar radiative flux at surface >= 700nm [W m-2]
41+
real(kind_phys), intent(inout) :: sols(:) ! Direct solar radiative flux at surface < 700nm [W m-2]
42+
real(kind_phys), intent(inout) :: solld(:) ! Diffuse solar radiative flux at surface >= 700nm [W m-2]
43+
real(kind_phys), intent(inout) :: solsd(:) ! Diffuse solar radiative flux at surface < 700nm [W m-2]
4344

4445

4546
! CCPP error handling variables
@@ -55,6 +56,11 @@ subroutine rrtmgp_sw_calculate_fluxes_run(num_diag_subcycles, icall, ncol, pverp
5556
errmsg = ''
5657
errflg = 0
5758

59+
! Persist fluxes from the last radiation timestep in non-radiation timesteps:
60+
if (.not. dosw) then
61+
return
62+
end if
63+
5864
diag_index = num_diag_subcycles - icall + 1
5965

6066
! Don't do anything if this subcycle is inactive

schemes/rrtmgp/rrtmgp_sw_calculate_fluxes.meta

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@
6565
type = logical
6666
dimensions = (number_of_diagnostic_subcycles)
6767
intent = in
68+
[ dosw ]
69+
standard_name = do_shortwave_radiation
70+
units = flag
71+
type = logical
72+
dimensions = ()
73+
intent = in
6874
[ fsw ]
6975
standard_name = shortwave_all_sky_flux_object_for_RRTMGP
7076
units = none
@@ -82,49 +88,49 @@
8288
units = W m-2
8389
type = real | kind = kind_phys
8490
dimensions = (horizontal_loop_extent, vertical_interface_dimension)
85-
intent = out
91+
intent = inout
8692
[ fcns ]
8793
standard_name = shortwave_net_radiative_clear_sky_flux
8894
units = W m-2
8995
type = real | kind = kind_phys
9096
dimensions = (horizontal_loop_extent, vertical_interface_dimension)
91-
intent = out
97+
intent = inout
9298
[ fsns ]
9399
standard_name = shortwave_net_upward_flux_at_surface
94100
units = W m-2
95101
type = real | kind = kind_phys
96102
dimensions = (horizontal_loop_extent)
97-
intent = out
103+
intent = inout
98104
[ fsnt ]
99105
standard_name = shortwave_net_outgoing_flux_at_model_top
100106
units = W m-2
101107
type = real | kind = kind_phys
102108
dimensions = (horizontal_loop_extent)
103-
intent = out
109+
intent = inout
104110
[ soll ]
105111
standard_name = direct_solar_radiative_flux_at_surface_ge_700nm_to_coupler
106112
units = W m-2
107113
type = real | kind = kind_phys
108114
dimensions = (horizontal_loop_extent)
109-
intent = out
115+
intent = inout
110116
[ sols ]
111117
standard_name = direct_solar_radiative_flux_at_surface_lt_700nm_to_coupler
112118
units = W m-2
113119
type = real | kind = kind_phys
114120
dimensions = (horizontal_loop_extent)
115-
intent = out
121+
intent = inout
116122
[ solld ]
117123
standard_name = diffuse_solar_radiative_flux_at_surface_ge_700nm_to_coupler
118124
units = W m-2
119125
type = real | kind = kind_phys
120126
dimensions = (horizontal_loop_extent)
121-
intent = out
127+
intent = inout
122128
[ solsd ]
123129
standard_name = diffuse_solar_radiative_flux_at_surface_lt_700nm_to_coupler
124130
units = W m-2
125131
type = real | kind = kind_phys
126132
dimensions = (horizontal_loop_extent)
127-
intent = out
133+
intent = inout
128134
[ errmsg ]
129135
standard_name = ccpp_error_message
130136
units = none

0 commit comments

Comments
 (0)