295 subroutine ugwpv1_gsldrag_run(me, master, im, levs, ak, bk, ntrac, lonr, dtp, &
296 kdt, ldiag3d, lssav, flag_for_gwd_generic_tend, do_gsl_drag_ls_bl, &
297 do_gsl_drag_ss, do_gsl_drag_tofd, &
298 do_gwd_opt_psl, psl_gwd_dx_factor, &
299 do_ngw_ec, do_ugwp_v1, do_ugwp_v1_orog_only, &
300 do_ugwp_v1_w_gsldrag, gwd_opt, do_tofd, ldiag_ugwp, ugwp_seq_update, &
301 cdmbgwd, alpha_fd, jdat, nmtvr, hprime, oc, theta, sigma, gamma, &
302 elvmax, clx, oa4, varss,oc1ss,oa4ss,ol4ss, dx, xlat, xlat_d, sinlat, coslat, &
303 area, rain, br1, hpbl,vtype, kpbl, slmsk, &
304 ugrs, vgrs, tgrs, q1, prsi, prsl, prslk, phii, phil, del, tau_amf, &
305 dudt_ogw, dvdt_ogw, du_ogwcol, dv_ogwcol, &
306 dudt_obl, dvdt_obl, du_oblcol, dv_oblcol, &
307 dudt_oss, dvdt_oss, du_osscol, dv_osscol, &
308 dudt_ofd, dvdt_ofd, du_ofdcol, dv_ofdcol, &
309 dudt_ngw, dvdt_ngw, dtdt_ngw, kdis_ngw, dudt_gw, dvdt_gw, dtdt_gw, kdis_gw, &
310 tau_ogw, tau_ngw, tau_oss, &
311 zogw, zlwb, zobl, zngw, dusfcg, dvsfcg, dudt, dvdt, dtdt, rdxzb, &
312 dtend, dtidx, index_of_x_wind, index_of_y_wind, index_of_temperature, &
313 index_of_process_orographic_gwd, index_of_process_nonorographic_gwd, &
314 lprnt, ipr, spp_wts_gwd, spp_gwd, errmsg, errflg)
325 use ugwp_common,
only : con_pi => pi, con_g => grav, con_rd => rd, &
326 con_rv => rv, con_cp => cpd, con_fv => fv, &
327 con_rerth => arad, con_omega => omega1, rgrav
341 logical,
intent(in) :: ldiag3d, lssav
342 logical,
intent(in) :: flag_for_gwd_generic_tend
343 logical,
intent(in) :: lprnt
345 integer,
intent(in) :: ipr
349 logical,
intent (in) :: do_gsl_drag_ls_bl, do_gsl_drag_ss, do_gsl_drag_tofd
350 logical,
intent (in) :: do_ugwp_v1, do_ngw_ec, do_ugwp_v1_orog_only, do_tofd
351 logical,
intent (in) :: ldiag_ugwp, ugwp_seq_update
352 logical,
intent (in) :: do_ugwp_v1_w_gsldrag
354 integer,
intent(in) :: me, master, im, levs, ntrac,lonr
355 real(kind=kind_phys),
intent(in) :: dtp
356 real(kind=kind_phys),
intent(in) :: ak(:), bk(:)
357 integer,
intent(in) :: kdt, jdat(:)
359 logical,
intent(in) :: do_gwd_opt_psl
360 real(kind=kind_phys),
intent(in) :: psl_gwd_dx_factor
362 integer,
intent(in) :: gwd_opt
363 integer,
intent(in) :: nmtvr
364 real(kind=kind_phys),
intent(in) :: cdmbgwd(:), alpha_fd
366 real(kind=kind_phys),
intent(in),
dimension(:) :: hprime, oc, theta, sigma, gamma
368 real(kind=kind_phys),
intent(in),
dimension(:) :: elvmax
369 real(kind=kind_phys),
intent(in),
dimension(:,:) :: clx, oa4
371 real(kind=kind_phys),
intent(in),
dimension(:) :: dx
372 real(kind=kind_phys),
intent(in),
dimension(:) :: varss,oc1ss
373 real(kind=kind_phys),
intent(in),
dimension(:,:) :: oa4ss,ol4ss
382 real(kind=kind_phys),
intent(in),
dimension(:) :: xlat, xlat_d, sinlat, coslat, area
386 real(kind=kind_phys),
intent(in),
dimension(:,:) :: del, ugrs, vgrs, tgrs, prsl, prslk, phil
387 real(kind=kind_phys),
intent(in),
dimension(:,:) :: prsi, phii
388 real(kind=kind_phys),
intent(in),
dimension(:,:) :: q1
389 integer,
intent(in),
dimension(:) :: kpbl
390 integer,
intent(in),
dimension(:) :: vtype
392 real(kind=kind_phys),
intent(in),
dimension(:) :: rain
393 real(kind=kind_phys),
intent(in),
dimension(:) :: br1, hpbl, slmsk
398 real(kind=kind_phys),
intent(in),
dimension(:) :: tau_amf
402 real(kind=kind_phys),
intent(out),
dimension(:) :: &
403 du_ogwcol, dv_ogwcol, du_oblcol, dv_oblcol, &
404 du_osscol, dv_osscol, du_ofdcol, dv_ofdcol
409 real(kind=kind_phys),
intent(out),
dimension(:) :: dusfcg, dvsfcg
410 real(kind=kind_phys),
intent(out),
dimension(:) :: tau_ogw, tau_ngw, tau_oss
412 real(kind=kind_phys),
intent(out) ,
dimension(:,:) :: &
413 dudt_ogw, dvdt_ogw, dudt_obl, dvdt_obl, &
414 dudt_oss, dvdt_oss, dudt_ofd, dvdt_ofd
416 real(kind=kind_phys),
intent(out) ,
dimension(:,:) :: dudt_ngw, dvdt_ngw, kdis_ngw, dtdt_ngw
417 real(kind=kind_phys),
intent(out) ,
dimension(:,:) :: dudt_gw, dvdt_gw, dtdt_gw, kdis_gw
419 real(kind=kind_phys),
intent(out) ,
dimension(:) :: zogw, zlwb, zobl, zngw
421 real(kind=kind_phys),
intent(inout),
dimension(:,:) :: dudt, dvdt, dtdt
423 real(kind=kind_phys),
intent(inout),
optional :: dtend(:,:,:)
424 integer,
intent(in) :: dtidx(:,:)
425 integer,
intent(in) :: &
426 index_of_x_wind, index_of_y_wind, index_of_temperature, &
427 index_of_process_orographic_gwd, index_of_process_nonorographic_gwd
429 real(kind=kind_phys),
intent(out),
dimension(:) :: rdxzb
431 real(kind=kind_phys),
intent(in),
optional :: spp_wts_gwd(:,:)
432 integer,
intent(in) :: spp_gwd
434 character(len=*),
intent(out) :: errmsg
435 integer,
intent(out) :: errflg
439 real(kind=kind_phys),
dimension(im) :: sgh30
440 real(kind=kind_phys),
dimension(im, levs) :: pdvdt, pdudt
441 real(kind=kind_phys),
dimension(im, levs) :: pdtdt, pkdis
455 real(kind=kind_phys),
dimension(im, levs) :: zmet
456 real(kind=kind_phys),
dimension(im, levs+1) :: zmeti
460 integer :: y4, month, day, ddd_ugwp, curdate, curday, idtend
486 if (do_ugwp_v1 .or. ldiag_ugwp)
then
487 dudt_ogw(:,:)= 0.; dvdt_ogw(:,:)=0.; dudt_obl(:,:)=0.; dvdt_obl(:,:)=0.
488 dudt_oss(:,:)= 0.; dvdt_oss(:,:)=0.; dudt_ofd(:,:)=0.; dvdt_ofd(:,:)=0.
489 du_ogwcol(:)=0. ; dv_ogwcol(:)=0. ; du_oblcol(:)=0. ; dv_oblcol(:)=0.
490 du_osscol(:)=0. ; dv_osscol(:)=0. ;du_ofdcol(:)=0. ; dv_ofdcol(:)=0.
491 dudt_ngw(:,:)=0.; dvdt_ngw(:,:)=0.; dtdt_ngw(:,:)=0.; kdis_ngw(:,:)=0.
496 dusfcg(:) = 0. ; dvsfcg(:) =0.
500 dudt_gw(:,:)=0. ; dvdt_gw(:,:)=0. ; dtdt_gw(:,:)=0. ; kdis_gw(:,:)=0.
503 tau_ogw(:)=0. ; tau_ngw(:)=0. ; tau_oss(:)=0.
507 zlwb(:)= 0. ; zogw(:)=0. ; zobl(:)=0. ; zngw(:)=0.
524 if ( do_gsl_drag_ls_bl.or.do_gsl_drag_ss.or.do_gsl_drag_tofd)
then
532 if (do_gwd_opt_psl)
then
533 call drag_suite_psl(im, levs, pdvdt, pdudt, pdtdt, &
535 kpbl,prsi,del,prsl,prslk,phii,phil,dtp, &
536 kdt,hprime,oc,oa4,clx,varss,oc1ss,oa4ss, &
537 ol4ss,theta,sigma,gamma,elvmax, &
538 dudt_ogw, dvdt_ogw, dudt_obl, dvdt_obl, &
539 dudt_oss, dvdt_oss, dudt_ofd, dvdt_ofd, &
541 du_ogwcol, dv_ogwcol, du_oblcol, dv_oblcol, &
542 du_osscol, dv_osscol, du_ofdcol, dv_ofdcol, &
543 slmsk,br1,hpbl,vtype,con_g,con_cp,con_rd,con_rv, &
544 con_fv, con_pi, lonr, &
545 cdmbgwd(1:2),alpha_fd,me,master, &
546 lprnt,ipr,rdxzb,dx,gwd_opt, &
547 do_gsl_drag_ls_bl,do_gsl_drag_ss,do_gsl_drag_tofd, &
549 dtend, dtidx, index_of_process_orographic_gwd, &
550 index_of_temperature, index_of_x_wind, &
551 index_of_y_wind, ldiag3d, ldiag_ugwp, &
552 ugwp_seq_update, spp_wts_gwd, spp_gwd, errmsg, errflg)
554 call drag_suite_run(im, levs, pdvdt, pdudt, pdtdt, &
556 kpbl,prsi,del,prsl,prslk,phii,phil,dtp, &
557 kdt,hprime,oc,oa4,clx,varss,oc1ss,oa4ss, &
558 ol4ss,theta,sigma,gamma,elvmax, &
559 dudt_ogw, dvdt_ogw, dudt_obl, dvdt_obl, &
560 dudt_oss, dvdt_oss, dudt_ofd, dvdt_ofd, &
562 du_ogwcol, dv_ogwcol, du_oblcol, dv_oblcol, &
563 du_osscol, dv_osscol, du_ofdcol, dv_ofdcol, &
564 slmsk,br1,hpbl,con_g,con_cp,con_rd,con_rv, &
565 con_fv, con_pi, lonr, &
566 cdmbgwd(1:2),alpha_fd,me,master, &
567 lprnt,ipr,rdxzb,dx,gwd_opt, &
568 do_gsl_drag_ls_bl,do_gsl_drag_ss,do_gsl_drag_tofd, &
569 dtend, dtidx, index_of_process_orographic_gwd, &
570 index_of_temperature, index_of_x_wind, &
571 index_of_y_wind, ldiag3d, ldiag_ugwp, &
572 ugwp_seq_update, spp_wts_gwd, spp_gwd, errmsg, errflg)
603 if ( do_ugwp_v1_orog_only )
then
612 if (gwd_opt ==1 )sgh30 = 0.15*hprime
613 if (gwd_opt >1 ) sgh30 = varss
615 call orogw_v1 (im, levs, lonr, me, master,dtp, kdt, do_tofd, &
616 xlat_d, sinlat, coslat, area, &
617 cdmbgwd(1:2), hprime, oc, oa4, clx, theta, &
618 sigma, gamma, elvmax, sgh30, kpbl, ugrs, &
619 vgrs, tgrs, q1, prsi,del,prsl,prslk, zmeti, zmet, &
620 pdvdt, pdudt, pdtdt, pkdis, dusfcg, dvsfcg,rdxzb, &
621 zobl, zlwb, zogw, tau_ogw, dudt_ogw, dvdt_ogw, &
622 dudt_obl, dvdt_obl,dudt_ofd, dvdt_ofd, &
623 du_ogwcol, dv_ogwcol, du_oblcol, dv_oblcol, &
624 du_ofdcol, dv_ofdcol, errmsg,errflg )
644 if(ldiag3d .and. lssav .and. .not. flag_for_gwd_generic_tend)
then
645 idtend = dtidx(index_of_x_wind,index_of_process_orographic_gwd)
647 dtend(:,:,idtend) = dtend(:,:,idtend) + pdudt*dtp
649 idtend = dtidx(index_of_y_wind,index_of_process_orographic_gwd)
651 dtend(:,:,idtend) = dtend(:,:,idtend) + pdvdt*dtp
653 idtend = dtidx(index_of_temperature,index_of_process_orographic_gwd)
655 dtend(:,:,idtend) = dtend(:,:,idtend) + pdtdt*dtp
672 call slat_geos5_2020(im, tamp_mpa, xlat_d, tau_ngw)
674 y4 = jdat(1); month = jdat(2); day = jdat(3)
681 call calendar_ugwp(y4, month, day, ddd_ugwp)
682 curdate = y4*1000 + ddd_ugwp
684 call ngwflux_update(me, master, im, levs, kdt, ddd_ugwp,curdate, &
685 tau_amf, xlat_d, sinlat,coslat, rain, tau_ngw)
689 call ecmwf_ngw_emc(me, master, im, levs, kdt, dtp, dx, &
690 tau_ngw, tgrs, ugrs, vgrs, q1, prsl, prsi, &
691 zmet, zmeti,prslk, xlat_d, sinlat, coslat, &
692 dudt_ngw, dvdt_ngw, dtdt_ngw, kdis_ngw, zngw)
695 call cires_ugwpv1_ngw_solv2(me, master, im, levs, kdt, dtp, &
696 tau_ngw, tgrs, ugrs, vgrs, q1, prsl, prsi, &
697 zmet, zmeti,prslk, xlat_d, sinlat, coslat, &
698 dudt_ngw, dvdt_ngw, dtdt_ngw, kdis_ngw, zngw)
719 if(ldiag3d .and. lssav .and. .not. flag_for_gwd_generic_tend)
then
720 idtend = dtidx(index_of_x_wind,index_of_process_nonorographic_gwd)
722 dtend(:,:,idtend) = dtend(:,:,idtend) + dudt_ngw(i,k)*dtp
724 idtend = dtidx(index_of_y_wind,index_of_process_nonorographic_gwd)
726 dtend(:,:,idtend) = dtend(:,:,idtend) + dvdt_ngw(i,k)*dtp
728 idtend = dtidx(index_of_temperature,index_of_process_nonorographic_gwd)
730 dtend(:,:,idtend) = dtend(:,:,idtend) + dtdt_ngw(i,k)*dtp
738 dudt_gw = pdudt + dudt_ngw
739 dvdt_gw = pdvdt + dvdt_ngw
740 dtdt_gw = pdtdt + dtdt_ngw
741 kdis_gw = pkdis + kdis_ngw
751 dudt = dudt + dudt_gw
752 dvdt = dvdt + dvdt_gw
753 dtdt = dtdt + dtdt_gw