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

HR4 Gravity Wave Drag Update #207

Merged
merged 14 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
1,217 changes: 1,217 additions & 0 deletions physics/GWD/drag_suite.F90

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions physics/GWD/drag_suite.meta
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,13 @@
type = real
kind = kind_phys
intent = in
[vtype]
standard_name = vegetation_type_classification
long_name = vegetation type for lsm
units = index
dimensions = (horizontal_loop_extent)
type = integer
intent = in
[g]
standard_name = gravitational_acceleration
long_name = gravitational acceleration
Expand Down Expand Up @@ -573,6 +580,14 @@
dimensions = ()
type = logical
intent = in
[psl_gwd_dx_factor]
standard_name = effective_grid_spacing_of_psl_gwd_suite
long_name = multiplication of grid spacing
units = count
grantfirl marked this conversation as resolved.
Show resolved Hide resolved
dimensions = ()
type = real
kind = kind_phys
intent = in
[dtend]
standard_name = cumulative_change_of_state_variables
long_name = diagnostic tendencies for state variables
Expand Down
37 changes: 32 additions & 5 deletions physics/GWD/ugwpv1_gsldrag.F90
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ module ugwpv1_gsldrag
use cires_ugwpv1_solv2, only: cires_ugwpv1_ngw_solv2
use cires_ugwpv1_oro, only: orogw_v1

use drag_suite, only: drag_suite_run
use drag_suite, only: drag_suite_run, drag_suite_psl
Copy link
Collaborator

Choose a reason for hiding this comment

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

I see what happened now. This is a bad example to follow.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Agree, the drag_suite_psl should be called inside the drag_suite_run


implicit none

Expand Down Expand Up @@ -305,11 +305,13 @@ end subroutine ugwpv1_gsldrag_finalize
!! @{
subroutine ugwpv1_gsldrag_run(me, master, im, levs, ak, bk, ntrac, lonr, dtp, &
fhzero, kdt, ldiag3d, lssav, flag_for_gwd_generic_tend, do_gsl_drag_ls_bl, &
do_gsl_drag_ss, do_gsl_drag_tofd, do_ugwp_v1, do_ugwp_v1_orog_only, &
do_gsl_drag_ss, do_gsl_drag_tofd, &
do_gwd_opt_psl, psl_gwd_dx_factor, &
do_ugwp_v1, do_ugwp_v1_orog_only, &
do_ugwp_v1_w_gsldrag, gwd_opt, do_tofd, ldiag_ugwp, ugwp_seq_update, &
cdmbgwd, jdat, nmtvr, hprime, oc, theta, sigma, gamma, &
elvmax, clx, oa4, varss,oc1ss,oa4ss,ol4ss, dx, xlat, xlat_d, sinlat, coslat, &
area, rain, br1, hpbl, kpbl, slmsk, &
area, rain, br1, hpbl,vtype, kpbl, slmsk, &
ugrs, vgrs, tgrs, q1, prsi, prsl, prslk, phii, phil, del, tau_amf, &
dudt_ogw, dvdt_ogw, du_ogwcol, dv_ogwcol, &
dudt_obl, dvdt_obl, du_oblcol, dv_oblcol, &
Expand Down Expand Up @@ -367,7 +369,9 @@ subroutine ugwpv1_gsldrag_run(me, master, im, levs, ak, bk, ntrac, lonr, dtp,
real(kind=kind_phys), intent(in) :: dtp, fhzero
real(kind=kind_phys), intent(in) :: ak(:), bk(:)
integer, intent(in) :: kdt, jdat(:)

! option for psl gwd
logical, intent(in) :: do_gwd_opt_psl ! option for psl gravity wave drag
real(kind=kind_phys), intent(in) :: psl_gwd_dx_factor !
! SSO parameters and variables
integer, intent(in) :: gwd_opt !gwd_opt and nmtvr are "redundant" controls
integer, intent(in) :: nmtvr
Expand Down Expand Up @@ -396,6 +400,7 @@ subroutine ugwpv1_gsldrag_run(me, master, im, levs, ak, bk, ntrac, lonr, dtp,
real(kind=kind_phys), intent(in), dimension(:,:) :: prsi, phii
real(kind=kind_phys), intent(in), dimension(:,:) :: q1
integer, intent(in), dimension(:) :: kpbl
integer, intent(in), dimension(:) :: vtype

real(kind=kind_phys), intent(in), dimension(:) :: rain
real(kind=kind_phys), intent(in), dimension(:) :: br1, hpbl, slmsk
Expand Down Expand Up @@ -544,6 +549,27 @@ subroutine ugwpv1_gsldrag_run(me, master, im, levs, ak, bk, ntrac, lonr, dtp,
! dusfcg, dvsfcg
!
!
if (do_gwd_opt_psl) then
call drag_suite_psl(im, levs, Pdvdt, Pdudt, Pdtdt, &
ugrs,vgrs,tgrs,q1, &
kpbl,prsi,del,prsl,prslk,phii,phil,dtp, &
kdt,hprime,oc,oa4,clx,varss,oc1ss,oa4ss, &
ol4ss,theta,sigma,gamma,elvmax, &
dudt_ogw, dvdt_ogw, dudt_obl, dvdt_obl, &
dudt_oss, dvdt_oss, dudt_ofd, dvdt_ofd, &
dusfcg, dvsfcg, &
du_ogwcol, dv_ogwcol, du_oblcol, dv_oblcol, &
du_osscol, dv_osscol, du_ofdcol, dv_ofdcol, &
slmsk,br1,hpbl,vtype,con_g,con_cp,con_rd,con_rv, &
con_fv, con_pi, lonr, &
cdmbgwd(1:2),me,master,lprnt,ipr,rdxzb,dx,gwd_opt, &
do_gsl_drag_ls_bl,do_gsl_drag_ss,do_gsl_drag_tofd, &
psl_gwd_dx_factor, &
dtend, dtidx, index_of_process_orographic_gwd, &
index_of_temperature, index_of_x_wind, &
index_of_y_wind, ldiag3d, ldiag_ugwp, &
ugwp_seq_update, spp_wts_gwd, spp_gwd, errmsg, errflg)
else
call drag_suite_run(im, levs, Pdvdt, Pdudt, Pdtdt, &
ugrs,vgrs,tgrs,q1, &
kpbl,prsi,del,prsl,prslk,phii,phil,dtp, &
Expand All @@ -554,14 +580,15 @@ subroutine ugwpv1_gsldrag_run(me, master, im, levs, ak, bk, ntrac, lonr, dtp,
dusfcg, dvsfcg, &
du_ogwcol, dv_ogwcol, du_oblcol, dv_oblcol, &
du_osscol, dv_osscol, du_ofdcol, dv_ofdcol, &
slmsk,br1,hpbl, con_g,con_cp,con_rd,con_rv, &
slmsk,br1,hpbl,con_g,con_cp,con_rd,con_rv, &
con_fv, con_pi, lonr, &
cdmbgwd(1:2),me,master,lprnt,ipr,rdxzb,dx,gwd_opt, &
do_gsl_drag_ls_bl,do_gsl_drag_ss,do_gsl_drag_tofd, &
dtend, dtidx, index_of_process_orographic_gwd, &
index_of_temperature, index_of_x_wind, &
index_of_y_wind, ldiag3d, ldiag_ugwp, &
ugwp_seq_update, spp_wts_gwd, spp_gwd, errmsg, errflg)
endif
!
! dusfcg = du_ogwcol + du_oblcol + du_osscol + du_ofdcol
!
Expand Down
22 changes: 22 additions & 0 deletions physics/GWD/ugwpv1_gsldrag.meta
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,21 @@
dimensions = ()
type = logical
intent = in
[do_gwd_opt_psl]
standard_name = do_gsl_drag_suite_with_psl_gwd_option
long_name = flag to activate PSL drag suite - mesoscale GWD and blocking
units = flag
dimensions = ()
type = logical
intent = in
[psl_gwd_dx_factor]
standard_name = effective_grid_spacing_of_psl_gwd_suite
long_name = multiplication of grid spacing
units = count
grantfirl marked this conversation as resolved.
Show resolved Hide resolved
dimensions = ()
type = real
kind = kind_phys
intent = in
[do_ugwp_v1]
standard_name = flag_for_ugwp_version_1
long_name = flag to activate ver 1 CIRES UGWP
Expand Down Expand Up @@ -641,6 +656,13 @@
type = real
kind = kind_phys
intent = in
[vtype]
standard_name = vegetation_type_classification
long_name = vegetation type for lsm
units = index
dimensions = (horizontal_loop_extent)
type = integer
intent = in
[kpbl]
standard_name = vertical_index_at_top_of_atmosphere_boundary_layer
long_name = vertical index at top atmospheric boundary layer
Expand Down
36 changes: 31 additions & 5 deletions physics/GWD/unified_ugwp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module unified_ugwp
use gwdps, only: gwdps_run
use cires_ugwp_triggers
use ugwp_driver_v0
use drag_suite, only: drag_suite_run
use drag_suite, only: drag_suite_run, drag_suite_psl

implicit none

Expand Down Expand Up @@ -249,11 +249,11 @@ subroutine unified_ugwp_run(me, master, im, levs, ak,bk, ntrac, dtp, fhzero, kdt
varss,oc1ss,oa4ss,ol4ss,dx,dusfc_ms,dvsfc_ms,dusfc_bl,dvsfc_bl,dusfc_ss, &
dvsfc_ss,dusfc_fd,dvsfc_fd,dtaux2d_ms,dtauy2d_ms,dtaux2d_bl,dtauy2d_bl, &
dtaux2d_ss,dtauy2d_ss,dtaux2d_fd,dtauy2d_fd,dudt_ngw,dvdt_ngw,dtdt_ngw, &
br1,hpbl,slmsk, do_tofd, ldiag_ugwp, ugwp_seq_update, &
br1,hpbl,vtype,slmsk, do_tofd, ldiag_ugwp, ugwp_seq_update, &
cdmbgwd, jdat, xlat, xlat_d, sinlat, coslat, area, &
ugrs, vgrs, tgrs, q1, prsi, prsl, prslk, phii, phil, &
del, kpbl, dusfcg, dvsfcg, gw_dudt, gw_dvdt, gw_dtdt, gw_kdis, &
tau_tofd, tau_mtb, tau_ogw, tau_ngw, &
tau_tofd, tau_mtb, tau_ogw, tau_ngw, zmtb, zlwb, zogw, &
dudt_mtb, dudt_tms, du3dt_mtb, du3dt_ogw, du3dt_tms, &
dudt, dvdt, dtdt, rdxzb, con_g, con_omega, con_pi, con_cp, con_rd, con_rv, &
con_rerth, con_fvirt, rain, ntke, q_tke, dqdt_tke, lprnt, ipr, &
Expand All @@ -262,6 +262,7 @@ subroutine unified_ugwp_run(me, master, im, levs, ak,bk, ntrac, dtp, fhzero, kdt
index_of_process_nonorographic_gwd, &
lssav, flag_for_gwd_generic_tend, do_ugwp_v0, do_ugwp_v0_orog_only, &
do_ugwp_v0_nst_only, do_gsl_drag_ls_bl, do_gsl_drag_ss, do_gsl_drag_tofd, &
do_gwd_opt_psl, psl_gwd_dx_factor, &
gwd_opt, spp_wts_gwd, spp_gwd, errmsg, errflg)

implicit none
Expand All @@ -270,6 +271,7 @@ subroutine unified_ugwp_run(me, master, im, levs, ak,bk, ntrac, dtp, fhzero, kdt
integer, intent(in) :: me, master, im, levs, ntrac, kdt, lonr, nmtvr
integer, intent(in) :: gwd_opt
integer, intent(in), dimension(:) :: kpbl
integer, intent(in), dimension(:) :: vtype
real(kind=kind_phys), intent(in), dimension(:) :: ak, bk
real(kind=kind_phys), intent(in), dimension(:) :: oro, oro_uf, hprime, oc, theta, sigma, gamma
real(kind=kind_phys), intent(in), dimension(:) :: varss,oc1ss, dx
Expand Down Expand Up @@ -309,7 +311,7 @@ subroutine unified_ugwp_run(me, master, im, levs, ak,bk, ntrac, dtp, fhzero, kdt
& slmsk(:)

real(kind=kind_phys), intent(out), dimension(:) :: dusfcg, dvsfcg
real(kind=kind_phys), intent(out), dimension(:) :: rdxzb
real(kind=kind_phys), intent(out), dimension(:) :: zmtb, zlwb, zogw, rdxzb
grantfirl marked this conversation as resolved.
Show resolved Hide resolved
real(kind=kind_phys), intent(out), dimension(:) :: tau_mtb, tau_ogw, tau_tofd, tau_ngw
real(kind=kind_phys), intent(out), dimension(:,:) :: gw_dudt, gw_dvdt, gw_dtdt, gw_kdis
real(kind=kind_phys), intent(out), dimension(:,:) :: dudt_mtb, dudt_tms
Expand Down Expand Up @@ -345,6 +347,10 @@ subroutine unified_ugwp_run(me, master, im, levs, ak,bk, ntrac, dtp, fhzero, kdt
real(kind=kind_phys), intent(in) :: spp_wts_gwd(:,:)
integer, intent(in) :: spp_gwd

! option for psl gwd
logical, intent(in) :: do_gwd_opt_psl ! option for psl gravity wave drag
real(kind=kind_phys), intent(in) :: psl_gwd_dx_factor !

character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg

Expand Down Expand Up @@ -487,7 +493,26 @@ subroutine unified_ugwp_run(me, master, im, levs, ak,bk, ntrac, dtp, fhzero, kdt
! Note: In case of GSL drag_suite, this includes ss and tofd

if ( do_gsl_drag_ls_bl.or.do_gsl_drag_ss.or.do_gsl_drag_tofd ) then

!
if (do_gwd_opt_psl) then
grantfirl marked this conversation as resolved.
Show resolved Hide resolved
call drag_suite_psl(im,levs,dvdt,dudt,dtdt,uwnd1,vwnd1, &
tgrs,q1,kpbl,prsi,del,prsl,prslk,phii,phil,dtp, &
kdt,hprime,oc,oa4,clx,varss,oc1ss,oa4ss, &
ol4ss,theta,sigma,gamma,elvmax,dtaux2d_ms, &
dtauy2d_ms,dtaux2d_bl,dtauy2d_bl,dtaux2d_ss, &
dtauy2d_ss,dtaux2d_fd,dtauy2d_fd,dusfcg, &
dvsfcg,dusfc_ms,dvsfc_ms,dusfc_bl,dvsfc_bl, &
dusfc_ss,dvsfc_ss,dusfc_fd,dvsfc_fd, &
slmsk,br1,hpbl,vtype,con_g,con_cp,con_rd,con_rv, &
con_fvirt,con_pi,lonr, &
cdmbgwd,me,master,lprnt,ipr,rdxzb,dx,gwd_opt, &
do_gsl_drag_ls_bl,do_gsl_drag_ss,do_gsl_drag_tofd, &
psl_gwd_dx_factor, &
dtend, dtidx, index_of_process_orographic_gwd, &
index_of_temperature, index_of_x_wind, &
index_of_y_wind, ldiag3d, ldiag_ugwp, &
ugwp_seq_update, spp_wts_gwd, spp_gwd, errmsg, errflg)
else
call drag_suite_run(im,levs,dvdt,dudt,dtdt,uwnd1,vwnd1, &
tgrs,q1,kpbl,prsi,del,prsl,prslk,phii,phil,dtp, &
kdt,hprime,oc,oa4,clx,varss,oc1ss,oa4ss, &
Expand All @@ -504,6 +529,7 @@ subroutine unified_ugwp_run(me, master, im, levs, ak,bk, ntrac, dtp, fhzero, kdt
index_of_temperature, index_of_x_wind, &
index_of_y_wind, ldiag3d, ldiag_ugwp, &
ugwp_seq_update, spp_wts_gwd, spp_gwd, errmsg, errflg)
endif
!
! put zeros due to xy GSL-drag style: dtaux2d_bl,dtauy2d_bl,dtaux2d_ss.......dusfc_ms,dvsfc_ms
!
Expand Down
46 changes: 46 additions & 0 deletions physics/GWD/unified_ugwp.meta
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,13 @@
type = real
kind = kind_phys
intent = in
[vtype]
standard_name = vegetation_type_classification
long_name = vegetation type for lsm
units = index
dimensions = (horizontal_loop_extent)
type = integer
intent = in
[slmsk]
standard_name = area_type
long_name = landmask: sea/land/ice=0/1/2
Expand Down Expand Up @@ -900,6 +907,30 @@
type = real
kind = kind_phys
intent = out
[zmtb]
standard_name = height_of_mountain_blocking
long_name = height of mountain blocking drag
units = m
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
intent = out
[zlwb]
standard_name = height_of_low_level_wave_breaking
long_name = height of low level wave breaking
units = m
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
intent = out
[zogw]
standard_name = height_of_launch_level_of_orographic_gravity_wave
long_name = height of launch level of orographic gravity wave
units = m
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
intent = out
[dudt_mtb]
standard_name = instantaneous_change_in_x_wind_due_to_mountain_blocking_drag
long_name = instantaneous change in x wind due to mountain blocking drag
Expand Down Expand Up @@ -1194,6 +1225,21 @@
dimensions = ()
type = logical
intent = in
[do_gwd_opt_psl]
standard_name = do_gsl_drag_suite_with_psl_gwd_option
long_name = flag to activate PSL drag suite - mesoscale GWD and blocking
units = flag
dimensions = ()
type = logical
intent = in
[psl_gwd_dx_factor]
standard_name = effective_grid_spacing_of_psl_gwd_suite
long_name = multiplication of grid spacing
units = count
grantfirl marked this conversation as resolved.
Show resolved Hide resolved
dimensions = ()
type = real
kind = kind_phys
intent = in
[gwd_opt]
standard_name = control_for_drag_suite_gravity_wave_drag
long_name = flag to choose gwd scheme
Expand Down
Loading