Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add YOG precipitation to diagnostics and coupler #35

Draft
wants to merge 1 commit into
base: CAM-ML
Choose a base branch
from
Draft
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
17 changes: 17 additions & 0 deletions src/physics/cam/cam_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ module cam_diagnostics
character(len=8) :: diag_cnst_conv_tend = 'q_only' ! output constituent tendencies due to convection
! 'none', 'q_only' or 'all'

character(len=16) :: yog_scheme ! Is YOG scheme in use to provide precipitation

integer, parameter :: surf_100000 = 1
integer, parameter :: surf_092500 = 2
integer, parameter :: surf_085000 = 3
Expand Down Expand Up @@ -92,6 +94,7 @@ module cam_diagnostics

integer :: prec_dp_idx = 0
integer :: snow_dp_idx = 0
integer :: prec_yog_idx = 0
integer :: prec_sh_idx = 0
integer :: snow_sh_idx = 0
integer :: prec_sed_idx = 0
Expand Down Expand Up @@ -710,6 +713,11 @@ subroutine diag_init_moist(pbuf2d)
snow_sed_idx = pbuf_get_index('SNOW_SED', errcode=ierr)
prec_pcw_idx = pbuf_get_index('PREC_PCW', errcode=ierr)
snow_pcw_idx = pbuf_get_index('SNOW_PCW', errcode=ierr)
! Check if we are using YOG scheme and create prec variable if neccessary.
call phys_getopts(yog_scheme_out = yog_scheme)
if (yog_scheme == 'on') then
prec_yog_idx = pbuf_get_index('PREC_YOG', errcode=ierr)
end if

if (is_first_step()) then
call pbuf_set_field(pbuf2d, trefmxav_idx, -1.0e36_r8)
Expand Down Expand Up @@ -1507,6 +1515,7 @@ subroutine diag_conv(state, ztodt, pbuf)
! convective precipitation variables
real(r8), pointer :: prec_dp(:) ! total precipitation from ZM convection
real(r8), pointer :: snow_dp(:) ! snow from ZM convection
real(r8), pointer :: prec_yog(:) ! total precipitation from YOG convection
real(r8), pointer :: prec_sh(:) ! total precipitation from Hack convection
real(r8), pointer :: snow_sh(:) ! snow from Hack convection
real(r8), pointer :: prec_sed(:) ! total precipitation from ZM convection
Expand Down Expand Up @@ -1543,6 +1552,11 @@ subroutine diag_conv(state, ztodt, pbuf)
else
nullify(snow_dp)
end if
if (prec_yog_idx > 0) then
call pbuf_get_field(pbuf, prec_yog_idx, prec_yog)
else
nullify(prec_yog)
end if
if (prec_sh_idx > 0) then
call pbuf_get_field(pbuf, prec_sh_idx, prec_sh)
else
Expand Down Expand Up @@ -1584,6 +1598,9 @@ subroutine diag_conv(state, ztodt, pbuf)
else
precc(:ncol) = 0._r8
end if
if (associated(prec_yog)) then
precc(:ncol) = precc(:ncol) + prec_yog(:ncol)
end if
if (associated(prec_sed) .and. associated(prec_pcw)) then
precl(:ncol) = prec_sed(:ncol) + prec_pcw(:ncol)
else if (associated(prec_sed)) then
Expand Down
14 changes: 7 additions & 7 deletions src/physics/cam/yog_intr.F90
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ subroutine yog_init()
call addfld ('YOGDQ ', (/ 'lev' /), 'A', 'kg/kg/s','Q tendency - Yuval-OGorman moist convection')
call addfld ('YOGDICE', (/ 'lev' /), 'A', 'kg/kg/s','Cloud ice tendency - Yuval-OGorman convection')
call addfld ('YOGDLIQ', (/ 'lev' /), 'A', 'kg/kg/s','Cloud liq tendency - Yuval-OGorman convection')
call addfld ('YOGPREC', horiz_only , 'A', 'm/s','Surface preciptation - Yuval-OGorman convection')
call addfld ('PREC_YOG', horiz_only , 'A', 'm/s','Surface preciptation - Yuval-OGorman convection')
if (masterproc) then
write(iulog,*)'YOG output fields added to buffer'
end if
Expand All @@ -126,11 +126,11 @@ subroutine yog_init()
history_budget_histfile_num_out = history_budget_histfile_num)

if ( history_budget ) then
call add_default('YOGDT ', history_budget_histfile_num, ' ')
call add_default('YOGDQ ', history_budget_histfile_num, ' ')
call add_default('YOGDICE', history_budget_histfile_num, ' ')
call add_default('YOGDLIQ', history_budget_histfile_num, ' ')
call add_default('YOGPREC', history_budget_histfile_num, ' ')
call add_default('YOGDT ' , history_budget_histfile_num, ' ')
call add_default('YOGDQ ' , history_budget_histfile_num, ' ')
call add_default('YOGDICE' , history_budget_histfile_num, ' ')
call add_default('YOGDLIQ' , history_budget_histfile_num, ' ')
call add_default('PREC_YOG', history_budget_histfile_num, ' ')
end if

call nn_convection_flux_CAM_init(yog_nn_weights, SAM_sounding)
Expand Down Expand Up @@ -224,7 +224,7 @@ subroutine yog_tend(ztodt, state, ptend)
call outfld('YOGDQ ',ptend%q(1,1,1) ,pcols ,lchnk )
call outfld('YOGDICE ',ptend%q(1,1,ixcldice) ,pcols ,lchnk )
call outfld('YOGDLIQ ',ptend%q(1,1,ixcldliq) ,pcols ,lchnk )
call outfld('YOGPREC ',yog_precsfc ,pcols ,lchnk )
call outfld('PREC_YOG',yog_precsfc ,pcols ,lchnk )
end subroutine yog_tend

!=========================================================================================
Expand Down