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 MILBRANDT2MOM , CAMMGMPSCHEME, FAST_KHAIN_LYNN_SHPUND, FULL_KHAIN_LYNN, &
43 NSSL_2MOM, MORR_TM_AERO !TWG add !,MILBRANDT3MOM, MORR_MILB_P3
45 USE module_driver_constants, ONLY: max_plevs, max_zlevs
47 ! From where we preferably are pulling g, Cp, etc.
49 USE module_model_constants, ONLY: g, R_v, R_d, Cp, T0, RCP
51 ! This gives us the type definition for grid (domain) and some clock information.
53 ! USE module_domain, ONLY : domain, domain_clock_get, get_ijk_from_subgrid
54 USE module_domain, ONLY : domain, domain_clock_get, domain_get_current_time
56 ! All of the information from the namelist is in config_flags. The
57 ! type declaration for this puppy must be available. While each domain
58 ! has a config_flags, together they are stored in model_config_rec.
60 USE module_configure, ONLY : grid_config_rec_type, &
64 USE module_utility, ONLY : WRFU_Time
66 !=============================================================
67 ! USE Association for the Diagnostic Packages
68 !=============================================================
70 USE module_lightning_driver, ONLY : lightning_driver
71 USE module_diag_misc, ONLY : diagnostic_output_calc, noahmp_output_calc
72 USE module_diag_nwp, ONLY : diagnostic_output_nwp
73 USE module_diag_cl, ONLY : clwrf_output_calc
74 USE module_diag_pld, ONLY : pld
75 USE module_diag_zld, ONLY : zld
76 USE module_diag_afwa, ONLY : afwa_diagnostics_driver
77 USE module_diag_rasm, ONLY : mean_output_calc, diurnalcycle_output_calc
78 USE module_diag_hailcast, ONLY : hailcast_diagnostic_driver
79 USE module_diag_solar, ONLY : solar_diag
80 USE module_trad_fields, ONLY : trad_fields
85 !=============================================================
86 ! Subroutine Arguments
87 !=============================================================
89 ! Arguments passed in. All of the diagnostics are part of the grid structure, so
90 ! even though we are not changing any of the fundamental variables, we are computing
91 ! the diagnostics. Therefore grid is INOUT.
93 TYPE ( domain ), INTENT(INOUT) :: grid
95 ! We are not changing any of the namelist settings.
97 TYPE ( grid_config_rec_type ), INTENT(IN) :: config_flags
99 ! The 4d arrays are input only, no mods to them.
101 REAL , DIMENSION(ims:ime,kms:kme,jms:jme,num_moist ) , INTENT(IN) :: moist
102 REAL , DIMENSION(ims:ime,kms:kme,jms:jme,num_chem ) , INTENT(IN) :: chem
103 REAL , DIMENSION(ims:ime,kms:kme,jms:jme,num_tracer) , INTENT(IN) :: tracer
104 REAL , DIMENSION(ims:ime,kms:kme,jms:jme,num_scalar) , INTENT(IN) :: scalar
106 ! A few handy 3d arrays computed for the physics scheme: pressure (Pa) and
107 ! temperature (K), on both half (_phy) and full levels.
109 REAL , DIMENSION(ims:ime,kms:kme,jms:jme) , INTENT(IN) :: th_phy , &
116 ! Time (s) since the beginning of the simulation, restart.
121 ! Is this to be a history output time? If so, compute the diagnostics.
125 ! The sundry dimensions required to keep a model running smoothly:
127 ! i: refers to the nominally west east direction, the inner-most (fastest)
129 ! j: refers to the nominally south north direction, the outer-most (slowest)
131 ! k: refers to the vertical direction form bottom to top, the second dimension
134 ! d: refers to the domain size, the geophysical extent of the entire domain,
135 ! not used in dimensions or looping, used to determine when we are close to
136 ! the edge of the boundary
137 ! m: refers to the memory size size, all 2d and 3d arrays from the Registry
138 ! (passed into here via the grid structure or the I1 variables [such as
139 ! p_phy, for example]) use these values for dimensioning
140 ! p: refers to the patch size, the extent over which computational loops run
142 INTEGER , INTENT(IN) :: ids, ide, jds, jde, kds, kde, &
143 ims, ime, jms, jme, kms, kme, &
144 ips, ipe, jps, jpe, kps, kpe
146 ! Hopefully unnecessary, these are the filtered dimensions.
148 INTEGER , INTENT(IN) :: imsx,imex,jmsx,jmex,kmsx,kmex, &
149 ipsx,ipex,jpsx,jpex,kpsx,kpex, &
150 imsy,imey,jmsy,jmey,kmsy,kmey, &
151 ipsy,ipey,jpsy,jpey,kpsy,kpey
154 !=============================================================
156 !=============================================================
158 ! Handy little character string for use instead of print statements.
160 CHARACTER (LEN=1000) :: diag_message
162 ! OpenMP indexing of tiles.
166 ! Vertical indexing that only goes up to the half levels.
168 INTEGER :: k_start, k_end
170 ! Current time associated with current simulation step (RASM_DIAGS)
172 TYPE(WRFU_Time) :: currentTime
174 !=============================================================
175 ! Start of executable code
176 !=============================================================
178 CALL wrf_debug ( 100 , '--> TOP OF DIAGNOSTICS PACKAGE' )
180 ! Some routine initializations.
185 ! There are some fields that were defined in the first RK loop for
186 ! physics and are now a time-step old.
188 CALL update_phys_fields ( grid, config_flags, moist, &
189 ids, ide, jds, jde, kds, kde, &
190 ims, ime, jms, jme, kms, kme, &
191 ips, ipe, jps, jpe, kps, kpe )
193 ! Lightning flash rate diagnostic production.
195 LIGHTNING: IF ( config_flags%lightning_option /= 0 ) THEN
196 CALL wrf_debug ( 100 , '--> CALL DIAGNOSTICS PACKAGE: LIGHTNING_DRIVER' )
197 CALL lightning_driver ( &
198 ! Frequently used prognostics
199 curr_secs, grid%dt, grid%dx, grid%dy, &
200 grid%xlat, grid%xlong, grid%xland, grid%ht, &
201 grid%t_phy, p_phy, grid%rho, &
202 grid%u_phy, grid%v_phy, grid%w_2, &
203 th_phy, pi_phy,dz8w, &
205 ! Scheme specific prognostics
206 grid%ktop_deep, grid%refl_10cm, &
207 domain_get_current_time( grid ), &
208 ! Flashrate namelist inputs
209 config_flags%lightning_option, &
210 config_flags%lightning_dt, &
211 config_flags%lightning_start_seconds, &
213 config_flags%flashrate_factor, &
214 ! IC:CG namelist settings
215 config_flags%iccg_method, &
216 config_flags%iccg_prescribed_num, &
217 config_flags%iccg_prescribed_den, &
219 grid%iccg_in_num, grid%iccg_in_den, &
220 ! Scheme specific namelist inputs
221 config_flags%cellcount_method, &
222 config_flags%cldtop_adjustment, &
223 ! Order dependent args for domain, mem, and tile dims
224 ids, ide, jds, jde, kds, kde, &
225 ims, ime, jms, jme, kms, kme, &
226 ips, ipe, jps, jpe, kps, kpe, &
227 ! Mandatory outputs for all quantitative schemes
228 grid%ic_flashcount, grid%ic_flashrate, &
229 grid%cg_flashcount, grid%cg_flashrate, &
235 !WRF-HAILCAST diagnostic - hail size prediction
236 HAILCAST: IF ( config_flags%hailcast_opt /= 0 ) THEN
238 IF ( ( config_flags%history_interval == 0 ) ) THEN
239 WRITE (diag_message , * ) &
240 "HAILCAST Error : No 'history_interval' defined in namelist"
241 CALL wrf_error_fatal ( diag_message )
246 DO ij = 1 , grid%num_tiles
248 CALL wrf_debug ( 100 , &
249 '--> CALL DIAGNOSTICS PACKAGE: HAILCAST_DIAGNOSTIC_DRIVER' )
251 CALL hailcast_diagnostic_driver ( grid , config_flags &
253 ,ids, ide, jds, jde, kds, kde &
254 ,ims, ime, jms, jme, kms, kme &
255 ,ips, ipe, jps, jpe, kps, kpe &
256 ,ITS=grid%i_start(ij),ITE=grid%i_end(ij) &
257 ,JTS=grid%j_start(ij),JTE=grid%j_end(ij) &
258 ,K_START=k_start,K_END=k_end &
259 ,dt=grid%dt, itimestep=grid%itimestep &
260 ,haildt=grid%haildt, curr_secs=curr_secs2 &
261 ,haildtacttime=grid%haildtacttime )
264 !$OMP END PARALLEL DO
267 TRADITIONAL_FIELDS: IF ( config_flags%diag_nwp2 == do_trad_fields ) THEN
270 DO ij = 1 , grid%num_tiles
272 CALL wrf_debug ( 100 , '--> CALL DIAGNOSTICS PACKAGE: TRAD_FIELDS' )
274 ! Input data for computing
278 ,t=grid%th_phy_m_t0 &
279 ,qv=moist(:,:,:,P_QV) &
286 ! Map factors, coriolis for diags
297 ! Input model diagnostic vraiables
300 ,qc=moist(:,:,:,P_QC) &
302 ,rainnc=grid%rainnc &
303 ,snownc=grid%snownc &
304 ,graupelnc=grid%graupelnc &
305 ,hailnc=grid%hailnc &
309 ,use_theta_m=config_flags%use_theta_m &
310 ! The diagnostic output variables
311 ,sealevelp=grid%sealevelp &
312 ,temperature=grid%temperature &
313 ,pressure=grid%pressure &
314 ,geoheight=grid%geoheight &
321 ,liqrain=grid%liqrain &
323 ,potential_t=grid%potential_t &
325 ! Various indexes for declarations, loop bounds
326 ,IDS=ids,IDE=ide, JDS=jds,JDE=jde, KDS=kds,KDE=kde &
327 ,IMS=ims,IME=ime, JMS=jms,JME=jme, KMS=kms,KME=kme &
328 ,IPS=ips,IPE=ipe, JPS=jps,JPE=jpe, KPS=kps,KPE=kpe &
329 ,ITS=grid%i_start(ij),ITE=grid%i_end(ij) &
330 ,JTS=grid%j_start(ij),JTE=grid%j_end(ij) &
333 !$OMP END PARALLEL DO
334 END IF TRADITIONAL_FIELDS
336 ! Mostly surface values, precip, column integrated quantities.
338 CALL wrf_debug ( 100 , '--> CALL DIAGNOSTICS PACKAGE: ACCUMULATED AND BUCKET DIAGNOSTICS' )
340 CALL diagnostic_output_calc( &
341 DPSDT=grid%dpsdt ,DMUDT=grid%dmudt &
342 ,P8W=p8w ,PK1M=grid%pk1m &
343 ,MU_2=grid%mu_2 ,MU_2M=grid%mu_2m &
344 ,RAINCV=grid%raincv ,RAINNCV=grid%rainncv &
345 ,RAINC=grid%rainc ,RAINNC=grid%rainnc &
346 ,I_RAINC=grid%i_rainc ,I_RAINNC=grid%i_rainnc &
347 ,HFX=grid%hfx ,SFCEVP=grid%sfcevp ,LH=grid%lh &
351 ,ACSWUPT=grid%acswupt ,ACSWUPTC=grid%acswuptc &
352 ,ACSWDNT=grid%acswdnt ,ACSWDNTC=grid%acswdntc &
353 ,ACSWUPB=grid%acswupb ,ACSWUPBC=grid%acswupbc &
354 ,ACSWDNB=grid%acswdnb ,ACSWDNBC=grid%acswdnbc &
355 ,ACLWUPT=grid%aclwupt ,ACLWUPTC=grid%aclwuptc &
356 ,ACLWDNT=grid%aclwdnt ,ACLWDNTC=grid%aclwdntc &
357 ,ACLWUPB=grid%aclwupb ,ACLWUPBC=grid%aclwupbc &
358 ,ACLWDNB=grid%aclwdnb ,ACLWDNBC=grid%aclwdnbc &
359 ,I_ACSWUPT=grid%i_acswupt ,I_ACSWUPTC=grid%i_acswuptc &
360 ,I_ACSWDNT=grid%i_acswdnt ,I_ACSWDNTC=grid%i_acswdntc &
361 ,I_ACSWUPB=grid%i_acswupb ,I_ACSWUPBC=grid%i_acswupbc &
362 ,I_ACSWDNB=grid%i_acswdnb ,I_ACSWDNBC=grid%i_acswdnbc &
363 ,I_ACLWUPT=grid%i_aclwupt ,I_ACLWUPTC=grid%i_aclwuptc &
364 ,I_ACLWDNT=grid%i_aclwdnt ,I_ACLWDNTC=grid%i_aclwdntc &
365 ,I_ACLWUPB=grid%i_aclwupb ,I_ACLWUPBC=grid%i_aclwupbc &
366 ,I_ACLWDNB=grid%i_aclwdnb ,I_ACLWDNBC=grid%i_aclwdnbc &
367 ,athmp=grid%athmpten ,aqvmp=grid%aqvmpten &
368 ,athcu=grid%athcuten ,aqvcu=grid%aqvcuten &
369 ,aucu=grid%aucuten ,avcu=grid%avcuten &
370 ,athsh=grid%athshten ,aqvsh=grid%aqvshten &
371 ,aush=grid%aushten ,avsh=grid%avshten &
372 ,athbl=grid%athblten ,aqvbl=grid%aqvblten &
373 ,aubl=grid%aublten ,avbl=grid%avblten &
374 ,athralw=grid%athratenlw ,athrasw=grid%athratensw &
375 ,h_diabatic=grid%h_diabatic ,qv_diabatic=grid%qv_diabatic &
376 ,rthcuten=grid%rthcuten ,rqvcuten=grid%rqvcuten &
377 ,rucuten=grid%rucuten ,rvcuten=grid%rvcuten &
378 ,rthshten=grid%rthshten ,rqvshten=grid%rqvshten &
379 ,rushten=grid%rushten ,rvshten=grid%rvshten &
380 ,rthblten=grid%rthblten ,rqvblten=grid%rqvblten &
381 ,rublten=grid%rublten ,rvblten=grid%rvblten &
382 ,rthratenlw=grid%rthratenlw ,rthratensw=grid%rthratensw &
384 ,DIAG_PRINT=config_flags%diag_print &
385 ,BUCKET_MM=config_flags%bucket_mm &
386 ,BUCKET_J =config_flags%bucket_J &
387 ,SNOWNCV=grid%snowncv, SNOW_ACC_NC=grid%snow_acc_nc &
388 ,PREC_ACC_C=grid%prec_acc_c &
389 ,PREC_ACC_NC=grid%prec_acc_nc &
390 ,PREC_ACC_DT=config_flags%prec_acc_dt &
391 ,CURR_SECS2=curr_secs2 &
392 ,HISTORY_INTERVAL=grid%history_interval &
393 ,ITIMESTEP=grid%itimestep &
394 ,cu_used=grid%cu_used &
395 ,shcu_used=grid%shcu_used &
396 ,acc_phy_tend=grid%acc_phy_tend &
397 ! Dimension arguments
398 ,IDS=ids,IDE=ide, JDS=jds,JDE=jde, KDS=kds,KDE=kde &
399 ,IMS=ims,IME=ime, JMS=jms,JME=jme, KMS=kms,KME=kme &
400 ,IPS=ips,IPE=ipe, JPS=jps,JPE=jpe, KPS=kps,KPE=kpe &
401 ,I_START=grid%i_start,I_END=min(grid%i_end, ide-1) &
402 ,J_START=grid%j_start,J_END=min(grid%j_end, jde-1) &
403 ,KTS=k_start, KTE=min(k_end,kde-1) &
404 ,NUM_TILES=grid%num_tiles &
407 NWPDIAGS: IF ( config_flags%nwp_diagnostics == 1 ) THEN
408 CALL wrf_debug ( 100 , '--> CALL DIAGNOSTICS PACKAGE: NWP DIAGNOSTICS' )
410 mp_select: SELECT CASE(config_flags%mp_physics)
412 CASE (LINSCHEME, WSM6SCHEME, WDM6SCHEME, GSFCGCESCHEME)
414 CALL diagnostic_output_nwp( &
415 config_flags=config_flags, &
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 config_flags=config_flags, &
464 U=grid%u_2 ,V=grid%v_2 &
465 ,TEMP=grid%t_phy ,P8W=p8w &
466 ,DT=grid%dt ,SBW=config_flags%spec_bdy_width &
469 ,MPHYSICS_OPT=config_flags%mp_physics & ! gthompsn
470 ,GSFCGCE_HAIL=config_flags%gsfcgce_hail & ! gthompsn
471 ,GSFCGCE_2ICE=config_flags%gsfcgce_2ice & ! gthompsn
472 ,MPUSE_HAIL=config_flags%hail_opt & ! gthompsn
473 ,NSSL_ALPHAH=config_flags%nssl_alphah & ! gthompsn
474 ,NSSL_ALPHAHL=config_flags%nssl_alphahl & ! gthompsn
475 ,NSSL_CNOH=config_flags%nssl_cnoh & ! gthompsn
476 ,NSSL_CNOHL=config_flags%nssl_cnohl & ! gthompsn
477 ,NSSL_RHO_QH=config_flags%nssl_rho_qh & ! gthompsn
478 ,NSSL_RHO_QHL=config_flags%nssl_rho_qhl & ! gthompsn
479 ,CURR_SECS2=curr_secs2 &
480 ,NWP_DIAGNOSTICS=config_flags%nwp_diagnostics &
481 ,DIAGFLAG=diag_flag &
482 ,HISTORY_INTERVAL=grid%history_interval &
483 ,ITIMESTEP=grid%itimestep &
484 ,U10=grid%u10,V10=grid%v10,W=grid%w_2 &
485 ,WSPD10MAX=grid%wspd10max &
486 ,UP_HELI_MAX=grid%up_heli_max &
487 ,W_UP_MAX=grid%w_up_max,W_DN_MAX=grid%w_dn_max &
488 ,ZNW=grid%znw,W_COLMEAN=grid%w_colmean &
489 ,NUMCOLPTS=grid%numcolpts,W_MEAN=grid%w_mean &
490 ,GRPL_MAX=grid%grpl_max,GRPL_COLINT=grid%grpl_colint &
491 ,REFD_MAX=grid%refd_max &
492 ,refl_10cm=grid%refl_10cm &
493 ,HAIL_MAXK1=grid%hail_maxk1,HAIL_MAX2D=grid%hail_max2d & ! gthompsn
494 ,QG_CURR=moist(ims,kms,jms,P_QG) &
495 ,QR_CURR=moist(ims,kms,jms,P_QR) & ! gthompsn
496 ,NR_CURR=scalar(ims,kms,jms,P_QNR) & ! gthompsn
497 ,RHO=grid%rho,PH=grid%ph_2,PHB=grid%phb,G=g &
498 ! Dimension arguments
499 ,IDS=ids,IDE=ide, JDS=jds,JDE=jde, KDS=kds,KDE=kde &
500 ,IMS=ims,IME=ime, JMS=jms,JME=jme, KMS=kms,KME=kme &
501 ,IPS=ips,IPE=ipe, JPS=jps,JPE=jpe, KPS=kps,KPE=kpe &
502 ,I_START=grid%i_start,I_END=min(grid%i_end, ide-1) &
503 ,J_START=grid%j_start,J_END=min(grid%j_end, jde-1) &
504 ,KTS=k_start, KTE=min(k_end,kde-1) &
505 ,NUM_TILES=grid%num_tiles &
506 ,MAX_TIME_STEP=grid%max_time_step &
507 ,ADAPTIVE_TS=config_flags%use_adaptive_time_step &
512 CALL diagnostic_output_nwp( &
513 config_flags=config_flags, &
514 U=grid%u_2 ,V=grid%v_2 &
515 ,TEMP=grid%t_phy ,P8W=p8w &
516 ,DT=grid%dt ,SBW=config_flags%spec_bdy_width &
519 ,MPHYSICS_OPT=config_flags%mp_physics & ! gthompsn
520 ,GSFCGCE_HAIL=config_flags%gsfcgce_hail & ! gthompsn
521 ,GSFCGCE_2ICE=config_flags%gsfcgce_2ice & ! gthompsn
522 ,MPUSE_HAIL=config_flags%hail_opt & ! gthompsn
523 ,NSSL_ALPHAH=config_flags%nssl_alphah & ! gthompsn
524 ,NSSL_ALPHAHL=config_flags%nssl_alphahl & ! gthompsn
525 ,NSSL_CNOH=config_flags%nssl_cnoh & ! gthompsn
526 ,NSSL_CNOHL=config_flags%nssl_cnohl & ! gthompsn
527 ,NSSL_RHO_QH=config_flags%nssl_rho_qh & ! gthompsn
528 ,NSSL_RHO_QHL=config_flags%nssl_rho_qhl & ! gthompsn
529 ,CURR_SECS2=curr_secs2 &
530 ,NWP_DIAGNOSTICS=config_flags%nwp_diagnostics &
531 ,DIAGFLAG=diag_flag &
532 ,HISTORY_INTERVAL=grid%history_interval &
533 ,ITIMESTEP=grid%itimestep &
534 ,U10=grid%u10,V10=grid%v10,W=grid%w_2 &
535 ,WSPD10MAX=grid%wspd10max &
536 ,UP_HELI_MAX=grid%up_heli_max &
537 ,W_UP_MAX=grid%w_up_max,W_DN_MAX=grid%w_dn_max &
538 ,ZNW=grid%znw,W_COLMEAN=grid%w_colmean &
539 ,NUMCOLPTS=grid%numcolpts,W_MEAN=grid%w_mean &
540 ,GRPL_MAX=grid%grpl_max,GRPL_COLINT=grid%grpl_colint &
541 ,REFD_MAX=grid%refd_max &
542 ,refl_10cm=grid%refl_10cm &
543 ,HAIL_MAXK1=grid%hail_maxk1,HAIL_MAX2D=grid%hail_max2d & ! gthompsn
544 ,QG_CURR=moist(ims,kms,jms,P_QG) &
545 ,QR_CURR=moist(ims,kms,jms,P_QR) & ! gthompsn
546 ,NR_CURR=scalar(ims,kms,jms,P_QNR) & ! gthompsn
547 ,NG_CURR=scalar(ims,kms,jms,P_QNG) & ! THOMPSONGH
548 ,QVOLG_CURR=scalar(ims,kms,jms,P_QVOLG) & ! THOMPSONGH
549 ,RHO=grid%rho,PH=grid%ph_2,PHB=grid%phb,G=g &
550 ! Dimension arguments
551 ,IDS=ids,IDE=ide, JDS=jds,JDE=jde, KDS=kds,KDE=kde &
552 ,IMS=ims,IME=ime, JMS=jms,JME=jme, KMS=kms,KME=kme &
553 ,IPS=ips,IPE=ipe, JPS=jps,JPE=jpe, KPS=kps,KPE=kpe &
554 ,I_START=grid%i_start,I_END=min(grid%i_end, ide-1) &
555 ,J_START=grid%j_start,J_END=min(grid%j_end, jde-1) &
556 ,KTS=k_start, KTE=min(k_end,kde-1) &
557 ,NUM_TILES=grid%num_tiles &
558 ,MAX_TIME_STEP=grid%max_time_step &
559 ,ADAPTIVE_TS=config_flags%use_adaptive_time_step &
562 CASE (MORR_TWO_MOMENT, MORR_TM_AERO) ! TWG add
564 CALL diagnostic_output_nwp( &
565 config_flags=config_flags, &
566 U=grid%u_2 ,V=grid%v_2 &
567 ,TEMP=grid%t_phy ,P8W=p8w &
568 ,DT=grid%dt ,SBW=config_flags%spec_bdy_width &
571 ,MPHYSICS_OPT=config_flags%mp_physics & ! gthompsn
572 ,GSFCGCE_HAIL=config_flags%gsfcgce_hail & ! gthompsn
573 ,GSFCGCE_2ICE=config_flags%gsfcgce_2ice & ! gthompsn
574 ,MPUSE_HAIL=config_flags%morr_rimed_ice & ! gthompsn
575 ,NSSL_ALPHAH=config_flags%nssl_alphah & ! gthompsn
576 ,NSSL_ALPHAHL=config_flags%nssl_alphahl & ! gthompsn
577 ,NSSL_CNOH=config_flags%nssl_cnoh & ! gthompsn
578 ,NSSL_CNOHL=config_flags%nssl_cnohl & ! gthompsn
579 ,NSSL_RHO_QH=config_flags%nssl_rho_qh & ! gthompsn
580 ,NSSL_RHO_QHL=config_flags%nssl_rho_qhl & ! gthompsn
581 ,CURR_SECS2=curr_secs2 &
582 ,NWP_DIAGNOSTICS=config_flags%nwp_diagnostics &
583 ,DIAGFLAG=diag_flag &
584 ,HISTORY_INTERVAL=grid%history_interval &
585 ,ITIMESTEP=grid%itimestep &
586 ,U10=grid%u10,V10=grid%v10,W=grid%w_2 &
587 ,WSPD10MAX=grid%wspd10max &
588 ,UP_HELI_MAX=grid%up_heli_max &
589 ,W_UP_MAX=grid%w_up_max,W_DN_MAX=grid%w_dn_max &
590 ,ZNW=grid%znw,W_COLMEAN=grid%w_colmean &
591 ,NUMCOLPTS=grid%numcolpts,W_MEAN=grid%w_mean &
592 ,GRPL_MAX=grid%grpl_max,GRPL_COLINT=grid%grpl_colint &
593 ,REFD_MAX=grid%refd_max &
594 ,refl_10cm=grid%refl_10cm &
595 ,HAIL_MAXK1=grid%hail_maxk1,HAIL_MAX2D=grid%hail_max2d & ! gthompsn
596 ,QG_CURR=moist(ims,kms,jms,P_QG) &
597 ,NG_CURR=scalar(ims,kms,jms,P_QNG) & ! gthompsn
598 ,RHO=grid%rho,PH=grid%ph_2,PHB=grid%phb,G=g &
599 ! Dimension arguments
600 ,IDS=ids,IDE=ide, JDS=jds,JDE=jde, KDS=kds,KDE=kde &
601 ,IMS=ims,IME=ime, JMS=jms,JME=jme, KMS=kms,KME=kme &
602 ,IPS=ips,IPE=ipe, JPS=jps,JPE=jpe, KPS=kps,KPE=kpe &
603 ,I_START=grid%i_start,I_END=min(grid%i_end, ide-1) &
604 ,J_START=grid%j_start,J_END=min(grid%j_end, jde-1) &
605 ,KTS=k_start, KTE=min(k_end,kde-1) &
606 ,NUM_TILES=grid%num_tiles &
607 ,MAX_TIME_STEP=grid%max_time_step &
608 ,ADAPTIVE_TS=config_flags%use_adaptive_time_step &
612 CASE (MILBRANDT2MOM, NSSL_2MOM)
614 CALL diagnostic_output_nwp( &
615 config_flags=config_flags, &
616 U=grid%u_2 ,V=grid%v_2 &
617 ,TEMP=grid%t_phy ,P8W=p8w &
618 ,DT=grid%dt ,SBW=config_flags%spec_bdy_width &
621 ,MPHYSICS_OPT=config_flags%mp_physics & ! gthompsn
622 ,GSFCGCE_HAIL=config_flags%gsfcgce_hail & ! gthompsn
623 ,GSFCGCE_2ICE=config_flags%gsfcgce_2ice & ! gthompsn
624 ,MPUSE_HAIL=config_flags%hail_opt & ! gthompsn
625 ,NSSL_ALPHAH=config_flags%nssl_alphah & ! gthompsn
626 ,NSSL_ALPHAHL=config_flags%nssl_alphahl & ! gthompsn
627 ,NSSL_CNOH=config_flags%nssl_cnoh & ! gthompsn
628 ,NSSL_CNOHL=config_flags%nssl_cnohl & ! gthompsn
629 ,NSSL_RHO_QH=config_flags%nssl_rho_qh & ! gthompsn
630 ,NSSL_RHO_QHL=config_flags%nssl_rho_qhl & ! gthompsn
631 ,CURR_SECS2=curr_secs2 &
632 ,NWP_DIAGNOSTICS=config_flags%nwp_diagnostics &
633 ,DIAGFLAG=diag_flag &
634 ,HISTORY_INTERVAL=grid%history_interval &
635 ,ITIMESTEP=grid%itimestep &
636 ,U10=grid%u10,V10=grid%v10,W=grid%w_2 &
637 ,WSPD10MAX=grid%wspd10max &
638 ,UP_HELI_MAX=grid%up_heli_max &
639 ,W_UP_MAX=grid%w_up_max,W_DN_MAX=grid%w_dn_max &
640 ,ZNW=grid%znw,W_COLMEAN=grid%w_colmean &
641 ,NUMCOLPTS=grid%numcolpts,W_MEAN=grid%w_mean &
642 ,GRPL_MAX=grid%grpl_max,GRPL_COLINT=grid%grpl_colint &
643 ,REFD_MAX=grid%refd_max &
644 ,refl_10cm=grid%refl_10cm &
645 ,HAIL_MAXK1=grid%hail_maxk1,HAIL_MAX2D=grid%hail_max2d & ! gthompsn
646 ,QG_CURR=moist(ims,kms,jms,P_QG) &
647 ,NG_CURR=scalar(ims,kms,jms,P_QNG) & ! gthompsn
648 ,QH_CURR=moist(ims,kms,jms,P_QH) & ! gthompsn
649 ,NH_CURR=scalar(ims,kms,jms,P_QNH) & ! gthompsn
650 ,RHO=grid%rho,PH=grid%ph_2,PHB=grid%phb,G=g &
651 ! Dimension arguments
652 ,IDS=ids,IDE=ide, JDS=jds,JDE=jde, KDS=kds,KDE=kde &
653 ,IMS=ims,IME=ime, JMS=jms,JME=jme, KMS=kms,KME=kme &
654 ,IPS=ips,IPE=ipe, JPS=jps,JPE=jpe, KPS=kps,KPE=kpe &
655 ,I_START=grid%i_start,I_END=min(grid%i_end, ide-1) &
656 ,J_START=grid%j_start,J_END=min(grid%j_end, jde-1) &
657 ,KTS=k_start, KTE=min(k_end,kde-1) &
658 ,NUM_TILES=grid%num_tiles &
659 ,MAX_TIME_STEP=grid%max_time_step &
660 ,ADAPTIVE_TS=config_flags%use_adaptive_time_step &
663 !..The remaining microphysics schemes do not have graupel, but
664 !..P_QG will just be empty and the remaining NWP-diagnostics can
665 !..still be computed, so go ahead, under DEFAULT, not their own.
667 ! CASE (KESSLERSCHEME)
671 ! CASE (SBU_YLINSCHEME)
675 ! CASE (MILBRANDT3MOM)
677 ! CASE (MORR_MILB_P3)
679 ! CASE (CAMMGMPSCHEME)
681 ! CASE (FULL_KHAIN_LYNN)
683 ! CASE (FAST_KHAIN_LYNN_SHPUND)
691 CALL diagnostic_output_nwp( &
692 config_flags=config_flags, &
693 U=grid%u_2 ,V=grid%v_2 &
694 ,TEMP=grid%t_phy ,P8W=p8w &
695 ,DT=grid%dt ,SBW=config_flags%spec_bdy_width &
698 ,MPHYSICS_OPT=config_flags%mp_physics & ! gthompsn
699 ,GSFCGCE_HAIL=config_flags%gsfcgce_hail & ! gthompsn
700 ,GSFCGCE_2ICE=config_flags%gsfcgce_2ice & ! gthompsn
701 ,MPUSE_HAIL=config_flags%hail_opt & ! gthompsn
702 ,NSSL_ALPHAH=config_flags%nssl_alphah & ! gthompsn
703 ,NSSL_ALPHAHL=config_flags%nssl_alphahl & ! gthompsn
704 ,NSSL_CNOH=config_flags%nssl_cnoh & ! gthompsn
705 ,NSSL_CNOHL=config_flags%nssl_cnohl & ! gthompsn
706 ,NSSL_RHO_QH=config_flags%nssl_rho_qh & ! gthompsn
707 ,NSSL_RHO_QHL=config_flags%nssl_rho_qhl & ! gthompsn
708 ,CURR_SECS2=curr_secs2 &
709 ,NWP_DIAGNOSTICS=config_flags%nwp_diagnostics &
710 ,DIAGFLAG=diag_flag &
711 ,HISTORY_INTERVAL=grid%history_interval &
712 ,ITIMESTEP=grid%itimestep &
713 ,U10=grid%u10,V10=grid%v10,W=grid%w_2 &
714 ,WSPD10MAX=grid%wspd10max &
715 ,UP_HELI_MAX=grid%up_heli_max &
716 ,W_UP_MAX=grid%w_up_max,W_DN_MAX=grid%w_dn_max &
717 ,ZNW=grid%znw,W_COLMEAN=grid%w_colmean &
718 ,NUMCOLPTS=grid%numcolpts,W_MEAN=grid%w_mean &
719 ,GRPL_MAX=grid%grpl_max,GRPL_COLINT=grid%grpl_colint &
720 ,REFD_MAX=grid%refd_max &
721 ,refl_10cm=grid%refl_10cm &
722 ,HAIL_MAXK1=grid%hail_maxk1,HAIL_MAX2D=grid%hail_max2d & ! gthompsn
723 ,QG_CURR=moist(ims,kms,jms,P_QG) &
724 ,RHO=grid%rho,PH=grid%ph_2,PHB=grid%phb,G=g &
725 ! Dimension arguments
726 ,IDS=ids,IDE=ide, JDS=jds,JDE=jde, KDS=kds,KDE=kde &
727 ,IMS=ims,IME=ime, JMS=jms,JME=jme, KMS=kms,KME=kme &
728 ,IPS=ips,IPE=ipe, JPS=jps,JPE=jpe, KPS=kps,KPE=kpe &
729 ,I_START=grid%i_start,I_END=min(grid%i_end, ide-1) &
730 ,J_START=grid%j_start,J_END=min(grid%j_end, jde-1) &
731 ,KTS=k_start, KTE=min(k_end,kde-1) &
732 ,NUM_TILES=grid%num_tiles &
733 ,MAX_TIME_STEP=grid%max_time_step &
734 ,ADAPTIVE_TS=config_flags%use_adaptive_time_step &
741 ! Climate-oriented diagnostic quantities.
743 CLIMATE_DIAGS : IF ( config_flags%output_diagnostics == 1 ) THEN
745 IF ( ( config_flags%auxhist3_interval == 0 ) ) THEN
746 WRITE (diag_message , * ) &
747 "CLWRF: ERROR -- error -- ERROR -- error : NO 'auxhist3_interval' has been defined in 'namelist.input'"
748 CALL wrf_error_fatal ( diag_message )
751 CALL wrf_debug ( 100 , '--> CALL DIAGNOSTICS PACKAGE: CLIMATE DIAGNOSTICS' )
753 CALL clwrf_output_calc( &
754 is_restart=config_flags%restart &
755 ,clwrfH=config_flags%auxhist3_interval &
756 ,T2=grid%t2, Q2=grid%q2, U10=grid%u10, V10=grid%v10 &
758 ,T2CLMIN=grid%t2min, T2CLMAX=grid%t2max &
759 ,TT2CLMIN=grid%tt2min, TT2CLMAX=grid%tt2max &
760 ,T2CLMEAN=grid%t2mean, T2CLSTD=grid%t2std &
761 ,Q2CLMIN=grid%q2min, Q2CLMAX=grid%q2max &
762 ,TQ2CLMIN=grid%tq2min, TQ2CLMAX=grid%tq2max &
763 ,Q2CLMEAN=grid%q2mean, Q2CLSTD=grid%q2std &
764 ,U10CLMAX=grid%u10max, V10CLMAX=grid%v10max &
765 ,SPDUV10CLMAX=grid%spduv10max &
766 ,TSPDUV10CLMAX=grid%tspduv10max &
767 ,U10CLMEAN=grid%u10mean, V10CLMEAN=grid%v10mean &
768 ,SPDUV10CLMEAN=grid%spduv10mean &
769 ,U10CLSTD=grid%u10std, V10CLSTD=grid%v10std &
770 ,SPDUV10CLSTD=grid%spduv10std &
771 ,RAINCCLMAX=grid%raincvmax &
772 ,RAINNCCLMAX=grid%rainncvmax &
773 ,TRAINCCLMAX=grid%traincvmax &
774 ,TRAINNCCLMAX=grid%trainncvmax &
775 ,RAINCCLMEAN=grid%raincvmean &
776 ,RAINNCCLMEAN=grid%rainncvmean &
777 ,RAINCCLSTD=grid%raincvstd &
778 ,RAINNCCLSTD=grid%rainncvstd &
779 ,SKINTEMPCLMIN=grid%skintempmin &
780 ,SKINTEMPCLMAX=grid%skintempmax &
781 ,TSKINTEMPCLMIN=grid%tskintempmin &
782 ,TSKINTEMPCLMAX=grid%tskintempmax &
783 ,SKINTEMPCLMEAN=grid%skintempmean &
784 ,SKINTEMPCLSTD=grid%skintempstd &
785 ,RAINCV=grid%raincv ,RAINNCV=grid%rainncv &
787 ,XTIME=grid%xtime,CURR_SECS2=curr_secs2 &
788 ,NSTEPS=grid%nsteps &
789 ! Dimension arguments
790 ,IDS=ids,IDE=ide, JDS=jds,JDE=jde, KDS=kds,KDE=kde &
791 ,IMS=ims,IME=ime, JMS=jms,JME=jme, KMS=kms,KME=kme &
792 ,IPS=ips,IPE=ipe, JPS=jps,JPE=jpe, KPS=kps,KPE=kpe &
793 ,I_START=grid%i_start,I_END=min(grid%i_end, ide-1) &
794 ,J_START=grid%j_start,J_END=min(grid%j_end, jde-1) &
795 ,KTS=k_start, KTE=k_end &
796 ,NUM_TILES=grid%num_tiles &
804 ! Pressure level diagnostics.
807 PL_DIAGNOSTICS : IF ( config_flags%p_lev_diags .NE. SKIP_PRESS_DIAGS ) THEN
809 ! Process the diags if this is the correct time step OR
810 ! if this is an adaptive timestep forecast.
812 TIME_TO_DO_PL_DIAGS : IF ( ( ( MOD(NINT(curr_secs2+grid%dt),NINT(config_flags%p_lev_interval)) .EQ. 0 ) ) .OR. &
813 ( config_flags%use_adaptive_time_step ) ) THEN
817 DO ij = 1 , grid%num_tiles
819 CALL wrf_debug ( 100 , '--> CALL DIAGNOSTICS PACKAGE: PRESSURE LEVEL DIAGNOSTICS' )
822 ! Input data for computing
826 ,t=grid%th_phy_m_t0 &
827 ,qv=moist(:,:,:,P_QV) &
834 ! Map factors, coriolis for diags
844 ,use_tot_or_hyd_p=config_flags%use_tot_or_hyd_p &
845 ,extrap_below_grnd=config_flags%extrap_below_grnd &
846 ,missing=config_flags%p_lev_missing &
847 ! The diagnostics, mostly output variables
848 ,num_press_levels=config_flags%num_press_levels &
849 ,max_press_levels=max_plevs &
850 ,press_levels=model_config_rec%press_levels &
855 ,rh_pl = grid%rh_pl &
856 ,ght_pl= grid%ght_pl &
858 ,td_pl = grid%td_pl &
860 ! Dimension arguments
861 ,IDS=ids,IDE=ide, JDS=jds,JDE=jde, KDS=kds,KDE=kde &
862 ,IMS=ims,IME=ime, JMS=jms,JME=jme, KMS=kms,KME=kme &
863 ,ITS=grid%i_start(ij),ITE=grid%i_end(ij) &
864 ,JTS=grid%j_start(ij),JTE=grid%j_end(ij) &
865 ,KTS=k_start,KTE=k_end+1 )
867 !$OMP END PARALLEL DO
868 END IF TIME_TO_DO_PL_DIAGS
869 END IF PL_DIAGNOSTICS
875 ! Height level and AGL diagnostics.
878 ZL_DIAGNOSTICS : IF ( config_flags%z_lev_diags .NE. SKIP_Z_DIAGS ) THEN
880 ! Process the diags if this is the correct time step OR
881 ! if this is an adaptive timestep forecast.
883 TIME_TO_DO_ZL_DIAGS : IF ( ( ( MOD(NINT(curr_secs2+grid%dt),NINT(config_flags%z_lev_interval)) .EQ. 0 ) ) .OR. &
884 ( config_flags%use_adaptive_time_step ) ) THEN
888 DO ij = 1 , grid%num_tiles
890 CALL wrf_debug ( 100 , '--> CALL DIAGNOSTICS PACKAGE: HEIGHT LEVEL AND AGL DIAGNOSTICS' )
893 ! Input data for computing
897 ,t=grid%th_phy_m_t0 &
898 ,qv=moist(:,:,:,P_QV) &
905 ! Map factors, coriolis for diags
916 ,use_tot_or_hyd_p=config_flags%use_tot_or_hyd_p &
917 ,extrap_below_grnd=config_flags%extrap_below_grnd &
918 ,missing=config_flags%z_lev_missing &
919 ! The diagnostics, mostly output variables
920 ,num_z_levels=config_flags%num_z_levels &
921 ,max_z_levels=max_zlevs &
922 ,z_levels=model_config_rec%z_levels &
927 ,rh_zl = grid%rh_zl &
928 ,ght_zl= grid%ght_zl &
930 ,td_zl = grid%td_zl &
933 ! Dimension arguments
934 ,IDS=ids,IDE=ide, JDS=jds,JDE=jde, KDS=kds,KDE=kde &
935 ,IMS=ims,IME=ime, JMS=jms,JME=jme, KMS=kms,KME=kme &
936 ,ITS=grid%i_start(ij),ITE=grid%i_end(ij) &
937 ,JTS=grid%j_start(ij),JTE=grid%j_end(ij) &
938 ,KTS=k_start,KTE=k_end+1 )
940 !$OMP END PARALLEL DO
941 END IF TIME_TO_DO_ZL_DIAGS
942 END IF ZL_DIAGNOSTICS
947 ! AFWA diagnostic package.
949 AFWA_DIAGS : IF ( config_flags%afwa_diag_opt == 1 ) THEN
951 IF ( ( config_flags%history_interval == 0 ) ) THEN
952 WRITE (diag_message , * ) &
953 "AFWA Diagnostics Error : No 'history_interval' defined in namelist"
954 CALL wrf_error_fatal ( diag_message )
959 DO ij = 1 , grid%num_tiles
961 CALL wrf_debug ( 100 , '--> CALL DIAGNOSTICS PACKAGE: AFWA DIAGNOSTICS' )
963 CALL afwa_diagnostics_driver ( grid , config_flags &
967 ,th_phy , pi_phy , p_phy &
968 ,grid%u_phy , grid%v_phy &
969 ,dz8w , p8w , t8w , grid%rho &
970 ,ids, ide, jds, jde, kds, kde &
971 ,ims, ime, jms, jme, kms, kme &
972 ,ips, ipe, jps, jpe, kps, kpe &
973 ,ITS=grid%i_start(ij),ITE=grid%i_end(ij) &
974 ,JTS=grid%j_start(ij),JTE=grid%j_end(ij) &
975 ,K_START=k_start,K_END=k_end )
978 !$OMP END PARALLEL DO
984 ! RASM Climate Diagnostics - mean output
986 RASM_DIAGS_MEAN : IF ( config_flags%mean_diag == 1 ) THEN
988 !IF ( ( config_flags%auxhist3_interval == 0 ) ) THEN
989 ! WRITE (diag_message , * ) &
990 ! "CLWRF: ERROR -- error -- ERROR -- error : NO 'auxhist3_interval' has been defined in 'namelist.input'"
991 ! CALL wrf_error_fatal ( diag_message )
994 CALL wrf_debug ( 100 , '--> CALL DIAGNOSTICS PACKAGE: RASM DIAGNOSTICS - MEAN' )
996 CALL domain_clock_get ( grid, current_time=currentTime)
998 CALL mean_output_calc( &
999 is_restart=config_flags%restart &
1000 ,CURRENTTIME=currentTime &
1001 ,stats_interval=config_flags%mean_interval &
1002 ,output_freq=config_flags%mean_freq &
1003 ,run_days=config_flags%run_days &
1004 ,DT=grid%dt, XTIME=grid%xtime &
1005 ,PSFC=grid%psfc, PSFC_MEAN=grid%psfc_mean &
1006 ,TSK=grid%tsk, TSK_MEAN=grid%tsk_mean &
1007 ,PMSL_MEAN=grid%pmsl_mean &
1008 ,T2=grid%t2, T2_MEAN=grid%t2_mean &
1009 ,T=grid%th_phy_m_t0, P=grid%p, PB=grid%pb &
1010 ,MOIST=grid%moist(:,:,:,P_QV), HT=grid%ht &
1011 ,TH2=grid%th2, TH2_MEAN=grid%th2_mean &
1012 ,Q2=grid%q2, Q2_MEAN=grid%q2_mean &
1013 ,U10=grid%u10, U10_MEAN=grid%u10_mean &
1014 ,V10=grid%v10, V10_MEAN=grid%v10_mean &
1015 ,HFX=grid%hfx, HFX_MEAN=grid%hfx_mean &
1016 ,LH=grid%lh, LH_MEAN=grid%lh_mean &
1017 ,SWDNB=grid%swdnb, SWDNB_MEAN=grid%swdnb_mean &
1018 ,GLW=grid%glw , GLW_MEAN=grid%glw_mean &
1019 ,LWUPB=grid%lwupb, LWUPB_MEAN=grid%lwupb_mean &
1020 ,SWUPB=grid%swupb, SWUPB_MEAN=grid%swupb_mean &
1021 ,SWUPT=grid%swupt, SWUPT_MEAN=grid%swupt_mean &
1022 ,SWDNT=grid%swdnt, SWDNT_MEAN=grid%swdnt_mean &
1023 ,LWUPT=grid%lwupt, LWUPT_MEAN=grid%lwupt_mean &
1024 ,LWDNT=grid%lwdnt, LWDNT_MEAN=grid%lwdnt_mean &
1025 ,AVGOUTALARM=grid%alarms(AUXHIST5_ALARM) &
1026 ,AVGOUTDATESTR=grid%OUTDATE_MEAN &
1027 ,NSTEPS=grid%NSTEPS_MEAN &
1028 ! Dimension arguments
1029 ,IDS=ids,IDE=ide, JDS=jds,JDE=jde, KDS=kds,KDE=kde &
1030 ,IMS=ims,IME=ime, JMS=jms,JME=jme, KMS=kms,KME=kme &
1031 ,IPS=ips,IPE=ipe, JPS=jps,JPE=jpe, KPS=kps,KPE=kpe &
1032 ,I_START=grid%i_start,I_END=min(grid%i_end, ide-1) &
1033 ,J_START=grid%j_start,J_END=min(grid%j_end, jde-1) &
1034 ,NUM_TILES=grid%num_tiles &
1036 END IF RASM_DIAGS_MEAN
1041 ! RASM Climate Diagnostics - diurnal output
1043 RASM_DIAGS_DIURNAL : IF ( config_flags%diurnal_diag == 1 ) THEN
1045 !IF ( ( config_flags%auxhist3_interval == 0 ) ) THEN
1046 ! WRITE (diag_message , * ) &
1047 ! "CLWRF: ERROR -- error -- ERROR -- error : NO 'auxhist3_interval' has been defined in 'namelist.input'"
1048 ! CALL wrf_error_fatal ( diag_message )
1051 CALL wrf_debug ( 100 , '--> CALL DIAGNOSTICS PACKAGE: RASM DIAGNOSTICS - DIURNAL' )
1053 CALL domain_clock_get ( grid, current_time=currentTime)
1055 CALL diurnalcycle_output_calc( &
1056 is_restart=config_flags%restart &
1057 ,CURRENTTIME=currentTime &
1058 ,DT=grid%dt, XTIME=grid%xtime &
1059 ,PSFC=grid%psfc, PSFC_DTMP=grid%psfc_dtmp &
1060 ,TSK=grid%tsk, TSK_DTMP=grid%tsk_dtmp &
1061 ,T2=grid%t2, T2_DTMP=grid%t2_dtmp &
1062 ,T=grid%th_phy_m_t0, P=grid%p, PB=grid%pb &
1063 ,MOIST=grid%moist(:,:,:,P_QV) &
1064 ,TH2=grid%th2, TH2_DTMP=grid%th2_dtmp &
1065 ,Q2=grid%q2, Q2_DTMP=grid%q2_dtmp &
1066 ,U10=grid%u10, U10_DTMP=grid%u10_dtmp &
1067 ,V10=grid%v10, V10_DTMP=grid%v10_dtmp &
1068 ,HFX=grid%hfx, HFX_DTMP=grid%hfx_dtmp &
1069 ,LH=grid%lh, LH_DTMP=grid%lh_dtmp &
1070 ,SWDNB=grid%swdnb, SWDNB_DTMP=grid%swdnb_dtmp &
1071 ,GLW=grid%glw, GLW_DTMP=grid%glw_dtmp &
1072 ,LWUPB=grid%lwupb, LWUPB_DTMP=grid%lwupb_dtmp &
1073 ,SWUPB=grid%swupb, SWUPB_DTMP=grid%swupb_dtmp &
1074 ,SWUPT=grid%swupt, SWUPT_DTMP=grid%swupt_dtmp &
1075 ,SWDNT=grid%swdnt, SWDNT_DTMP=grid%swdnt_dtmp &
1076 ,LWUPT=grid%lwupt, LWUPT_DTMP=grid%lwupt_dtmp &
1077 ,LWDNT=grid%lwdnt, LWDNT_DTMP=grid%lwdnt_dtmp &
1078 ,AVGOUTALARM=grid%alarms(AUXHIST6_ALARM) &
1079 ,DIURNOUTDATESTR=grid%OUTDATE_DIURN &
1080 ,AVG_NSTEPS=grid%NSTEPSMEAN_DIURN &
1081 ,DIURNAL_NSTEPS=grid%NSTEPS_DIURN &
1082 ,PSFC_DIURN=grid%PSFC_DIURN &
1083 ,TSK_DIURN=grid%TSK_DIURN, T2_DIURN=grid%T2_DIURN &
1084 ,TH2_DIURN=grid%TH2_DIURN, Q2_DIURN=grid%Q2_DIURN &
1085 ,U10_DIURN=grid%U10_DIURN, V10_DIURN=grid%V10_DIURN &
1086 ,HFX_DIURN=grid%HFX_DIURN, LH_DIURN=grid%LH_DIURN &
1087 ,SWDNB_DIURN=grid%SWDNB_DIURN, GLW_DIURN=grid%GLW_DIURN &
1088 ,LWUPB_DIURN=grid%LWUPB_DIURN, SWUPB_DIURN=grid%SWUPB_DIURN &
1089 ,SWUPT_DIURN=grid%SWUPT_DIURN, SWDNT_DIURN=grid%SWDNT_DIURN &
1090 ,LWUPT_DIURN=grid%LWUPT_DIURN, LWDNT_DIURN=grid%LWDNT_DIURN &
1091 ! Dimension arguments
1092 ,IDS=ids, IDE=ide, JDS=jds, JDE=jde, KDS=kds, KDE=kde &
1093 ,IMS=ims, IME=ime, JMS=jms, JME=jme, KMS=kms, KME=kme &
1094 ,IPS=ips, IPE=ipe, JPS=jps, JPE=jpe, KPS=kps, KPE=kpe &
1095 ,I_START=grid%i_start, I_END=min(grid%i_end, ide-1) &
1096 ,J_START=grid%j_start, J_END=min(grid%j_end, jde-1) &
1097 ,NUM_TILES=grid%num_tiles &
1099 END IF RASM_DIAGS_DIURNAL
1102 ! Noah-MP accumulation output
1104 NOAHMP_DIAGS : IF ( config_flags%sf_surface_physics == 4 .and. config_flags%noahmp_output == 3 ) THEN
1106 CALL wrf_debug ( 100 , '--> CALL DIAGNOSTICS PACKAGE: NOAHMP_DIAGS' )
1108 CALL domain_clock_get ( grid, current_time=currentTime)
1110 CALL noahmp_output_calc( &
1111 ims=ims, ime=ime, jms=jms, jme=jme ,&
1112 i_start=grid%i_start, i_end=min(grid%i_end, ide-1) ,&
1113 j_start=grid%j_start, j_end=min(grid%j_end, jde-1) ,&
1114 num_tiles=grid%num_tiles ,&
1116 noahmp_acc_dt=config_flags%noahmp_acc_dt ,&
1117 opt_run=config_flags%opt_run ,&
1118 stepwtd=grid%stepwtd ,&
1119 itimestep=grid%itimestep ,&
1120 curr_secs2=curr_secs2 ,&
1121 acsagb=grid%acsagb , acsagv=grid%acsagv , sag=grid%sagxy ,&
1122 acirg=grid%acirg , irg=grid%irgxy ,&
1123 acshg=grid%acshg , shg=grid%shgxy ,&
1124 acevg=grid%acevg , evg=grid%evgxy ,&
1125 acghv=grid%acghv , ghv=grid%ghvxy ,&
1126 acpahg=grid%acpahg , pahg=grid%pahgxy ,&
1127 acirb=grid%acirb , irb=grid%irbxy ,&
1128 acshb=grid%acshb , shb=grid%shbxy ,&
1129 acevb=grid%acevb , evb=grid%evbxy ,&
1130 acghb=grid%acghb , ghb=grid%ghbxy ,&
1131 acpahb=grid%acpahb , pahb=grid%pahbxy ,&
1132 acsav=grid%acsav , sav=grid%savxy ,&
1133 acirc=grid%acirc , ircmp=grid%ircxy ,&
1134 acshc=grid%acshc , shc=grid%shcxy ,&
1135 acevc=grid%acevc , evc=grid%evcxy ,&
1136 actr=grid%actr , tr=grid%trxy ,&
1137 acpahv=grid%acpahv , pahv=grid%pahvxy ,&
1138 acswdnlsm=grid%acswdnlsm , swdown=grid%swnorm ,&
1139 acswuplsm=grid%acswuplsm , albedo=grid%albedo ,&
1140 aclwdnlsm=grid%aclwdnlsm , emiss=grid%emiss , glw=grid%glw ,&
1141 aclwuplsm=grid%aclwuplsm , trad=grid%tradxy ,&
1142 acshflsm=grid%acshflsm ,aclhflsm=grid%aclhflsm ,&
1143 acghflsm=grid%acghflsm ,acpahlsm=grid%acpahlsm ,&
1144 acints=grid%acints , qints=grid%qintsxy ,&
1145 acintr=grid%acintr , qintr=grid%qintrxy ,&
1146 acdrips=grid%acdrips , qdrips=grid%qdripsxy ,&
1147 acdripr=grid%acdripr , qdripr=grid%qdriprxy ,&
1148 acthros=grid%acthros , qthros=grid%qthrosxy ,&
1149 acthror=grid%acthror , qthror=grid%qthrorxy ,&
1150 acsnsub=grid%acsnsub , qsnsub=grid%qsnsubxy ,&
1151 acsnfro=grid%acsnfro , qsnfro=grid%qsnfroxy ,&
1152 acsubc=grid%acsubc , qsubc=grid%qsubcxy ,&
1153 acfroc=grid%acfroc , qfroc=grid%qfrocxy ,&
1154 acevac=grid%acevac , qevac=grid%qevacxy ,&
1155 acdewc=grid%acdewc , qdewc=grid%qdewcxy ,&
1156 acfrzc=grid%acfrzc , qfrzc=grid%qfrzcxy ,&
1157 acmeltc=grid%acmeltc , qmeltc=grid%qmeltcxy ,&
1158 acsnbot=grid%acsnbot , qsnbot=grid%qsnbotxy ,&
1159 acsnmelt=grid%acsnmelt , qmelt=grid%qmeltxy ,&
1160 acponding=grid%acponding , ponding=grid%pondingxy ,&
1161 acrainlsm=grid%acrainlsm , rainlsm=grid%rainlsm ,&
1162 acsnowlsm=grid%acsnowlsm , snowlsm=grid%snowlsm ,&
1163 acrainsnow=grid%acrainsnow, isnow=grid%isnowxy ,&
1164 acrunsb=grid%acrunsb , runsb=grid%runsbxy ,&
1165 acrunsf=grid%acrunsf , runsf=grid%runsfxy ,&
1166 acecan=grid%acecan , ecan=grid%ecanxy ,&
1167 acetran=grid%acetran , etran=grid%etranxy ,&
1168 acedir=grid%acedir , edir=grid%edirxy ,&
1169 acetlsm=grid%acetlsm ,&
1170 acqlat=grid%acqlat , qlat=grid%qlatxy ,&
1171 acqrf=grid%acqrf , qrf=grid%qrfxy ,&
1172 acrech=grid%acrech ,deeprech=grid%deeprechxy ,&
1173 acqspring=grid%acqspring , qspring=grid%qspringxy ,&
1174 fpice=grid%fpicexy , fveg=grid%fvegxy ,&
1175 aceflxb=grid%aceflxb , eflxb=grid%eflxbxy ,&
1176 accanhs=grid%accanhs , canhs=grid%canhsxy )
1181 SOLAR_FIELDS: IF (config_flags%solar_diagnostics == do_solar_output) THEN
1182 CALL wrf_debug (100 , '--> CALL DIAGNOSTICS PACKAGE: SOLAR_DIAG')
1184 CALL solar_diag (dt=grid%dt, &
1185 rho=grid%rho, dz8w=dz8w, ph=grid%ph_2, phb=grid%phb, &
1186 cldfrac3d=grid%cldfra, coszen=grid%coszen, swdnb=grid%swdnb, &
1187 swdnt=grid%swdnt, param_first_scalar=param_first_scalar, &
1188 p_qc=p_qc, p_qi=p_qi, p_qs=p_qs, qv=moist(ims,kms,jms,P_QV), &
1189 qc=moist(ims,kms,jms,P_QC), qi=moist(ims,kms,jms,P_QI), &
1190 qs=moist(ims,kms,jms,P_QS), qc_tot=grid%qc_tot, &
1191 qi_tot=grid%qi_tot, &
1192 has_reqc=grid%has_reqc, has_reqi=grid%has_reqi, &
1193 has_reqs=grid%has_reqs, f_qv=f_qv, f_qc=f_qc, f_qi=f_qi, &
1194 f_qs=f_qs, re_cloud=grid%re_cloud, re_ice=grid%re_ice, &
1195 re_snow=grid%re_snow, cldfrac2d=grid%cldfrac2d, &
1196 wvp2d=grid%wvp, lwp2d=grid%lwp, iwp2d=grid%iwp, &
1197 swp2d=grid%swp, wp2d_sum=grid%wp_sum, lwp2d_tot=grid%lwp_tot, &
1198 iwp2d_tot=grid%iwp_tot, wp2d_tot_sum=grid%wp_tot_sum, &
1199 re_cloud_path=grid%re_qc, re_ice_path=grid%re_qi, &
1200 re_snow_path=grid%re_qs, re_cloud_path_tot=grid%re_qc_tot, &
1201 re_ice_path_tot=grid%re_qi_tot, tau_qc=grid%tau_qc, &
1202 tau_qi=grid%tau_qi, tau_qs=grid%tau_qs, &
1203 tau_qc_tot=grid%tau_qc_tot, tau_qi_tot=grid%tau_qi_tot, &
1204 cbase=grid%cbaseht, ctop=grid%ctopht, &
1205 cbase_tot=grid%cbaseht_tot, ctop_tot=grid%ctopht_tot, &
1206 clrnidx=grid%clrnidx, sza=grid%sza, ghi_accum=grid%ghi_accum, &
1207 ids=ids, ide=ide, jds=jds, jde=jde, kds=kds, kde=kde, &
1208 ims=ims, ime=ime, jms=jms, jme=jme, kms=kms, kme=kme, &
1209 ips=ips, ipe=ipe, jps=jps, jpe=jpe, kps=kps, kpe=kpe, &
1210 i_start=grid%i_start, i_end=min(grid%i_end, ide-1), &
1211 j_start=grid%j_start, j_end=min(grid%j_end, jde-1), &
1212 kts=k_start, kte=min(k_end,kde-1), num_tiles=grid%num_tiles )
1216 END SUBROUTINE diagnostics_driver
1220 SUBROUTINE update_phys_fields ( grid, config_flags, moist, &
1221 ids, ide, jds, jde, kds, kde, &
1222 ims, ime, jms, jme, kms, kme, &
1223 ips, ipe, jps, jpe, kps, kpe )
1225 USE module_domain, ONLY : domain
1226 USE module_configure, ONLY : grid_config_rec_type
1227 USE module_state_description, ONLY: num_moist, P_Qv
1228 USE module_model_constants, ONLY: g, R_v, R_d, Cp, T0, RCP
1230 TYPE ( domain ), INTENT(INOUT) :: grid
1232 ! We are not changing any of the namelist settings.
1234 TYPE ( grid_config_rec_type ), INTENT(IN) :: config_flags
1236 ! The 4d arrays are input only, no mods to them.
1238 REAL , DIMENSION(ims:ime,kms:kme,jms:jme,num_moist ) , INTENT(IN) :: moist
1240 ! Domain indices - no change to these puppies.
1242 INTEGER , INTENT(IN) :: ids, ide, jds, jde, kds, kde, &
1243 ims, ime, jms, jme, kms, kme, &
1244 ips, ipe, jps, jpe, kps, kpe
1250 ! Moist or dry theta
1252 IF ( config_flags%use_theta_m .EQ. 1 ) THEN
1253 DO j = jps, MIN(jde-1, jpe)
1255 DO i = ips, MIN(ide-1, ipe)
1256 grid%th_phy_m_t0(i,k,j) = (grid%t_2(i,k,j)+T0) / &
1257 (1.+(R_v/R_d)*moist(i,k,j,P_Qv)) - T0
1262 DO j = jps, MIN(jde-1, jpe)
1264 DO i = ips, MIN(ide-1, ipe)
1265 grid%th_phy_m_t0(i,k,j) = grid%t_2(i,k,j)
1270 END SUBROUTINE update_phys_fields
1272 END MODULE module_diagnostics_driver