Skip to content

Commit

Permalink
Implement switching options with all using the existing scheme at pre…
Browse files Browse the repository at this point in the history
…sent.
  • Loading branch information
jatkinson1000 committed Jun 17, 2024
1 parent e31f407 commit d5e10b8
Showing 1 changed file with 32 additions and 12 deletions.
44 changes: 32 additions & 12 deletions src/physics/cam/gw_drag.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d5e10b8

Please sign in to comment.