301 subroutine ugwpv1_gsldrag_run(me, master, im, levs, ak, bk, ntrac, lonr, dtp, &
302 fhzero, kdt, ldiag3d, lssav, flag_for_gwd_generic_tend, do_gsl_drag_ls_bl, &
303 do_gsl_drag_ss, do_gsl_drag_tofd, &
304 do_gwd_opt_psl, psl_gwd_dx_factor, &
305 do_ugwp_v1, do_ugwp_v1_orog_only, &
306 do_ugwp_v1_w_gsldrag, gwd_opt, do_tofd, ldiag_ugwp, ugwp_seq_update, &
307 cdmbgwd, alpha_fd, jdat, nmtvr, hprime, oc, theta, sigma, gamma, &
308 elvmax, clx, oa4, varss,oc1ss,oa4ss,ol4ss, dx, xlat, xlat_d, sinlat, coslat, &
309 area, rain, br1, hpbl,vtype, kpbl, slmsk, &
310 ugrs, vgrs, tgrs, q1, prsi, prsl, prslk, phii, phil, del, tau_amf, &
311 dudt_ogw, dvdt_ogw, du_ogwcol, dv_ogwcol, &
312 dudt_obl, dvdt_obl, du_oblcol, dv_oblcol, &
313 dudt_oss, dvdt_oss, du_osscol, dv_osscol, &
314 dudt_ofd, dvdt_ofd, du_ofdcol, dv_ofdcol, &
315 dudt_ngw, dvdt_ngw, dtdt_ngw, kdis_ngw, dudt_gw, dvdt_gw, dtdt_gw, kdis_gw, &
316 tau_ogw, tau_ngw, tau_oss, &
317 zogw, zlwb, zobl, zngw, dusfcg, dvsfcg, dudt, dvdt, dtdt, rdxzb, &
318 dtend, dtidx, index_of_x_wind, index_of_y_wind, index_of_temperature, &
319 index_of_process_orographic_gwd, index_of_process_nonorographic_gwd, &
320 lprnt, ipr, spp_wts_gwd, spp_gwd, errmsg, errflg)
333 use ugwp_common,
only : con_pi => pi, con_g => grav, con_rd => rd, &
334 con_rv => rv, con_cp => cpd, con_fv => fv, &
335 con_rerth => arad, con_omega => omega1, rgrav
350 logical,
intent(in) :: ldiag3d, lssav
351 logical,
intent(in) :: flag_for_gwd_generic_tend
352 logical,
intent(in) :: lprnt
354 integer,
intent(in) :: ipr
358 logical,
intent (in) :: do_gsl_drag_ls_bl, do_gsl_drag_ss, do_gsl_drag_tofd
359 logical,
intent (in) :: do_ugwp_v1, do_ugwp_v1_orog_only, do_tofd
360 logical,
intent (in) :: ldiag_ugwp, ugwp_seq_update
361 logical,
intent (in) :: do_ugwp_v1_w_gsldrag
363 integer,
intent(in) :: me, master, im, levs, ntrac,lonr
364 real(kind=kind_phys),
intent(in) :: dtp, fhzero
365 real(kind=kind_phys),
intent(in) :: ak(:), bk(:)
366 integer,
intent(in) :: kdt, jdat(:)
368 logical,
intent(in) :: do_gwd_opt_psl
369 real(kind=kind_phys),
intent(in) :: psl_gwd_dx_factor
371 integer,
intent(in) :: gwd_opt
372 integer,
intent(in) :: nmtvr
373 real(kind=kind_phys),
intent(in) :: cdmbgwd(:), alpha_fd
375 real(kind=kind_phys),
intent(in),
dimension(:) :: hprime, oc, theta, sigma, gamma
377 real(kind=kind_phys),
intent(in),
dimension(:) :: elvmax
378 real(kind=kind_phys),
intent(in),
dimension(:,:) :: clx, oa4
380 real(kind=kind_phys),
intent(in),
dimension(:) :: dx
381 real(kind=kind_phys),
intent(in),
dimension(:),
optional :: varss,oc1ss
382 real(kind=kind_phys),
intent(in),
dimension(:,:),
optional :: oa4ss,ol4ss
391 real(kind=kind_phys),
intent(in),
dimension(:) :: xlat, xlat_d, sinlat, coslat, area
395 real(kind=kind_phys),
intent(in),
dimension(:,:) :: del, ugrs, vgrs, tgrs, prsl, prslk, phil
396 real(kind=kind_phys),
intent(in),
dimension(:,:) :: prsi, phii
397 real(kind=kind_phys),
intent(in),
dimension(:,:) :: q1
398 integer,
intent(in),
dimension(:) :: kpbl
399 integer,
intent(in),
dimension(:) :: vtype
401 real(kind=kind_phys),
intent(in),
dimension(:) :: rain
402 real(kind=kind_phys),
intent(in),
dimension(:) :: br1, hpbl, slmsk
407 real(kind=kind_phys),
intent(in),
dimension(:) :: tau_amf
411 real(kind=kind_phys),
intent(out),
dimension(:),
optional :: &
412 du_ogwcol, dv_ogwcol, du_oblcol, dv_oblcol, &
413 du_osscol, dv_osscol, du_ofdcol, dv_ofdcol
418 real(kind=kind_phys),
intent(out),
dimension(:) :: dusfcg, dvsfcg
419 real(kind=kind_phys),
intent(out),
dimension(:) :: tau_ogw, tau_ngw, tau_oss
421 real(kind=kind_phys),
intent(out) ,
dimension(:,:),
optional :: &
422 dudt_ogw, dvdt_ogw, dudt_obl, dvdt_obl, &
423 dudt_oss, dvdt_oss, dudt_ofd, dvdt_ofd
425 real(kind=kind_phys),
intent(out) ,
dimension(:,:),
optional :: dudt_ngw, dvdt_ngw, kdis_ngw, dtdt_ngw
426 real(kind=kind_phys),
intent(out) ,
dimension(:,:) :: dudt_gw, dvdt_gw, dtdt_gw, kdis_gw
428 real(kind=kind_phys),
intent(out) ,
dimension(:) :: zogw, zlwb, zobl, zngw
431 real(kind=kind_phys),
intent(inout),
dimension(:,:) :: dudt, dvdt, dtdt
433 real(kind=kind_phys),
intent(inout),
optional :: dtend(:,:,:)
434 integer,
intent(in) :: dtidx(:,:)
435 integer,
intent(in) :: &
436 index_of_x_wind, index_of_y_wind, index_of_temperature, &
437 index_of_process_orographic_gwd, index_of_process_nonorographic_gwd
439 real(kind=kind_phys),
intent(out),
dimension(:) :: rdxzb
441 real(kind=kind_phys),
intent(in),
optional :: spp_wts_gwd(:,:)
442 integer,
intent(in) :: spp_gwd
444 character(len=*),
intent(out) :: errmsg
445 integer,
intent(out) :: errflg
449 real(kind=kind_phys),
dimension(im) :: sgh30
450 real(kind=kind_phys),
dimension(im, levs) :: pdvdt, pdudt
451 real(kind=kind_phys),
dimension(im, levs) :: pdtdt, pkdis
465 real(kind=kind_phys),
dimension(im, levs) :: zmet
466 real(kind=kind_phys),
dimension(im, levs+1) :: zmeti
471 integer :: y4, month, day, ddd_ugwp, curdate, curday, idtend
499 if (do_ugwp_v1 .or. ldiag_ugwp)
then
500 dudt_ogw(:,:)= 0.; dvdt_ogw(:,:)=0.; dudt_obl(:,:)=0.; dvdt_obl(:,:)=0.
501 dudt_oss(:,:)= 0.; dvdt_oss(:,:)=0.; dudt_ofd(:,:)=0.; dvdt_ofd(:,:)=0.
502 du_ogwcol(:)=0. ; dv_ogwcol(:)=0. ; du_oblcol(:)=0. ; dv_oblcol(:)=0.
503 du_osscol(:)=0. ; dv_osscol(:)=0. ;du_ofdcol(:)=0. ; dv_ofdcol(:)=0.
504 dudt_ngw(:,:)=0.; dvdt_ngw(:,:)=0.; dtdt_ngw(:,:)=0.; kdis_ngw(:,:)=0.
509 dusfcg(:) = 0. ; dvsfcg(:) =0.
514 dudt_gw(:,:)=0. ; dvdt_gw(:,:)=0. ; dtdt_gw(:,:)=0. ; kdis_gw(:,:)=0.
517 tau_ogw(:)=0. ; tau_ngw(:)=0. ; tau_oss(:)=0.
521 zlwb(:)= 0. ; zogw(:)=0. ; zobl(:)=0. ; zngw(:)=0.
538 if ( do_gsl_drag_ls_bl.or.do_gsl_drag_ss.or.do_gsl_drag_tofd)
then
547 if (do_gwd_opt_psl)
then
548 call drag_suite_psl(im, levs, pdvdt, pdudt, pdtdt, &
550 kpbl,prsi,del,prsl,prslk,phii,phil,dtp, &
551 kdt,hprime,oc,oa4,clx,varss,oc1ss,oa4ss, &
552 ol4ss,theta,sigma,gamma,elvmax, &
553 dudt_ogw, dvdt_ogw, dudt_obl, dvdt_obl, &
554 dudt_oss, dvdt_oss, dudt_ofd, dvdt_ofd, &
556 du_ogwcol, dv_ogwcol, du_oblcol, dv_oblcol, &
557 du_osscol, dv_osscol, du_ofdcol, dv_ofdcol, &
558 slmsk,br1,hpbl,vtype,con_g,con_cp,con_rd,con_rv, &
559 con_fv, con_pi, lonr, &
560 cdmbgwd(1:2),alpha_fd,me,master, &
561 lprnt,ipr,rdxzb,dx,gwd_opt, &
562 do_gsl_drag_ls_bl,do_gsl_drag_ss,do_gsl_drag_tofd, &
564 dtend, dtidx, index_of_process_orographic_gwd, &
565 index_of_temperature, index_of_x_wind, &
566 index_of_y_wind, ldiag3d, ldiag_ugwp, &
567 ugwp_seq_update, spp_wts_gwd, spp_gwd, errmsg, errflg)
569 call drag_suite_run(im, levs, pdvdt, pdudt, pdtdt, &
571 kpbl,prsi,del,prsl,prslk,phii,phil,dtp, &
572 kdt,hprime,oc,oa4,clx,varss,oc1ss,oa4ss, &
573 ol4ss,theta,sigma,gamma,elvmax, &
574 dudt_ogw, dvdt_ogw, dudt_obl, dvdt_obl, &
575 dudt_oss, dvdt_oss, dudt_ofd, dvdt_ofd, &
577 du_ogwcol, dv_ogwcol, du_oblcol, dv_oblcol, &
578 du_osscol, dv_osscol, du_ofdcol, dv_ofdcol, &
579 slmsk,br1,hpbl,con_g,con_cp,con_rd,con_rv, &
580 con_fv, con_pi, lonr, &
581 cdmbgwd(1:2),alpha_fd,me,master, &
582 lprnt,ipr,rdxzb,dx,gwd_opt, &
583 do_gsl_drag_ls_bl,do_gsl_drag_ss,do_gsl_drag_tofd, &
584 dtend, dtidx, index_of_process_orographic_gwd, &
585 index_of_temperature, index_of_x_wind, &
586 index_of_y_wind, ldiag3d, ldiag_ugwp, &
587 ugwp_seq_update, spp_wts_gwd, spp_gwd, errmsg, errflg)
616 if ( do_ugwp_v1_orog_only )
then
625 if (gwd_opt ==1 )sgh30 = 0.15*hprime
626 if (gwd_opt >1 ) sgh30 = varss
628 call orogw_v1 (im, levs, lonr, me, master,dtp, kdt, do_tofd, &
629 xlat_d, sinlat, coslat, area, &
630 cdmbgwd(1:2), hprime, oc, oa4, clx, theta, &
631 sigma, gamma, elvmax, sgh30, kpbl, ugrs, &
632 vgrs, tgrs, q1, prsi,del,prsl,prslk, zmeti, zmet, &
633 pdvdt, pdudt, pdtdt, pkdis, dusfcg, dvsfcg,rdxzb, &
634 zobl, zlwb, zogw, tau_ogw, dudt_ogw, dvdt_ogw, &
635 dudt_obl, dvdt_obl,dudt_ofd, dvdt_ofd, &
636 du_ogwcol, dv_ogwcol, du_oblcol, dv_oblcol, &
637 du_ofdcol, dv_ofdcol, errmsg,errflg )
657 if(ldiag3d .and. lssav .and. .not. flag_for_gwd_generic_tend)
then
658 idtend = dtidx(index_of_x_wind,index_of_process_orographic_gwd)
660 dtend(:,:,idtend) = dtend(:,:,idtend) + pdudt*dtp
662 idtend = dtidx(index_of_y_wind,index_of_process_orographic_gwd)
664 dtend(:,:,idtend) = dtend(:,:,idtend) + pdvdt*dtp
666 idtend = dtidx(index_of_temperature,index_of_process_orographic_gwd)
668 dtend(:,:,idtend) = dtend(:,:,idtend) + pdtdt*dtp
685 call slat_geos5_2020(im, tamp_mpa, xlat_d, tau_ngw)
687 y4 = jdat(1); month = jdat(2); day = jdat(3)
695 call calendar_ugwp(y4, month, day, ddd_ugwp)
696 curdate = y4*1000 + ddd_ugwp
698 call ngwflux_update(me, master, im, levs, kdt, ddd_ugwp,curdate, &
699 tau_amf, xlat_d, sinlat,coslat, rain, tau_ngw)
701 call cires_ugwpv1_ngw_solv2(me, master, im, levs, kdt, dtp, &
702 tau_ngw, tgrs, ugrs, vgrs, q1, prsl, prsi, &
703 zmet, zmeti,prslk, xlat_d, sinlat, coslat, &
704 dudt_ngw, dvdt_ngw, dtdt_ngw, kdis_ngw, zngw)
723 if(ldiag3d .and. lssav .and. .not. flag_for_gwd_generic_tend)
then
724 idtend = dtidx(index_of_x_wind,index_of_process_nonorographic_gwd)
726 dtend(:,:,idtend) = dtend(:,:,idtend) + dudt_ngw(i,k)*dtp
728 idtend = dtidx(index_of_y_wind,index_of_process_nonorographic_gwd)
730 dtend(:,:,idtend) = dtend(:,:,idtend) + dvdt_ngw(i,k)*dtp
732 idtend = dtidx(index_of_temperature,index_of_process_nonorographic_gwd)
734 dtend(:,:,idtend) = dtend(:,:,idtend) + dtdt_ngw(i,k)*dtp
742 dudt_gw = pdudt + dudt_ngw
743 dvdt_gw = pdvdt + dvdt_ngw
744 dtdt_gw = pdtdt + dtdt_ngw
745 kdis_gw = pkdis + kdis_ngw
755 dudt = dudt + dudt_gw
756 dvdt = dvdt + dvdt_gw
757 dtdt = dtdt + dtdt_gw