diff --git a/src/physics/cam/gw_drag.F90 b/src/physics/cam/gw_drag.F90 index 51c6a3de3e..f04f35b8a9 100644 --- a/src/physics/cam/gw_drag.F90 +++ b/src/physics/cam/gw_drag.F90 @@ -1482,18 +1482,38 @@ subroutine gw_tend(state, pbuf, dt, ptend, cam_in, flx_heat) effgw = 0._r8 end where - ! Determine wave sources for Beres deep scheme - call gw_beres_src(ncol, band_mid, beres_dp_desc, & - u, v, ttend_dp(:ncol,:), zm, src_level, tend_level, tau, & - ubm, ubi, xv, yv, c, hdepth, maxq0) - - ! Solve for the drag profile with Beres source spectrum. - call gw_drag_prof(ncol, band_mid, p, src_level, tend_level, dt, & - t, vramp, & - piln, rhoi, nm, ni, ubm, ubi, xv, yv, & - effgw, c, kvtt, q, dse, tau, utgw, vtgw, & - ttgw, qtgw, egwdffi, gwut, dttdf, dttke, & - lapply_effgw_in=gw_apply_tndmax) + if ((gw_convect_dp_ml == 'off') .or. (gw_convect_dp_ml == 'bothoff') .or. (gw_convect_dp_ml == 'bothon')) then + ! Determine wave sources for Beres deep scheme + call gw_beres_src(ncol, band_mid, beres_dp_desc, & + u, v, ttend_dp(:ncol,:), zm, src_level, tend_level, tau, & + ubm, ubi, xv, yv, c, hdepth, maxq0) + + ! Solve for the drag profile with Beres source spectrum. + call gw_drag_prof(ncol, band_mid, p, src_level, tend_level, dt, & + t, vramp, & + piln, rhoi, nm, ni, ubm, ubi, xv, yv, & + effgw, c, kvtt, q, dse, tau, utgw, vtgw, & + ttgw, qtgw, egwdffi, gwut, dttdf, dttke, & + lapply_effgw_in=gw_apply_tndmax) + end if + if ((gw_convect_dp_ml == 'on') .or. (gw_convect_dp_ml == 'bothoff') .or. (gw_convect_dp_ml == 'bothon')) then + ! Solve for the drag profile with Beres source spectrum. + ! Placeholder for ML scheme + if (masterproc) then + write(iulog,*) "Using the ML scheme for convective gravity waves." + end if + ! Determine wave sources for Beres deep scheme + call gw_beres_src(ncol, band_mid, beres_dp_desc, & + u, v, ttend_dp(:ncol,:), zm, src_level, tend_level, tau, & + ubm, ubi, xv, yv, c, hdepth, maxq0) + + call gw_drag_prof(ncol, band_mid, p, src_level, tend_level, dt, & + t, vramp, & + piln, rhoi, nm, ni, ubm, ubi, xv, yv, & + effgw, c, kvtt, q, dse, tau, utgw, vtgw, & + ttgw, qtgw, egwdffi, gwut, dttdf, dttke, & + lapply_effgw_in=gw_apply_tndmax) + end if ! Project stress into directional components. taucd = calc_taucd(ncol, band_mid%ngwv, tend_level, tau, c, xv, yv, ubi)