1 !WRF:MODEL_LAYER:PHYSICS
3 MODULE module_diagnostics_driver
7 ! This subroutine is the driver for the diagnostics packages.
10 SUBROUTINE diagnostics_driver ( grid, config_flags, &
11 moist, chem, tracer, scalar, &
12 th_phy, pi_phy, p_phy, &
14 curr_secs, curr_secs2, &
16 ids, ide, jds, jde, kds, kde, &
17 ims, ime, jms, jme, kms, kme, &
18 ips, ipe, jps, jpe, kps, kpe, &
19 imsx, imex, jmsx, jmex, kmsx, kmex, &
20 ipsx, ipex, jpsx, jpex, kpsx, kpex, &
21 imsy, imey, jmsy, jmey, kmsy, kmey, &
22 ipsy, ipey, jpsy, jpey, kpsy, kpey )
25 !=============================================================
26 ! USE Association for Generic WRF Infrastructure
27 !=============================================================
29 ! Pick up the number of members for each of the 4d arrays - for declaration purposes.
31 USE module_state_description, ONLY: num_moist, num_chem, num_tracer, num_scalar, &
32 SKIP_PRESS_DIAGS, SKIP_Z_DIAGS, &
36 P_QG, P_QH, P_QV, P_QC, P_QI, P_QS, &
37 P_QNG, P_QH, P_QNH, P_QR, P_QNR, P_QVOLG, &
38 F_QV, F_QC, F_QI, F_QS, &
39 KESSLERSCHEME, LINSCHEME, SBU_YLINSCHEME, WSM3SCHEME, WSM5SCHEME, &
40 WSM6SCHEME, ETAMPNEW, THOMPSON, THOMPSONAERO, THOMPSONGH, &
41 MORR_TWO_MOMENT, GSFCGCESCHEME, WDM5SCHEME, WDM6SCHEME, &
42 NSSL_2MOM, NSSL_2MOMCCN, NSSL_1MOM, NSSL_1MOMLFO, &
43 MILBRANDT2MOM , CAMMGMPSCHEME, FAST_KHAIN_LYNN_SHPUND, FULL_KHAIN_LYNN, &
44 MORR_TM_AERO !TWG add !,MILBRANDT3MOM, NSSL_3MOM, MORR_MILB_P3
46 USE module_driver_constants, ONLY: max_plevs, max_zlevs
48 ! From where we preferably are pulling g, Cp, etc.
50 USE module_model_constants, ONLY: g, R_v, R_d, Cp, T0, RCP
52 ! This gives us the type definition for grid (domain) and some clock information.
54 ! USE module_domain, ONLY : domain, domain_clock_get, get_ijk_from_subgrid
55 USE module_domain, ONLY : domain, domain_clock_get, domain_get_current_time
57 ! All of the information from the namelist is in config_flags. The
58 ! type declaration for this puppy must be available. While each domain
59 ! has a config_flags, together they are stored in model_config_rec.
61 USE module_configure, ONLY : grid_config_rec_type, &
65 USE module_utility, ONLY : WRFU_Time
67 !=============================================================
68 ! USE Association for the Diagnostic Packages
69 !=============================================================
71 USE module_lightning_driver, ONLY : lightning_driver
72 USE module_diag_misc, ONLY : diagnostic_output_calc, noahmp_output_calc
73 USE module_diag_nwp, ONLY : diagnostic_output_nwp
74 USE module_diag_cl, ONLY : clwrf_output_calc
75 USE module_diag_pld, ONLY : pld
76 USE module_diag_zld, ONLY : zld
77 USE module_diag_afwa, ONLY : afwa_diagnostics_driver
78 USE module_diag_rasm, ONLY : mean_output_calc, diurnalcycle_output_calc
79 USE module_diag_hailcast, ONLY : hailcast_diagnostic_driver
80 USE module_diag_solar, ONLY : solar_diag
81 USE module_trad_fields, ONLY : trad_fields
86 !=============================================================
87 ! Subroutine Arguments
88 !=============================================================
90 ! Arguments passed in. All of the diagnostics are part of the grid structure, so
91 ! even though we are not changing any of the fundamental variables, we are computing
92 ! the diagnostics. Therefore grid is INOUT.
94 TYPE ( domain ), INTENT(INOUT) :: grid
96 ! We are not changing any of the namelist settings.
98 TYPE ( grid_config_rec_type ), INTENT(IN) :: config_flags
100 ! The 4d arrays are input only, no mods to them.
102 REAL , DIMENSION(ims:ime,kms:kme,jms:jme,num_moist ) , INTENT(IN) :: moist
103 REAL , DIMENSION(ims:ime,kms:kme,jms:jme,num_chem ) , INTENT(IN) :: chem
104 REAL , DIMENSION(ims:ime,kms:kme,jms:jme,num_tracer) , INTENT(IN) :: tracer
105 REAL , DIMENSION(ims:ime,kms:kme,jms:jme,num_scalar) , INTENT(IN) :: scalar
107 ! A few handy 3d arrays computed for the physics scheme: pressure (Pa) and
108 ! temperature (K), on both half (_phy) and full levels.
110 REAL , DIMENSION(ims:ime,kms:kme,jms:jme) , INTENT(IN) :: th_phy , &
117 ! Time (s) since the beginning of the simulation, restart.
122 ! Is this to be a history output time? If so, compute the diagnostics.
126 ! The sundry dimensions required to keep a model running smoothly:
128 ! i: refers to the nominally west east direction, the inner-most (fastest)
130 ! j: refers to the nominally south north direction, the outer-most (slowest)
132 ! k: refers to the vertical direction form bottom to top, the second dimension
135 ! d: refers to the domain size, the geophysical extent of the entire domain,
136 ! not used in dimensions or looping, used to determine when we are close to
137 ! the edge of the boundary
138 ! m: refers to the memory size size, all 2d and 3d arrays from the Registry
139 ! (passed into here via the grid structure or the I1 variables [such as
140 ! p_phy, for example]) use these values for dimensioning
141 ! p: refers to the patch size, the extent over which computational loops run
143 INTEGER , INTENT(IN) :: ids, ide, jds, jde, kds, kde, &
144 ims, ime, jms, jme, kms, kme, &
145 ips, ipe, jps, jpe, kps, kpe
147 ! Hopefully unnecessary, these are the filtered dimensions.
149 INTEGER , INTENT(IN) :: imsx,imex,jmsx,jmex,kmsx,kmex, &
150 ipsx,ipex,jpsx,jpex,kpsx,kpex, &
151 imsy,imey,jmsy,jmey,kmsy,kmey, &
152 ipsy,ipey,jpsy,jpey,kpsy,kpey
155 !=============================================================
157 !=============================================================
159 ! Handy little character string for use instead of print statements.
161 CHARACTER (LEN=1000) :: diag_message
163 ! OpenMP indexing of tiles.
167 ! Vertical indexing that only goes up to the half levels.
169 INTEGER :: k_start, k_end
171 ! Current time associated with current simulation step (RASM_DIAGS)
173 TYPE(WRFU_Time) :: currentTime
175 !=============================================================
176 ! Start of executable code
177 !=============================================================
179 CALL wrf_debug ( 100 , '--> TOP OF DIAGNOSTICS PACKAGE' )
181 ! Some routine initializations.
186 ! There are some fields that were defined in the first RK loop for
187 ! physics and are now a time-step old.
189 CALL update_phys_fields ( grid, config_flags, moist, &
190 ids, ide, jds, jde, kds, kde, &
191 ims, ime, jms, jme, kms, kme, &
192 ips, ipe, jps, jpe, kps, kpe )
194 ! Lightning flash rate diagnostic production.
196 LIGHTNING: IF ( config_flags%lightning_option /= 0 ) THEN
197 CALL wrf_debug ( 100 , '--> CALL DIAGNOSTICS PACKAGE: LIGHTNING_DRIVER' )
198 CALL lightning_driver ( &
199 ! Frequently used prognostics
200 curr_secs, grid%dt, grid%dx, grid%dy, &
201 grid%xlat, grid%xlong, grid%xland, grid%ht, &
202 grid%t_phy, p_phy, grid%rho, &
203 grid%u_phy, grid%v_phy, grid%w_2, &
204 th_phy, pi_phy,dz8w, &
206 ! Scheme specific prognostics
207 grid%ktop_deep, grid%refl_10cm, &
208 domain_get_current_time( grid ), &
209 ! Flashrate namelist inputs
210 config_flags%lightning_option, &
211 config_flags%lightning_dt, &
212 config_flags%lightning_start_seconds, &
214 config_flags%flashrate_factor, &
215 ! IC:CG namelist settings
216 config_flags%iccg_method, &
217 config_flags%iccg_prescribed_num, &
218 config_flags%iccg_prescribed_den, &
220 grid%iccg_in_num, grid%iccg_in_den, &
221 ! Scheme specific namelist inputs
222 config_flags%cellcount_method, &
223 config_flags%cldtop_adjustment, &
224 ! Order dependent args for domain, mem, and tile dims
225 ids, ide, jds, jde, kds, kde, &
226 ims, ime, jms, jme, kms, kme, &
227 ips, ipe, jps, jpe, kps, kpe, &
228 ! Mandatory outputs for all quantitative schemes
229 grid%ic_flashcount, grid%ic_flashrate, &
230 grid%cg_flashcount, grid%cg_flashrate, &
236 !WRF-HAILCAST diagnostic - hail size prediction
237 HAILCAST: IF ( config_flags%hailcast_opt /= 0 ) THEN
239 IF ( ( config_flags%history_interval == 0 ) ) THEN
240 WRITE (diag_message , * ) &
241 "HAILCAST Error : No 'history_interval' defined in namelist"
242 CALL wrf_error_fatal ( diag_message )
247 DO ij = 1 , grid%num_tiles
249 CALL wrf_debug ( 100 , &
250 '--> CALL DIAGNOSTICS PACKAGE: HAILCAST_DIAGNOSTIC_DRIVER' )
252 CALL hailcast_diagnostic_driver ( grid , config_flags &
254 ,ids, ide, jds, jde, kds, kde &
255 ,ims, ime, jms, jme, kms, kme &
256 ,ips, ipe, jps, jpe, kps, kpe &
257 ,ITS=grid%i_start(ij),ITE=grid%i_end(ij) &
258 ,JTS=grid%j_start(ij),JTE=grid%j_end(ij) &
259 ,K_START=k_start,K_END=k_end &
260 ,dt=grid%dt, itimestep=grid%itimestep &
261 ,haildt=grid%haildt, curr_secs=curr_secs2 &
262 ,haildtacttime=grid%haildtacttime )
265 !$OMP END PARALLEL DO
268 TRADITIONAL_FIELDS: IF ( config_flags%diag_nwp2 == do_trad_fields ) THEN
271 DO ij = 1 , grid%num_tiles
273 CALL wrf_debug ( 100 , '--> CALL DIAGNOSTICS PACKAGE: TRAD_FIELDS' )
275 ! Input data for computing
279 ,t=grid%th_phy_m_t0 &
280 ,qv=moist(:,:,:,P_QV) &
287 ! Map factors, coriolis for diags
298 ! Input model diagnostic vraiables
301 ,qc=moist(:,:,:,P_QC) &
303 ,rainnc=grid%rainnc &
304 ,snownc=grid%snownc &
305 ,graupelnc=grid%graupelnc &
306 ,hailnc=grid%hailnc &
310 ,use_theta_m=config_flags%use_theta_m &
311 ! The diagnostic output variables
312 ,sealevelp=grid%sealevelp &
313 ,temperature=grid%temperature &
314 ,pressure=grid%pressure &
315 ,geoheight=grid%geoheight &
322 ,liqrain=grid%liqrain &
324 ,potential_t=grid%potential_t &
326 ! Various indexes for declarations, loop bounds
327 ,IDS=ids,IDE=ide, JDS=jds,JDE=jde, KDS=kds,KDE=kde &
328 ,IMS=ims,IME=ime, JMS=jms,JME=jme, KMS=kms,KME=kme &
329 ,IPS=ips,IPE=ipe, JPS=jps,JPE=jpe, KPS=kps,KPE=kpe &
330 ,ITS=grid%i_start(ij),ITE=grid%i_end(ij) &
331 ,JTS=grid%j_start(ij),JTE=grid%j_end(ij) &
334 !$OMP END PARALLEL DO
335 END IF TRADITIONAL_FIELDS
337 ! Mostly surface values, precip, column integrated quantities.
339 CALL wrf_debug ( 100 , '--> CALL DIAGNOSTICS PACKAGE: ACCUMULATED AND BUCKET DIAGNOSTICS' )
341 CALL diagnostic_output_calc( &
342 DPSDT=grid%dpsdt ,DMUDT=grid%dmudt &
343 ,P8W=p8w ,PK1M=grid%pk1m &
344 ,MU_2=grid%mu_2 ,MU_2M=grid%mu_2m &
345 ,RAINCV=grid%raincv ,RAINNCV=grid%rainncv &
346 ,RAINC=grid%rainc ,RAINNC=grid%rainnc &
347 ,I_RAINC=grid%i_rainc ,I_RAINNC=grid%i_rainnc &
348 ,HFX=grid%hfx ,SFCEVP=grid%sfcevp ,LH=grid%lh &
352 ,ACSWUPT=grid%acswupt ,ACSWUPTC=grid%acswuptc &
353 ,ACSWDNT=grid%acswdnt ,ACSWDNTC=grid%acswdntc &
354 ,ACSWUPB=grid%acswupb ,ACSWUPBC=grid%acswupbc &
355 ,ACSWDNB=grid%acswdnb ,ACSWDNBC=grid%acswdnbc &
356 ,ACLWUPT=grid%aclwupt ,ACLWUPTC=grid%aclwuptc &
357 ,ACLWDNT=grid%aclwdnt ,ACLWDNTC=grid%aclwdntc &
358 ,ACLWUPB=grid%aclwupb ,ACLWUPBC=grid%aclwupbc &
359 ,ACLWDNB=grid%aclwdnb ,ACLWDNBC=grid%aclwdnbc &
360 ,I_ACSWUPT=grid%i_acswupt ,I_ACSWUPTC=grid%i_acswuptc &
361 ,I_ACSWDNT=grid%i_acswdnt ,I_ACSWDNTC=grid%i_acswdntc &
362 ,I_ACSWUPB=grid%i_acswupb ,I_ACSWUPBC=grid%i_acswupbc &
363 ,I_ACSWDNB=grid%i_acswdnb ,I_ACSWDNBC=grid%i_acswdnbc &
364 ,I_ACLWUPT=grid%i_aclwupt ,I_ACLWUPTC=grid%i_aclwuptc &
365 ,I_ACLWDNT=grid%i_aclwdnt ,I_ACLWDNTC=grid%i_aclwdntc &
366 ,I_ACLWUPB=grid%i_aclwupb ,I_ACLWUPBC=grid%i_aclwupbc &
367 ,I_ACLWDNB=grid%i_aclwdnb ,I_ACLWDNBC=grid%i_aclwdnbc &
368 ,athmp=grid%athmpten ,aqvmp=grid%aqvmpten &
369 ,athcu=grid%athcuten ,aqvcu=grid%aqvcuten &
370 ,aucu=grid%aucuten ,avcu=grid%avcuten &
371 ,athsh=grid%athshten ,aqvsh=grid%aqvshten &
372 ,aush=grid%aushten ,avsh=grid%avshten &
373 ,athbl=grid%athblten ,aqvbl=grid%aqvblten &
374 ,aubl=grid%aublten ,avbl=grid%avblten &
375 ,athralw=grid%athratenlw ,athrasw=grid%athratensw &
376 ,h_diabatic=grid%h_diabatic ,qv_diabatic=grid%qv_diabatic &
377 ,rthcuten=grid%rthcuten ,rqvcuten=grid%rqvcuten &
378 ,rucuten=grid%rucuten ,rvcuten=grid%rvcuten &
379 ,rthshten=grid%rthshten ,rqvshten=grid%rqvshten &
380 ,rushten=grid%rushten ,rvshten=grid%rvshten &
381 ,rthblten=grid%rthblten ,rqvblten=grid%rqvblten &
382 ,rublten=grid%rublten ,rvblten=grid%rvblten &
383 ,rthratenlw=grid%rthratenlw ,rthratensw=grid%rthratensw &
385 ,DIAG_PRINT=config_flags%diag_print &
386 ,BUCKET_MM=config_flags%bucket_mm &
387 ,BUCKET_J =config_flags%bucket_J &
388 ,SNOWNCV=grid%snowncv, SNOW_ACC_NC=grid%snow_acc_nc &
389 ,PREC_ACC_C=grid%prec_acc_c &
390 ,PREC_ACC_NC=grid%prec_acc_nc &
391 ,PREC_ACC_DT=config_flags%prec_acc_dt &
392 ,CURR_SECS2=curr_secs2 &
393 ,HISTORY_INTERVAL=grid%history_interval &
394 ,ITIMESTEP=grid%itimestep &
395 ,cu_used=grid%cu_used &
396 ,shcu_used=grid%shcu_used &
397 ,acc_phy_tend=grid%acc_phy_tend &
398 ! Dimension arguments
399 ,IDS=ids,IDE=ide, JDS=jds,JDE=jde, KDS=kds,KDE=kde &
400 ,IMS=ims,IME=ime, JMS=jms,JME=jme, KMS=kms,KME=kme &
401 ,IPS=ips,IPE=ipe, JPS=jps,JPE=jpe, KPS=kps,KPE=kpe &
402 ,I_START=grid%i_start,I_END=min(grid%i_end, ide-1) &
403 ,J_START=grid%j_start,J_END=min(grid%j_end, jde-1) &
404 ,KTS=k_start, KTE=min(k_end,kde-1) &
405 ,NUM_TILES=grid%num_tiles &
408 NWPDIAGS: IF ( config_flags%nwp_diagnostics == 1 ) THEN
409 CALL wrf_debug ( 100 , '--> CALL DIAGNOSTICS PACKAGE: NWP DIAGNOSTICS' )
411 mp_select: SELECT CASE(config_flags%mp_physics)
413 CASE (LINSCHEME, WSM6SCHEME, WDM6SCHEME, GSFCGCESCHEME, NSSL_1MOMLFO)
415 CALL diagnostic_output_nwp( &
416 U=grid%u_2 ,V=grid%v_2 &
417 ,TEMP=grid%t_phy ,P8W=p8w &
418 ,DT=grid%dt ,SBW=config_flags%spec_bdy_width &
421 ,MPHYSICS_OPT=config_flags%mp_physics & ! gthompsn
422 ,GSFCGCE_HAIL=config_flags%gsfcgce_hail & ! gthompsn
423 ,GSFCGCE_2ICE=config_flags%gsfcgce_2ice & ! gthompsn
424 ,MPUSE_HAIL=config_flags%hail_opt & ! gthompsn
425 ,NSSL_ALPHAH=config_flags%nssl_alphah & ! gthompsn
426 ,NSSL_ALPHAHL=config_flags%nssl_alphahl & ! gthompsn
427 ,NSSL_CNOH=config_flags%nssl_cnoh & ! gthompsn
428 ,NSSL_CNOHL=config_flags%nssl_cnohl & ! gthompsn
429 ,NSSL_RHO_QH=config_flags%nssl_rho_qh & ! gthompsn
430 ,NSSL_RHO_QHL=config_flags%nssl_rho_qhl & ! gthompsn
431 ,CURR_SECS2=curr_secs2 &
432 ,NWP_DIAGNOSTICS=config_flags%nwp_diagnostics &
433 ,DIAGFLAG=diag_flag &
434 ,HISTORY_INTERVAL=grid%history_interval &
435 ,ITIMESTEP=grid%itimestep &
436 ,U10=grid%u10,V10=grid%v10,W=grid%w_2 &
437 ,WSPD10MAX=grid%wspd10max &
438 ,UP_HELI_MAX=grid%up_heli_max &
439 ,W_UP_MAX=grid%w_up_max,W_DN_MAX=grid%w_dn_max &
440 ,ZNW=grid%znw,W_COLMEAN=grid%w_colmean &
441 ,NUMCOLPTS=grid%numcolpts,W_MEAN=grid%w_mean &
442 ,GRPL_MAX=grid%grpl_max,GRPL_COLINT=grid%grpl_colint &
443 ,REFD_MAX=grid%refd_max &
444 ,refl_10cm=grid%refl_10cm &
445 ,HAIL_MAXK1=grid%hail_maxk1,HAIL_MAX2D=grid%hail_max2d & ! gthompsn
446 ,QG_CURR=moist(ims,kms,jms,P_QG) &
447 ,RHO=grid%rho,PH=grid%ph_2,PHB=grid%phb,G=g &
448 ! Dimension arguments
449 ,IDS=ids,IDE=ide, JDS=jds,JDE=jde, KDS=kds,KDE=kde &
450 ,IMS=ims,IME=ime, JMS=jms,JME=jme, KMS=kms,KME=kme &
451 ,IPS=ips,IPE=ipe, JPS=jps,JPE=jpe, KPS=kps,KPE=kpe &
452 ,I_START=grid%i_start,I_END=min(grid%i_end, ide-1) &
453 ,J_START=grid%j_start,J_END=min(grid%j_end, jde-1) &
454 ,KTS=k_start, KTE=min(k_end,kde-1) &
455 ,NUM_TILES=grid%num_tiles &
456 ,MAX_TIME_STEP=grid%max_time_step &
457 ,ADAPTIVE_TS=config_flags%use_adaptive_time_step &
460 CASE (THOMPSON, THOMPSONAERO)
462 CALL diagnostic_output_nwp( &
463 U=grid%u_2 ,V=grid%v_2 &
464 ,TEMP=grid%t_phy ,P8W=p8w &
465 ,DT=grid%dt ,SBW=config_flags%spec_bdy_width &
468 ,MPHYSICS_OPT=config_flags%mp_physics & ! gthompsn
469 ,GSFCGCE_HAIL=config_flags%gsfcgce_hail & ! gthompsn
470 ,GSFCGCE_2ICE=config_flags%gsfcgce_2ice & ! gthompsn
471 ,MPUSE_HAIL=config_flags%hail_opt & ! gthompsn
472 ,NSSL_ALPHAH=config_flags%nssl_alphah & ! gthompsn
473 ,NSSL_ALPHAHL=config_flags%nssl_alphahl & ! gthompsn
474 ,NSSL_CNOH=config_flags%nssl_cnoh & ! gthompsn
475 ,NSSL_CNOHL=config_flags%nssl_cnohl & ! gthompsn
476 ,NSSL_RHO_QH=config_flags%nssl_rho_qh & ! gthompsn
477 ,NSSL_RHO_QHL=config_flags%nssl_rho_qhl & ! gthompsn
478 ,CURR_SECS2=curr_secs2 &
479 ,NWP_DIAGNOSTICS=config_flags%nwp_diagnostics &
480 ,DIAGFLAG=diag_flag &
481 ,HISTORY_INTERVAL=grid%history_interval &
482 ,ITIMESTEP=grid%itimestep &
483 ,U10=grid%u10,V10=grid%v10,W=grid%w_2 &
484 ,WSPD10MAX=grid%wspd10max &
485 ,UP_HELI_MAX=grid%up_heli_max &
486 ,W_UP_MAX=grid%w_up_max,W_DN_MAX=grid%w_dn_max &
487 ,ZNW=grid%znw,W_COLMEAN=grid%w_colmean &
488 ,NUMCOLPTS=grid%numcolpts,W_MEAN=grid%w_mean &
489 ,GRPL_MAX=grid%grpl_max,GRPL_COLINT=grid%grpl_colint &
490 ,REFD_MAX=grid%refd_max &
491 ,refl_10cm=grid%refl_10cm &
492 ,HAIL_MAXK1=grid%hail_maxk1,HAIL_MAX2D=grid%hail_max2d & ! gthompsn
493 ,QG_CURR=moist(ims,kms,jms,P_QG) &
494 ,QR_CURR=moist(ims,kms,jms,P_QR) & ! gthompsn
495 ,NR_CURR=scalar(ims,kms,jms,P_QNR) & ! gthompsn
496 ,RHO=grid%rho,PH=grid%ph_2,PHB=grid%phb,G=g &
497 ! Dimension arguments
498 ,IDS=ids,IDE=ide, JDS=jds,JDE=jde, KDS=kds,KDE=kde &
499 ,IMS=ims,IME=ime, JMS=jms,JME=jme, KMS=kms,KME=kme &
500 ,IPS=ips,IPE=ipe, JPS=jps,JPE=jpe, KPS=kps,KPE=kpe &
501 ,I_START=grid%i_start,I_END=min(grid%i_end, ide-1) &
502 ,J_START=grid%j_start,J_END=min(grid%j_end, jde-1) &
503 ,KTS=k_start, KTE=min(k_end,kde-1) &
504 ,NUM_TILES=grid%num_tiles &
505 ,MAX_TIME_STEP=grid%max_time_step &
506 ,ADAPTIVE_TS=config_flags%use_adaptive_time_step &
511 CALL diagnostic_output_nwp( &
512 U=grid%u_2 ,V=grid%v_2 &
513 ,TEMP=grid%t_phy ,P8W=p8w &
514 ,DT=grid%dt ,SBW=config_flags%spec_bdy_width &
517 ,MPHYSICS_OPT=config_flags%mp_physics & ! gthompsn
518 ,GSFCGCE_HAIL=config_flags%gsfcgce_hail & ! gthompsn
519 ,GSFCGCE_2ICE=config_flags%gsfcgce_2ice & ! gthompsn
520 ,MPUSE_HAIL=config_flags%hail_opt & ! gthompsn
521 ,NSSL_ALPHAH=config_flags%nssl_alphah & ! gthompsn
522 ,NSSL_ALPHAHL=config_flags%nssl_alphahl & ! gthompsn
523 ,NSSL_CNOH=config_flags%nssl_cnoh & ! gthompsn
524 ,NSSL_CNOHL=config_flags%nssl_cnohl & ! gthompsn
525 ,NSSL_RHO_QH=config_flags%nssl_rho_qh & ! gthompsn
526 ,NSSL_RHO_QHL=config_flags%nssl_rho_qhl & ! gthompsn
527 ,CURR_SECS2=curr_secs2 &
528 ,NWP_DIAGNOSTICS=config_flags%nwp_diagnostics &
529 ,DIAGFLAG=diag_flag &
530 ,HISTORY_INTERVAL=grid%history_interval &
531 ,ITIMESTEP=grid%itimestep &
532 ,U10=grid%u10,V10=grid%v10,W=grid%w_2 &
533 ,WSPD10MAX=grid%wspd10max &
534 ,UP_HELI_MAX=grid%up_heli_max &
535 ,W_UP_MAX=grid%w_up_max,W_DN_MAX=grid%w_dn_max &
536 ,ZNW=grid%znw,W_COLMEAN=grid%w_colmean &
537 ,NUMCOLPTS=grid%numcolpts,W_MEAN=grid%w_mean &
538 ,GRPL_MAX=grid%grpl_max,GRPL_COLINT=grid%grpl_colint &
539 ,REFD_MAX=grid%refd_max &
540 ,refl_10cm=grid%refl_10cm &
541 ,HAIL_MAXK1=grid%hail_maxk1,HAIL_MAX2D=grid%hail_max2d & ! gthompsn
542 ,QG_CURR=moist(ims,kms,jms,P_QG) &
543 ,QR_CURR=moist(ims,kms,jms,P_QR) & ! gthompsn
544 ,NR_CURR=scalar(ims,kms,jms,P_QNR) & ! gthompsn
545 ,NG_CURR=scalar(ims,kms,jms,P_QNG) & ! THOMPSONGH
546 ,QVOLG_CURR=scalar(ims,kms,jms,P_QVOLG) & ! THOMPSONGH
547 ,RHO=grid%rho,PH=grid%ph_2,PHB=grid%phb,G=g &
548 ! Dimension arguments
549 ,IDS=ids,IDE=ide, JDS=jds,JDE=jde, KDS=kds,KDE=kde &
550 ,IMS=ims,IME=ime, JMS=jms,JME=jme, KMS=kms,KME=kme &
551 ,IPS=ips,IPE=ipe, JPS=jps,JPE=jpe, KPS=kps,KPE=kpe &
552 ,I_START=grid%i_start,I_END=min(grid%i_end, ide-1) &
553 ,J_START=grid%j_start,J_END=min(grid%j_end, jde-1) &
554 ,KTS=k_start, KTE=min(k_end,kde-1) &
555 ,NUM_TILES=grid%num_tiles &
556 ,MAX_TIME_STEP=grid%max_time_step &
557 ,ADAPTIVE_TS=config_flags%use_adaptive_time_step &
560 CASE (MORR_TWO_MOMENT, MORR_TM_AERO) ! TWG add
562 CALL diagnostic_output_nwp( &
563 U=grid%u_2 ,V=grid%v_2 &
564 ,TEMP=grid%t_phy ,P8W=p8w &
565 ,DT=grid%dt ,SBW=config_flags%spec_bdy_width &
568 ,MPHYSICS_OPT=config_flags%mp_physics & ! gthompsn
569 ,GSFCGCE_HAIL=config_flags%gsfcgce_hail & ! gthompsn
570 ,GSFCGCE_2ICE=config_flags%gsfcgce_2ice & ! gthompsn
571 ,MPUSE_HAIL=config_flags%morr_rimed_ice & ! gthompsn
572 ,NSSL_ALPHAH=config_flags%nssl_alphah & ! gthompsn
573 ,NSSL_ALPHAHL=config_flags%nssl_alphahl & ! gthompsn
574 ,NSSL_CNOH=config_flags%nssl_cnoh & ! gthompsn
575 ,NSSL_CNOHL=config_flags%nssl_cnohl & ! gthompsn
576 ,NSSL_RHO_QH=config_flags%nssl_rho_qh & ! gthompsn
577 ,NSSL_RHO_QHL=config_flags%nssl_rho_qhl & ! gthompsn
578 ,CURR_SECS2=curr_secs2 &
579 ,NWP_DIAGNOSTICS=config_flags%nwp_diagnostics &
580 ,DIAGFLAG=diag_flag &
581 ,HISTORY_INTERVAL=grid%history_interval &
582 ,ITIMESTEP=grid%itimestep &
583 ,U10=grid%u10,V10=grid%v10,W=grid%w_2 &
584 ,WSPD10MAX=grid%wspd10max &
585 ,UP_HELI_MAX=grid%up_heli_max &
586 ,W_UP_MAX=grid%w_up_max,W_DN_MAX=grid%w_dn_max &
587 ,ZNW=grid%znw,W_COLMEAN=grid%w_colmean &
588 ,NUMCOLPTS=grid%numcolpts,W_MEAN=grid%w_mean &
589 ,GRPL_MAX=grid%grpl_max,GRPL_COLINT=grid%grpl_colint &
590 ,REFD_MAX=grid%refd_max &
591 ,refl_10cm=grid%refl_10cm &
592 ,HAIL_MAXK1=grid%hail_maxk1,HAIL_MAX2D=grid%hail_max2d & ! gthompsn
593 ,QG_CURR=moist(ims,kms,jms,P_QG) &
594 ,NG_CURR=scalar(ims,kms,jms,P_QNG) & ! gthompsn
595 ,RHO=grid%rho,PH=grid%ph_2,PHB=grid%phb,G=g &
596 ! Dimension arguments
597 ,IDS=ids,IDE=ide, JDS=jds,JDE=jde, KDS=kds,KDE=kde &
598 ,IMS=ims,IME=ime, JMS=jms,JME=jme, KMS=kms,KME=kme &
599 ,IPS=ips,IPE=ipe, JPS=jps,JPE=jpe, KPS=kps,KPE=kpe &
600 ,I_START=grid%i_start,I_END=min(grid%i_end, ide-1) &
601 ,J_START=grid%j_start,J_END=min(grid%j_end, jde-1) &
602 ,KTS=k_start, KTE=min(k_end,kde-1) &
603 ,NUM_TILES=grid%num_tiles &
604 ,MAX_TIME_STEP=grid%max_time_step &
605 ,ADAPTIVE_TS=config_flags%use_adaptive_time_step &
610 CALL diagnostic_output_nwp( &
611 U=grid%u_2 ,V=grid%v_2 &
612 ,TEMP=grid%t_phy ,P8W=p8w &
613 ,DT=grid%dt ,SBW=config_flags%spec_bdy_width &
616 ,MPHYSICS_OPT=config_flags%mp_physics & ! gthompsn
617 ,GSFCGCE_HAIL=config_flags%gsfcgce_hail & ! gthompsn
618 ,GSFCGCE_2ICE=config_flags%gsfcgce_2ice & ! gthompsn
619 ,MPUSE_HAIL=config_flags%hail_opt & ! gthompsn
620 ,NSSL_ALPHAH=config_flags%nssl_alphah & ! gthompsn
621 ,NSSL_ALPHAHL=config_flags%nssl_alphahl & ! gthompsn
622 ,NSSL_CNOH=config_flags%nssl_cnoh & ! gthompsn
623 ,NSSL_CNOHL=config_flags%nssl_cnohl & ! gthompsn
624 ,NSSL_RHO_QH=config_flags%nssl_rho_qh & ! gthompsn
625 ,NSSL_RHO_QHL=config_flags%nssl_rho_qhl & ! gthompsn
626 ,CURR_SECS2=curr_secs2 &
627 ,NWP_DIAGNOSTICS=config_flags%nwp_diagnostics &
628 ,DIAGFLAG=diag_flag &
629 ,HISTORY_INTERVAL=grid%history_interval &
630 ,ITIMESTEP=grid%itimestep &
631 ,U10=grid%u10,V10=grid%v10,W=grid%w_2 &
632 ,WSPD10MAX=grid%wspd10max &
633 ,UP_HELI_MAX=grid%up_heli_max &
634 ,W_UP_MAX=grid%w_up_max,W_DN_MAX=grid%w_dn_max &
635 ,ZNW=grid%znw,W_COLMEAN=grid%w_colmean &
636 ,NUMCOLPTS=grid%numcolpts,W_MEAN=grid%w_mean &
637 ,GRPL_MAX=grid%grpl_max,GRPL_COLINT=grid%grpl_colint &
638 ,REFD_MAX=grid%refd_max &
639 ,refl_10cm=grid%refl_10cm &
640 ,HAIL_MAXK1=grid%hail_maxk1,HAIL_MAX2D=grid%hail_max2d & ! gthompsn
641 ,QG_CURR=moist(ims,kms,jms,P_QG) &
642 ,QH_CURR=moist(ims,kms,jms,P_QH) & ! gthompsn
643 ,RHO=grid%rho,PH=grid%ph_2,PHB=grid%phb,G=g &
644 ! Dimension arguments
645 ,IDS=ids,IDE=ide, JDS=jds,JDE=jde, KDS=kds,KDE=kde &
646 ,IMS=ims,IME=ime, JMS=jms,JME=jme, KMS=kms,KME=kme &
647 ,IPS=ips,IPE=ipe, JPS=jps,JPE=jpe, KPS=kps,KPE=kpe &
648 ,I_START=grid%i_start,I_END=min(grid%i_end, ide-1) &
649 ,J_START=grid%j_start,J_END=min(grid%j_end, jde-1) &
650 ,KTS=k_start, KTE=min(k_end,kde-1) &
651 ,NUM_TILES=grid%num_tiles &
652 ,MAX_TIME_STEP=grid%max_time_step &
653 ,ADAPTIVE_TS=config_flags%use_adaptive_time_step &
656 CASE (MILBRANDT2MOM, NSSL_2MOM, NSSL_2MOMCCN)
658 CALL diagnostic_output_nwp( &
659 U=grid%u_2 ,V=grid%v_2 &
660 ,TEMP=grid%t_phy ,P8W=p8w &
661 ,DT=grid%dt ,SBW=config_flags%spec_bdy_width &
664 ,MPHYSICS_OPT=config_flags%mp_physics & ! gthompsn
665 ,GSFCGCE_HAIL=config_flags%gsfcgce_hail & ! gthompsn
666 ,GSFCGCE_2ICE=config_flags%gsfcgce_2ice & ! gthompsn
667 ,MPUSE_HAIL=config_flags%hail_opt & ! gthompsn
668 ,NSSL_ALPHAH=config_flags%nssl_alphah & ! gthompsn
669 ,NSSL_ALPHAHL=config_flags%nssl_alphahl & ! gthompsn
670 ,NSSL_CNOH=config_flags%nssl_cnoh & ! gthompsn
671 ,NSSL_CNOHL=config_flags%nssl_cnohl & ! gthompsn
672 ,NSSL_RHO_QH=config_flags%nssl_rho_qh & ! gthompsn
673 ,NSSL_RHO_QHL=config_flags%nssl_rho_qhl & ! gthompsn
674 ,CURR_SECS2=curr_secs2 &
675 ,NWP_DIAGNOSTICS=config_flags%nwp_diagnostics &
676 ,DIAGFLAG=diag_flag &
677 ,HISTORY_INTERVAL=grid%history_interval &
678 ,ITIMESTEP=grid%itimestep &
679 ,U10=grid%u10,V10=grid%v10,W=grid%w_2 &
680 ,WSPD10MAX=grid%wspd10max &
681 ,UP_HELI_MAX=grid%up_heli_max &
682 ,W_UP_MAX=grid%w_up_max,W_DN_MAX=grid%w_dn_max &
683 ,ZNW=grid%znw,W_COLMEAN=grid%w_colmean &
684 ,NUMCOLPTS=grid%numcolpts,W_MEAN=grid%w_mean &
685 ,GRPL_MAX=grid%grpl_max,GRPL_COLINT=grid%grpl_colint &
686 ,REFD_MAX=grid%refd_max &
687 ,refl_10cm=grid%refl_10cm &
688 ,HAIL_MAXK1=grid%hail_maxk1,HAIL_MAX2D=grid%hail_max2d & ! gthompsn
689 ,QG_CURR=moist(ims,kms,jms,P_QG) &
690 ,NG_CURR=scalar(ims,kms,jms,P_QNG) & ! gthompsn
691 ,QH_CURR=moist(ims,kms,jms,P_QH) & ! gthompsn
692 ,NH_CURR=scalar(ims,kms,jms,P_QNH) & ! gthompsn
693 ,RHO=grid%rho,PH=grid%ph_2,PHB=grid%phb,G=g &
694 ! Dimension arguments
695 ,IDS=ids,IDE=ide, JDS=jds,JDE=jde, KDS=kds,KDE=kde &
696 ,IMS=ims,IME=ime, JMS=jms,JME=jme, KMS=kms,KME=kme &
697 ,IPS=ips,IPE=ipe, JPS=jps,JPE=jpe, KPS=kps,KPE=kpe &
698 ,I_START=grid%i_start,I_END=min(grid%i_end, ide-1) &
699 ,J_START=grid%j_start,J_END=min(grid%j_end, jde-1) &
700 ,KTS=k_start, KTE=min(k_end,kde-1) &
701 ,NUM_TILES=grid%num_tiles &
702 ,MAX_TIME_STEP=grid%max_time_step &
703 ,ADAPTIVE_TS=config_flags%use_adaptive_time_step &
706 !..The remaining microphysics schemes do not have graupel, but
707 !..P_QG will just be empty and the remaining NWP-diagnostics can
708 !..still be computed, so go ahead, under DEFAULT, not their own.
710 ! CASE (KESSLERSCHEME)
714 ! CASE (SBU_YLINSCHEME)
720 ! CASE (MILBRANDT3MOM)
722 ! CASE (MORR_MILB_P3)
724 ! CASE (CAMMGMPSCHEME)
726 ! CASE (FULL_KHAIN_LYNN)
728 ! CASE (FAST_KHAIN_LYNN_SHPUND)
736 CALL diagnostic_output_nwp( &
737 U=grid%u_2 ,V=grid%v_2 &
738 ,TEMP=grid%t_phy ,P8W=p8w &
739 ,DT=grid%dt ,SBW=config_flags%spec_bdy_width &
742 ,MPHYSICS_OPT=config_flags%mp_physics & ! gthompsn
743 ,GSFCGCE_HAIL=config_flags%gsfcgce_hail & ! gthompsn
744 ,GSFCGCE_2ICE=config_flags%gsfcgce_2ice & ! gthompsn
745 ,MPUSE_HAIL=config_flags%hail_opt & ! gthompsn
746 ,NSSL_ALPHAH=config_flags%nssl_alphah & ! gthompsn
747 ,NSSL_ALPHAHL=config_flags%nssl_alphahl & ! gthompsn
748 ,NSSL_CNOH=config_flags%nssl_cnoh & ! gthompsn
749 ,NSSL_CNOHL=config_flags%nssl_cnohl & ! gthompsn
750 ,NSSL_RHO_QH=config_flags%nssl_rho_qh & ! gthompsn
751 ,NSSL_RHO_QHL=config_flags%nssl_rho_qhl & ! gthompsn
752 ,CURR_SECS2=curr_secs2 &
753 ,NWP_DIAGNOSTICS=config_flags%nwp_diagnostics &
754 ,DIAGFLAG=diag_flag &
755 ,HISTORY_INTERVAL=grid%history_interval &
756 ,ITIMESTEP=grid%itimestep &
757 ,U10=grid%u10,V10=grid%v10,W=grid%w_2 &
758 ,WSPD10MAX=grid%wspd10max &
759 ,UP_HELI_MAX=grid%up_heli_max &
760 ,W_UP_MAX=grid%w_up_max,W_DN_MAX=grid%w_dn_max &
761 ,ZNW=grid%znw,W_COLMEAN=grid%w_colmean &
762 ,NUMCOLPTS=grid%numcolpts,W_MEAN=grid%w_mean &
763 ,GRPL_MAX=grid%grpl_max,GRPL_COLINT=grid%grpl_colint &
764 ,REFD_MAX=grid%refd_max &
765 ,refl_10cm=grid%refl_10cm &
766 ,HAIL_MAXK1=grid%hail_maxk1,HAIL_MAX2D=grid%hail_max2d & ! gthompsn
767 ,QG_CURR=moist(ims,kms,jms,P_QG) &
768 ,RHO=grid%rho,PH=grid%ph_2,PHB=grid%phb,G=g &
769 ! Dimension arguments
770 ,IDS=ids,IDE=ide, JDS=jds,JDE=jde, KDS=kds,KDE=kde &
771 ,IMS=ims,IME=ime, JMS=jms,JME=jme, KMS=kms,KME=kme &
772 ,IPS=ips,IPE=ipe, JPS=jps,JPE=jpe, KPS=kps,KPE=kpe &
773 ,I_START=grid%i_start,I_END=min(grid%i_end, ide-1) &
774 ,J_START=grid%j_start,J_END=min(grid%j_end, jde-1) &
775 ,KTS=k_start, KTE=min(k_end,kde-1) &
776 ,NUM_TILES=grid%num_tiles &
777 ,MAX_TIME_STEP=grid%max_time_step &
778 ,ADAPTIVE_TS=config_flags%use_adaptive_time_step &
785 ! Climate-oriented diagnostic quantities.
787 CLIMATE_DIAGS : IF ( config_flags%output_diagnostics == 1 ) THEN
789 IF ( ( config_flags%auxhist3_interval == 0 ) ) THEN
790 WRITE (diag_message , * ) &
791 "CLWRF: ERROR -- error -- ERROR -- error : NO 'auxhist3_interval' has been defined in 'namelist.input'"
792 CALL wrf_error_fatal ( diag_message )
795 CALL wrf_debug ( 100 , '--> CALL DIAGNOSTICS PACKAGE: CLIMATE DIAGNOSTICS' )
797 CALL clwrf_output_calc( &
798 is_restart=config_flags%restart &
799 ,clwrfH=config_flags%auxhist3_interval &
800 ,T2=grid%t2, Q2=grid%q2, U10=grid%u10, V10=grid%v10 &
802 ,T2CLMIN=grid%t2min, T2CLMAX=grid%t2max &
803 ,TT2CLMIN=grid%tt2min, TT2CLMAX=grid%tt2max &
804 ,T2CLMEAN=grid%t2mean, T2CLSTD=grid%t2std &
805 ,Q2CLMIN=grid%q2min, Q2CLMAX=grid%q2max &
806 ,TQ2CLMIN=grid%tq2min, TQ2CLMAX=grid%tq2max &
807 ,Q2CLMEAN=grid%q2mean, Q2CLSTD=grid%q2std &
808 ,U10CLMAX=grid%u10max, V10CLMAX=grid%v10max &
809 ,SPDUV10CLMAX=grid%spduv10max &
810 ,TSPDUV10CLMAX=grid%tspduv10max &
811 ,U10CLMEAN=grid%u10mean, V10CLMEAN=grid%v10mean &
812 ,SPDUV10CLMEAN=grid%spduv10mean &
813 ,U10CLSTD=grid%u10std, V10CLSTD=grid%v10std &
814 ,SPDUV10CLSTD=grid%spduv10std &
815 ,RAINCCLMAX=grid%raincvmax &
816 ,RAINNCCLMAX=grid%rainncvmax &
817 ,TRAINCCLMAX=grid%traincvmax &
818 ,TRAINNCCLMAX=grid%trainncvmax &
819 ,RAINCCLMEAN=grid%raincvmean &
820 ,RAINNCCLMEAN=grid%rainncvmean &
821 ,RAINCCLSTD=grid%raincvstd &
822 ,RAINNCCLSTD=grid%rainncvstd &
823 ,SKINTEMPCLMIN=grid%skintempmin &
824 ,SKINTEMPCLMAX=grid%skintempmax &
825 ,TSKINTEMPCLMIN=grid%tskintempmin &
826 ,TSKINTEMPCLMAX=grid%tskintempmax &
827 ,SKINTEMPCLMEAN=grid%skintempmean &
828 ,SKINTEMPCLSTD=grid%skintempstd &
829 ,RAINCV=grid%raincv ,RAINNCV=grid%rainncv &
831 ,XTIME=grid%xtime,CURR_SECS2=curr_secs2 &
832 ,NSTEPS=grid%nsteps &
833 ! Dimension arguments
834 ,IDS=ids,IDE=ide, JDS=jds,JDE=jde, KDS=kds,KDE=kde &
835 ,IMS=ims,IME=ime, JMS=jms,JME=jme, KMS=kms,KME=kme &
836 ,IPS=ips,IPE=ipe, JPS=jps,JPE=jpe, KPS=kps,KPE=kpe &
837 ,I_START=grid%i_start,I_END=min(grid%i_end, ide-1) &
838 ,J_START=grid%j_start,J_END=min(grid%j_end, jde-1) &
839 ,KTS=k_start, KTE=k_end &
840 ,NUM_TILES=grid%num_tiles &
848 ! Pressure level diagnostics.
851 PL_DIAGNOSTICS : IF ( config_flags%p_lev_diags .NE. SKIP_PRESS_DIAGS ) THEN
853 ! Process the diags if this is the correct time step OR
854 ! if this is an adaptive timestep forecast.
856 TIME_TO_DO_PL_DIAGS : IF ( ( ( MOD(NINT(curr_secs2+grid%dt),NINT(config_flags%p_lev_interval)) .EQ. 0 ) ) .OR. &
857 ( config_flags%use_adaptive_time_step ) ) THEN
861 DO ij = 1 , grid%num_tiles
863 CALL wrf_debug ( 100 , '--> CALL DIAGNOSTICS PACKAGE: PRESSURE LEVEL DIAGNOSTICS' )
866 ! Input data for computing
870 ,t=grid%th_phy_m_t0 &
871 ,qv=moist(:,:,:,P_QV) &
878 ! Map factors, coriolis for diags
888 ,use_tot_or_hyd_p=config_flags%use_tot_or_hyd_p &
889 ,extrap_below_grnd=config_flags%extrap_below_grnd &
890 ,missing=config_flags%p_lev_missing &
891 ! The diagnostics, mostly output variables
892 ,num_press_levels=config_flags%num_press_levels &
893 ,max_press_levels=max_plevs &
894 ,press_levels=model_config_rec%press_levels &
899 ,rh_pl = grid%rh_pl &
900 ,ght_pl= grid%ght_pl &
902 ,td_pl = grid%td_pl &
904 ! Dimension arguments
905 ,IDS=ids,IDE=ide, JDS=jds,JDE=jde, KDS=kds,KDE=kde &
906 ,IMS=ims,IME=ime, JMS=jms,JME=jme, KMS=kms,KME=kme &
907 ,ITS=grid%i_start(ij),ITE=grid%i_end(ij) &
908 ,JTS=grid%j_start(ij),JTE=grid%j_end(ij) &
909 ,KTS=k_start,KTE=k_end+1 )
911 !$OMP END PARALLEL DO
912 END IF TIME_TO_DO_PL_DIAGS
913 END IF PL_DIAGNOSTICS
919 ! Height level and AGL diagnostics.
922 ZL_DIAGNOSTICS : IF ( config_flags%z_lev_diags .NE. SKIP_Z_DIAGS ) THEN
924 ! Process the diags if this is the correct time step OR
925 ! if this is an adaptive timestep forecast.
927 TIME_TO_DO_ZL_DIAGS : IF ( ( ( MOD(NINT(curr_secs2+grid%dt),NINT(config_flags%z_lev_interval)) .EQ. 0 ) ) .OR. &
928 ( config_flags%use_adaptive_time_step ) ) THEN
932 DO ij = 1 , grid%num_tiles
934 CALL wrf_debug ( 100 , '--> CALL DIAGNOSTICS PACKAGE: HEIGHT LEVEL AND AGL DIAGNOSTICS' )
937 ! Input data for computing
941 ,t=grid%th_phy_m_t0 &
942 ,qv=moist(:,:,:,P_QV) &
949 ! Map factors, coriolis for diags
960 ,use_tot_or_hyd_p=config_flags%use_tot_or_hyd_p &
961 ,extrap_below_grnd=config_flags%extrap_below_grnd &
962 ,missing=config_flags%z_lev_missing &
963 ! The diagnostics, mostly output variables
964 ,num_z_levels=config_flags%num_z_levels &
965 ,max_z_levels=max_zlevs &
966 ,z_levels=model_config_rec%z_levels &
971 ,rh_zl = grid%rh_zl &
972 ,ght_zl= grid%ght_zl &
974 ,td_zl = grid%td_zl &
977 ! Dimension arguments
978 ,IDS=ids,IDE=ide, JDS=jds,JDE=jde, KDS=kds,KDE=kde &
979 ,IMS=ims,IME=ime, JMS=jms,JME=jme, KMS=kms,KME=kme &
980 ,ITS=grid%i_start(ij),ITE=grid%i_end(ij) &
981 ,JTS=grid%j_start(ij),JTE=grid%j_end(ij) &
982 ,KTS=k_start,KTE=k_end+1 )
984 !$OMP END PARALLEL DO
985 END IF TIME_TO_DO_ZL_DIAGS
986 END IF ZL_DIAGNOSTICS
991 ! AFWA diagnostic package.
993 AFWA_DIAGS : IF ( config_flags%afwa_diag_opt == 1 ) THEN
995 IF ( ( config_flags%history_interval == 0 ) ) THEN
996 WRITE (diag_message , * ) &
997 "AFWA Diagnostics Error : No 'history_interval' defined in namelist"
998 CALL wrf_error_fatal ( diag_message )
1002 !$OMP PRIVATE ( ij )
1003 DO ij = 1 , grid%num_tiles
1005 CALL wrf_debug ( 100 , '--> CALL DIAGNOSTICS PACKAGE: AFWA DIAGNOSTICS' )
1007 CALL afwa_diagnostics_driver ( grid , config_flags &
1011 ,th_phy , pi_phy , p_phy &
1012 ,grid%u_phy , grid%v_phy &
1013 ,dz8w , p8w , t8w , grid%rho &
1014 ,ids, ide, jds, jde, kds, kde &
1015 ,ims, ime, jms, jme, kms, kme &
1016 ,ips, ipe, jps, jpe, kps, kpe &
1017 ,ITS=grid%i_start(ij),ITE=grid%i_end(ij) &
1018 ,JTS=grid%j_start(ij),JTE=grid%j_end(ij) &
1019 ,K_START=k_start,K_END=k_end )
1022 !$OMP END PARALLEL DO
1028 ! RASM Climate Diagnostics - mean output
1030 RASM_DIAGS_MEAN : IF ( config_flags%mean_diag == 1 ) THEN
1032 !IF ( ( config_flags%auxhist3_interval == 0 ) ) THEN
1033 ! WRITE (diag_message , * ) &
1034 ! "CLWRF: ERROR -- error -- ERROR -- error : NO 'auxhist3_interval' has been defined in 'namelist.input'"
1035 ! CALL wrf_error_fatal ( diag_message )
1038 CALL wrf_debug ( 100 , '--> CALL DIAGNOSTICS PACKAGE: RASM DIAGNOSTICS - MEAN' )
1040 CALL domain_clock_get ( grid, current_time=currentTime)
1042 CALL mean_output_calc( &
1043 is_restart=config_flags%restart &
1044 ,CURRENTTIME=currentTime &
1045 ,stats_interval=config_flags%mean_interval &
1046 ,output_freq=config_flags%mean_freq &
1047 ,run_days=config_flags%run_days &
1048 ,DT=grid%dt, XTIME=grid%xtime &
1049 ,PSFC=grid%psfc, PSFC_MEAN=grid%psfc_mean &
1050 ,TSK=grid%tsk, TSK_MEAN=grid%tsk_mean &
1051 ,PMSL_MEAN=grid%pmsl_mean &
1052 ,T2=grid%t2, T2_MEAN=grid%t2_mean &
1053 ,T=grid%th_phy_m_t0, P=grid%p, PB=grid%pb &
1054 ,MOIST=grid%moist(:,:,:,P_QV), HT=grid%ht &
1055 ,TH2=grid%th2, TH2_MEAN=grid%th2_mean &
1056 ,Q2=grid%q2, Q2_MEAN=grid%q2_mean &
1057 ,U10=grid%u10, U10_MEAN=grid%u10_mean &
1058 ,V10=grid%v10, V10_MEAN=grid%v10_mean &
1059 ,HFX=grid%hfx, HFX_MEAN=grid%hfx_mean &
1060 ,LH=grid%lh, LH_MEAN=grid%lh_mean &
1061 ,SWDNB=grid%swdnb, SWDNB_MEAN=grid%swdnb_mean &
1062 ,GLW=grid%glw , GLW_MEAN=grid%glw_mean &
1063 ,LWUPB=grid%lwupb, LWUPB_MEAN=grid%lwupb_mean &
1064 ,SWUPB=grid%swupb, SWUPB_MEAN=grid%swupb_mean &
1065 ,SWUPT=grid%swupt, SWUPT_MEAN=grid%swupt_mean &
1066 ,SWDNT=grid%swdnt, SWDNT_MEAN=grid%swdnt_mean &
1067 ,LWUPT=grid%lwupt, LWUPT_MEAN=grid%lwupt_mean &
1068 ,LWDNT=grid%lwdnt, LWDNT_MEAN=grid%lwdnt_mean &
1069 ,AVGOUTALARM=grid%alarms(AUXHIST5_ALARM) &
1070 ,AVGOUTDATESTR=grid%OUTDATE_MEAN &
1071 ,NSTEPS=grid%NSTEPS_MEAN &
1072 ! Dimension arguments
1073 ,IDS=ids,IDE=ide, JDS=jds,JDE=jde, KDS=kds,KDE=kde &
1074 ,IMS=ims,IME=ime, JMS=jms,JME=jme, KMS=kms,KME=kme &
1075 ,IPS=ips,IPE=ipe, JPS=jps,JPE=jpe, KPS=kps,KPE=kpe &
1076 ,I_START=grid%i_start,I_END=min(grid%i_end, ide-1) &
1077 ,J_START=grid%j_start,J_END=min(grid%j_end, jde-1) &
1078 ,NUM_TILES=grid%num_tiles &
1080 END IF RASM_DIAGS_MEAN
1085 ! RASM Climate Diagnostics - diurnal output
1087 RASM_DIAGS_DIURNAL : IF ( config_flags%diurnal_diag == 1 ) THEN
1089 !IF ( ( config_flags%auxhist3_interval == 0 ) ) THEN
1090 ! WRITE (diag_message , * ) &
1091 ! "CLWRF: ERROR -- error -- ERROR -- error : NO 'auxhist3_interval' has been defined in 'namelist.input'"
1092 ! CALL wrf_error_fatal ( diag_message )
1095 CALL wrf_debug ( 100 , '--> CALL DIAGNOSTICS PACKAGE: RASM DIAGNOSTICS - DIURNAL' )
1097 CALL domain_clock_get ( grid, current_time=currentTime)
1099 CALL diurnalcycle_output_calc( &
1100 is_restart=config_flags%restart &
1101 ,CURRENTTIME=currentTime &
1102 ,DT=grid%dt, XTIME=grid%xtime &
1103 ,PSFC=grid%psfc, PSFC_DTMP=grid%psfc_dtmp &
1104 ,TSK=grid%tsk, TSK_DTMP=grid%tsk_dtmp &
1105 ,T2=grid%t2, T2_DTMP=grid%t2_dtmp &
1106 ,T=grid%th_phy_m_t0, P=grid%p, PB=grid%pb &
1107 ,MOIST=grid%moist(:,:,:,P_QV) &
1108 ,TH2=grid%th2, TH2_DTMP=grid%th2_dtmp &
1109 ,Q2=grid%q2, Q2_DTMP=grid%q2_dtmp &
1110 ,U10=grid%u10, U10_DTMP=grid%u10_dtmp &
1111 ,V10=grid%v10, V10_DTMP=grid%v10_dtmp &
1112 ,HFX=grid%hfx, HFX_DTMP=grid%hfx_dtmp &
1113 ,LH=grid%lh, LH_DTMP=grid%lh_dtmp &
1114 ,SWDNB=grid%swdnb, SWDNB_DTMP=grid%swdnb_dtmp &
1115 ,GLW=grid%glw, GLW_DTMP=grid%glw_dtmp &
1116 ,LWUPB=grid%lwupb, LWUPB_DTMP=grid%lwupb_dtmp &
1117 ,SWUPB=grid%swupb, SWUPB_DTMP=grid%swupb_dtmp &
1118 ,SWUPT=grid%swupt, SWUPT_DTMP=grid%swupt_dtmp &
1119 ,SWDNT=grid%swdnt, SWDNT_DTMP=grid%swdnt_dtmp &
1120 ,LWUPT=grid%lwupt, LWUPT_DTMP=grid%lwupt_dtmp &
1121 ,LWDNT=grid%lwdnt, LWDNT_DTMP=grid%lwdnt_dtmp &
1122 ,AVGOUTALARM=grid%alarms(AUXHIST6_ALARM) &
1123 ,DIURNOUTDATESTR=grid%OUTDATE_DIURN &
1124 ,AVG_NSTEPS=grid%NSTEPSMEAN_DIURN &
1125 ,DIURNAL_NSTEPS=grid%NSTEPS_DIURN &
1126 ,PSFC_DIURN=grid%PSFC_DIURN &
1127 ,TSK_DIURN=grid%TSK_DIURN, T2_DIURN=grid%T2_DIURN &
1128 ,TH2_DIURN=grid%TH2_DIURN, Q2_DIURN=grid%Q2_DIURN &
1129 ,U10_DIURN=grid%U10_DIURN, V10_DIURN=grid%V10_DIURN &
1130 ,HFX_DIURN=grid%HFX_DIURN, LH_DIURN=grid%LH_DIURN &
1131 ,SWDNB_DIURN=grid%SWDNB_DIURN, GLW_DIURN=grid%GLW_DIURN &
1132 ,LWUPB_DIURN=grid%LWUPB_DIURN, SWUPB_DIURN=grid%SWUPB_DIURN &
1133 ,SWUPT_DIURN=grid%SWUPT_DIURN, SWDNT_DIURN=grid%SWDNT_DIURN &
1134 ,LWUPT_DIURN=grid%LWUPT_DIURN, LWDNT_DIURN=grid%LWDNT_DIURN &
1135 ! Dimension arguments
1136 ,IDS=ids, IDE=ide, JDS=jds, JDE=jde, KDS=kds, KDE=kde &
1137 ,IMS=ims, IME=ime, JMS=jms, JME=jme, KMS=kms, KME=kme &
1138 ,IPS=ips, IPE=ipe, JPS=jps, JPE=jpe, KPS=kps, KPE=kpe &
1139 ,I_START=grid%i_start, I_END=min(grid%i_end, ide-1) &
1140 ,J_START=grid%j_start, J_END=min(grid%j_end, jde-1) &
1141 ,NUM_TILES=grid%num_tiles &
1143 END IF RASM_DIAGS_DIURNAL
1146 ! Noah-MP accumulation output
1148 NOAHMP_DIAGS : IF ( config_flags%sf_surface_physics == 4 .and. config_flags%noahmp_output == 3 ) THEN
1150 CALL wrf_debug ( 100 , '--> CALL DIAGNOSTICS PACKAGE: NOAHMP_DIAGS' )
1152 CALL domain_clock_get ( grid, current_time=currentTime)
1154 CALL noahmp_output_calc( &
1155 ims=ims, ime=ime, jms=jms, jme=jme ,&
1156 i_start=grid%i_start, i_end=min(grid%i_end, ide-1) ,&
1157 j_start=grid%j_start, j_end=min(grid%j_end, jde-1) ,&
1158 num_tiles=grid%num_tiles ,&
1160 noahmp_acc_dt=config_flags%noahmp_acc_dt ,&
1161 opt_run=config_flags%opt_run ,&
1162 stepwtd=grid%stepwtd ,&
1163 itimestep=grid%itimestep ,&
1164 curr_secs2=curr_secs2 ,&
1165 acsagb=grid%acsagb , acsagv=grid%acsagv , sag=grid%sagxy ,&
1166 acirg=grid%acirg , irg=grid%irgxy ,&
1167 acshg=grid%acshg , shg=grid%shgxy ,&
1168 acevg=grid%acevg , evg=grid%evgxy ,&
1169 acghv=grid%acghv , ghv=grid%ghvxy ,&
1170 acpahg=grid%acpahg , pahg=grid%pahgxy ,&
1171 acirb=grid%acirb , irb=grid%irbxy ,&
1172 acshb=grid%acshb , shb=grid%shbxy ,&
1173 acevb=grid%acevb , evb=grid%evbxy ,&
1174 acghb=grid%acghb , ghb=grid%ghbxy ,&
1175 acpahb=grid%acpahb , pahb=grid%pahbxy ,&
1176 acsav=grid%acsav , sav=grid%savxy ,&
1177 acirc=grid%acirc , ircmp=grid%ircxy ,&
1178 acshc=grid%acshc , shc=grid%shcxy ,&
1179 acevc=grid%acevc , evc=grid%evcxy ,&
1180 actr=grid%actr , tr=grid%trxy ,&
1181 acpahv=grid%acpahv , pahv=grid%pahvxy ,&
1182 acswdnlsm=grid%acswdnlsm , swdown=grid%swnorm ,&
1183 acswuplsm=grid%acswuplsm , albedo=grid%albedo ,&
1184 aclwdnlsm=grid%aclwdnlsm , emiss=grid%emiss , glw=grid%glw ,&
1185 aclwuplsm=grid%aclwuplsm , trad=grid%tradxy ,&
1186 acshflsm=grid%acshflsm ,aclhflsm=grid%aclhflsm ,&
1187 acghflsm=grid%acghflsm ,acpahlsm=grid%acpahlsm ,&
1188 acints=grid%acints , qints=grid%qintsxy ,&
1189 acintr=grid%acintr , qintr=grid%qintrxy ,&
1190 acdrips=grid%acdrips , qdrips=grid%qdripsxy ,&
1191 acdripr=grid%acdripr , qdripr=grid%qdriprxy ,&
1192 acthros=grid%acthros , qthros=grid%qthrosxy ,&
1193 acthror=grid%acthror , qthror=grid%qthrorxy ,&
1194 acsnsub=grid%acsnsub , qsnsub=grid%qsnsubxy ,&
1195 acsnfro=grid%acsnfro , qsnfro=grid%qsnfroxy ,&
1196 acsubc=grid%acsubc , qsubc=grid%qsubcxy ,&
1197 acfroc=grid%acfroc , qfroc=grid%qfrocxy ,&
1198 acevac=grid%acevac , qevac=grid%qevacxy ,&
1199 acdewc=grid%acdewc , qdewc=grid%qdewcxy ,&
1200 acfrzc=grid%acfrzc , qfrzc=grid%qfrzcxy ,&
1201 acmeltc=grid%acmeltc , qmeltc=grid%qmeltcxy ,&
1202 acsnbot=grid%acsnbot , qsnbot=grid%qsnbotxy ,&
1203 acsnmelt=grid%acsnmelt , qmelt=grid%qmeltxy ,&
1204 acponding=grid%acponding , ponding=grid%pondingxy ,&
1205 acrainlsm=grid%acrainlsm , rainlsm=grid%rainlsm ,&
1206 acsnowlsm=grid%acsnowlsm , snowlsm=grid%snowlsm ,&
1207 acrainsnow=grid%acrainsnow, isnow=grid%isnowxy ,&
1208 acrunsb=grid%acrunsb , runsb=grid%runsbxy ,&
1209 acrunsf=grid%acrunsf , runsf=grid%runsfxy ,&
1210 acecan=grid%acecan , ecan=grid%ecanxy ,&
1211 acetran=grid%acetran , etran=grid%etranxy ,&
1212 acedir=grid%acedir , edir=grid%edirxy ,&
1213 acetlsm=grid%acetlsm ,&
1214 acqlat=grid%acqlat , qlat=grid%qlatxy ,&
1215 acqrf=grid%acqrf , qrf=grid%qrfxy ,&
1216 acrech=grid%acrech ,deeprech=grid%deeprechxy ,&
1217 acqspring=grid%acqspring , qspring=grid%qspringxy ,&
1218 fpice=grid%fpicexy , fveg=grid%fvegxy ,&
1219 aceflxb=grid%aceflxb , eflxb=grid%eflxbxy ,&
1220 accanhs=grid%accanhs , canhs=grid%canhsxy )
1225 SOLAR_FIELDS: IF (config_flags%solar_diagnostics == do_solar_output) THEN
1226 CALL wrf_debug (100 , '--> CALL DIAGNOSTICS PACKAGE: SOLAR_DIAG')
1228 CALL solar_diag (dt=grid%dt, &
1229 rho=grid%rho, dz8w=dz8w, ph=grid%ph_2, phb=grid%phb, &
1230 cldfrac3d=grid%cldfra, coszen=grid%coszen, swdnb=grid%swdnb, &
1231 swdnt=grid%swdnt, param_first_scalar=param_first_scalar, &
1232 p_qc=p_qc, p_qi=p_qi, p_qs=p_qs, qv=moist(ims,kms,jms,P_QV), &
1233 qc=moist(ims,kms,jms,P_QC), qi=moist(ims,kms,jms,P_QI), &
1234 qs=moist(ims,kms,jms,P_QS), qc_tot=grid%qc_tot, &
1235 qi_tot=grid%qi_tot, &
1236 has_reqc=grid%has_reqc, has_reqi=grid%has_reqi, &
1237 has_reqs=grid%has_reqs, f_qv=f_qv, f_qc=f_qc, f_qi=f_qi, &
1238 f_qs=f_qs, re_cloud=grid%re_cloud, re_ice=grid%re_ice, &
1239 re_snow=grid%re_snow, cldfrac2d=grid%cldfrac2d, &
1240 wvp2d=grid%wvp, lwp2d=grid%lwp, iwp2d=grid%iwp, &
1241 swp2d=grid%swp, wp2d_sum=grid%wp_sum, lwp2d_tot=grid%lwp_tot, &
1242 iwp2d_tot=grid%iwp_tot, wp2d_tot_sum=grid%wp_tot_sum, &
1243 re_cloud_path=grid%re_qc, re_ice_path=grid%re_qi, &
1244 re_snow_path=grid%re_qs, re_cloud_path_tot=grid%re_qc_tot, &
1245 re_ice_path_tot=grid%re_qi_tot, tau_qc=grid%tau_qc, &
1246 tau_qi=grid%tau_qi, tau_qs=grid%tau_qs, &
1247 tau_qc_tot=grid%tau_qc_tot, tau_qi_tot=grid%tau_qi_tot, &
1248 cbase=grid%cbaseht, ctop=grid%ctopht, &
1249 cbase_tot=grid%cbaseht_tot, ctop_tot=grid%ctopht_tot, &
1250 clrnidx=grid%clrnidx, sza=grid%sza, ghi_accum=grid%ghi_accum, &
1251 ids=ids, ide=ide, jds=jds, jde=jde, kds=kds, kde=kde, &
1252 ims=ims, ime=ime, jms=jms, jme=jme, kms=kms, kme=kme, &
1253 ips=ips, ipe=ipe, jps=jps, jpe=jpe, kps=kps, kpe=kpe, &
1254 i_start=grid%i_start, i_end=min(grid%i_end, ide-1), &
1255 j_start=grid%j_start, j_end=min(grid%j_end, jde-1), &
1256 kts=k_start, kte=min(k_end,kde-1), num_tiles=grid%num_tiles )
1260 END SUBROUTINE diagnostics_driver
1264 SUBROUTINE update_phys_fields ( grid, config_flags, moist, &
1265 ids, ide, jds, jde, kds, kde, &
1266 ims, ime, jms, jme, kms, kme, &
1267 ips, ipe, jps, jpe, kps, kpe )
1269 USE module_domain, ONLY : domain
1270 USE module_configure, ONLY : grid_config_rec_type
1271 USE module_state_description, ONLY: num_moist, P_Qv
1272 USE module_model_constants, ONLY: g, R_v, R_d, Cp, T0, RCP
1274 TYPE ( domain ), INTENT(INOUT) :: grid
1276 ! We are not changing any of the namelist settings.
1278 TYPE ( grid_config_rec_type ), INTENT(IN) :: config_flags
1280 ! The 4d arrays are input only, no mods to them.
1282 REAL , DIMENSION(ims:ime,kms:kme,jms:jme,num_moist ) , INTENT(IN) :: moist
1284 ! Domain indices - no change to these puppies.
1286 INTEGER , INTENT(IN) :: ids, ide, jds, jde, kds, kde, &
1287 ims, ime, jms, jme, kms, kme, &
1288 ips, ipe, jps, jpe, kps, kpe
1294 ! Moist or dry theta
1296 IF ( config_flags%use_theta_m .EQ. 1 ) THEN
1297 DO j = jps, MIN(jde-1, jpe)
1299 DO i = ips, MIN(ide-1, ipe)
1300 grid%th_phy_m_t0(i,k,j) = (grid%t_2(i,k,j)+T0) / &
1301 (1.+(R_v/R_d)*moist(i,k,j,P_Qv)) - T0
1306 DO j = jps, MIN(jde-1, jpe)
1308 DO i = ips, MIN(ide-1, ipe)
1309 grid%th_phy_m_t0(i,k,j) = grid%t_2(i,k,j)
1314 END SUBROUTINE update_phys_fields
1316 END MODULE module_diagnostics_driver