1 !WRF+/AD:MEDIATION_LAYER:SOLVER FOR AD
2 !Created by Ning Pan, 2010-08
7 MODULE a_module_first_rk_step_part2
11 SUBROUTINE a_first_rk_step_part2 ( grid , config_flags &
12 , moist ,a_moist , moist_tend ,a_moist_tend &
13 , chem ,a_chem , chem_tend ,a_chem_tend &
14 , tracer,a_tracer, tracer_tend,a_tracer_tend &
15 , scalar,a_scalar, scalar_tend,a_scalar_tend &
16 , fdda3d,a_fdda3d, fdda2d, a_fdda2d &
17 , ru_tendf,a_ru_tendf, rv_tendf,a_rv_tendf &
18 , rw_tendf,a_rw_tendf, t_tendf ,a_t_tendf &
19 , ph_tendf,a_ph_tendf, mu_tendf,a_mu_tendf &
20 , tke_tend,a_tke_tend &
21 , adapt_step_flag , curr_secs &
22 , psim ,a_psim , psih ,a_psih , &
23 gz1oz0 ,a_gz1oz0 , chklowq,a_chklowq &
24 , cu_act_flag , hol ,a_hol, th_phy,a_th_phy &
25 , pi_phy ,a_pi_phy, p_phy ,a_p_phy , t_phy ,a_t_phy &
26 , dz8w ,a_dz8w , p8w ,a_p8w , t8w ,a_t8w &
27 , nba_mij,a_nba_mij, n_nba_mij &
28 , nba_rij,a_nba_rij, n_nba_rij &
29 , ids, ide, jds, jde, kds, kde &
30 , ims, ime, jms, jme, kms, kme &
31 , ips, ipe, jps, jpe, kps, kpe &
32 , imsx,imex,jmsx,jmex,kmsx,kmex &
33 , ipsx,ipex,jpsx,jpex,kpsx,kpex &
34 , imsy,imey,jmsy,jmey,kmsy,kmey &
35 , ipsy,ipey,jpsy,jpey,kpsy,kpey &
39 USE module_state_description
40 USE module_model_constants
41 USE module_domain, ONLY : domain
42 USE module_configure, ONLY : grid_config_rec_type, model_config_rec
44 USE module_dm, ONLY : local_communicator, mytask, ntasks, ntasks_x, ntasks_y, local_communicator_periodic, wrf_dm_maxval, wrf_err_message, local_communicator_x, local_communicator_y
45 USE module_comm_dm, ONLY : halo_em_tke_c_ad_sub,halo_em_tke_d_ad_sub,halo_em_tke_e_ad_sub &
46 ,halo_em_phys_pbl_ad_sub &
47 ,halo_em_phys_diffusion_ad_sub,halo_em_tke_3_ad_sub &
51 USE module_driver_constants
52 USE a_module_diffusion_em, ONLY : a_phy_bc, a_cal_deform_and_div, &
53 a_compute_diff_metrics, a_vertical_diffusion_2, &
54 a_horizontal_diffusion_2, a_calculate_km_kh, a_tke_rhs
55 ! USE module_em, ONLY : calculate_phy_tend
56 USE a_module_em, ONLY : a_calculate_phy_tend
57 ! USE module_fddaobs_driver, ONLY : fddaobs_driver
58 ! USE module_bc, ONLY : set_physical_bc3d, set_physical_bc2d
59 USE a_module_bc, ONLY : a_set_physical_bc3d, a_set_physical_bc2d
60 ! USE module_physics_addtendc, ONLY : update_phy_ten
61 USE a_module_physics_addtendc, ONLY : a_update_phy_ten
63 ! USE module_sfs_driver
64 ! USE module_stoch, ONLY : update_stoch_ten, perturb_physics_tend,RAND_PERT_UPDATE
66 USE a_module_sfs_driver
70 TYPE ( domain ), INTENT(INOUT) :: grid
71 TYPE ( grid_config_rec_type ), INTENT(IN) :: config_flags
73 INTEGER, INTENT(IN) :: ids, ide, jds, jde, kds, kde, &
74 ims, ime, jms, jme, kms, kme, &
75 ips, ipe, jps, jpe, kps, kpe, &
76 imsx,imex,jmsx,jmex,kmsx,kmex, &
77 ipsx,ipex,jpsx,jpex,kpsx,kpex, &
78 imsy,imey,jmsy,jmey,kmsy,kmey, &
79 ipsy,ipey,jpsy,jpey,kpsy,kpey
82 LOGICAL ,INTENT(IN) :: adapt_step_flag
83 REAL, INTENT(IN) :: curr_secs
85 REAL,DIMENSION(ims:ime,kms:kme,jms:jme,num_moist),INTENT(INOUT) :: moist,a_moist
86 REAL,DIMENSION(ims:ime,kms:kme,jms:jme,num_moist),INTENT(INOUT) :: moist_tend,a_moist_tend
87 REAL,DIMENSION(ims:ime,kms:kme,jms:jme,num_chem),INTENT(INOUT) :: chem,a_chem
88 REAL,DIMENSION(ims:ime,kms:kme,jms:jme,num_chem),INTENT(INOUT) :: chem_tend,a_chem_tend
89 REAL,DIMENSION(ims:ime,kms:kme,jms:jme,num_tracer),INTENT(INOUT) :: tracer,a_tracer
90 REAL,DIMENSION(ims:ime,kms:kme,jms:jme,num_tracer),INTENT(INOUT) :: tracer_tend,a_tracer_tend
91 REAL,DIMENSION(ims:ime,kms:kme,jms:jme,num_scalar),INTENT(INOUT) :: scalar,a_scalar
92 REAL,DIMENSION(ims:ime,kms:kme,jms:jme,num_scalar),INTENT(INOUT) :: scalar_tend,a_scalar_tend
93 REAL,DIMENSION(ims:ime,kms:kme,jms:jme,num_fdda3d),INTENT(INOUT) :: fdda3d,a_fdda3d
94 REAL,DIMENSION(ims:ime,1:1,jms:jme,num_fdda2d),INTENT(INOUT) :: fdda2d,a_fdda2d
95 REAL,DIMENSION(ims:ime,jms:jme), INTENT(INOUT) :: psim,a_psim
96 REAL,DIMENSION(ims:ime,jms:jme), INTENT(INOUT) :: psih,a_psih
97 REAL,DIMENSION(ims:ime,jms:jme), INTENT(INOUT) :: gz1oz0,a_gz1oz0
98 REAL,DIMENSION(ims:ime,jms:jme), INTENT(INOUT) :: chklowq,a_chklowq
99 REAL,DIMENSION(ims:ime,jms:jme), INTENT(INOUT) :: hol,a_hol
100 LOGICAL,DIMENSION(ims:ime,jms:jme), INTENT(INOUT) :: cu_act_flag
102 REAL,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: th_phy,a_th_phy
103 REAL,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: pi_phy,a_pi_phy
104 REAL,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: p_phy,a_p_phy
105 REAL,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: t_phy,a_t_phy
106 REAL,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: dz8w,a_dz8w
107 REAL,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: p8w,a_p8w
108 REAL,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: t8w,a_t8w
110 REAL,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: ru_tendf,a_ru_tendf
111 REAL,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: rv_tendf,a_rv_tendf
112 REAL,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: rw_tendf,a_rw_tendf
113 REAL,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: ph_tendf,a_ph_tendf
114 REAL,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: t_tendf,a_t_tendf
115 REAL,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: tke_tend,a_tke_tend
117 REAL,DIMENSION(ims:ime,jms:jme), INTENT(INOUT) :: mu_tendf,a_mu_tendf
119 INTEGER , INTENT(IN) :: k_start, k_end
121 INTEGER, INTENT( IN ) :: n_nba_mij, n_nba_rij
123 REAL ,DIMENSION(grid%sm31:grid%em31,grid%sm32:grid%em32,grid%sm33:grid%em33,n_nba_mij) &
126 REAL ,DIMENSION(grid%sm31:grid%em31,grid%sm32:grid%em32,grid%sm33:grid%em33,n_nba_rij) &
131 REAL ,DIMENSION(grid%sm31:grid%em31,grid%sm32:grid%em32,grid%sm33:grid%em33,n_nba_mij) &
134 REAL, DIMENSION( ims:ime, jms:jme ) :: ht_loc
136 INTEGER, DIMENSION( ims:ime, jms:jme ) :: shadowmask
138 INTEGER num_roof_layers
139 INTEGER num_wall_layers
140 INTEGER num_road_layers
143 #if ( WRF_DFI_RADAR == 1 )
144 INTEGER i_start,i_end,j_start,j_end,i,j,k
150 !***********************************************************************
152 IF(config_flags%diff_opt .eq. 2) THEN
154 BENCH_START(adj_hor_diff_tim)
157 DO ij = grid%num_tiles,1,-1
159 CALL wrf_debug ( 200 , ' call a_horizontal_diffusion_2' )
160 CALL a_horizontal_diffusion_2( t_tendf,a_t_tendf, ru_tendf,a_ru_tendf, &
161 rv_tendf,a_rv_tendf, rw_tendf,a_rw_tendf, &
162 tke_tend,a_tke_tend, &
163 moist_tend,a_moist_tend, num_moist, &
164 chem_tend,a_chem_tend, num_chem, &
165 scalar_tend,a_scalar_tend, num_scalar, &
166 tracer_tend,a_tracer_tend, num_tracer, &
167 grid%t_2,grid%a_t_2, th_phy,a_th_phy, &
168 grid%mut,grid%a_mut, grid%tke_2,grid%a_tke_2, config_flags, &
169 grid%defor11,grid%a_defor11, grid%defor22,grid%a_defor22, &
170 grid%defor12,grid%a_defor12, &
171 grid%defor13,grid%a_defor13, grid%defor23,grid%a_defor23, &
172 nba_mij,a_nba_mij, num_nba_mij, &
173 grid%div,grid%a_div, &
174 moist,a_moist, chem,a_chem, scalar,a_scalar,tracer,a_tracer, &
175 grid%msfux,grid%msfuy, grid%msfvx,grid%msfvy, grid%msftx, &
176 grid%msfty, grid%xkmh,grid%a_xkmh, grid%xkhh,grid%a_xkhh, config_flags%km_opt, &
177 grid%rdx, grid%rdy, grid%rdz,grid%a_rdz, grid%rdzw,grid%a_rdzw, &
178 grid%fnm, grid%fnp, grid%cf1, grid%cf2, grid%cf3, &
179 grid%zx,grid%a_zx, grid%zy,grid%a_zy, grid%dn, grid%dnw, &
180 grid%rho, grid%a_rho, &
181 ids, ide, jds, jde, kds, kde, &
182 ims, ime, jms, jme, kms, kme, &
183 grid%i_start(ij), grid%i_end(ij), &
184 grid%j_start(ij), grid%j_end(ij), &
187 !$OMP END PARALLEL DO
188 BENCH_END(adj_hor_diff_tim)
190 IF (config_flags%bl_pbl_physics .eq. 0) THEN
192 BENCH_START(adj_vert_diff_tim)
197 DO ij = grid%num_tiles,1,-1
199 CALL wrf_debug ( 200 , ' call a_vertical_diffusion_2 ' )
200 CALL a_vertical_diffusion_2(ru_tendf,a_ru_tendf, &
201 rv_tendf,a_rv_tendf, rw_tendf,a_rw_tendf, &
202 t_tendf,a_t_tendf, tke_tend,a_tke_tend, &
203 moist_tend,a_moist_tend,num_moist, &
204 chem_tend,a_chem_tend,num_chem, &
205 scalar_tend,a_scalar_tend,num_scalar, &
206 tracer_tend,a_tracer_tend,num_tracer, &
207 grid%u_2,grid%a_u_2,grid%v_2,grid%a_v_2, &
208 grid%t_2,grid%a_t_2,grid%u_base,grid%v_base,grid%t_base,grid%qv_base,&
209 grid%mut,grid%a_mut,grid%tke_2,grid%a_tke_2,config_flags, &
210 grid%defor13,grid%a_defor13,grid%defor23,grid%a_defor23, &
211 grid%defor33,grid%a_defor33, &
212 nba_mij,a_nba_mij, num_nba_mij, &
213 grid%div,grid%a_div, moist,a_moist, chem,a_chem, scalar,a_scalar, tracer,a_tracer, &
214 grid%xkmv,grid%a_xkmv, grid%xkhv,grid%a_xkhv, config_flags%km_opt, &
215 grid%fnm, grid%fnp, grid%dn, grid%dnw, grid%rdz,grid%a_rdz, grid%rdzw,grid%a_rdzw, &
216 grid%hfx,grid%a_hfx, grid%qfx,grid%a_qfx, grid%ustm,grid%a_ustm, grid%rho,grid%a_rho, &
217 ids, ide, jds, jde, kds, kde, &
218 ims, ime, jms, jme, kms, kme, &
219 grid%i_start(ij), grid%i_end(ij), &
220 grid%j_start(ij), grid%j_end(ij), &
224 !$OMP END PARALLEL DO
225 BENCH_END(adj_vert_diff_tim)
231 IF( config_flags%diff_opt .eq. 2 .and. config_flags%km_opt .eq. 2 ) THEN
233 BENCH_START(adj_tke_rhs_tim)
236 DO ij = grid%num_tiles,1,-1
238 CALL a_tke_rhs ( tke_tend,a_tke_tend,grid%bn2,grid%a_bn2, &
239 config_flags,grid%defor11,grid%a_defor11,grid%defor22,grid%a_defor22, &
240 grid%defor33,grid%a_defor33,grid%defor12,grid%a_defor12, &
241 grid%defor13,grid%a_defor13,grid%defor23,grid%a_defor23, &
242 grid%u_2,grid%a_u_2,grid%v_2,grid%a_v_2,grid%w_2,grid%a_w_2, &
243 grid%div,grid%a_div,grid%tke_2,grid%a_tke_2,grid%mut,grid%a_mut, &
244 grid%c1h, grid%c2h, &
245 th_phy,a_th_phy,p_phy,a_p_phy,p8w,a_p8w,t8w,a_t8w, &
246 grid%z,grid%a_z,grid%fnm, &
247 grid%fnp,grid%cf1,grid%cf2,grid%cf3, &
248 grid%msftx,grid%msfty,grid%xkmh,grid%a_xkmh, &
249 grid%xkmv,grid%a_xkmv,grid%xkhv,grid%a_xkhv,grid%rdx,grid%rdy, &
250 grid%dx,grid%dy,grid%dt,grid%zx,grid%a_zx,grid%zy,grid%a_zy, &
251 grid%rdz,grid%a_rdz,grid%rdzw,grid%a_rdzw,grid%dn, &
252 grid%dnw,config_flags%mix_isotropic, &
253 grid%hfx,grid%a_hfx, grid%qfx,grid%a_qfx, &
254 moist(ims,kms,jms,P_QV),a_moist(ims,kms,jms,P_QV), &
255 grid%ustm,grid%a_ustm, grid%rho,grid%a_rho, &
256 ids, ide, jds, jde, kds, kde, &
257 ims, ime, jms, jme, kms, kme, &
258 grid%i_start(ij), grid%i_end(ij), &
259 grid%j_start(ij), grid%j_end(ij), &
263 !$OMP END PARALLEL DO
264 BENCH_END(adj_tke_rhs_tim)
270 IF ( (config_flags%damp_opt == 101) .OR. &
271 (config_flags%damp_opt == 103) ) THEN
274 DO ij = 1 , grid%num_tiles
275 !!!!! Need adj of damptop, but cannot find declaration of damptop. Ning Pan, 2010-08-11
276 CALL damptop( grid%u_2, grid%v_2, grid%t_2, &
277 grid%mut, grid%muu, grid%muv, &
279 t_tendf, ru_tendf, rv_tendf, P2SI, &
280 ids, ide, jds, jde, kds, kde, &
281 ims, ime, jms, jme, kms, kme, &
282 grid%i_start(ij), grid%i_end(ij), &
283 grid%j_start(ij), grid%j_end(ij), &
286 !$OMP END PARALLEL DO
290 BENCH_START(adj_update_phy_ten_tim)
294 DO ij = grid%num_tiles,1,-1
296 CALL wrf_debug ( 200 , ' call a_update_phy_ten' )
297 CALL a_update_phy_ten(ph_tendf,t_tendf, a_t_tendf, ru_tendf, a_ru_tendf, &
298 rv_tendf,a_rv_tendf, moist_tend ,a_moist_tend, &
299 scalar_tend, mu_tendf, &
300 grid%rthraten,grid%rthblten,grid%a_rthblten, &
301 grid%rthcuten,grid%a_rthcuten,grid%rthshten, &
302 grid%rublten,grid%a_rublten, &
303 grid%rucuten,grid%rushten, &
304 grid%rvblten,grid%a_rvblten, &
305 grid%rvcuten,grid%rvshten, &
306 grid%rqvblten,grid%a_rqvblten, &
307 grid%rqcblten,grid%rqiblten, &
308 grid%rqvcuten,grid%a_rqvcuten,grid%rqccuten,grid%rqrcuten, &
309 grid%rqicuten,grid%rqscuten, &
310 grid%rqvshten,grid%rqcshten,grid%rqrshten, &
311 grid%rqishten,grid%rqsshten,grid%rqgshten, &
313 grid%RVNDGDTEN,grid%RTHNDGDTEN,grid%RPHNDGDTEN, &
314 grid%RQVNDGDTEN,grid%RMUNDGDTEN, &
315 grid%rthfrten,grid%rqvfrten, & ! fire
316 num_moist,num_scalar,config_flags,rk_step, &
317 grid%adv_moist_cond, &
318 ids, ide, jds, jde, kds, kde, &
319 ims, ime, jms, jme, kms, kme, &
320 grid%i_start(ij), grid%i_end(ij), &
321 grid%j_start(ij), grid%j_end(ij), &
324 #if ( WRF_DFI_RADAR == 1 )
325 if (config_flags%cu_physics .gt. 0) then
326 i_start = grid%i_start(ij)
327 i_end = min( grid%i_end(ij),ide-1 )
328 j_start = grid%j_start(ij)
329 j_end = min( grid%j_end(ij),jde-1 )
330 if (grid%dfi_stage == DFI_FWD ) &
331 CALL wrf_debug ( 200 , ' adj of Zero out cu_physics' )
332 DO j = j_start, j_end
333 DO k = k_start, min( k_end,kde-1 ) - 1
334 DO i = i_start, i_end
335 if (grid%dfi_stage ==DFI_FWD &
336 .and. grid%dfi_tten_rad(i,k,j) >= 1.0e-7 .and. &
337 grid%dfi_tten_rad(i,k,j) <= 10.) then
339 grid%a_rthcuten(i,k,j) = 0.0
348 !$OMP END PARALLEL DO
349 BENCH_END(adj_update_phy_ten_tim)
352 IF ( config_flags%bl_pbl_physics .ge. 1 ) THEN
353 # include "HALO_EM_PHYS_PBL_AD.inc"
355 IF ( config_flags%diff_opt .ge. 1 ) THEN
356 # include "HALO_EM_PHYS_DIFFUSION_AD.inc"
359 IF ( config_flags%h_mom_adv_order <= 4 ) THEN
360 # include "HALO_EM_TKE_3_AD.inc"
361 ELSE IF ( config_flags%h_mom_adv_order <= 6 ) THEN
362 # include "HALO_EM_TKE_5_AD.inc"
364 WRITE(wrf_err_message,*)'solve_em_ad: invalid h_mom_adv_order = ',config_flags%h_mom_adv_order
365 CALL wrf_error_fatal(TRIM(wrf_err_message))
370 IF ( ( config_flags%sfs_opt .GT. 0 ) .AND. ( config_flags%diff_opt .eq. 2 ) ) THEN
371 CALL a_sfs_driver( grid, config_flags, &
372 nba_mij,a_nba_mij, n_nba_mij, &
373 nba_rij,a_nba_rij, n_nba_rij )
377 BENCH_START(adj_phy_bc_tim)
381 DO ij = grid%num_tiles,1,-1
383 CALL wrf_debug ( 200 , ' call a_phy_bc' )
384 CALL a_phy_bc (config_flags,grid%div,grid%a_div,grid%defor11,grid%a_defor11,&
385 grid%defor22,grid%a_defor22,grid%defor33,grid%a_defor33, &
386 grid%defor12,grid%a_defor12,grid%defor13,grid%a_defor13, &
387 grid%defor23,grid%a_defor23, &
388 grid%xkmh,grid%a_xkmh,grid%xkmv,grid%a_xkmv, &
389 grid%xkhh,grid%a_xkhh,grid%xkhv,grid%a_xkhv, &
390 grid%tke_2,grid%a_tke_2, &
391 grid%rublten,grid%a_rublten, grid%rvblten,grid%a_rvblten, &
392 grid%rucuten,grid%a_rucuten, grid%rvcuten,grid%a_rvcuten, &
393 grid%rushten,grid%a_rushten, grid%rvshten,grid%a_rvshten, &
394 ids, ide, jds, jde, kds, kde, &
395 ims, ime, jms, jme, kms, kme, &
396 ips, ipe, jps, jpe, kps, kpe, &
397 grid%i_start(ij), grid%i_end(ij), &
398 grid%j_start(ij), grid%j_end(ij), &
401 !$OMP END PARALLEL DO
402 BENCH_END(adj_phy_bc_tim)
404 IF(config_flags%diff_opt .eq. 2 .OR. config_flags%diff_opt .eq. 1) THEN
407 # include "HALO_EM_TKE_E_AD.inc"
410 BENCH_START(adj_calc_tke_tim)
413 DO ij = grid%num_tiles,1,-1
415 CALL wrf_debug ( 200 , ' call a_calculate_km_kh' )
416 CALL a_calculate_km_kh( config_flags,grid%dt,grid%dampcoef,grid%zdamp, &
417 config_flags%damp_opt, &
418 grid%xkmh,grid%a_xkmh,grid%xkmv,grid%a_xkmv,grid%xkhh,grid%a_xkhh, &
419 grid%xkhv,grid%a_xkhv,grid%bn2,grid%a_bn2, &
420 grid%khdif,grid%kvdif,grid%div,grid%a_div, &
421 grid%defor11,grid%a_defor11,grid%defor22,grid%a_defor22, &
422 grid%defor33,grid%a_defor33,grid%defor12,grid%a_defor12, &
423 grid%defor13,grid%a_defor13,grid%defor23,grid%a_defor23, &
424 grid%tke_2,grid%a_tke_2,p8w,a_p8w,t8w,a_t8w,th_phy,a_th_phy, &
425 t_phy,a_t_phy,p_phy,a_p_phy,moist,a_moist,grid%dn,grid%dnw, &
426 grid%dx,grid%dy,grid%rdz,grid%a_rdz,grid%rdzw,grid%a_rdzw, &
427 config_flags%mix_isotropic,num_moist, &
428 grid%cf1, grid%cf2, grid%cf3, grid%warm_rain, &
429 grid%mix_upper_bound, &
430 grid%msftx, grid%msfty, &
431 grid%zx, grid%a_zx, grid%zy, grid%a_zy, &
432 ids,ide, jds,jde, kds,kde, &
433 ims,ime, jms,jme, kms,kme, &
434 grid%i_start(ij), grid%i_end(ij), &
435 grid%j_start(ij), grid%j_end(ij), &
438 !$OMP END PARALLEL DO
439 BENCH_END(adj_calc_tke_tim)
442 # include "HALO_EM_TKE_D_AD.inc"
445 BENCH_START(adj_deform_div_tim)
450 DO ij = grid%num_tiles,1,-1
452 CALL wrf_debug ( 200 , ' call a_cal_deform_and_div' )
453 CALL a_cal_deform_and_div ( config_flags,grid%u_2,grid%a_u_2, &
454 grid%v_2,grid%a_v_2,grid%w_2,grid%a_w_2,grid%div,grid%a_div, &
455 grid%defor11,grid%a_defor11,grid%defor22,grid%a_defor22, &
456 grid%defor33,grid%a_defor33,grid%defor12,grid%a_defor12, &
457 grid%defor13,grid%a_defor13,grid%defor23,grid%a_defor23, &
458 nba_rij,a_nba_rij, n_nba_rij, &
459 grid%u_base, grid%v_base,grid%msfux,grid%msfuy, &
460 grid%msfvx,grid%msfvy,grid%msftx,grid%msfty, &
461 grid%rdx, grid%rdy, grid%dn, grid%dnw, grid%rdz,grid%a_rdz, &
462 grid%rdzw,grid%a_rdzw,grid%fnm,grid%fnp,grid%cf1,grid%cf2, &
463 grid%cf3,grid%zx,grid%a_zx,grid%zy,grid%a_zy, &
464 ids, ide, jds, jde, kds, kde, &
465 ims, ime, jms, jme, kms, kme, &
466 grid%i_start(ij), grid%i_end(ij), &
467 grid%j_start(ij), grid%j_end(ij), &
470 !$OMP END PARALLEL DO
471 BENCH_END(adj_deform_div_tim)
473 BENCH_START(adj_tke_diff_bc_tim)
477 DO ij = grid%num_tiles,1,-1
479 CALL wrf_debug ( 200 , ' call adj of bc for diffusion_metrics ' )
480 CALL a_set_physical_bc2d( grid%a_ustm, 't', config_flags, &
481 ids, ide, jds, jde, &
482 ims, ime, jms, jme, &
483 ips, ipe, jps, jpe, &
484 grid%i_start(ij), grid%i_end(ij), &
485 grid%j_start(ij), grid%j_end(ij) )
486 CALL a_set_physical_bc3d( grid%a_zy , 'w', config_flags, &
487 ids, ide, jds, jde, kds, kde, &
488 ims, ime, jms, jme, kms, kme, &
489 ips, ipe, jps, jpe, kps, kpe, &
490 grid%i_start(ij), grid%i_end(ij), &
491 grid%j_start(ij), grid%j_end(ij), &
493 CALL a_set_physical_bc3d( grid%a_zx , 'w', config_flags, &
494 ids, ide, jds, jde, kds, kde, &
495 ims, ime, jms, jme, kms, kme, &
496 ips, ipe, jps, jpe, kps, kpe, &
497 grid%i_start(ij), grid%i_end(ij), &
498 grid%j_start(ij), grid%j_end(ij), &
500 CALL a_set_physical_bc3d( grid%a_z , 'w', config_flags, &
501 ids, ide, jds, jde, kds, kde, &
502 ims, ime, jms, jme, kms, kme, &
503 ips, ipe, jps, jpe, kps, kpe, &
504 grid%i_start(ij), grid%i_end(ij), &
505 grid%j_start(ij), grid%j_end(ij), &
507 CALL a_set_physical_bc3d( grid%a_rdz , 'w', config_flags, &
508 ids, ide, jds, jde, kds, kde, &
509 ims, ime, jms, jme, kms, kme, &
510 ips, ipe, jps, jpe, kps, kpe, &
511 grid%i_start(ij), grid%i_end(ij), &
512 grid%j_start(ij), grid%j_end(ij), &
514 CALL a_set_physical_bc3d( grid%a_rdzw , 'w', config_flags,&
515 ids, ide, jds, jde, kds, kde, &
516 ims, ime, jms, jme, kms, kme, &
517 ips, ipe, jps, jpe, kps, kpe, &
518 grid%i_start(ij), grid%i_end(ij), &
519 grid%j_start(ij), grid%j_end(ij), &
523 !$OMP END PARALLEL DO
524 BENCH_END(adj_tke_diff_bc_tim)
527 # include "HALO_EM_TKE_C_AD.inc"
530 BENCH_START(adj_comp_diff_metrics_tim)
533 DO ij = grid%num_tiles,1,-1
534 CALL wrf_debug ( 200 , ' call a_compute_diff_metrics ' )
535 CALL a_compute_diff_metrics ( config_flags, grid%ph_2,grid%a_ph_2, &
536 grid%phb, grid%z,grid%a_z, grid%rdz,grid%a_rdz, grid%rdzw,grid%a_rdzw, &
537 grid%zx,grid%a_zx, grid%zy,grid%a_zy, grid%rdx, grid%rdy, &
538 ids, ide, jds, jde, kds, kde, &
539 ims, ime, jms, jme, kms, kme, &
540 grid%i_start(ij), grid%i_end(ij), &
541 grid%j_start(ij), grid%j_end(ij), &
544 !$OMP END PARALLEL DO
545 BENCH_END(adj_comp_diff_metrics_tim)
549 BENCH_START(adj_cal_phy_tend)
553 DO ij = grid%num_tiles,1,-1
555 CALL wrf_debug ( 200 , ' call a_calculate_phy_tend' )
556 CALL a_calculate_phy_tend (config_flags,grid%mut,grid%a_mut,grid%muu,grid%a_muu, &
557 grid%muv,grid%a_muv,pi_phy, &
558 grid%rthraten, grid%a_rthraten, &
559 grid%rublten, grid%a_rublten, &
560 grid%rvblten, grid%a_rvblten, &
561 grid%rthblten, grid%a_rthblten, &
562 grid%rqvblten, grid%a_rqvblten, &
563 grid%rqcblten, grid%a_rqcblten, &
564 grid%rqiblten, grid%a_rqiblten, &
565 grid%rucuten, grid%a_rucuten, &
566 grid%rvcuten, grid%a_rvcuten, &
567 grid%rthcuten, grid%a_rthcuten, &
568 grid%rqvcuten, grid%a_rqvcuten, &
569 grid%rqccuten, grid%a_rqccuten, &
570 grid%rqrcuten, grid%a_rqrcuten, &
571 grid%rqicuten, grid%a_rqicuten, &
572 grid%rqscuten, grid%a_rqscuten, &
573 grid%rushten, grid%a_rushten, &
574 grid%rvshten, grid%a_rvshten, &
575 grid%rthshten, grid%a_rthshten, &
576 grid%rqvshten, grid%a_rqvshten, &
577 grid%rqcshten, grid%a_rqcshten, &
578 grid%rqrshten, grid%a_rqrshten, &
579 grid%rqishten, grid%a_rqishten, &
580 grid%rqsshten, grid%a_rqsshten, &
581 grid%rqgshten, grid%a_rqgshten, &
582 grid%RUNDGDTEN, grid%a_RUNDGDTEN, &
583 grid%RVNDGDTEN, grid%a_RVNDGDTEN, &
584 grid%RTHNDGDTEN, grid%a_RTHNDGDTEN, &
585 grid%RQVNDGDTEN, grid%a_RQVNDGDTEN, &
587 ids,ide, jds,jde, kds,kde, &
588 ims,ime, jms,jme, kms,kme, &
589 grid%i_start(ij), min(grid%i_end(ij),ide-1), &
590 grid%j_start(ij), min(grid%j_end(ij),jde-1), &
591 k_start , min(k_end,kde-1) )
594 !$OMP END PARALLEL DO
595 BENCH_END(adj_cal_phy_tend)
597 END SUBROUTINE a_first_rk_step_part2
599 END MODULE a_module_first_rk_step_part2