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

Random fixes for HR4 GWD update #3

Merged
merged 3 commits into from
Jun 3, 2024
Merged
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
77 changes: 38 additions & 39 deletions physics/GWD/drag_suite.F90
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,6 @@ subroutine drag_suite_run( &
real(kind=kind_phys),parameter :: olmin = 1.0e-5
real(kind=kind_phys),parameter :: odmin = 0.1
real(kind=kind_phys),parameter :: odmax = 10.
real(kind=kind_phys),parameter :: erad = 6371.315e+3
integer :: komax(im)
integer :: kblk
real(kind=kind_phys) :: cd
Expand Down Expand Up @@ -1552,7 +1551,7 @@ subroutine drag_suite_psl( &
integer, parameter :: ims=1, kms=1, its=1, kts=1
real(kind=kind_phys), intent(in) :: fv, pi
real(kind=kind_phys) :: rcl, cdmb
real(kind=kind_phys) :: g_inv, g_cp
real(kind=kind_phys) :: g_inv, g_cp, rd_inv

real(kind=kind_phys), intent(inout) :: &
& dudt(:,:),dvdt(:,:), &
Expand Down Expand Up @@ -1736,7 +1735,6 @@ subroutine drag_suite_psl( &
real(kind=kind_phys),parameter :: odmin = 0.1
real(kind=kind_phys),parameter :: odmax = 10.
real(kind=kind_phys),parameter :: cdmin = 0.0
real(kind=kind_phys),parameter :: erad = 6371.315e+3
integer :: komax(im),kbmax(im),kblk(im)
real(kind=kind_phys) :: hmax(im)
real(kind=kind_phys) :: cd
Expand Down Expand Up @@ -1808,43 +1806,43 @@ subroutine drag_suite_psl( &
endif
enddo

! Remove ss_tapering
ss_taper(:) = 1.
! Remove ss_tapering
ss_taper(:) = 1.

! SPP, if spp_gwd is 0, no perturbations are applied.
if ( spp_gwd==1 ) then
do i = its,im
var_stoch(i) = var(i) + var(i)*0.75*spp_wts_gwd(i,1)
varss_stoch(i) = varss(i) + varss(i)*0.75*spp_wts_gwd(i,1)
varmax_ss_stoch(i) = varmax_ss + varmax_ss*0.75*spp_wts_gwd(i,1)
varmax_fd_stoch(i) = varmax_fd + varmax_fd*0.75*spp_wts_gwd(i,1)
enddo
else
do i = its,im
var_stoch(i) = var(i)
varss_stoch(i) = varss(i)
varmax_ss_stoch(i) = varmax_ss
varmax_fd_stoch(i) = varmax_fd
enddo
endif
! SPP, if spp_gwd is 0, no perturbations are applied.
if ( spp_gwd==1 ) then
do i = its,im
var_stoch(i) = var(i) + var(i)*0.75*spp_wts_gwd(i,1)
varss_stoch(i) = varss(i) + varss(i)*0.75*spp_wts_gwd(i,1)
varmax_ss_stoch(i) = varmax_ss + varmax_ss*0.75*spp_wts_gwd(i,1)
varmax_fd_stoch(i) = varmax_fd + varmax_fd*0.75*spp_wts_gwd(i,1)
enddo
else
do i = its,im
var_stoch(i) = var(i)
varss_stoch(i) = varss(i)
varmax_ss_stoch(i) = varmax_ss
varmax_fd_stoch(i) = varmax_fd
enddo
endif

!--- calculate length of grid for flow-blocking drag
!
do i=1,im
delx = dx(i)
dely = dx(i)
dxy4(i,1) = delx
dxy4(i,2) = dely
dxy4(i,3) = sqrt(delx*delx + dely*dely)
dxy4(i,4) = dxy4(i,3)
dxy4p(i,1) = dxy4(i,2)
dxy4p(i,2) = dxy4(i,1)
dxy4p(i,3) = dxy4(i,4)
dxy4p(i,4) = dxy4(i,3)
cleff(i) = psl_gwd_dx_factor*(delx+dely)*0.5
cleff_ss(i) = 0.1 * max(dxmax_ss,dxy4(i,3))
! cleff_ss(i) = cleff(i) ! consider .....
enddo
!--- calculate length of grid for flow-blocking drag
!
do i=1,im
delx = dx(i)
dely = dx(i)
dxy4(i,1) = delx
dxy4(i,2) = dely
dxy4(i,3) = sqrt(delx*delx + dely*dely)
dxy4(i,4) = dxy4(i,3)
dxy4p(i,1) = dxy4(i,2)
dxy4p(i,2) = dxy4(i,1)
dxy4p(i,3) = dxy4(i,4)
dxy4p(i,4) = dxy4(i,3)
cleff(i) = psl_gwd_dx_factor*(delx+dely)*0.5
cleff_ss(i) = 0.1 * max(dxmax_ss,dxy4(i,3))
! cleff_ss(i) = cleff(i) ! consider .....
enddo
!
!-----initialize arrays
!
Expand Down Expand Up @@ -1928,11 +1926,12 @@ subroutine drag_suite_psl( &
kbmax(1:im) = 0
kblk(1:im) = 0
!
rd_inv = 1./rd
do k = kts,km
do i = its,im
vtj(i,k) = t1(i,k) * (1.+fv*q1(i,k))
vtk(i,k) = vtj(i,k) / prslk(i,k)
ro(i,k) = 1./rd * prsl(i,k) / vtj(i,k) ! density kg/m**3
ro(i,k) = rd_inv * prsl(i,k) / vtj(i,k) ! density kg/m**3
enddo
enddo
!
Expand Down
17 changes: 1 addition & 16 deletions physics/GWD/drag_suite.meta
Original file line number Diff line number Diff line change
Expand Up @@ -458,13 +458,6 @@
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 @@ -531,7 +524,7 @@
[alpha_fd]
standard_name = alpha_coefficient_for_turbulent_orographic_form_drag
long_name = alpha coefficient for Beljaars et al turbulent orographic form drag
units = none
units = 1
dimensions = ()
type = real
kind = kind_phys
Expand Down Expand Up @@ -608,14 +601,6 @@
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 = 1
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
2 changes: 1 addition & 1 deletion physics/GWD/ugwpv1_gsldrag.meta
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@
[alpha_fd]
standard_name = alpha_coefficient_for_turbulent_orographic_form_drag
long_name = alpha coefficient for Beljaars et al turbulent orographic form drag
units = none
units = 1
dimensions = ()
type = real
kind = kind_phys
Expand Down
16 changes: 14 additions & 2 deletions physics/GWD/unified_ugwp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ subroutine unified_ugwp_run(me, master, im, levs, ak,bk, ntrac, dtp, fhzero, kdt
cdmbgwd, alpha_fd, 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, zmtb, zlwb, zogw, &
tau_tofd, tau_mtb, tau_ogw, tau_ngw, &
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 Down Expand Up @@ -311,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(:) :: zmtb, zlwb, zogw, rdxzb
real(kind=kind_phys), intent(out), dimension(:) :: rdxzb
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 @@ -385,6 +385,18 @@ subroutine unified_ugwp_run(me, master, im, levs, ak,bk, ntrac, dtp, fhzero, kdt
errflg = 0


! Initialize intent(out) variables in case they are not set below
dusfcg(:) = 0.0
dvsfcg(:) = 0.0
rdxzb(:) = 0.0
tau_ngw(:) = 0.0
gw_dudt(:,:) = 0.0
gw_dvdt(:,:) = 0.0
gw_dtdt(:,:) = 0.0
gw_kdis(:,:) = 0.0
dudt_mtb(:,:) = 0.0
dudt_tms(:,:) = 0.0

! 1) ORO stationary GWs
! ------------------

Expand Down
26 changes: 1 addition & 25 deletions physics/GWD/unified_ugwp.meta
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@
[alpha_fd]
standard_name = alpha_coefficient_for_turbulent_orographic_form_drag
long_name = alpha coefficient for Beljaars et al turbulent orographic form drag
units = none
units = 1
dimensions = ()
type = real
kind = kind_phys
Expand Down Expand Up @@ -938,30 +938,6 @@
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
2 changes: 2 additions & 0 deletions physics/SFC_Models/Land/Noahmp/module_sf_noahmplsm.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2020,6 +2020,8 @@ subroutine energy (parameters,ice ,vegtyp ,ist ,nsnow ,nsoil , & !in
chuc = 0.
chv2 = 0.
rb = 0.
laisun = 0.
laisha = 0.

cdmnv = 0.0
ezpdv = 0.0
Expand Down
2 changes: 1 addition & 1 deletion physics/SFC_Models/Land/Noahmp/noahmpdrv.F90
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ subroutine noahmpdrv_run &
sncovr1, qsurf, gflux, drain, evap, hflx, ep, runoff, &
cmm, chh, evbs, evcw, sbsno, pah, ecan, etran, edir, snowc,&
stm, snohf,smcwlt2, smcref2, wet1, t2mmp, q2mp,zvfun, &
ztmax, rca, errmsg, errflg, &
ztmax, rca, errmsg, errflg, &
canopy_heat_storage_ccpp, &
rainfall_ccpp, &
sw_absorbed_total_ccpp, &
Expand Down
2 changes: 1 addition & 1 deletion physics/SFC_Models/Land/Noahmp/noahmpdrv.meta
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@
[gwd_z0m_factor]
standard_name = momentum_roughness_factor_in_turbulent_form_drag
long_name = multiplication of orograhic standard deviation
units = count
units = 1
dimensions = ()
type = real
kind = kind_phys
Expand Down