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

compiling all 3 GW suites #6

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
57 changes: 52 additions & 5 deletions physics/cires_orowam2017.f
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ subroutine oro_wam_2017(im, levs,npt,ipt, kref,kdt,me,master,
& sinlat, xlatd, taup, taud, pkdis)
!
USE MACHINE , ONLY : kind_phys
use ugwp_common , only : grav, omega2
use ugwp_common_v0 , only : grav, omega2
!
implicit none

Expand Down Expand Up @@ -121,7 +121,7 @@ subroutine oro_wam_2017(im, levs,npt,ipt, kref,kdt,me,master,
taub_kx(1:nw) = tau_kx(1:nw) * taub(i)
wkdis(:,:) = kedmin

call oro_meanflow(levs, nzi, u1(j,:), v1(j,:), t1(j,:),
call oro_meanflow_v0(levs, nzi, u1(j,:), v1(j,:), t1(j,:),
& prsi(j,:), prsL(j,:), del(j,:), rho(i,:),
& bn2(i,:), uzi, rhoi,ktur, kalp,dzi,
& xn(i), yn(i))
Expand Down Expand Up @@ -275,10 +275,10 @@ end subroutine oro_wam_2017
! define mean flow and dissipation for OGW-kx spectrum
!
!-------------------------------------------------------------
subroutine oro_meanflow(nz, nzi, u1, v1, t1, pint, pmid,
subroutine oro_meanflow_v0(nz, nzi, u1, v1, t1, pint, pmid,
& delp, rho, bn2, uzi, rhoi, ktur, kalp, dzi, xn, yn)

use ugwp_common , only : grav, rgrav, rdi, velmin, dw2min
use ugwp_common_v0 , only : grav, rgrav, rdi, velmin, dw2min
implicit none

integer :: nz, nzi
Expand Down Expand Up @@ -336,4 +336,51 @@ subroutine oro_meanflow(nz, nzi, u1, v1, t1, pint, pmid,
rhoi(k) = rhoi(k-1)*.5
dzi(k) = dzi(k-1)

end subroutine oro_meanflow
end subroutine oro_meanflow_v0

subroutine ugwpv0_tofd1d(levs, sigflt, elvmax, zsurf,
& zpbl, u, v, zmid, utofd, vtofd, epstofd, krf_tofd)
use machine , only : kind_phys
use ugwp_common_v0 , only : rcpd2
use ugwpv0_oro_init, only : n_tofd, const_tofd, ze_tofd
use ugwpv0_oro_init, only : a12_tofd, ztop_tofd
!
implicit none
integer :: levs
real(kind_phys), dimension(levs) :: u, v, zmid
real(kind_phys) :: sigflt, elvmax, zpbl, zsurf
real(kind_phys), dimension(levs) :: utofd, vtofd
real(kind_phys), dimension(levs) :: epstofd, krf_tofd
!
! locals
!
integer :: i, k
real(kind_phys) :: sghmax = 5.
real(kind_phys) :: sgh2, ekin, zdec, rzdec, umag, zmet
real(kind_phys) :: zarg, ztexp, krf
!
utofd =0.0 ; vtofd = 0.0
epstofd =0.0 ; krf_tofd =0.0
!
zdec = max(n_tofd*sigflt, zpbl) ! ntimes*sgh_turb or Zpbl
zdec = min(ze_tofd, zdec) ! cannot exceed 18 km
rzdec = 1.0/zdec
sgh2 = max(sigflt*sigflt, sghmax*sghmax) ! 25 meters dz-of the first layer

do k=1, levs
zmet = zmid(k)-zsurf
if (zmet > ztop_tofd) cycle
ekin = u(k)*u(k) + v(k)*v(k)
umag = sqrt(ekin)
zarg = zmet*rzdec
ztexp = exp(-zarg*sqrt(zarg))
krf = const_tofd* a12_tofd *sgh2* zmet ** (-1.2) *ztexp

utofd(k) = -krf*u(k)
vtofd(k) = -krf*v(k)
epstofd(k) = rcpd2*krf*ekin ! more accurate heat/mom form using "implicit tend-solver"
! to update momentum and temp-re; epstofd(k) can be skipped
krf_tofd(k) = krf
enddo
!
end subroutine ugwpv0_tofd1d
29 changes: 4 additions & 25 deletions physics/cires_ugwp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module cires_ugwp

use machine, only: kind_phys

use cires_ugwp_module, only: knob_ugwp_version, cires_ugwp_mod_init, cires_ugwp_mod_finalize
use cires_ugwpv0_module, only: knob_ugwp_version, cires_ugwpv0_mod_init, cires_ugwpv0_mod_finalize

use gwdps, only: gwdps_run

Expand Down Expand Up @@ -77,7 +77,7 @@ subroutine cires_ugwp_init (me, master, nlunit, input_nml_file, logunit, &
if (is_initialized) return

if (do_ugwp .or. cdmbgwd(3) > 0.0) then
call cires_ugwp_mod_init (me, master, nlunit, input_nml_file, logunit, &
call cires_ugwpv0_mod_init (me, master, nlunit, input_nml_file, logunit, &
fn_nml2, lonr, latr, levs, ak, bk, con_p0, dtp, &
cdmbgwd(1:2), cgwf, pa_rf_in, tau_rf_in)
else
Expand Down Expand Up @@ -120,7 +120,7 @@ subroutine cires_ugwp_finalize(errmsg, errflg)

if (.not.is_initialized) return

call cires_ugwp_mod_finalize()
call cires_ugwpv0_mod_finalize()

is_initialized = .false.

Expand Down Expand Up @@ -293,7 +293,7 @@ subroutine cires_ugwp_run(do_ugwp, me, master, im, levs, ntrac, dtp, kdt, lonr
if (cdmbgwd(3) > 0.0) then

! 2) non-stationary GW-scheme with GMAO/MERRA GW-forcing
call slat_geos5_tamp(im, tamp_mpa, xlat_d, tau_ngw)
call slat_geos5_tamp_v0(im, tamp_mpa, xlat_d, tau_ngw)

if (abs(1.0-cdmbgwd(3)) > 1.0e-6) then
if (cdmbgwd(4) > 0.0) then
Expand Down Expand Up @@ -365,27 +365,6 @@ subroutine cires_ugwp_run(do_ugwp, me, master, im, levs, ntrac, dtp, kdt, lonr
dudt_mtb = 0. ; dudt_ogw = 0. ; dudt_tms = 0.
endif

#if 0
!=============================================================================
! make "ugwp eddy-diffusion" update for gw_dtdt/gw_dudt/gw_dvdt by solving
! vert diffusion equations & update "Statein%tgrs, Statein%ugrs, Statein%vgrs"
!=============================================================================
! 3) application of "eddy"-diffusion to "smooth" UGWP-related tendencies
!------------------------------------------------------------------------------
do k=1,levs
do i=1,im
ed_dudt(i,k) = 0.0 ; ed_dvdt(i,k) = 0.0 ; ed_dtdt(i,k) = 0.0
enddo
enddo

call edmix_ugwp_v0(im, levs, dtp, tgrs, ugrs, vgrs, qgrs(:,:,1), &
del, prsl, prsi, phil, prslk, gw_dudt, gw_dvdt, gw_dtdt, gw_kdis, &
ed_dudt, ed_dvdt, ed_dtdt, me, master, kdt)
gw_dtdt = gw_dtdt*(1.-pked) + ed_dtdt*pked
gw_dvdt = gw_dvdt*(1.-pked) + ed_dvdt*pked
gw_dudt = gw_dudt*(1.-pked) + ed_dudt*pked
#endif

if(ldiag3d .and. lssav .and. .not. flag_for_gwd_generic_tend) then
do k=1,levs
do i=1,im
Expand Down
5 changes: 3 additions & 2 deletions physics/cires_ugwp.meta
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[ccpp-table-properties]
name = cires_ugwp
type = scheme
# DH* 20200804 - this is a result of the nasty hack to call gwdps from within ugwp!
dependencies = cires_ugwp_triggers.F90,cires_ugwp_initialize.F90,cires_ugwp_solvers.F90,cires_ugwp_utils.F90,cires_orowam2017.f,cires_vert_lsatdis.F90,cires_vert_orodis.F90,cires_vert_wmsdis.F90,cires_ugwp_module.F90,gwdps.f,machine.F,ugwp_driver_v0.F
# DH* 20200804 - this is a result of the nasty hack to call gwdps from within ugwp-v0!
dependencies=cires_ugwp_triggers.F90,cires_ugwp_initialize.F90
dependencies=cires_orowam2017.f, cires_ugwp_module.F90,gwdps.f,machine.F,ugwp_driver_v0.F

########################################################################
[ccpp-arg-table]
Expand Down
Loading