189 subroutine cires_ugwp_run(do_ugwp, me, master, im, levs, ntrac, dtp, kdt, lonr, &
190 oro, oro_uf, hprime, nmtvr, oc, theta, sigma, gamma, elvmax, clx, oa4, &
191 do_tofd, ldiag_ugwp, cdmbgwd, xlat, xlat_d, sinlat, coslat, &
192 area, ugrs, vgrs, tgrs, qgrs, prsi, prsl, prslk, phii, phil, &
193 del, kpbl, dusfcg, dvsfcg, gw_dudt, gw_dvdt, gw_dtdt, gw_kdis, &
194 tau_tofd, tau_mtb, tau_ogw, tau_ngw, zmtb, zlwb, zogw, &
195 dusfc_ms, dvsfc_ms, dusfc_bl, dvsfc_bl, &
196 dudt_ogw, dtauy2d_ms, dtaux2d_bl, dtauy2d_bl, &
197 dudt_mtb, dudt_tms, du3dt_mtb, du3dt_ogw, du3dt_tms, &
198 rdxzb, con_g, con_pi, con_cp, con_rd, con_rv, con_fvirt, &
199 con_omega, rain, ntke, q_tke, dqdt_tke, lprnt, ipr, &
200 dtend, dtidx, index_of_x_wind, index_of_y_wind, index_of_temperature, &
201 index_of_process_orographic_gwd, index_of_process_nonorographic_gwd, &
202 ldiag3d, lssav, flag_for_gwd_generic_tend, ten_q, errmsg, errflg)
207 integer,
intent(in) :: me, master, im, levs, ntrac, kdt, lonr, nmtvr
208 integer,
intent(in),
dimension(:) :: kpbl
209 real(kind=kind_phys),
intent(in),
dimension(:) :: oro, oro_uf, hprime, oc, theta, sigma, gamma
210 logical,
intent(in) :: flag_for_gwd_generic_tend
212 real(kind=kind_phys),
intent(inout),
dimension(:) :: elvmax
213 real(kind=kind_phys),
intent(in),
dimension(:, :) :: clx, oa4
214 real(kind=kind_phys),
intent(in),
dimension(:) :: xlat, xlat_d, sinlat, coslat, area
215 real(kind=kind_phys),
intent(in),
dimension(:, :) :: del, ugrs, vgrs, tgrs, prsl, prslk, phil
216 real(kind=kind_phys),
intent(in),
dimension(:, :) :: prsi, phii
217 real(kind=kind_phys),
intent(in),
dimension(:,:,:):: qgrs
218 real(kind=kind_phys),
intent(in) :: dtp, cdmbgwd(:)
219 logical,
intent(in) :: do_ugwp, do_tofd, ldiag_ugwp
221 real(kind=kind_phys),
intent(out),
dimension(:) :: dusfcg, dvsfcg
222 real(kind=kind_phys),
intent(out),
dimension(:) :: zmtb, zlwb, zogw, rdxzb
223 real(kind=kind_phys),
intent(out),
dimension(:) :: tau_mtb, tau_ogw, tau_tofd, tau_ngw
224 real(kind=kind_phys),
intent(out),
dimension(:, :):: gw_dudt, gw_dvdt, gw_dtdt, gw_kdis
225 real(kind=kind_phys),
intent(out),
dimension(:, :):: dudt_mtb, dudt_tms
226 real(kind=kind_phys),
intent(out),
dimension(:, :),
optional :: dudt_ogw
227 real(kind=kind_phys),
intent(out),
dimension(:),
optional :: dusfc_ms, dvsfc_ms, dusfc_bl, dvsfc_bl
228 real(kind=kind_phys),
intent(out),
dimension(:, :),
optional :: dtauy2d_ms
229 real(kind=kind_phys),
intent(out),
dimension(:, :),
optional :: dtaux2d_bl, dtauy2d_bl
232 real(kind=kind_phys),
optional,
intent(inout) :: dtend(:,:,:)
233 integer,
intent(in) :: dtidx(:,:), &
234 index_of_x_wind, index_of_y_wind, index_of_temperature, &
235 index_of_process_orographic_gwd, index_of_process_nonorographic_gwd
237 logical,
intent(in) :: ldiag3d, lssav
240 real(kind=kind_phys),
intent(inout),
dimension(:,:),
optional :: du3dt_mtb, du3dt_ogw, du3dt_tms
242 real(kind=kind_phys),
intent(in) :: con_g, con_pi, con_cp, con_rd, con_rv, con_fvirt, con_omega
244 real(kind=kind_phys),
intent(in),
dimension(:) :: rain
246 integer,
intent(in) :: ntke
247 real(kind=kind_phys),
intent(in),
dimension(:,:),
optional :: q_tke, dqdt_tke
249 logical,
intent(in) :: lprnt
250 integer,
intent(in) :: ipr
252 real(kind=kind_phys),
intent(out) :: ten_q(:,:,:)
254 character(len=*),
intent(out) :: errmsg
255 integer,
intent(out) :: errflg
258 integer :: i, k, idtend
259 real(kind=kind_phys),
dimension(im) :: sgh30
260 real(kind=kind_phys),
dimension(im, levs) :: pdvdt, pdudt
261 real(kind=kind_phys),
dimension(im, levs) :: pdtdt, pkdis
262 real(kind=kind_phys),
dimension(im, levs) :: ed_dudt, ed_dvdt, ed_dtdt
264 real(kind=kind_phys),
parameter :: tamp_mpa=30.e-3
266 real(kind=kind_phys),
parameter :: pogw=1., pngw=1., pked=1.
268 real(kind=kind_phys),
dimension(:,:),
allocatable :: tke
269 real(kind=kind_phys),
dimension(:),
allocatable :: turb_fac, tem
270 real(kind=kind_phys) :: rfac, tx1
287 sgh30 = abs(oro - oro_uf)
295 call gwdps_v0(im, levs, lonr, do_tofd, pdvdt, pdudt, pdtdt, pkdis, &
296 ugrs, vgrs, tgrs, qgrs(:,:,1), kpbl, prsi,del,prsl, prslk, phii, phil, &
297 dtp, kdt, sgh30, hprime, oc, oa4, clx, theta, sigma, gamma, elvmax, &
298 dusfcg, dvsfcg, xlat_d, sinlat, coslat, area, cdmbgwd(1:2), &
299 me, master, rdxzb, zmtb, zogw, tau_mtb, tau_ogw, &
300 tau_tofd, dudt_mtb, dudt_ogw, dudt_tms, &
314 if (cdmbgwd(1) > 0.0 .or. cdmbgwd(2) > 0.0)
then
315 call gwdps_run(im, levs, pdvdt, pdudt, pdtdt, ten_q, &
316 ugrs, vgrs, tgrs, qgrs(:,:,1), &
317 kpbl, prsi, del, prsl, prslk, phii, phil, dtp, kdt, &
318 hprime, oc, oa4, clx, theta, sigma, gamma, &
319 elvmax, dusfcg, dvsfcg, dudt_ogw, dtauy2d_ms, &
320 dtaux2d_bl, dtauy2d_bl, dusfc_ms, dvsfc_ms, &
321 dusfc_bl, dvsfc_bl, &
322 con_g, con_cp, con_rd, con_rv, lonr, &
323 nmtvr, cdmbgwd, me, lprnt, ipr, rdxzb, ldiag_ugwp, &
325 if (errflg/=0)
return
328 tau_mtb = 0.0 ; tau_ogw = 0.0 ; tau_tofd = 0.0
330 du3dt_mtb = 0.0 ; du3dt_ogw = 0.0 ; du3dt_tms= 0.0
335 if(ldiag3d .and. lssav .and. .not. flag_for_gwd_generic_tend)
then
336 idtend = dtidx(index_of_x_wind,index_of_process_orographic_gwd)
338 dtend(:,:,idtend) = dtend(:,:,idtend) + pdudt*dtp
340 idtend = dtidx(index_of_y_wind,index_of_process_orographic_gwd)
342 dtend(:,:,idtend) = dtend(:,:,idtend) + pdvdt*dtp
344 idtend = dtidx(index_of_temperature,index_of_process_orographic_gwd)
346 dtend(:,:,idtend) = dtend(:,:,idtend) + pdtdt*dtp
350 if (cdmbgwd(3) > 0.0)
then
353 call slat_geos5_tamp_v0(im, tamp_mpa, xlat_d, tau_ngw)
355 if (abs(1.0-cdmbgwd(3)) > 1.0e-6)
then
356 if (cdmbgwd(4) > 0.0)
then
357 allocate(turb_fac(im))
362 allocate(tke(im,levs))
364 tke(:,:) = q_tke(:,:) + dqdt_tke(:,:) * dtp
368 turb_fac(i) = turb_fac(i) + del(i,k) * tke(i,k)
369 tem(i) = tem(i) + del(i,k)
373 turb_fac(i) = turb_fac(i) / tem(i)
378 rfac = 86400000 / dtp
380 tx1 = cdmbgwd(4)*min(10.0, max(turb_fac(i),rain(i)*rfac))
381 tau_ngw(i) = tau_ngw(i) * max(0.1, min(5.0, tx1))
386 tau_ngw(i) = tau_ngw(i) * cdmbgwd(3)
390 call fv3_ugwp_solv2_v0(im, levs, dtp, tgrs, ugrs, vgrs,qgrs(:,:,1), &
391 prsl, prsi, phil, xlat_d, sinlat, coslat, &
392 gw_dudt, gw_dvdt, gw_dtdt, gw_kdis, tau_ngw, &
397 gw_dtdt(i,k) = pngw*gw_dtdt(i,k) + pogw*pdtdt(i,k)
398 gw_dudt(i,k) = pngw*gw_dudt(i,k) + pogw*pdudt(i,k)
399 gw_dvdt(i,k) = pngw*gw_dvdt(i,k) + pogw*pdvdt(i,k)
400 gw_kdis(i,k) = pngw*gw_kdis(i,k) + pogw*pkdis(i,k)
408 gw_dtdt(i,k) = pdtdt(i,k)
409 gw_dudt(i,k) = pdudt(i,k)
410 gw_dvdt(i,k) = pdvdt(i,k)
411 gw_kdis(i,k) = pkdis(i,k)
417 if (pogw == 0.0)
then
418 tau_mtb = 0. ; tau_ogw = 0. ; tau_tofd = 0.
419 dudt_mtb = 0. ; dudt_ogw = 0. ; dudt_tms = 0.
422 if(ldiag3d .and. lssav .and. .not. flag_for_gwd_generic_tend)
then
423 idtend = dtidx(index_of_x_wind,index_of_process_nonorographic_gwd)
425 dtend(:,:,idtend) = dtend(:,:,idtend) + (gw_dudt - pdudt)*dtp
427 idtend = dtidx(index_of_y_wind,index_of_process_nonorographic_gwd)
429 dtend(:,:,idtend) = dtend(:,:,idtend) + (gw_dvdt - pdvdt)*dtp
431 idtend = dtidx(index_of_temperature,index_of_process_nonorographic_gwd)
433 dtend(:,:,idtend) = dtend(:,:,idtend) + (gw_dtdt - pdtdt)*dtp
subroutine gwdps_run(im, km, a, b, c, ten_q, u1, v1, t1, q1, kpbl, prsi, del, prsl, prslk, phii, phil, deltim, kdt, hprime, oc, oa4, clx4, theta, sigma, gamma, elvmax, dusfc, dvsfc, dtaux2d_ms, dtauy2d_ms, dtaux2d_bl, dtauy2d_bl, dusfc_ms, dvsfc_ms, dusfc_bl, dvsfc_bl, g, cp, rd, rv, imx, nmtvr, cdmbgwd, me, lprnt, ipr, rdxzb, ldiag_ugwp, errmsg, errflg)