1 | !WRF:MEDIATION_LAYER:SOLVER |
---|
2 | |
---|
3 | #define BENCH_START(A) |
---|
4 | #define BENCH_END(A) |
---|
5 | |
---|
6 | MODULE module_first_rk_step_part2 |
---|
7 | |
---|
8 | CONTAINS |
---|
9 | |
---|
10 | SUBROUTINE first_rk_step_part2 ( grid , config_flags & |
---|
11 | , moist , moist_tend & |
---|
12 | , chem , chem_tend & |
---|
13 | , scalar , scalar_tend & |
---|
14 | , fdda3d, fdda2d & |
---|
15 | , ru_tendf, rv_tendf & |
---|
16 | , rw_tendf, t_tendf & |
---|
17 | , ph_tendf, mu_tendf & |
---|
18 | , tke_tend & |
---|
19 | , adapt_step_flag , curr_secs & |
---|
20 | , psim , psih , wspd , gz1oz0 , br , chklowq & |
---|
21 | , cu_act_flag , hol , th_phy & |
---|
22 | , pi_phy , p_phy , t_phy , u_phy , v_phy & |
---|
23 | , dz8w , p8w , t8w , rho_phy , rho & |
---|
24 | , z_at_w , mu_3d & |
---|
25 | , ids, ide, jds, jde, kds, kde & |
---|
26 | , ims, ime, jms, jme, kms, kme & |
---|
27 | , ips, ipe, jps, jpe, kps, kpe & |
---|
28 | , k_start , k_end & |
---|
29 | ) |
---|
30 | USE module_state_description |
---|
31 | USE module_model_constants |
---|
32 | USE module_domain, ONLY : domain |
---|
33 | USE module_configure, ONLY : grid_config_rec_type, model_config_rec |
---|
34 | USE module_dm |
---|
35 | USE module_diffusion_em, ONLY : phy_bc, cal_deform_and_div, compute_diff_metrics, & |
---|
36 | vertical_diffusion_2, horizontal_diffusion_2, calculate_km_kh, & |
---|
37 | tke_rhs |
---|
38 | USE module_em, ONLY : calculate_phy_tend |
---|
39 | USE module_fddaobs_driver, ONLY : fddaobs_driver |
---|
40 | USE module_bc, ONLY : set_physical_bc3d, set_physical_bc2d |
---|
41 | USE module_physics_addtendc, ONLY : update_phy_ten |
---|
42 | |
---|
43 | IMPLICIT NONE |
---|
44 | |
---|
45 | TYPE ( domain ), INTENT(INOUT) :: grid |
---|
46 | TYPE ( grid_config_rec_type ), INTENT(IN) :: config_flags |
---|
47 | |
---|
48 | INTEGER, INTENT(IN) :: ids, ide, jds, jde, kds, kde, & |
---|
49 | ims, ime, jms, jme, kms, kme, & |
---|
50 | ips, ipe, jps, jpe, kps, kpe |
---|
51 | |
---|
52 | LOGICAL ,INTENT(IN) :: adapt_step_flag |
---|
53 | REAL, INTENT(IN) :: curr_secs |
---|
54 | |
---|
55 | REAL ,DIMENSION(ims:ime,kms:kme,jms:jme,num_moist),INTENT(INOUT) :: moist |
---|
56 | REAL ,DIMENSION(ims:ime,kms:kme,jms:jme,num_moist),INTENT(INOUT) :: moist_tend |
---|
57 | REAL ,DIMENSION(ims:ime,kms:kme,jms:jme,num_moist),INTENT(INOUT) :: chem |
---|
58 | REAL ,DIMENSION(ims:ime,kms:kme,jms:jme,num_moist),INTENT(INOUT) :: chem_tend |
---|
59 | REAL ,DIMENSION(ims:ime,kms:kme,jms:jme,num_moist),INTENT(INOUT) :: scalar |
---|
60 | REAL ,DIMENSION(ims:ime,kms:kme,jms:jme,num_moist),INTENT(INOUT) :: scalar_tend |
---|
61 | REAL ,DIMENSION(ims:ime,kms:kme,jms:jme,num_fdda3d),INTENT(INOUT) :: fdda3d |
---|
62 | REAL ,DIMENSION(ims:ime,1:1,jms:jme,num_fdda2d),INTENT(INOUT) :: fdda2d |
---|
63 | REAL ,DIMENSION(ims:ime,jms:jme), INTENT(INOUT) :: psim |
---|
64 | REAL ,DIMENSION(ims:ime,jms:jme), INTENT(INOUT) :: psih |
---|
65 | REAL ,DIMENSION(ims:ime,jms:jme), INTENT(INOUT) :: wspd |
---|
66 | REAL ,DIMENSION(ims:ime,jms:jme), INTENT(INOUT) :: gz1oz0 |
---|
67 | REAL ,DIMENSION(ims:ime,jms:jme), INTENT(INOUT) :: br |
---|
68 | REAL ,DIMENSION(ims:ime,jms:jme), INTENT(INOUT) :: chklowq |
---|
69 | LOGICAL ,DIMENSION(ims:ime,jms:jme), INTENT(INOUT) :: cu_act_flag |
---|
70 | REAL ,DIMENSION(ims:ime,jms:jme), INTENT(INOUT) :: hol |
---|
71 | |
---|
72 | REAL ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: th_phy |
---|
73 | REAL ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: pi_phy |
---|
74 | REAL ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: p_phy |
---|
75 | REAL ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: t_phy |
---|
76 | REAL ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: u_phy |
---|
77 | REAL ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: v_phy |
---|
78 | REAL ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: dz8w |
---|
79 | REAL ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: p8w |
---|
80 | REAL ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: t8w |
---|
81 | REAL ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: rho_phy |
---|
82 | REAL ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: rho |
---|
83 | REAL ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: z_at_w |
---|
84 | REAL ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: mu_3d |
---|
85 | |
---|
86 | REAL ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: ru_tendf |
---|
87 | REAL ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: rv_tendf |
---|
88 | REAL ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: rw_tendf |
---|
89 | REAL ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: ph_tendf |
---|
90 | REAL ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: t_tendf |
---|
91 | REAL ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: tke_tend |
---|
92 | |
---|
93 | REAL ,DIMENSION(ims:ime,jms:jme), INTENT(INOUT) :: mu_tendf |
---|
94 | |
---|
95 | INTEGER , INTENT(IN) :: k_start, k_end |
---|
96 | |
---|
97 | ! Local |
---|
98 | |
---|
99 | REAL, DIMENSION( ims:ime, jms:jme ) :: ht_loc |
---|
100 | INTEGER, DIMENSION( ims:ime, jms:jme ) :: shadowmask |
---|
101 | INTEGER :: ij |
---|
102 | INTEGER num_roof_layers |
---|
103 | INTEGER num_wall_layers |
---|
104 | INTEGER num_road_layers |
---|
105 | INTEGER iswater |
---|
106 | INTEGER rk_step |
---|
107 | |
---|
108 | ! initialize all tendencies to zero in order to update physics |
---|
109 | ! tendencies first (separate from dry dynamics). |
---|
110 | |
---|
111 | rk_step = 1 |
---|
112 | |
---|
113 | ! calculate_phy_tend |
---|
114 | |
---|
115 | BENCH_START(cal_phy_tend) |
---|
116 | !$OMP PARALLEL DO & |
---|
117 | !$OMP PRIVATE ( ij ) |
---|
118 | |
---|
119 | DO ij = 1 , grid%num_tiles |
---|
120 | |
---|
121 | CALL wrf_debug ( 200 , ' call calculate_phy_tend' ) |
---|
122 | CALL calculate_phy_tend (config_flags,grid%mut,grid%muu,grid%muv,pi_phy, & |
---|
123 | grid%rthraten, & |
---|
124 | grid%rublten,grid%rvblten,grid%rthblten, & |
---|
125 | grid%rqvblten,grid%rqcblten,grid%rqiblten, & |
---|
126 | grid%rthcuten,grid%rqvcuten,grid%rqccuten,grid%rqrcuten, & |
---|
127 | grid%rqicuten,grid%rqscuten, & |
---|
128 | grid%RUNDGDTEN,grid%RVNDGDTEN,grid%RTHNDGDTEN,grid%RQVNDGDTEN, & |
---|
129 | grid%RMUNDGDTEN, & |
---|
130 | ids,ide, jds,jde, kds,kde, & |
---|
131 | ims,ime, jms,jme, kms,kme, & |
---|
132 | grid%i_start(ij), min(grid%i_end(ij),ide-1), & |
---|
133 | grid%j_start(ij), min(grid%j_end(ij),jde-1), & |
---|
134 | k_start , min(k_end,kde-1) ) |
---|
135 | |
---|
136 | ENDDO |
---|
137 | !$OMP END PARALLEL DO |
---|
138 | BENCH_END(cal_phy_tend) |
---|
139 | |
---|
140 | ! tke diffusion |
---|
141 | |
---|
142 | IF(config_flags%diff_opt .eq. 2 .OR. config_flags%diff_opt .eq. 1) THEN |
---|
143 | |
---|
144 | BENCH_START(comp_diff_metrics_tim) |
---|
145 | !$OMP PARALLEL DO & |
---|
146 | !$OMP PRIVATE ( ij ) |
---|
147 | DO ij = 1 , grid%num_tiles |
---|
148 | CALL wrf_debug ( 200 , ' call compute_diff_metrics ' ) |
---|
149 | CALL compute_diff_metrics ( config_flags, grid%ph_2, grid%phb, grid%z, grid%rdz, grid%rdzw, & |
---|
150 | grid%zx, grid%zy, grid%rdx, grid%rdy, & |
---|
151 | ids, ide, jds, jde, kds, kde, & |
---|
152 | ims, ime, jms, jme, kms, kme, & |
---|
153 | grid%i_start(ij), grid%i_end(ij), & |
---|
154 | grid%j_start(ij), grid%j_end(ij), & |
---|
155 | k_start , k_end ) |
---|
156 | ENDDO |
---|
157 | !$OMP END PARALLEL DO |
---|
158 | BENCH_END(comp_diff_metrics_tim) |
---|
159 | |
---|
160 | #ifdef DM_PARALLEL |
---|
161 | # include "HALO_EM_TKE_C.inc" |
---|
162 | # include "PERIOD_BDY_EM_A1.inc" |
---|
163 | #endif |
---|
164 | |
---|
165 | BENCH_START(tke_diff_bc_tim) |
---|
166 | !$OMP PARALLEL DO & |
---|
167 | !$OMP PRIVATE ( ij ) |
---|
168 | |
---|
169 | DO ij = 1 , grid%num_tiles |
---|
170 | |
---|
171 | CALL wrf_debug ( 200 , ' call bc for diffusion_metrics ' ) |
---|
172 | CALL set_physical_bc3d( grid%rdzw , 'w', config_flags, & |
---|
173 | ids, ide, jds, jde, kds, kde, & |
---|
174 | ims, ime, jms, jme, kms, kme, & |
---|
175 | ips, ipe, jps, jpe, kps, kpe, & |
---|
176 | grid%i_start(ij), grid%i_end(ij), & |
---|
177 | grid%j_start(ij), grid%j_end(ij), & |
---|
178 | k_start , k_end ) |
---|
179 | CALL set_physical_bc3d( grid%rdz , 'w', config_flags, & |
---|
180 | ids, ide, jds, jde, kds, kde, & |
---|
181 | ims, ime, jms, jme, kms, kme, & |
---|
182 | ips, ipe, jps, jpe, kps, kpe, & |
---|
183 | grid%i_start(ij), grid%i_end(ij), & |
---|
184 | grid%j_start(ij), grid%j_end(ij), & |
---|
185 | k_start , k_end ) |
---|
186 | CALL set_physical_bc3d( grid%z , 'w', config_flags, & |
---|
187 | ids, ide, jds, jde, kds, kde, & |
---|
188 | ims, ime, jms, jme, kms, kme, & |
---|
189 | ips, ipe, jps, jpe, kps, kpe, & |
---|
190 | grid%i_start(ij), grid%i_end(ij), & |
---|
191 | grid%j_start(ij), grid%j_end(ij), & |
---|
192 | k_start , k_end ) |
---|
193 | CALL set_physical_bc3d( grid%zx , 'w', config_flags, & |
---|
194 | ids, ide, jds, jde, kds, kde, & |
---|
195 | ims, ime, jms, jme, kms, kme, & |
---|
196 | ips, ipe, jps, jpe, kps, kpe, & |
---|
197 | grid%i_start(ij), grid%i_end(ij), & |
---|
198 | grid%j_start(ij), grid%j_end(ij), & |
---|
199 | k_start , k_end ) |
---|
200 | CALL set_physical_bc3d( grid%zy , 'w', config_flags, & |
---|
201 | ids, ide, jds, jde, kds, kde, & |
---|
202 | ims, ime, jms, jme, kms, kme, & |
---|
203 | ips, ipe, jps, jpe, kps, kpe, & |
---|
204 | grid%i_start(ij), grid%i_end(ij), & |
---|
205 | grid%j_start(ij), grid%j_end(ij), & |
---|
206 | k_start , k_end ) |
---|
207 | CALL set_physical_bc2d( grid%ustm, 't', config_flags, & |
---|
208 | ids, ide, jds, jde, & |
---|
209 | ims, ime, jms, jme, & |
---|
210 | ips, ipe, jps, jpe, & |
---|
211 | grid%i_start(ij), grid%i_end(ij), & |
---|
212 | grid%j_start(ij), grid%j_end(ij) ) |
---|
213 | |
---|
214 | ENDDO |
---|
215 | !$OMP END PARALLEL DO |
---|
216 | BENCH_END(tke_diff_bc_tim) |
---|
217 | |
---|
218 | BENCH_START(deform_div_tim) |
---|
219 | |
---|
220 | !$OMP PARALLEL DO & |
---|
221 | !$OMP PRIVATE ( ij ) |
---|
222 | |
---|
223 | DO ij = 1 , grid%num_tiles |
---|
224 | |
---|
225 | CALL wrf_debug ( 200 , ' call cal_deform_and_div' ) |
---|
226 | CALL cal_deform_and_div ( config_flags,grid%u_2,grid%v_2,grid%w_2,grid%div, & |
---|
227 | grid%defor11,grid%defor22,grid%defor33, & |
---|
228 | grid%defor12,grid%defor13,grid%defor23, & |
---|
229 | grid%u_base, grid%v_base,grid%msfux,grid%msfuy, & |
---|
230 | grid%msfvx,grid%msfvy,grid%msftx,grid%msfty, & |
---|
231 | grid%rdx, grid%rdy, grid%dn, grid%dnw, grid%rdz, & |
---|
232 | grid%rdzw,grid%fnm,grid%fnp,grid%cf1,grid%cf2, & |
---|
233 | grid%cf3,grid%zx,grid%zy, & |
---|
234 | ids, ide, jds, jde, kds, kde, & |
---|
235 | ims, ime, jms, jme, kms, kme, & |
---|
236 | grid%i_start(ij), grid%i_end(ij), & |
---|
237 | grid%j_start(ij), grid%j_end(ij), & |
---|
238 | k_start , k_end ) |
---|
239 | ENDDO |
---|
240 | !$OMP END PARALLEL DO |
---|
241 | BENCH_END(deform_div_tim) |
---|
242 | |
---|
243 | #ifdef DM_PARALLEL |
---|
244 | # include "HALO_EM_TKE_D.inc" |
---|
245 | #endif |
---|
246 | |
---|
247 | ! calculate tke, kmh, and kmv |
---|
248 | |
---|
249 | BENCH_START(calc_tke_tim) |
---|
250 | !$OMP PARALLEL DO & |
---|
251 | !$OMP PRIVATE ( ij ) |
---|
252 | DO ij = 1 , grid%num_tiles |
---|
253 | |
---|
254 | CALL wrf_debug ( 200 , ' call calculate_km_kh' ) |
---|
255 | CALL calculate_km_kh( config_flags,grid%dt,grid%dampcoef,grid%zdamp, & |
---|
256 | config_flags%damp_opt, & |
---|
257 | grid%xkmh,grid%xkmv,grid%xkhh,grid%xkhv,grid%bn2, & |
---|
258 | grid%khdif,grid%kvdif,grid%div, & |
---|
259 | grid%defor11,grid%defor22,grid%defor33,grid%defor12, & |
---|
260 | grid%defor13,grid%defor23, & |
---|
261 | grid%tke_2,p8w,t8w,th_phy, & |
---|
262 | t_phy,p_phy,moist,grid%dn,grid%dnw, & |
---|
263 | grid%dx,grid%dy,grid%rdz,grid%rdzw, & |
---|
264 | config_flags%mix_isotropic,num_moist, & |
---|
265 | grid%cf1, grid%cf2, grid%cf3, grid%warm_rain, & |
---|
266 | grid%mix_upper_bound, & |
---|
267 | grid%msftx, grid%msfty, & |
---|
268 | ids,ide, jds,jde, kds,kde, & |
---|
269 | ims,ime, jms,jme, kms,kme, & |
---|
270 | grid%i_start(ij), grid%i_end(ij), & |
---|
271 | grid%j_start(ij), grid%j_end(ij), & |
---|
272 | k_start , k_end ) |
---|
273 | ENDDO |
---|
274 | !$OMP END PARALLEL DO |
---|
275 | BENCH_END(calc_tke_tim) |
---|
276 | |
---|
277 | #ifdef DM_PARALLEL |
---|
278 | # include "HALO_EM_TKE_E.inc" |
---|
279 | #endif |
---|
280 | |
---|
281 | ENDIF |
---|
282 | |
---|
283 | #ifdef DM_PARALLEL |
---|
284 | # include "PERIOD_BDY_EM_PHY_BC.inc" |
---|
285 | IF ( config_flags%grid_fdda .eq. 1) THEN |
---|
286 | # include "PERIOD_BDY_EM_FDDA_BC.inc" |
---|
287 | ENDIF |
---|
288 | # include "PERIOD_BDY_EM_CHEM.inc" |
---|
289 | #endif |
---|
290 | |
---|
291 | BENCH_START(phy_bc_tim) |
---|
292 | !$OMP PARALLEL DO & |
---|
293 | !$OMP PRIVATE ( ij ) |
---|
294 | |
---|
295 | DO ij = 1 , grid%num_tiles |
---|
296 | |
---|
297 | CALL wrf_debug ( 200 , ' call phy_bc' ) |
---|
298 | CALL phy_bc (config_flags,grid%div,grid%defor11,grid%defor22,grid%defor33, & |
---|
299 | grid%defor12,grid%defor13,grid%defor23, & |
---|
300 | grid%xkmh,grid%xkmv,grid%xkhh,grid%xkhv, & |
---|
301 | grid%tke_2, & |
---|
302 | grid%rublten, grid%rvblten, & |
---|
303 | ids, ide, jds, jde, kds, kde, & |
---|
304 | ims, ime, jms, jme, kms, kme, & |
---|
305 | ips, ipe, jps, jpe, kps, kpe, & |
---|
306 | grid%i_start(ij), grid%i_end(ij), & |
---|
307 | grid%j_start(ij), grid%j_end(ij), & |
---|
308 | k_start , k_end ) |
---|
309 | ENDDO |
---|
310 | !$OMP END PARALLEL DO |
---|
311 | BENCH_END(phy_bc_tim) |
---|
312 | |
---|
313 | #ifdef DM_PARALLEL |
---|
314 | !----------------------------------------------------------------------- |
---|
315 | ! |
---|
316 | ! MPP for some physics tendency, km, kh, deformation, and divergence |
---|
317 | ! |
---|
318 | ! * * * * * * * |
---|
319 | ! * * * * * * * * * * * * |
---|
320 | ! * * * * * * * * * * * * * * |
---|
321 | ! * + * * + * + * * + * * * * * + * * * |
---|
322 | ! * * * * * * * * * * * * * * |
---|
323 | ! * * * * * * * * * * * * |
---|
324 | ! * * * * * * * |
---|
325 | ! |
---|
326 | ! (for PBL) |
---|
327 | ! rublten x |
---|
328 | ! rvblten x |
---|
329 | ! |
---|
330 | ! (for FDDA) |
---|
331 | ! rundgdten x |
---|
332 | ! rvndgdten x |
---|
333 | ! |
---|
334 | ! (for TKE3) |
---|
335 | ! tke_2 x |
---|
336 | ! (for TKE5) |
---|
337 | ! tke_2 x |
---|
338 | ! |
---|
339 | ! (for diff_opt >= 1) |
---|
340 | ! defor11 x |
---|
341 | ! defor22 x |
---|
342 | ! defor12 x |
---|
343 | ! defor13 x |
---|
344 | ! defor23 x |
---|
345 | ! div x |
---|
346 | ! xkmv x |
---|
347 | ! xkmh x |
---|
348 | ! xkhv x |
---|
349 | ! xkhh x |
---|
350 | ! tke x |
---|
351 | ! |
---|
352 | !----------------------------------------------------------------------- |
---|
353 | IF ( config_flags%bl_pbl_physics .ge. 1 ) THEN |
---|
354 | # include "HALO_EM_PHYS_PBL.inc" |
---|
355 | ENDIF |
---|
356 | IF ( config_flags%grid_fdda .eq. 1) THEN |
---|
357 | # include "HALO_EM_FDDA.inc" |
---|
358 | ENDIF |
---|
359 | IF ( config_flags%diff_opt .ge. 1 ) THEN |
---|
360 | # include "HALO_EM_PHYS_DIFFUSION.inc" |
---|
361 | ENDIF |
---|
362 | |
---|
363 | IF ( config_flags%h_mom_adv_order <= 4 ) THEN |
---|
364 | # include "HALO_EM_TKE_3.inc" |
---|
365 | ELSE IF ( config_flags%h_mom_adv_order <= 6 ) THEN |
---|
366 | # include "HALO_EM_TKE_5.inc" |
---|
367 | ELSE |
---|
368 | WRITE(wrf_err_message,*)'solve_em: invalid h_mom_adv_order = ',config_flags%h_mom_adv_order |
---|
369 | CALL wrf_error_fatal(TRIM(wrf_err_message)) |
---|
370 | ENDIF |
---|
371 | #endif |
---|
372 | |
---|
373 | BENCH_START(update_phy_ten_tim) |
---|
374 | !$OMP PARALLEL DO & |
---|
375 | !$OMP PRIVATE ( ij ) |
---|
376 | |
---|
377 | DO ij = 1 , grid%num_tiles |
---|
378 | |
---|
379 | CALL wrf_debug ( 200 , ' call update_phy_ten' ) |
---|
380 | CALL update_phy_ten(t_tendf, ru_tendf, rv_tendf,moist_tend, & |
---|
381 | scalar_tend, mu_tendf, & |
---|
382 | grid%rthraten,grid%rthblten,grid%rthcuten, & |
---|
383 | grid%rublten,grid%rvblten, & |
---|
384 | grid%rqvblten,grid%rqcblten,grid%rqiblten, & |
---|
385 | grid%rqvcuten,grid%rqccuten,grid%rqrcuten, & |
---|
386 | grid%rqicuten,grid%rqscuten,grid%RUNDGDTEN, & |
---|
387 | grid%RVNDGDTEN,grid%RTHNDGDTEN,grid%RQVNDGDTEN, & |
---|
388 | grid%RMUNDGDTEN, & |
---|
389 | num_moist,num_scalar,config_flags,rk_step, & |
---|
390 | grid%adv_moist_cond, & |
---|
391 | ids, ide, jds, jde, kds, kde, & |
---|
392 | ims, ime, jms, jme, kms, kme, & |
---|
393 | grid%i_start(ij), grid%i_end(ij), & |
---|
394 | grid%j_start(ij), grid%j_end(ij), & |
---|
395 | k_start, k_end ) |
---|
396 | |
---|
397 | END DO |
---|
398 | !$OMP END PARALLEL DO |
---|
399 | BENCH_END(update_phy_ten_tim) |
---|
400 | |
---|
401 | #ifdef PLANET |
---|
402 | ! do rayleigh (and zonal-average newtonian) damping during |
---|
403 | ! first iteration of RK loop only |
---|
404 | |
---|
405 | IF ( (config_flags%damp_opt == 101) .OR. & |
---|
406 | (config_flags%damp_opt == 103) ) THEN |
---|
407 | !$OMP PARALLEL DO & |
---|
408 | !$OMP PRIVATE ( ij ) |
---|
409 | DO ij = 1 , grid%num_tiles |
---|
410 | CALL damptop( grid%u_2, grid%v_2, grid%t_2, & |
---|
411 | grid%mut, grid%muu, grid%muv, & |
---|
412 | pi_phy, & |
---|
413 | t_tendf, ru_tendf, rv_tendf, P2SI, & |
---|
414 | ids, ide, jds, jde, kds, kde, & |
---|
415 | ims, ime, jms, jme, kms, kme, & |
---|
416 | grid%i_start(ij), grid%i_end(ij), & |
---|
417 | grid%j_start(ij), grid%j_end(ij), & |
---|
418 | k_start, k_end ) |
---|
419 | END DO |
---|
420 | !$OMP END PARALLEL DO |
---|
421 | END IF |
---|
422 | #endif |
---|
423 | |
---|
424 | IF( config_flags%diff_opt .eq. 2 .and. config_flags%km_opt .eq. 2 ) THEN |
---|
425 | |
---|
426 | BENCH_START(tke_rhs_tim) |
---|
427 | !$OMP PARALLEL DO & |
---|
428 | !$OMP PRIVATE ( ij ) |
---|
429 | DO ij = 1 , grid%num_tiles |
---|
430 | |
---|
431 | CALL tke_rhs ( tke_tend,grid%bn2, & |
---|
432 | config_flags,grid%defor11,grid%defor22, & |
---|
433 | grid%defor33, & |
---|
434 | grid%defor12,grid%defor13,grid%defor23, & |
---|
435 | grid%u_2,grid%v_2,grid%w_2,grid%div, & |
---|
436 | grid%tke_2,grid%mut, & |
---|
437 | th_phy,p_phy,p8w,t8w,grid%z,grid%fnm, & |
---|
438 | grid%fnp,grid%cf1,grid%cf2,grid%cf3, & |
---|
439 | grid%msftx,grid%msfty,grid%xkmh, & |
---|
440 | grid%xkmv,grid%xkhv,grid%rdx,grid%rdy, & |
---|
441 | grid%dx,grid%dy,grid%dt,grid%zx,grid%zy, & |
---|
442 | grid%rdz,grid%rdzw,grid%dn, & |
---|
443 | grid%dnw,config_flags%mix_isotropic, & |
---|
444 | grid%hfx, grid%qfx, moist(ims,kms,jms,P_QV), & |
---|
445 | grid%ustm, rho, & |
---|
446 | ids, ide, jds, jde, kds, kde, & |
---|
447 | ims, ime, jms, jme, kms, kme, & |
---|
448 | grid%i_start(ij), grid%i_end(ij), & |
---|
449 | grid%j_start(ij), grid%j_end(ij), & |
---|
450 | k_start , k_end ) |
---|
451 | |
---|
452 | ENDDO |
---|
453 | !$OMP END PARALLEL DO |
---|
454 | BENCH_END(tke_rhs_tim) |
---|
455 | |
---|
456 | ENDIF |
---|
457 | |
---|
458 | ! calculate vertical diffusion first and then horizontal |
---|
459 | ! (keep this order) |
---|
460 | |
---|
461 | IF(config_flags%diff_opt .eq. 2) THEN |
---|
462 | |
---|
463 | IF (config_flags%bl_pbl_physics .eq. 0) THEN |
---|
464 | |
---|
465 | BENCH_START(vert_diff_tim) |
---|
466 | !$OMP PARALLEL DO & |
---|
467 | !$OMP PRIVATE ( ij ) |
---|
468 | DO ij = 1 , grid%num_tiles |
---|
469 | |
---|
470 | CALL wrf_debug ( 200 , ' call vertical_diffusion_2 ' ) |
---|
471 | CALL vertical_diffusion_2( ru_tendf, rv_tendf, rw_tendf, & |
---|
472 | t_tendf, tke_tend, & |
---|
473 | moist_tend, num_moist, & |
---|
474 | chem_tend, num_chem, & |
---|
475 | scalar_tend, num_scalar, & |
---|
476 | grid%u_2, grid%v_2, & |
---|
477 | grid%t_2,grid%u_base,grid%v_base,grid%t_base,grid%qv_base, & |
---|
478 | grid%mut,grid%tke_2,config_flags, & |
---|
479 | grid%defor13,grid%defor23,grid%defor33, & |
---|
480 | grid%div, moist, chem, scalar, & |
---|
481 | grid%xkmv, grid%xkhv, config_flags%km_opt, & |
---|
482 | grid%fnm, grid%fnp, grid%dn, grid%dnw, grid%rdz, grid%rdzw, & |
---|
483 | grid%hfx, grid%qfx, grid%ustm, rho, & |
---|
484 | ids, ide, jds, jde, kds, kde, & |
---|
485 | ims, ime, jms, jme, kms, kme, & |
---|
486 | grid%i_start(ij), grid%i_end(ij), & |
---|
487 | grid%j_start(ij), grid%j_end(ij), & |
---|
488 | k_start, k_end ) |
---|
489 | |
---|
490 | ENDDO |
---|
491 | !$OMP END PARALLEL DO |
---|
492 | BENCH_END(vert_diff_tim) |
---|
493 | |
---|
494 | ENDIF |
---|
495 | ! |
---|
496 | BENCH_START(hor_diff_tim) |
---|
497 | !$OMP PARALLEL DO & |
---|
498 | !$OMP PRIVATE ( ij ) |
---|
499 | DO ij = 1 , grid%num_tiles |
---|
500 | |
---|
501 | CALL wrf_debug ( 200 , ' call horizontal_diffusion_2' ) |
---|
502 | CALL horizontal_diffusion_2( t_tendf, ru_tendf, rv_tendf, rw_tendf, & |
---|
503 | tke_tend, & |
---|
504 | moist_tend, num_moist, & |
---|
505 | chem_tend, num_chem, & |
---|
506 | scalar_tend, num_scalar, & |
---|
507 | grid%t_2, th_phy, & |
---|
508 | grid%mut, grid%tke_2, config_flags, & |
---|
509 | grid%defor11, grid%defor22, grid%defor12, & |
---|
510 | grid%defor13, grid%defor23, grid%div, & |
---|
511 | moist, chem, scalar, & |
---|
512 | grid%msfux,grid%msfuy, grid%msfvx,grid%msfvy, grid%msftx, & |
---|
513 | grid%msfty, grid%xkmh, grid%xkhh, config_flags%km_opt, & |
---|
514 | grid%rdx, grid%rdy, grid%rdz, grid%rdzw, & |
---|
515 | grid%fnm, grid%fnp, grid%cf1, grid%cf2, grid%cf3, & |
---|
516 | grid%zx, grid%zy, grid%dn, grid%dnw, & |
---|
517 | ids, ide, jds, jde, kds, kde, & |
---|
518 | ims, ime, jms, jme, kms, kme, & |
---|
519 | grid%i_start(ij), grid%i_end(ij), & |
---|
520 | grid%j_start(ij), grid%j_end(ij), & |
---|
521 | k_start , k_end ) |
---|
522 | ENDDO |
---|
523 | !$OMP END PARALLEL DO |
---|
524 | BENCH_END(hor_diff_tim) |
---|
525 | ENDIF |
---|
526 | |
---|
527 | IF ( grid%obs_nudge_opt .EQ. 1 ) THEN |
---|
528 | # ifdef DM_PARALLEL |
---|
529 | # include "HALO_OBS_NUDGE.inc" |
---|
530 | #endif |
---|
531 | !*********************************************************************** |
---|
532 | ! This section for obs nudging |
---|
533 | !$OMP PARALLEL DO & |
---|
534 | !$OMP PRIVATE ( ij ) |
---|
535 | |
---|
536 | DO ij = 1 , grid%num_tiles |
---|
537 | |
---|
538 | CALL fddaobs_driver (grid%grid_id, model_config_rec%grid_id, & |
---|
539 | model_config_rec%parent_id, config_flags%restart, & |
---|
540 | grid%obs_nudge_opt, & |
---|
541 | grid%obs_ipf_errob, & |
---|
542 | grid%obs_ipf_nudob, & |
---|
543 | grid%fdda_start, & |
---|
544 | grid%fdda_end, & |
---|
545 | grid%obs_nudge_wind, & |
---|
546 | grid%obs_nudge_temp, & |
---|
547 | grid%obs_nudge_mois, & |
---|
548 | grid%obs_nudge_pstr, & |
---|
549 | grid%obs_coef_wind, & |
---|
550 | grid%obs_coef_temp, & |
---|
551 | grid%obs_coef_mois, & |
---|
552 | grid%obs_coef_pstr, & |
---|
553 | grid%obs_rinxy, & |
---|
554 | grid%obs_rinsig, & |
---|
555 | grid%obs_npfi, & |
---|
556 | grid%obs_ionf, & |
---|
557 | grid%obs_nobs_prt, & |
---|
558 | grid%obs_idynin, & |
---|
559 | grid%obs_dtramp, & |
---|
560 | model_config_rec%cen_lat(1), & |
---|
561 | model_config_rec%cen_lon(1), & |
---|
562 | config_flags%truelat1, & |
---|
563 | config_flags%truelat2, & |
---|
564 | config_flags%map_proj, & |
---|
565 | model_config_rec%i_parent_start, & |
---|
566 | model_config_rec%j_parent_start, & |
---|
567 | grid%parent_grid_ratio, & |
---|
568 | grid%max_dom, grid%itimestep, & |
---|
569 | grid%dt, grid%gmt, grid%julday, grid%fdob, & |
---|
570 | grid%max_obs, & |
---|
571 | model_config_rec%nobs_ndg_vars, & |
---|
572 | model_config_rec%nobs_err_flds, & |
---|
573 | grid%fdob%nstat, grid%fdob%varobs, grid%fdob%errf, & |
---|
574 | grid%dx, grid%KPBL,grid%HT, & |
---|
575 | grid%mut, grid%muu, grid%muv, & |
---|
576 | grid%msftx, grid%msfty, grid%msfux, grid%msfuy, grid%msfvx, grid%msfvy, & |
---|
577 | p_phy, t_tendf, t0, & |
---|
578 | grid%u_2, grid%v_2, grid%t_2, & |
---|
579 | moist(ims,kms,jms,P_QV), & |
---|
580 | grid%pb, grid%p_top, grid%p, & |
---|
581 | grid%uratx, grid%vratx, grid%tratx, & |
---|
582 | ru_tendf, rv_tendf, & |
---|
583 | moist_tend(ims,kms,jms,P_QV), grid%obs_savwt, & |
---|
584 | ids,ide, jds,jde, kds,kde, & |
---|
585 | ims,ime, jms,jme, kms,kme, & |
---|
586 | grid%i_start(ij), min(grid%i_end(ij),ide-1), & |
---|
587 | grid%j_start(ij), min(grid%j_end(ij),jde-1), & |
---|
588 | k_start , min(k_end,kde-1) ) |
---|
589 | |
---|
590 | ENDDO |
---|
591 | !$OMP END PARALLEL DO |
---|
592 | ENDIF ! obs_nudge_opt .eq. 1 |
---|
593 | ! |
---|
594 | !*********************************************************************** |
---|
595 | |
---|
596 | END SUBROUTINE first_rk_step_part2 |
---|
597 | |
---|
598 | END MODULE module_first_rk_step_part2 |
---|
599 | |
---|