35 use fv_mp_nlm_mod,
only: mp_reduce_sum, mp_reduce_min, mp_reduce_max, is_master
57 character(len=3) ::
gn =
'' 83 integer,
parameter ::
nplev = 31
88 subroutine fv_diag_init(Atm, axes, Time, npx, npy, npz, p_ref)
90 integer,
intent(out) :: axes(4)
92 integer,
intent(in) :: npx, npy, npz
93 real,
intent(in):: p_ref
95 real,
allocatable :: grid_xt(:), grid_yt(:), grid_xe(:), grid_ye(:), grid_xn(:), grid_yn(:)
96 real,
allocatable :: grid_x(:), grid_y(:)
97 real :: vrange(2), vsrange(2), wrange(2), trange(2), slprange(2), rhrange(2)
98 real,
allocatable :: a3(:,:,:)
100 real :: hyam(npz), hybm(npz)
103 integer :: id_bk, id_pk, id_area, id_lon, id_lat, id_lont, id_latt, id_phalf, id_pfull
104 integer :: id_hyam, id_hybm
106 integer :: i, j, k, n, ntileme, id_xt, id_yt, id_x, id_y, id_xe, id_ye, id_xn, id_yn
107 integer :: isc, iec, jsc, jec
111 character(len=64) :: plev
112 character(len=64) :: field
120 idiag => atm(1)%idiag
144 vsrange = (/ -200., 200. /)
146 vrange = (/ -330., 330. /)
147 wrange = (/ -100., 100. /)
148 rhrange = (/ -10., 150. /)
150 trange = (/ 5., 350. /)
152 trange = (/ 100., 350. /)
154 slprange = (/800., 1200./)
157 if (atm(1)%grid_number == 1)
fv_time = time
159 allocate (
idiag%phalf(npz+1) )
163 allocate(grid_xt(npx-1), grid_yt(npy-1))
164 grid_xt = (/ (i, i=1,npx-1) /)
165 grid_yt = (/ (j, j=1,npy-1) /)
171 allocate(grid_x(npx), grid_y(npy))
172 grid_x = (/ (i, i=1,npx) /)
173 grid_y = (/ (j, j=1,npy) /)
176 isc = atm(n)%bd%isc; iec = atm(n)%bd%iec
177 jsc = atm(n)%bd%jsc; jec = atm(n)%bd%jec
180 call diag_grid_init(domain=atm(n)%domain, &
181 & glo_lon=
rad2deg*atm(n)%gridstruct%grid(isc:iec+1,jsc:jec+1,1), &
182 & glo_lat=
rad2deg*atm(n)%gridstruct%grid(isc:iec+1,jsc:jec+1,2), &
183 & aglo_lon=
rad2deg*atm(n)%gridstruct%agrid(isc-1:iec+1,jsc-1:jec+1,1), &
184 & aglo_lat=
rad2deg*atm(n)%gridstruct%agrid(isc-1:iec+1,jsc-1:jec+1,2))
186 ntileme =
size(atm(:))
187 if (ntileme > 1)
call mpp_error(fatal,
"fv_diag_init can only be called with one grid at a time.")
193 id_xt = diag_axis_init(
'grid_xt',grid_xt,
'degrees_E',
'x',
'T-cell longitude', &
194 set_name=trim(field),domain2=atm(n)%Domain, tile_count=n)
195 id_yt = diag_axis_init(
'grid_yt',grid_yt,
'degrees_N',
'y',
'T-cell latitude', &
196 set_name=trim(field), domain2=atm(n)%Domain, tile_count=n)
207 id_x = diag_axis_init(
'grid_x',grid_x,
'degrees_E',
'x',
'cell corner longitude', &
208 set_name=trim(field),domain2=atm(n)%Domain, tile_count=n)
209 id_y = diag_axis_init(
'grid_y',grid_y,
'degrees_N',
'y',
'cell corner latitude', &
210 set_name=trim(field), domain2=atm(n)%Domain, tile_count=n)
214 deallocate(grid_xt, grid_yt)
215 deallocate(grid_x, grid_y )
217 id_phalf = diag_axis_init(
'phalf',
idiag%phalf,
'mb',
'z', &
218 'ref half pressure level', direction=-1, set_name=
"dynamics")
219 id_pfull = diag_axis_init(
'pfull', pfull,
'mb',
'z', &
220 'ref full pressure level', direction=-1, set_name=
"dynamics", edges=id_phalf)
225 'vertical coordinate sigma value',
'none' )
228 'pressure part of the hybrid coordinate',
'pascal' )
231 'vertical coordinate A value',
'1E-5 Pa' )
234 'vertical coordinate B value',
'none' )
238 if ( id_bk > 0 ) used =
send_data( id_bk,atm(1)%bk, time )
239 if ( id_pk > 0 ) used =
send_data( id_pk,atm(1)%ak, time )
240 if ( id_hyam > 0 )
then 242 hyam(k) = 0.5 * ( atm(1)%ak(k) + atm(1)%ak(k+1) ) * 1.e-5
246 if ( id_hybm > 0 )
then 248 hybm(k) = 0.5 * ( atm(1)%bk(k) + atm(1)%bk(k+1) )
262 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/)
264 id_plev = diag_axis_init(
'plev',
levs(:)*1.0,
'mb',
'z', &
265 'actual pressure level', direction=-1, set_name=
"dynamics")
277 'longitude',
'degrees_E' )
279 'latitude',
'degrees_N' )
281 'longitude',
'degrees_E' )
283 'latitude',
'degrees_N' )
285 'cell area',
'm**2' )
288 'surface height',
'm' )
291 'Original Mean Terrain',
'm' )
294 'Hybrid_Z_surface',
'm' )
296 'Land/Water Mask',
'none' )
298 'Terrain Standard deviation',
'm' )
306 'initial surface pressure',
'Pa' )
308 'zonal wind',
'm/sec' )
310 'meridional wind',
'm/sec' )
312 'potential temperature perturbation',
'K' )
314 'initial surface pressure',
'Pa' )
318 master = (mpp_pe()==mpp_root_pe())
321 isc = atm(n)%bd%isc; iec = atm(n)%bd%iec
322 jsc = atm(n)%bd%jsc; jec = atm(n)%bd%jec
324 allocate (
idiag%zsurf(isc:iec,jsc:jec) )
328 idiag%zsurf(i,j) =
ginv * atm(n)%phis(i,j)
336 isc = atm(n)%bd%isc; iec = atm(n)%bd%iec
337 jsc = atm(n)%bd%jsc; jec = atm(n)%bd%jec
338 if (id_lon > 0) used =
send_data(id_lon,
rad2deg*atm(n)%gridstruct%grid(isc:iec+1,jsc:jec+1,1), time)
339 if (id_lat > 0) used =
send_data(id_lat,
rad2deg*atm(n)%gridstruct%grid(isc:iec+1,jsc:jec+1,2), time)
340 if (id_lont > 0) used =
send_data(id_lont,
rad2deg*atm(n)%gridstruct%agrid(isc:iec,jsc:jec,1), time)
341 if (id_latt > 0) used =
send_data(id_latt,
rad2deg*atm(n)%gridstruct%agrid(isc:iec,jsc:jec,2), time)
342 if (id_area > 0) used =
send_data(id_area, atm(n)%gridstruct%area(isc:iec,jsc:jec), time)
346 if ( atm(n)%flagstruct%fv_land )
then 352 if ( atm(n)%flagstruct%ncep_ic )
then 356 if ( atm(n)%flagstruct%hybrid_z .and.
idiag%id_ze > 0 ) &
357 used =
send_data(
idiag%id_ze, atm(n)%ze0(isc:iec,jsc:jec,1:npz), time)
365 if(
idiag%ic_ppt> 0)
then 367 allocate (
idiag%pt1(npz) )
368 allocate ( a3(isc:iec,jsc:jec,npz) )
370 call gw_1d(npz, 1000.e2, atm(n)%ak, atm(n)%ak, atm(n)%ak(1), 10.e3,
idiag%pt1)
377 a3(i,j,k) = (atm(n)%pt(i,j,k)/atm(n)%pkz(i,j,k) -
idiag%pt1(k)) *
pk0 383 deallocate (
idiag%pt1 )
391 allocate(
idiag%id_tracer(ncnst))
392 allocate(
idiag%id_tracer_dmmr(ncnst))
393 allocate(
idiag%id_tracer_dvmr(ncnst))
394 allocate(
idiag%w_mr(ncnst))
395 idiag%id_tracer(:) = 0
396 idiag%id_tracer_dmmr(:) = 0
397 idiag%id_tracer_dvmr(:) = 0
419 'surface height',
'm')
442 write(plev,
'(I5)')
levs(i)
477 if ( all(
idiag%id_h(minloc(abs(
levs-10)))>0) .or. all(
idiag%id_h(minloc(abs(
levs-50)))>0) .or. &
478 all(
idiag%id_h(minloc(abs(
levs-100)))>0) .or. all(
idiag%id_h(minloc(abs(
levs-200)))>0) .or. &
479 all(
idiag%id_h(minloc(abs(
levs-250)))>0) .or. all(
idiag%id_h(minloc(abs(
levs-300)))>0) .or. &
480 all(
idiag%id_h(minloc(abs(
levs-500)))>0) .or. all(
idiag%id_h(minloc(abs(
levs-700)))>0) .or. &
481 all(
idiag%id_h(minloc(abs(
levs-850)))>0) .or. all(
idiag%id_h(minloc(abs(
levs-1000)))>0) )
then 502 'masking pressure at lowest level',
'mb', &
538 if ( .not. atm(n)%flagstruct%hydrostatic ) &
564 if ( .not. atm(n)%flagstruct%hydrostatic ) &
567 if( atm(n)%flagstruct%hydrostatic )
then 627 'Skin temperature',
'K' )
629 'lowest layer temperature',
'K' )
631 'cloud_top temperature',
'K' )
633 'cloud_top pressure',
'hPa' )
649 if ( .not. atm(n)%flagstruct%hydrostatic ) &
672 if( .not. atm(n)%flagstruct%hydrostatic ) &
681 if( .not. atm(n)%flagstruct%hydrostatic ) &
689 if( .not. atm(n)%flagstruct%hydrostatic )
then 712 if( .not. atm(n)%flagstruct%hydrostatic )
then 719 if( .not. atm(n)%flagstruct%hydrostatic ) &
780 if (
idiag%id_tracer(i) > 0)
then 782 write(unit,
'(a,a,a,a)') &
783 &
'Diagnostics available for tracer ',trim(
tname), &
784 ' in module ', trim(field)
792 if (trim(
tname).eq.
'co2')
then 795 axes(1:3), time, trim(
tlongname)//
" (dry mmr)", &
798 axes(1:3), time, trim(
tlongname)//
" (dry vmr)", &
802 if (
idiag%id_tracer_dmmr(i) > 0)
then 803 write(unit,
'(a,a,a,a)')
'Diagnostics available for '//trim(
tname)//
' dry mmr ', &
804 trim(
tname)//
'_dmmr',
' in module ', trim(field)
806 if (
idiag%id_tracer_dvmr(i) > 0)
then 807 write(unit,
'(a,a,a,a)')
'Diagnostics available for '//trim(
tname)//
' dry vmr ', &
808 trim(
tname)//
'_dvmr',
' in module ', trim(field)
816 if ( atm(1)%flagstruct%consv_am .or.
idiag%id_mq > 0 .or.
idiag%id_amdt > 0 )
then 817 allocate (
idiag%zxg(isc:iec,jsc:jec) )
819 call init_mq(atm(n)%phis, atm(n)%gridstruct, &
820 npx, npy, isc, iec, jsc, jec, atm(n)%ng)
827 call prt_mass(npz, atm(n)%ncnst, isc, iec, jsc, jec, atm(n)%ng,
max(1,atm(n)%flagstruct%nwat), &
828 atm(n)%ps, atm(n)%delp, atm(n)%q, atm(n)%gridstruct%area_64, atm(n)%domain)
830 call prt_mass(npz, atm(n)%ncnst, isc, iec, jsc, jec, atm(n)%ng, atm(n)%flagstruct%nwat, &
831 atm(n)%ps, atm(n)%delp, atm(n)%q, atm(n)%gridstruct%area_64, atm(n)%domain)
841 subroutine init_mq(phis, gridstruct, npx, npy, is, ie, js, je, ng)
842 integer,
intent(in):: npx, npy, is, ie, js, je, ng
843 real,
intent(in):: phis(is-ng:ie+ng, js-ng:je+ng)
844 type(fv_grid_type),
intent(IN),
target :: gridstruct
847 real zs(is-ng:ie+ng, js-ng:je+ng)
848 real zb(is-ng:ie+ng, js-ng:je+ng)
849 real pdx(3,is:ie,js:je+1)
850 real pdy(3,is:ie+1,js:je)
853 real,
pointer :: rarea(:,:)
854 real,
pointer,
dimension(:,:) :: dx, dy
855 real(kind=R_GRID),
pointer,
dimension(:,:,:) :: en1, en2, vlon, vlat
856 real,
pointer,
dimension(:,:,:) :: agrid
858 rarea => gridstruct%rarea
861 en1 => gridstruct%en1
862 en2 => gridstruct%en2
863 agrid => gridstruct%agrid
864 vlon => gridstruct%vlon
865 vlat => gridstruct%vlat
871 zs(i,j) = phis(i,j) /
grav 877 call a2b_ord4(zs, zb, gridstruct, npx, npy, is, ie, js, je, ng)
882 pdx(n,i,j) = 0.5*(zb(i,j)+zb(i+1,j))*dx(i,j)*en1(n,i,j)
889 pdy(n,i,j) = 0.5*(zb(i,j)+zb(i,j+1))*dy(i,j)*en2(n,i,j)
897 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)) &
898 + vlon(i,j,2)*(pdx(2,i,j+1)-pdx(2,i,j)-pdy(2,i,j)+pdy(2,i+1,j)) &
899 + vlon(i,j,3)*(pdx(3,i,j+1)-pdx(3,i,j)-pdy(3,i,j)+pdy(3,i+1,j))
909 subroutine fv_diag(Atm, zvir, Time, print_freq)
913 real,
intent(in):: zvir
914 integer,
intent(in):: print_freq
916 integer :: isc, iec, jsc, jec, n, ntileme
917 integer :: isd, ied, jsd, jed, npz, itrac
918 integer :: ngc, nwater
920 real,
allocatable :: a2(:,:),a3(:,:,:), wk(:,:,:), wz(:,:,:), ucoor(:,:,:), vcoor(:,:,:)
921 real,
allocatable :: slp(:,:), depress(:,:), ws_max(:,:), tc_count(:,:)
922 real,
allocatable :: u2(:,:), v2(:,:), x850(:,:), var1(:,:), var2(:,:), var3(:,:)
923 real,
allocatable :: dmmr(:,:,:), dvmr(:,:,:)
927 real :: tot_mq, tmp, sar, slon, slat
928 real :: t_gb, t_nh, t_sh, t_eq, area_gb, area_nh, area_sh, area_eq
929 logical :: do_cs_intp
932 integer i,j,k, yr, mon, dd, hr, mn, days, seconds, nq, theta_d
933 character(len=128) ::
tname 934 real,
parameter:: ws_0 = 16.
935 real,
parameter:: ws_1 = 20.
936 real,
parameter:: vort_c0= 2.2e-5
937 logical,
allocatable :: storm(:,:), cat_crt(:,:)
938 real :: tmp2, pvsum, e2, einf, qm, mm, maxdbz, allmax, rgrav
952 pout(i) =
levs(i) * 1.e2
953 plevs(i) = log( pout(i) )
956 ntileme =
size(atm(:))
958 isc = atm(n)%bd%isc; iec = atm(n)%bd%iec
959 jsc = atm(n)%bd%jsc; jec = atm(n)%bd%jec
963 nq =
size (atm(n)%q,4)
965 isd = atm(n)%bd%isd; ied = atm(n)%bd%ied
966 jsd = atm(n)%bd%jsd; jed = atm(n)%bd%jed
968 if(
idiag%id_c15>0 )
then 969 allocate ( storm(isc:iec,jsc:jec) )
970 allocate ( depress(isc:iec,jsc:jec) )
971 allocate ( ws_max(isc:iec,jsc:jec) )
972 allocate ( cat_crt(isc:iec,jsc:jec) )
973 allocate (tc_count(isc:iec,jsc:jec) )
976 if(
idiag%id_x850>0 )
then 977 allocate ( x850(isc:iec,jsc:jec) )
985 if( print_freq == 0 )
then 987 elseif( print_freq < 0 )
then 991 prt_minmax = mod(hr, print_freq) == 0 .and. mn==0 .and. seconds==0
995 if( print_freq == 0 )
then 997 elseif( print_freq < 0 )
then 1001 prt_minmax = mod(seconds, 3600*print_freq) == 0
1007 if(
master)
write(*,*) yr, mon, dd, hr, mn, seconds
1009 if(
master)
write(*,*) days, seconds
1013 allocate ( a2(isc:iec,jsc:jec) )
1017 call prt_mxm(
'ZS',
idiag%zsurf, isc, iec, jsc, jec, 0, 1, 1.0, atm(n)%gridstruct%area_64, atm(n)%domain)
1018 call prt_maxmin(
'PS', atm(n)%ps, isc, iec, jsc, jec, ngc, 1, 0.01)
1021 allocate(var2(isc:iec,jsc:jec))
1025 slat =
rad2deg*atm(n)%gridstruct%agrid(i,j,2)
1026 if (slat >= 0.)
then 1027 a2(i,j) = atm(n)%ps(i,j)
1031 var2(i,j) = atm(n)%ps(i,j)
1035 call prt_maxmin(
'NH PS', a2, isc, iec, jsc, jec, 0, 1, 0.01)
1036 call prt_maxmin(
'SH PS', var2, isc, iec, jsc, jec, 0, 1, 0.01)
1042 call prt_mass(npz, nq, isc, iec, jsc, jec, ngc,
max(1,atm(n)%flagstruct%nwat), &
1043 atm(n)%ps, atm(n)%delp, atm(n)%q, atm(n)%gridstruct%area_64, atm(n)%domain)
1045 call prt_mass(npz, nq, isc, iec, jsc, jec, ngc, atm(n)%flagstruct%nwat, &
1046 atm(n)%ps, atm(n)%delp, atm(n)%q, atm(n)%gridstruct%area_64, atm(n)%domain)
1051 if (atm(n)%flagstruct%consv_te > 1.e-5)
then 1056 write(*,*)
'ENG Deficit (W/m**2)', trim(
gn),
'=',
e_flux 1061 if ( .not. atm(n)%flagstruct%hydrostatic ) &
1063 atm(n)%w, atm(n)%delz, atm(n)%pt, atm(n)%delp, &
1064 atm(n)%q, atm(n)%phis, atm(n)%gridstruct%area, atm(n)%domain, &
1066 atm(n)%ua, atm(n)%va, atm(n)%flagstruct%moist_phys, a2)
1069 call prt_maxmin(
'UA_top', atm(n)%ua(isc:iec,jsc:jec,1), &
1070 isc, iec, jsc, jec, 0, 1, 1.)
1071 call prt_maxmin(
'UA', atm(n)%ua, isc, iec, jsc, jec, ngc, npz, 1.)
1072 call prt_maxmin(
'VA', atm(n)%va, isc, iec, jsc, jec, ngc, npz, 1.)
1074 if ( .not. atm(n)%flagstruct%hydrostatic )
then 1075 call prt_maxmin(
'W ', atm(n)%w , isc, iec, jsc, jec, ngc, npz, 1.)
1076 call prt_maxmin(
'Bottom w', atm(n)%w(isc:iec,jsc:jec,npz), isc, iec, jsc, jec, 0, 1, 1.)
1079 a2(i,j) = -atm(n)%w(i,j,npz)/atm(n)%delz(i,j,npz)
1082 call prt_maxmin(
'Bottom: w/dz', a2, isc, iec, jsc, jec, 0, 1, 1.)
1084 if ( atm(n)%flagstruct%hybrid_z )
call prt_maxmin(
'Hybrid_ZTOP (km)', atm(n)%ze0(isc:iec,jsc:jec,1), &
1085 isc, iec, jsc, jec, 0, 1, 1.e-3)
1086 call prt_maxmin(
'DZ (m)', atm(n)%delz(isc:iec,jsc:jec,1:npz), &
1087 isc, iec, jsc, jec, 0, npz, 1.)
1088 call prt_maxmin(
'Bottom DZ (m)', atm(n)%delz(isc:iec,jsc:jec,npz), &
1089 isc, iec, jsc, jec, 0, 1, 1.)
1095 call prt_maxmin(
'TA', atm(n)%pt, isc, iec, jsc, jec, ngc, npz, 1.)
1098 call prt_maxmin(
'OM', atm(n)%omga, isc, iec, jsc, jec, ngc, npz, 1.)
1101 elseif ( atm(n)%flagstruct%range_warn )
then 1102 call range_check(
'DELP', atm(n)%delp, isc, iec, jsc, jec, ngc, npz, atm(n)%gridstruct%agrid, &
1103 0.01*
ptop, 200.e2, bad_range)
1104 call range_check(
'UA', atm(n)%ua, isc, iec, jsc, jec, ngc, npz, atm(n)%gridstruct%agrid, &
1105 -250., 250., bad_range)
1106 call range_check(
'VA', atm(n)%va, isc, iec, jsc, jec, ngc, npz, atm(n)%gridstruct%agrid, &
1107 -250., 250., bad_range)
1109 call range_check(
'TA', atm(n)%pt, isc, iec, jsc, jec, ngc, npz, atm(n)%gridstruct%agrid, &
1111 130., 350., bad_range)
1113 150., 350., bad_range)
1119 allocate ( u2(isc:iec,jsc:jec) )
1120 allocate ( v2(isc:iec,jsc:jec) )
1121 allocate ( wk(isc:iec,jsc:jec,npz) )
1122 if ( any(
idiag%id_tracer_dmmr > 0) .or. any(
idiag%id_tracer_dvmr > 0) )
then 1123 allocate ( dmmr(isc:iec,jsc:jec,1:npz) )
1124 allocate ( dvmr(isc:iec,jsc:jec,1:npz) )
1136 call wind_max(isc, iec, jsc, jec ,isd, ied, jsd, jed, atm(n)%ua(isc:iec,jsc:jec,npz), &
1137 atm(n)%va(isc:iec,jsc:jec,npz), ws_max, atm(n)%domain)
1140 if( abs(atm(n)%gridstruct%agrid(i,j,2)*
rad2deg)<45.0 .and. &
1141 atm(n)%phis(i,j)*
ginv<500.0 .and. ws_max(i,j)>ws_0 )
then 1144 storm(i,j) = .false.
1150 if (
idiag%id_vort200>0 .or.
idiag%id_vort500>0 .or.
idiag%id_vort850>0 .or.
idiag%id_vorts>0 &
1153 call get_vorticity(isc, iec, jsc, jec, isd, ied, jsd, jed, npz, atm(n)%u, atm(n)%v, wk, &
1154 atm(n)%gridstruct%dx, atm(n)%gridstruct%dy, atm(n)%gridstruct%rarea)
1159 if(
idiag%id_c15>0)
then 1163 storm(i,j) = (atm(n)%gridstruct%agrid(i,j,2)>0. .and. wk(i,j,npz)> vort_c0) .or. &
1164 (atm(n)%gridstruct%agrid(i,j,2)<0. .and. wk(i,j,npz)<-vort_c0)
1169 if(
idiag%id_vort200>0 )
then 1171 200.e2, atm(n)%peln, wk, a2)
1174 if(
idiag%id_vort500>0 )
then 1176 500.e2, atm(n)%peln, wk, a2)
1182 850.e2, atm(n)%peln, wk, a2)
1184 if (
idiag%id_x850>0 ) x850(:,:) = a2(:,:)
1186 if(
idiag%id_c15>0)
then 1190 storm(i,j) = (atm(n)%gridstruct%agrid(i,j,2)>0. .and. a2(i,j)> vort_c0) .or. &
1191 (atm(n)%gridstruct%agrid(i,j,2)<0. .and. a2(i,j)<-vort_c0)
1198 if( .not. atm(n)%flagstruct%hydrostatic )
then 1200 if (
idiag%id_uh03 > 0 )
then 1202 atm(n)%w, wk, atm(n)%delz, atm(n)%q, &
1203 atm(n)%flagstruct%hydrostatic, atm(n)%pt, atm(n)%peln, atm(n)%phis,
grav, 0., 3.e3)
1208 tmp =
rad2deg * atm(n)%gridstruct%agrid(i,j,1)
1209 tmp2 =
rad2deg * atm(n)%gridstruct%agrid(i,j,2)
1210 if ( tmp2<25. .or. tmp2>50. &
1211 .or. tmp<235. .or. tmp>300. )
then 1216 call prt_maxmin(
'UH over CONUS', a2, isc, iec, jsc, jec, 0, 1, 1.)
1219 if (
idiag%id_uh25 > 0 )
then 1221 atm(n)%w, wk, atm(n)%delz, atm(n)%q, &
1222 atm(n)%flagstruct%hydrostatic, atm(n)%pt, atm(n)%peln, atm(n)%phis,
grav, 2.e3, 5.e3)
1228 if (
idiag%id_pv > 0 )
then 1230 call pv_entropy(isc, iec, jsc, jec, ngc, npz, wk, &
1231 atm(n)%gridstruct%f0, atm(n)%pt, atm(n)%pkz, atm(n)%delp,
grav)
1240 if (
idiag%id_srh > 0 )
then 1242 atm(n)%ua, atm(n)%va, atm(n)%delz, atm(n)%q, &
1243 atm(n)%flagstruct%hydrostatic, atm(n)%pt, atm(n)%peln, atm(n)%phis,
grav, 0., 3.e3)
1248 tmp =
rad2deg * atm(n)%gridstruct%agrid(i,j,1)
1249 tmp2 =
rad2deg * atm(n)%gridstruct%agrid(i,j,2)
1250 if ( tmp2<25. .or. tmp2>50. &
1251 .or. tmp<235. .or. tmp>300. )
then 1256 call prt_maxmin(
'SRH over CONUS', a2, isc, iec, jsc, jec, 0, 1, 1.)
1260 if (
idiag%id_srh25 > 0 )
then 1262 atm(n)%ua, atm(n)%va, atm(n)%delz, atm(n)%q, &
1263 atm(n)%flagstruct%hydrostatic, atm(n)%pt, atm(n)%peln, atm(n)%phis,
grav, 2.e3, 5.e3)
1266 if (
idiag%id_srh01 > 0 )
then 1268 atm(n)%ua, atm(n)%va, atm(n)%delz, atm(n)%q, &
1269 atm(n)%flagstruct%hydrostatic, atm(n)%pt, atm(n)%peln, atm(n)%phis,
grav, 0.e3, 1.e3)
1275 if (
idiag%id_rh > 0 )
then 1280 a2(i,j) = atm(n)%delp(i,j,k)/(atm(n)%peln(i,k+1,j)-atm(n)%peln(i,k,j))
1283 call qsmith(iec-isc+1, jec-jsc+1, 1, atm(n)%pt(isc:iec,jsc:jec,k), &
1284 a2, atm(n)%q(isc:iec,jsc:jec,k,
sphum), wk(isc,jsc,k))
1287 wk(i,j,k) = 100.*atm(n)%q(i,j,k,
sphum)/wk(i,j,k)
1293 call prt_maxmin(
'RH_sf (%)', wk(isc:iec,jsc:jec,npz), isc, iec, jsc, jec, 0, 1, 1.)
1294 call prt_maxmin(
'RH_3D (%)', wk, isc, iec, jsc, jec, 0, npz, 1.)
1301 idiag%id_rh925>0 .or.
idiag%id_rh1000>0)
then 1306 a2(i,j) = atm(n)%delp(i,j,k)/(atm(n)%peln(i,k+1,j)-atm(n)%peln(i,k,j))
1309 call rh_calc (a2, atm(n)%pt(isc:iec,jsc:jec,k), &
1310 atm(n)%q(isc:iec,jsc:jec,k,
sphum), wk(isc:iec,jsc:jec,k))
1312 if (
idiag%id_rh50>0)
then 1313 call interpolate_vertical(isc, iec, jsc, jec, npz, 50.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1316 if (
idiag%id_rh100>0)
then 1317 call interpolate_vertical(isc, iec, jsc, jec, npz, 100.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1320 if (
idiag%id_rh200>0)
then 1321 call interpolate_vertical(isc, iec, jsc, jec, npz, 200.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1324 if (
idiag%id_rh250>0)
then 1325 call interpolate_vertical(isc, iec, jsc, jec, npz, 250.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1328 if (
idiag%id_rh300>0)
then 1329 call interpolate_vertical(isc, iec, jsc, jec, npz, 300.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1332 if (
idiag%id_rh500>0)
then 1333 call interpolate_vertical(isc, iec, jsc, jec, npz, 500.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1336 if (
idiag%id_rh700>0)
then 1337 call interpolate_vertical(isc, iec, jsc, jec, npz, 700.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1340 if (
idiag%id_rh850>0)
then 1341 call interpolate_vertical(isc, iec, jsc, jec, npz, 850.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1344 if (
idiag%id_rh925>0)
then 1345 call interpolate_vertical(isc, iec, jsc, jec, npz, 925.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1348 if (
idiag%id_rh1000>0)
then 1349 call interpolate_vertical(isc, iec, jsc, jec, npz, 1000.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1355 if (
idiag%id_rh10_cmip>0 .or.
idiag%id_rh50_cmip>0 .or.
idiag%id_rh100_cmip>0 .or. &
1356 idiag%id_rh250_cmip>0 .or.
idiag%id_rh300_cmip>0 .or.
idiag%id_rh500_cmip>0 .or. &
1357 idiag%id_rh700_cmip>0 .or.
idiag%id_rh850_cmip>0 .or.
idiag%id_rh925_cmip>0 .or. &
1358 idiag%id_rh1000_cmip>0)
then 1363 a2(i,j) = atm(n)%delp(i,j,k)/(atm(n)%peln(i,k+1,j)-atm(n)%peln(i,k,j))
1366 call rh_calc (a2, atm(n)%pt(isc:iec,jsc:jec,k), &
1367 atm(n)%q(isc:iec,jsc:jec,k,
sphum), wk(isc:iec,jsc:jec,k), do_cmip=.true.)
1369 if (
idiag%id_rh10_cmip>0)
then 1370 call interpolate_vertical(isc, iec, jsc, jec, npz, 10.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1373 if (
idiag%id_rh50_cmip>0)
then 1374 call interpolate_vertical(isc, iec, jsc, jec, npz, 50.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1377 if (
idiag%id_rh100_cmip>0)
then 1378 call interpolate_vertical(isc, iec, jsc, jec, npz, 100.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1381 if (
idiag%id_rh250_cmip>0)
then 1382 call interpolate_vertical(isc, iec, jsc, jec, npz, 250.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1385 if (
idiag%id_rh300_cmip>0)
then 1386 call interpolate_vertical(isc, iec, jsc, jec, npz, 300.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1389 if (
idiag%id_rh500_cmip>0)
then 1390 call interpolate_vertical(isc, iec, jsc, jec, npz, 500.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1393 if (
idiag%id_rh700_cmip>0)
then 1394 call interpolate_vertical(isc, iec, jsc, jec, npz, 700.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1397 if (
idiag%id_rh850_cmip>0)
then 1398 call interpolate_vertical(isc, iec, jsc, jec, npz, 850.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1401 if (
idiag%id_rh925_cmip>0)
then 1402 call interpolate_vertical(isc, iec, jsc, jec, npz, 925.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1405 if (
idiag%id_rh1000_cmip>0)
then 1406 call interpolate_vertical(isc, iec, jsc, jec, npz, 1000.e2, atm(n)%peln, wk(isc:iec,jsc:jec,:), a2)
1414 if ( storm(i,j) .and. ws_max(i,j)>ws_1 )
then 1415 cat_crt(i,j) = .true.
1417 cat_crt(i,j) = .false.
1427 allocate ( wz(isc:iec,jsc:jec,npz+1) )
1428 call get_height_field(isc, iec, jsc, jec, ngc, npz, atm(n)%flagstruct%hydrostatic, atm(n)%delz, &
1429 wz, atm(n)%pt, atm(n)%q, atm(n)%peln, zvir)
1431 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)
1434 if(
idiag%id_slp > 0)
then 1436 allocate ( slp(isc:iec,jsc:jec) )
1438 atm(n)%pt(:,:,npz), atm(n)%peln, slp, 0.01)
1441 call prt_maxmin(
'SLP', slp, isc, iec, jsc, jec, 0, 1, 1.)
1446 slon =
rad2deg*atm(n)%gridstruct%agrid(i,j,1)
1447 slat =
rad2deg*atm(n)%gridstruct%agrid(i,j,2)
1448 if ( slat>15. .and. slat<40. .and. slon>270. .and. slon<290. )
then 1453 call prt_maxmin(
'ATL SLP', a2, isc, iec, jsc, jec, 0, 1, 1.)
1460 allocate( a3(isc:iec,jsc:jec,
nplev) )
1462 idg(:) =
idiag%id_h(:)
1464 if (
idiag%id_tm>0 )
then 1465 idg(minloc(abs(
levs-300))) = 1
1466 idg(minloc(abs(
levs-500))) = 1
1468 idg(minloc(abs(
levs-300))) =
idiag%id_h(minloc(abs(
levs-300)))
1469 idg(minloc(abs(
levs-500))) =
idiag%id_h(minloc(abs(
levs-500)))
1472 call get_height_given_pressure(isc, iec, jsc, jec, ngc, npz, wz,
nplev, idg, plevs, atm(n)%peln, a3)
1474 idg(minloc(abs(
levs-300))) =
idiag%id_h(minloc(abs(
levs-300)))
1475 idg(minloc(abs(
levs-500))) =
idiag%id_h(minloc(abs(
levs-500)))
1478 if (idg(i)>0) used=
send_data(idg(i), a3(isc:iec,jsc:jec,i), time)
1481 if (
idiag%id_h_plev>0)
then 1483 call get_height_given_pressure(isc, iec, jsc, jec, ngc, npz, wz,
nplev, id1, plevs, atm(n)%peln, a3)
1489 if(all(
idiag%id_h(minloc(abs(
levs-100)))>0)) &
1490 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)
1492 if(all(
idiag%id_h(minloc(abs(
levs-500)))>0))
then 1494 if (.not. atm(n)%neststruct%nested)
then 1495 t_eq = 0. ; t_nh = 0.; t_sh = 0.; t_gb = 0.
1496 area_eq = 0.; area_nh = 0.; area_sh = 0.; area_gb = 0.
1499 slat = atm(n)%gridstruct%agrid(i,j,2)*
rad2deg 1500 area_gb = area_gb + atm(n)%gridstruct%area(i,j)
1501 t_gb = t_gb + a3(i,j,19)*atm(n)%gridstruct%area(i,j)
1502 if( (slat>-20. .and. slat<20.) )
then 1504 area_eq = area_eq + atm(n)%gridstruct%area(i,j)
1505 t_eq = t_eq + a3(i,j,19)*atm(n)%gridstruct%area(i,j)
1506 elseif( slat>=20. .and. slat<80. )
then 1508 area_nh = area_nh + atm(n)%gridstruct%area(i,j)
1509 t_nh = t_nh + a3(i,j,19)*atm(n)%gridstruct%area(i,j)
1510 elseif( slat<=-20. .and. slat>-80. )
then 1512 area_sh = area_sh + atm(n)%gridstruct%area(i,j)
1513 t_sh = t_sh + a3(i,j,19)*atm(n)%gridstruct%area(i,j)
1517 call mp_reduce_sum(area_gb)
1518 call mp_reduce_sum( t_gb)
1519 call mp_reduce_sum(area_nh)
1520 call mp_reduce_sum( t_nh)
1521 call mp_reduce_sum(area_sh)
1522 call mp_reduce_sum( t_sh)
1523 call mp_reduce_sum(area_eq)
1524 call mp_reduce_sum( t_eq)
1525 if (
master)
write(*,*)
'Z500 GB_NH_SH_EQ=', t_gb/area_gb, t_nh/area_nh, t_sh/area_sh, t_eq/area_eq
1532 if(
idiag%id_tm>0 )
then 1535 a2(i,j) =
grav*(a3(i,j,15)-a3(i,j,19))/(
rdgas*(plevs(19)-plevs(15)))
1545 if ( storm(i,j) )
then 1546 if( a2(i,j)<254.0 .or. atm(n)%pt(i,j,npz)<281.0 )
Then 1547 storm(i,j) = .false.
1548 cat_crt(i,j) = .false.
1556 if ( storm(i,j) .and. slp(i,j)<1000.0 )
then 1557 depress(i,j) = 1000. - slp(i,j)
1570 slon =
rad2deg*atm(n)%gridstruct%agrid(i,j,1)
1571 slat =
rad2deg*atm(n)%gridstruct%agrid(i,j,2)
1573 if ( slat>0. .and. slat<40. .and. slon>110. .and. slon<180. )
then 1574 depress(i,j) = -depress(i,j)
1578 call prt_maxmin(
'Depress', depress, isc, iec, jsc, jec, 0, 1, 1.)
1581 if ( atm(n)%gridstruct%agrid(i,j,2)<0.)
then 1587 call prt_maxmin(
'NH Deps', depress, isc, iec, jsc, jec, 0, 1, 1.)
1592 tmp =
rad2deg * atm(n)%gridstruct%agrid(i,j,1)
1593 if ( tmp<280. )
then 1598 call prt_maxmin(
'ATL Deps', depress, isc, iec, jsc, jec, 0, 1, 1.)
1603 if(
idiag%id_c25>0)
then 1606 if ( cat_crt(i,j) .and. slp(i,j)<980.0 )
then 1607 depress(i,j) = 980. - slp(i,j)
1620 if(
idiag%id_c35>0)
then 1623 if ( cat_crt(i,j) .and. slp(i,j)<964.0 )
then 1624 depress(i,j) = 964. - slp(i,j)
1637 if(
idiag%id_c45>0)
then 1640 if ( cat_crt(i,j) .and. slp(i,j)<944.0 )
then 1641 depress(i,j) = 944. - slp(i,j)
1653 if (
idiag%id_c15>0)
then 1658 deallocate(tc_count)
1661 if(
idiag%id_slp>0 )
deallocate( slp )
1670 idg(:) =
idiag%id_t(:)
1672 do_cs_intp = .false.
1674 if ( idg(i)>0 )
then 1680 if ( do_cs_intp )
then 1681 if(.not.
allocated (a3) )
allocate( a3(isc:iec,jsc:jec,
nplev) )
1683 plevs, wz, atm(n)%peln, idg, a3, 1)
1685 if (idg(i)>0) used=
send_data(idg(i), a3(isc:iec,jsc:jec,i), time)
1688 call prt_mxm(
'T100:', a3(isc:iec,jsc:jec,11), isc, iec, jsc, jec, 0, 1, 1., &
1689 atm(n)%gridstruct%area_64, atm(n)%domain)
1690 if (.not. atm(n)%neststruct%nested)
then 1696 slat = atm(n)%gridstruct%agrid(i,j,2)*
rad2deg 1697 if( (slat>-10.0 .and. slat<10.) )
then 1698 sar = sar + atm(n)%gridstruct%area(i,j)
1699 tmp = tmp + a3(i,j,11)*atm(n)%gridstruct%area(i,j)
1703 call mp_reduce_sum(sar)
1704 call mp_reduce_sum(tmp)
1705 if ( sar > 0. )
then 1706 if (
master)
write(*,*)
'Tropical [10s,10n] mean T100 =', tmp/sar
1708 if (
master)
write(*,*)
'Warning: problem computing tropical mean T100' 1713 call prt_mxm(
'T200:', a3(isc:iec,jsc:jec,13), isc, iec, jsc, jec, 0, 1, 1., &
1714 atm(n)%gridstruct%area_64, atm(n)%domain)
1715 if (.not. atm(n)%neststruct%nested)
then 1720 slat = atm(n)%gridstruct%agrid(i,j,2)*
rad2deg 1721 if( (slat>-20 .and. slat<20) )
then 1722 sar = sar + atm(n)%gridstruct%area(i,j)
1723 tmp = tmp + a3(i,j,13)*atm(n)%gridstruct%area(i,j)
1727 call mp_reduce_sum(sar)
1728 call mp_reduce_sum(tmp)
1729 if ( sar > 0. )
then 1730 if (
master)
write(*,*)
'Tropical [-20.,20.] mean T200 =', tmp/sar
1737 if (
idiag%id_t_plev>0)
then 1738 if(.not.
allocated (a3) )
allocate( a3(isc:iec,jsc:jec,
nplev) )
1741 plevs, wz, atm(n)%peln, id1, a3, 1)
1746 if(
idiag%id_mq > 0)
then 1751 a2(i,j) = -1.e-18 * atm(n)%ps(i,j)*
idiag%zxg(i,j)
1756 tot_mq =
g_sum( atm(n)%domain, a2, isc, iec, jsc, jec, ngc, atm(n)%gridstruct%area_64, 0)
1759 if(
master)
write(*,*)
'Total (global) mountain torque (Hadleys)=', tot_mq
1765 if (
idiag%id_tq>0 )
then 1766 nwater = atm(1)%flagstruct%nwat
1772 a2(i,j) = a2(i,j) + sum(atm(n)%q(i,j,k,1:nwater))*atm(n)%delp(i,j,k)
1781 if (cl > 0 .and. cl2 > 0)
then 1782 allocate(var2(isc:iec,jsc:jec))
1787 var2(i,j) = var2(i,j) + atm(n)%delp(i,j,k)
1792 if (
idiag%id_acl > 0 )
then 1799 a2(i,j) = a2(i,j) + atm(n)%q(i,j,k,cl)*atm(n)%delp(i,j,k)
1806 a2(i,j) = a2(i,j) / var2(i,j)
1811 if (
idiag%id_acl2 > 0 )
then 1818 a2(i,j) = a2(i,j) + atm(n)%q(i,j,k,cl2)*atm(n)%delp(i,j,k)
1825 a2(i,j) = a2(i,j) / var2(i,j)
1830 if (
idiag%id_acly > 0 )
then 1838 mm = (atm(n)%q(i,j,k,cl)+2.*atm(n)%q(i,j,k,cl2))*atm(n)%delp(i,j,k)
1839 a2(i,j) = a2(i,j) + mm
1840 qm = qm + mm*atm(n)%gridstruct%area_64(i,j)
1847 a2(i,j) = a2(i,j) / var2(i,j)
1853 e2 = e2 + ((a2(i,j) -
qcly0)**2)*atm(n)%gridstruct%area_64(i,j)
1854 einf =
max(einf, abs(a2(i,j) -
qcly0))
1857 if (
prt_minmax .and. .not. atm(n)%neststruct%nested)
then 1858 call mp_reduce_sum(qm)
1859 call mp_reduce_max(einf)
1860 call mp_reduce_sum(e2)
1862 write(*,*)
' TERMINATOR TEST: ' 1865 write(*,*)
' max err: ', einf/
qcly0 1874 if (
idiag%id_iw>0 )
then 1880 a2(i,j) = a2(i,j) + atm(n)%delp(i,j,k) * &
1890 a2(i,j) = a2(i,j) + atm(n)%delp(i,j,k) * &
1900 a2(i,j) = a2(i,j) + atm(n)%delp(i,j,k) * &
1908 if (
idiag%id_lw>0 )
then 1914 a2(i,j) = a2(i,j) + atm(n)%q(i,j,k,
liq_wat)*atm(n)%delp(i,j,k)
1923 a2(i,j) = a2(i,j) + atm(n)%q(i,j,k,
rainwat)*atm(n)%delp(i,j,k)
1932 if ( (
idiag%id_ctt>0 .or.
idiag%id_ctp>0).and. atm(n)%flagstruct%nwat==6)
then 1933 allocate ( var1(isc:iec,jsc:jec) )
1940 if( tmp>5.e-6 )
then 1941 a2(i,j) = atm(n)%pt(i,j,k)
1942 var1(i,j) = 0.01*atm(n)%pe(i,k,j)
1944 elseif( k==npz )
then 1945 a2(i,j) = atm(n)%pt(i,j,k)
1946 var1(i,j) = 0.01*atm(n)%pe(i,k+1,j)
1951 if (
idiag%id_ctt>0 )
then 1955 if (
idiag%id_ctp>0 )
then 1977 wk(i,j,k) = wk(i,j,k) + atm(n)%q(i,j,k,
liq_wat)*atm(n)%delp(i,j,k)
1987 wk(i,j,k) = wk(i,j,k) + atm(n)%q(i,j,k,
ice_wat)*atm(n)%delp(i,j,k)
1993 if (
idiag%id_qn200>0 )
then 1997 if (
idiag%id_qn500>0 )
then 2001 if (
idiag%id_qn850>0 )
then 2007 if (
idiag%id_qp>0 )
then 2021 wk(i,j,k) = wk(i,j,k) + atm(n)%q(i,j,k,
rainwat)*atm(n)%delp(i,j,k)
2031 wk(i,j,k) = wk(i,j,k) + atm(n)%q(i,j,k,
snowwat)*atm(n)%delp(i,j,k)
2041 wk(i,j,k) = wk(i,j,k) + atm(n)%q(i,j,k,
graupel)*atm(n)%delp(i,j,k)
2049 if(
idiag%id_us > 0 .and.
idiag%id_vs > 0)
then 2050 u2(:,:) = atm(n)%ua(isc:iec,jsc:jec,npz)
2051 v2(:,:) = atm(n)%va(isc:iec,jsc:jec,npz)
2054 a2(i,j) = sqrt(u2(i,j)**2 + v2(i,j)**2)
2062 if(
idiag%id_tb > 0)
then 2063 a2(:,:) = atm(n)%pt(isc:iec,jsc:jec,npz)
2066 call prt_mxm(
'T_bot:', a2, isc, iec, jsc, jec, 0, 1, 1., atm(n)%gridstruct%area_64, atm(n)%domain)
2072 if(
idiag%id_ke > 0)
then 2077 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)
2084 a2(i,j) = 0.5*a2(i,j)/(atm(n)%ps(i,j)-
ptop)
2089 tot_mq =
g_sum( atm(n)%domain, a2, isc, iec, jsc, jec, ngc, atm(n)%gridstruct%area_64, 1)
2090 if (
master)
write(*,*)
'SQRT(2.*KE; m/s)=', sqrt(2.*tot_mq)
2096 if(
idiag%id_delp > 0 .or. ((.not. atm(n)%flagstruct%hydrostatic) .and.
idiag%id_pfnh > 0))
then 2100 if ( atm(n)%flagstruct%nwat .eq. 2)
then 2101 wk(i,j,k) = atm(n)%delp(i,j,k)*(1.-atm(n)%q(i,j,k,
liq_wat))
2102 elseif ( atm(n)%flagstruct%nwat .eq. 6)
then 2103 wk(i,j,k) = atm(n)%delp(i,j,k)*(1.-atm(n)%q(i,j,k,
liq_wat)-&
2115 if( (.not. atm(n)%flagstruct%hydrostatic) .and.
idiag%id_pfnh > 0)
then 2119 wk(i,j,k) = -wk(i,j,k)/(atm(n)%delz(i,j,k)*
grav)*
rdgas* &
2120 atm(n)%pt(i,j,k)*(1.+zvir*atm(n)%q(i,j,k,
sphum))
2132 if( (.not. atm(n)%flagstruct%hydrostatic) .and.
idiag%id_pfnh > 0)
then 2136 wk(i,j,k) = -atm(n)%delp(i,j,k)/(atm(n)%delz(i,j,k)*
grav)*
rdgas* &
2137 atm(n)%pt(i,j,k)*(1.+zvir*atm(n)%q(i,j,k,
sphum))
2145 if((.not. atm(n)%flagstruct%hydrostatic) .and.
idiag%id_delz > 0)
then 2149 wk(i,j,k) = -atm(n)%delz(i,j,k)
2156 if( atm(n)%flagstruct%hydrostatic .and.
idiag%id_pfhy > 0 )
then 2160 wk(i,j,k) = 0.5 *(atm(n)%pe(i,k,j)+atm(n)%pe(i,k+1,j))
2170 if (
idiag%id_pmask>0)
then 2173 a2(i,j) = exp((atm(n)%peln(i,npz+1,j)+atm(n)%peln(i,npz+1,j))*0.5)*0.01
2182 if (
idiag%id_pmaskv2>0)
then 2185 a2(i,j) = exp((atm(n)%peln(i,npz,j)+atm(n)%peln(i,npz+1,j))*0.5)*0.01
2192 if (.not.
allocated(wz))
allocate ( wz(isc:iec,jsc:jec,npz+1) )
2193 if ( atm(n)%flagstruct%hydrostatic)
then 2203 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))
2216 wz(i,j,k) = wz(i,j,k+1) - atm(n)%delz(i,j,k)
2222 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)
2225 if (
idiag%id_rain5km>0 )
then 2227 call interpolate_z(isc, iec, jsc, jec, npz, 5.e3, wz, atm(n)%q(isc:iec,jsc:jec,:,
rainwat), a2)
2231 if (
idiag%id_w5km>0 )
then 2232 call interpolate_z(isc, iec, jsc, jec, npz, 5.e3, wz, atm(n)%w(isc:iec,jsc:jec,:), a2)
2236 if (
idiag%id_w2500m>0 )
then 2237 call interpolate_z(isc, iec, jsc, jec, npz, 2.5e3, wz, atm(n)%w(isc:iec,jsc:jec,:), a2)
2241 if (
idiag%id_w100m>0 )
then 2242 call interpolate_z(isc, iec, jsc, jec, npz, 100., wz, atm(n)%w(isc:iec,jsc:jec,:), a2)
2246 if (
idiag%id_u100m>0 )
then 2247 call interpolate_z(isc, iec, jsc, jec, npz, 100., wz, atm(n)%ua(isc:iec,jsc:jec,:), a2)
2251 if (
idiag%id_v100m>0 )
then 2252 call interpolate_z(isc, iec, jsc, jec, npz, 100., wz, atm(n)%va(isc:iec,jsc:jec,:), a2)
2259 if (.not.
allocated(a3))
allocate(a3(isc:iec,jsc:jec,npz))
2261 call dbzcalc(atm(n)%q, atm(n)%pt, atm(n)%delp, atm(n)%peln, atm(n)%delz, &
2262 a3, a2, allmax, atm(n)%bd, npz, atm(n)%ncnst, atm(n)%flagstruct%hydrostatic, &
2263 zvir, .false., .false., .false., .true. )
2265 if (
idiag%id_dbz > 0)
then 2268 if (
idiag%id_maxdbz > 0)
then 2271 if (
idiag%id_basedbz > 0)
then 2273 call interpolate_z(isc, iec, jsc, jec, npz, 1000., wz, a3, a2)
2276 if (
idiag%id_dbz4km > 0)
then 2278 call interpolate_z(isc, iec, jsc, jec, npz, 4000., wz, a3, a2)
2284 if (
master)
write(*,*)
'max reflectivity = ', allmax,
' dBZ' 2289 if(
allocated(wz) )
deallocate (wz)
2295 if(.not.
allocated(a3))
allocate( a3(isc:iec,jsc:jec,
nplev) )
2297 idg(:) =
idiag%id_u(:)
2299 do_cs_intp = .false.
2301 if ( idg(i)>0 )
then 2307 if ( do_cs_intp )
then 2309 pout, wz, atm(n)%pe(isc:iec,1:npz+1,jsc:jec), idg, a3, -1)
2312 if (idg(i)>0) used=
send_data(idg(i), a3(isc:iec,jsc:jec,i), time)
2316 if (
idiag%id_u_plev>0)
then 2319 pout, wz, atm(n)%pe(isc:iec,1:npz+1,jsc:jec), id1, a3, -1)
2324 idg(:) =
idiag%id_v(:)
2326 do_cs_intp = .false.
2328 if ( idg(i)>0 )
then 2334 if ( do_cs_intp )
then 2336 pout, wz, atm(n)%pe(isc:iec,1:npz+1,jsc:jec), idg, a3, -1)
2339 if (idg(i)>0) used=
send_data(idg(i), a3(isc:iec,jsc:jec,i), time)
2343 if (
idiag%id_v_plev>0)
then 2346 pout, wz, atm(n)%pe(isc:iec,1:npz+1,jsc:jec), id1, a3, -1)
2351 idg(:) =
idiag%id_q(:)
2353 do_cs_intp = .false.
2355 if ( idg(i)>0 )
then 2361 if ( do_cs_intp )
then 2362 call cs3_interpolator(isc,iec,jsc,jec,npz, atm(n)%q(isc:iec,jsc:jec,:,
sphum),
nplev, &
2363 pout, wz, atm(n)%pe(isc:iec,1:npz+1,jsc:jec), idg, a3, 0)
2366 if (idg(i)>0) used=
send_data(idg(i), a3(isc:iec,jsc:jec,i), time)
2370 if (
idiag%id_q_plev>0)
then 2372 call cs3_interpolator(isc,iec,jsc,jec,npz, atm(n)%q(isc:iec,jsc:jec,:,
sphum),
nplev, &
2373 pout, wz, atm(n)%pe(isc:iec,1:npz+1,jsc:jec), id1, a3, 0)
2378 idg(:) =
idiag%id_omg(:)
2380 do_cs_intp = .false.
2382 if ( idg(i)>0 )
then 2387 if ( do_cs_intp )
then 2389 pout, wz, atm(n)%pe(isc:iec,1:npz+1,jsc:jec), idg, a3, -1)
2392 if (idg(i)>0) used=
send_data(idg(i), a3(isc:iec,jsc:jec,i), time)
2396 if (
idiag%id_omg_plev>0)
then 2399 pout, wz, atm(n)%pe(isc:iec,1:npz+1,jsc:jec), id1, a3, -1)
2403 if(
allocated(a3) )
deallocate (a3)
2406 if (
idiag%id_sl12>0 )
then 2409 a2(i,j) = sqrt(atm(n)%ua(i,j,12)**2 + atm(n)%va(i,j,12)**2)
2414 if (
idiag%id_sl13>0 )
then 2417 a2(i,j) = sqrt(atm(n)%ua(i,j,13)**2 + atm(n)%va(i,j,13)**2)
2423 if ( (.not.atm(n)%flagstruct%hydrostatic) .and.
idiag%id_w200>0 )
then 2425 200.e2, atm(n)%peln, atm(n)%w(isc:iec,jsc:jec,:), a2)
2429 if ( (.not.atm(n)%flagstruct%hydrostatic) .and.
idiag%id_w500>0 )
then 2431 500.e2, atm(n)%peln, atm(n)%w(isc:iec,jsc:jec,:), a2)
2434 if ( (.not.atm(n)%flagstruct%hydrostatic) .and.
idiag%id_w700>0 )
then 2436 700.e2, atm(n)%peln, atm(n)%w(isc:iec,jsc:jec,:), a2)
2439 if ( (.not.atm(n)%flagstruct%hydrostatic) .and.
idiag%id_w850>0 .or.
idiag%id_x850>0)
then 2441 850.e2, atm(n)%peln, atm(n)%w(isc:iec,jsc:jec,:), a2)
2444 if (
idiag%id_x850>0 .and.
idiag%id_vort850>0 )
then 2445 x850(:,:) = x850(:,:)*a2(:,:)
2452 if ( .not.atm(n)%flagstruct%hydrostatic .and.
idiag%id_w>0 )
then 2459 allocate( a3(isc:iec,jsc:jec,npz) )
2460 if(
idiag%id_theta_e > 0)
then 2462 if ( atm(n)%flagstruct%adiabatic .and. atm(n)%flagstruct%kord_tm>0 )
then 2466 a3(i,j,k) = atm(n)%pt(i,j,k)
2477 write (0,*)
'Attention - calling eqv_pot with Atm(n)%q instead of Atm(n)%q(isd,jsd,1,sphum) for gfortran has not been tested!' 2478 call eqv_pot(a3, atm(n)%pt, atm(n)%delp, atm(n)%delz, atm(n)%peln, atm(n)%pkz, atm(n)%q, &
2479 isc, iec, jsc, jec, ngc, npz, atm(n)%flagstruct%hydrostatic, atm(n)%flagstruct%moist_phys)
2481 call eqv_pot(a3, atm(n)%pt, atm(n)%delp, atm(n)%delz, atm(n)%peln, atm(n)%pkz, atm(n)%q(isd,jsd,1,
sphum), &
2482 isc, iec, jsc, jec, ngc, npz, atm(n)%flagstruct%hydrostatic, atm(n)%flagstruct%moist_phys)
2490 if ( theta_d>0 )
then 2498 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
2502 call prt_mxm(
'PT_SUM', a2, isc, iec, jsc, jec, 0, 1, 1.e-5, atm(n)%gridstruct%area_64, atm(n)%domain)
2507 a3(i,j,k) = atm(n)%q(i,j,k,theta_d)/a3(i,j,k) - 1.
2511 call prt_maxmin(
'Theta_Err (%)', a3, isc, iec, jsc, jec, 0, npz, 100.)
2517 if(
idiag%id_ppt> 0)
then 2519 allocate (
idiag%pt1(npz) )
2520 if( .not.
allocated(a3) )
allocate ( a3(isc:iec,jsc:jec,npz) )
2522 call gw_1d(npz, 1000.e2, atm(n)%ak, atm(n)%ak, atm(n)%ak(1), 10.e3,
idiag%pt1)
2530 wk(i,j,k) = (atm(n)%pt(i,j,k)/atm(n)%pkz(i,j,k) -
idiag%pt1(k)) *
pk0 2537 call prt_maxmin(
'PoTemp', wk, isc, iec, jsc, jec, 0, npz, 1.)
2540 if(
allocated(a3) )
deallocate ( a3 )
2541 deallocate (
idiag%pt1 )
2546 do itrac=1, atm(n)%ncnst
2548 if (
idiag%id_tracer(itrac) > 0 .and. itrac.gt.nq)
then 2549 used =
send_data(
idiag%id_tracer(itrac), atm(n)%qdiag(isc:iec,jsc:jec,:,itrac), time )
2551 used =
send_data(
idiag%id_tracer(itrac), atm(n)%q(isc:iec,jsc:jec,:,itrac), time )
2553 if (itrac .le. nq)
then 2555 isc, iec, jsc, jec, ngc, npz, 1.)
2558 isc, iec, jsc, jec, ngc, npz, 1.)
2567 if (
idiag%id_tracer_dmmr(itrac) > 0 .or.
idiag%id_tracer_dvmr(itrac) > 0)
then 2568 if (itrac .gt. nq)
then 2569 dmmr(:,:,:) = atm(n)%qdiag(isc:iec,jsc:jec,1:npz,itrac) &
2570 /(1.0-atm(n)%q(isc:iec,jsc:jec,1:npz,1))
2572 dmmr(:,:,:) = atm(n)%q(isc:iec,jsc:jec,1:npz,itrac) &
2573 /(1.0-atm(n)%q(isc:iec,jsc:jec,1:npz,1))
2575 dvmr(:,:,:) = dmmr(isc:iec,jsc:jec,1:npz) *
wtmair/
idiag%w_mr(itrac)
2580 isc, iec, jsc, jec, 0, npz, 1.)
2582 isc, iec, jsc, jec, 0, npz, 1.)
2598 if (
allocated(a3))
deallocate(a3)
2599 if (
allocated(wz))
deallocate(wz)
2600 if (
allocated(dmmr))
deallocate(dmmr)
2601 if (
allocated(dvmr))
deallocate(dvmr)
2608 subroutine wind_max(isc, iec, jsc, jec ,isd, ied, jsd, jed, us, vs, ws_max, domain)
2609 integer isc, iec, jsc, jec
2610 integer isd, ied, jsd, jed
2611 real,
intent(in),
dimension(isc:iec,jsc:jec):: us, vs
2612 real,
intent(out) :: ws_max(isc:iec,jsc:jec)
2613 type(domain2d),
intent(INOUT) :: domain
2615 real :: wx(isc:iec,jsd:jed), ws(isd:ied,jsd:jed)
2621 ws(i,j) = sqrt(us(i,j)**2 + vs(i,j)**2)
2629 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))
2635 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))
2642 subroutine get_vorticity(isc, iec, jsc, jec ,isd, ied, jsd, jed, npz, u, v, vort, dx, dy, rarea)
2643 integer isd, ied, jsd, jed, npz
2644 integer isc, iec, jsc, jec
2645 real,
intent(in) :: u(isd:ied, jsd:jed+1, npz), v(isd:ied+1, jsd:jed, npz)
2646 real,
intent(out) :: vort(isc:iec, jsc:jec, npz)
2647 real,
intent(IN) :: dx(isd:ied,jsd:jed+1)
2648 real,
intent(IN) :: dy(isd:ied+1,jsd:jed)
2649 real,
intent(IN) :: rarea(isd:ied,jsd:jed)
2651 real :: utmp(isc:iec, jsc:jec+1), vtmp(isc:iec+1, jsc:jec)
2657 utmp(i,j) = u(i,j,k)*dx(i,j)
2662 vtmp(i,j) = v(i,j,k)*dy(i,j)
2668 vort(i,j,k) = rarea(i,j)*(utmp(i,j)-utmp(i,j+1)-vtmp(i,j)+vtmp(i+1,j))
2676 subroutine get_height_field(is, ie, js, je, ng, km, hydrostatic, delz, wz, pt, q, peln, zvir)
2677 integer,
intent(in):: is, ie, js, je, km, ng
2678 real,
intent(in):: peln(is:ie,km+1,js:je)
2679 real,
intent(in):: pt(is-ng:ie+ng,js-ng:je+ng,km)
2680 real,
intent(in):: q(is-ng:ie+ng,js-ng:je+ng,km,*)
2681 real,
intent(in):: delz(is-ng:,js-ng:,1:)
2682 real,
intent(in):: zvir
2683 logical,
intent(in):: hydrostatic
2684 real,
intent(out):: wz(is:ie,js:je,km+1)
2693 wz(i,j,km+1) =
idiag%zsurf(i,j)
2695 if (hydrostatic )
then 2698 wz(i,j,k) = wz(i,j,k+1) + gg*pt(i,j,k)*(1.+zvir*q(i,j,k,
sphum)) &
2699 *(peln(i,k+1,j)-peln(i,k,j))
2705 wz(i,j,k) = wz(i,j,k+1) - delz(i,j,k)
2713 subroutine range_check(qname, q, is, ie, js, je, n_g, km, pos, q_low, q_hi, bad_range)
2714 character(len=*),
intent(in):: qname
2715 integer,
intent(in):: is, ie, js, je
2716 integer,
intent(in):: n_g, km
2717 real,
intent(in):: q(is-n_g:ie+n_g, js-n_g:je+n_g, km)
2718 real,
intent(in):: pos(is-n_g:ie+n_g, js-n_g:je+n_g,2)
2719 real,
intent(in):: q_low, q_hi
2720 logical,
optional,
intent(out):: bad_range
2725 if (
present(bad_range) ) bad_range = .false.
2732 if( q(i,j,k) < qmin )
then 2734 elseif( q(i,j,k) > qmax )
then 2741 call mp_reduce_min(qmin)
2742 call mp_reduce_max(qmax)
2744 if( qmin<q_low .or. qmax>q_hi )
then 2745 if(
master)
write(*,*)
'Range_check Warning:', qname,
' max = ', qmax,
' min = ', qmin
2746 if (
present(bad_range) )
then 2751 if (
present(bad_range) )
then 2753 if ( bad_range .EQV. .false. )
return 2757 if( q(i,j,k)<q_low .or. q(i,j,k)>q_hi )
then 2758 write(*,*)
'Crash_K=',k,
'(i,j)=',i,j, pos(i,j,1)*
rad2deg, pos(i,j,2)*
rad2deg, q(i,j,k)
2759 if ( k/= 1 )
write(*,*) k-1, q(i,j,k-1)
2760 if ( k/=km )
write(*,*) k+1, q(i,j,k+1)
2765 call mpp_error(fatal,
'==> Error from range_check: data out of bound')
2770 subroutine prt_maxmin(qname, q, is, ie, js, je, n_g, km, fac)
2771 character(len=*),
intent(in):: qname
2772 integer,
intent(in):: is, ie, js, je
2773 integer,
intent(in):: n_g, km
2774 real,
intent(in):: q(is-n_g:ie+n_g, js-n_g:je+n_g, km)
2775 real,
intent(in):: fac
2780 master = (mpp_pe()==mpp_root_pe()) .or. is_master()
2790 if( q(i,j,k) < qmin )
then 2792 elseif( q(i,j,k) > qmax )
then 2799 call mp_reduce_min(qmin)
2800 call mp_reduce_max(qmax)
2803 write(*,*) qname//trim(
gn),
' max = ', qmax*fac,
' min = ', qmin*fac
2808 subroutine prt_mxm(qname, q, is, ie, js, je, n_g, km, fac, area, domain)
2809 character(len=*),
intent(in):: qname
2810 integer,
intent(in):: is, ie, js, je
2811 integer,
intent(in):: n_g, km
2812 real,
intent(in):: q(is-n_g:ie+n_g, js-n_g:je+n_g, km)
2813 real,
intent(in):: fac
2816 real(kind=R_GRID),
intent(IN):: area(is-3:ie+3, js-3:je+3)
2817 type(
domain2d),
intent(INOUT) :: domain
2819 real qmin, qmax, gmean
2823 master = (mpp_pe()==mpp_root_pe()) .or. is_master()
2833 if( q(i,j,k) < qmin )
then 2835 elseif( q(i,j,k) > qmax )
then 2842 call mp_reduce_min(qmin)
2843 call mp_reduce_max(qmax)
2847 gmean =
g_sum(domain, q(is:ie,js:je,km), is, ie, js, je, 3, area, 1)
2849 if(
master)
write(6,*) qname,
gn, qmax*fac, qmin*fac, gmean*fac
2854 subroutine prt_mass(km, nq, is, ie, js, je, n_g, nwat, ps, delp, q, area, domain)
2856 integer,
intent(in):: is, ie, js, je
2857 integer,
intent(in):: nq, n_g, km, nwat
2858 real,
intent(in):: ps(is-n_g:ie+n_g, js-n_g:je+n_g)
2859 real,
intent(in):: delp(is-n_g:ie+n_g, js-n_g:je+n_g, km)
2860 real,
intent(in):: q(is-n_g:ie+n_g, js-n_g:je+n_g, km, nq)
2861 real(kind=R_GRID),
intent(IN):: area(is-n_g:ie+n_g,js-n_g:je+n_g)
2862 type(
domain2d),
intent(INOUT) :: domain
2864 real psq(is:ie,js:je,nwat), psqv(is:ie,js:je)
2865 real q_strat(is:ie,js:je)
2866 real qtot(nwat), qwat
2867 real psmo, totw, psdry
2868 integer k, n, kstrat
2880 psmo =
g_sum(domain, ps(is:ie,js:je), is, ie, js, je, n_g, area, 1)
2881 if(
master )
write(*,*)
'Total surface pressure (mb)', trim(
gn),
' = ', 0.01*psmo
2882 call z_sum(is, ie, js, je, km, n_g, delp, q(is-n_g,js-n_g,1,1 ), psqv(is,js))
2887 call z_sum(is, ie, js, je, km, n_g, delp, q(is-n_g,js-n_g,1,
sphum ), psq(is,js,
sphum ))
2890 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))
2893 call z_sum(is, ie, js, je, km, n_g, delp, q(is-n_g,js-n_g,1,
rainwat), psq(is,js,
rainwat))
2897 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))
2900 call z_sum(is, ie, js, je, km, n_g, delp, q(is-n_g,js-n_g,1,
snowwat), psq(is,js,
snowwat))
2902 call z_sum(is, ie, js, je, km, n_g, delp, q(is-n_g,js-n_g,1,
graupel), psq(is,js,
graupel))
2906 if (
idiag%phalf(2)< 75. )
then 2909 if (
idiag%phalf(k+1) > 75. )
exit 2912 call z_sum(is, ie, js, je, kstrat, n_g, delp, q(is-n_g,js-n_g,1,
sphum), q_strat(is,js))
2913 psmo =
g_sum(domain, q_strat(is,js), is, ie, js, je, n_g, area, 1) * 1.e6 &
2914 /
p_sum(is, ie, js, je, kstrat, n_g, delp, area, domain)
2915 if(
master)
write(*,*)
'Mean specific humidity (mg/kg) above 75 mb', trim(
gn),
'=', psmo
2922 psmo =
g_sum(domain, ps(is:ie,js:je), is, ie, js, je, n_g, area, 1)
2925 qtot(n) =
g_sum(domain, psq(is,js,n), is, ie, js, je, n_g, area, 1)
2928 totw = sum(qtot(1:nwat))
2932 write(*,*)
'Total surface pressure (mb)', trim(
gn),
' = ', 0.01*psmo
2933 write(*,*)
'mean dry surface pressure', trim(
gn),
' = ', 0.01*psdry
2934 write(*,*)
'Total Water Vapor (kg/m**2)', trim(
gn),
' =', qtot(
sphum)*
ginv 2936 write(*,*)
'--- Micro Phys water substances (kg/m**2) ---' 2937 write(*,*)
'Total cloud water', trim(
gn),
'=', qtot(
liq_wat)*
ginv 2939 write(*,*)
'Total rain water', trim(
gn),
'=', qtot(
rainwat)*
ginv 2941 write(*,*)
'Total cloud ice ', trim(
gn),
'=', qtot(
ice_wat)*
ginv 2945 write(*,*)
'Total graupel ', trim(
gn),
'=', qtot(
graupel)*
ginv 2946 write(*,*)
'---------------------------------------------' 2947 elseif ( nwat==2 )
then 2948 write(*,*)
'GFS condensate (kg/m^2)', trim(
gn),
'=', qtot(
liq_wat)*
ginv 2955 subroutine z_sum(is, ie, js, je, km, n_g, delp, q, sum2)
2956 integer,
intent(in):: is, ie, js, je, n_g, km
2957 real,
intent(in):: delp(is-n_g:ie+n_g, js-n_g:je+n_g, km)
2958 real,
intent(in):: q(is-n_g:ie+n_g, js-n_g:je+n_g, km)
2959 real,
intent(out):: sum2(is:ie,js:je)
2965 sum2(i,j) = delp(i,j,1)*q(i,j,1)
2969 sum2(i,j) = sum2(i,j) + delp(i,j,k)*q(i,j,k)
2974 end subroutine z_sum 2977 real function p_sum(is, ie, js, je, km, n_g, delp, area, domain)
2978 integer,
intent(in):: is, ie, js, je, n_g, km
2979 real,
intent(in):: delp(is-n_g:ie+n_g, js-n_g:je+n_g, km)
2980 real(kind=R_GRID),
intent(IN) :: area(is-n_g:ie+n_g, js-n_g:je+n_g)
2981 real :: sum2(is:ie,js:je)
2983 type(
domain2d),
intent(INOUT) :: domain
2988 sum2(i,j) = delp(i,j,1)
2992 sum2(i,j) = sum2(i,j) + delp(i,j,k)
2996 p_sum =
g_sum(domain, sum2, is, ie, js, je, n_g, area, 1)
3005 integer,
intent(in):: is, ie, js, je, km, ng
3006 integer,
intent(in):: kd
3007 real,
intent(in):: wz(is:ie,js:je,km+1)
3008 real,
intent(in):: ts(is-ng:ie+ng,js-ng:je+ng)
3009 real,
intent(in):: peln(is:ie,km+1,js:je)
3010 real,
intent(in):: height(kd)
3011 real,
intent(out):: a2(is:ie,js:je,kd)
3012 real,
optional,
intent(in):: fac
3027 if ( height(n) >= wz(i,j,km+1) )
then 3032 if( height(n) < wz(i,j,k) .and. height(n) >= wz(i,j,k+1) )
then 3034 ptmp = peln(i,k,j) + (peln(i,k+1,j)-peln(i,k,j)) * &
3035 (wz(i,j,k)-height(n)) / (wz(i,j,k)-wz(i,j,k+1))
3036 a2(i,j,n) = exp(ptmp)
3045 tm =
rdgas*
ginv*(ts(i,j) + 3.25e-3*(wz(i,j,km)-height(n)))
3046 a2(i,j,n) = exp( peln(i,km+1,j) + (wz(i,j,km+1) - height(n))/tm )
3048 500
if (
present(fac) ) a2(i,j,n) = fac * a2(i,j,n)
3055 subroutine get_height_given_pressure(is, ie, js, je, ng, km, wz, kd, id, log_p, peln, a2)
3056 integer,
intent(in):: is, ie, js, je, ng, km
3057 integer,
intent(in):: kd
3058 integer,
intent(in):: id(kd)
3059 real,
intent(in):: log_p(kd)
3061 real,
intent(in):: wz(is:ie,js:je,km+1)
3062 real,
intent(in):: peln(is:ie,km+1,js:je)
3063 real,
intent(out):: a2(is:ie,js:je,kd)
3073 if( id(n)<0 )
goto 1000
3075 if( log_p(n) <= peln(i,k+1,j) .and. log_p(n) >= peln(i,k,j) )
then 3076 a2(i,j,n) = wz(i,j,k) + (wz(i,j,k+1) - wz(i,j,k)) * &
3077 (log_p(n)-peln(i,k,j)) / (peln(i,k+1,j)-peln(i,k,j) )
3084 a2(i,j,n) = wz(i,j,km+1) + (wz(i,j,km+1) - wz(i,j,km-3)) * &
3085 (log_p(n)-peln(i,km+1,j)) / (peln(i,km+1,j)-peln(i,km-3,j) )
3093 subroutine cs3_interpolator(is, ie, js, je, km, qin, kd, pout, wz, pe, id, qout, iv)
3097 integer,
intent(in):: is, ie, js, je, km, iv
3098 integer,
intent(in):: kd
3099 integer,
intent(in):: id(kd)
3100 real,
intent(in):: pout(kd)
3101 real,
intent(in):: pe(is:ie,km+1,js:je)
3102 real,
intent(in):: qin(is:ie,js:je,km)
3103 real,
intent(in):: wz(is:ie,js:je,km+1)
3104 real,
intent(out):: qout(is:ie,js:je,kd)
3107 real:: qe(is:ie,km+1)
3108 real,
dimension(is:ie,km):: q2, dp
3110 integer:: i,j,k, n, k1
3118 dp(i,k) = pe(i,k+1,j) - pe(i,k,j)
3119 q2(i,k) = qin(i,j,k)
3123 call cs_prof(q2, dp, qe, km, is, ie, iv)
3128 if ( id(n) > 0 )
then 3129 if( pout(n) <= pe(i,1,j) )
then 3131 qout(i,j,n) = qe(i,1)
3132 elseif ( pout(n) >= pe(i,km+1,j) )
then 3138 qout(i,j,n) = gcp*exp(
kappa*pout(n)) * (wz(i,j,km-2) - wz(i,j,km)) / &
3139 ( exp(
kappa*pe(i,km,j)) - exp(
kappa*pe(i,km-2,j)) )
3141 qout(i,j,n) = qe(i,km+1)
3145 if ( pout(n)>=pe(i,k,j) .and. pout(n) <= pe(i,k+1,j) )
then 3147 a6 = 3.*(2.*q2(i,k) - (qe(i,k)+qe(i,k+1)))
3148 s0 = (pout(n)-pe(i,k,j)) / dp(i,k)
3149 qout(i,j,n) = qe(i,k) + s0*(qe(i,k+1)-qe(i,k)+a6*(1.-s0))
3155 500
if ( iv==0 ) qout(i,j,n) =
max(0., qout(i,j,n))
3165 subroutine cs_interpolator(is, ie, js, je, km, qin, kd, pout, pe, id, qout, iv)
3167 integer,
intent(in):: is, ie, js, je, km
3168 integer,
intent(in):: kd
3169 integer,
intent(in):: id(kd)
3170 integer,
optional,
intent(in):: iv
3171 real,
intent(in):: pout(kd)
3172 real,
intent(in):: pe(is:ie,km+1,js:je)
3173 real,
intent(in):: qin(is:ie,js:je,km)
3174 real,
intent(out):: qout(is:ie,js:je,kd)
3177 integer i,j,k, n, k1
3185 pm(k) = 0.5*(pe(i,k,j)+pe(i,k+1,j))
3190 if ( id(n) < 0 )
go to 500
3191 if( pout(n) <= pm(1) )
then 3193 qout(i,j,n) = qin(i,j,1)
3194 elseif ( pout(n) >= pm(km) )
then 3196 qout(i,j,n) = qin(i,j,km)
3199 if ( pout(n)>=pm(k) .and. pout(n) <= pm(k+1) )
then 3200 qout(i,j,n) = qin(i,j,k) + (qin(i,j,k+1)-qin(i,j,k))*(pout(n)-pm(k))/(pm(k+1)-pm(k))
3213 subroutine cs_prof(q2, delp, q, km, i1, i2, iv)
3215 integer,
intent(in):: i1, i2, km
3216 integer,
intent(in):: iv
3217 real,
intent(in) :: q2(i1:i2,km)
3218 real,
intent(in) :: delp(i1:i2,km)
3219 real,
intent(out):: q(i1:i2,km+1)
3223 real bet, a_bot, grat
3227 grat = delp(i,2) / delp(i,1)
3228 bet = grat*(grat+0.5)
3229 q(i,1) = ( (grat+grat)*(grat+1.)*q2(i,1) + q2(i,2) ) / bet
3230 gam(i,1) = ( 1. + grat*(grat+1.5) ) / bet
3235 d4(i) = delp(i,k-1) / delp(i,k)
3236 bet = 2. + d4(i) + d4(i) - gam(i,k-1)
3237 q(i,k) = ( 3.*(q2(i,k-1)+d4(i)*q2(i,k)) - q(i,k-1) )/bet
3238 gam(i,k) = d4(i) / bet
3243 a_bot = 1. + d4(i)*(d4(i)+1.5)
3244 q(i,km+1) = (2.*d4(i)*(d4(i)+1.)*q2(i,km)+q2(i,km-1)-a_bot*q(i,km)) &
3245 / ( d4(i)*(d4(i)+0.5) - a_bot*gam(i,km) )
3250 q(i,k) = q(i,k) - gam(i,k)*q(i,k+1)
3256 q(i,2) =
min( q(i,2),
max(q2(i,1), q2(i,2)) )
3257 q(i,2) =
max( q(i,2),
min(q2(i,1), q2(i,2)) )
3262 gam(i,k) = q2(i,k) - q2(i,k-1)
3269 if ( gam(i,k-1)*gam(i,k+1)>0. )
then 3271 q(i,k) =
min( q(i,k),
max(q2(i,k-1),q2(i,k)) )
3272 q(i,k) =
max( q(i,k),
min(q2(i,k-1),q2(i,k)) )
3274 if ( gam(i,k-1) > 0. )
then 3276 q(i,k) =
max(q(i,k),
min(q2(i,k-1),q2(i,k)))
3279 q(i,k) =
min(q(i,k),
max(q2(i,k-1),q2(i,k)))
3280 if ( iv==0 ) q(i,k) =
max(0., q(i,k))
3288 q(i,km) =
min( q(i,km),
max(q2(i,km-1), q2(i,km)) )
3289 q(i,km) =
max( q(i,km),
min(q2(i,km-1), q2(i,km)) )
3297 integer,
intent(in):: is, ie, js, je, km
3298 real,
intent(in):: peln(is:ie,km+1,js:je)
3299 real,
intent(in):: a3(is:ie,js:je,km)
3300 real,
intent(in):: plev
3301 real,
intent(out):: a2(is:ie,js:je)
3315 pm(k) = 0.5*(peln(i,k,j)+peln(i,k+1,j))
3318 if( logp <= pm(1) )
then 3320 elseif ( logp >= pm(km) )
then 3321 a2(i,j) = a3(i,j,km)
3324 if( logp <= pm(k+1) .and. logp >= pm(k) )
then 3325 a2(i,j) = a3(i,j,k) + (a3(i,j,k+1)-a3(i,j,k))*(logp-pm(k))/(pm(k+1)-pm(k))
3336 subroutine interpolate_z(is, ie, js, je, km, zl, hght, a3, a2)
3338 integer,
intent(in):: is, ie, js, je, km
3339 real,
intent(in):: hght(is:ie,js:je,km+1)
3340 real,
intent(in):: a3(is:ie,js:je,km)
3341 real,
intent(in):: zl
3342 real,
intent(out):: a2(is:ie,js:je)
3352 zm(k) = 0.5*(hght(i,j,k)+hght(i,j,k+1))
3354 if( zl >= zm(1) )
then 3356 elseif ( zl <= zm(km) )
then 3357 a2(i,j) = a3(i,j,km)
3360 if( zl <= zm(k) .and. zl >= zm(k+1) )
then 3361 a2(i,j) = a3(i,j,k) + (a3(i,j,k+1)-a3(i,j,k))*(zm(k)-zl)/(zm(k)-zm(k+1))
3372 ua, va, delz, q, hydrostatic, pt, peln, phis, grav, z_bot, z_top)
3374 integer,
intent(in):: is, ie, js, je, ng, km, sphum
3375 real,
intent(in):: grav, zvir, z_bot, z_top
3376 real,
intent(in),
dimension(is-ng:ie+ng,js-ng:je+ng,km):: pt, ua, va
3377 real,
intent(in):: delz(is-ng:ie+ng,js-ng:je+ng,km)
3378 real,
intent(in):: q(is-ng:ie+ng,js-ng:je+ng,km,*)
3379 real,
intent(in):: phis(is-ng:ie+ng,js-ng:je+ng)
3380 real,
intent(in):: peln(is:ie,km+1,js:je)
3381 logical,
intent(in):: hydrostatic
3382 real,
intent(out):: srh(is:ie,js:je)
3393 real,
dimension(is:ie):: zh, uc, vc, dz, zh0
3394 integer i, j, k, k0, k1
3395 logical below(is:ie)
3414 if ( hydrostatic )
then 3415 dz(i) = rdg*pt(i,j,k)*(1.+zvir*q(i,j,k,sphum))*(peln(i,k+1,j)-peln(i,k,j))
3417 dz(i) = - delz(i,j,k)
3419 zh(i) = zh(i) + dz(i)
3420 if (zh(i) <= z_bot )
continue 3421 if (zh(i) > z_bot .and. below(i))
then 3422 uc(i) = ua(i,j,k)*dz(i)
3423 vc(i) = va(i,j,k)*dz(i)
3424 zh0(i) = zh(i) - dz(i)
3428 elseif ( zh(i) < z_top )
then 3429 uc(i) = uc(i) + ua(i,j,k)*dz(i)
3430 vc(i) = vc(i) + va(i,j,k)*dz(i)
3433 uc(i) = uc(i) / (zh(i)-dz(i) - zh0(i))
3434 vc(i) = vc(i) / (zh(i)-dz(i) - zh0(i))
3442 srh(i,j) = 0.5*(va(i,j,k1)-vc(i))*(ua(i,j,k1-1)-ua(i,j,k1)) - &
3443 0.5*(ua(i,j,k1)-uc(i))*(va(i,j,k1-1)-va(i,j,k1))
3445 srh(i,j) = srh(i,j) + 0.5*(va(i,j,k)-vc(i))*(ua(i,j,k-1)-ua(i,j,k+1)) - &
3446 0.5*(ua(i,j,k)-uc(i))*(va(i,j,k-1)-va(i,j,k+1))
3455 w, vort, delz, q, hydrostatic, pt, peln, phis, grav, z_bot, z_top)
3457 integer,
intent(in):: is, ie, js, je, ng, km, sphum
3458 real,
intent(in):: grav, zvir, z_bot, z_top
3459 real,
intent(in),
dimension(is-ng:ie+ng,js-ng:je+ng,km):: pt, w
3460 real,
intent(in),
dimension(is:ie,js:je,km):: vort
3461 real,
intent(in):: delz(is-ng:ie+ng,js-ng:je+ng,km)
3462 real,
intent(in):: q(is-ng:ie+ng,js-ng:je+ng,km,*)
3463 real,
intent(in):: phis(is-ng:ie+ng,js-ng:je+ng)
3464 real,
intent(in):: peln(is:ie,km+1,js:je)
3465 logical,
intent(in):: hydrostatic
3466 real,
intent(out):: uh(is:ie,js:je)
3471 real,
dimension(is:ie):: zh, dz, zh0
3473 logical below(is:ie)
3490 if ( hydrostatic )
then 3491 dz(i) = rdg*pt(i,j,k)*(1.+zvir*q(i,j,k,sphum))*(peln(i,k+1,j)-peln(i,k,j))
3493 dz(i) = - delz(i,j,k)
3495 zh(i) = zh(i) + dz(i)
3496 if (zh(i) <= z_bot )
continue 3497 if (zh(i) > z_bot .and. below(i))
then 3498 uh(i,j) = vort(i,j,k)*w(i,j,k)*(zh(i) - z_bot)
3501 elseif ( zh(i) < z_top )
then 3502 uh(i,j) = uh(i,j) + vort(i,j,k)*w(i,j,k)*dz(i)
3504 uh(i,j) = uh(i,j) + vort(i,j,k)*w(i,j,k)*(z_top - (zh(i)-dz(i)) )
3517 subroutine pv_entropy(is, ie, js, je, ng, km, vort, f_d, pt, pkz, delp, grav)
3520 integer,
intent(in):: is, ie, js, je, ng, km
3521 real,
intent(in):: grav
3522 real,
intent(in):: pt(is-ng:ie+ng,js-ng:je+ng,km)
3523 real,
intent(in):: pkz(is:ie,js:je,km)
3524 real,
intent(in):: delp(is-ng:ie+ng,js-ng:je+ng,km)
3525 real,
intent(in):: f_d(is-ng:ie+ng,js-ng:je+ng)
3528 real,
intent(inout):: vort(is:ie,js:je,km)
3549 real w3d(is:ie,js:je,km)
3550 real te(is:ie,js:je,km+1), t2(is:ie,km), delp2(is:ie,km)
3551 real te2(is:ie,km+1)
3558 vort(i,j,1) = grav * (vort(i,j,1)+f_d(i,j)) / delp(i,j,1)
3568 t2(i,k) = pt(i,j,k) / pkz(i,j,k)
3569 w3d(i,j,k) = t2(i,k)
3570 delp2(i,k) = delp(i,j,k)
3574 call ppme(t2, te2, delp2, ie-is+1, km)
3578 te(i,j,k) = te2(i,k)
3588 vort(i,j,k) = (vort(i,j,k)+f_d(i,j)) * ( te(i,j,k)-te(i,j,k+1) ) &
3589 / ( w3d(i,j,k)*delp(i,j,k) ) * grav
3598 subroutine ppme(p,qe,delp,im,km)
3600 integer,
intent(in):: im, km
3601 real,
intent(in):: p(im,km)
3602 real,
intent(in):: delp(im,km)
3603 real,
intent(out)::qe(im,km+1)
3606 real dc(im,km),delq(im,km), a6(im,km)
3607 real c1, c2, c3, tmp, qmax, qmin
3608 real a1, a2, s1, s2, s3, s4, ss3, s32, s34, s42
3609 real a3, b2, sc, dm, d1, d2, f1, f2, f3, f4
3617 500 a6(i,k) = delp(i,k-1) + delp(i,k)
3621 delq(i,k) = p(i,k+1) - p(i,k)
3626 c1 = (delp(i,k-1)+0.5*delp(i,k))/a6(i,k+1)
3627 c2 = (delp(i,k+1)+0.5*delp(i,k))/a6(i,k)
3628 tmp = delp(i,k)*(c1*delq(i,k) + c2*delq(i,k-1)) / &
3629 (a6(i,k)+delp(i,k+1))
3630 qmax =
max(p(i,k-1),p(i,k),p(i,k+1)) - p(i,k)
3631 qmin = p(i,k) -
min(p(i,k-1),p(i,k),p(i,k+1))
3632 dc(i,k) = sign(
min(abs(tmp),qmax,qmin), tmp)
3641 c1 = delq(i,k-1)*delp(i,k-1) / a6(i,k)
3642 a1 = a6(i,k-1) / (a6(i,k) + delp(i,k-1))
3643 a2 = a6(i,k+1) / (a6(i,k) + delp(i,k))
3644 qe(i,k) = p(i,k-1) + c1 + 2./(a6(i,k-1)+a6(i,k+1)) * &
3645 ( delp(i,k)*(c1*(a1 - a2)+a2*dc(i,k-1)) - &
3646 delp(i,k-1)*a1*dc(i,k ) )
3660 s3 = delp(i,2) + delp(i,3)
3667 a3 = (delq(i,2) - delq(i,1)*s3/s2) / (s3*ss3)
3669 if(abs(a3) .gt. 1.e-14)
then 3670 b2 = delq(i,1)/s2 - a3*(s1+s2)
3672 if(sc .lt. 0. .or. sc .gt. s1)
then 3673 qe(i,1) = p(i,1) - s1*(a3*s1 + b2)
3675 qe(i,1) = p(i,1) - delq(i,1)*s1/s2
3679 qe(i,1) = p(i,1) - delq(i,1)*s1/s2
3681 dc(i,1) = p(i,1) - qe(i,1)
3683 dm = delp(i,1) / (s34*ss3*(delp(i,2)+s3)*(s4+delp(i,1)))
3684 f1 = delp(i,2)*s34 / ( s2*ss3*(s4+delp(i,1)) )
3685 f2 = (delp(i,2)+s3) * (ss3*(delp(i,2)*s3+s34+delp(i,2)*s4) &
3686 + s42*(delp(i,2)+s3+s32/s2))
3687 f3 = -delp(i,2)*( ss3*(s32*(s3+s4)/(s4-delp(i,2)) &
3688 + (delp(i,2)*s3+s34+delp(i,2)*s4)) &
3689 + s42*(delp(i,2)+s3) )
3690 f4 = ss3*delp(i,2)*s32*(delp(i,2)+s3) / (s4-delp(i,2))
3691 qe(i,2) = f1*p(i,1)+(f2*p(i,2)+f3*p(i,3)+f4*p(i,4))*dm
3699 qm = (d2*p(i,km)+d1*p(i,km1)) / (d1+d2)
3700 dq = 2.*(p(i,km1)-p(i,km)) / (d1+d2)
3701 c1 = (qe(i,km1)-qm-d2*dq) / (d2*(2.*d2*d2+d1*(d2+3.*d1)))
3702 c3 = dq - 2.0*c1*(d2*(5.*d1+d2)-3.*d1**2)
3703 qe(i,km ) = qm - c1*d1*d2*(d2+3.*d1)
3704 qe(i,km+1) = d1*(8.*c1*d1**2-c3) + qe(i,km)
3711 subroutine rh_calc (pfull, t, qv, rh, do_cmip)
3713 real,
intent (in),
dimension(:,:) :: pfull, t, qv
3714 real,
intent (out),
dimension(:,:) :: rh
3715 real,
dimension(size(t,1),size(t,2)) :: esat
3716 logical,
intent(in),
optional :: do_cmip
3719 real,
parameter :: d378 = 1.-d622
3721 logical :: do_simple = .false.
3727 rh(:,:) = pfull(:,:)
3728 rh(:,:) =
max(rh(:,:),esat(:,:))
3729 rh(:,:)=100.*qv(:,:)/(d622*esat(:,:)/rh(:,:))
3731 if (
present(do_cmip))
then 3732 call compute_qs (t, pfull, rh, q=qv, es_over_liq_and_ice = .true.)
3733 rh(:,:)=100.*qv(:,:)/rh(:,:)
3736 rh(:,:)=100.*qv(:,:)/rh(:,:)
3742 subroutine eqv_pot(theta_e, pt, delp, delz, peln, pkz, q, is, ie, js, je, ng, npz, &
3748 integer,
intent(in):: is,ie,js,je,ng,npz
3749 real,
intent(in),
dimension(is-ng:ie+ng,js-ng:je+ng,npz):: pt, delp, q
3750 real,
intent(in),
dimension(is-ng: ,js-ng: ,1: ):: delz
3751 real,
intent(in),
dimension(is:ie,npz+1,js:je):: peln
3752 real,
intent(in):: pkz(is:ie,js:je,npz)
3753 logical,
intent(in):: hydrostatic, moist
3755 real,
dimension(is:ie,js:je,npz),
intent(out) :: theta_e
3758 real,
parameter:: cappa_b = 0.2854
3759 real(kind=R_GRID):: cv_air, cappa, zvir
3760 real(kind=R_GRID):: p_mb(is:ie)
3761 real(kind=R_GRID) :: r, e, t_l, rdg, capa
3778 if ( hydrostatic )
then 3780 p_mb(i) = 0.01*delp(i,j,k) / (peln(i,k+1,j) - peln(i,k,j))
3784 p_mb(i) = 0.01*rdg*delp(i,j,k)/delz(i,j,k)*pt(i,j,k)*(1.+zvir*q(i,j,k))
3789 cappa =
rdgas/(
rdgas+((1.-q(i,j,k))*cv_air+q(i,j,k)*cv_vap)/(1.+zvir*q(i,j,k)))
3791 r = q(i,j,k)/(1.-q(i,j,k))*1000.
3794 e = p_mb(i)*r/(622.+r)
3797 t_l = 2840./(3.5*log(pt(i,j,k))-log(e)-4.805)+55.
3801 capa = cappa*(1. - r*0.28e-3)
3802 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
3805 if ( hydrostatic )
then 3807 theta_e(i,j,k) = pt(i,j,k)*
pk0/pkz(i,j,k)
3811 theta_e(i,j,k) = pt(i,j,k)*exp(
kappa*log(1000./p_mb(i)) )
3823 w, delz, pt, delp, q, hs, area, domain, &
3824 sphum, liq_wat, rainwat, ice_wat, &
3825 snowwat, graupel, nwat, ua, va, moist_phys, te)
3830 integer,
intent(in):: km, is, ie, js, je, isd, ied, jsd, jed
3831 integer,
intent(in):: nwat, sphum, liq_wat, rainwat, ice_wat, snowwat, graupel
3832 real,
intent(in),
dimension(isd:ied,jsd:jed,km):: ua, va, pt, delp, w, delz
3833 real,
intent(in),
dimension(isd:ied,jsd:jed,km,nwat):: q
3834 real,
intent(in):: hs(isd:ied,jsd:jed)
3835 real,
intent(in):: area(isd:ied, jsd:jed)
3836 logical,
intent(in):: moist_phys
3837 type(domain2d),
intent(INOUT) :: domain
3838 real,
intent(out):: te(is:ie,js:je)
3840 real,
parameter:: c_liq = 4190.
3841 real(kind=R_Grid) :: area_l(isd:ied, jsd:jed)
3843 real phiz(is:ie,km+1)
3844 real,
dimension(is:ie):: cvm, qc
3858 phiz(i,km+1) = hs(i,j)
3863 phiz(i,k) = phiz(i,k+1) -
grav*delz(i,j,k)
3867 if ( moist_phys )
then 3869 call moist_cv(is,ie,isd,ied,jsd,jed, km, j, k, nwat, sphum, liq_wat, rainwat, &
3870 ice_wat, snowwat, graupel, q, qc, cvm)
3872 te(i,j) = te(i,j) + delp(i,j,k)*( cvm(i)*pt(i,j,k) +
hlv*q(i,j,k,sphum) + &
3873 0.5*(phiz(i,k)+phiz(i,k+1)+ua(i,j,k)**2+va(i,j,k)**2+w(i,j,k)**2) )
3879 te(i,j) = te(i,j) + delp(i,j,k)*( cv_air*pt(i,j,k) + &
3880 0.5*(phiz(i,k)+phiz(i,k+1)+ua(i,j,k)**2+va(i,j,k)**2+w(i,j,k)**2) )
3886 te(i,j) = te(i,j)/
grav 3890 psm =
g_sum(domain, te, is, ie, js, je, 3, area_l, 1)
3891 if(
master )
write(*,*)
'TE ( Joule/m^2 * E9) =', psm * 1.e-9
3896 subroutine dbzcalc(q, pt, delp, peln, delz, &
3897 dbz, maxdbz, allmax, bd, npz, ncnst, &
3898 hydrostatic, zvir, in0r, in0s, in0g, iliqskin)
3941 type(fv_grid_bounds_type),
intent(IN) :: bd
3942 integer,
intent(IN) :: npz, ncnst
3943 real,
intent(IN),
dimension(bd%isd:bd%ied, bd%jsd:bd%jed, npz) :: pt, delp, delz
3944 real,
intent(IN),
dimension(bd%isd:bd%ied, bd%jsd:bd%jed, npz, ncnst) :: q
3945 real,
intent(IN),
dimension(bd%is :bd%ie, npz+1, bd%js:bd%je) :: peln
3946 real,
intent(OUT),
dimension(bd%is :bd%ie, bd%js :bd%je , npz) :: dbz
3947 real,
intent(OUT),
dimension(bd%is :bd%ie, bd%js :bd%je) :: maxdbz
3948 logical,
intent(IN) :: hydrostatic, in0r, in0s, in0g, iliqskin
3949 real,
intent(IN) :: zvir
3950 real,
intent(OUT) :: allmax
3954 real,
parameter :: rn0_r = 8.e6
3955 real,
parameter :: rn0_s = 3.e6
3956 real,
parameter :: rn0_g = 4.e6
3960 real,
parameter :: r1=1.e-15
3961 real,
parameter :: ron=8.e6
3962 real,
parameter :: ron2=1.e10
3963 real,
parameter :: son=2.e7
3964 real,
parameter :: gon=5.e7
3965 real,
parameter :: ron_min = 8.e6
3966 real,
parameter :: ron_qr0 = 0.00010
3967 real,
parameter :: ron_delqr0 = 0.25*ron_qr0
3968 real,
parameter :: ron_const1r = (ron2-ron_min)*0.5
3969 real,
parameter :: ron_const2r = (ron2+ron_min)*0.5
3972 real,
parameter :: gamma_seven = 720.
3973 real,
parameter :: koch_correction = 161.3
3975 real,
parameter :: rho_r = 1.0e3
3976 real,
parameter :: rho_s = 100.
3977 real,
parameter :: rho_g = 400.
3978 real,
parameter :: alpha = 0.224
3979 real,
parameter :: factor_r = gamma_seven * 1.e18 * (1./(
pi*rho_r))**1.75
3980 real,
parameter :: factor_s = koch_correction * 1.e18 * (1./(
pi*rho_s))**1.75 &
3981 * (rho_s/rho_r)**2 * alpha
3982 real,
parameter :: factor_g = koch_correction * 1.e18 * (1./(
pi*rho_g))**1.75 &
3983 * (rho_g/rho_r)**2 * alpha
3988 real,
parameter :: tice = 273.16
3991 real :: factorb_s, factorb_g, rhoair
3992 real :: temp_c, pres, sonv, gonv, ronv, z_e
3993 real :: qr1, qs1, qg1
3995 integer :: is, ie, js, je
4011 if (hydrostatic)
then 4012 rhoair = 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) ) )
4014 rhoair = -delp(i,j,k)/(
grav*delz(i,j,k))
4022 if (iliqskin .and. pt(i,j,k) .gt. tice)
then 4023 factorb_s=factor_s/alpha
4024 factorb_g=factor_g/alpha
4033 temp_c =
min(-0.001, pt(i,j,k) - tice)
4034 sonv =
min(2.0e8, 2.0e6*exp(-0.12*temp_c))
4054 gonv = 2.38 * (
pi * rho_g / (rhoair*qg1))**0.92
4055 gonv =
max(1.e4,
min(gonv,gon))
4064 ronv = ron_const1r * tanh((ron_qr0-qr1)/ron_delqr0) + ron_const2r
4071 z_e = factor_r * (rhoair*qr1)**1.75 / ronv**.75 &
4072 + factorb_s * (rhoair*qs1)**1.75 / sonv**.75 &
4073 + factorb_g * (rhoair*qg1)**1.75 / gonv**.75
4077 dbz(i,j,k) = 10. * log10(z_e)
4079 maxdbz(i,j) =
max(dbz(i,j,k), maxdbz(i,j))
4080 allmax =
max(dbz(i,j,k), allmax)
4093 if (atm%grid_Number > 1)
then 4094 write(
gn,
"(A2,I1)")
" g", atm%grid_number
subroutine, public eqv_pot(theta_e, pt, delp, delz, peln, pkz, q, is, ie, js, je, ng, npz, hydrostatic, moist)
subroutine cs_prof(q2, delp, q, km, i1, i2, iv)
subroutine, public get_date(time, year, month, day, hour, minute, second, tick, err_msg)
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)
real, parameter, public radius
Radius of the Earth [m].
subroutine, public set_domain(Domain2)
subroutine, public fv_diag_init(Atm, axes, Time, npx, npy, npz, p_ref)
integer, parameter, public model_atmos
type(fv_diag_type), pointer idiag
subroutine cs_interpolator(is, ie, js, je, km, qin, kd, pout, pe, id, qout, iv)
real, dimension(:,:), allocatable, public zs_g
subroutine cs3_interpolator(is, ie, js, je, km, qin, kd, pout, wz, pe, id, qout, iv)
character(len=3), public gn
real, parameter, public omega
Rotation rate of the Earth [1/s].
subroutine pv_entropy(is, ie, js, je, ng, km, vort, f_d, pt, pkz, delp, grav)
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)
real(kind=8), parameter, public pi_8
Ratio of circle circumference to diameter [N/A].
subroutine, public prt_mass(km, nq, is, ie, js, je, n_g, nwat, ps, delp, q, area, domain)
subroutine, public interpolate_vertical(is, ie, js, je, km, plev, peln, a3, a2)
real, parameter, public wtmair
Molecular weight of air [AMU].
real, parameter, public hlv
Latent heat of evaporation [J/kg].
character(len=256) tunits
integer function, public register_static_field(module_name, field_name, axes, long_name, units, missing_value, range, mask_variant, standard_name, DYNAMIC, do_not_log, interp_method, tile_count, area, volume, realm)
real, parameter, public rdgas
Gas constant for dry air [J/kg/deg].
real, public sphum_ll_fix
subroutine, public get_number_tracers(model, num_tracers, num_prog, num_diag, num_family)
subroutine, public gw_1d(km, p0, ak, bk, ptop, ztop, pt1)
real, parameter, public cp_vapor
Specific heat capacity of water vapor at constant pressure [J/kg/deg].
subroutine, public get_eta_level(npz, p_s, pf, ph, ak, bk, pscale)
subroutine get_pressure_given_height(is, ie, js, je, ng, km, wz, kd, height, ts, peln, a2, fac)
subroutine dbzcalc(q, pt, delp, peln, delz, dbz, maxdbz, allmax, bd, npz, ncnst, hydrostatic, zvir, in0r, in0s, in0g, iliqskin)
void a2b_ord2(int nx, int ny, const double *qin, const double *edge_w, const double *edge_e, const double *edge_s, const double *edge_n, double *qout, int on_west_edge, int on_east_edge, int on_south_edge, int on_north_edge)
character(len=256) tlongname
integer, parameter max_step
subroutine, public fv_diag(Atm, zvir, Time, print_freq)
real, parameter, public rvgas
Gas constant for water vapor [J/kg/deg].
integer, dimension(nplev) levs
subroutine, public a2b_ord4(qin, qout, gridstruct, npx, npy, is, ie, js, je, ng, replace)
subroutine wind_max(isc, iec, jsc, jec, isd, ied, jsd, jed, us, vs, ws_max, domain)
subroutine get_vorticity(isc, iec, jsc, jec, isd, ied, jsd, jed, npz, u, v, vort, dx, dy, rarea)
subroutine, public nullify_domain()
real, parameter, public cp_air
Specific heat capacity of dry air at constant pressure [J/kg/deg].
subroutine, public z_sum(is, ie, js, je, km, n_g, delp, q, sum2)
logical module_is_initialized
integer, parameter, public r_grid
subroutine, public fv_diag_init_gn(Atm)
subroutine, public qsmith(im, km, k1, t, p, q, qs, dqdt)
subroutine, public rh_calc(pfull, t, qv, rh, do_cmip)
subroutine, public get_height_given_pressure(is, ie, js, je, ng, km, wz, kd, id, log_p, peln, a2)
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)
real, parameter, public grav
Acceleration due to gravity [m/s^2].
real function, public g_sum(domain, p, ifirst, ilast, jfirst, jlast, ngc, area, mode, reproduce)
subroutine, public get_height_field(is, ie, js, je, ng, km, hydrostatic, delz, wz, pt, q, peln, zvir)
subroutine interpolate_z(is, ie, js, je, km, zl, hght, a3, a2)
subroutine, public get_tracer_names(model, n, name, longname, units, err_msg)
subroutine init_mq(phis, gridstruct, npx, npy, is, ie, js, je, ng)
subroutine, public prt_mxm(qname, q, is, ie, js, je, n_g, km, fac, area, domain)
subroutine, public prt_maxmin(qname, q, is, ie, js, je, n_g, km, fac)
real(kind=4), public e_flux
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)
subroutine, public ppme(p, qe, delp, im, km)
real function p_sum(is, ie, js, je, km, n_g, delp, area, domain)
real, parameter, public wtmco2
Molecular weight of carbon dioxide [AMU].
subroutine, public get_time(Time, seconds, days, ticks, err_msg)
logical, public prt_minmax
real, parameter, public kappa
RDGAS / CP_AIR [dimensionless].
subroutine, public range_check(qname, q, is, ie, js, je, n_g, km, pos, q_low, q_hi, bad_range)
type(time_type), public fv_time
real, parameter missing_value
real(fp), parameter, public pi