120 use constants_mod,
only: grav, rdgas, rvgas, pi=>pi_8, radius, kappa, wtmair, wtmco2, &
121 omega, hlv, cp_air, cp_vapor
122 use fms_mod,
only: write_version_number
123 use fms_io_mod,
only: set_domain, nullify_domain, write_version_number
124 use time_manager_mod,
only: time_type, get_date, get_time
125 use mpp_domains_mod,
only: domain2d, mpp_update_domains, dgrid_ne
126 use diag_manager_mod,
only: diag_axis_init, register_diag_field, &
127 register_static_field, send_data, diag_grid_init
132 use fv_mp_mod,
only: mp_reduce_sum, mp_reduce_min, mp_reduce_max, is_master
139 use tracer_manager_mod,
only: get_tracer_names, get_number_tracers, get_tracer_index
140 use field_manager_mod,
only: model_atmos
141 use mpp_mod,
only: mpp_error, fatal, stdlog, mpp_pe, mpp_root_pe, mpp_sum, mpp_max, note
142 use sat_vapor_pres_mod,
only: compute_qs, lookup_es
146 use gfdl_cloud_microphys_mod,
only: wqs1, qsmith_init
162 character(len=3) ::
gn =
'' 196 #include<file_version.h> 200 subroutine fv_diag_init(Atm, axes, Time, npx, npy, npz, p_ref)
202 integer,
intent(out) :: axes(4)
203 type(time_type),
intent(in) :: time
204 integer,
intent(in) :: npx, npy, npz
205 real,
intent(in):: p_ref
207 real,
allocatable :: grid_xt(:), grid_yt(:), grid_xe(:), grid_ye(:), grid_xn(:), grid_yn(:)
208 real,
allocatable :: grid_x(:), grid_y(:)
209 real :: vrange(2), vsrange(2), wrange(2), trange(2), slprange(2), rhrange(2), skrange(2)
210 real,
allocatable :: a3(:,:,:)
212 real :: hyam(npz), hybm(npz)
215 integer :: id_bk, id_pk, id_area, id_lon, id_lat, id_lont, id_latt, id_phalf, id_pfull
216 integer :: id_hyam, id_hybm
218 integer :: i, j, k, n, ntileme, id_xt, id_yt, id_x, id_y, id_xe, id_ye, id_xn, id_yn
219 integer :: isc, iec, jsc, jec
222 character(len=64) :: plev
223 character(len=64) :: field
231 call write_version_number (
'FV_DIAGNOSTICS_MOD', version )
232 idiag => atm(1)%idiag
241 call set_domain(atm(1)%domain)
243 sphum = get_tracer_index(model_atmos,
'sphum')
244 liq_wat = get_tracer_index(model_atmos,
'liq_wat')
245 ice_wat = get_tracer_index(model_atmos,
'ice_wat')
247 rainwat = get_tracer_index(model_atmos,
'rainwat')
248 snowwat = get_tracer_index(model_atmos,
'snowwat')
249 graupel = get_tracer_index(model_atmos,
'graupel')
250 cld_amt = get_tracer_index(model_atmos,
'cld_amt')
256 vsrange = (/ -200., 200. /)
258 vrange = (/ -330., 330. /)
259 wrange = (/ -100., 100. /)
260 rhrange = (/ -10., 150. /)
262 trange = (/ 5., 350. /)
264 trange = (/ 100., 350. /)
266 slprange = (/800., 1200./)
267 skrange = (/ -10000000.0, 10000000.0 /)
270 if (atm(1)%grid_number == 1)
fv_time = time
272 allocate (
idiag%phalf(npz+1) )
277 if ( pfull(k) > 30.e2 )
then 282 if ( is_master() )
write(*,*)
'mp_top=',
mp_top,
'pfull=', pfull(
mp_top)
285 allocate(grid_xt(npx-1), grid_yt(npy-1))
286 grid_xt = (/ (i, i=1,npx-1) /)
287 grid_yt = (/ (j, j=1,npy-1) /)
293 allocate(grid_x(npx), grid_y(npy))
294 grid_x = (/ (i, i=1,npx) /)
295 grid_y = (/ (j, j=1,npy) /)
298 isc = atm(n)%bd%isc; iec = atm(n)%bd%iec
299 jsc = atm(n)%bd%jsc; jec = atm(n)%bd%jec
302 call diag_grid_init(domain=atm(n)%domain, &
303 & glo_lon=
rad2deg*atm(n)%gridstruct%grid(isc:iec+1,jsc:jec+1,1), &
304 & glo_lat=
rad2deg*atm(n)%gridstruct%grid(isc:iec+1,jsc:jec+1,2), &
305 & aglo_lon=
rad2deg*atm(n)%gridstruct%agrid(isc-1:iec+1,jsc-1:jec+1,1), &
306 & aglo_lat=
rad2deg*atm(n)%gridstruct%agrid(isc-1:iec+1,jsc-1:jec+1,2))
308 ntileme =
size(atm(:))
309 if (ntileme > 1)
call mpp_error(fatal,
"fv_diag_init can only be called with one grid at a time.")
315 id_xt = diag_axis_init(
'grid_xt',grid_xt,
'degrees_E',
'x',
'T-cell longitude', &
316 set_name=trim(field),domain2=atm(n)%Domain, tile_count=n)
317 id_yt = diag_axis_init(
'grid_yt',grid_yt,
'degrees_N',
'y',
'T-cell latitude', &
318 set_name=trim(field), domain2=atm(n)%Domain, tile_count=n)
329 id_x = diag_axis_init(
'grid_x',grid_x,
'degrees_E',
'x',
'cell corner longitude', &
330 set_name=trim(field),domain2=atm(n)%Domain, tile_count=n)
331 id_y = diag_axis_init(
'grid_y',grid_y,
'degrees_N',
'y',
'cell corner latitude', &
332 set_name=trim(field), domain2=atm(n)%Domain, tile_count=n)
336 deallocate(grid_xt, grid_yt)
337 deallocate(grid_x, grid_y )
339 id_phalf = diag_axis_init(
'phalf',
idiag%phalf,
'mb',
'z', &
340 'ref half pressure level', direction=-1, set_name=
"dynamics")
341 id_pfull = diag_axis_init(
'pfull', pfull,
'mb',
'z', &
342 'ref full pressure level', direction=-1, set_name=
"dynamics", edges=id_phalf)
346 id_bk = register_static_field(
"dynamics",
'bk', (/id_phalf/), &
347 'vertical coordinate sigma value',
'none' )
349 id_pk = register_static_field(
"dynamics",
'pk', (/id_phalf/), &
350 'pressure part of the hybrid coordinate',
'pascal' )
352 id_hyam = register_static_field(
"dynamics",
'hyam', (/id_pfull/), &
353 'vertical coordinate A value',
'1E-5 Pa' )
355 id_hybm = register_static_field(
"dynamics",
'hybm', (/id_pfull/), &
356 'vertical coordinate B value',
'none' )
360 if ( id_bk > 0 ) used = send_data( id_bk,atm(1)%bk, time )
361 if ( id_pk > 0 ) used = send_data( id_pk,atm(1)%ak, time )
362 if ( id_hyam > 0 )
then 364 hyam(k) = 0.5 * ( atm(1)%ak(k) + atm(1)%ak(k+1) ) * 1.e-5
366 used = send_data( id_hyam, hyam, time )
368 if ( id_hybm > 0 )
then 370 hybm(k) = 0.5 * ( atm(1)%bk(k) + atm(1)%bk(k+1) )
372 used = send_data( id_hybm, hybm, time )
384 levs = (/1,2,3,5,7,10,20,30,50,70,100,150,200,250,300,350,400,450,500,550,600,650,700,750,800,850,900,925,950,975,1000/)
386 id_plev = diag_axis_init(
'plev',
levs(:)*1.0,
'mb',
'z', &
387 'actual pressure level', direction=-1, set_name=
"dynamics")
398 id_lon = register_static_field( trim(field),
'grid_lon', (/id_x,id_y/), &
399 'longitude',
'degrees_E' )
400 id_lat = register_static_field( trim(field),
'grid_lat', (/id_x,id_y/), &
401 'latitude',
'degrees_N' )
402 id_lont = register_static_field( trim(field),
'grid_lont', (/id_xt,id_yt/), &
403 'longitude',
'degrees_E' )
404 id_latt = register_static_field( trim(field),
'grid_latt', (/id_xt,id_yt/), &
405 'latitude',
'degrees_N' )
406 id_area = register_static_field( trim(field),
'area', axes(1:2), &
407 'cell area',
'm**2' )
409 idiag%id_zsurf = register_static_field( trim(field),
'zsurf', axes(1:2), &
410 'surface height',
'm' )
412 idiag%id_zs = register_static_field( trim(field),
'zs', axes(1:2), &
413 'Original Mean Terrain',
'm' )
415 idiag%id_ze = register_static_field( trim(field),
'ze', axes(1:3), &
416 'Hybrid_Z_surface',
'm' )
417 idiag%id_oro = register_static_field( trim(field),
'oro', axes(1:2), &
418 'Land/Water Mask',
'none' )
419 idiag%id_sgh = register_static_field( trim(field),
'sgh', axes(1:2), &
420 'Terrain Standard deviation',
'm' )
427 idiag%ic_ps = register_static_field( trim(field),
'ps_ic', axes(1:2), &
428 'initial surface pressure',
'Pa' )
429 idiag%ic_ua = register_static_field( trim(field),
'ua_ic', axes(1:3), &
430 'zonal wind',
'm/sec' )
431 idiag%ic_va = register_static_field( trim(field),
'va_ic', axes(1:3), &
432 'meridional wind',
'm/sec' )
433 idiag%ic_ppt= register_static_field( trim(field),
'ppt_ic', axes(1:3), &
434 'potential temperature perturbation',
'K' )
435 idiag%ic_sphum = register_static_field( trim(field),
'sphum_ic', axes(1:2), &
436 'initial surface pressure',
'Pa' )
440 master = (mpp_pe()==mpp_root_pe())
443 isc = atm(n)%bd%isc; iec = atm(n)%bd%iec
444 jsc = atm(n)%bd%jsc; jec = atm(n)%bd%jec
446 allocate (
idiag%zsurf(isc:iec,jsc:jec) )
450 idiag%zsurf(i,j) =
ginv * atm(n)%phis(i,j)
458 isc = atm(n)%bd%isc; iec = atm(n)%bd%iec
459 jsc = atm(n)%bd%jsc; jec = atm(n)%bd%jec
460 if (id_lon > 0) used = send_data(id_lon,
rad2deg*atm(n)%gridstruct%grid(isc:iec+1,jsc:jec+1,1), time)
461 if (id_lat > 0) used = send_data(id_lat,
rad2deg*atm(n)%gridstruct%grid(isc:iec+1,jsc:jec+1,2), time)
462 if (id_lont > 0) used = send_data(id_lont,
rad2deg*atm(n)%gridstruct%agrid(isc:iec,jsc:jec,1), time)
463 if (id_latt > 0) used = send_data(id_latt,
rad2deg*atm(n)%gridstruct%agrid(isc:iec,jsc:jec,2), time)
464 if (id_area > 0) used = send_data(id_area, atm(n)%gridstruct%area(isc:iec,jsc:jec), time)
466 if (
idiag%id_zsurf > 0) used = send_data(
idiag%id_zsurf,
idiag%zsurf, time)
468 if ( atm(n)%flagstruct%fv_land )
then 470 if (
idiag%id_oro > 0) used = send_data(
idiag%id_oro, atm(n)%oro(isc:iec,jsc:jec), time)
471 if (
idiag%id_sgh > 0) used = send_data(
idiag%id_sgh, atm(n)%sgh(isc:iec,jsc:jec), time)
474 if ( atm(n)%flagstruct%ncep_ic )
then 475 if (
idiag%id_ts > 0) used = send_data(
idiag%id_ts, atm(n)%ts(isc:iec,jsc:jec), time)
478 if ( atm(n)%flagstruct%hybrid_z .and.
idiag%id_ze > 0 ) &
479 used = send_data(
idiag%id_ze, atm(n)%ze0(isc:iec,jsc:jec,1:npz), time)
481 if (
idiag%ic_ps > 0) used = send_data(
idiag%ic_ps, atm(n)%ps(isc:iec,jsc:jec)*
ginv, time)
483 if(
idiag%ic_ua > 0) used=send_data(
idiag%ic_ua, atm(n)%ua(isc:iec,jsc:jec,:), time)
484 if(
idiag%ic_va > 0) used=send_data(
idiag%ic_va, atm(n)%va(isc:iec,jsc:jec,:), time)
486 pk0 = 1000.e2 ** kappa
487 if(
idiag%ic_ppt> 0)
then 489 allocate (
idiag%pt1(npz) )
490 allocate ( a3(isc:iec,jsc:jec,npz) )
492 call gw_1d(npz, 1000.e2, atm(n)%ak, atm(n)%ak, atm(n)%ak(1), 10.e3,
idiag%pt1)
499 a3(i,j,k) = (atm(n)%pt(i,j,k)/atm(n)%pkz(i,j,k) -
idiag%pt1(k)) *
pk0 503 used=send_data(
idiag%ic_ppt, a3, time)
505 deallocate (
idiag%pt1 )
513 allocate(
idiag%id_tracer(ncnst))
514 allocate(
idiag%id_tracer_dmmr(ncnst))
515 allocate(
idiag%id_tracer_dvmr(ncnst))
516 allocate(
idiag%w_mr(ncnst))
517 idiag%id_tracer(:) = 0
518 idiag%id_tracer_dmmr(:) = 0
519 idiag%id_tracer_dvmr(:) = 0
540 idiag%id_zsurf = register_diag_field( trim(field),
'zsurf', axes(1:2), time, &
541 'surface height',
'm')
546 idiag%id_ps = register_diag_field( trim(field),
'ps', axes(1:2), time, &
552 idiag%id_mq = register_diag_field( trim(field),
'mq', axes(1:2), time, &
557 idiag%id_aam = register_diag_field( trim(field),
'aam', axes(1:2), time, &
559 idiag%id_amdt = register_diag_field( trim(field),
'amdt', axes(1:2), time, &
564 write(plev,
'(I5)')
levs(i)
566 idiag%id_h(i) = register_diag_field(trim(field),
'z'//trim(adjustl(plev)), axes(1:2), time, &
569 idiag%id_u(i) = register_diag_field(trim(field),
'u'//trim(adjustl(plev)), axes(1:2), time, &
572 idiag%id_v(i) = register_diag_field(trim(field),
'v'//trim(adjustl(plev)), axes(1:2), time, &
575 idiag%id_t(i) = register_diag_field(trim(field),
't'//trim(adjustl(plev)), axes(1:2), time, &
578 idiag%id_q(i) = register_diag_field(trim(field),
'q'//trim(adjustl(plev)), axes(1:2), time, &
581 idiag%id_omg(i) = register_diag_field(trim(field),
'omg'//trim(adjustl(plev)), axes(1:2), time, &
585 idiag%id_u_plev = register_diag_field( trim(field),
'u_plev', axe2(1:3), time, &
587 idiag%id_v_plev = register_diag_field( trim(field),
'v_plev', axe2(1:3), time, &
589 idiag%id_t_plev = register_diag_field( trim(field),
't_plev', axe2(1:3), time, &
591 idiag%id_h_plev = register_diag_field( trim(field),
'h_plev', axe2(1:3), time, &
593 idiag%id_q_plev = register_diag_field( trim(field),
'q_plev', axe2(1:3), time, &
595 idiag%id_omg_plev = register_diag_field( trim(field),
'omg_plev', axe2(1:3), time, &
599 if ( all(
idiag%id_h(minloc(abs(
levs-10)))>0) .or. all(
idiag%id_h(minloc(abs(
levs-50)))>0) .or. &
600 all(
idiag%id_h(minloc(abs(
levs-100)))>0) .or. all(
idiag%id_h(minloc(abs(
levs-200)))>0) .or. &
601 all(
idiag%id_h(minloc(abs(
levs-250)))>0) .or. all(
idiag%id_h(minloc(abs(
levs-300)))>0) .or. &
602 all(
idiag%id_h(minloc(abs(
levs-500)))>0) .or. all(
idiag%id_h(minloc(abs(
levs-700)))>0) .or. &
603 all(
idiag%id_h(minloc(abs(
levs-850)))>0) .or. all(
idiag%id_h(minloc(abs(
levs-1000)))>0) )
then 611 idiag%id_tm = register_diag_field(trim(field),
'tm', axes(1:2), time, &
617 idiag%id_slp = register_diag_field(trim(field),
'slp', axes(1:2), time, &
623 idiag%id_pmask = register_diag_field(trim(field),
'pmask', axes(1:2), time, &
624 'masking pressure at lowest level',
'mb', &
629 idiag%id_pmaskv2 = register_diag_field(trim(field),
'pmaskv2', axes(1:2), time,&
636 idiag%id_c15 = register_diag_field(trim(field),
'cat15', axes(1:2), time, &
638 idiag%id_c25 = register_diag_field(trim(field),
'cat25', axes(1:2), time, &
640 idiag%id_c35 = register_diag_field(trim(field),
'cat35', axes(1:2), time, &
642 idiag%id_c45 = register_diag_field(trim(field),
'cat45', axes(1:2), time, &
645 idiag%id_f15 = register_diag_field(trim(field),
'f15', axes(1:2), time, &
647 idiag%id_f25 = register_diag_field(trim(field),
'f25', axes(1:2), time, &
649 idiag%id_f35 = register_diag_field(trim(field),
'f35', axes(1:2), time, &
651 idiag%id_f45 = register_diag_field(trim(field),
'f45', axes(1:2), time, &
656 if (atm(n)%flagstruct%write_3d_diags)
then 657 idiag%id_ua = register_diag_field( trim(field),
'ucomp', axes(1:3), time, &
659 idiag%id_va = register_diag_field( trim(field),
'vcomp', axes(1:3), time, &
661 if ( .not. atm(n)%flagstruct%hydrostatic ) &
662 idiag%id_w = register_diag_field( trim(field),
'w', axes(1:3), time, &
665 idiag%id_pt = register_diag_field( trim(field),
'temp', axes(1:3), time, &
667 idiag%id_ppt = register_diag_field( trim(field),
'ppt', axes(1:3), time, &
669 idiag%id_theta_e = register_diag_field( trim(field),
'theta_e', axes(1:3), time, &
671 idiag%id_omga = register_diag_field( trim(field),
'omega', axes(1:3), time, &
673 idiag%id_divg = register_diag_field( trim(field),
'divg', axes(1:3), time, &
676 idiag%id_diss = register_diag_field( trim(field),
'diss_est', axes(1:3), time, &
679 idiag%id_rh = register_diag_field( trim(field),
'rh', axes(1:3), time, &
682 idiag%id_delp = register_diag_field( trim(field),
'delp', axes(1:3), time, &
684 if ( .not. atm(n)%flagstruct%hydrostatic ) &
685 idiag%id_delz = register_diag_field( trim(field),
'delz', axes(1:3), time, &
687 if( atm(n)%flagstruct%hydrostatic )
then 688 idiag%id_pfhy = register_diag_field( trim(field),
'pfhy', axes(1:3), time, &
691 idiag%id_pfnh = register_diag_field( trim(field),
'pfnh', axes(1:3), time, &
694 idiag%id_zratio = register_diag_field( trim(field),
'zratio', axes(1:3), time, &
699 idiag%id_qn = register_diag_field( trim(field),
'qn', axes(1:3), time, &
701 idiag%id_qp = register_diag_field( trim(field),
'qp', axes(1:3), time, &
704 idiag%id_mdt = register_diag_field( trim(field),
'mdt', axes(1:3), time, &
706 idiag%id_qdt = register_diag_field( trim(field),
'qdt', axes(1:3), time, &
708 idiag%id_dbz = register_diag_field( trim(field),
'reflectivity', axes(1:3), time, &
714 idiag%id_vort = register_diag_field( trim(field),
'vort', axes(1:3), time, &
719 idiag%id_pv = register_diag_field( trim(field),
'pv', axes(1:3), time, &
725 idiag%id_te = register_diag_field( trim(field),
'te', axes(1:2), time, &
728 idiag%id_ke = register_diag_field( trim(field),
'ke', axes(1:2), time, &
730 idiag%id_ws = register_diag_field( trim(field),
'ws', axes(1:2), time, &
732 idiag%id_maxdbz = register_diag_field( trim(field),
'max_reflectivity', axes(1:2), time, &
734 idiag%id_basedbz = register_diag_field( trim(field),
'base_reflectivity', axes(1:2), time, &
736 idiag%id_dbz4km = register_diag_field( trim(field),
'4km_reflectivity', axes(1:2), time, &
738 idiag%id_dbztop = register_diag_field( trim(field),
'echo_top', axes(1:2), time, &
740 idiag%id_dbz_m10C = register_diag_field( trim(field),
'm10C_reflectivity', axes(1:2), time, &
747 idiag%id_vorts = register_diag_field( trim(field),
'vorts', axes(1:2), time, &
749 idiag%id_us = register_diag_field( trim(field),
'us', axes(1:2), time, &
751 idiag%id_vs = register_diag_field( trim(field),
'vs', axes(1:2), time, &
753 idiag%id_tq = register_diag_field( trim(field),
'tq', axes(1:2), time, &
755 idiag%id_iw = register_diag_field( trim(field),
'iw', axes(1:2), time, &
757 idiag%id_lw = register_diag_field( trim(field),
'lw', axes(1:2), time, &
759 idiag%id_ts = register_diag_field( trim(field),
'ts', axes(1:2), time, &
760 'Skin temperature',
'K' )
761 idiag%id_tb = register_diag_field( trim(field),
'tb', axes(1:2), time, &
762 'lowest layer temperature',
'K' )
763 idiag%id_ctt = register_diag_field( trim(field),
'ctt', axes(1:2), time, &
765 idiag%id_ctp = register_diag_field( trim(field),
'ctp', axes(1:2), time, &
767 idiag%id_ctz = register_diag_field( trim(field),
'ctz', axes(1:2), time, &
769 idiag%id_cape = register_diag_field( trim(field),
'cape', axes(1:2), time, &
771 idiag%id_cin = register_diag_field( trim(field),
'cin', axes(1:2), time, &
774 idiag%id_acl = register_diag_field( trim(field),
'acl', axes(1:2), time, &
776 idiag%id_acl2 = register_diag_field( trim(field),
'acl2', axes(1:2), time, &
778 idiag%id_acly = register_diag_field( trim(field),
'acly', axes(1:2), time, &
785 idiag%id_vort850 = register_diag_field( trim(field),
'vort850', axes(1:2), time, &
788 idiag%id_vort200 = register_diag_field( trim(field),
'vort200', axes(1:2), time, &
793 idiag%id_s200 = register_diag_field( trim(field),
's200', axes(1:2), time, &
795 idiag%id_sl12 = register_diag_field( trim(field),
'sl12', axes(1:2), time, &
797 idiag%id_sl13 = register_diag_field( trim(field),
'sl13', axes(1:2), time, &
800 idiag%id_qn200 = register_diag_field( trim(field),
'qn200', axes(1:2), time, &
802 idiag%id_qn500 = register_diag_field( trim(field),
'qn500', axes(1:2), time, &
804 idiag%id_qn850 = register_diag_field( trim(field),
'qn850', axes(1:2), time, &
807 idiag%id_vort500 = register_diag_field( trim(field),
'vort500', axes(1:2), time, &
810 idiag%id_rain5km = register_diag_field( trim(field),
'rain5km', axes(1:2), time, &
815 if( .not. atm(n)%flagstruct%hydrostatic )
then 816 idiag%id_w200 = register_diag_field( trim(field),
'w200', axes(1:2), time, &
818 idiag%id_w500 = register_diag_field( trim(field),
'w500', axes(1:2), time, &
820 idiag%id_w700 = register_diag_field( trim(field),
'w700', axes(1:2), time, &
823 idiag%id_w850 = register_diag_field( trim(field),
'w850', axes(1:2), time, &
825 idiag%id_w5km = register_diag_field( trim(field),
'w5km', axes(1:2), time, &
827 idiag%id_w2500m = register_diag_field( trim(field),
'w2500m', axes(1:2), time, &
829 idiag%id_w1km = register_diag_field( trim(field),
'w1km', axes(1:2), time, &
831 idiag%id_wmaxup = register_diag_field( trim(field),
'wmaxup', axes(1:2), time, &
833 idiag%id_wmaxdn = register_diag_field( trim(field),
'wmaxdn', axes(1:2), time, &
839 idiag%id_x850 = register_diag_field( trim(field),
'x850', axes(1:2), time, &
847 idiag%id_srh1 = register_diag_field( trim(field),
'srh01', axes(1:2), time, &
849 idiag%id_srh3 = register_diag_field( trim(field),
'srh03', axes(1:2), time, &
851 idiag%id_ustm = register_diag_field( trim(field),
'ustm', axes(1:2), time, &
853 idiag%id_vstm = register_diag_field( trim(field),
'vstm', axes(1:2), time, &
856 idiag%id_srh25 = register_diag_field( trim(field),
'srh25', axes(1:2), time, &
859 if( .not. atm(n)%flagstruct%hydrostatic )
then 860 idiag%id_uh03 = register_diag_field( trim(field),
'uh03', axes(1:2), time, &
862 idiag%id_uh25 = register_diag_field( trim(field),
'uh25', axes(1:2), time, &
866 if( .not. atm(n)%flagstruct%hydrostatic ) &
867 idiag%id_w100m = register_diag_field( trim(field),
'w100m', axes(1:2), time, &
869 idiag%id_u100m = register_diag_field( trim(field),
'u100m', axes(1:2), time, &
871 idiag%id_v100m = register_diag_field( trim(field),
'v100m', axes(1:2), time, &
876 idiag%id_rh10 = register_diag_field( trim(field),
'rh10', axes(1:2), time, &
878 idiag%id_rh50 = register_diag_field( trim(field),
'rh50', axes(1:2), time, &
880 idiag%id_rh100 = register_diag_field( trim(field),
'rh100', axes(1:2), time, &
882 idiag%id_rh200 = register_diag_field( trim(field),
'rh200', axes(1:2), time, &
884 idiag%id_rh250 = register_diag_field( trim(field),
'rh250', axes(1:2), time, &
886 idiag%id_rh300 = register_diag_field( trim(field),
'rh300', axes(1:2), time, &
888 idiag%id_rh500 = register_diag_field( trim(field),
'rh500', axes(1:2), time, &
890 idiag%id_rh700 = register_diag_field( trim(field),
'rh700', axes(1:2), time, &
892 idiag%id_rh850 = register_diag_field( trim(field),
'rh850', axes(1:2), time, &
894 idiag%id_rh925 = register_diag_field( trim(field),
'rh925', axes(1:2), time, &
896 idiag%id_rh1000 = register_diag_field( trim(field),
'rh1000', axes(1:2), time, &
901 idiag%id_dp10 = register_diag_field( trim(field),
'dp10', axes(1:2), time, &
903 idiag%id_dp50 = register_diag_field( trim(field),
'dp50', axes(1:2), time, &
905 idiag%id_dp100 = register_diag_field( trim(field),
'dp100', axes(1:2), time, &
907 idiag%id_dp200 = register_diag_field( trim(field),
'dp200', axes(1:2), time, &
909 idiag%id_dp250 = register_diag_field( trim(field),
'dp250', axes(1:2), time, &
911 idiag%id_dp300 = register_diag_field( trim(field),
'dp300', axes(1:2), time, &
913 idiag%id_dp500 = register_diag_field( trim(field),
'dp500', axes(1:2), time, &
915 idiag%id_dp700 = register_diag_field( trim(field),
'dp700', axes(1:2), time, &
917 idiag%id_dp850 = register_diag_field( trim(field),
'dp850', axes(1:2), time, &
919 idiag%id_dp925 = register_diag_field( trim(field),
'dp925', axes(1:2), time, &
921 idiag%id_dp1000 = register_diag_field( trim(field),
'dp1000', axes(1:2), time, &
926 idiag%id_rh10_cmip = register_diag_field( trim(field),
'rh10_cmip', axes(1:2), time, &
928 idiag%id_rh50_cmip = register_diag_field( trim(field),
'rh50_cmip', axes(1:2), time, &
930 idiag%id_rh100_cmip = register_diag_field( trim(field),
'rh100_cmip', axes(1:2), time, &
932 idiag%id_rh250_cmip = register_diag_field( trim(field),
'rh250_cmip', axes(1:2), time, &
934 idiag%id_rh300_cmip = register_diag_field( trim(field),
'rh300_cmip', axes(1:2), time, &
936 idiag%id_rh500_cmip = register_diag_field( trim(field),
'rh500_cmip', axes(1:2), time, &
938 idiag%id_rh700_cmip = register_diag_field( trim(field),
'rh700_cmip', axes(1:2), time, &
940 idiag%id_rh850_cmip = register_diag_field( trim(field),
'rh850_cmip', axes(1:2), time, &
942 idiag%id_rh925_cmip = register_diag_field( trim(field),
'rh925_cmip', axes(1:2), time, &
944 idiag%id_rh1000_cmip = register_diag_field( trim(field),
'rh1000_cmip', axes(1:2), time, &
947 if (atm(n)%flagstruct%write_3d_diags)
then 953 idiag%id_tracer(i) = register_diag_field( field, trim(
tname), &
957 if (
idiag%id_tracer(i) > 0)
then 959 write(unit,
'(a,a,a,a)') &
960 &
'Diagnostics available for tracer ',trim(
tname), &
961 ' in module ', trim(field)
969 if (trim(
tname).eq.
'co2')
then 970 idiag%w_mr(:) = wtmco2
971 idiag%id_tracer_dmmr(i) = register_diag_field( field, trim(
tname)//
'_dmmr', &
972 axes(1:3), time, trim(
tlongname)//
" (dry mmr)", &
974 idiag%id_tracer_dvmr(i) = register_diag_field( field, trim(
tname)//
'_dvmr', &
975 axes(1:3), time, trim(
tlongname)//
" (dry vmr)", &
979 if (
idiag%id_tracer_dmmr(i) > 0)
then 980 write(unit,
'(a,a,a,a)')
'Diagnostics available for '//trim(
tname)//
' dry mmr ', &
981 trim(
tname)//
'_dmmr',
' in module ', trim(field)
983 if (
idiag%id_tracer_dvmr(i) > 0)
then 984 write(unit,
'(a,a,a,a)')
'Diagnostics available for '//trim(
tname)//
' dry vmr ', &
985 trim(
tname)//
'_dvmr',
' in module ', trim(field)
994 if ( atm(1)%flagstruct%consv_am .or.
idiag%id_mq > 0 .or.
idiag%id_amdt > 0 )
then 995 allocate (
idiag%zxg(isc:iec,jsc:jec) )
997 call init_mq(atm(n)%phis, atm(n)%gridstruct, &
998 npx, npy, isc, iec, jsc, jec, atm(n)%ng)
1005 call prt_mass(npz, atm(n)%ncnst, isc, iec, jsc, jec, atm(n)%ng, max(1,atm(n)%flagstruct%nwat), &
1006 atm(n)%ps, atm(n)%delp, atm(n)%q, atm(n)%gridstruct%area_64, atm(n)%domain)
1008 call prt_mass(npz, atm(n)%ncnst, isc, iec, jsc, jec, atm(n)%ng, atm(n)%flagstruct%nwat, &
1009 atm(n)%ps, atm(n)%delp, atm(n)%q, atm(n)%gridstruct%area_64, atm(n)%domain)
1012 call nullify_domain()
1017 if(
idiag%id_theta_e >0 )
call qsmith_init
1022 subroutine init_mq(phis, gridstruct, npx, npy, is, ie, js, je, ng)
1023 integer,
intent(in):: npx, npy, is, ie, js, je, ng
1024 real,
intent(in):: phis(is-ng:ie+ng, js-ng:je+ng)
1025 type(fv_grid_type),
intent(IN),
target :: gridstruct
1028 real zs(is-ng:ie+ng, js-ng:je+ng)
1029 real zb(is-ng:ie+ng, js-ng:je+ng)
1030 real pdx(3,is:ie,js:je+1)
1031 real pdy(3,is:ie+1,js:je)
1034 real,
pointer :: rarea(:,:)
1035 real,
pointer,
dimension(:,:) :: dx, dy
1036 real(kind=R_GRID),
pointer,
dimension(:,:,:) :: en1, en2, vlon, vlat
1037 real,
pointer,
dimension(:,:,:) :: agrid
1039 rarea => gridstruct%rarea
1042 en1 => gridstruct%en1
1043 en2 => gridstruct%en2
1044 agrid => gridstruct%agrid
1045 vlon => gridstruct%vlon
1046 vlat => gridstruct%vlat
1052 zs(i,j) = phis(i,j) / grav
1058 call a2b_ord4(zs, zb, gridstruct, npx, npy, is, ie, js, je, ng)
1063 pdx(n,i,j) = 0.5*(zb(i,j)+zb(i+1,j))*dx(i,j)*en1(n,i,j)
1070 pdy(n,i,j) = 0.5*(zb(i,j)+zb(i,j+1))*dy(i,j)*en2(n,i,j)
1078 idiag%zxg(i,j) = vlon(i,j,1)*(pdx(1,i,j+1)-pdx(1,i,j)-pdy(1,i,j)+pdy(1,i+1,j)) &
1079 + vlon(i,j,2)*(pdx(2,i,j+1)-pdx(2,i,j)-pdy(2,i,j)+pdy(2,i+1,j)) &
1080 + vlon(i,j,3)*(pdx(3,i,j+1)-pdx(3,i,j)-pdy(3,i,j)+pdy(3,i+1,j))
1083 idiag%zxg(i,j) =
idiag%zxg(i,j)*rarea(i,j) * radius*cos(agrid(i,j,2))
1090 subroutine fv_diag(Atm, zvir, Time, print_freq)
1093 type(time_type),
intent(in) :: time
1094 real,
intent(in):: zvir
1095 integer,
intent(in):: print_freq
1097 integer :: isc, iec, jsc, jec, n, ntileme
1098 integer :: isd, ied, jsd, jed, npz, itrac
1099 integer :: ngc, nwater
1101 real,
allocatable :: a2(:,:),a3(:,:,:), wk(:,:,:), wz(:,:,:), ucoor(:,:,:), vcoor(:,:,:)
1102 real,
allocatable :: ustm(:,:), vstm(:,:)
1103 real,
allocatable :: slp(:,:), depress(:,:), ws_max(:,:), tc_count(:,:)
1104 real,
allocatable :: u2(:,:), v2(:,:), x850(:,:), var1(:,:), var2(:,:), var3(:,:)
1105 real,
allocatable :: dmmr(:,:,:), dvmr(:,:,:)
1109 real :: tot_mq, tmp, sar, slon, slat
1110 real :: a1d(atm(1)%npz)
1112 logical :: do_cs_intp
1114 logical :: bad_range
1115 integer i,j,k, yr, mon, dd, hr, mn, days, seconds, nq, theta_d
1116 character(len=128) ::
tname 1117 real,
parameter:: ws_0 = 16.
1118 real,
parameter:: ws_1 = 20.
1119 real,
parameter:: vort_c0= 2.2e-5
1120 logical,
allocatable :: storm(:,:), cat_crt(:,:)
1121 real :: tmp2, pvsum, e2, einf, qm, mm, maxdbz, allmax, rgrav
1134 pout(i) =
levs(i) * 1.e2
1135 plevs(i) = log( pout(i) )
1138 ntileme =
size(atm(:))
1140 isc = atm(n)%bd%isc; iec = atm(n)%bd%iec
1141 jsc = atm(n)%bd%jsc; jec = atm(n)%bd%jec
1145 nq =
size (atm(n)%q,4)
1147 isd = atm(n)%bd%isd; ied = atm(n)%bd%ied
1148 jsd = atm(n)%bd%jsd; jed = atm(n)%bd%jed
1150 if(
idiag%id_c15>0 )
then 1151 allocate ( storm(isc:iec,jsc:jec) )
1152 allocate ( depress(isc:iec,jsc:jec) )
1153 allocate ( ws_max(isc:iec,jsc:jec) )
1154 allocate ( cat_crt(isc:iec,jsc:jec) )
1155 allocate (tc_count(isc:iec,jsc:jec) )
1158 if(
idiag%id_x850>0 )
then 1159 allocate ( x850(isc:iec,jsc:jec) )
1163 call set_domain(atm(1)%domain)
1166 call get_date(
fv_time, yr, mon, dd, hr, mn, seconds)
1167 if( print_freq == 0 )
then 1169 elseif( print_freq < 0 )
then 1173 prt_minmax = mod(hr, print_freq) == 0 .and. mn==0 .and. seconds==0
1176 call get_time (
fv_time, seconds, days)
1177 if( print_freq == 0 )
then 1179 elseif( print_freq < 0 )
then 1183 prt_minmax = mod(seconds, 3600*print_freq) == 0
1189 if(
master)
write(*,*) yr, mon, dd, hr, mn, seconds
1191 if(
master)
write(*,*) days, seconds
1195 allocate ( a2(isc:iec,jsc:jec) )
1199 call prt_mxm(
'ZS',
idiag%zsurf, isc, iec, jsc, jec, 0, 1, 1.0, atm(n)%gridstruct%area_64, atm(n)%domain)
1200 call prt_maxmin(
'PS', atm(n)%ps, isc, iec, jsc, jec, ngc, 1, 0.01)
1203 allocate(var2(isc:iec,jsc:jec))
1207 slat =
rad2deg*atm(n)%gridstruct%agrid(i,j,2)
1208 if (slat >= 0.)
then 1209 a2(i,j) = atm(n)%ps(i,j)
1213 var2(i,j) = atm(n)%ps(i,j)
1217 call prt_maxmin(
'NH PS', a2, isc, iec, jsc, jec, 0, 1, 0.01)
1218 call prt_maxmin(
'SH PS', var2, isc, iec, jsc, jec, 0, 1, 0.01)
1224 call prt_mass(npz, nq, isc, iec, jsc, jec, ngc, max(1,atm(n)%flagstruct%nwat), &
1225 atm(n)%ps, atm(n)%delp, atm(n)%q, atm(n)%gridstruct%area_64, atm(n)%domain)
1227 call prt_mass(npz, nq, isc, iec, jsc, jec, ngc, atm(n)%flagstruct%nwat, &
1228 atm(n)%ps, atm(n)%delp, atm(n)%q, atm(n)%gridstruct%area_64, atm(n)%domain)
1232 if (atm(n)%flagstruct%consv_te > 1.e-5)
then 1237 write(*,*)
'ENG Deficit (W/m**2)', trim(
gn),
'=',
e_flux 1242 if ( .not. atm(n)%flagstruct%hydrostatic ) &
1244 atm(n)%w, atm(n)%delz, atm(n)%pt, atm(n)%delp, &
1245 atm(n)%q, atm(n)%phis, atm(n)%gridstruct%area, atm(n)%domain, &
1247 atm(n)%ua, atm(n)%va, atm(n)%flagstruct%moist_phys, a2)
1249 call prt_maxmin(
'UA_top', atm(n)%ua(isc:iec,jsc:jec,1), &
1250 isc, iec, jsc, jec, 0, 1, 1.)
1251 call prt_maxmin(
'UA', atm(n)%ua, isc, iec, jsc, jec, ngc, npz, 1.)
1252 call prt_maxmin(
'VA', atm(n)%va, isc, iec, jsc, jec, ngc, npz, 1.)
1254 if ( .not. atm(n)%flagstruct%hydrostatic )
then 1255 call prt_maxmin(
'W ', atm(n)%w , isc, iec, jsc, jec, ngc, npz, 1.)
1256 call prt_maxmin(
'Bottom w', atm(n)%w(isc:iec,jsc:jec,npz), isc, iec, jsc, jec, 0, 1, 1.)
1259 a2(i,j) = -atm(n)%w(i,j,npz)/atm(n)%delz(i,j,npz)
1262 call prt_maxmin(
'Bottom: w/dz', a2, isc, iec, jsc, jec, 0, 1, 1.)
1264 if ( atm(n)%flagstruct%hybrid_z )
call prt_maxmin(
'Hybrid_ZTOP (km)', atm(n)%ze0(isc:iec,jsc:jec,1), &
1265 isc, iec, jsc, jec, 0, 1, 1.e-3)
1266 call prt_maxmin(
'DZ (m)', atm(n)%delz(isc:iec,jsc:jec,1:npz), &
1267 isc, iec, jsc, jec, 0, npz, 1.)
1268 call prt_maxmin(
'Bottom DZ (m)', atm(n)%delz(isc:iec,jsc:jec,npz), &
1269 isc, iec, jsc, jec, 0, 1, 1.)
1275 call prt_maxmin(
'TA', atm(n)%pt, isc, iec, jsc, jec, ngc, npz, 1.)
1278 call prt_maxmin(
'OM', atm(n)%omga, isc, iec, jsc, jec, ngc, npz, 1.)
1281 elseif ( atm(n)%flagstruct%range_warn )
then 1282 call range_check(
'DELP', atm(n)%delp, isc, iec, jsc, jec, ngc, npz, atm(n)%gridstruct%agrid, &
1283 0.01*
ptop, 200.e2, bad_range)
1284 call range_check(
'UA', atm(n)%ua, isc, iec, jsc, jec, ngc, npz, atm(n)%gridstruct%agrid, &
1285 -250., 250., bad_range)
1286 call range_check(
'VA', atm(n)%va, isc, iec, jsc, jec, ngc, npz, atm(n)%gridstruct%agrid, &
1287 -250., 250., bad_range)
1289 call range_check(
'TA', atm(n)%pt, isc, iec, jsc, jec, ngc, npz, atm(n)%gridstruct%agrid, &
1291 130., 350., bad_range)
1293 150., 350., bad_range)
1299 allocate ( u2(isc:iec,jsc:jec) )
1300 allocate ( v2(isc:iec,jsc:jec) )
1301 allocate ( wk(isc:iec,jsc:jec,npz) )
1302 if ( any(
idiag%id_tracer_dmmr > 0) .or. any(
idiag%id_tracer_dvmr > 0) )
then 1303 allocate ( dmmr(isc:iec,jsc:jec,1:npz) )
1304 allocate ( dvmr(isc:iec,jsc:jec,1:npz) )
1311 if(
idiag%id_zsurf > 0) used=send_data(
idiag%id_zsurf,
idiag%zsurf, time)
1313 if(
idiag%id_ps > 0) used=send_data(
idiag%id_ps, atm(n)%ps(isc:iec,jsc:jec), time)
1316 call wind_max(isc, iec, jsc, jec ,isd, ied, jsd, jed, atm(n)%ua(isc:iec,jsc:jec,npz), &
1317 atm(n)%va(isc:iec,jsc:jec,npz), ws_max, atm(n)%domain)
1320 if( abs(atm(n)%gridstruct%agrid(i,j,2)*
rad2deg)<45.0 .and. &
1321 atm(n)%phis(i,j)*
ginv<500.0 .and. ws_max(i,j)>ws_0 )
then 1324 storm(i,j) = .false.
1330 if (
idiag%id_vort200>0 .or.
idiag%id_vort500>0 .or.
idiag%id_vort850>0 .or.
idiag%id_vorts>0 &
1333 call get_vorticity(isc, iec, jsc, jec, isd, ied, jsd, jed, npz, atm(n)%u, atm(n)%v, wk, &
1334 atm(n)%gridstruct%dx, atm(n)%gridstruct%dy, atm(n)%gridstruct%rarea)
1336 if(
idiag%id_vort >0) used=send_data(
idiag%id_vort, wk, time)
1337 if(
idiag%id_vorts>0) used=send_data(
idiag%id_vorts, wk(isc:iec,jsc:jec,npz), time)
1339 if(
idiag%id_c15>0)
then 1343 storm(i,j) = (atm(n)%gridstruct%agrid(i,j,2)>0. .and. wk(i,j,npz)> vort_c0) .or. &
1344 (atm(n)%gridstruct%agrid(i,j,2)<0. .and. wk(i,j,npz)<-vort_c0)
1349 if(
idiag%id_vort200>0 )
then 1351 200.e2, atm(n)%peln, wk, a2)
1352 used=send_data(
idiag%id_vort200, a2, time)
1354 if(
idiag%id_vort500>0 )
then 1356 500.e2, atm(n)%peln, wk, a2)
1357 used=send_data(
idiag%id_vort500, a2, time)
1362 850.e2, atm(n)%peln, wk, a2)
1363 used=send_data(
idiag%id_vort850, a2, time)
1364 if (
idiag%id_x850>0 ) x850(:,:) = a2(:,:)
1366 if(
idiag%id_c15>0)
then 1370 storm(i,j) = (atm(n)%gridstruct%agrid(i,j,2)>0. .and. a2(i,j)> vort_c0) .or. &
1371 (atm(n)%gridstruct%agrid(i,j,2)<0. .and. a2(i,j)<-vort_c0)
1378 if( .not. atm(n)%flagstruct%hydrostatic )
then 1380 if (
idiag%id_uh03 > 0 )
then 1382 atm(n)%w, wk, atm(n)%delz, atm(n)%q, &
1383 atm(n)%flagstruct%hydrostatic, atm(n)%pt, atm(n)%peln, atm(n)%phis, grav, 0., 3.e3)
1384 used = send_data(
idiag%id_uh03, a2, time )
1388 tmp =
rad2deg * atm(n)%gridstruct%agrid(i,j,1)
1389 tmp2 =
rad2deg * atm(n)%gridstruct%agrid(i,j,2)
1390 if ( tmp2<25. .or. tmp2>50. &
1391 .or. tmp<235. .or. tmp>300. )
then 1396 call prt_maxmin(
'UH over CONUS', a2, isc, iec, jsc, jec, 0, 1, 1.)
1399 if (
idiag%id_uh25 > 0 )
then 1401 atm(n)%w, wk, atm(n)%delz, atm(n)%q, &
1402 atm(n)%flagstruct%hydrostatic, atm(n)%pt, atm(n)%peln, atm(n)%phis, grav, 2.e3, 5.e3)
1403 used = send_data(
idiag%id_uh25, a2, time )
1408 if (
idiag%id_srh1 > 0 .or.
idiag%id_srh3 > 0 .or.
idiag%id_srh25 > 0 .or.
idiag%id_ustm > 0 .or.
idiag%id_vstm > 0)
then 1409 allocate(ustm(isc:iec,jsc:jec), vstm(isc:iec,jsc:jec))
1411 call bunkers_vector(isc, iec, jsc, jec, ngc, npz, zvir,
sphum, ustm, vstm, &
1412 atm(n)%ua, atm(n)%va, atm(n)%delz, atm(n)%q, &
1413 atm(n)%flagstruct%hydrostatic, atm(n)%pt, atm(n)%peln, atm(n)%phis, grav)
1415 if (
idiag%id_ustm > 0 )
then 1416 used = send_data(
idiag%id_ustm, ustm, time )
1418 if (
idiag%id_vstm > 0 )
then 1419 used = send_data(
idiag%id_vstm, vstm, time )
1422 if (
idiag%id_srh1 > 0 )
then 1423 call helicity_relative_caps(isc, iec, jsc, jec, ngc, npz, zvir,
sphum, a2, ustm, vstm, &
1424 atm(n)%ua, atm(n)%va, atm(n)%delz, atm(n)%q, &
1425 atm(n)%flagstruct%hydrostatic, atm(n)%pt, atm(n)%peln, atm(n)%phis, grav, 0., 1.e3)
1426 used = send_data(
idiag%id_srh1, a2, time )
1430 tmp =
rad2deg * atm(n)%gridstruct%agrid(i,j,1)
1431 tmp2 =
rad2deg * atm(n)%gridstruct%agrid(i,j,2)
1432 if ( tmp2<25. .or. tmp2>50. &
1433 .or. tmp<235. .or. tmp>300. )
then 1438 call prt_maxmin(
'SRH (0-1 km) over CONUS', a2, isc, iec, jsc, jec, 0, 1, 1.)
1442 if (
idiag%id_srh3 > 0 )
then 1443 call helicity_relative_caps(isc, iec, jsc, jec, ngc, npz, zvir,
sphum, a2, ustm, vstm, &
1444 atm(n)%ua, atm(n)%va, atm(n)%delz, atm(n)%q, &
1445 atm(n)%flagstruct%hydrostatic, atm(n)%pt, atm(n)%peln, atm(n)%phis, grav, 0., 3e3)
1446 used = send_data(
idiag%id_srh3, a2, time )
1450 tmp =
rad2deg * atm(n)%gridstruct%agrid(i,j,1)
1451 tmp2 =
rad2deg * atm(n)%gridstruct%agrid(i,j,2)
1452 if ( tmp2<25. .or. tmp2>50. &
1453 .or. tmp<235. .or. tmp>300. )
then 1458 call prt_maxmin(
'SRH (0-3 km) over CONUS', a2, isc, iec, jsc, jec, 0, 1, 1.)
1462 if (
idiag%id_srh25 > 0 )
then 1463 call helicity_relative_caps(isc, iec, jsc, jec, ngc, npz, zvir,
sphum, a2, ustm, vstm, &
1464 atm(n)%ua, atm(n)%va, atm(n)%delz, atm(n)%q, &
1465 atm(n)%flagstruct%hydrostatic, atm(n)%pt, atm(n)%peln, atm(n)%phis, grav, 2.e3, 5e3)
1466 used = send_data(
idiag%id_srh25, a2, time )
1470 tmp =
rad2deg * atm(n)%gridstruct%agrid(i,j,1)
1471 tmp2 =
rad2deg * atm(n)%gridstruct%agrid(i,j,2)
1472 if ( tmp2<25. .or. tmp2>50. &
1473 .or. tmp<235. .or. tmp>300. )
then 1478 call prt_maxmin(
'SRH (2-5 km) over CONUS', a2, isc, iec, jsc, jec, 0, 1, 1.)
1482 deallocate(ustm, vstm)
1486 if (
idiag%id_pv > 0 )
then 1488 call pv_entropy(isc, iec, jsc, jec, ngc, npz, wk, &
1489 atm(n)%gridstruct%f0, atm(n)%pt, atm(n)%pkz, atm(n)%delp, grav)
1490 used = send_data(
idiag%id_pv, wk, time )
1527 if (
idiag%id_rh > 0 )
then 1532 a2(i,j) = atm(n)%delp(i,j,k)/(atm(n)%peln(i,k+1,j)-atm(n)%peln(i,k,j))
1536 call qsmith((iec-isc+1)*(jec-jsc+1), npz, &
1537 (iec-isc+1)*(jec-jsc+1), 1, atm(n)%pt(isc:iec,jsc:jec,k), &
1538 a2, atm(n)%q(isc:iec,jsc:jec,k,
sphum), wk(isc,jsc,k))
1540 call qsmith(iec-isc+1, jec-jsc+1, 1, atm(n)%pt(isc:iec,jsc:jec,k), &
1541 a2, atm(n)%q(isc:iec,jsc:jec,k,
sphum), wk(isc,jsc,k))
1545 wk(i,j,k) = 100.*atm(n)%q(i,j,k,
sphum)/wk(i,j,k)
1549 used = send_data(
idiag%id_rh, wk, time )
1551 call prt_maxmin(
'RH_sf (%)', wk(isc:iec,jsc:jec,npz), isc, iec, jsc, jec, 0, 1, 1.)
1552 call prt_maxmin(
'RH_3D (%)', wk, isc, iec, jsc, jec, 0, npz, 1.)
1559 idiag%id_rh925>0 .or.
idiag%id_rh1000>0 .or. &
1562 idiag%id_dp925>0 .or.
idiag%id_dp1000>0)
then 1567 a2(i,j) = atm(n)%delp(i,j,k)/(atm(n)%peln(i,k+1,j)-atm(n)%peln(i,k,j))
1570 call rh_calc (a2, atm(n)%pt(isc:iec,jsc:jec,k), &
1571 atm(n)%q(isc:iec,jsc:jec,k,
sphum), wk(isc:iec,jsc:jec,k))
1573 if (
idiag%id_rh50>0)
then 1574 call interpolate_vertical(isc, iec, jsc, jec, npz, 50.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1575 used=send_data(
idiag%id_rh50, a2, time)
1577 if (
idiag%id_rh100>0)
then 1578 call interpolate_vertical(isc, iec, jsc, jec, npz, 100.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1579 used=send_data(
idiag%id_rh100, a2, time)
1581 if (
idiag%id_rh200>0)
then 1582 call interpolate_vertical(isc, iec, jsc, jec, npz, 200.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1583 used=send_data(
idiag%id_rh200, a2, time)
1585 if (
idiag%id_rh250>0)
then 1586 call interpolate_vertical(isc, iec, jsc, jec, npz, 250.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1587 used=send_data(
idiag%id_rh250, a2, time)
1589 if (
idiag%id_rh300>0)
then 1590 call interpolate_vertical(isc, iec, jsc, jec, npz, 300.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1591 used=send_data(
idiag%id_rh300, a2, time)
1593 if (
idiag%id_rh500>0)
then 1594 call interpolate_vertical(isc, iec, jsc, jec, npz, 500.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1595 used=send_data(
idiag%id_rh500, a2, time)
1597 if (
idiag%id_rh700>0)
then 1598 call interpolate_vertical(isc, iec, jsc, jec, npz, 700.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1599 used=send_data(
idiag%id_rh700, a2, time)
1601 if (
idiag%id_rh850>0)
then 1602 call interpolate_vertical(isc, iec, jsc, jec, npz, 850.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1603 used=send_data(
idiag%id_rh850, a2, time)
1605 if (
idiag%id_rh925>0)
then 1606 call interpolate_vertical(isc, iec, jsc, jec, npz, 925.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1607 used=send_data(
idiag%id_rh925, a2, time)
1609 if (
idiag%id_rh1000>0)
then 1610 call interpolate_vertical(isc, iec, jsc, jec, npz, 1000.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1611 used=send_data(
idiag%id_rh1000, a2, time)
1616 idiag%id_dp925>0 .or.
idiag%id_dp1000>0 )
then 1618 if (
allocated(a3))
deallocate(a3)
1619 allocate(a3(isc:iec,jsc:jec,1:npz))
1625 tmp = ( log(max(wk(i,j,k)*1.e-2,1.e-2)) + 17.27 * ( atm(n)%pt(i,j,k) - 273.14 )/ ( -35.84 + atm(n)%pt(i,j,k)) ) / 17.27
1626 a3(i,j,k) = 273.14 + 237.3*tmp/ ( 1. - tmp )
1631 if (
idiag%id_dp50>0)
then 1633 used=send_data(
idiag%id_dp50, a2, time)
1635 if (
idiag%id_dp100>0)
then 1637 used=send_data(
idiag%id_dp100, a2, time)
1639 if (
idiag%id_dp200>0)
then 1641 used=send_data(
idiag%id_dp200, a2, time)
1643 if (
idiag%id_dp250>0)
then 1645 used=send_data(
idiag%id_dp250, a2, time)
1647 if (
idiag%id_dp300>0)
then 1649 used=send_data(
idiag%id_dp300, a2, time)
1651 if (
idiag%id_dp500>0)
then 1653 used=send_data(
idiag%id_dp500, a2, time)
1655 if (
idiag%id_dp700>0)
then 1657 used=send_data(
idiag%id_dp700, a2, time)
1659 if (
idiag%id_dp850>0)
then 1661 used=send_data(
idiag%id_dp850, a2, time)
1663 if (
idiag%id_dp925>0)
then 1665 used=send_data(
idiag%id_dp925, a2, time)
1667 if (
idiag%id_dp1000>0)
then 1669 used=send_data(
idiag%id_dp1000, a2, time)
1678 if (
idiag%id_rh10_cmip>0 .or.
idiag%id_rh50_cmip>0 .or.
idiag%id_rh100_cmip>0 .or. &
1679 idiag%id_rh250_cmip>0 .or.
idiag%id_rh300_cmip>0 .or.
idiag%id_rh500_cmip>0 .or. &
1680 idiag%id_rh700_cmip>0 .or.
idiag%id_rh850_cmip>0 .or.
idiag%id_rh925_cmip>0 .or. &
1681 idiag%id_rh1000_cmip>0)
then 1686 a2(i,j) = atm(n)%delp(i,j,k)/(atm(n)%peln(i,k+1,j)-atm(n)%peln(i,k,j))
1689 call rh_calc (a2, atm(n)%pt(isc:iec,jsc:jec,k), &
1690 atm(n)%q(isc:iec,jsc:jec,k,
sphum), wk(isc:iec,jsc:jec,k), do_cmip=.true.)
1692 if (
idiag%id_rh10_cmip>0)
then 1693 call interpolate_vertical(isc, iec, jsc, jec, npz, 10.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1694 used=send_data(
idiag%id_rh10_cmip, a2, time)
1696 if (
idiag%id_rh50_cmip>0)
then 1697 call interpolate_vertical(isc, iec, jsc, jec, npz, 50.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1698 used=send_data(
idiag%id_rh50_cmip, a2, time)
1700 if (
idiag%id_rh100_cmip>0)
then 1701 call interpolate_vertical(isc, iec, jsc, jec, npz, 100.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1702 used=send_data(
idiag%id_rh100_cmip, a2, time)
1704 if (
idiag%id_rh250_cmip>0)
then 1705 call interpolate_vertical(isc, iec, jsc, jec, npz, 250.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1706 used=send_data(
idiag%id_rh250_cmip, a2, time)
1708 if (
idiag%id_rh300_cmip>0)
then 1709 call interpolate_vertical(isc, iec, jsc, jec, npz, 300.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1710 used=send_data(
idiag%id_rh300_cmip, a2, time)
1712 if (
idiag%id_rh500_cmip>0)
then 1713 call interpolate_vertical(isc, iec, jsc, jec, npz, 500.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1714 used=send_data(
idiag%id_rh500_cmip, a2, time)
1716 if (
idiag%id_rh700_cmip>0)
then 1717 call interpolate_vertical(isc, iec, jsc, jec, npz, 700.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1718 used=send_data(
idiag%id_rh700_cmip, a2, time)
1720 if (
idiag%id_rh850_cmip>0)
then 1721 call interpolate_vertical(isc, iec, jsc, jec, npz, 850.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1722 used=send_data(
idiag%id_rh850_cmip, a2, time)
1724 if (
idiag%id_rh925_cmip>0)
then 1725 call interpolate_vertical(isc, iec, jsc, jec, npz, 925.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1726 used=send_data(
idiag%id_rh925_cmip, a2, time)
1728 if (
idiag%id_rh1000_cmip>0)
then 1729 call interpolate_vertical(isc, iec, jsc, jec, npz, 1000.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1730 used=send_data(
idiag%id_rh1000_cmip, a2, time)
1737 if ( storm(i,j) .and. ws_max(i,j)>ws_1 )
then 1738 cat_crt(i,j) = .true.
1740 cat_crt(i,j) = .false.
1750 allocate ( wz(isc:iec,jsc:jec,npz+1) )
1751 call get_height_field(isc, iec, jsc, jec, ngc, npz, atm(n)%flagstruct%hydrostatic, atm(n)%delz, &
1752 wz, atm(n)%pt, atm(n)%q, atm(n)%peln, zvir)
1754 call prt_mxm(
'ZTOP',wz(isc:iec,jsc:jec,1), isc, iec, jsc, jec, 0, 1, 1.e-3, atm(n)%gridstruct%area_64, atm(n)%domain)
1757 if(
idiag%id_slp > 0)
then 1759 allocate ( slp(isc:iec,jsc:jec) )
1761 atm(n)%pt(:,:,npz), atm(n)%peln, slp, 0.01)
1762 used = send_data(
idiag%id_slp, slp, time)
1764 call prt_maxmin(
'SLP', slp, isc, iec, jsc, jec, 0, 1, 1.)
1769 slon =
rad2deg*atm(n)%gridstruct%agrid(i,j,1)
1770 slat =
rad2deg*atm(n)%gridstruct%agrid(i,j,2)
1771 if ( slat>15. .and. slat<40. .and. slon>270. .and. slon<290. )
then 1776 call prt_maxmin(
'ATL SLP', a2, isc, iec, jsc, jec, 0, 1, 1.)
1783 allocate( a3(isc:iec,jsc:jec,
nplev) )
1785 idg(:) =
idiag%id_h(:)
1787 if (
idiag%id_tm>0 )
then 1788 idg(minloc(abs(
levs-300))) = 1
1789 idg(minloc(abs(
levs-500))) = 1
1791 idg(minloc(abs(
levs-300))) =
idiag%id_h(minloc(abs(
levs-300)))
1792 idg(minloc(abs(
levs-500))) =
idiag%id_h(minloc(abs(
levs-500)))
1795 call get_height_given_pressure(isc, iec, jsc, jec, npz, wz,
nplev, idg, plevs, atm(n)%peln, a3)
1797 idg(minloc(abs(
levs-300))) =
idiag%id_h(minloc(abs(
levs-300)))
1798 idg(minloc(abs(
levs-500))) =
idiag%id_h(minloc(abs(
levs-500)))
1801 if (idg(i)>0) used=send_data(idg(i), a3(isc:iec,jsc:jec,i), time)
1804 if (
idiag%id_h_plev>0)
then 1806 call get_height_given_pressure(isc, iec, jsc, jec, npz, wz,
nplev, id1, plevs, atm(n)%peln, a3)
1807 used=send_data(
idiag%id_h_plev, a3(isc:iec,jsc:jec,:), time)
1812 if(all(
idiag%id_h(minloc(abs(
levs-100)))>0)) &
1813 call prt_mxm(
'Z100',a3(isc:iec,jsc:jec,11),isc,iec,jsc,jec,0,1,1.e-3,atm(n)%gridstruct%area_64,atm(n)%domain)
1815 if(all(
idiag%id_h(minloc(abs(
levs-500)))>0))
then 1816 if (.not. atm(n)%neststruct%nested)
then 1817 #ifdef TO_BE_DELETED 1818 t_eq = 0. ; t_nh = 0.; t_sh = 0.; t_gb = 0.
1819 area_eq = 0.; area_nh = 0.; area_sh = 0.; area_gb = 0.
1822 slat = atm(n)%gridstruct%agrid(i,j,2)*
rad2deg 1823 area_gb = area_gb + atm(n)%gridstruct%area(i,j)
1824 t_gb = t_gb + a3(i,j,19)*atm(n)%gridstruct%area(i,j)
1825 if( (slat>-20. .and. slat<20.) )
then 1827 area_eq = area_eq + atm(n)%gridstruct%area(i,j)
1828 t_eq = t_eq + a3(i,j,19)*atm(n)%gridstruct%area(i,j)
1829 elseif( slat>=20. .and. slat<80. )
then 1831 area_nh = area_nh + atm(n)%gridstruct%area(i,j)
1832 t_nh = t_nh + a3(i,j,19)*atm(n)%gridstruct%area(i,j)
1833 elseif( slat<=-20. .and. slat>-80. )
then 1835 area_sh = area_sh + atm(n)%gridstruct%area(i,j)
1836 t_sh = t_sh + a3(i,j,19)*atm(n)%gridstruct%area(i,j)
1840 call mp_reduce_sum(area_gb)
1841 call mp_reduce_sum( t_gb)
1842 call mp_reduce_sum(area_nh)
1843 call mp_reduce_sum( t_nh)
1844 call mp_reduce_sum(area_sh)
1845 call mp_reduce_sum( t_sh)
1846 call mp_reduce_sum(area_eq)
1847 call mp_reduce_sum( t_eq)
1848 if (
master)
write(*,*)
'Z500 GB_NH_SH_EQ=', t_gb/area_gb, t_nh/area_nh, t_sh/area_sh, t_eq/area_eq
1851 call prt_gb_nh_sh(
'fv_GFS Z500', isc,iec, jsc,jec, a3(isc,jsc,19), atm(n)%gridstruct%area_64(isc:iec,jsc:jec), &
1852 atm(n)%gridstruct%agrid_64(isc:iec,jsc:jec,2))
1859 if(
idiag%id_tm>0 )
then 1862 a2(i,j) = grav*(a3(i,j,15)-a3(i,j,19))/(rdgas*(plevs(19)-plevs(15)))
1865 used = send_data(
idiag%id_tm, a2, time )
1872 if ( storm(i,j) )
then 1873 if( a2(i,j)<254.0 .or. atm(n)%pt(i,j,npz)<281.0 )
Then 1874 storm(i,j) = .false.
1875 cat_crt(i,j) = .false.
1883 if ( storm(i,j) .and. slp(i,j)<1000.0 )
then 1884 depress(i,j) = 1000. - slp(i,j)
1892 used = send_data(
idiag%id_c15, depress, time)
1893 if(
idiag%id_f15>0) used = send_data(
idiag%id_f15, tc_count, time)
1897 slon =
rad2deg*atm(n)%gridstruct%agrid(i,j,1)
1898 slat =
rad2deg*atm(n)%gridstruct%agrid(i,j,2)
1900 if ( slat>0. .and. slat<40. .and. slon>110. .and. slon<180. )
then 1901 depress(i,j) = -depress(i,j)
1905 call prt_maxmin(
'Depress', depress, isc, iec, jsc, jec, 0, 1, 1.)
1908 if ( atm(n)%gridstruct%agrid(i,j,2)<0.)
then 1914 call prt_maxmin(
'NH Deps', depress, isc, iec, jsc, jec, 0, 1, 1.)
1919 tmp =
rad2deg * atm(n)%gridstruct%agrid(i,j,1)
1920 if ( tmp<280. )
then 1925 call prt_maxmin(
'ATL Deps', depress, isc, iec, jsc, jec, 0, 1, 1.)
1930 if(
idiag%id_c25>0)
then 1933 if ( cat_crt(i,j) .and. slp(i,j)<980.0 )
then 1934 depress(i,j) = 980. - slp(i,j)
1942 used = send_data(
idiag%id_c25, depress, time)
1943 if(
idiag%id_f25>0) used = send_data(
idiag%id_f25, tc_count, time)
1947 if(
idiag%id_c35>0)
then 1950 if ( cat_crt(i,j) .and. slp(i,j)<964.0 )
then 1951 depress(i,j) = 964. - slp(i,j)
1959 used = send_data(
idiag%id_c35, depress, time)
1960 if(
idiag%id_f35>0) used = send_data(
idiag%id_f35, tc_count, time)
1964 if(
idiag%id_c45>0)
then 1967 if ( cat_crt(i,j) .and. slp(i,j)<944.0 )
then 1968 depress(i,j) = 944. - slp(i,j)
1976 used = send_data(
idiag%id_c45, depress, time)
1977 if(
idiag%id_f45>0) used = send_data(
idiag%id_f45, tc_count, time)
1980 if (
idiag%id_c15>0)
then 1985 deallocate(tc_count)
1988 if(
idiag%id_slp>0 )
deallocate( slp )
1997 idg(:) =
idiag%id_t(:)
1999 do_cs_intp = .false.
2001 if ( idg(i)>0 )
then 2007 if ( do_cs_intp )
then 2008 if(.not.
allocated (a3) )
allocate( a3(isc:iec,jsc:jec,
nplev) )
2010 plevs, wz, atm(n)%peln, idg, a3, 1)
2012 if (idg(i)>0) used=send_data(idg(i), a3(isc:iec,jsc:jec,i), time)
2015 call prt_mxm(
'T100:', a3(isc:iec,jsc:jec,11), isc, iec, jsc, jec, 0, 1, 1., &
2016 atm(n)%gridstruct%area_64, atm(n)%domain)
2017 if (.not. atm(n)%neststruct%nested)
then 2023 slat = atm(n)%gridstruct%agrid(i,j,2)*
rad2deg 2024 if( (slat>-10.0 .and. slat<10.) )
then 2025 sar = sar + atm(n)%gridstruct%area(i,j)
2026 tmp = tmp + a3(i,j,11)*atm(n)%gridstruct%area(i,j)
2030 call mp_reduce_sum(sar)
2031 call mp_reduce_sum(tmp)
2032 if ( sar > 0. )
then 2033 if (
master)
write(*,*)
'Tropical [10s,10n] mean T100 =', tmp/sar
2035 if (
master)
write(*,*)
'Warning: problem computing tropical mean T100' 2040 call prt_mxm(
'T200:', a3(isc:iec,jsc:jec,13), isc, iec, jsc, jec, 0, 1, 1., &
2041 atm(n)%gridstruct%area_64, atm(n)%domain)
2042 if (.not. atm(n)%neststruct%nested)
then 2047 slat = atm(n)%gridstruct%agrid(i,j,2)*
rad2deg 2048 if( (slat>-20 .and. slat<20) )
then 2049 sar = sar + atm(n)%gridstruct%area(i,j)
2050 tmp = tmp + a3(i,j,13)*atm(n)%gridstruct%area(i,j)
2054 call mp_reduce_sum(sar)
2055 call mp_reduce_sum(tmp)
2056 if ( sar > 0. )
then 2057 if (
master)
write(*,*)
'Tropical [-20.,20.] mean T200 =', tmp/sar
2064 if (
idiag%id_t_plev>0)
then 2065 if(.not.
allocated (a3) )
allocate( a3(isc:iec,jsc:jec,
nplev) )
2068 plevs, wz, atm(n)%peln, id1, a3, 1)
2069 used=send_data(
idiag%id_t_plev, a3(isc:iec,jsc:jec,:), time)
2073 if(
idiag%id_mq > 0)
then 2078 a2(i,j) = -1.e-18 * atm(n)%ps(i,j)*
idiag%zxg(i,j)
2081 used = send_data(
idiag%id_mq, a2, time)
2083 tot_mq =
g_sum( atm(n)%domain, a2, isc, iec, jsc, jec, ngc, atm(n)%gridstruct%area_64, 0)
2086 if(
master)
write(*,*)
'Total (global) mountain torque (Hadleys)=', tot_mq
2090 if (
idiag%id_ts > 0) used = send_data(
idiag%id_ts, atm(n)%ts(isc:iec,jsc:jec), time)
2092 if (
idiag%id_tq>0 )
then 2093 nwater = atm(1)%flagstruct%nwat
2099 a2(i,j) = a2(i,j) + sum(atm(n)%q(i,j,k,1:nwater))*atm(n)%delp(i,j,k)
2103 used = send_data(
idiag%id_tq, a2*
ginv, time)
2106 cl = get_tracer_index(model_atmos,
'Cl')
2107 cl2 = get_tracer_index(model_atmos,
'Cl2')
2108 if (cl > 0 .and. cl2 > 0)
then 2109 allocate(var2(isc:iec,jsc:jec))
2114 var2(i,j) = var2(i,j) + atm(n)%delp(i,j,k)
2119 if (
idiag%id_acl > 0 )
then 2126 a2(i,j) = a2(i,j) + atm(n)%q(i,j,k,cl)*atm(n)%delp(i,j,k)
2133 a2(i,j) = a2(i,j) / var2(i,j)
2136 used = send_data(
idiag%id_acl, a2, time)
2138 if (
idiag%id_acl2 > 0 )
then 2145 a2(i,j) = a2(i,j) + atm(n)%q(i,j,k,cl2)*atm(n)%delp(i,j,k)
2152 a2(i,j) = a2(i,j) / var2(i,j)
2155 used = send_data(
idiag%id_acl2, a2, time)
2157 if (
idiag%id_acly > 0 )
then 2165 mm = (atm(n)%q(i,j,k,cl)+2.*atm(n)%q(i,j,k,cl2))*atm(n)%delp(i,j,k)
2166 a2(i,j) = a2(i,j) + mm
2167 qm = qm + mm*atm(n)%gridstruct%area_64(i,j)
2174 a2(i,j) = a2(i,j) / var2(i,j)
2177 used = send_data(
idiag%id_acly, a2, time)
2180 e2 = e2 + ((a2(i,j) -
qcly0)**2)*atm(n)%gridstruct%area_64(i,j)
2181 einf = max(einf, abs(a2(i,j) -
qcly0))
2184 if (
prt_minmax .and. .not. atm(n)%neststruct%nested)
then 2185 call mp_reduce_sum(qm)
2186 call mp_reduce_max(einf)
2187 call mp_reduce_sum(e2)
2189 write(*,*)
' TERMINATOR TEST: ' 2190 write(*,*)
' chlorine mass: ',
real(qm)/(4.*pi*radius*radius)
2191 write(*,*)
' L2 err: ', sqrt(e2)/sqrt(4.*pi*radius*radius)/
qcly0 2192 write(*,*)
' max err: ', einf/
qcly0 2201 if (
idiag%id_iw>0 )
then 2207 a2(i,j) = a2(i,j) + atm(n)%delp(i,j,k) * &
2217 a2(i,j) = a2(i,j) + atm(n)%delp(i,j,k) * &
2227 a2(i,j) = a2(i,j) + atm(n)%delp(i,j,k) * &
2233 used = send_data(
idiag%id_iw, a2*
ginv, time)
2235 if (
idiag%id_lw>0 )
then 2241 a2(i,j) = a2(i,j) + atm(n)%q(i,j,k,
liq_wat)*atm(n)%delp(i,j,k)
2250 a2(i,j) = a2(i,j) + atm(n)%q(i,j,k,
rainwat)*atm(n)%delp(i,j,k)
2255 used = send_data(
idiag%id_lw, a2*
ginv, time)
2259 if ( (
idiag%id_ctt>0 .or.
idiag%id_ctp>0 .or.
idiag%id_ctz>0).and. atm(n)%flagstruct%nwat==6)
then 2260 allocate ( var1(isc:iec,jsc:jec) )
2261 allocate ( var2(isc:iec,jsc:jec) )
2268 if( tmp>5.e-6 )
then 2269 a2(i,j) = atm(n)%pt(i,j,k)
2270 var1(i,j) = 0.01*atm(n)%pe(i,k,j)
2271 var2(i,j) = wz(i,j,k) - wz(i,j,npz+1)
2273 elseif( k==npz )
then 2283 if (
idiag%id_ctt>0 )
then 2284 used = send_data(
idiag%id_ctt, a2, time)
2287 if (
idiag%id_ctp>0 )
then 2288 used = send_data(
idiag%id_ctp, var1, time)
2292 if (
idiag%id_ctz>0 )
then 2293 used = send_data(
idiag%id_ctz, var2, time)
2314 wk(i,j,k) = wk(i,j,k) + atm(n)%q(i,j,k,
liq_wat)*atm(n)%delp(i,j,k)
2324 wk(i,j,k) = wk(i,j,k) + atm(n)%q(i,j,k,
ice_wat)*atm(n)%delp(i,j,k)
2329 if (
idiag%id_qn>0 ) used = send_data(
idiag%id_qn, wk, time)
2330 if (
idiag%id_qn200>0 )
then 2332 used=send_data(
idiag%id_qn200, a2, time)
2334 if (
idiag%id_qn500>0 )
then 2336 used=send_data(
idiag%id_qn500, a2, time)
2338 if (
idiag%id_qn850>0 )
then 2340 used=send_data(
idiag%id_qn850, a2, time)
2344 if (
idiag%id_qp>0 )
then 2358 wk(i,j,k) = wk(i,j,k) + atm(n)%q(i,j,k,
rainwat)*atm(n)%delp(i,j,k)
2368 wk(i,j,k) = wk(i,j,k) + atm(n)%q(i,j,k,
snowwat)*atm(n)%delp(i,j,k)
2378 wk(i,j,k) = wk(i,j,k) + atm(n)%q(i,j,k,
graupel)*atm(n)%delp(i,j,k)
2383 used = send_data(
idiag%id_qp, wk, time)
2386 if(
idiag%id_us > 0 .and.
idiag%id_vs > 0)
then 2387 u2(:,:) = atm(n)%ua(isc:iec,jsc:jec,npz)
2388 v2(:,:) = atm(n)%va(isc:iec,jsc:jec,npz)
2391 a2(i,j) = sqrt(u2(i,j)**2 + v2(i,j)**2)
2394 used=send_data(
idiag%id_us, u2, time)
2395 used=send_data(
idiag%id_vs, v2, time)
2399 if(
idiag%id_tb > 0)
then 2400 a2(:,:) = atm(n)%pt(isc:iec,jsc:jec,npz)
2401 used=send_data(
idiag%id_tb, a2, time)
2403 call prt_mxm(
'T_bot:', a2, isc, iec, jsc, jec, 0, 1, 1., atm(n)%gridstruct%area_64, atm(n)%domain)
2406 if(
idiag%id_ua > 0) used=send_data(
idiag%id_ua, atm(n)%ua(isc:iec,jsc:jec,:), time)
2407 if(
idiag%id_va > 0) used=send_data(
idiag%id_va, atm(n)%va(isc:iec,jsc:jec,:), time)
2409 if(
idiag%id_ke > 0)
then 2414 a2(i,j) = a2(i,j) + atm(n)%delp(i,j,k)*(atm(n)%ua(i,j,k)**2+atm(n)%va(i,j,k)**2)
2421 a2(i,j) = 0.5*a2(i,j)/(atm(n)%ps(i,j)-
ptop)
2424 used=send_data(
idiag%id_ke, a2, time)
2426 tot_mq =
g_sum( atm(n)%domain, a2, isc, iec, jsc, jec, ngc, atm(n)%gridstruct%area_64, 1)
2427 if (
master)
write(*,*)
'SQRT(2.*KE; m/s)=', sqrt(2.*tot_mq)
2433 if(
idiag%id_delp > 0 .or.
idiag%id_cape > 0 .or.
idiag%id_cin > 0 .or. ((.not. atm(n)%flagstruct%hydrostatic) .and.
idiag%id_pfnh > 0))
then 2437 wk(i,j,k) = atm(n)%delp(i,j,k)*(1.-sum(atm(n)%q(i,j,k,2:atm(n)%flagstruct%nwat)))
2441 if (
idiag%id_delp > 0) used=send_data(
idiag%id_delp, wk, time)
2444 if( ( (.not. atm(n)%flagstruct%hydrostatic) .and.
idiag%id_pfnh > 0) .or.
idiag%id_cape > 0 .or.
idiag%id_cin > 0)
then 2449 wk(i,j,k) = -wk(i,j,k)/(atm(n)%delz(i,j,k)*grav)*rdgas* &
2452 wk(i,j,k) = -wk(i,j,k)/(atm(n)%delz(i,j,k)*grav)*rdgas* &
2453 atm(n)%pt(i,j,k)*(1.+zvir*atm(n)%q(i,j,k,
sphum))
2461 used=send_data(
idiag%id_pfnh, wk, time)
2464 if(
idiag%id_delp > 0) used=send_data(
idiag%id_delp, atm(n)%delp(isc:iec,jsc:jec,:), time)
2466 if( (.not. atm(n)%flagstruct%hydrostatic) .and. (
idiag%id_pfnh > 0 .or.
idiag%id_cape > 0 .or.
idiag%id_cin > 0))
then 2471 wk(i,j,k) = -atm(n)%delp(i,j,k)/(atm(n)%delz(i,j,k)*grav)*rdgas* &
2474 wk(i,j,k) = -atm(n)%delp(i,j,k)/(atm(n)%delz(i,j,k)*grav)*rdgas* &
2475 atm(n)%pt(i,j,k)*(1.+zvir*atm(n)%q(i,j,k,
sphum))
2480 used=send_data(
idiag%id_pfnh, wk, time)
2484 if( atm(n)%flagstruct%hydrostatic .and. (
idiag%id_pfhy > 0 .or.
idiag%id_cape > 0 .or.
idiag%id_cin > 0) )
then 2488 wk(i,j,k) = 0.5 *(atm(n)%pe(i,k,j)+atm(n)%pe(i,k+1,j))
2492 used=send_data(
idiag%id_pfhy, wk, time)
2495 if (
idiag%id_cape > 0 .or.
idiag%id_cin > 0)
then 2498 allocate(var2(isc:iec,jsc:jec))
2499 allocate(a3(isc:iec,jsc:jec,npz))
2500 call eqv_pot(a3, atm(n)%pt, atm(n)%delp, atm(n)%delz, atm(n)%peln, atm(n)%pkz, atm(n)%q(isd:ied,jsd:jed,1:npz,
sphum), &
2501 isc, iec, jsc, jec, ngc, npz, atm(n)%flagstruct%hydrostatic, atm(n)%flagstruct%moist_phys)
2509 call getcape(npz, wk(i,j,:), atm(n)%pt(i,j,:), -atm(n)%delz(i,j,:), atm(n)%q(i,j,:,
sphum), a3(i,j,:), a2(i,j), var2(i,j), source_in=1)
2513 if (
idiag%id_cape > 0)
then 2515 call prt_maxmin(
' CAPE (J/kg)', a2, isc,iec,jsc,jec, 0, 1, 1.)
2517 used=send_data(
idiag%id_cape, a2, time)
2519 if (
idiag%id_cin > 0)
then 2521 call prt_maxmin(
' CIN (J/kg)', var2, isc,iec,jsc,jec, 0, 1, 1.)
2523 used=send_data(
idiag%id_cin, var2, time)
2532 if((.not. atm(n)%flagstruct%hydrostatic) .and.
idiag%id_delz > 0)
then 2536 wk(i,j,k) = -atm(n)%delz(i,j,k)
2540 used=send_data(
idiag%id_delz, wk, time)
2546 if (
idiag%id_pmask>0)
then 2549 a2(i,j) = exp((atm(n)%peln(i,npz+1,j)+atm(n)%peln(i,npz+1,j))*0.5)*0.01
2553 used=send_data(
idiag%id_pmask, a2, time)
2558 if (
idiag%id_pmaskv2>0)
then 2561 a2(i,j) = exp((atm(n)%peln(i,npz,j)+atm(n)%peln(i,npz+1,j))*0.5)*0.01
2564 used=send_data(
idiag%id_pmaskv2, a2, time)
2568 if (.not.
allocated(wz))
allocate ( wz(isc:iec,jsc:jec,npz+1) )
2569 if ( atm(n)%flagstruct%hydrostatic)
then 2579 wz(i,j,k) = wz(i,j,k+1) - (rdgas*rgrav)*atm(n)%pt(i,j,k)*(atm(n)%peln(i,k,j) - atm(n)%peln(i,k+1,j))
2592 wz(i,j,k) = wz(i,j,k+1) - atm(n)%delz(i,j,k)
2598 call prt_maxmin(
'ZTOP', wz(isc:iec,jsc:jec,1)+atm(n)%phis(isc:iec,jsc:jec)/grav, isc, iec, jsc, jec, 0, 1, 1.e-3)
2601 if (
idiag%id_rain5km>0 )
then 2602 rainwat = get_tracer_index(model_atmos,
'rainwat')
2603 call interpolate_z(isc, iec, jsc, jec, npz, 5.e3, wz, atm(n)%q(isc:iec,jsc:jec,:,
rainwat), a2)
2604 used=send_data(
idiag%id_rain5km, a2, time)
2607 if (
idiag%id_w5km>0 )
then 2608 call interpolate_z(isc, iec, jsc, jec, npz, 5.e3, wz, atm(n)%w(isc:iec,jsc:jec,:), a2)
2609 used=send_data(
idiag%id_w5km, a2, time)
2612 if (
idiag%id_w2500m>0 )
then 2613 call interpolate_z(isc, iec, jsc, jec, npz, 2.5e3, wz, atm(n)%w(isc:iec,jsc:jec,:), a2)
2614 used=send_data(
idiag%id_w2500m, a2, time)
2617 if (
idiag%id_w1km>0 )
then 2618 call interpolate_z(isc, iec, jsc, jec, npz, 1.e3, wz, atm(n)%w(isc:iec,jsc:jec,:), a2)
2619 used=send_data(
idiag%id_w1km, a2, time)
2622 if (
idiag%id_w100m>0 )
then 2623 call interpolate_z(isc, iec, jsc, jec, npz, 100., wz, atm(n)%w(isc:iec,jsc:jec,:), a2)
2624 used=send_data(
idiag%id_w100m, a2, time)
2627 if (
idiag%id_u100m>0 )
then 2628 call interpolate_z(isc, iec, jsc, jec, npz, 100., wz, atm(n)%ua(isc:iec,jsc:jec,:), a2)
2629 used=send_data(
idiag%id_u100m, a2, time)
2632 if (
idiag%id_v100m>0 )
then 2633 call interpolate_z(isc, iec, jsc, jec, npz, 100., wz, atm(n)%va(isc:iec,jsc:jec,:), a2)
2634 used=send_data(
idiag%id_v100m, a2, time)
2640 if (.not.
allocated(a3))
allocate(a3(isc:iec,jsc:jec,npz))
2643 call dbzcalc(atm(n)%q, atm(n)%pt, atm(n)%delp, atm(n)%peln, atm(n)%delz, &
2644 a3, a2, allmax, atm(n)%bd, npz, atm(n)%ncnst, atm(n)%flagstruct%hydrostatic, &
2645 zvir, .false., .false., .false., .true. )
2647 if (
idiag%id_dbz > 0) used=send_data(
idiag%id_dbz, a3, time)
2648 if (
idiag%id_maxdbz > 0) used=send_data(
idiag%id_maxdbz, a2, time)
2650 if (
idiag%id_basedbz > 0)
then 2652 call cs_interpolator(isc, iec, jsc, jec, npz, a3, 1000., wz, a2, -20.)
2653 used=send_data(
idiag%id_basedbz, a2, time)
2657 if (
idiag%id_dbz4km > 0)
then 2659 call cs_interpolator(isc, iec, jsc, jec, npz, a3, 4000., wz, a2, -20.)
2660 used=send_data(
idiag%id_dbz4km, a2, time)
2662 if (
idiag%id_dbztop > 0)
then 2667 if (wz(i,j,k) >= 25000. )
continue 2668 if (a3(i,j,k) >= 18.5 )
then 2675 used=send_data(
idiag%id_dbztop, a2, time)
2677 if (
idiag%id_dbz_m10C > 0)
then 2682 if (wz(i,j,k) >= 25000. )
exit 2683 if (atm(n)%pt(i,j,k) <= 263.14 )
then 2690 used=send_data(
idiag%id_dbz_m10C, a2, time)
2694 call mpp_max(allmax)
2695 if (
master)
write(*,*)
'max reflectivity = ', allmax,
' dBZ' 2703 if(.not.
allocated(a3))
allocate( a3(isc:iec,jsc:jec,
nplev) )
2705 idg(:) =
idiag%id_u(:)
2707 do_cs_intp = .false.
2709 if ( idg(i)>0 )
then 2715 if ( do_cs_intp )
then 2717 pout, wz, atm(n)%pe(isc:iec,1:npz+1,jsc:jec), idg, a3, -1)
2720 if (idg(i)>0) used=send_data(idg(i), a3(isc:iec,jsc:jec,i), time)
2724 if (
idiag%id_u_plev>0)
then 2727 pout, wz, atm(n)%pe(isc:iec,1:npz+1,jsc:jec), id1, a3, -1)
2728 used=send_data(
idiag%id_u_plev, a3(isc:iec,jsc:jec,:), time)
2732 idg(:) =
idiag%id_v(:)
2734 do_cs_intp = .false.
2736 if ( idg(i)>0 )
then 2742 if ( do_cs_intp )
then 2744 pout, wz, atm(n)%pe(isc:iec,1:npz+1,jsc:jec), idg, a3, -1)
2747 if (idg(i)>0) used=send_data(idg(i), a3(isc:iec,jsc:jec,i), time)
2751 if (
idiag%id_v_plev>0)
then 2754 pout, wz, atm(n)%pe(isc:iec,1:npz+1,jsc:jec), id1, a3, -1)
2755 used=send_data(
idiag%id_v_plev, a3(isc:iec,jsc:jec,:), time)
2759 idg(:) =
idiag%id_q(:)
2761 do_cs_intp = .false.
2763 if ( idg(i)>0 )
then 2769 if ( do_cs_intp )
then 2770 call cs3_interpolator(isc,iec,jsc,jec,npz, atm(n)%q(isc:iec,jsc:jec,:,
sphum),
nplev, &
2771 pout, wz, atm(n)%pe(isc:iec,1:npz+1,jsc:jec), idg, a3, 0)
2774 if (idg(i)>0) used=send_data(idg(i), a3(isc:iec,jsc:jec,i), time)
2778 if (
idiag%id_q_plev>0)
then 2780 call cs3_interpolator(isc,iec,jsc,jec,npz, atm(n)%q(isc:iec,jsc:jec,:,
sphum),
nplev, &
2781 pout, wz, atm(n)%pe(isc:iec,1:npz+1,jsc:jec), id1, a3, 0)
2782 used=send_data(
idiag%id_q_plev, a3(isc:iec,jsc:jec,:), time)
2786 idg(:) =
idiag%id_omg(:)
2788 do_cs_intp = .false.
2790 if ( idg(i)>0 )
then 2795 if ( do_cs_intp )
then 2797 pout, wz, atm(n)%pe(isc:iec,1:npz+1,jsc:jec), idg, a3, -1)
2800 if (idg(i)>0) used=send_data(idg(i), a3(isc:iec,jsc:jec,i), time)
2804 if (
idiag%id_omg_plev>0)
then 2807 pout, wz, atm(n)%pe(isc:iec,1:npz+1,jsc:jec), id1, a3, -1)
2808 used=send_data(
idiag%id_omg_plev, a3(isc:iec,jsc:jec,:), time)
2811 if(
allocated(a3) )
deallocate (a3)
2814 if (
idiag%id_sl12>0 )
then 2817 a2(i,j) = sqrt(atm(n)%ua(i,j,12)**2 + atm(n)%va(i,j,12)**2)
2820 used=send_data(
idiag%id_sl12, a2, time)
2822 if (
idiag%id_sl13>0 )
then 2825 a2(i,j) = sqrt(atm(n)%ua(i,j,13)**2 + atm(n)%va(i,j,13)**2)
2828 used=send_data(
idiag%id_sl13, a2, time)
2831 if ( (.not.atm(n)%flagstruct%hydrostatic) .and.
idiag%id_w200>0 )
then 2833 200.e2, atm(n)%peln, atm(n)%w(isc:iec,jsc:jec,:), a2)
2834 used=send_data(
idiag%id_w200, a2, time)
2837 if ( (.not.atm(n)%flagstruct%hydrostatic) .and.
idiag%id_w500>0 )
then 2839 500.e2, atm(n)%peln, atm(n)%w(isc:iec,jsc:jec,:), a2)
2840 used=send_data(
idiag%id_w500, a2, time)
2842 if ( (.not.atm(n)%flagstruct%hydrostatic) .and.
idiag%id_w700>0 )
then 2844 700.e2, atm(n)%peln, atm(n)%w(isc:iec,jsc:jec,:), a2)
2845 used=send_data(
idiag%id_w700, a2, time)
2847 if ( (.not.atm(n)%flagstruct%hydrostatic) .and.
idiag%id_w850>0 .or.
idiag%id_x850>0)
then 2849 850.e2, atm(n)%peln, atm(n)%w(isc:iec,jsc:jec,:), a2)
2850 used=send_data(
idiag%id_w850, a2, time)
2852 if (
idiag%id_x850>0 .and.
idiag%id_vort850>0 )
then 2853 x850(:,:) = x850(:,:)*a2(:,:)
2854 used=send_data(
idiag%id_x850, x850, time)
2860 if ( .not.atm(n)%flagstruct%hydrostatic .and.
idiag%id_w>0 )
then 2861 used=send_data(
idiag%id_w, atm(n)%w(isc:iec,jsc:jec,:), time)
2863 if ( .not. atm(n)%flagstruct%hydrostatic .and. (
idiag%id_wmaxup>0 .or.
idiag%id_wmaxdn>0) )
then 2864 allocate(var2(isc:iec,jsc:jec))
2870 if (atm(n)%pe(i,k,j) <= 400.e2)
continue 2871 a2(i,j) = max(a2(i,j),atm(n)%w(i,j,k))
2872 var2(i,j) = min(var2(i,j),atm(n)%w(i,j,k))
2876 if (
idiag%id_wmaxup > 0)
then 2877 used=send_data(
idiag%id_wmaxup, a2, time)
2879 if (
idiag%id_wmaxdn > 0)
then 2880 used=send_data(
idiag%id_wmaxdn, var2, time)
2885 if(
idiag%id_pt > 0) used=send_data(
idiag%id_pt , atm(n)%pt (isc:iec,jsc:jec,:), time)
2886 if(
idiag%id_omga > 0) used=send_data(
idiag%id_omga, atm(n)%omga(isc:iec,jsc:jec,:), time)
2887 if(
idiag%id_diss > 0) used=send_data(
idiag%id_diss, atm(n)%diss_est(isc:iec,jsc:jec,:), time)
2889 allocate( a3(isc:iec,jsc:jec,npz) )
2890 if(
idiag%id_theta_e > 0 )
then 2892 if ( atm(n)%flagstruct%adiabatic .and. atm(n)%flagstruct%kord_tm>0 )
then 2896 a3(i,j,k) = atm(n)%pt(i,j,k)
2901 call eqv_pot(a3, atm(n)%pt, atm(n)%delp, atm(n)%delz, atm(n)%peln, atm(n)%pkz, atm(n)%q(isd:ied,jsd:jed,1:npz,
sphum), &
2902 isc, iec, jsc, jec, ngc, npz, atm(n)%flagstruct%hydrostatic, atm(n)%flagstruct%moist_phys)
2905 if (
idiag%id_theta_e > 0)
then 2907 used=send_data(
idiag%id_theta_e, a3, time)
2909 theta_d = get_tracer_index(model_atmos,
'theta_d')
2910 if ( theta_d>0 )
then 2917 a2(i,j) = a2(i,j) + atm(n)%delp(i,j,k)*(atm(n)%q(i,j,k,theta_d)-a3(i,j,k))**2
2921 call prt_mxm(
'PT_SUM', a2, isc, iec, jsc, jec, 0, 1, 1.e-5, atm(n)%gridstruct%area_64, atm(n)%domain)
2926 a3(i,j,k) = atm(n)%q(i,j,k,theta_d)/a3(i,j,k) - 1.
2930 call prt_maxmin(
'Theta_Err (%)', a3, isc, iec, jsc, jec, 0, npz, 100.)
2937 if(
idiag%id_ppt> 0)
then 2939 allocate (
idiag%pt1(npz) )
2940 if( .not.
allocated(a3) )
allocate ( a3(isc:iec,jsc:jec,npz) )
2942 call gw_1d(npz, 1000.e2, atm(n)%ak, atm(n)%ak, atm(n)%ak(1), 10.e3,
idiag%pt1)
2950 wk(i,j,k) = (atm(n)%pt(i,j,k)/atm(n)%pkz(i,j,k) -
idiag%pt1(k)) *
pk0 2954 used=send_data(
idiag%id_ppt, wk, time)
2957 call prt_maxmin(
'PoTemp', wk, isc, iec, jsc, jec, 0, npz, 1.)
2960 if(
allocated(a3) )
deallocate ( a3 )
2961 deallocate (
idiag%pt1 )
2966 do itrac=1, atm(n)%ncnst
2967 call get_tracer_names (model_atmos, itrac,
tname)
2968 if (
idiag%id_tracer(itrac) > 0 .and. itrac.gt.nq)
then 2969 used = send_data(
idiag%id_tracer(itrac), atm(n)%qdiag(isc:iec,jsc:jec,:,itrac), time )
2971 used = send_data(
idiag%id_tracer(itrac), atm(n)%q(isc:iec,jsc:jec,:,itrac), time )
2973 if (itrac .le. nq)
then 2975 isc, iec, jsc, jec, ngc, npz, 1.)
2978 isc, iec, jsc, jec, ngc, npz, 1.)
2987 if (
idiag%id_tracer_dmmr(itrac) > 0 .or.
idiag%id_tracer_dvmr(itrac) > 0)
then 2988 if (itrac .gt. nq)
then 2989 dmmr(:,:,:) = atm(n)%qdiag(isc:iec,jsc:jec,1:npz,itrac) &
2990 /(1.0-atm(n)%q(isc:iec,jsc:jec,1:npz,1))
2992 dmmr(:,:,:) = atm(n)%q(isc:iec,jsc:jec,1:npz,itrac) &
2993 /(1.0-atm(n)%q(isc:iec,jsc:jec,1:npz,1))
2995 dvmr(:,:,:) = dmmr(isc:iec,jsc:jec,1:npz) * wtmair/
idiag%w_mr(itrac)
2996 used = send_data(
idiag%id_tracer_dmmr(itrac), dmmr, time )
2997 used = send_data(
idiag%id_tracer_dvmr(itrac), dvmr, time )
3000 isc, iec, jsc, jec, 0, npz, 1.)
3002 isc, iec, jsc, jec, 0, npz, 1.)
3008 if ( .not. atm(n)%neststruct%nested )
then 3014 a2(i,j) = max(a2(i,j), atm(n)%q(i,j,k,
cld_amt) )
3018 call prt_gb_nh_sh(
'Max_cld GB_NH_SH_EQ',isc,iec, jsc,jec, a2, atm(n)%gridstruct%area_64(isc:iec,jsc:jec), &
3019 atm(n)%gridstruct%agrid_64(isc:iec,jsc:jec,2))
3032 if (
allocated(a3))
deallocate(a3)
3033 if (
allocated(wz))
deallocate(wz)
3034 if (
allocated(dmmr))
deallocate(dmmr)
3035 if (
allocated(dvmr))
deallocate(dvmr)
3037 call nullify_domain()
3042 subroutine wind_max(isc, iec, jsc, jec ,isd, ied, jsd, jed, us, vs, ws_max, domain)
3043 integer isc, iec, jsc, jec
3044 integer isd, ied, jsd, jed
3045 real,
intent(in),
dimension(isc:iec,jsc:jec):: us, vs
3046 real,
intent(out) :: ws_max(isc:iec,jsc:jec)
3047 type(domain2d),
intent(INOUT) :: domain
3049 real :: wx(isc:iec,jsd:jed), ws(isd:ied,jsd:jed)
3055 ws(i,j) = sqrt(us(i,j)**2 + vs(i,j)**2)
3059 call mpp_update_domains( ws, domain )
3063 wx(i,j) = max(ws(i-3,j), ws(i-2,j), ws(i-1,j), ws(i,j), ws(i+1,j), ws(i+2,j), ws(i+3,j))
3069 ws_max(i,j) = max(wx(i,j-3), wx(i,j-2), wx(i,j-1), wx(i,j), wx(i,j+1), wx(i,j+2), wx(i,j+3))
3076 subroutine get_vorticity(isc, iec, jsc, jec ,isd, ied, jsd, jed, npz, u, v, vort, dx, dy, rarea)
3077 integer isd, ied, jsd, jed, npz
3078 integer isc, iec, jsc, jec
3079 real,
intent(in) :: u(isd:ied, jsd:jed+1, npz), v(isd:ied+1, jsd:jed, npz)
3080 real,
intent(out) :: vort(isc:iec, jsc:jec, npz)
3081 real,
intent(IN) :: dx(isd:ied,jsd:jed+1)
3082 real,
intent(IN) :: dy(isd:ied+1,jsd:jed)
3083 real,
intent(IN) :: rarea(isd:ied,jsd:jed)
3085 real :: utmp(isc:iec, jsc:jec+1), vtmp(isc:iec+1, jsc:jec)
3091 utmp(i,j) = u(i,j,k)*dx(i,j)
3096 vtmp(i,j) = v(i,j,k)*dy(i,j)
3102 vort(i,j,k) = rarea(i,j)*(utmp(i,j)-utmp(i,j+1)-vtmp(i,j)+vtmp(i+1,j))
3110 subroutine get_height_field(is, ie, js, je, ng, km, hydrostatic, delz, wz, pt, q, peln, zvir)
3111 integer,
intent(in):: is, ie, js, je, km, ng
3112 real,
intent(in):: peln(is:ie,km+1,js:je)
3113 real,
intent(in):: pt(is-ng:ie+ng,js-ng:je+ng,km)
3114 real,
intent(in):: q(is-ng:ie+ng,js-ng:je+ng,km,*)
3115 real,
intent(in):: delz(is-ng:,js-ng:,1:)
3116 real,
intent(in):: zvir
3117 logical,
intent(in):: hydrostatic
3118 real,
intent(out):: wz(is:ie,js:je,km+1)
3127 wz(i,j,km+1) =
idiag%zsurf(i,j)
3129 if (hydrostatic )
then 3133 wz(i,j,k) = wz(i,j,k+1) + gg*pt(i,j,k)*
virq(q(i,j,k,1:
num_gas)) &
3134 *(peln(i,k+1,j)-peln(i,k,j))
3136 wz(i,j,k) = wz(i,j,k+1) + gg*pt(i,j,k)*(1.+zvir*q(i,j,k,
sphum)) &
3137 *(peln(i,k+1,j)-peln(i,k,j))
3144 wz(i,j,k) = wz(i,j,k+1) - delz(i,j,k)
3152 subroutine range_check(qname, q, is, ie, js, je, n_g, km, pos, q_low, q_hi, bad_range)
3153 character(len=*),
intent(in):: qname
3154 integer,
intent(in):: is, ie, js, je
3155 integer,
intent(in):: n_g, km
3156 real,
intent(in):: q(is-n_g:ie+n_g, js-n_g:je+n_g, km)
3157 real,
intent(in):: pos(is-n_g:ie+n_g, js-n_g:je+n_g,2)
3158 real,
intent(in):: q_low, q_hi
3159 logical,
optional,
intent(out):: bad_range
3164 if (
present(bad_range) ) bad_range = .false.
3171 if( q(i,j,k) < qmin )
then 3173 elseif( q(i,j,k) > qmax )
then 3180 call mp_reduce_min(qmin)
3181 call mp_reduce_max(qmax)
3183 if( qmin<q_low .or. qmax>q_hi )
then 3184 if(
master)
write(*,*)
'Range_check Warning:', qname,
' max = ', qmax,
' min = ', qmin
3185 if (
present(bad_range) )
then 3190 if (
present(bad_range) )
then 3192 if ( bad_range .EQV. .false. )
return 3196 if( q(i,j,k)<q_low .or. q(i,j,k)>q_hi )
then 3197 write(*,*)
'Warn_K=',k,
'(i,j)=',i,j, pos(i,j,1)*
rad2deg, pos(i,j,2)*
rad2deg, q(i,j,k)
3198 if ( k/= 1 )
write(*,*) k-1, q(i,j,k-1)
3199 if ( k/=km )
write(*,*) k+1, q(i,j,k+1)
3204 call mpp_error(note,
'==> Error from range_check: data out of bound')
3209 subroutine prt_maxmin(qname, q, is, ie, js, je, n_g, km, fac)
3210 character(len=*),
intent(in):: qname
3211 integer,
intent(in):: is, ie, js, je
3212 integer,
intent(in):: n_g, km
3213 real,
intent(in):: q(is-n_g:ie+n_g, js-n_g:je+n_g, km)
3214 real,
intent(in):: fac
3219 master = (mpp_pe()==mpp_root_pe()) .or. is_master()
3229 if( q(i,j,k) < qmin )
then 3231 elseif( q(i,j,k) > qmax )
then 3238 call mp_reduce_min(qmin)
3239 call mp_reduce_max(qmax)
3242 write(*,*) qname//trim(
gn),
' max = ', qmax*fac,
' min = ', qmin*fac
3247 subroutine prt_mxm(qname, q, is, ie, js, je, n_g, km, fac, area, domain)
3248 character(len=*),
intent(in):: qname
3249 integer,
intent(in):: is, ie, js, je
3250 integer,
intent(in):: n_g, km
3251 real,
intent(in):: q(is-n_g:ie+n_g, js-n_g:je+n_g, km)
3252 real,
intent(in):: fac
3255 real(kind=R_GRID),
intent(IN):: area(is-3:ie+3, js-3:je+3)
3256 type(domain2d),
intent(INOUT) :: domain
3258 real qmin, qmax, gmean
3262 master = (mpp_pe()==mpp_root_pe()) .or. is_master()
3272 if( q(i,j,k) < qmin )
then 3274 elseif( q(i,j,k) > qmax )
then 3281 call mp_reduce_min(qmin)
3282 call mp_reduce_max(qmax)
3286 gmean =
g_sum(domain, q(is:ie,js:je,km), is, ie, js, je, 3, area, 1)
3288 if(
master)
write(6,*) qname,
gn, qmax*fac, qmin*fac, gmean*fac
3293 subroutine prt_mass(km, nq, is, ie, js, je, n_g, nwat, ps, delp, q, area, domain)
3295 integer,
intent(in):: is, ie, js, je
3296 integer,
intent(in):: nq, n_g, km, nwat
3297 real,
intent(in):: ps(is-n_g:ie+n_g, js-n_g:je+n_g)
3298 real,
intent(in):: delp(is-n_g:ie+n_g, js-n_g:je+n_g, km)
3299 real,
intent(in):: q(is-n_g:ie+n_g, js-n_g:je+n_g, km, nq)
3300 real(kind=R_GRID),
intent(IN):: area(is-n_g:ie+n_g,js-n_g:je+n_g)
3301 type(domain2d),
intent(INOUT) :: domain
3303 real psq(is:ie,js:je,nwat), psqv(is:ie,js:je)
3304 real q_strat(is:ie,js:je)
3305 real qtot(nwat), qwat
3306 real psmo, totw, psdry
3307 integer k, n, kstrat
3310 sphum = get_tracer_index(model_atmos,
'sphum')
3311 liq_wat = get_tracer_index(model_atmos,
'liq_wat')
3312 ice_wat = get_tracer_index(model_atmos,
'ice_wat')
3314 rainwat = get_tracer_index(model_atmos,
'rainwat')
3315 snowwat = get_tracer_index(model_atmos,
'snowwat')
3316 graupel = get_tracer_index(model_atmos,
'graupel')
3319 psmo =
g_sum(domain, ps(is:ie,js:je), is, ie, js, je, n_g, area, 1)
3320 if(
master )
write(*,*)
'Total surface pressure (mb)', trim(
gn),
' = ', 0.01*psmo
3321 call z_sum(is, ie, js, je, km, n_g, delp, q(is-n_g,js-n_g,1,1 ), psqv(is,js))
3326 call z_sum(is, ie, js, je, km, n_g, delp, q(is-n_g,js-n_g,1,
sphum ), psq(is,js,
sphum ))
3329 call z_sum(is, ie, js, je, km, n_g, delp, q(is-n_g,js-n_g,1,
liq_wat), psq(is,js,
liq_wat))
3332 call z_sum(is, ie, js, je, km, n_g, delp, q(is-n_g,js-n_g,1,
rainwat), psq(is,js,
rainwat))
3336 call z_sum(is, ie, js, je, km, n_g, delp, q(is-n_g,js-n_g,1,
ice_wat), psq(is,js,
ice_wat))
3339 call z_sum(is, ie, js, je, km, n_g, delp, q(is-n_g,js-n_g,1,
snowwat), psq(is,js,
snowwat))
3341 call z_sum(is, ie, js, je, km, n_g, delp, q(is-n_g,js-n_g,1,
graupel), psq(is,js,
graupel))
3345 if (
idiag%phalf(2)< 75. )
then 3348 if (
idiag%phalf(k+1) > 75. )
exit 3351 call z_sum(is, ie, js, je, kstrat, n_g, delp, q(is-n_g,js-n_g,1,
sphum), q_strat(is,js))
3352 psmo =
g_sum(domain, q_strat(is,js), is, ie, js, je, n_g, area, 1) * 1.e6 &
3353 /
p_sum(is, ie, js, je, kstrat, n_g, delp, area, domain)
3354 if(
master)
write(*,*)
'Mean specific humidity (mg/kg) above 75 mb', trim(
gn),
'=', psmo
3361 psmo =
g_sum(domain, ps(is:ie,js:je), is, ie, js, je, n_g, area, 1)
3364 qtot(n) =
g_sum(domain, psq(is,js,n), is, ie, js, je, n_g, area, 1)
3367 totw = sum(qtot(1:nwat))
3371 write(*,*)
'Total surface pressure (mb)', trim(
gn),
' = ', 0.01*psmo
3372 write(*,*)
'mean dry surface pressure', trim(
gn),
' = ', 0.01*psdry
3373 write(*,*)
'Total Water Vapor (kg/m**2)', trim(
gn),
' =', qtot(
sphum)*
ginv 3375 write(*,*)
'--- Micro Phys water substances (kg/m**2) ---' 3376 write(*,*)
'Total cloud water', trim(
gn),
'=', qtot(
liq_wat)*
ginv 3378 write(*,*)
'Total rain water', trim(
gn),
'=', qtot(
rainwat)*
ginv 3380 write(*,*)
'Total cloud ice ', trim(
gn),
'=', qtot(
ice_wat)*
ginv 3384 write(*,*)
'Total graupel ', trim(
gn),
'=', qtot(
graupel)*
ginv 3385 write(*,*)
'---------------------------------------------' 3386 elseif ( nwat==2 )
then 3387 write(*,*)
'GFS condensate (kg/m^2)', trim(
gn),
'=', qtot(
liq_wat)*
ginv 3394 subroutine z_sum(is, ie, js, je, km, n_g, delp, q, sum2)
3395 integer,
intent(in):: is, ie, js, je, n_g, km
3396 real,
intent(in):: delp(is-n_g:ie+n_g, js-n_g:je+n_g, km)
3397 real,
intent(in):: q(is-n_g:ie+n_g, js-n_g:je+n_g, km)
3398 real,
intent(out):: sum2(is:ie,js:je)
3404 sum2(i,j) = delp(i,j,1)*q(i,j,1)
3408 sum2(i,j) = sum2(i,j) + delp(i,j,k)*q(i,j,k)
3413 end subroutine z_sum 3416 real function p_sum(is, ie, js, je, km, n_g, delp, area, domain)
3417 integer,
intent(in):: is, ie, js, je, n_g, km
3418 real,
intent(in):: delp(is-n_g:ie+n_g, js-n_g:je+n_g, km)
3419 real(kind=R_GRID),
intent(IN) :: area(is-n_g:ie+n_g, js-n_g:je+n_g)
3420 real :: sum2(is:ie,js:je)
3422 type(domain2d),
intent(INOUT) :: domain
3427 sum2(i,j) = delp(i,j,1)
3431 sum2(i,j) = sum2(i,j) + delp(i,j,k)
3435 p_sum =
g_sum(domain, sum2, is, ie, js, je, n_g, area, 1)
3444 integer,
intent(in):: is, ie, js, je, km, ng
3445 integer,
intent(in):: kd
3446 real,
intent(in):: wz(is:ie,js:je,km+1)
3447 real,
intent(in):: ts(is-ng:ie+ng,js-ng:je+ng)
3448 real,
intent(in):: peln(is:ie,km+1,js:je)
3449 real,
intent(in):: height(kd)
3450 real,
intent(out):: a2(is:ie,js:je,kd)
3451 real,
optional,
intent(in):: fac
3466 if ( height(n) >= wz(i,j,km+1) )
then 3471 if( height(n) < wz(i,j,k) .and. height(n) >= wz(i,j,k+1) )
then 3473 ptmp = peln(i,k,j) + (peln(i,k+1,j)-peln(i,k,j)) * &
3474 (wz(i,j,k)-height(n)) / (wz(i,j,k)-wz(i,j,k+1))
3475 a2(i,j,n) = exp(ptmp)
3484 tm = rdgas*
ginv*(ts(i,j) + 3.25e-3*(wz(i,j,km)-height(n)))
3485 a2(i,j,n) = exp( peln(i,km+1,j) + (wz(i,j,km+1) - height(n))/tm )
3487 500
if (
present(fac) ) a2(i,j,n) = fac * a2(i,j,n)
3495 subroutine get_height_given_pressure(is, ie, js, je, km, wz, kd, id, log_p, peln, a2)
3496 integer,
intent(in):: is, ie, js, je, km
3497 integer,
intent(in):: kd
3498 integer,
intent(in):: id(kd)
3499 real,
intent(in):: log_p(kd)
3501 real,
intent(in):: wz(is:ie,js:je,km+1)
3502 real,
intent(in):: peln(is:ie,km+1,js:je)
3503 real,
intent(out):: a2(is:ie,js:je,kd)
3505 real,
dimension(2*km+1):: pn, gz
3506 integer n,i,j,k, k1, k2, l
3508 k2 = max(12, km/2+1)
3523 gz(k) = 2.*gz(km+1) - gz(l)
3524 pn(k) = 2.*pn(km+1) - pn(l)
3528 if( id(n)<0 )
goto 1000
3530 if( log_p(n) <= pn(k+1) .and. log_p(n) >= pn(k) )
then 3531 a2(i,j,n) = gz(k) + (gz(k+1)-gz(k))*(log_p(n)-pn(k))/(pn(k+1)-pn(k))
3542 subroutine prt_height(qname, is, ie, js, je, ng, km, press, phis, delz, peln, area, lat)
3543 character(len=*),
intent(in):: qname
3544 integer,
intent(in):: is, ie, js, je, ng, km
3545 real,
intent(in):: press
3546 real,
intent(in):: peln(is:ie,km+1,js:je)
3547 real,
intent(in):: phis(is-ng:ie+ng,js-ng:je+ng)
3548 real,
intent(in):: delz(is-ng:ie+ng,js-ng:je+ng,km)
3549 real(kind=R_GRID),
intent(in),
dimension(is:ie, js:je):: area, lat
3551 real:: a2(is:ie,js:je)
3552 real(kind=R_GRID),
dimension(2*km+1):: pn, gz
3553 real(kind=R_GRID):: log_p
3554 integer i,j,k, k2, l
3557 k2 = max(12, km/2+1)
3569 gz(km+1) = phis(i,j)/grav
3571 gz(k) = gz(k+1) - delz(i,j,k)
3575 gz(k) = 2.*gz(km+1) - gz(l)
3576 pn(k) = 2.*pn(km+1) - pn(l)
3580 if( log_p <= pn(k+1) .and. log_p >= pn(k) )
then 3581 a2(i,j) = gz(k) + (gz(k+1)-gz(k))*(log_p-pn(k))/(pn(k+1)-pn(k))
3591 subroutine prt_gb_nh_sh(qname, is,ie, js,je, a2, area, lat)
3592 character(len=*),
intent(in):: qname
3593 integer,
intent(in):: is, ie, js, je
3594 real,
intent(in),
dimension(is:ie, js:je):: a2
3595 real(kind=R_GRID),
intent(in),
dimension(is:ie, js:je):: area, lat
3597 real(R_GRID),
parameter::
rad2deg = 180./pi
3599 real:: t_eq, t_nh, t_sh, t_gb
3600 real:: area_eq, area_nh, area_sh, area_gb
3603 t_eq = 0. ; t_nh = 0.; t_sh = 0.; t_gb = 0.
3604 area_eq = 0.; area_nh = 0.; area_sh = 0.; area_gb = 0.
3608 area_gb = area_gb + area(i,j)
3609 t_gb = t_gb + a2(i,j)*area(i,j)
3610 if( (slat>-20. .and. slat<20.) )
then 3611 area_eq = area_eq + area(i,j)
3612 t_eq = t_eq + a2(i,j)*area(i,j)
3613 elseif( slat>=20. .and. slat<80. )
then 3614 area_nh = area_nh + area(i,j)
3615 t_nh = t_nh + a2(i,j)*area(i,j)
3616 elseif( slat<=-20. .and. slat>-80. )
then 3617 area_sh = area_sh + area(i,j)
3618 t_sh = t_sh + a2(i,j)*area(i,j)
3622 call mp_reduce_sum(area_gb)
3623 call mp_reduce_sum( t_gb)
3624 call mp_reduce_sum(area_nh)
3625 call mp_reduce_sum( t_nh)
3626 call mp_reduce_sum(area_sh)
3627 call mp_reduce_sum( t_sh)
3628 call mp_reduce_sum(area_eq)
3629 call mp_reduce_sum( t_eq)
3631 if (area_gb <= 1.) area_gb = -1.0
3632 if (area_nh <= 1.) area_nh = -1.0
3633 if (area_sh <= 1.) area_sh = -1.0
3634 if (area_eq <= 1.) area_eq = -1.0
3635 if (is_master())
write(*,*) qname, t_gb/area_gb, t_nh/area_nh, t_sh/area_sh, t_eq/area_eq
3639 subroutine cs3_interpolator(is, ie, js, je, km, qin, kd, pout, wz, pe, id, qout, iv)
3643 integer,
intent(in):: is, ie, js, je, km, iv
3644 integer,
intent(in):: kd
3645 integer,
intent(in):: id(kd)
3646 real,
intent(in):: pout(kd)
3647 real,
intent(in):: pe(is:ie,km+1,js:je)
3648 real,
intent(in):: qin(is:ie,js:je,km)
3649 real,
intent(in):: wz(is:ie,js:je,km+1)
3650 real,
intent(out):: qout(is:ie,js:je,kd)
3652 real,
parameter:: gcp = grav / cp_air
3653 real:: qe(is:ie,km+1)
3654 real,
dimension(is:ie,km):: q2, dp
3656 integer:: i,j,k, n, k1
3664 dp(i,k) = pe(i,k+1,j) - pe(i,k,j)
3665 q2(i,k) = qin(i,j,k)
3669 call cs_prof(q2, dp, qe, km, is, ie, iv)
3674 if ( id(n) > 0 )
then 3675 if( pout(n) <= pe(i,1,j) )
then 3677 qout(i,j,n) = qe(i,1)
3678 elseif ( pout(n) >= pe(i,km+1,j) )
then 3684 qout(i,j,n) = gcp*exp(kappa*pout(n)) * (wz(i,j,km-2) - wz(i,j,km)) / &
3685 ( exp(kappa*pe(i,km,j)) - exp(kappa*pe(i,km-2,j)) )
3687 qout(i,j,n) = qe(i,km+1)
3691 if ( pout(n)>=pe(i,k,j) .and. pout(n) <= pe(i,k+1,j) )
then 3693 a6 = 3.*(2.*q2(i,k) - (qe(i,k)+qe(i,k+1)))
3694 s0 = (pout(n)-pe(i,k,j)) / dp(i,k)
3695 qout(i,j,n) = qe(i,k) + s0*(qe(i,k+1)-qe(i,k)+a6*(1.-s0))
3701 500
if ( iv==0 ) qout(i,j,n) = max(0., qout(i,j,n))
3711 subroutine cs_interpolator(is, ie, js, je, km, qin, zout, wz, qout, qmin)
3712 integer,
intent(in):: is, ie, js, je, km
3713 real,
intent(in):: zout, qmin
3714 real,
intent(in):: qin(is:ie,js:je,km)
3715 real,
intent(in):: wz(is:ie,js:je,km+1)
3716 real,
intent(out):: qout(is:ie,js:je)
3718 real:: qe(is:ie,km+1)
3719 real,
dimension(is:ie,km):: q2, dz
3729 dz(i,k) = wz(i,j,k) - wz(i,j,k+1)
3730 q2(i,k) = qin(i,j,k)
3734 call cs_prof(q2, dz, qe, km, is, ie, 1)
3737 if( zout >= wz(i,j,1) )
then 3740 elseif ( zout <= wz(i,j,km+1) )
then 3741 qout(i,j) = qe(i,km+1)
3744 if ( zout<=wz(i,j,k) .and. zout >= wz(i,j,k+1) )
then 3746 a6 = 3.*(2.*q2(i,k) - (qe(i,k)+qe(i,k+1)))
3747 s0 = (wz(i,j,k)-zout) / dz(i,k)
3748 qout(i,j) = qe(i,k) + s0*(qe(i,k+1)-qe(i,k)+a6*(1.-s0))
3753 500 qout(i,j) = max(qmin, qout(i,j))
3761 subroutine cs_prof(q2, delp, q, km, i1, i2, iv)
3763 integer,
intent(in):: i1, i2, km
3764 integer,
intent(in):: iv
3765 real,
intent(in) :: q2(i1:i2,km)
3766 real,
intent(in) :: delp(i1:i2,km)
3767 real,
intent(out):: q(i1:i2,km+1)
3771 real bet, a_bot, grat
3775 grat = delp(i,2) / delp(i,1)
3776 bet = grat*(grat+0.5)
3777 q(i,1) = ( (grat+grat)*(grat+1.)*q2(i,1) + q2(i,2) ) / bet
3778 gam(i,1) = ( 1. + grat*(grat+1.5) ) / bet
3783 d4(i) = delp(i,k-1) / delp(i,k)
3784 bet = 2. + d4(i) + d4(i) - gam(i,k-1)
3785 q(i,k) = ( 3.*(q2(i,k-1)+d4(i)*q2(i,k)) - q(i,k-1) )/bet
3786 gam(i,k) = d4(i) / bet
3791 a_bot = 1. + d4(i)*(d4(i)+1.5)
3792 q(i,km+1) = (2.*d4(i)*(d4(i)+1.)*q2(i,km)+q2(i,km-1)-a_bot*q(i,km)) &
3793 / ( d4(i)*(d4(i)+0.5) - a_bot*gam(i,km) )
3798 q(i,k) = q(i,k) - gam(i,k)*q(i,k+1)
3804 q(i,2) = min( q(i,2), max(q2(i,1), q2(i,2)) )
3805 q(i,2) = max( q(i,2), min(q2(i,1), q2(i,2)) )
3810 gam(i,k) = q2(i,k) - q2(i,k-1)
3817 if ( gam(i,k-1)*gam(i,k+1)>0. )
then 3819 q(i,k) = min( q(i,k), max(q2(i,k-1),q2(i,k)) )
3820 q(i,k) = max( q(i,k), min(q2(i,k-1),q2(i,k)) )
3822 if ( gam(i,k-1) > 0. )
then 3824 q(i,k) = max(q(i,k), min(q2(i,k-1),q2(i,k)))
3827 q(i,k) = min(q(i,k), max(q2(i,k-1),q2(i,k)))
3828 if ( iv==0 ) q(i,k) = max(0., q(i,k))
3836 q(i,km) = min( q(i,km), max(q2(i,km-1), q2(i,km)) )
3837 q(i,km) = max( q(i,km), min(q2(i,km-1), q2(i,km)) )
3845 integer,
intent(in):: is, ie, js, je, km
3846 real,
intent(in):: peln(is:ie,km+1,js:je)
3847 real,
intent(in):: a3(is:ie,js:je,km)
3848 real,
intent(in):: plev
3849 real,
intent(out):: a2(is:ie,js:je)
3863 pm(k) = 0.5*(peln(i,k,j)+peln(i,k+1,j))
3866 if( logp <= pm(1) )
then 3868 elseif ( logp >= pm(km) )
then 3869 a2(i,j) = a3(i,j,km)
3872 if( logp <= pm(k+1) .and. logp >= pm(k) )
then 3873 a2(i,j) = a3(i,j,k) + (a3(i,j,k+1)-a3(i,j,k))*(logp-pm(k))/(pm(k+1)-pm(k))
3884 subroutine interpolate_z(is, ie, js, je, km, zl, hght, a3, a2)
3886 integer,
intent(in):: is, ie, js, je, km
3887 real,
intent(in):: hght(is:ie,js:je,km+1)
3888 real,
intent(in):: a3(is:ie,js:je,km)
3889 real,
intent(in):: zl
3890 real,
intent(out):: a2(is:ie,js:je)
3900 zm(k) = 0.5*(hght(i,j,k)+hght(i,j,k+1))
3902 if( zl >= zm(1) )
then 3904 elseif ( zl <= zm(km) )
then 3905 a2(i,j) = a3(i,j,km)
3908 if( zl <= zm(k) .and. zl >= zm(k+1) )
then 3909 a2(i,j) = a3(i,j,k) + (a3(i,j,k+1)-a3(i,j,k))*(zm(k)-zl)/(zm(k)-zm(k+1))
3920 ua, va, delz, q, hydrostatic, pt, peln, phis, grav, z_bot, z_top)
3922 integer,
intent(in):: is, ie, js, je, ng, km, sphum
3923 real,
intent(in):: grav, zvir, z_bot, z_top
3924 real,
intent(in),
dimension(is-ng:ie+ng,js-ng:je+ng,km):: pt, ua, va
3925 real,
intent(in):: delz(is-ng:ie+ng,js-ng:je+ng,km)
3926 real,
intent(in):: q(is-ng:ie+ng,js-ng:je+ng,km,*)
3927 real,
intent(in):: phis(is-ng:ie+ng,js-ng:je+ng)
3928 real,
intent(in):: peln(is:ie,km+1,js:je)
3929 logical,
intent(in):: hydrostatic
3930 real,
intent(out):: srh(is:ie,js:je)
3941 real,
dimension(is:ie):: zh, uc, vc, dz, zh0
3942 integer i, j, k, k0, k1
3943 logical below(is:ie)
3965 if ( hydrostatic )
then 3967 dz(i) = rdg*pt(i,j,k)*
virq(q(i,j,k,1:
num_gas))*(peln(i,k+1,j)-peln(i,k,j))
3969 dz(i) = rdg*pt(i,j,k)*(1.+zvir*q(i,j,k,sphum))*(peln(i,k+1,j)-peln(i,k,j))
3972 dz(i) = - delz(i,j,k)
3974 zh(i) = zh(i) + dz(i)
3975 if (zh(i) <= z_bot )
continue 3976 if (zh(i) > z_bot .and. below(i))
then 3977 uc(i) = ua(i,j,k)*dz(i)
3978 vc(i) = va(i,j,k)*dz(i)
3979 zh0(i) = zh(i) - dz(i)
3983 elseif ( zh(i) < z_top )
then 3984 uc(i) = uc(i) + ua(i,j,k)*dz(i)
3985 vc(i) = vc(i) + va(i,j,k)*dz(i)
3988 uc(i) = uc(i) / (zh(i)-dz(i) - zh0(i))
3989 vc(i) = vc(i) / (zh(i)-dz(i) - zh0(i))
3997 srh(i,j) = 0.5*(va(i,j,k1)-vc(i))*(ua(i,j,k1-1)-ua(i,j,k1)) - &
3998 0.5*(ua(i,j,k1)-uc(i))*(va(i,j,k1-1)-va(i,j,k1))
4000 srh(i,j) = srh(i,j) + 0.5*(va(i,j,k)-vc(i))*(ua(i,j,k-1)-ua(i,j,k+1)) - &
4001 0.5*(ua(i,j,k)-uc(i))*(va(i,j,k-1)-va(i,j,k+1))
4009 subroutine helicity_relative_caps(is, ie, js, je, ng, km, zvir, sphum, srh, uc, vc, &
4010 ua, va, delz, q, hydrostatic, pt, peln, phis, grav, z_bot, z_top)
4012 integer,
intent(in):: is, ie, js, je, ng, km,
sphum 4013 real,
intent(in):: grav, zvir, z_bot, z_top
4014 real,
intent(in),
dimension(is-ng:ie+ng,js-ng:je+ng,km):: pt, ua, va
4015 real,
intent(in):: delz(is-ng:ie+ng,js-ng:je+ng,km)
4016 real,
intent(in):: q(is-ng:ie+ng,js-ng:je+ng,km,*)
4017 real,
intent(in):: phis(is-ng:ie+ng,js-ng:je+ng)
4018 real,
intent(in):: peln(is:ie,km+1,js:je)
4019 real,
intent(in):: uc(is:ie,js:je), vc(is:ie,js:je)
4020 logical,
intent(in):: hydrostatic
4021 real,
intent(out):: srh(is:ie,js:je)
4031 real,
dimension(is:ie):: zh, dz, zh0
4032 integer i, j, k, k0, k1, n
4052 if ( hydrostatic )
then 4054 dz(i) = rdg*pt(i,j,k)*
virq(q(i,j,k,1:
num_gas))*(peln(i,k+1,j)-peln(i,k,j))
4056 dz(i) = rdg*pt(i,j,k)*(1.+zvir*q(i,j,k,
sphum))*(peln(i,k+1,j)-peln(i,k,j))
4059 dz(i) = -delz(i,j,k)
4062 zh(i) = zh(i) + dz(i)
4063 if (zh(i) <= z_bot )
continue 4064 if (zh(i) > z_bot .and. below)
then 4065 zh0(i) = zh(i) - dz(i)
4069 elseif ( zh(i) < z_top )
then 4079 srh(i,j) = 0.5*(va(i,j,k1)-vc(i,j))*(ua(i,j,k1-1)-ua(i,j,k1)) - &
4080 0.5*(ua(i,j,k1)-uc(i,j))*(va(i,j,k1-1)-va(i,j,k1))
4082 srh(i,j) = srh(i,j) + 0.5*(va(i,j,k)-vc(i,j))*(ua(i,j,k-1)-ua(i,j,k+1)) - &
4083 0.5*(ua(i,j,k)-uc(i,j))*(va(i,j,k-1)-va(i,j,k+1))
4091 subroutine bunkers_vector(is, ie, js, je, ng, km, zvir, sphum, uc, vc, &
4092 ua, va, delz, q, hydrostatic, pt, peln, phis, grav)
4094 integer,
intent(in):: is, ie, js, je, ng, km,
sphum 4095 real,
intent(in):: grav, zvir
4096 real,
intent(in),
dimension(is-ng:ie+ng,js-ng:je+ng,km):: pt, ua, va
4097 real,
intent(in):: delz(is-ng:ie+ng,js-ng:je+ng,km)
4098 real,
intent(in):: q(is-ng:ie+ng,js-ng:je+ng,km,*)
4099 real,
intent(in):: phis(is-ng:ie+ng,js-ng:je+ng)
4100 real,
intent(in):: peln(is:ie,km+1,js:je)
4101 logical,
intent(in):: hydrostatic
4102 real,
intent(out):: uc(is:ie,js:je), vc(is:ie,js:je)
4105 real :: zh, dz, usfc, vsfc, u6km, v6km, umn, vmn
4106 real :: ushr, vshr, shrmag
4108 real,
parameter :: bunkers_d = 7.5
4109 logical :: has_sfc, has_6km
4134 if ( hydrostatic )
then 4136 dz = rdg*pt(i,j,k)*
virq(q(i,j,k,1:
num_gas))*(peln(i,k+1,j)-peln(i,k,j))
4138 dz = rdg*pt(i,j,k)*(1.+zvir*q(i,j,k,
sphum))*(peln(i,k+1,j)-peln(i,k,j))
4149 umn = umn + ua(i,j,k)*dz
4150 vmn = vmn + va(i,j,k)*dz
4157 u6km = u6km + (ua(i,j,k) - u6km) / dz * (6000. - (zh - dz))
4158 v6km = v6km + (va(i,j,k) - v6km) / dz * (6000. - (zh - dz))
4160 umn = umn / (zh - dz)
4161 vmn = vmn / (zh - dz)
4165 shrmag = sqrt(ushr * ushr + vshr * vshr)
4166 uc(i,j) = umn + bunkers_d * vshr / shrmag
4167 vc(i,j) = vmn - bunkers_d * ushr / shrmag
4176 w, vort, delz, q, hydrostatic, pt, peln, phis, grav, z_bot, z_top)
4178 integer,
intent(in):: is, ie, js, je, ng, km, sphum
4179 real,
intent(in):: grav, zvir, z_bot, z_top
4180 real,
intent(in),
dimension(is-ng:ie+ng,js-ng:je+ng,km):: pt, w
4181 real,
intent(in),
dimension(is:ie,js:je,km):: vort
4182 real,
intent(in):: delz(is-ng:ie+ng,js-ng:je+ng,km)
4183 real,
intent(in):: q(is-ng:ie+ng,js-ng:je+ng,km,*)
4184 real,
intent(in):: phis(is-ng:ie+ng,js-ng:je+ng)
4185 real,
intent(in):: peln(is:ie,km+1,js:je)
4186 logical,
intent(in):: hydrostatic
4187 real,
intent(out):: uh(is:ie,js:je)
4192 real,
dimension(is:ie):: zh, dz, zh0
4194 logical below(is:ie)
4214 if ( hydrostatic )
then 4216 dz(i) = rdg*pt(i,j,k)*
virq(q(i,j,k,1:
num_gas))*(peln(i,k+1,j)-peln(i,k,j))
4218 dz(i) = rdg*pt(i,j,k)*(1.+zvir*q(i,j,k,sphum))*(peln(i,k+1,j)-peln(i,k,j))
4221 dz(i) = - delz(i,j,k)
4223 zh(i) = zh(i) + dz(i)
4224 if (zh(i) <= z_bot )
continue 4225 if (zh(i) > z_bot .and. below(i))
then 4226 uh(i,j) = vort(i,j,k)*w(i,j,k)*(zh(i) - z_bot)
4229 elseif ( zh(i) < z_top )
then 4230 uh(i,j) = uh(i,j) + vort(i,j,k)*w(i,j,k)*dz(i)
4232 uh(i,j) = uh(i,j) + vort(i,j,k)*w(i,j,k)*(z_top - (zh(i)-dz(i)) )
4245 subroutine pv_entropy(is, ie, js, je, ng, km, vort, f_d, pt, pkz, delp, grav)
4248 integer,
intent(in):: is, ie, js, je, ng, km
4249 real,
intent(in):: grav
4250 real,
intent(in):: pt(is-ng:ie+ng,js-ng:je+ng,km)
4251 real,
intent(in):: pkz(is:ie,js:je,km)
4252 real,
intent(in):: delp(is-ng:ie+ng,js-ng:je+ng,km)
4253 real,
intent(in):: f_d(is-ng:ie+ng,js-ng:je+ng)
4256 real,
intent(inout):: vort(is:ie,js:je,km)
4277 real w3d(is:ie,js:je,km)
4278 real te(is:ie,js:je,km+1), t2(is:ie,km), delp2(is:ie,km)
4279 real te2(is:ie,km+1)
4286 vort(i,j,1) = grav * (vort(i,j,1)+f_d(i,j)) / delp(i,j,1)
4296 t2(i,k) = pt(i,j,k) / pkz(i,j,k)
4297 w3d(i,j,k) = t2(i,k)
4298 delp2(i,k) = delp(i,j,k)
4302 call ppme(t2, te2, delp2, ie-is+1, km)
4306 te(i,j,k) = te2(i,k)
4316 vort(i,j,k) = (vort(i,j,k)+f_d(i,j)) * ( te(i,j,k)-te(i,j,k+1) ) &
4317 / ( w3d(i,j,k)*delp(i,j,k) ) * grav
4326 subroutine ppme(p,qe,delp,im,km)
4328 integer,
intent(in):: im, km
4329 real,
intent(in):: p(im,km)
4330 real,
intent(in):: delp(im,km)
4331 real,
intent(out)::qe(im,km+1)
4334 real dc(im,km),delq(im,km), a6(im,km)
4335 real c1, c2, c3, tmp, qmax, qmin
4336 real a1, a2, s1, s2, s3, s4, ss3, s32, s34, s42
4337 real a3, b2, sc, dm, d1, d2, f1, f2, f3, f4
4345 500 a6(i,k) = delp(i,k-1) + delp(i,k)
4349 delq(i,k) = p(i,k+1) - p(i,k)
4354 c1 = (delp(i,k-1)+0.5*delp(i,k))/a6(i,k+1)
4355 c2 = (delp(i,k+1)+0.5*delp(i,k))/a6(i,k)
4356 tmp = delp(i,k)*(c1*delq(i,k) + c2*delq(i,k-1)) / &
4357 (a6(i,k)+delp(i,k+1))
4358 qmax = max(p(i,k-1),p(i,k),p(i,k+1)) - p(i,k)
4359 qmin = p(i,k) - min(p(i,k-1),p(i,k),p(i,k+1))
4360 dc(i,k) = sign(min(abs(tmp),qmax,qmin), tmp)
4369 c1 = delq(i,k-1)*delp(i,k-1) / a6(i,k)
4370 a1 = a6(i,k-1) / (a6(i,k) + delp(i,k-1))
4371 a2 = a6(i,k+1) / (a6(i,k) + delp(i,k))
4372 qe(i,k) = p(i,k-1) + c1 + 2./(a6(i,k-1)+a6(i,k+1)) * &
4373 ( delp(i,k)*(c1*(a1 - a2)+a2*dc(i,k-1)) - &
4374 delp(i,k-1)*a1*dc(i,k ) )
4388 s3 = delp(i,2) + delp(i,3)
4395 a3 = (delq(i,2) - delq(i,1)*s3/s2) / (s3*ss3)
4397 if(abs(a3) .gt. 1.e-14)
then 4398 b2 = delq(i,1)/s2 - a3*(s1+s2)
4400 if(sc .lt. 0. .or. sc .gt. s1)
then 4401 qe(i,1) = p(i,1) - s1*(a3*s1 + b2)
4403 qe(i,1) = p(i,1) - delq(i,1)*s1/s2
4407 qe(i,1) = p(i,1) - delq(i,1)*s1/s2
4409 dc(i,1) = p(i,1) - qe(i,1)
4411 dm = delp(i,1) / (s34*ss3*(delp(i,2)+s3)*(s4+delp(i,1)))
4412 f1 = delp(i,2)*s34 / ( s2*ss3*(s4+delp(i,1)) )
4413 f2 = (delp(i,2)+s3) * (ss3*(delp(i,2)*s3+s34+delp(i,2)*s4) &
4414 + s42*(delp(i,2)+s3+s32/s2))
4415 f3 = -delp(i,2)*( ss3*(s32*(s3+s4)/(s4-delp(i,2)) &
4416 + (delp(i,2)*s3+s34+delp(i,2)*s4)) &
4417 + s42*(delp(i,2)+s3) )
4418 f4 = ss3*delp(i,2)*s32*(delp(i,2)+s3) / (s4-delp(i,2))
4419 qe(i,2) = f1*p(i,1)+(f2*p(i,2)+f3*p(i,3)+f4*p(i,4))*dm
4427 qm = (d2*p(i,km)+d1*p(i,km1)) / (d1+d2)
4428 dq = 2.*(p(i,km1)-p(i,km)) / (d1+d2)
4429 c1 = (qe(i,km1)-qm-d2*dq) / (d2*(2.*d2*d2+d1*(d2+3.*d1)))
4430 c3 = dq - 2.0*c1*(d2*(5.*d1+d2)-3.*d1**2)
4431 qe(i,km ) = qm - c1*d1*d2*(d2+3.*d1)
4432 qe(i,km+1) = d1*(8.*c1*d1**2-c3) + qe(i,km)
4437 subroutine rh_calc (pfull, t, qv, rh, do_cmip)
4439 real,
intent (in),
dimension(:,:) :: pfull, t, qv
4440 real,
intent (out),
dimension(:,:) :: rh
4441 real,
dimension(size(t,1),size(t,2)) :: esat
4442 logical,
intent(in),
optional :: do_cmip
4444 real,
parameter :: d622 = rdgas/rvgas
4445 real,
parameter :: d378 = 1.-d622
4447 logical :: do_simple = .false.
4452 call lookup_es (t, esat)
4453 rh(:,:) = pfull(:,:)
4454 rh(:,:) = max(rh(:,:),esat(:,:))
4455 rh(:,:)=100.*qv(:,:)/(d622*esat(:,:)/rh(:,:))
4457 if (
present(do_cmip))
then 4458 call compute_qs (t, pfull, rh, q=qv, es_over_liq_and_ice = .true.)
4459 rh(:,:)=100.*qv(:,:)/rh(:,:)
4461 call compute_qs (t, pfull, rh, q=qv)
4462 rh(:,:)=100.*qv(:,:)/rh(:,:)
4468 #ifdef SIMPLIFIED_THETA_E 4474 subroutine eqv_pot(theta_e, pt, delp, delz, peln, pkz, qi, is, ie, js, je, ng, npz, &
4477 subroutine eqv_pot(theta_e, pt, delp, delz, peln, pkz, q, is, ie, js, je, ng, npz, &
4480 integer,
intent(in):: is,ie,js,je,ng,npz
4482 real,
intent(in),
dimension(is-ng:ie+ng,js-ng:je+ng,npz,*):: qi
4484 real,
intent(in),
dimension(is-ng:ie+ng,js-ng:je+ng,npz):: pt, delp, q
4485 real,
intent(in),
dimension(is-ng: ,js-ng: ,1: ):: delz
4486 real,
intent(in),
dimension(is:ie,npz+1,js:je):: peln
4487 real,
intent(in):: pkz(is:ie,js:je,npz)
4488 logical,
intent(in):: hydrostatic, moist
4490 real,
dimension(is:ie,js:je,npz),
intent(out) :: theta_e
4492 real,
parameter:: tice = 273.16
4493 real,
parameter:: c_liq = 4190.
4495 real,
parameter:: dc_vap = 0.
4497 real,
parameter:: dc_vap = cp_vapor - c_liq
4499 real(kind=R_GRID),
dimension(is:ie):: pd, rq
4500 real(kind=R_GRID) :: wfac
4512 q(i,j,k) = qi(i,j,k,1)
4523 if ( hydrostatic )
then 4525 rq(i) = max(0., wfac*q(i,j,k))
4526 pd(i) = (1.-rq(i))*delp(i,j,k) / (peln(i,k+1,j) - peln(i,k,j))
4531 rq(i) = max(0., wfac*q(i,j,k))
4532 pd(i) = -rdgas*pt(i,j,k)*(1.-rq(i))*delp(i,j,k)/(grav*delz(i,j,k))
4538 rq(i) = max(0., q(i,j,k))
4545 theta_e(i,j,k) = pt(i,j,k)*exp(kappa * (
virqd(qi(i,j,k,:))/
vicpqd(qi(i,j,k,:)))*log(1.e5/pd(i))) * &
4546 exp(rq(i)*hlv/(cp_air*
vicpqd(qi(i,j,k,:))*pt(i,j,k)))
4548 theta_e(i,j,k) = pt(i,j,k)*exp(kappa*log(1.e5/pd(i))) * &
4549 exp(rq(i)*hlv/(cp_air*pt(i,j,k)))
4553 theta_e(i,j,k) = pt(i,j,k)*exp( rq(i)/(cp_air*
vicpqd(q(i,j,k,:))*pt(i,j,k))*(hlv+dc_vap*(pt(i,j,k)-tice)) &
4554 + rdgas*
virqd(qi(i,j,k,:)) / (cp_air*
vicpqd(qi(i,j,k,:)))*log(1.e5/pd(i)) )
4556 theta_e(i,j,k) = pt(i,j,k)*exp( rq(i)/(cp_air*pt(i,j,k))*(hlv+dc_vap*(pt(i,j,k)-tice)) &
4557 + kappa*log(1.e5/pd(i)) )
4562 if ( hydrostatic )
then 4564 theta_e(i,j,k) = pt(i,j,k)*
pk0/pkz(i,j,k)
4570 theta_e(i,j,k) = pt(i,j,k)*exp( kappa * (
virqd(qi(i,j,k,:))/
vicpqd(qi(i,j,k,:)))*log(1.e5/pd(i)) )
4572 theta_e(i,j,k) = pt(i,j,k)*exp( kappa*log(1.e5/pd(i)) )
4589 subroutine eqv_pot(theta_e, pt, delp, delz, peln, pkz, qi, is, ie, js, je, ng, npz, &
4591 subroutine eqv_pot(theta_e, pt, delp, delz, peln, pkz, q, is, ie, js, je, ng, npz, &
4595 integer,
intent(in):: is,ie,js,je,ng,npz
4597 real,
intent(in),
dimension(is-ng:ie+ng,js-ng:je+ng,npz,*):: qi
4599 real,
intent(in),
dimension(is-ng:ie+ng,js-ng:je+ng,npz):: q
4601 real,
intent(in),
dimension(is-ng:ie+ng,js-ng:je+ng,npz):: pt, delp
4602 real,
intent(in),
dimension(is-ng: ,js-ng: ,1: ):: delz
4603 real,
intent(in),
dimension(is:ie,npz+1,js:je):: peln
4604 real,
intent(in):: pkz(is:ie,js:je,npz)
4605 logical,
intent(in):: hydrostatic, moist
4607 real,
dimension(is:ie,js:je,npz),
intent(out) :: theta_e
4610 real,
dimension(is-ng:ie+ng,js-ng:je+ng,npz):: q
4612 real,
parameter:: cv_vap = cp_vapor - rvgas
4613 real,
parameter:: cappa_b = 0.2854
4614 real(kind=R_GRID):: cv_air, cappa, zvir
4615 real(kind=R_GRID):: p_mb(is:ie)
4616 real(kind=R_GRID) :: r, e, t_l, rdg, capa
4620 q(:,:,:) = qi(:,:,:,1)
4622 cv_air = cp_air - rdgas
4625 zvir = rvgas/rdgas - 1.
4640 if ( hydrostatic )
then 4642 p_mb(i) = 0.01*delp(i,j,k) / (peln(i,k+1,j) - peln(i,k,j))
4647 p_mb(i) = 0.01*rdg*delp(i,j,k)/delz(i,j,k)*pt(i,j,k)*
virq(qi(i,j,k,1:
num_gas))
4649 p_mb(i) = 0.01*rdg*delp(i,j,k)/delz(i,j,k)*pt(i,j,k)*(1.+zvir*q(i,j,k))
4656 cappa = rdgas/(rdgas+((1.-q(i,j,k))*cv_air+q(i,j,k)*cv_vap)/
virq(qi(i,j,k,1:
num_gas)))
4658 cappa = rdgas/(rdgas+((1.-q(i,j,k))*cv_air+q(i,j,k)*cv_vap)/(1.+zvir*q(i,j,k)))
4661 r = q(i,j,k)/(1.-q(i,j,k))*1000.
4664 e = p_mb(i)*r/(622.+r)
4667 t_l = 2840./(3.5*log(pt(i,j,k))-log(e)-4.805)+55.
4671 capa = cappa*(1. - r*0.28e-3)
4672 theta_e(i,j,k) = exp( (3.376/t_l-0.00254)*r*(1.+r*0.81e-3) )*pt(i,j,k)*(1000./p_mb(i))**capa
4675 if ( hydrostatic )
then 4677 theta_e(i,j,k) = pt(i,j,k)*
pk0/pkz(i,j,k)
4682 theta_e(i,j,k) = pt(i,j,k)*exp( kappa *
virqd(qi(i,j,k,1:
num_gas))/
vicpqd(qi(i,j,k,1:
num_gas)) *log(1000./p_mb(i)) )
4684 theta_e(i,j,k) = pt(i,j,k)*exp( kappa*log(1000./p_mb(i)) )
4699 w, delz, pt, delp, q, hs, area, domain, &
4700 sphum, liq_wat, rainwat, ice_wat, &
4701 snowwat, graupel, nwat, ua, va, moist_phys, te)
4703 integer,
intent(in):: km, is, ie, js, je, isd, ied, jsd, jed
4704 integer,
intent(in):: nwat, sphum, liq_wat, rainwat, ice_wat, snowwat, graupel
4705 real,
intent(in),
dimension(isd:ied,jsd:jed,km):: ua, va, pt, delp, w, delz
4706 real,
intent(in),
dimension(isd:ied,jsd:jed,km,nwat):: q
4707 real,
intent(in):: hs(isd:ied,jsd:jed)
4708 real,
intent(in):: area(isd:ied, jsd:jed)
4709 logical,
intent(in):: moist_phys
4710 type(domain2d),
intent(INOUT) :: domain
4711 real,
intent(out):: te(is:ie,js:je)
4713 real,
parameter:: c_liq = 4190.
4714 real(kind=R_Grid) :: area_l(isd:ied, jsd:jed)
4715 real,
parameter:: cv_vap = cp_vapor - rvgas
4716 real phiz(is:ie,km+1)
4717 real,
dimension(is:ie):: cvm, qc
4722 cv_air = cp_air - rdgas
4734 phiz(i,km+1) = hs(i,j)
4739 phiz(i,k) = phiz(i,k+1) - grav*delz(i,j,k)
4743 if ( moist_phys )
then 4745 call moist_cv(is,ie,isd,ied,jsd,jed, km, j, k, nwat, sphum, liq_wat, rainwat, &
4746 ice_wat, snowwat, graupel, q, qc, cvm)
4748 te(i,j) = te(i,j) + delp(i,j,k)*( cvm(i)*pt(i,j,k) + hlv*q(i,j,k,sphum) + &
4749 0.5*(phiz(i,k)+phiz(i,k+1)+ua(i,j,k)**2+va(i,j,k)**2+w(i,j,k)**2) )
4756 te(i,j) = te(i,j) + delp(i,j,k)*( cv_air*
vicvqd(q(i,j,k,1:
num_gas))*pt(i,j,k) + &
4757 0.5*(phiz(i,k)+phiz(i,k+1)+ua(i,j,k)**2+va(i,j,k)**2+w(i,j,k)**2) )
4759 te(i,j) = te(i,j) + delp(i,j,k)*( cv_air*pt(i,j,k) + &
4760 0.5*(phiz(i,k)+phiz(i,k+1)+ua(i,j,k)**2+va(i,j,k)**2+w(i,j,k)**2) )
4767 te(i,j) = te(i,j)/grav
4771 psm =
g_sum(domain, te, is, ie, js, je, 3, area_l, 1)
4772 if(
master )
write(*,*)
'TE ( Joule/m^2 * E9) =', psm * 1.e-9
4786 subroutine dbzcalc(q, pt, delp, peln, delz, &
4787 dbz, maxdbz, allmax, bd, npz, ncnst, &
4788 hydrostatic, zvir, in0r, in0s, in0g, iliqskin)
4832 integer,
intent(IN) :: npz, ncnst
4833 real,
intent(IN),
dimension(bd%isd:bd%ied, bd%jsd:bd%jed, npz) :: pt, delp, delz
4834 real,
intent(IN),
dimension(bd%isd:bd%ied, bd%jsd:bd%jed, npz, ncnst) :: q
4835 real,
intent(IN),
dimension(bd%is :bd%ie, npz+1, bd%js:bd%je) :: peln
4836 real,
intent(OUT),
dimension(bd%is :bd%ie, bd%js :bd%je , npz) :: dbz
4837 real,
intent(OUT),
dimension(bd%is :bd%ie, bd%js :bd%je) :: maxdbz
4838 logical,
intent(IN) :: hydrostatic, in0r, in0s, in0g, iliqskin
4839 real,
intent(IN) :: zvir
4840 real,
intent(OUT) :: allmax
4844 real(kind=R_GRID),
parameter:: rn0_r = 8.e6
4845 real(kind=R_GRID),
parameter:: rn0_s = 3.e6
4846 real(kind=R_GRID),
parameter:: rn0_g = 4.e6
4847 real(kind=R_GRID),
parameter:: vconr = 2503.23638966667
4848 real(kind=R_GRID),
parameter:: vcong = 87.2382675
4849 real(kind=R_GRID),
parameter:: vcons = 6.6280504
4850 real(kind=R_GRID),
parameter:: normr = 25132741228.7183
4851 real(kind=R_GRID),
parameter:: normg = 5026548245.74367
4852 real(kind=R_GRID),
parameter:: norms = 942477796.076938
4856 real,
parameter :: r1=1.e-15
4857 real,
parameter :: ron=8.e6
4858 real,
parameter :: ron2=1.e10
4859 real,
parameter :: son=2.e7
4860 real,
parameter :: gon=5.e7
4861 real,
parameter :: ron_min = 8.e6
4862 real,
parameter :: ron_qr0 = 0.00010
4863 real,
parameter :: ron_delqr0 = 0.25*ron_qr0
4864 real,
parameter :: ron_const1r = (ron2-ron_min)*0.5
4865 real,
parameter :: ron_const2r = (ron2+ron_min)*0.5
4868 real,
parameter :: gamma_seven = 720.
4870 real,
parameter :: rho_r = 1.0e3
4871 real,
parameter :: rho_s = 100.
4872 real,
parameter :: rho_g0 = 400.
4873 real,
parameter :: rho_g = 500.
4875 real,
parameter :: alpha = 0.224
4876 real(kind=R_GRID),
parameter :: factor_r = gamma_seven * 1.e18 * (1./(pi*rho_r))**1.75
4877 real(kind=R_GRID),
parameter :: factor_s = gamma_seven * 1.e18 * (1./(pi*rho_s))**1.75 &
4878 * (rho_s/rho_r)**2 * alpha
4879 real(kind=R_GRID),
parameter :: factor_g = gamma_seven * 1.e18 * (1./(pi*rho_g))**1.75 &
4880 * (rho_g/rho_r)**2 * alpha
4881 real,
parameter :: qmin = 1.e-12
4882 real,
parameter :: tice = 273.16
4885 real(kind=R_GRID):: rhoair(bd%is:bd%ie)
4886 real(kind=R_GRID):: qr1, qs1, qg1, t1, t2, t3, rwat, denfac, vtr, vtg, vts
4887 real(kind=R_GRID):: factorb_s, factorb_g
4888 real(kind=R_GRID):: temp_c, pres, sonv, gonv, ronv, z_e
4891 integer :: is, ie, js, je
4907 if (hydrostatic)
then 4910 rhoair(i) = delp(i,j,k)/( (peln(i,k+1,j)-peln(i,k,j)) * rdgas * pt(i,j,k) *
virq(q(i,j,k,1:
num_gas)) )
4912 rhoair(i) = delp(i,j,k)/( (peln(i,k+1,j)-peln(i,k,j)) * rdgas * pt(i,j,k) * ( 1. + zvir*q(i,j,k,
sphum) ) )
4917 rhoair(i) = -delp(i,j,k)/(grav*delz(i,j,k))
4926 t1 = rhoair(i)*max(qmin, q(i,j,k,
rainwat)+dim(q(i,j,k,
liq_wat), 1.0e-3))
4927 t2 = rhoair(i)*max(qmin, q(i,j,k,
snowwat))
4929 t3 = rhoair(i)*max(qmin, q(i,j,k,
graupel))
4933 denfac = sqrt(min(10., 1.2/rhoair(i)))
4934 vtr = max(1.e-3, vconr*denfac*exp(0.2 *log(t1/normr)))
4935 vtg = max(1.e-3, vcong*denfac*exp(0.125 *log(t3/normg)))
4937 z_e = 200.*(exp(1.6*log(3.6e6*t1/rho_r*vtr)) + exp(1.6*log(3.6e6*t3/rho_g0*vtg))) + (factor_s/alpha)*t2*exp(0.75*log(t2/rn0_s))
4939 dbz(i,j,k) = 10.*log10( max(0.01, z_e) )
4948 maxdbz(i,j) = max(dbz(i,j,k), maxdbz(i,j))
4955 allmax = max(maxdbz(i,j), allmax)
4962 integer,
intent(in):: is, ie, js, je, km
4963 real,
intent(in),
dimension(is:ie,js:je,km):: vort
4964 real,
intent(inout),
dimension(is:ie,js:je):: maxvorthy1
4969 maxvorthy1(i,j)=max(maxvorthy1(i,j),vort(i,j,km))
4976 subroutine max_vorticity(is, ie, js, je, ng, km, zvir, sphum, delz, q, hydrostatic, &
4977 pt, peln, phis, grav, vort, maxvort, z_bot, z_top)
4978 integer,
intent(in):: is, ie, js, je, ng, km,
sphum 4979 real,
intent(in):: grav, zvir, z_bot, z_top
4980 real,
intent(in),
dimension(is-ng:ie+ng,js-ng:je+ng,km):: pt
4981 real,
intent(in),
dimension(is:ie,js:je,km):: vort
4982 real,
intent(in):: delz(is-ng:ie+ng,js-ng:je+ng,km)
4983 real,
intent(in):: q(is-ng:ie+ng,js-ng:je+ng,km,*)
4984 real,
intent(in):: phis(is-ng:ie+ng,js-ng:je+ng)
4985 real,
intent(in):: peln(is:ie,km+1,js:je)
4986 logical,
intent(in):: hydrostatic
4988 real,
intent(inout),
dimension(is:ie,js:je):: maxvort
4991 real,
dimension(is:ie):: zh, dz, zh0
4992 integer i, j, k,klevel
4993 logical below(is:ie)
5005 if ( hydrostatic )
then 5006 dz(i) = rdg*pt(i,j,k)*(1.+zvir*q(i,j,k,
sphum))*(peln(i,k+1,j)-peln(i,k,j))
5008 dz(i) = - delz(i,j,k)
5010 zh(i) = zh(i) + dz(i)
5011 if (zh(i) <= z_bot )
continue 5012 if (zh(i) > z_bot .and. below(i))
then 5013 maxvort(i,j) = max(maxvort(i,j),vort(i,j,k))
5015 elseif ( zh(i) < z_top )
then 5016 maxvort(i,j) = max(maxvort(i,j),vort(i,j,k))
5018 maxvort(i,j) = max(maxvort(i,j),vort(i,j,k))
5029 subroutine max_uh(is, ie, js, je, ng, km, zvir, sphum, uphmax,uphmin, &
5030 w, vort, delz, q, hydrostatic, pt, peln, phis, grav, z_bot, z_top)
5032 integer,
intent(in):: is, ie, js, je, ng, km,
sphum 5033 real,
intent(in):: grav, zvir, z_bot, z_top
5034 real,
intent(in),
dimension(is-ng:ie+ng,js-ng:je+ng,km):: pt, w
5035 real,
intent(in),
dimension(is:ie,js:je,km):: vort
5036 real,
intent(in):: delz(is-ng:ie+ng,js-ng:je+ng,km)
5037 real,
intent(in):: q(is-ng:ie+ng,js-ng:je+ng,km,*)
5038 real,
intent(in):: phis(is-ng:ie+ng,js-ng:je+ng)
5039 real,
intent(in):: peln(is:ie,km+1,js:je)
5040 logical,
intent(in):: hydrostatic
5041 real :: uh(is:ie,js:je)
5042 real,
intent(inout),
dimension(is:ie,js:je):: uphmax,uphmin
5047 real,
dimension(is:ie):: zh, dz, zh0
5049 logical below(is:ie)
5062 if ( hydrostatic )
then 5063 dz(i) = rdg*pt(i,j,k)*(1.+zvir*q(i,j,k,
sphum))*(peln(i,k+1,j)-peln(i,k,j))
5065 dz(i) = - delz(i,j,k)
5067 zh(i) = zh(i) + dz(i)
5068 if (zh(i) <= z_bot )
continue 5069 if (zh(i) > z_bot .and. below(i))
then 5070 if(w(i,j,k).lt.0)
then 5074 uh(i,j) = vort(i,j,k)*w(i,j,k)*(zh(i) - z_bot)
5077 elseif ( zh(i) < z_top )
then 5078 if(w(i,j,k).lt.0)
then 5082 uh(i,j) = uh(i,j) + vort(i,j,k)*w(i,j,k)*dz(i)
5084 if(w(i,j,k).lt.0)
then 5088 uh(i,j) = uh(i,j) + vort(i,j,k)*w(i,j,k)*(z_top - (zh(i)-dz(i)) )
5092 if (uh(i,j) > uphmax(i,j))
then 5093 uphmax(i,j) = uh(i,j)
5094 elseif (uh(i,j) < uphmin(i,j))
then 5095 uphmin(i,j) = uh(i,j)
5101 subroutine max_vv(is,ie,js,je,npz,ng,up2,dn2,pe,w)
5103 integer,
intent(in):: is, ie, js, je, ng, npz
5105 real,
intent(in),
dimension(is-ng:ie+ng,js-ng:je+ng,npz):: w
5106 real,
intent(in):: pe(is-1:ie+1,npz+1,js-1:je+1)
5107 real,
intent(inout),
dimension(is:ie,js:je):: up2,dn2
5111 if (pe(i,k,j) >= 100.e2)
then 5112 up2(i,j) = max(up2(i,j),w(i,j,k))
5113 dn2(i,j) = min(dn2(i,j),w(i,j,k))
5123 if (atm%grid_Number > 1)
then 5124 write(
gn,
"(A2,I1)")
" g", atm%grid_number
5139 subroutine getcape( nk , p , t , dz, q, the, cape , cin, source_in )
5142 integer,
intent(in) :: nk
5143 real,
dimension(nk),
intent(in) :: p,t,dz,q,the
5144 real,
intent(out) :: cape,cin
5145 integer,
intent(IN),
OPTIONAL :: source_in
5189 real,
parameter :: pinc = 10000.0
5195 real,
parameter :: ml_depth = 200.0
5198 integer,
parameter :: adiabat = 1
5210 integer :: source = 1
5211 logical :: doit,ice,cloud,not_converged
5212 integer :: k,kmin,n,nloop,i,orec
5213 real,
dimension(nk) :: pi,th,thv,z,pt,pb,pc,pn,ptv
5215 real :: maxthe,parea,narea,lfc
5216 real :: th1,p1,t1,qv1,ql1,qi1,b1,pi1,thv1,qt,dp,frac
5217 real :: th2,p2,t2,qv2,ql2,qi2,b2,pi2,thv2
5218 real :: thlast,fliq,fice,tbar,qvbar,qlbar,qibar,lhv,lhs,lhf,rm,cpm
5219 real*8 :: avgth,avgqv
5223 real,
parameter :: g = 9.81
5224 real,
parameter :: p00 = 100000.0
5225 real,
parameter :: cp = 1005.7
5226 real,
parameter :: rd = 287.04
5227 real,
parameter :: rv = 461.5
5228 real,
parameter :: xlv = 2501000.0
5229 real,
parameter :: xls = 2836017.0
5230 real,
parameter :: t0 = 273.15
5231 real,
parameter :: cpv = 1875.0
5232 real,
parameter :: cpl = 4190.0
5233 real,
parameter :: cpi = 2118.636
5234 real,
parameter :: lv1 = xlv+(cpl-cpv)*t0
5235 real,
parameter :: lv2 = cpl-cpv
5236 real,
parameter :: ls1 = xls+(cpi-cpv)*t0
5237 real,
parameter :: ls2 = cpi-cpv
5239 real,
parameter :: rp00 = 1.0/p00
5240 real,
parameter :: eps = rd/rv
5241 real,
parameter :: reps = rv/rd
5242 real,
parameter :: rddcp = rd/cp
5243 real,
parameter :: cpdrd = cp/rd
5244 real,
parameter :: cpdg = cp/g
5246 real,
parameter :: converge = 0.1
5248 integer,
parameter :: debug_level = 0
5250 if (
present(source_in)) source = source_in
5257 pi(k) = (p(k)*rp00)**rddcp
5259 thv(k) = th(k)*(1.0+reps*q(k))/(1.0+q(k))
5266 z(k) = z(k+1) + 0.5*(dz(k+1)+dz(k))
5275 ELSEIF(source.eq.2)
THEN 5278 IF(p(1).lt.50000.0)
THEN 5286 if(p(k).ge.50000.0)
then 5287 if( the(nk).gt.maxthe )
then 5294 if(debug_level.ge.100) print *,
' kmin,maxthe = ',kmin,maxthe
5358 print *,
' Unknown value for source' 5360 print *,
' source = ',source
5362 call mpp_error(fatal,
" Unknown CAPE source")
5369 if( (source.eq.1).or.(source.eq.2) )
then 5378 elseif( source.eq.3 )
then 5382 thv2 = th2*(1.0+reps*qv2)/(1.0+qv2)
5386 b2 = g*( thv2-thv(kmin) )/thv(kmin)
5399 if(adiabat.eq.1.or.adiabat.eq.2)
then 5410 if(debug_level.ge.100)
then 5411 print *,
' Start loop:' 5412 print *,
' p2,th2,qv2 = ',p2,th2,qv2
5415 do while( doit .and. (k.gt.1) )
5422 if( dp.lt.pinc )
then 5425 nloop = 1 + int( dp/pinc )
5426 dp = dp/float(nloop)
5441 pi2 = (p2*rp00)**rddcp
5445 not_converged = .true.
5447 do while( not_converged )
5451 fliq = max(min((t2-233.15)/(273.15-233.15),1.0),0.0)
5457 qv2 = min( qt , fliq*
getqvs(p2,t2) + fice*
getqvi(p2,t2) )
5458 qi2 = max( fice*(qt-qv2) , 0.0 )
5459 ql2 = max( qt-qv2-qi2 , 0.0 )
5462 qvbar = 0.5*(qv1+qv2)
5463 qlbar = 0.5*(ql1+ql2)
5464 qibar = 0.5*(qi1+qi2)
5471 cpm=cp+cpv*qvbar+cpl*qlbar+cpi*qibar
5472 th2=th1*exp( lhv*(ql2-ql1)/(cpm*tbar) &
5473 +lhs*(qi2-qi1)/(cpm*tbar) &
5474 +(rm/cpm-rd/cp)*alog(p2/p1) )
5476 if(i.gt.90) print *,i,th2,thlast,th2-thlast
5479 print *,
' Error: lack of convergence' 5481 print *,
' ... stopping iteration ' 5485 if( abs(th2-thlast).gt.converge )
then 5486 thlast=thlast+0.3*(th2-thlast)
5488 not_converged = .false.
5495 if( ql2.ge.1.0e-10 ) cloud = .true.
5497 IF(adiabat.eq.1.or.adiabat.eq.3)
THEN 5502 ELSEIF(adiabat.le.0.or.adiabat.ge.5)
THEN 5504 print *,
' Undefined adiabat' 5511 thv2 = th2*(1.0+reps*qv2)/(1.0+qv2+ql2+qi2)
5512 b2 = g*( thv2-thv(k) )/thv(k)
5518 if( (b2.ge.0.0) .and. (b1.lt.0.0) )
then 5522 parea = 0.5*b2*dz(k)*frac
5523 narea = narea-0.5*b1*dz(k)*(1.0-frac)
5524 if(debug_level.ge.200)
then 5525 print *,
' b1,b2 = ',b1,b2
5527 print *,
' frac = ',frac
5528 print *,
' parea = ',parea
5529 print *,
' narea = ',narea
5533 elseif( (b2.lt.0.0) .and. (b1.gt.0.0) )
then 5537 parea = 0.5*b1*dz(k)*frac
5538 narea = -0.5*b2*dz(k)*(1.0-frac)
5539 if(debug_level.ge.200)
then 5540 print *,
' b1,b2 = ',b1,b2
5542 print *,
' frac = ',frac
5543 print *,
' parea = ',parea
5544 print *,
' narea = ',narea
5546 elseif( b2.lt.0.0 )
then 5549 narea = narea-0.5*dz(k)*(b1+b2)
5552 parea = 0.5*dz(k)*(b1+b2)
5556 cape = cape + max(0.0,parea)
5558 if(debug_level.ge.200)
then 5559 write(6,102) p2,b1,b2,cape,cin,cloud
5560 102
format(5(f13.4),2x,l1)
5563 if( (p(k).le.10000.0).and.(b2.lt.0.0) )
then 5577 real function getqvs(p,t)
5582 real,
parameter :: eps = 287.04/461.5
5584 es = 611.2*exp(17.67*(t-273.15)/(t-29.65))
5592 real function getqvi(p,t)
5597 real,
parameter :: eps = 287.04/461.5
5599 es = 611.2*exp(21.8745584*(t-273.15)/(t-7.66))
character(len=256) tlongname
subroutine, public prt_height(qname, is, ie, js, je, ng, km, press, phis, delz, peln, area, lat)
pure real function, public vicpqd(q)
real, parameter missing_value3
for variables where we look for smallest values
subroutine cs_prof(q2, delp, q, km, i1, i2, iv)
The module 'fv_mp_mod' is a single program multiple data (SPMD) parallel decompostion/communication m...
subroutine, public max_uh(is, ie, js, je, ng, km, zvir, sphum, uphmax, uphmin, w, vort, delz, q, hydrostatic, pt, peln, phis, grav, z_bot, z_top)
The type 'fv_grid_type' is made up of grid-dependent information from fv_grid_tools and fv_grid_utils...
real, parameter missing_value2
for variables with many missing values
real, dimension(:,:), allocatable, public zs_g
subroutine, public moist_cv(is, ie, isd, ied, jsd, jed, km, j, k, nwat, sphum, liq_wat, rainwat, ice_wat, snowwat, graupel, q, qd, cvm, t1)
The subroutine 'moist_cv' computes the FV3-consistent moist heat capacity under constant volume...
real, public sphum_ll_fix
subroutine getcape(nk, p, t, dz, q, the, cape, cin, source_in)
The subroutine 'getcape' calculates the Convective Available Potential Energy (CAPE) from a Sounding...
The module 'multi_gases' peforms multi constitutents computations.
subroutine, public a2b_ord2(qin, qout, gridstruct, npx, npy, is, ie, js, je, ng, replace)
subroutine, public eqv_pot(theta_e, pt, delp, delz, peln, pkz, q, is, ie, js, je, ng, npz, hydrostatic, moist)
The subroutine 'eqv_pot' calculates the equivalent potential temperature.
subroutine, public get_eta_level(npz, p_s, pf, ph, ak, bk, pscale)
The subroutine 'get_eta_level' returns the interface and layer-mean pressures for reference...
real, parameter missing_value
subroutine get_height_given_pressure(is, ie, js, je, km, wz, kd, id, log_p, peln, a2)
real function, public g_sum(domain, p, ifirst, ilast, jfirst, jlast, ngc, area, mode, reproduce)
The function 'g_sum' is the fast version of 'globalsum'.
integer, parameter max_step
subroutine wind_max(isc, iec, jsc, jec, isd, ied, jsd, jed, us, vs, ws_max, domain)
subroutine get_pressure_given_height(is, ie, js, je, ng, km, wz, kd, height, ts, peln, a2, fac)
integer, parameter, public r_grid
character(len=256) tunits
subroutine, public gw_1d(km, p0, ak, bk, ptop, ztop, pt1)
The module 'fv_sg' performs FV sub-grid mixing.
subroutine, public bunkers_vector(is, ie, js, je, ng, km, zvir, sphum, uc, vc, ua, va, delz, q, hydrostatic, pt, peln, phis, grav)
subroutine, public fv_diag_init_gn(Atm)
pure real function, public virqd(q)
subroutine, public prt_mxm(qname, q, is, ie, js, je, n_g, km, fac, area, domain)
subroutine, public max_vorticity_hy1(is, ie, js, je, km, vort, maxvorthy1)
pure real function, public virq(q)
subroutine interpolate_z(is, ie, js, je, km, zl, hght, a3, a2)
The module 'a2b_edge' performs FV-consistent interpolation of pressure to corners.
subroutine, public z_sum(is, ie, js, je, km, n_g, delp, q, sum2)
subroutine, public fv_diag_init(Atm, axes, Time, npx, npy, npz, p_ref)
subroutine cs_interpolator(is, ie, js, je, km, qin, zout, wz, qout, qmin)
subroutine cs3_interpolator(is, ie, js, je, km, qin, kd, pout, wz, pe, id, qout, iv)
subroutine, public ppme(p, qe, delp, im, km)
subroutine init_mq(phis, gridstruct, npx, npy, is, ie, js, je, ng)
The module 'fv_mapz' contains the vertical mapping routines .
subroutine, public qsmith(im, km, k1, t, p, q, qs, dqdt)
logical, public prt_minmax
The module 'fv_arrays' contains the 'fv_atmos_type' and associated datatypes.
subroutine, public get_height_field(is, ie, js, je, ng, km, hydrostatic, delz, wz, pt, q, peln, zvir)
The module 'fv_eta' contains routine to set up the reference (Eulerian) pressure coordinate.
subroutine, public fv_diag(Atm, zvir, Time, print_freq)
subroutine updraft_helicity(is, ie, js, je, ng, km, zvir, sphum, uh, w, vort, delz, q, hydrostatic, pt, peln, phis, grav, z_bot, z_top)
subroutine pv_entropy(is, ie, js, je, ng, km, vort, f_d, pt, pkz, delp, grav)
The subroutine 'pv_entropy' computes potential vorticity.
type(time_type), public fv_time
logical module_is_initialized
real function getqvi(p, t)
real function getqvs(p, t)
integer, dimension(nplev) levs
subroutine, public range_check(qname, q, is, ie, js, je, n_g, km, pos, q_low, q_hi, bad_range)
subroutine, public dbzcalc(q, pt, delp, peln, delz, dbz, maxdbz, allmax, bd, npz, ncnst, hydrostatic, zvir, in0r, in0s, in0g, iliqskin)
The subroutine 'dbzcalc' computes equivalent reflectivity factor (in dBZ) at each model grid point...
@ The module 'fv_diagnostics' contains routines to compute diagnosic fields.
The module 'fv_grid_utils' contains routines for setting up and computing grid-related quantities...
character(len=3), public gn
subroutine, public prt_gb_nh_sh(qname, is, ie, js, je, a2, area, lat)
subroutine, public prt_maxmin(qname, q, is, ie, js, je, n_g, km, fac)
subroutine, public helicity_relative_caps(is, ie, js, je, ng, km, zvir, sphum, srh, uc, vc, ua, va, delz, q, hydrostatic, pt, peln, phis, grav, z_bot, z_top)
subroutine, public rh_calc(pfull, t, qv, rh, do_cmip)
subroutine, public max_vorticity(is, ie, js, je, ng, km, zvir, sphum, delz, q, hydrostatic, pt, peln, phis, grav, vort, maxvort, z_bot, z_top)
subroutine, public a2b_ord4(qin, qout, gridstruct, npx, npy, is, ie, js, je, ng, replace)
real function p_sum(is, ie, js, je, km, n_g, delp, area, domain)
type(fv_diag_type), pointer idiag
subroutine, public interpolate_vertical(is, ie, js, je, km, plev, peln, a3, a2)
real(kind=4), public e_flux
subroutine, public prt_mass(km, nq, is, ie, js, je, n_g, nwat, ps, delp, q, area, domain)
subroutine nh_total_energy(is, ie, js, je, isd, ied, jsd, jed, km, w, delz, pt, delp, q, hs, area, domain, sphum, liq_wat, rainwat, ice_wat, snowwat, graupel, nwat, ua, va, moist_phys, te)
The subroutine 'nh_total_energy computes vertically-integrated total energy per column.
subroutine, public max_vv(is, ie, js, je, npz, ng, up2, dn2, pe, w)
subroutine helicity_relative(is, ie, js, je, ng, km, zvir, sphum, srh, ua, va, delz, q, hydrostatic, pt, peln, phis, grav, z_bot, z_top)
pure real function, public vicvqd(q)
subroutine, public get_vorticity(isc, iec, jsc, jec, isd, ied, jsd, jed, npz, u, v, vort, dx, dy, rarea)