21 #define _GET_VAR1 get_var1_real 23 #define _GET_VAR1 get_var1_double 31 use fms_mod,
only: write_version_number, open_namelist_file, &
43 use fv_mp_nlm_mod,
only: mp_reduce_sum, mp_reduce_min, mp_reduce_max, is_master
53 real(kind=R_GRID),
parameter ::
radius = cnst_radius
85 real,
allocatable::
s2c(:,:,:)
89 real(KIND=4),
allocatable,
dimension(:,:,:)::
gz3 90 real,
allocatable::
gz0(:,:)
206 integer :: is, ie, js, je
211 k_breed,
k_trop,
p_trop,
dps_min,
kord_data,
tc_mask,
nudge_debug,
nf_ps,
nf_t,
nf_ht, &
221 subroutine fv_nwp_nudge ( Time, dt, npx, npy, npz, ps_dt, u_dt, v_dt, t_dt, q_dt, zvir, ptop, &
222 ak, bk, ts, ps, delp, ua, va, pt, nwat, q, phis, gridstruct, &
226 integer,
intent(IN):: npx, npy
227 integer,
intent(in):: npz
228 integer,
intent(in):: nwat
229 real,
intent(in):: dt
230 real,
intent(in):: zvir, ptop
231 type(
domain2d),
intent(INOUT),
target :: domain
233 real,
intent(in ),
dimension(npz+1):: ak, bk
234 real,
intent(in ),
dimension(isd:ied,jsd:jed ):: phis
235 real,
intent(inout),
dimension(isd:ied,jsd:jed,npz):: pt, ua, va, delp
238 real,
intent(inout),
dimension(isd:ied,jsd:jed):: ps
240 real,
intent(inout),
dimension(isd:ied,jsd:jed,npz):: u_dt, v_dt
241 real,
intent(out),
dimension(is:ie,js:je,npz):: t_dt, q_dt
242 real,
intent(out),
dimension(is:ie,js:je):: ps_dt, ts
246 real:: h2(is:ie,js:je)
247 real:: m_err(is:ie,js:je)
248 real:: slp_n(is:ie,js:je)
249 real:: slp_m(is:ie,js:je)
250 real:: mask(is:ie,js:je)
251 real:: tv(is:ie,js:je)
252 real:: peln(is:ie,npz+1)
253 real:: pe2(is:ie, npz+1)
255 real,
allocatable :: ps_obs(:,:)
256 real,
allocatable,
dimension(:,:,:):: u_obs, v_obs, t_obs, q_obs
257 real,
allocatable,
dimension(:,:,:):: du_obs, dv_obs
258 real:: ps_fac(is:ie,js:je)
259 integer :: seconds, days
260 integer :: i,j,k, iq, kht
261 real :: factor, rms, bias, co
262 real :: rdt, press(npz), profile(npz), prof_t(npz), prof_q(npz), du, dv
266 real(kind=R_GRID),
pointer,
dimension(:,:,:) :: agrid
267 real,
pointer,
dimension(:,:) :: rarea, area
269 real,
pointer,
dimension(:,:) :: sina_u, sina_v
270 real,
pointer,
dimension(:,:,:) :: sin_sg
271 real(kind=R_GRID),
pointer,
dimension(:,:,:) :: vlon, vlat
273 real,
pointer,
dimension(:,:) :: dx, dy, rdxc, rdyc
275 real(kind=R_GRID),
pointer :: da_min
277 logical,
pointer :: nested, sw_corner, se_corner, nw_corner, ne_corner
280 call mpp_error(fatal,
'==> Error from fv_nwp_nudge: module not initialized')
282 agrid => gridstruct%agrid_64
283 area => gridstruct%area
284 rarea => gridstruct%rarea
286 vlon => gridstruct%vlon
287 vlat => gridstruct%vlat
288 sina_u => gridstruct%sina_u
289 sina_v => gridstruct%sina_v
290 sin_sg => gridstruct%sin_sg
294 rdxc => gridstruct%rdxc
295 rdyc => gridstruct%rdyc
297 da_min => gridstruct%da_min
299 nested => gridstruct%nested
300 sw_corner => gridstruct%sw_corner
301 se_corner => gridstruct%se_corner
302 nw_corner => gridstruct%nw_corner
303 ne_corner => gridstruct%ne_corner
307 forecast_mode = .true.
328 press(k) = 0.5*(ak(k) + ak(k+1)) + 0.5*(bk(k)+bk(k+1))*1.e5
334 if( press(k) <
p_norelax ) profile(k) = 0.0
342 if ( press(k) < 10.e2 )
then 343 prof_t(k) =
max(0.01, press(k)/10.e2)
352 if ( press(k) < 300.e2 )
then 353 prof_q(k) =
max(0., press(k)/300.e2)
362 ptmp = ak(k+1) + bk(k+1)*1.e5
378 factor =
max(1.e-5, factor)
385 allocate (ps_obs(is:ie,js:je) )
386 allocate ( t_obs(is:ie,js:je,npz) )
387 allocate ( q_obs(is:ie,js:je,npz) )
390 allocate (u_obs(is:ie,js:je,npz) )
391 allocate (v_obs(is:ie,js:je,npz) )
395 call get_obs(time, dt, zvir, ak, bk, ps, ts, ps_obs, delp, pt, nwat, q, u_obs, v_obs, t_obs, q_obs, &
396 phis, ua, va, u_dt, v_dt, npx, npy, npz, factor, mask, ptop, bd, gridstruct, domain)
408 forecast_mode = .true.
415 if ( abs(ps(i,j)-ps_obs(i,j)) > 2.e2 )
then 416 ps_fac(i,j) = 2.e2 / abs(ps(i,j)-ps_obs(i,j))
429 tv(i,j) = pt(i,j,npz)*(1.+zvir*q(i,j,npz,1))
432 call compute_slp(is, ie, js, je, tv, ps(is:ie,js:je), phis(is:ie,js:je), slp_m)
433 call compute_slp(is, ie, js, je, t_obs(is,js,npz), ps_obs,
gz0, slp_n)
436 if(
master)
write(*,*)
'kht=', kht
437 call prt_maxmin(
'PS_o', ps_obs, is, ie, js, je, 0, 1, 0.01)
438 ptmp = 0.01*
g0_sum(ps_obs, is, ie, js, je, 1, .false.,
isd,
ied,
jsd,
jed, area)
439 if(
master)
write(*,*)
'Mean PS_o=', ptmp
440 call prt_maxmin(
'SLP_m', slp_m, is, ie, js, je, 0, 1, 0.01)
441 call prt_maxmin(
'SLP_o', slp_n, is, ie, js, je, 0, 1, 0.01)
447 if ( abs(phis(i,j)-
gz0(i,j))/
grav > 2. )
then 448 m_err(i,j) = mask(i,j)*(slp_m(i,j) - slp_n(i,j))*2.*
grav/abs(phis(i,j)-
gz0(i,j))
450 m_err(i,j) = mask(i,j)*(slp_m(i,j) - slp_n(i,j))
456 call corr(slp_m, slp_n, co, area)
458 call prt_maxmin(
'SLP Error (mb)=', m_err, is, ie, js, je, 0, 1, 0.01)
459 if(
master)
write(*,*)
'SLP (Pa): RMS=', rms,
' Bias=', bias
460 if(
master)
write(*,*)
'SLP correlation=',co
465 allocate (du_obs(is:ie,js:je,npz) )
466 allocate (dv_obs(is:ie,js:je,npz) )
478 du_obs(i,j,k) = profile(k)*(u_obs(i,j,k)-ua(i,j,k))*rdt
479 dv_obs(i,j,k) = profile(k)*(v_obs(i,j,k)-va(i,j,k))*rdt
492 du_obs(i,j,k) = du_obs(i,j,k) * mask(i,j) * ps_fac(i,j)
493 dv_obs(i,j,k) = dv_obs(i,j,k) * mask(i,j) * ps_fac(i,j)
495 u_dt(i,j,k) = u_dt(i,j,k) + du_obs(i,j,k)
496 v_dt(i,j,k) = v_dt(i,j,k) + dv_obs(i,j,k)
497 ua(i,j,k) = ua(i,j,k) + du_obs(i,j,k)*dt
498 va(i,j,k) = va(i,j,k) + dv_obs(i,j,k)*dt
505 du_obs(i,j,k) = du_obs(i,j,k) * mask(i,j)
506 dv_obs(i,j,k) = dv_obs(i,j,k) * mask(i,j)
508 u_dt(i,j,k) = u_dt(i,j,k) + du_obs(i,j,k)
509 v_dt(i,j,k) = v_dt(i,j,k) + dv_obs(i,j,k)
510 ua(i,j,k) = ua(i,j,k) + du_obs(i,j,k)*dt
511 va(i,j,k) = va(i,j,k) + dv_obs(i,j,k)*dt
535 t_dt(i,j,k) = prof_t(k)*(t_obs(i,j,k)/(1.+zvir*q(i,j,k,1))-pt(i,j,k))*rdt*ps_fac(i,j)
541 t_dt(i,j,k) = prof_t(k)*(t_obs(i,j,k)/(1.+zvir*q(i,j,k,1))-pt(i,j,k))*rdt
560 pe2(i,k+1) = pe2(i,k) + delp(i,j,k)
565 peln(i,k) = log(pe2(i,k))
572 h2(i,j) = h2(i,j) + (t_obs(i,j,k)-pt(i,j,k)*(1.+zvir*q(i,j,k,1)))*(peln(i,k+1)-peln(i,k))
576 h2(i,j) = h2(i,j) / (peln(i,npz+1)-peln(i,kht+1))
577 h2(i,j) = rdt*ps_fac(i,j)*h2(i,j)*mask(i,j)
582 t_dt(i,j,k) = h2(i,j) / (1.+zvir*q(i,j,k,1))
595 pt(i,j,k) = pt(i,j,k) + t_dt(i,j,k)*dt*mask(i,j)
603 rdt = 1./(
tau_q/factor + dt)
607 if ( press(k) >
p_wvp )
then 611 q(i,j,k,iq) = q(i,j,k,iq)*delp(i,j,k)
618 delp(i,j,k) = delp(i,j,k)*(1.-q(i,j,k,1))
619 q_dt(i,j,k) = prof_q(k)*(
max(
q_min,q_obs(i,j,k))-q(i,j,k,1))*rdt*mask(i,j)
620 q(i,j,k,1) = q(i,j,k,1) + q_dt(i,j,k)*dt
621 delp(i,j,k) = delp(i,j,k)/(1.-q(i,j,k,1))
627 q(i,j,k,iq) = q(i,j,k,iq)/delp(i,j,k)
639 deallocate ( ps_obs )
642 call breed_srf_winds(time, dt, npz, u_obs, v_obs, ak, bk, ps, phis, delp, ua, va, u_dt, v_dt, pt, q, nwat, zvir, gridstruct)
645 call prt_maxmin(
'T increment=', t_dt, is, ie, js, je, 0, npz, dt)
646 call prt_maxmin(
'U increment=', du_obs, is, ie, js, je, 0, npz, dt)
647 call prt_maxmin(
'V increment=', dv_obs, is, ie, js, je, 0, npz, dt)
683 subroutine ps_nudging(dt, factor, npz, ak, bk, ps_obs, mask, tm, ps, phis, delp, ua, va, pt, nwat, q, bd, npx, npy, gridstruct, domain)
685 real,
intent(in):: dt, factor
686 integer,
intent(in):: npz, nwat, npx, npy
687 real,
intent(in),
dimension(npz+1):: ak, bk
688 type(fv_grid_bounds_type),
intent(IN) :: bd
689 real,
intent(in):: phis(isd:ied,jsd:jed)
690 real,
intent(in),
dimension(is:ie,js:je):: ps_obs, mask, tm
691 type(fv_grid_type),
intent(IN),
target :: gridstruct
692 type(domain2d),
intent(INOUT) :: domain
694 real,
intent(inout),
dimension(isd:ied,jsd:jed):: ps
695 real,
intent(inout),
dimension(isd:ied,jsd:jed,npz):: delp, pt, ua, va
696 real,
intent(inout):: q(isd:ied,jsd:jed,npz,nwat)
698 real,
dimension(is:ie,js:je):: ps_dt
699 integer,
parameter:: kmax = 100
700 real:: pn0(kmax+1), pk0(kmax+1)
701 real,
dimension(is:ie,npz+1):: pe2, peln
702 real:: pst, dbk, pt0, rdt, bias
705 real,
pointer,
dimension(:,:) :: area
707 area => gridstruct%area
710 if ( kmax <
km )
call mpp_error(fatal,
'==> KMAX must be larger than km')
717 if( phis(i,j)>
gz0(i,j) )
then 719 if( phis(i,j)<
gz3(i,j,k) .and. phis(i,j) >=
gz3(i,j,k+1) )
then 720 pst = pk0(k) + (pk0(k+1)-pk0(k))*(
gz3(i,j,k)-phis(i,j))/(
gz3(i,j,k)-
gz3(i,j,k+1))
726 pn0(
km+1) = log(ps_obs(i,j))
728 pt0 = tm(i,j)/(pk0(
km+1)-pk0(
km))*(
kappa*(pn0(
km+1)-pn0(
km)))
729 pst = pk0(
km+1) + (
gz0(i,j)-phis(i,j))/(
cp_air*pt0)
731 666 ps_dt(i,j) = pst**(1./
kappa) - ps(i,j)
739 ps_dt(i,j) = sign(
min(10.e2, abs(ps_dt(i,j))), ps_dt(i,j) )
740 ps_dt(i,j) = mask(i,j)*ps_dt(i,j) *
max( 0., 1.-abs(
gz0(i,j)-phis(i,j))/(
grav*500.) )
752 q(i,j,k,iq) = q(i,j,k,iq) * delp(i,j,k)
761 ua(i,j,k) = ua(i,j,k) * delp(i,j,k)
762 va(i,j,k) = va(i,j,k) * delp(i,j,k)
770 peln(i,1) = log(pe2(i,1))
774 pe2(i,k) = pe2(i,k-1) + delp(i,j,k-1)
775 peln(i,k) = log(pe2(i,k))
780 pt(i,j,k) = pt(i,j,k)*(peln(i,k+1)-peln(i,k))
793 rdt = dt / (
tau_ps/factor + dt)
795 dbk = rdt*(bk(k+1) - bk(k))
798 delp(i,j,k) = delp(i,j,k) + dbk*ps_dt(i,j)
799 ps(i,j) = delp(i,j,k) + ps(i,j)
808 pe2(i,k) = pe2(i,k-1) + delp(i,j,k-1)
809 peln(i,k) = log(pe2(i,k))
814 pt(i,j,k) = pt(i,j,k)/(peln(i,k+1)-peln(i,k))
824 q(i,j,k,iq) = q(i,j,k,iq) / delp(i,j,k)
833 ua(i,j,k) = ua(i,j,k) / delp(i,j,k)
834 va(i,j,k) = va(i,j,k) / delp(i,j,k)
843 integer,
intent(IN) :: is, ie, js, je
844 integer,
intent(IN) :: isd, ied, jsd,jed
845 real,
intent(inout):: ps_dt(is:ie,js:je)
846 real,
intent(IN),
dimension(isd:ied,jsd:jed) :: area
848 real:: esl, total_area
855 bias =
g0_sum(ps_dt, is, ie, js, je, 1, .true., isd, ied, jsd, jed, area)
857 if ( abs(bias) < esl )
then 858 if(
master .and.
nudge_debug)
write(*,*)
'Very small PS bias=', -bias,
' No bais adjustment' 864 if ( bias > 0. )
then 868 if ( ps_dt(i,j) > 0. )
then 869 psum = psum + area(i,j)
874 call mp_reduce_sum( psum )
875 bias = bias * total_area / psum
879 if ( ps_dt(i,j) > 0.0 )
then 880 ps_dt(i,j) =
max(0.0, ps_dt(i,j) - bias)
888 if ( ps_dt(i,j) < 0. )
then 889 psum = psum + area(i,j)
894 call mp_reduce_sum( psum )
895 bias = bias * total_area / psum
899 if ( ps_dt(i,j) < 0.0 )
then 900 ps_dt(i,j) =
min(0.0, ps_dt(i,j) - bias)
909 real function g0_sum(p, ifirst, ilast, jfirst, jlast, mode, reproduce, isd, ied, jsd, jed, area)
911 integer,
intent(IN) :: ifirst, ilast
912 integer,
intent(IN) :: jfirst, jlast
913 integer,
intent(IN) :: mode
914 logical,
intent(IN) :: reproduce
915 real,
intent(IN) :: p(ifirst:ilast,jfirst:jlast)
925 gsum = gsum + p(i,j)*area(i,j)
929 call mp_reduce_sum(gsum)
937 if ( reproduce )
g0_sum =
real(g0_sum, 4) 942 subroutine compute_slp(isc, iec, jsc, jec, tm, ps, gz, slp)
943 integer,
intent(in):: isc, iec, jsc, jec
944 real,
intent(in),
dimension(isc:iec,jsc:jec):: tm, ps, gz
946 real,
intent(out):: slp(isc:iec,jsc:jec)
951 slp(i,j) = ps(i,j) * exp( gz(i,j)/(
rdgas*(tm(i,j) + 3.25e-3*gz(i,j)/
grav)) )
958 subroutine get_obs(Time, dt, zvir, ak, bk, ps, ts, ps_obs, delp, pt, nwat, q, u_obs, v_obs, t_obs, q_obs, &
959 phis, ua, va, u_dt, v_dt, npx, npy, npz, factor, mask, ptop, bd, gridstruct, domain)
960 type(time_type),
intent(in):: Time
961 integer,
intent(in):: npz, nwat, npx, npy
962 real,
intent(in):: zvir, ptop
963 real,
intent(in):: dt, factor
964 real,
intent(in),
dimension(npz+1):: ak, bk
965 type(fv_grid_bounds_type),
intent(IN) :: bd
966 real,
intent(in),
dimension(isd:ied,jsd:jed):: phis
967 real,
intent(in),
dimension(is:ie,js:je):: mask
968 real,
intent(inout),
dimension(isd:ied,jsd:jed):: ps
969 real,
intent(inout),
dimension(isd:ied,jsd:jed,npz):: delp, pt, ua, va, u_dt, v_dt
970 real,
intent(inout)::q(isd:ied,jsd:jed,npz,*)
971 real,
intent(out),
dimension(is:ie,js:je):: ts, ps_obs
972 real,
intent(out),
dimension(is:ie,js:je,npz):: u_obs, v_obs, t_obs, q_obs
973 type(fv_grid_type),
intent(IN) :: gridstruct
974 type(domain2d),
intent(INOUT) :: domain
976 real:: tm(is:ie,js:je)
977 real(KIND=4),
allocatable,
dimension(:,:,:):: ut, vt, wt
978 real,
allocatable,
dimension(:,:,:):: uu, vv
979 integer :: seconds, days
986 seconds = seconds - nint(dt)
998 forecast_mode = .true.
1002 if (
master)
write(*,*)
'*** L-S nudging Ended at', days, seconds
1019 call get_ncep_analysis (
ps_dat(:,:,2),
u_dat(:,:,:,2),
v_dat(:,:,:,2), &
1033 if ( beta < 0. .or. beta > (1.+1.e-7) )
then 1034 if (
master)
write(*,*)
'Nudging: beta=', beta
1035 call mpp_error(fatal,
'==> Error from get_obs:data out of range')
1041 beta = 1.; alpha = 0.
1042 if(
nudge_debug .and.
master)
write(*,*)
'Doing final adiabatic initialization/nudging' 1056 allocate ( wt(is:ie,js:je,
km) )
1057 wt(:,:,:) = alpha*
t_dat(:,:,:,1) + beta*
t_dat(:,:,:,2)
1059 call get_int_hght(npz, ak, bk, ps(is:ie,js:je), delp, ps_obs(is:ie,js:je), wt)
1062 tm(i,j) = wt(i,j,
km)
1067 allocate ( uu(isd:ied,jsd:jed,npz) )
1068 allocate ( vv(isd:ied,jsd:jed,npz) )
1071 call ps_nudging(dt, factor, npz, ak, bk, ps_obs, mask, tm, ps, phis, delp, uu, vv, pt, nwat, q, bd, npx, npy, gridstruct, domain)
1075 u_dt(i,j,k) = u_dt(i,j,k) + (uu(i,j,k) - ua(i,j,k)) / dt
1076 v_dt(i,j,k) = v_dt(i,j,k) + (vv(i,j,k) - va(i,j,k)) / dt
1084 allocate ( ut(is:ie,js:je,npz) )
1085 allocate ( vt(is:ie,js:je,npz) )
1089 call remap_uv(npz, ak, bk, ps(is:ie,js:je), delp, ut, vt, &
1090 km,
ps_dat(is:ie,js:je,1),
u_dat(:,:,:,1),
v_dat(:,:,:,1), ptop )
1092 u_obs(:,:,:) = alpha*ut(:,:,:)
1093 v_obs(:,:,:) = alpha*vt(:,:,:)
1095 call remap_uv(npz, ak, bk, ps(is:ie,js:je), delp, ut, vt, &
1096 km,
ps_dat(is:ie,js:je,2),
u_dat(:,:,:,2),
v_dat(:,:,:,2), ptop )
1098 u_obs(:,:,:) = u_obs(:,:,:) + beta*ut(:,:,:)
1099 v_obs(:,:,:) = v_obs(:,:,:) + beta*vt(:,:,:)
1102 call remap_tq(npz, ak, bk, ps(is:ie,js:je), delp, ut, vt, &
1103 km,
ps_dat(is:ie,js:je,1),
t_dat(:,:,:,1),
q_dat(:,:,:,1), zvir, ptop)
1105 t_obs(:,:,:) = alpha*ut(:,:,:)
1106 q_obs(:,:,:) = alpha*vt(:,:,:)
1108 call remap_tq(npz, ak, bk, ps(is:ie,js:je), delp, ut, vt, &
1109 km,
ps_dat(is:ie,js:je,2),
t_dat(:,:,:,2),
q_dat(:,:,:,2), zvir, ptop)
1111 t_obs(:,:,:) = t_obs(:,:,:) + beta*ut(:,:,:)
1112 q_obs(:,:,:) = q_obs(:,:,:) + beta*vt(:,:,:)
1120 subroutine fv_nwp_nudge_init(time, axes, npz, zvir, ak, bk, ts, phis, gridstruct, ks, npx, neststruct, bd)
1121 character(len=17) :: mod_name =
'fv_nudge' 1123 integer,
intent(in):: axes(4)
1124 integer,
intent(in):: npz
1125 real,
intent(in):: zvir
1127 real,
intent(in),
dimension(bd%isd:bd%ied,bd%jsd:bd%jed):: phis
1128 real,
intent(in),
dimension(npz+1):: ak, bk
1129 real,
intent(out),
dimension(bd%is:bd%ie,bd%js:bd%je):: ts
1131 integer,
intent(in) :: ks, npx
1134 real :: missing_value = -1.e10
1137 integer :: i, j, j1, f_unit, unit, io, ierr, nt, k
1141 integer :: input_fname_unit
1142 character(len=128) :: fname_tmp
1145 real,
pointer,
dimension(:,:,:) :: agrid
1158 agrid => gridstruct%agrid
1165 if (neststruct%nested)
then 1167 grid_size = 1.e7/(neststruct%npx_global*neststruct%refinement_of_global)
1178 if( file_exist(
'input.nml' ) )
then 1179 unit = open_namelist_file()
1181 do while ( io .ne. 0 )
1182 read( unit, nml = fv_nwp_nudge_nml, iostat = io, end = 10 )
1185 10
call close_file ( unit )
1190 write( f_unit, nml = fv_nwp_nudge_nml )
1191 write(*,*)
'NWP nudging initialized.' 1195 input_fname_unit = get_unit()
1200 do while ( io .eq. 0 )
1201 read ( input_fname_unit,
'(a)', iostat = io, end = 101 ) fname_tmp
1202 if( trim(fname_tmp) .ne.
"" )
then 1215 if( nt .eq. 1 )
then 1218 write(*,*)
'From NCEP file list: ', nt,
file_names(nt)
1226 if( nt .eq. 1 )
then 1229 write(*,*)
'From NCEP file list: ', nt,
file_names(nt)
1236 101
close( input_fname_unit )
1241 if (
file_names(nt) ==
"No_File_specified" )
then 1249 'height_error',
'DEG K', missing_value=missing_value )
1265 if(
master)
write(*,*)
'NCEP analysis dimensions:',
im,
jm,
km 1267 allocate (
s2c(is:ie,js:je,4) )
1268 allocate (
id1(is:ie,js:je) )
1269 allocate (
id2(is:ie,js:je) )
1270 allocate (
jdc(is:ie,js:je) )
1272 allocate (
lon(
im) )
1273 allocate (
lat(
jm) )
1275 call _get_var1 (ncid,
'lon',
im,
lon )
1276 call _get_var1 (ncid,
'lat',
jm,
lat )
1286 allocate (
ak0(
km+1) )
1287 allocate (
bk0(
km+1) )
1289 call _get_var1 (ncid,
'hyai',
km+1,
ak0, found )
1290 if ( .not. found )
ak0(:) = 0.
1292 call _get_var1 (ncid,
'hybi',
km+1,
bk0 )
1302 write(*,*) k, 0.5*(ak(k)+ak(k+1))+0.5*(bk(k)+bk(k+1))*1.e5,
'del-B=', bk(k+1)-bk(k)
1325 allocate (
gz0(is:ie,js:je) )
1326 allocate (
gz3(is:ie,js:je,
km+1) )
1327 allocate (
ps_dat(is:ie,js:je,2) )
1328 allocate (
u_dat(is:ie,js:je,
km,2) )
1329 allocate (
v_dat(is:ie,js:je,
km,2) )
1330 allocate (
t_dat(is:ie,js:je,
km,2) )
1331 allocate (
q_dat(is:ie,js:je,
km,2) )
1337 call get_ncep_analysis (
ps_dat(:,:,nt),
u_dat(:,:,:,nt),
v_dat(:,:,:,nt), &
1350 real,
intent(in):: zvir
1351 character(len=128),
intent(in):: fname
1352 integer,
intent(inout):: nfile
1354 type(fv_grid_bounds_type),
intent(IN) :: bd
1355 real,
intent(out),
dimension(is:ie,js:je):: ts, ps
1356 real(KIND=4),
intent(out),
dimension(is:ie,js:je,km):: u, v, t, q
1358 real(kind=4),
allocatable:: wk0(:,:), wk1(:,:), wk2(:,:), wk3(:,:,:)
1360 integer:: i, j, k, npt
1361 integer:: i1, i2, j1, ncid
1363 logical:: read_ts = .true.
1364 logical:: land_ts = .false.
1366 integer:: status, var3id
1367 #include <netcdf.inc> 1370 if( .not. file_exist(fname) )
then 1371 call mpp_error(fatal,
'==> Error from get_ncep_analysis: file not found')
1374 if(
master)
write(*,*)
'Reading NCEP anlysis file:', fname
1378 allocate ( wk1(
im,
jm) )
1383 if ( .not. land_ts )
then 1384 allocate ( wk0(
im,
jm) )
1388 status = nf_inq_varid(ncid,
'ORO', var3id)
1389 if (status .eq. nf_noerr)
then 1393 status = nf_inq_varid(ncid,
'LAND', var3id)
1394 if (status .eq. nf_noerr)
then 1397 call mpp_error(fatal,
'Neither ORO nor LAND exists in re-analysis data')
1406 if( abs(wk0(i,j)-1.) > 0.99 )
then 1407 tmean = tmean + wk1(i,j)
1414 if ( npt /= 0 )
then 1415 tmean= tmean /
real(npt)
1417 if( abs(wk0(i,j)-1.) <= 0.99 )
then 1420 elseif ( i==
im )
then 1425 if ( abs(wk0(i2,j)-1.)>0.99 )
then 1426 wk1(i,j) = wk1(i2,j)
1427 elseif ( abs(wk0(i1,j)-1.)>0.99 )
then 1428 wk1(i,j) = wk1(i1,j)
1444 ts(i,j) =
s2c(i,j,1)*wk1(i1,j1 ) +
s2c(i,j,2)*wk1(i2,j1 ) + &
1445 s2c(i,j,3)*wk1(i2,j1+1) +
s2c(i,j,4)*wk1(i1,j1+1)
1448 call prt_maxmin(
'SST_model', ts, is, ie, js, je, 0, 1, 1.)
1453 if(
master)
call pmaxmin(
'SST_ncep', sst_ncep, i_sst, j_sst, 1.)
1457 if (
master)
write(*,*)
'Done processing NCEP SST' 1473 ps(i,j) =
s2c(i,j,1)*wk2(i1,j1 ) +
s2c(i,j,2)*wk2(i2,j1 ) + &
1474 s2c(i,j,3)*wk2(i2,j1+1) +
s2c(i,j,4)*wk2(i1,j1+1)
1480 status = nf_inq_varid(ncid,
'PHIS', var3id)
1481 if (status .eq. nf_noerr)
then 1485 status = nf_inq_varid(ncid,
'PHI', var3id)
1486 if (status .eq. nf_noerr)
then 1490 call mpp_error(fatal,
'Neither PHIS nor PHI exists in re-analysis data')
1501 gz0(i,j) =
s2c(i,j,1)*wk2(i1,j1 ) +
s2c(i,j,2)*wk2(i2,j1 ) + &
1502 s2c(i,j,3)*wk2(i2,j1+1) +
s2c(i,j,4)*wk2(i1,j1+1)
1522 u(i,j,k) =
s2c(i,j,1)*wk3(i1,j1 ,k) +
s2c(i,j,2)*wk3(i2,j1 ,k) + &
1523 s2c(i,j,3)*wk3(i2,j1+1,k) +
s2c(i,j,4)*wk3(i1,j1+1,k)
1536 v(i,j,k) =
s2c(i,j,1)*wk3(i1,j1 ,k) +
s2c(i,j,2)*wk3(i2,j1 ,k) + &
1537 s2c(i,j,3)*wk3(i2,j1+1,k) +
s2c(i,j,4)*wk3(i1,j1+1,k)
1553 q(i,j,k) =
s2c(i,j,1)*wk3(i1,j1 ,k) +
s2c(i,j,2)*wk3(i2,j1 ,k) + &
1554 s2c(i,j,3)*wk3(i2,j1+1,k) +
s2c(i,j,4)*wk3(i1,j1+1,k)
1568 t(i,j,k) =
s2c(i,j,1)*wk3(i1,j1 ,k) +
s2c(i,j,2)*wk3(i2,j1 ,k) + &
1569 s2c(i,j,3)*wk3(i2,j1+1,k) +
s2c(i,j,4)*wk3(i1,j1+1,k)
1581 t(i,j,k) = t(i,j,k)*(1.+zvir*q(i,j,k))
1598 real,
intent(IN),
dimension(isd:ied,jsd:jed,2) :: agrid
1604 integer i,j, i1, i2, jc, i0, j0
1607 rdlon(i) = 1. / (
lon(i+1) -
lon(i))
1609 rdlon(im) = 1. / (
lon(1) + 2.*
pi -
lon(im))
1612 rdlat(j) = 1. / (
lat(j+1) -
lat(j))
1620 if ( agrid(i,j,1)>
lon(im) )
then 1622 a1 = (agrid(i,j,1)-
lon(im)) * rdlon(im)
1623 elseif ( agrid(i,j,1)<
lon(1) )
then 1625 a1 = (agrid(i,j,1)+2.*
pi-
lon(im)) * rdlon(im)
1628 if ( agrid(i,j,1)>=
lon(i0) .and. agrid(i,j,1)<=
lon(i0+1) )
then 1630 a1 = (agrid(i,j,1)-
lon(i1)) * rdlon(i0)
1637 if ( agrid(i,j,2)<
lat(1) )
then 1640 elseif ( agrid(i,j,2)>
lat(jm) )
then 1645 if ( agrid(i,j,2)>=
lat(j0) .and. agrid(i,j,2)<=
lat(j0+1) )
then 1647 b1 = (agrid(i,j,2)-
lat(jc)) * rdlat(jc)
1654 if ( a1<0.0 .or. a1>1.0 .or. b1<0.0 .or. b1>1.0 )
then 1655 write(*,*)
'gid=', mpp_pe(), i,j,a1, b1
1658 s2c(i,j,1) = (1.-a1) * (1.-b1)
1659 s2c(i,j,2) = a1 * (1.-b1)
1660 s2c(i,j,3) = a1 * b1
1661 s2c(i,j,4) = (1.-a1) * b1
1673 real(kind=4),
intent(in):: sst(im,jm)
1680 real:: c1, c2, c3, c4
1681 integer i,j, i1, i2, jc, i0, j0, it, jt
1684 rdlon(i) = 1. / (
lon(i+1) -
lon(i))
1686 rdlon(im) = 1. / (
lon(1) + 2.*
pi -
lon(im))
1689 rdlat(j) = 1. / (
lat(j+1) -
lat(j))
1696 delx = 360./
real(i_sst) 1697 dely = 180./
real(j_sst) 1702 yc = (-90. + dely * (0.5+
real(j-1))) * deg2rad
1703 if ( yc<
lat(1) )
then 1706 elseif ( yc>
lat(jm) )
then 1711 if ( yc>=
lat(j0) .and. yc<=
lat(j0+1) )
then 1714 b1 = (yc-
lat(jc)) * rdlat(jc)
1723 xc = delx * (0.5+
real(i-1)) * deg2rad
1724 if ( xc>
lon(im) )
then 1726 a1 = (xc-
lon(im)) * rdlon(im)
1727 elseif ( xc<
lon(1) )
then 1729 a1 = (xc+2.*
pi-
lon(im)) * rdlon(im)
1732 if ( xc>=
lon(i0) .and. xc<=
lon(i0+1) )
then 1735 a1 = (xc-
lon(i1)) * rdlon(i0)
1745 c1 = (1.-a1) * (1.-b1)
1750 sst_ncep(i,j) = c1*sst(i1,jc ) + c2*sst(i2,jc ) + &
1751 c3*sst(i2,jc+1) + c4*sst(i1,jc+1)
1758 subroutine get_int_hght(npz, ak, bk, ps, delp, ps0, tv)
1759 integer,
intent(in):: npz
1760 real,
intent(in):: ak(npz+1), bk(npz+1)
1761 real,
intent(in),
dimension(is:ie,js:je):: ps, ps0
1762 real,
intent(in),
dimension(isd:ied,jsd:jed,npz):: delp
1763 real(KIND=4),
intent(in),
dimension(is:ie,js:je,km):: tv
1765 real,
dimension(is:ie,km+1):: pn0
1774 pn0(i,k) = log(
ak0(k) +
bk0(k)*ps0(i,j) )
1783 gz3(i,j,k) =
gz3(i,j,k+1) +
rdgas*tv(i,j,k)*(pn0(i,k+1)-pn0(i,k))
1793 subroutine remap_tq( npz, ak, bk, ps, delp, t, q, &
1794 kmd, ps0, ta, qa, zvir, ptop)
1795 integer,
intent(in):: npz, kmd
1796 real,
intent(in):: zvir, ptop
1797 real,
intent(in):: ak(npz+1), bk(npz+1)
1798 real,
intent(in),
dimension(is:ie,js:je):: ps0
1799 real,
intent(inout),
dimension(is:ie,js:je):: ps
1800 real,
intent(in),
dimension(isd:ied,jsd:jed,npz):: delp
1801 real(KIND=4),
intent(in),
dimension(is:ie,js:je,kmd):: ta, qa
1802 real(KIND=4),
intent(out),
dimension(is:ie,js:je,npz):: t
1805 real(KIND=4),
intent(out),
dimension(is:ie,js:je,npz):: q
1807 real,
dimension(is:ie,kmd):: tp, qp
1808 real,
dimension(is:ie,kmd+1):: pe0, pn0
1809 real,
dimension(is:ie,npz):: qn1
1810 real,
dimension(is:ie,npz+1):: pe1, pn1
1817 pe0(i,k) =
ak0(k) +
bk0(k)*ps0(i,j)
1818 pn0(i,k) = log(pe0(i,k))
1829 pe1(i,k+1) = pe1(i,k) + delp(i,j,k)
1833 ps(i,j) = pe1(i,npz+1)
1837 pn1(i,k) = log(pe1(i,k))
1847 call mappm(kmd, pe0, qp, npz, pe1, qn1, is,ie, 0,
kord_data, ptop)
1860 call mappm(kmd, pn0, tp, npz, pn1, qn1, is,ie, 1,
kord_data, ptop)
1873 subroutine remap_uv(npz, ak, bk, ps, delp, u, v, kmd, ps0, u0, v0, ptop)
1874 integer,
intent(in):: npz
1875 real,
intent(IN):: ptop
1876 real,
intent(in):: ak(npz+1), bk(npz+1)
1877 real,
intent(inout):: ps(is:ie,js:je)
1878 real,
intent(in),
dimension(isd:ied,jsd:jed,npz):: delp
1879 real(KIND=4),
intent(inout),
dimension(is:ie,js:je,npz):: u, v
1881 integer,
intent(in):: kmd
1882 real,
intent(in):: ps0(is:ie,js:je)
1883 real(KIND=4),
intent(in),
dimension(is:ie,js:je,kmd):: u0, v0
1886 real,
dimension(is:ie,kmd+1):: pe0
1887 real,
dimension(is:ie,npz+1):: pe1
1888 real,
dimension(is:ie,kmd):: qt
1889 real,
dimension(is:ie,npz):: qn1
1898 pe0(i,k) =
ak0(k) +
bk0(k)*ps0(i,j)
1909 pe1(i,k+1) = pe1(i,k) + delp(i,j,k)
1913 ps(i,j) = pe1(i,npz+1)
1923 call mappm(kmd, pe0, qt, npz, pe1, qn1, is,ie, -1,
kord_data, ptop)
1937 call mappm(kmd, pe0, qt, npz, pe1, qn1, is,ie, -1,
kord_data, ptop)
1952 deallocate (
t_dat )
1953 deallocate (
q_dat )
1956 deallocate (
u_dat )
1957 deallocate (
v_dat )
1977 real :: slp_mask = 100900.
1979 type(time_type),
intent(in):: time
1980 real,
intent(inout):: mask(is:ie,js:je)
1981 real(kind=R_GRID),
intent(IN),
dimension(isd:ied,jsd:jed,2) :: agrid
1983 real(kind=R_GRID):: pos(2)
1994 call get_slp_obs(time,
nobs_tc(n),
x_obs(1,n),
y_obs(1,n),
wind_obs(1,n),
mslp_obs(1,n),
mslp_out(1,n),
rad_out(1,n), &
1995 time_tc(1,n), pos(1), pos(2), w10_o, slp_o, r_vor, p_vor)
1997 if ( slp_o<880.e2 .or. slp_o>
min(
slp_env,slp_mask) .or. abs(pos(2))*
rad2deg>40. )
goto 5000
1999 if ( r_vor < 30.e3 )
then 2005 dist = great_circle_dist(pos, agrid(i,j,1:2),
radius)
2006 if( dist < 6.*r_vor )
then 2007 mask(i,j) = mask(i,j) * ( 1. -
mask_fac*exp(-(0.5*dist/r_vor)**2)*
min(1.,(
slp_env-slp_o)/10.e2) )
2017 subroutine breed_slp_inline(nstep, dt, npz, ak, bk, phis, pe, pk, peln, pkz, delp, u, v, pt, q, nwat, &
2018 zvir, gridstruct, ks, domain_local, bd, hydrostatic)
2024 integer,
intent(in):: nstep, npz, nwat, ks
2025 real,
intent(in):: dt
2026 real,
intent(in):: zvir
2027 real,
intent(in),
dimension(npz+1):: ak, bk
2028 logical,
intent(in):: hydrostatic
2031 type(
domain2d),
intent(INOUT) :: domain_local
2035 real,
intent(inout),
dimension(isd:ied,jsd:jed,npz):: delp, pt
2038 real,
intent(inout):: pk(is:ie,js:je, npz+1)
2039 real,
intent(inout):: pe(is-1:ie+1, npz+1,js-1:je+1)
2040 real,
intent(inout):: pkz(is:ie,js:je,npz)
2041 real,
intent(out):: peln(is:ie,npz+1,js:je)
2046 real:: ps(is:ie,js:je)
2047 real:: dist(is:ie,js:je)
2048 real:: tm(is:ie,js:je)
2049 real:: slp(is:ie,js:je)
2050 real(kind=R_GRID):: pos(2)
2054 real:: relx0, relx, f1, pbreed, pbtop, delp0, dp0
2055 real:: ratio, p_count, p_sum, a_sum, mass_sink, delps
2056 real:: p_lo, p_hi, tau_vt, mslp0
2057 real:: split_time, fac, pdep, r2, r3
2058 integer year, month, day, hour, minute, second
2059 integer n, i, j, k, iq, k0
2061 real,
pointer :: area(:,:)
2062 real(kind=R_GRID),
pointer :: agrid(:,:,:)
2064 if ( forecast_mode )
return 2066 agrid => gridstruct%agrid_64
2067 area => gridstruct%area
2070 if(
master)
write(*,*)
'NO TC data to process' 2080 if (
master)
write(*,*)
'Warning: The year in storm track data is not the same as model year' 2084 split_time =
calday(year, month, day, hour, minute, second) + dt*
real(nstep)/86400.
2090 if (
master)
write(*,*)
'*** Vortext Breeding Ended at', day, hour, minute, second
2103 ps(i,j) = ps(i,j) + delp(i,j,k)
2108 tm(i,j) = pkz(i,j,npz)*pt(i,j,npz) /
cp_air 2120 u(i,j,k) = u(i,j,k) * (delp(i,j-1,k)+delp(i,j,k))
2125 v(i,j,k) = v(i,j,k) * (delp(i-1,j,k)+delp(i,j,k))
2134 pt(i,j,k) = pt(i,j,k)*pkz(i,j,k)*delp(i,j,k)
2143 q(i,j,k,iq) = q(i,j,k,iq) * delp(i,j,k)
2164 call get_slp_obs(time,
nobs_tc(n),
x_obs(1,n),
y_obs(1,n),
wind_obs(1,n),
mslp_obs(1,n),
mslp_out(1,n),
rad_out(1,n), &
2165 time_tc(1,n), pos(1), pos(2), w10_o, slp_o, r_vor, p_env, stime=split_time, fact=fac)
2167 if ( slp_o<87500. .or. slp_o>
slp_env .or. abs(pos(2))*
rad2deg>45. )
then 2173 write(*,*)
'Vortex breeding for TC:', n,
' slp=',slp_o/100.,pos(1)*
rad2deg,pos(2)*
rad2deg 2180 if ( slp_o > 1000.e2 )
then 2185 pbtop =
max(100.e2, 850.e2-25.*(1000.e2-slp_o))
2187 if ( slp_o > 1000.e2 )
then 2190 pbtop =
max(100.e2, 750.e2-20.*(1000.e2-slp_o))
2195 if ( slp_o > 1000.e2 )
then 2198 pbtop =
max(500.e2, 900.e2-5.*(1000.e2-slp_o))
2203 pbreed = ak(k) + bk(k)*1.e5
2204 if ( pbreed>pbtop )
then 2213 dist(i,j) = great_circle_dist( pos, agrid(i,j,1:2),
radius)
2217 call compute_slp(is, ie, js, je, tm, ps, phis(is:ie,js:je), slp)
2219 if ( r_vor < 30.e3 .or. p_env<900.e2 )
then 2230 if( dist(i,j)<(r_vor+
del_r) .and. dist(i,j)>r_vor .and. phis(i,j)<250.*
grav )
then 2231 p_count = p_count + 1.
2232 p_sum = p_sum + slp(i,j)*area(i,j)
2233 a_sum = a_sum + area(i,j)
2238 call mp_reduce_sum(p_count)
2240 if ( p_count<32. )
then 2241 if(
nudge_debug .and.
master)
write(*,*) p_count,
'Skipping obs: too few p_count' 2245 call mp_reduce_sum(p_sum)
2246 call mp_reduce_sum(a_sum)
2247 p_env = p_sum / a_sum
2249 if(
nudge_debug .and.
master)
write(*,*)
'Environmental SLP=', p_env/100.,
' computed radius=', r_vor/1.e3
2251 if ( p_env>1015.e2 .or. p_env<920.e2 )
then 2253 if(
master)
write(*,*)
'Environmental SLP out of bound; skipping obs. p_count=', p_count, p_sum
2254 call prt_maxmin(
'SLP_breeding', slp, is, ie, js, je, 0, 1, 0.01)
2264 r_vor = r_vor + 25.e3
2267 write(*,*)
'Computed environmental SLP too low' 2268 write(*,*)
' ', p_env/100., slp_o/100.,pos(1)*
rad2deg, pos(2)*
rad2deg 2271 if ( slp_o > 1003.e2 .and. r_vor > 1000.e3 )
then 2276 if ( r_vor < 1250.e3 )
goto 123
2283 tau_vt =
tau_vt_slp * (1. + (960.e2-slp_o)/100.e2 )
2284 tau_vt =
max(abs(dt), tau_vt)
2287 relx0 =
min(1., 2.*abs(dt)/tau_vt)
2289 relx0 =
min(1., abs(dt)/tau_vt)
2299 if( dist(i,j) < r_vor .and. phis(i,j)<250.*
grav )
then 2300 f1 = dist(i,j)/r_vor
2302 p_hi = p_env - (p_env-slp_o) * exp( -
r_hi*f1**2 )
2303 p_lo = p_env - (p_env-slp_o) * exp( -
r_lo*f1**2 )
2305 if ( ps(i,j) > p_hi .and. tm(i,j) <
tm_max )
then 2309 delps = relx*(ps(i,j) - p_hi) *
min( (
tm_max-tm(i,j))/10., 1.)
2316 elseif ( slp(i,j) < p_lo )
then 2318 relx =
max(0.5, relx0)
2319 delps = relx*(slp(i,j) - p_lo)
2327 pbreed = pbreed + delp(i,j,k)
2329 f1 = 1. - delps/(ps(i,j)-pbreed)
2331 delp(i,j,k) = delp(i,j,k)*f1
2333 mass_sink = mass_sink + delps*area(i,j)
2335 if ( delps > 0. )
then 2338 pbreed = pbreed + delp(i,j,k)
2340 f1 = 1. - delps/(ps(i,j)-pbreed)
2342 delp(i,j,k) = delp(i,j,k)*f1
2344 mass_sink = mass_sink + delps*area(i,j)
2348 if ( abs(delps) < 1. )
then 2349 delp(i,j,k) = delp(i,j,k) - delps
2350 mass_sink = mass_sink + delps*area(i,j)
2353 pdep =
max(1.0,
min(abs(0.4*delps), 0.2*dp0, 0.02*delp(i,j,k)))
2354 pdep = -
min(pdep, abs(delps))
2355 delp(i,j,k) = delp(i,j,k) - pdep
2356 delps = delps - pdep
2357 mass_sink = mass_sink + pdep*area(i,j)
2368 call mp_reduce_sum(mass_sink)
2369 if ( abs(mass_sink)<1.e-40 )
goto 5000
2372 r3 =
min( 4.*r_vor,
max(2.*r_vor, 2500.e3) ) +
del_r 2377 if( dist(i,j)<r3 .and. dist(i,j)>r2 )
then 2378 p_sum = p_sum + area(i,j)
2383 call mp_reduce_sum(p_sum)
2384 mass_sink = mass_sink / p_sum
2385 if(
master .and.
nudge_debug)
write(*,*)
'TC#',n,
'Mass tele-ported (pa)=', mass_sink
2391 if( dist(i,j)<r3 .and. dist(i,j)>r2 )
then 2394 pbreed = pbreed + delp(i,j,k)
2396 f1 = 1. + mass_sink/(ps(i,j)-pbreed)
2398 delp(i,j,k) = delp(i,j,k)*f1
2411 ps(i,j) = ps(i,j) + delp(i,j,k)
2430 pe(i,k,j) = pe(i,k-1,j) + delp(i,j,k-1)
2438 peln(i,k,j) = log(pe(i,k,j))
2439 pk(i,j,k) = pe(i,k,j)**
kappa 2451 u(i,j,k) = u(i,j,k) / (delp(i,j-1,k)+delp(i,j,k))
2456 v(i,j,k) = v(i,j,k) / (delp(i-1,j,k)+delp(i,j,k))
2465 pkz(i,j,k) = (pk(i,j,k+1)-pk(i,j,k))/(
kappa*(peln(i,k+1,j)-peln(i,k,j)))
2466 pt(i,j,k) = pt(i,j,k) / (pkz(i,j,k)*delp(i,j,k))
2480 q(i,j,k,iq) = q(i,j,k,iq) / delp(i,j,k)
2494 subroutine breed_srf_w10(time, dt, npz, ak, bk, ps, phis, slp, delp, u, v, gridstruct)
2498 type(time_type),
intent(in):: time
2499 integer,
intent(in):: npz
2500 real,
intent(in):: dt
2501 real,
intent(in),
dimension(npz+1):: ak, bk
2502 real,
intent(in):: phis(isd:ied,jsd:jed)
2503 real,
intent(in):: ps(isd:ied,jsd:jed)
2504 real,
intent(in),
dimension(is:ie,js:je):: slp
2505 type(fv_grid_type),
intent(IN),
target :: gridstruct
2506 real,
intent(inout):: u(isd:ied,jsd:jed+1,npz)
2507 real,
intent(inout):: v(isd:ied+1,jsd:jed,npz)
2509 real,
intent(inout),
dimension(isd:ied,jsd:jed,npz):: delp
2511 real,
dimension(is:ie,js:je):: us, vs
2512 real wu(is:ie, js:je+1)
2513 real wv(is:ie+1,js:je)
2514 real u1(is:ie), v1(is:ie)
2515 real:: dist(is:ie,js:je), wind(is:ie,js:je)
2516 real(kind=R_GRID):: pos(2)
2519 real:: r_vor, pc, p_count
2520 real:: r_max, speed, ut, vt, speed_local
2521 real:: u_bg, v_bg, mass, t_mass
2522 real:: relx0, relx, f1
2529 real,
pointer,
dimension(:,:) :: dx, dy, rdxa, rdya, a11, a21, a12, a22, area
2530 real(kind=R_GRID),
pointer,
dimension(:,:,:) :: agrid, vlon, vlat
2534 rdxa => gridstruct%rdxa
2535 rdya => gridstruct%rdya
2536 a11 => gridstruct%a11
2537 a21 => gridstruct%a21
2538 a12 => gridstruct%a12
2539 a22 => gridstruct%a22
2540 area => gridstruct%area
2541 agrid => gridstruct%agrid_64
2542 vlon => gridstruct%vlon
2543 vlat => gridstruct%vlat
2547 if(
master)
write(*,*)
'NO TC data to process' 2555 wu(i,j) = u(i,j,npz)*dx(i,j)
2561 wv(i,j) = v(i,j,npz)*dy(i,j)
2570 u1(i) = (wu(i,j) + wu(i,j+1)) * rdxa(i,j)
2571 v1(i) = (wv(i,j) + wv(i+1,j)) * rdya(i,j)
2573 us(i,j) = a11(i,j)*u1(i) + a12(i,j)*v1(i)
2574 vs(i,j) = a21(i,j)*u1(i) + a22(i,j)*v1(i)
2576 wind(i,j) = sqrt( us(i,j)**2 + vs(i,j)**2 )
2596 call get_slp_obs(time,
nobs_tc(n),
x_obs(1,n),
y_obs(1,n),
wind_obs(1,n),
mslp_obs(1,n),
mslp_out(1,n),
rad_out(1,n), &
2597 time_tc(1,n), pos(1), pos(2), w10_o, slp_o, r_vor, p_env)
2599 if ( slp_o<90000. .or. slp_o>
slp_env .or. abs(pos(2))*
rad2deg>35. )
goto 3000
2604 dist(i,j) = great_circle_dist( pos, agrid(i,j,1:2),
radius )
2620 if( dist(i,j) < r_vor )
then 2623 if ( dist(i,j)<0.5*r_vor .and. abs(phis(i,j))>2.*
grav ) p_count = p_count + 1.
2625 pc =
min(pc, slp(i,j))
2627 if ( speed_local < wind(i,j) )
then 2628 speed_local = wind(i,j)
2636 call mp_reduce_sum(p_count)
2637 if ( p_count>32 )
goto 3000
2639 if ( w10_o < 0. )
then 2641 w10_o = 3.446778 * (1010.-slp_o/100.)**0.644
2645 call mp_reduce_max(speed)
2646 call mp_reduce_min(pc)
2648 if ( speed_local < speed )
then 2651 call mp_reduce_max(r_max)
2652 if( r_max<0. )
call mpp_error(fatal,
'==> Error in r_max')
2659 if ( w10_o > 12.5 )
then 2660 z0 = (0.085*w10_o - 0.58) * 1.e-3
2665 z0 = 0.0185/
grav*(0.001*w10_o**2 + 0.028*w10_o)**2
2670 wind_fac = log(zz/z0) / log(10./z0)
2672 if( wind_fac<1. )
call mpp_error(fatal,
'==> Error in wind_fac')
2674 if ( pc < slp_o )
then 2682 speed = wind_fac*w10_o
2685 speed =
max(wind_fac*w10_o, speed)
2686 if ( pc>1009.e2 ) r_max = 0.5 * r_vor
2693 r_max =
min(0.75*r_vor, r_max)
2703 if( dist(i,j) <=
min(r_vor,2.*
r_fac*r_max) .and. phis(i,j)<2.*
grav )
then 2704 mass = area(i,j)*delp(i,j,npz)
2706 u_bg = u_bg + us(i,j)*mass
2707 v_bg = v_bg + vs(i,j)*mass
2709 t_mass = t_mass + mass
2710 p_count = p_count + 1.
2714 call mp_reduce_sum(p_count)
2715 if ( p_count<16. )
go to 3000
2717 call mp_reduce_sum(t_mass)
2718 call mp_reduce_sum(u_bg)
2719 call mp_reduce_sum(v_bg)
2720 u_bg = u_bg / t_mass
2721 v_bg = v_bg / t_mass
2730 if( dist(i,j) <=
min(r_vor,
r_fac*r_max) .and. phis(i,j)<2.*
grav )
then 2731 f1 = dist(i,j)/r_max
2733 if( dist(i,j)<=r_max )
then 2734 speed_local = speed * f1
2736 speed_local = speed / f1**0.75
2738 call tangent_wind(vlon(i,j,1:3), vlat(i,j,1:3), speed_local, pos, agrid(i,j,1:2), ut, vt)
2742 us(i,j) = relx*(ut-us(i,j))
2743 vs(i,j) = relx*(vt-vs(i,j))
2751 if( dist(i,j) <=
min(r_vor,
r_fac*r_max) .and. phis(i,j)<2.*
grav )
then 2752 f1 = dist(i,j)/r_max
2754 if( dist(i,j)<=r_max )
then 2755 speed_local = speed * f1
2757 speed_local = speed / f1**0.75
2759 call tangent_wind(vlon(i,j,1:3), vlat(i,j,1:3), speed_local, pos, agrid(i,j,1:2), ut, vt)
2763 us(i,j) = relx*(ut-us(i,j))
2764 vs(i,j) = relx*(vt-vs(i,j))
2776 subroutine breed_srf_winds(time, dt, npz, u_obs, v_obs, ak, bk, ps, phis, delp, ua, va, u_dt, v_dt, pt, q, nwat, zvir, gridstruct)
2781 type(time_type),
intent(in):: time
2782 integer,
intent(in):: npz, nwat
2783 real,
intent(in):: dt
2784 real,
intent(in):: zvir
2785 real,
intent(in),
dimension(npz+1):: ak, bk
2786 real,
intent(in),
dimension(isd:ied,jsd:jed):: phis, ps
2787 real,
intent(in),
dimension(is:ie,js:je,npz):: u_obs, v_obs
2788 type(fv_grid_type),
intent(IN),
target :: gridstruct
2790 real,
intent(inout),
dimension(isd:ied,jsd:jed,npz):: delp, pt, ua, va, u_dt, v_dt
2791 real,
intent(inout)::q(isd:ied,jsd:jed,npz,nwat)
2793 real:: dist(is:ie,js:je), wind(is:ie,js:je)
2794 real:: slp(is:ie,js:je)
2795 real(kind=R_GRID):: pos(2)
2798 real:: r_vor, pc, p_count
2799 real:: r_max, speed, ut, vt, speed_local
2800 real:: u_bg, v_bg, mass, t_mass
2801 real:: relx0, relx, f1, rdt
2805 integer n, i, j, k, iq
2807 real,
pointer :: area(:,:)
2808 real(kind=R_GRID),
pointer :: vlon(:,:,:), vlat(:,:,:), agrid(:,:,:)
2810 area => gridstruct%area
2811 vlon => gridstruct%vlon
2812 vlat => gridstruct%vlat
2813 agrid => gridstruct%agrid_64
2816 if(
master)
write(*,*)
'NO TC data to process' 2826 slp(i,j) = ps(i,j)*exp(phis(i,j)/(
rdgas*(pt(i,j,npz)+3.25e-3*phis(i,j)/
grav)))
2827 wind(i,j) = sqrt( ua(i,j,npz)**2 + va(i,j,npz)**2 )
2846 call get_slp_obs(time,
nobs_tc(n),
x_obs(1,n),
y_obs(1,n),
wind_obs(1,n),
mslp_obs(1,n),
mslp_out(1,n),
rad_out(1,n), &
2847 time_tc(1,n), pos(1), pos(2), w10_o, slp_o, r_vor, p_env)
2849 if ( slp_o<90000. .or. slp_o>
slp_env .or. abs(pos(2))*
rad2deg>35. )
goto 3000
2854 dist(i,j) = great_circle_dist( pos, agrid(i,j,1:2),
radius )
2871 if( dist(i,j) < r_vor )
then 2874 if ( dist(i,j)<0.5*r_vor .and. abs(phis(i,j))>2.*
grav ) p_count = p_count + 1.
2876 pc =
min(pc, slp(i,j))
2878 if ( speed_local < wind(i,j) )
then 2879 speed_local = wind(i,j)
2887 call mp_reduce_sum(p_count)
2888 if ( p_count>32 )
goto 3000
2890 if ( w10_o < 0. )
then 2892 w10_o = 3.446778 * (1010.-slp_o/100.)**0.644
2896 call mp_reduce_max(speed)
2897 call mp_reduce_min(pc)
2899 if ( speed_local < speed )
then 2902 call mp_reduce_max(r_max)
2903 if( r_max<0. )
call mpp_error(fatal,
'==> Error in r_max')
2910 if ( w10_o > 12.5 )
then 2911 z0 = (0.085*w10_o - 0.58) * 1.e-3
2916 z0 = 0.0185/
grav*(0.001*w10_o**2 + 0.028*w10_o)**2
2921 wind_fac = log(zz/z0) / log(10./z0)
2923 if( wind_fac<1. )
call mpp_error(fatal,
'==> Error in wind_fac')
2925 if ( pc < slp_o )
then 2933 speed = wind_fac*w10_o
2936 speed =
max(wind_fac*w10_o, speed)
2937 if ( pc>1009.e2 ) r_max = 0.5 * r_vor
2944 r_max =
min(0.75*r_vor, r_max)
2954 if( dist(i,j) <=
min(r_vor,2.*
r_fac*r_max) .and. phis(i,j)<2.*
grav )
then 2955 mass = area(i,j)*delp(i,j,npz)
2961 u_bg = u_bg + u_obs(i,j,npz)*mass
2962 v_bg = v_bg + v_obs(i,j,npz)*mass
2963 t_mass = t_mass + mass
2964 p_count = p_count + 1.
2968 call mp_reduce_sum(p_count)
2969 if ( p_count<16. )
go to 3000
2971 call mp_reduce_sum(t_mass)
2972 call mp_reduce_sum(u_bg)
2973 call mp_reduce_sum(v_bg)
2974 u_bg = u_bg / t_mass
2975 v_bg = v_bg / t_mass
2984 if( dist(i,j) <=
min(r_vor,
r_fac*r_max) .and. phis(i,j)<2.*
grav )
then 2985 f1 = dist(i,j)/r_max
2987 if( dist(i,j)<=r_max )
then 2988 speed_local = speed * f1
2990 speed_local = speed / f1**0.75
2992 call tangent_wind(vlon(i,j,1:3), vlat(i,j,1:3), speed_local, pos, agrid(i,j,1:2), ut, vt)
2995 u_dt(i,j,k) = u_dt(i,j,k) + relx*(ut-ua(i,j,k)) * rdt
2996 v_dt(i,j,k) = v_dt(i,j,k) + relx*(vt-va(i,j,k)) * rdt
2998 ua(i,j,k) = ua(i,j,k) + relx*(ut-ua(i,j,k))
2999 va(i,j,k) = va(i,j,k) + relx*(vt-va(i,j,k))
3009 subroutine tangent_wind ( elon, elat, speed, po, pp, ut, vt )
3010 real,
intent(in):: speed
3011 real(kind=R_GRID),
intent(in):: po(2), pp(2)
3012 real(kind=R_GRID),
intent(in):: elon(3), elat(3)
3013 real,
intent(out):: ut, vt
3015 real(kind=R_GRID):: e1(3), eo(3), ep(3), op(3)
3020 op(:) = ep(:) - eo(:)
3025 ut = speed * (e1(1)*elon(1) + e1(2)*elon(2) + e1(3)*elon(3))
3026 vt = speed * (e1(1)*elat(1) + e1(2)*elat(2) + e1(3)*elat(3))
3029 if ( po(2) < 0. )
then 3037 subroutine get_slp_obs(time, nobs, lon_obs, lat_obs, w10, mslp, slp_out, r_out, time_obs, &
3038 x_o, y_o, w10_o, slp_o, r_vor, p_vor, stime, fact)
3040 type(time_type),
intent(in):: time
3041 integer,
intent(in):: nobs
3042 real(KIND=4),
intent(in):: lon_obs(nobs)
3043 real(KIND=4),
intent(in):: lat_obs(nobs)
3044 real(KIND=4),
intent(in):: w10(nobs)
3045 real(KIND=4),
intent(in):: mslp(nobs)
3046 real(KIND=4),
intent(in):: slp_out(nobs)
3047 real(KIND=4),
intent(in):: r_out(nobs)
3048 real(KIND=4),
intent(in):: time_obs(nobs)
3049 real,
optional,
intent(in):: stime
3050 real,
optional,
intent(out):: fact
3052 real(kind=R_GRID),
intent(out):: x_o , y_o
3053 real,
intent(out):: w10_o
3054 real,
intent(out):: slp_o
3055 real,
intent(out):: r_vor, p_vor
3058 real(kind=R_GRID):: p1(2), p2(2)
3060 real(kind=R_GRID) fac
3061 integer year, month, day, hour, minute, second, n
3063 t_thresh = 600./86400.
3072 if (
present(stime) )
then 3075 call get_date(time, year, month, day, hour, minute, second)
3078 if (
master)
write(*,*)
'Warning: The year in storm track data is not the same as model year' 3082 time_model =
calday(year, month, day, hour, minute, second)
3091 if ( time_model <= (time_obs(1)-t_thresh) .or. time_model >= time_obs(nobs) )
return 3093 if ( time_model <= time_obs(1) )
then 3101 if (
present(fact) ) fact = 1.25
3104 if( time_model >= time_obs(n) .and. time_model <= time_obs(n+1) )
then 3105 fac = (time_model-time_obs(n)) / (time_obs(n+1)-time_obs(n))
3106 w10_o = w10(n) + ( w10(n+1)- w10(n)) * fac
3107 slp_o = mslp(n) + ( mslp(n+1)- mslp(n)) * fac
3112 p1(1) = lon_obs(n); p1(2) = lat_obs(n)
3113 p2(1) = lon_obs(n+1); p2(2) = lat_obs(n+1)
3114 call intp_great_circle(fac, p1, p2, x_o, y_o)
3116 if (
present(fact) ) fact = 1. + 0.25*cos(fac*2.*
pi)
3131 integer:: unit, n, nobs
3132 character(len=3):: GMT
3133 character(len=9):: ts_name
3134 character(len=19):: comment
3135 integer:: mmddhh, yr, year, month, day, hour, MPH, islp
3136 integer:: it, i1, i2, p_ring, d_ring
3137 real:: lon_deg, lat_deg, cald, slp, mps
3150 if(
master)
write(*,*)
'No TC track file specified' 3158 if(
master)
write(*,*)
'Reading TC track data for YEAR=', year
3172 read(unit, *) ts_name, nobs, yr, month, day, hour
3174 if ( yr /= year )
then 3175 if(
master)
write(*, *)
'Year inconsistency found !!!' 3176 call mpp_error(fatal,
'==> Error in reading best track data')
3179 do while ( ts_name==
'start' )
3186 read(unit, *) lon_deg, lat_deg, mps, slp, yr, month, day, hour
3190 cald =
calday(yr, month, day, hour, 0, 0)
3192 if(
nudge_debug .and.
master)
write(*, 100) cald, month, day, hour, lon_deg, lat_deg, mps, slp
3200 read(unit, *) ts_name, nobs, yr, month, day, hour
3202 100
format(1x, f9.2, 1x, i3, 1x, i2, 1x, i2, 1x, f6.1, 1x, f6.1, 1x, f4.1, 1x, f6.1)
3206 do while ( month /= 0 )
3208 read(unit, *) month, day, hour, gmt, lat_deg, lon_deg, mph, islp, comment
3215 if(
master)
write(*, *)
'Reading data for TC#',
nstorms, comment
3217 if(
master)
write(*, *)
'End of record reached' 3220 cald =
calday(year, month, day, hour, 0, 0)
3224 if(
master)
write(*, 200) nobs, cald, month, day, hour, gmt, lat_deg, lon_deg, mph, islp, comment
3227 if ( gmt ==
'GMT' )
then 3229 if ( lon_deg < 0 )
then 3234 elseif ( gmt ==
'PAC' )
then 3246 write(*,*)
'TC vortex breeding: total storms=',
nstorms 3249 write(*, *)
'TC#',n,
' contains ',
nobs_tc(n),
' observations' 3254 200
format(i3, 1x,f9.4, 1x, i2, 1x, i2, 1x, i2, 1x, a3, f5.1, 1x, f5.1, 1x, i3, 1x, i4, 1x, a19)
3259 real function calday(year, month, day, hour, minute, sec)
3262 integer,
intent(in):: year, month, day, hour
3263 integer,
intent(in):: minute, sec
3265 integer n, m, ds, nday
3268 data days /31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31/
3272 if( month /= 1 )
then 3288 calday =
real((year-year_track_data)*nday + ds) +
real(hour*3600 + minute*60 + sec)/86400.
3294 integer,
intent(in):: ny
3302 parameter( ny00 = 0000 )
3304 if( ny >= ny00 )
then 3305 if( mod(ny,100) == 0. .and. mod(ny,400) == 0. )
then 3307 elseif( mod(ny,4) == 0. .and. mod(ny,100) /= 0. )
then 3319 subroutine pmaxmin( qname, a, imax, jmax, fac )
3321 character(len=*) qname
3326 real qmin(jmax), qmax(jmax)
3334 pmax =
max(pmax, a(i,j))
3335 pmin =
min(pmin, a(i,j))
3346 pmax =
max(pmax, qmax(j))
3347 pmin =
min(pmin, qmin(j))
3350 write(*,*) qname,
' max = ', pmax*fac,
' min = ', pmin*fac
3355 subroutine del2_uv(du, dv, cd, kmd, ntimes, bd, npx, npy, gridstruct, domain)
3357 integer,
intent(in):: kmd
3358 integer,
intent(in):: ntimes
3359 real,
intent(in):: cd
3360 type(fv_grid_bounds_type),
intent(IN) :: bd
3361 real,
intent(inout),
dimension(is:ie,js:je,kmd):: du, dv
3362 integer,
intent(IN) :: npx, npy
3363 type(fv_grid_type),
intent(IN),
target :: gridstruct
3364 type(domain2d),
intent(INOUT) :: domain
3366 real(kind=R_GRID),
pointer,
dimension(:,:,:) :: vlon, vlat
3367 real,
dimension(is:ie,js:je,kmd):: v1, v2, v3
3370 vlon => gridstruct%vlon
3371 vlat => gridstruct%vlat
3378 v1(i,j,k) = du(i,j,k)*vlon(i,j,1) + dv(i,j,k)*vlat(i,j,1)
3379 v2(i,j,k) = du(i,j,k)*vlon(i,j,2) + dv(i,j,k)*vlat(i,j,2)
3380 v3(i,j,k) = du(i,j,k)*vlon(i,j,3) + dv(i,j,k)*vlat(i,j,3)
3386 call del2_scalar( v1(is,js,1), cd, kmd, ntimes, bd, npx, npy, gridstruct, domain )
3387 call del2_scalar( v2(is,js,1), cd, kmd, ntimes, bd, npx, npy, gridstruct, domain )
3388 call del2_scalar( v3(is,js,1), cd, kmd, ntimes, bd, npx, npy, gridstruct, domain )
3395 du(i,j,k) = v1(i,j,k)*vlon(i,j,1) + v2(i,j,k)*vlon(i,j,2) + v3(i,j,k)*vlon(i,j,3)
3396 dv(i,j,k) = v1(i,j,k)*vlat(i,j,1) + v2(i,j,k)*vlat(i,j,2) + v3(i,j,k)*vlat(i,j,3)
3403 subroutine del2_scalar(qdt, cd, kmd, nmax, bd, npx, npy, gridstruct, domain)
3405 integer,
intent(in):: kmd
3406 integer,
intent(in):: nmax
3407 real,
intent(in):: cd
3408 type(fv_grid_bounds_type),
intent(IN) :: bd
3409 real,
intent(inout):: qdt(is:ie,js:je,kmd)
3410 integer,
intent(IN) :: npx, npy
3411 type(fv_grid_type),
intent(IN),
target :: gridstruct
3412 type(domain2d),
intent(INOUT) :: domain
3414 real:: q(isd:ied,jsd:jed,kmd)
3415 real:: fx(isd:ied+1,jsd:jed), fy(isd:ied,jsd:jed+1)
3416 integer i,j,k, n, nt, ntimes
3419 real,
pointer,
dimension(:,:) :: rarea, area
3420 real,
pointer,
dimension(:,:) :: sina_u, sina_v
3421 real,
pointer,
dimension(:,:,:) :: sin_sg
3423 real,
pointer,
dimension(:,:) :: dx, dy, rdxc, rdyc
3425 real(kind=R_GRID),
pointer :: da_min
3427 logical,
pointer :: nested, sw_corner, se_corner, nw_corner, ne_corner
3429 area => gridstruct%area
3430 rarea => gridstruct%rarea
3432 sina_u => gridstruct%sina_u
3433 sina_v => gridstruct%sina_v
3434 sin_sg => gridstruct%sin_sg
3438 rdxc => gridstruct%rdxc
3439 rdyc => gridstruct%rdyc
3441 da_min => gridstruct%da_min
3443 nested => gridstruct%nested
3444 sw_corner => gridstruct%sw_corner
3445 se_corner => gridstruct%se_corner
3446 nw_corner => gridstruct%nw_corner
3447 ne_corner => gridstruct%ne_corner
3449 ntimes =
min(3, nmax)
3457 q(i,j,k) = qdt(i,j,k)
3475 if(nt>0)
call copy_corners(q(isd,jsd,k), npx, npy, 1, nested, bd, &
3476 sw_corner, se_corner, nw_corner, ne_corner)
3479 fx(i,j) = dy(i,j)*sina_u(i,j)*(q(i-1,j,k)-q(i,j,k))*rdxc(i,j)
3481 if (is == 1) fx(i,j) = dy(is,j)*(q(is-1,j,k)-q(is,j,k))*rdxc(is,j)* &
3482 0.5*(sin_sg(1,j,1) + sin_sg(0,j,3))
3483 if (ie+1 == npx) fx(i,j) = dy(ie+1,j)*(q(ie,j,k)-q(ie+1,j,k))*rdxc(ie+1,j)* &
3484 0.5*(sin_sg(npx,j,1) + sin_sg(npx-1,j,3))
3487 if(nt>0)
call copy_corners(q(isd,jsd,k), npx, npy, 2, nested, bd, &
3488 sw_corner, se_corner, nw_corner, ne_corner)
3490 if (j == 1 .OR. j == npy)
then 3492 fy(i,j) = dx(i,j)*(q(i,j-1,k)-q(i,j,k))*rdyc(i,j) &
3493 *0.5*(sin_sg(i,j,2) + sin_sg(i,j-1,4) )
3497 fy(i,j) = dx(i,j)*sina_v(i,j)*(q(i,j-1,k)-q(i,j,k))*rdyc(i,j)
3505 qdt(i,j,k) = q(i,j,k) + damp*rarea(i,j)*(fx(i,j)-fx(i+1,j)+fy(i,j)-fy(i,j+1))
3511 q(i,j,k) = q(i,j,k) + damp*rarea(i,j)*(fx(i,j)-fx(i+1,j)+fy(i,j)-fy(i,j+1))
3521 subroutine rmse_bias(a, rms, bias, area)
3522 real,
intent(in):: a(is:ie,js:je)
3523 real,
intent(IN) :: area(isd:ied,jsd:jed)
3524 real,
intent(out):: rms, bias
3534 bias = bias + area(i,j) * a(i,j)
3535 rms = rms + area(i,j) * a(i,j)**2
3538 call mp_reduce_sum(bias)
3539 call mp_reduce_sum(rms)
3541 bias = bias / total_area
3542 rms = sqrt( rms / total_area )
3547 subroutine corr(a, b, co, area)
3548 real,
intent(in):: a(is:ie,js:je), b(is:ie,js:je)
3549 real,
intent(in):: area(isd:ied,jsd:jed)
3550 real,
intent(out):: co
3551 real:: m_a, m_b, std_a, std_b
3558 call std(a, m_a, std_a, area)
3559 call std(b, m_b, std_b, area)
3565 co = co + area(i,j) * (a(i,j)-m_a)*(b(i,j)-m_b)
3568 call mp_reduce_sum(co)
3569 co = co / (total_area*std_a*std_b )
3573 subroutine std(a, mean, stdv, area)
3574 real,
intent(in):: a(is:ie,js:je)
3575 real,
intent(IN) :: area(isd:ied,jsd:jed)
3576 real,
intent(out):: mean, stdv
3585 mean = mean + area(i,j) * a(i,j)
3588 call mp_reduce_sum(mean)
3589 mean = mean / total_area
3594 stdv = stdv + area(i,j) * (a(i,j)-mean)**2
3597 call mp_reduce_sum(stdv)
3598 stdv = sqrt( stdv / total_area )
real(kind=4), dimension(nobs_max, max_storm) time_tc
subroutine del2_uv(du, dv, cd, kmd, ntimes, bd, npx, npy, gridstruct, domain)
subroutine, public get_date(time, year, month, day, hour, minute, second, tick, err_msg)
real, dimension(:), allocatable ak0
real, parameter, public radius
Radius of the Earth [m].
real, dimension(:), allocatable bk0
real(kind=4), dimension(:,:,:,:), allocatable v_dat
integer, dimension(:,:), allocatable id1
real function calday(year, month, day, hour, minute, sec)
character(len=128) version
real(kind=4), dimension(nobs_max, max_storm) mslp_out
real(kind=4), dimension(nobs_max, max_storm) mslp_obs
subroutine, public open_ncfile(iflnm, ncid)
real, dimension(:), allocatable lat
real(kind=4), dimension(nobs_max, max_storm) x_obs
real(kind=8), parameter, public pi_8
Ratio of circle circumference to diameter [N/A].
subroutine, public get_var1_real(ncid, var1_name, im, var1, var_exist)
real(kind=4), dimension(nobs_max, max_storm) rad_out
subroutine pmaxmin(qname, a, imax, jmax, fac)
subroutine del2_scalar(qdt, cd, kmd, nmax, bd, npx, npy, gridstruct, domain)
integer, dimension(max_storm) nobs_tc
real(kind=4), dimension(:,:,:,:), allocatable q_dat
subroutine remap_tq(npz, ak, bk, ps, delp, t, q, kmd, ps0, ta, qa, zvir, ptop)
subroutine std(a, mean, stdv, area)
real, dimension(:,:,:), allocatable s2c
integer, dimension(:,:), allocatable id2
subroutine, public get_var3_r4(ncid, var3_name, is, ie, js, je, ks, ke, var3, time_slice)
real, parameter, public rdgas
Gas constant for dry air [J/kg/deg].
character(len=128) analysis_file_first
void vect_cross(const double *p1, const double *p2, double *e)
real, dimension(:,:,:), allocatable ps_dat
subroutine compute_slp(isc, iec, jsc, jec, tm, ps, gz, slp)
integer function, public check_nml_error(IOSTAT, NML_NAME)
real, dimension(:,:), allocatable gz0
real(kind=4), dimension(nobs_max, max_storm) y_obs
character(len=128) tagname
logical function leap_year(ny)
subroutine rmse_bias(a, rms, bias, area)
subroutine, public breed_slp_inline(nstep, dt, npz, ak, bk, phis, pe, pk, peln, pkz, delp, u, v, pt, q, nwat, zvir, gridstruct, ks, domain_local, bd, hydrostatic)
character(len=128) input_fname_list
real, dimension(:), allocatable lon
integer, parameter max_storm
subroutine corr(a, b, co, area)
real(kind=4), dimension(:,:,:,:), allocatable t_dat
subroutine get_ncep_analysis(ps, u, v, t, q, zvir, ts, nfile, fname, bd)
real function g0_sum(p, ifirst, ilast, jfirst, jlast, mode, reproduce, isd, ied, jsd, jed, area)
subroutine ps_nudging(dt, factor, npz, ak, bk, ps_obs, mask, tm, ps, phis, delp, ua, va, pt, nwat, q, bd, npx, npy, gridstruct, domain)
subroutine timing_on(blk_name)
integer, parameter nobs_max
subroutine, public fv_nwp_nudge_init(time, axes, npz, zvir, ak, bk, ts, phis, gridstruct, ks, npx, neststruct, bd)
real, parameter, public cp_air
Specific heat capacity of dry air at constant pressure [J/kg/deg].
subroutine breed_srf_w10(time, dt, npz, ak, bk, ps, phis, slp, delp, u, v, gridstruct)
integer, parameter, public r_grid
logical, public do_adiabatic_init
real function, public great_circle_dist(q1, q2, radius)
logical module_is_initialized
subroutine, public close_ncfile(ncid)
subroutine get_int_hght(npz, ak, bk, ps, delp, ps0, tv)
subroutine get_tc_mask(time, mask, agrid)
real, parameter, public grav
Acceleration due to gravity [m/s^2].
real(kind=4), dimension(:,:,:), allocatable gz3
subroutine, public get_var1_double(ncid, var1_name, im, var1, var_exist)
character(len=128) track_file_name
subroutine, public mappm(km, pe1, q1, kn, pe2, q2, i1, i2, iv, kord, ptop)
subroutine, public get_ncdim1(ncid, var1_name, im)
subroutine, public intp_great_circle(beta, p1, p2, x_o, y_o)
void normalize_vect(double *e)
subroutine ps_bias_correction(ps_dt, is, ie, js, je, isd, ied, jsd, jed, area)
real(kind=4), dimension(:,:,:,:), allocatable u_dat
subroutine tangent_wind(elon, elat, speed, po, pp, ut, vt)
integer, parameter nfile_max
subroutine, public fv_nwp_nudge_end
subroutine remap_uv(npz, ak, bk, ps, delp, u, v, kmd, ps0, u0, v0, ptop)
character(len=128), dimension(nfile_max) file_names
subroutine, public copy_corners(q, npx, npy, dir, nested, bd, sw_corner, se_corner, nw_corner, ne_corner)
subroutine, public prt_maxmin(qname, q, is, ie, js, je, n_g, km, fac)
subroutine get_slp_obs(time, nobs, lon_obs, lat_obs, w10, mslp, slp_out, r_out, time_obs, x_o, y_o, w10_o, slp_o, r_vor, p_vor, stime, fact)
subroutine get_obs(Time, dt, zvir, ak, bk, ps, ts, ps_obs, delp, pt, nwat, q, u_obs, v_obs, t_obs, q_obs, phis, ua, va, u_dt, v_dt, npx, npy, npz, factor, mask, ptop, bd, gridstruct, domain)
character(len=128) analysis_file_last
real(kind=4), dimension(nobs_max, max_storm) wind_obs
subroutine breed_srf_winds(time, dt, npz, u_obs, v_obs, ak, bk, ps, phis, delp, ua, va, u_dt, v_dt, pt, q, nwat, zvir, gridstruct)
subroutine, public fv_nwp_nudge(Time, dt, npx, npy, npz, ps_dt, u_dt, v_dt, t_dt, q_dt, zvir, ptop, ak, bk, ts, ps, delp, ua, va, pt, nwat, q, phis, gridstruct, bd, domain)
subroutine, public get_time(Time, seconds, days, ticks, err_msg)
void latlon2xyz(int size, const double *lon, const double *lat, double *x, double *y, double *z)
real, parameter, public kappa
RDGAS / CP_AIR [dimensionless].
subroutine remap_coef(agrid)
type(time_type), public fv_time
integer, dimension(:,:), allocatable jdc
real(fp), parameter, public pi
subroutine timing_off(blk_name)