Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions schemes/zhang_mcfarlane/zm_prepare_flux_for_check_energy.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
! Prepare flux variables for energy checker after ZM deep convection
! Has to run after both zm_convr (provides reserved liquid)
! and zm_conv_evap+interstitial to deep (provides snow_dp and prec_dp) have
! been ran.
! The resulting net liquid and (lwe) ice fluxes are combined and provided to
! the check_energy_chng CCPPized scheme.
module zm_prepare_flux_for_check_energy
implicit none
private

public :: zm_prepare_flux_for_check_energy_run

contains

!> \section arg_table_zm_prepare_flux_for_check_energy_run Argument Table
!! \htmlinclude zm_prepare_flux_for_check_energy_run.html
subroutine zm_prepare_flux_for_check_energy_run( &
ncol, &
prec_dp, rliq, snow_dp, &
scheme_name, &
flx_cnd, flx_ice, &
errmsg, errflg)

use ccpp_kinds, only: kind_phys

! Input arguments
integer, intent(in) :: ncol
real(kind_phys), intent(in) :: prec_dp(:) ! Deep convection precipitation rate [m s-1]
real(kind_phys), intent(in) :: rliq(:) ! Reserved liquid water tendency [m s-1]
real(kind_phys), intent(in) :: snow_dp(:) ! Deep convection frozen precipitation rate [m s-1]

! Output arguments
character(len=16), intent(out) :: scheme_name ! Scheme name for energy checking
real(kind_phys), intent(out) :: flx_cnd(:) ! Liquid fluxes [m s-1]
real(kind_phys), intent(out) :: flx_ice(:) ! Ice fluxes [m s-1]
character(len=512), intent(out) :: errmsg
integer, intent(out) :: errflg

! Local variables
integer :: i

errmsg = ''
errflg = 0

! Set scheme name for energy checking
scheme_name = "convect_deep_zm"

! Combine precipitation and reserved liquid for total liquid+ice flux
! This represents net liquid and ice fluxes through column boundaries
flx_cnd(:ncol) = prec_dp(:ncol) + rliq(:ncol)
Copy link
Copy Markdown
Collaborator

@nusbaume nusbaume Sep 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realize this is copying exactly what is in CAM, but is this actually the correct equation? If flx_cnd is supposed to be the total liquid+ice flux, and the reserved condensate values are considered "flux", then shouldn't this equation actually be:

Suggested change
flx_cnd(:ncol) = prec_dp(:ncol) + rliq(:ncol)
flx_cnd(:ncol) = prec_dp(:ncol) + rliq(:ncol) + rice(:ncol)

I am guessing this is actually a question for @PeterHjortLauritzen and/or @swrneale.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rice has now been removed from ZM and throughout CAM


! Frozen precipitation represents net ice fluxes through column boundaries
flx_ice(:ncol) = snow_dp(:ncol)

end subroutine zm_prepare_flux_for_check_energy_run

end module zm_prepare_flux_for_check_energy
61 changes: 61 additions & 0 deletions schemes/zhang_mcfarlane/zm_prepare_flux_for_check_energy.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[ccpp-table-properties]
name = zm_prepare_flux_for_check_energy
type = scheme

[ccpp-arg-table]
name = zm_prepare_flux_for_check_energy_run
type = scheme
[ ncol ]
standard_name = horizontal_loop_extent
units = count
type = integer
dimensions = ()
intent = in
[ prec_dp ]
standard_name = lwe_precipitation_rate_at_surface_due_to_deep_convection
units = m s-1
type = real | kind = kind_phys
dimensions = (horizontal_loop_extent)
intent = in
[ rliq ]
standard_name = vertically_integrated_cloud_liquid_water_tendency_due_to_all_convection_to_be_applied_later_in_time_loop
units = m s-1
type = real | kind = kind_phys
dimensions = (horizontal_loop_extent)
intent = in
[ snow_dp ]
standard_name = lwe_frozen_precipitation_rate_at_surface_due_to_deep_convection
units = m s-1
type = real | kind = kind_phys
dimensions = (horizontal_loop_extent)
intent = in
[ scheme_name ]
standard_name = scheme_name
units = none
type = character | kind = len=16
dimensions = ()
intent = out
[ flx_cnd ]
standard_name = net_liquid_and_lwe_ice_fluxes_through_top_and_bottom_of_atmosphere_column
units = m s-1
type = real | kind = kind_phys
dimensions = (horizontal_loop_extent)
intent = out
[ flx_ice ]
standard_name = net_lwe_ice_fluxes_through_top_and_bottom_of_atmosphere_column
units = m s-1
type = real | kind = kind_phys
dimensions = (horizontal_loop_extent)
intent = out
[ errmsg ]
standard_name = ccpp_error_message
units = none
type = character | kind = len=512
dimensions = ()
intent = out
[ errflg ]
standard_name = ccpp_error_code
units = 1
type = integer
dimensions = ()
intent = out
1 change: 1 addition & 0 deletions suites/suite_cam4.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
<scheme>zm_diagnostics</scheme>

<!-- Check that energy and water change matches the boundary fluxes -->
<scheme>zm_prepare_flux_for_check_energy</scheme>
<scheme>check_energy_scaling</scheme>
<scheme>check_energy_chng</scheme>

Expand Down
2 changes: 2 additions & 0 deletions suites/suite_cam7.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<scheme>geopotential_temp</scheme>

<!-- Zhang McFarlane (convect_deep) -->
<scheme>check_energy_zero_fluxes</scheme>
<scheme>zm_conv_options</scheme>
<scheme>zm_convr</scheme>
<scheme>zm_convr_tendency_diagnostics</scheme>
Expand Down Expand Up @@ -71,6 +72,7 @@
<scheme>zm_diagnostics</scheme>

<!-- Check that energy and water change matches the boundary fluxes -->
<scheme>zm_prepare_flux_for_check_energy</scheme>
<scheme>check_energy_scaling</scheme>
<scheme>check_energy_chng</scheme>

Expand Down
Loading