1 !WRF:MODEL_LAYER: PHYSICS
3 ! note: this module really belongs in the dyn_em directory since it is
4 ! specific only to the EM core. Leaving here for now, with an
5 ! #if ( EM_CORE == 1 ) directive. JM 20031201
8 ! This MODULE holds the routines which are used to perform updates of the
9 ! model C-grid tendencies with physics A-grid tendencies
10 ! The module consolidates code that was (up to v1.2) duplicated in
11 ! module_em and module_rk and in
12 ! module_big_step_utilities.F and module_big_step_utilities_em.F
14 ! This MODULE CONTAINS the following routines:
15 ! update_phy_ten, phy_ra_ten, phy_bl_ten, phy_cu_ten, advance_ppt,
16 ! add_a2a, add_a2c_u, and add_a2c_v
19 MODULE module_physics_addtendc
23 USE module_state_description
28 SUBROUTINE update_phy_ten(rph_tendf,rt_tendf,ru_tendf,rv_tendf,moist_tendf, &
29 scalar_tendf,mu_tendf, &
30 RTHRATEN,RTHBLTEN,RTHCUTEN,RTHSHTEN, &
31 RUBLTEN,RUCUTEN,RUSHTEN, &
32 RVBLTEN,RVCUTEN,RVSHTEN, &
33 RQVBLTEN,RQCBLTEN,RQIBLTEN,RQNIBLTEN,&!RQNCBLTEN, & !JOE
34 RQVCUTEN,RQCCUTEN,RQRCUTEN,RQICUTEN,RQSCUTEN, &
35 RQCNCUTEN,RQINCUTEN, &
36 RQVSHTEN,RQCSHTEN,RQRSHTEN,RQISHTEN,RQSSHTEN,RQGSHTEN,&
37 RQCNSHTEN,RQINSHTEN, &
38 RUNDGDTEN,RVNDGDTEN,RTHNDGDTEN,RPHNDGDTEN, &
39 RQVNDGDTEN,RMUNDGDTEN, &
40 rthfrten,rqvfrten, & !fire
41 n_moist,n_scalar,config_flags,rk_step,adv_moist_cond, &
42 ids, ide, jds, jde, kds, kde, &
43 ims, ime, jms, jme, kms, kme, &
44 its, ite, jts, jte, kts, kte )
45 !-------------------------------------------------------------------
47 !-------------------------------------------------------------------
49 TYPE(grid_config_rec_type ) , INTENT(IN ) :: config_flags
51 INTEGER , INTENT(IN) :: ids, ide, jds, jde, kds, kde, &
52 ims, ime, jms, jme, kms, kme, &
53 its, ite, jts, jte, kts, kte, &
54 n_moist,n_scalar,rk_step
56 LOGICAL , INTENT(IN) :: adv_moist_cond
58 REAL , DIMENSION(ims:ime , kms:kme, jms:jme),INTENT(INOUT) :: &
64 REAL , DIMENSION(ims:ime , jms:jme),INTENT(INOUT) :: mu_tendf
66 REAL , DIMENSION(ims:ime, kms:kme, jms:jme, n_moist), &
67 INTENT(INOUT) :: moist_tendf
69 REAL , DIMENSION(ims:ime, kms:kme, jms:jme, n_scalar), &
70 INTENT(INOUT) :: scalar_tendf
72 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(IN ) :: &
86 RQNIBLTEN, & !For CAMUWPBL
108 REAL, DIMENSION(ims:ime, jms:jme), INTENT(IN ) :: RMUNDGDTEN
110 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(IN ) :: & ! fire
113 !------------------------------------------------------------------
114 ! set up loop bounds for this grid's boundary conditions
116 if (config_flags%ra_lw_physics .gt. 0 .or. &
117 config_flags%ra_sw_physics .gt. 0) &
118 CALL phy_ra_ten(config_flags,rt_tendf,RTHRATEN, &
119 ids, ide, jds, jde, kds, kde, &
120 ims, ime, jms, jme, kms, kme, &
121 its, ite, jts, jte, kts, kte )
123 if (config_flags%bl_pbl_physics .gt. 0) &
124 CALL phy_bl_ten(config_flags,rk_step,n_moist,n_scalar, &
125 rt_tendf,ru_tendf,rv_tendf,moist_tendf, &
126 scalar_tendf,adv_moist_cond, &
127 RTHBLTEN,RUBLTEN,RVBLTEN, &
128 RQVBLTEN,RQCBLTEN,RQIBLTEN, &
129 RQNIBLTEN, &! For CAMUWPBL
130 ids, ide, jds, jde, kds, kde, &
131 ims, ime, jms, jme, kms, kme, &
132 its, ite, jts, jte, kts, kte )
134 if (config_flags%cu_physics .gt. 0) &
135 CALL phy_cu_ten(config_flags,rk_step,n_moist,n_scalar, &
136 rt_tendf,ru_tendf,rv_tendf, &
137 RUCUTEN,RVCUTEN,RTHCUTEN, &
138 RQVCUTEN,RQCCUTEN,RQRCUTEN, &
139 RQICUTEN,RQSCUTEN,RQCNCUTEN,RQINCUTEN, &
141 scalar_tendf,adv_moist_cond, &
142 ids, ide, jds, jde, kds, kde, &
143 ims, ime, jms, jme, kms, kme, &
144 its, ite, jts, jte, kts, kte )
146 if (config_flags%shcu_physics .gt. 0) &
147 CALL phy_shcu_ten(config_flags,rk_step,n_moist,n_scalar, &
148 rt_tendf,ru_tendf,rv_tendf, &
149 RUSHTEN,RVSHTEN,RTHSHTEN, &
150 RQVSHTEN,RQCSHTEN,RQRSHTEN, &
151 RQISHTEN,RQSSHTEN,RQGSHTEN,RQCNSHTEN, &
152 RQINSHTEN,moist_tendf,scalar_tendf, &
153 ids, ide, jds, jde, kds, kde, &
154 ims, ime, jms, jme, kms, kme, &
155 its, ite, jts, jte, kts, kte )
157 if (config_flags%grid_fdda .gt. 0) &
158 CALL phy_fg_ten(config_flags,rk_step,n_moist, &
159 rph_tendf,rt_tendf,ru_tendf,rv_tendf, &
160 mu_tendf, moist_tendf, &
161 RUNDGDTEN,RVNDGDTEN,RTHNDGDTEN, &
162 RPHNDGDTEN,RQVNDGDTEN,RMUNDGDTEN, &
163 ids, ide, jds, jde, kds, kde, &
164 ims, ime, jms, jme, kms, kme, &
165 its, ite, jts, jte, kts, kte )
167 if (config_flags%ifire .gt. 0) & ! fire
168 CALL phy_fr_ten(config_flags,rk_step,n_moist, &
169 rt_tendf,ru_tendf,rv_tendf, &
170 mu_tendf, moist_tendf, &
172 ids, ide, jds, jde, kds, kde, &
173 ims, ime, jms, jme, kms, kme, &
174 its, ite, jts, jte, kts, kte )
176 END SUBROUTINE update_phy_ten
178 !=================================================================
179 SUBROUTINE phy_ra_ten(config_flags,rt_tendf,RTHRATEN, &
180 ids, ide, jds, jde, kds, kde, &
181 ims, ime, jms, jme, kms, kme, &
182 its, ite, jts, jte, kts, kte )
183 !-----------------------------------------------------------------
185 !-----------------------------------------------------------------
186 TYPE(grid_config_rec_type ) , INTENT(IN ) :: config_flags
188 INTEGER , INTENT(IN) :: ids, ide, jds, jde, kds, kde, &
189 ims, ime, jms, jme, kms, kme, &
190 its, ite, jts, jte, kts, kte
192 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(IN ) :: &
195 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(INOUT) :: &
202 CALL add_a2a(rt_tendf,RTHRATEN,config_flags, &
203 ids,ide, jds, jde, kds, kde, &
204 ims, ime, jms, jme, kms, kme, &
205 its, ite, jts, jte, kts, kte )
207 END SUBROUTINE phy_ra_ten
209 !=================================================================
210 SUBROUTINE phy_bl_ten(config_flags,rk_step,n_moist,n_scalar, &
211 rt_tendf,ru_tendf,rv_tendf,moist_tendf, &
212 scalar_tendf,adv_moist_cond, &
213 RTHBLTEN,RUBLTEN,RVBLTEN, &
214 RQVBLTEN,RQCBLTEN,RQIBLTEN,RQNIBLTEN, &
215 ids, ide, jds, jde, kds, kde, &
216 ims, ime, jms, jme, kms, kme, &
217 its, ite, jts, jte, kts, kte )
218 !-----------------------------------------------------------------
220 !-----------------------------------------------------------------
221 TYPE(grid_config_rec_type) , INTENT(IN ) :: config_flags
223 INTEGER , INTENT(IN) :: ids, ide, jds, jde, kds, kde, &
224 ims, ime, jms, jme, kms, kme, &
225 its, ite, jts, jte, kts, kte, &
226 n_moist, n_scalar, rk_step
228 LOGICAL , INTENT(IN) :: adv_moist_cond
230 REAL , DIMENSION(ims:ime, kms:kme, jms:jme, n_moist), &
231 INTENT(INOUT) :: moist_tendf
233 REAL , DIMENSION(ims:ime, kms:kme, jms:jme, n_scalar), &
234 INTENT(INOUT) :: scalar_tendf
236 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(IN ) :: &
245 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(INOUT):: &
251 INTEGER :: i,j,k,IBGN,IEND,JBGN,JEND
253 !-----------------------------------------------------------------
255 SELECT CASE(config_flags%bl_pbl_physics)
259 CALL add_a2a(rt_tendf,RTHBLTEN,config_flags, &
260 ids,ide, jds, jde, kds, kde, &
261 ims, ime, jms, jme, kms, kme, &
262 its, ite, jts, jte, kts, kte )
264 CALL add_a2c_u(ru_tendf,RUBLTEN,config_flags, &
265 ids,ide, jds, jde, kds, kde, &
266 ims, ime, jms, jme, kms, kme, &
267 its, ite, jts, jte, kts, kte )
269 CALL add_a2c_v(rv_tendf,RVBLTEN,config_flags, &
270 ids,ide, jds, jde, kds, kde, &
271 ims, ime, jms, jme, kms, kme, &
272 its, ite, jts, jte, kts, kte )
274 if (P_QV .ge. PARAM_FIRST_SCALAR) &
275 CALL add_a2a(moist_tendf(ims,kms,jms,P_QV),RQVBLTEN, &
277 ids,ide, jds, jde, kds, kde, &
278 ims, ime, jms, jme, kms, kme, &
279 its, ite, jts, jte, kts, kte )
281 if (P_QC .ge. PARAM_FIRST_SCALAR) &
282 CALL add_a2a(moist_tendf(ims,kms,jms,P_QC),RQCBLTEN, &
284 ids,ide, jds, jde, kds, kde, &
285 ims, ime, jms, jme, kms, kme, &
286 its, ite, jts, jte, kts, kte )
288 if (P_QI .ge. PARAM_FIRST_SCALAR) &
289 CALL add_a2a(moist_tendf(ims,kms,jms,P_QI),RQIBLTEN, &
291 ids,ide, jds, jde, kds, kde, &
292 ims, ime, jms, jme, kms, kme, &
293 its, ite, jts, jte, kts, kte )
295 IF(.not. adv_moist_cond)THEN
297 if (P_QT .ge. PARAM_FIRST_SCALAR) &
298 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQCBLTEN, &
300 ids,ide, jds, jde, kds, kde, &
301 ims, ime, jms, jme, kms, kme, &
302 its, ite, jts, jte, kts, kte )
304 if (P_QT .ge. PARAM_FIRST_SCALAR) &
305 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQIBLTEN, &
307 ids,ide, jds, jde, kds, kde, &
308 ims, ime, jms, jme, kms, kme, &
309 its, ite, jts, jte, kts, kte )
312 CASE (SHINHONGSCHEME)
314 CALL add_a2a(rt_tendf,RTHBLTEN,config_flags, &
315 ids,ide, jds, jde, kds, kde, &
316 ims, ime, jms, jme, kms, kme, &
317 its, ite, jts, jte, kts, kte )
319 CALL add_a2c_u(ru_tendf,RUBLTEN,config_flags, &
320 ids,ide, jds, jde, kds, kde, &
321 ims, ime, jms, jme, kms, kme, &
322 its, ite, jts, jte, kts, kte )
324 CALL add_a2c_v(rv_tendf,RVBLTEN,config_flags, &
325 ids,ide, jds, jde, kds, kde, &
326 ims, ime, jms, jme, kms, kme, &
327 its, ite, jts, jte, kts, kte )
329 if (P_QV .ge. PARAM_FIRST_SCALAR) &
330 CALL add_a2a(moist_tendf(ims,kms,jms,P_QV),RQVBLTEN, &
332 ids,ide, jds, jde, kds, kde, &
333 ims, ime, jms, jme, kms, kme, &
334 its, ite, jts, jte, kts, kte )
336 if (P_QC .ge. PARAM_FIRST_SCALAR) &
337 CALL add_a2a(moist_tendf(ims,kms,jms,P_QC),RQCBLTEN, &
339 ids,ide, jds, jde, kds, kde, &
340 ims, ime, jms, jme, kms, kme, &
341 its, ite, jts, jte, kts, kte )
343 if (P_QI .ge. PARAM_FIRST_SCALAR) &
344 CALL add_a2a(moist_tendf(ims,kms,jms,P_QI),RQIBLTEN, &
346 ids,ide, jds, jde, kds, kde, &
347 ims, ime, jms, jme, kms, kme, &
348 its, ite, jts, jte, kts, kte )
350 IF(.not. adv_moist_cond)THEN
352 if (P_QT .ge. PARAM_FIRST_SCALAR) &
353 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQCBLTEN, &
355 ids,ide, jds, jde, kds, kde, &
356 ims, ime, jms, jme, kms, kme, &
357 its, ite, jts, jte, kts, kte )
359 if (P_QT .ge. PARAM_FIRST_SCALAR) &
360 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQIBLTEN, &
362 ids,ide, jds, jde, kds, kde, &
363 ims, ime, jms, jme, kms, kme, &
364 its, ite, jts, jte, kts, kte )
369 CALL add_a2a(rt_tendf,RTHBLTEN,config_flags, &
370 ids,ide, jds, jde, kds, kde, &
371 ims, ime, jms, jme, kms, kme, &
372 its, ite, jts, jte, kts, kte )
374 CALL add_a2c_u(ru_tendf,RUBLTEN,config_flags, &
375 ids,ide, jds, jde, kds, kde, &
376 ims, ime, jms, jme, kms, kme, &
377 its, ite, jts, jte, kts, kte )
379 CALL add_a2c_v(rv_tendf,RVBLTEN,config_flags, &
380 ids,ide, jds, jde, kds, kde, &
381 ims, ime, jms, jme, kms, kme, &
382 its, ite, jts, jte, kts, kte )
384 if (P_QV .ge. PARAM_FIRST_SCALAR) &
385 CALL add_a2a(moist_tendf(ims,kms,jms,P_QV),RQVBLTEN, &
387 ids,ide, jds, jde, kds, kde, &
388 ims, ime, jms, jme, kms, kme, &
389 its, ite, jts, jte, kts, kte )
391 if (P_QC .ge. PARAM_FIRST_SCALAR) &
392 CALL add_a2a(moist_tendf(ims,kms,jms,P_QC),RQCBLTEN, &
394 ids,ide, jds, jde, kds, kde, &
395 ims, ime, jms, jme, kms, kme, &
396 its, ite, jts, jte, kts, kte )
398 if (P_QI .ge. PARAM_FIRST_SCALAR) &
399 CALL add_a2a(moist_tendf(ims,kms,jms,P_QI),RQIBLTEN, &
401 ids,ide, jds, jde, kds, kde, &
402 ims, ime, jms, jme, kms, kme, &
403 its, ite, jts, jte, kts, kte )
405 IF(.not. adv_moist_cond)THEN
407 if (P_QT .ge. PARAM_FIRST_SCALAR) &
408 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQCBLTEN, &
410 ids,ide, jds, jde, kds, kde, &
411 ims, ime, jms, jme, kms, kme, &
412 its, ite, jts, jte, kts, kte )
414 if (P_QT .ge. PARAM_FIRST_SCALAR) &
415 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQIBLTEN, &
417 ids,ide, jds, jde, kds, kde, &
418 ims, ime, jms, jme, kms, kme, &
419 its, ite, jts, jte, kts, kte )
424 CALL add_a2a(rt_tendf,RTHBLTEN,config_flags, &
425 ids,ide, jds, jde, kds, kde, &
426 ims, ime, jms, jme, kms, kme, &
427 its, ite, jts, jte, kts, kte )
429 CALL add_a2c_u(ru_tendf,RUBLTEN,config_flags, &
430 ids,ide, jds, jde, kds, kde, &
431 ims, ime, jms, jme, kms, kme, &
432 its, ite, jts, jte, kts, kte )
434 CALL add_a2c_v(rv_tendf,RVBLTEN,config_flags, &
435 ids,ide, jds, jde, kds, kde, &
436 ims, ime, jms, jme, kms, kme, &
437 its, ite, jts, jte, kts, kte )
439 if (P_QV .ge. PARAM_FIRST_SCALAR) &
440 CALL add_a2a(moist_tendf(ims,kms,jms,P_QV),RQVBLTEN, &
442 ids,ide, jds, jde, kds, kde, &
443 ims, ime, jms, jme, kms, kme, &
444 its, ite, jts, jte, kts, kte )
446 if (P_QC .ge. PARAM_FIRST_SCALAR) &
447 CALL add_a2a(moist_tendf(ims,kms,jms,P_QC),RQCBLTEN, &
449 ids,ide, jds, jde, kds, kde, &
450 ims, ime, jms, jme, kms, kme, &
451 its, ite, jts, jte, kts, kte )
453 if (P_QI .ge. PARAM_FIRST_SCALAR) &
454 CALL add_a2a(moist_tendf(ims,kms,jms,P_QI),RQIBLTEN, &
456 ids,ide, jds, jde, kds, kde, &
457 ims, ime, jms, jme, kms, kme, &
458 its, ite, jts, jte, kts, kte )
460 IF(.not. adv_moist_cond)THEN
462 if (P_QT .ge. PARAM_FIRST_SCALAR)THEN
463 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQCBLTEN, &
465 ids,ide, jds, jde, kds, kde, &
466 ims, ime, jms, jme, kms, kme, &
467 its, ite, jts, jte, kts, kte )
469 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQIBLTEN, &
471 ids,ide, jds, jde, kds, kde, &
472 ims, ime, jms, jme, kms, kme, &
473 its, ite, jts, jte, kts, kte )
480 CALL add_a2a(rt_tendf,RTHBLTEN,config_flags, &
481 ids,ide, jds, jde, kds, kde, &
482 ims, ime, jms, jme, kms, kme, &
483 its, ite, jts, jte, kts, kte )
485 CALL add_a2c_u(ru_tendf,RUBLTEN,config_flags, &
486 ids,ide, jds, jde, kds, kde, &
487 ims, ime, jms, jme, kms, kme, &
488 its, ite, jts, jte, kts, kte )
490 CALL add_a2c_v(rv_tendf,RVBLTEN,config_flags, &
491 ids,ide, jds, jde, kds, kde, &
492 ims, ime, jms, jme, kms, kme, &
493 its, ite, jts, jte, kts, kte )
495 if (P_QV .ge. PARAM_FIRST_SCALAR) &
496 CALL add_a2a(moist_tendf(ims,kms,jms,P_QV),RQVBLTEN, &
498 ids,ide, jds, jde, kds, kde, &
499 ims, ime, jms, jme, kms, kme, &
500 its, ite, jts, jte, kts, kte )
502 IF(.not. adv_moist_cond)THEN
504 if (P_QT .ge. PARAM_FIRST_SCALAR) &
505 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQCBLTEN, &
507 ids,ide, jds, jde, kds, kde, &
508 ims, ime, jms, jme, kms, kme, &
509 its, ite, jts, jte, kts, kte )
511 if (P_QT .ge. PARAM_FIRST_SCALAR) &
512 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQIBLTEN, &
514 ids,ide, jds, jde, kds, kde, &
515 ims, ime, jms, jme, kms, kme, &
516 its, ite, jts, jte, kts, kte )
518 ! if (P_QT .ge. PARAM_FIRST_SCALAR) &
519 ! CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQSBLTEN, &
521 ! ids,ide, jds, jde, kds, kde, &
522 ! ims, ime, jms, jme, kms, kme, &
523 ! its, ite, jts, jte, kts, kte )
525 ! if (P_QT .ge. PARAM_FIRST_SCALAR) &
526 ! CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQRBLTEN, &
528 ! ids,ide, jds, jde, kds, kde, &
529 ! ims, ime, jms, jme, kms, kme, &
530 ! its, ite, jts, jte, kts, kte )
532 ! if (P_QT .ge. PARAM_FIRST_SCALAR) &
533 ! CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQGBLTEN, &
535 ! ids,ide, jds, jde, kds, kde, &
536 ! ims, ime, jms, jme, kms, kme, &
537 ! its, ite, jts, jte, kts, kte )
541 if (P_QC .ge. PARAM_FIRST_SCALAR) &
542 CALL add_a2a(moist_tendf(ims,kms,jms,P_QC),RQCBLTEN, &
544 ids,ide, jds, jde, kds, kde, &
545 ims, ime, jms, jme, kms, kme, &
546 its, ite, jts, jte, kts, kte )
548 if (P_QI .ge. PARAM_FIRST_SCALAR) &
549 CALL add_a2a(moist_tendf(ims,kms,jms,P_QI),RQIBLTEN, &
551 ids,ide, jds, jde, kds, kde, &
552 ims, ime, jms, jme, kms, kme, &
553 its, ite, jts, jte, kts, kte )
555 ! if (P_QS .ge. PARAM_FIRST_SCALAR) &
556 ! CALL add_a2a(moist_tendf(ims,kms,jms,P_QS),RQSBLTEN, &
558 ! ids,ide, jds, jde, kds, kde, &
559 ! ims, ime, jms, jme, kms, kme, &
560 ! its, ite, jts, jte, kts, kte )
562 ! if (P_QR .ge. PARAM_FIRST_SCALAR) &
563 ! CALL add_a2a(moist_tendf(ims,kms,jms,P_QR),RQRBLTEN, &
565 ! ids,ide, jds, jde, kds, kde, &
566 ! ims, ime, jms, jme, kms, kme, &
567 ! its, ite, jts, jte, kts, kte )
569 ! if (P_QG .ge. PARAM_FIRST_SCALAR) &
570 ! CALL add_a2a(moist_tendf(ims,kms,jms,P_QG),RQGBLTEN, &
572 ! ids,ide, jds, jde, kds, kde, &
573 ! ims, ime, jms, jme, kms, kme, &
574 ! its, ite, jts, jte, kts, kte )
580 CALL add_a2a(rt_tendf,RTHBLTEN,config_flags, &
581 ids,ide, jds, jde, kds, kde, &
582 ims, ime, jms, jme, kms, kme, &
583 its, ite, jts, jte, kts, kte )
585 CALL add_a2c_u(ru_tendf,RUBLTEN,config_flags, &
586 ids,ide, jds, jde, kds, kde, &
587 ims, ime, jms, jme, kms, kme, &
588 its, ite, jts, jte, kts, kte )
590 CALL add_a2c_v(rv_tendf,RVBLTEN,config_flags, &
591 ids,ide, jds, jde, kds, kde, &
592 ims, ime, jms, jme, kms, kme, &
593 its, ite, jts, jte, kts, kte )
595 if (P_QV .ge. PARAM_FIRST_SCALAR) &
596 CALL add_a2a(moist_tendf(ims,kms,jms,P_QV),RQVBLTEN, &
598 ids,ide, jds, jde, kds, kde, &
599 ims, ime, jms, jme, kms, kme, &
600 its, ite, jts, jte, kts, kte )
602 IF(.not. adv_moist_cond)THEN
604 if (P_QT .ge. PARAM_FIRST_SCALAR) &
605 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQCBLTEN, &
607 ids,ide, jds, jde, kds, kde, &
608 ims, ime, jms, jme, kms, kme, &
609 its, ite, jts, jte, kts, kte )
613 if (P_QC .ge. PARAM_FIRST_SCALAR) &
614 CALL add_a2a(moist_tendf(ims,kms,jms,P_QC),RQCBLTEN, &
616 ids,ide, jds, jde, kds, kde, &
617 ims, ime, jms, jme, kms, kme, &
618 its, ite, jts, jte, kts, kte )
624 CALL add_a2a(rt_tendf,RTHBLTEN,config_flags, &
625 ids,ide, jds, jde, kds, kde, &
626 ims, ime, jms, jme, kms, kme, &
627 its, ite, jts, jte, kts, kte )
629 CALL add_a2c_u(ru_tendf,RUBLTEN,config_flags, &
630 ids,ide, jds, jde, kds, kde, &
631 ims, ime, jms, jme, kms, kme, &
632 its, ite, jts, jte, kts, kte )
634 CALL add_a2c_v(rv_tendf,RVBLTEN,config_flags, &
635 ids,ide, jds, jde, kds, kde, &
636 ims, ime, jms, jme, kms, kme, &
637 its, ite, jts, jte, kts, kte )
639 if (P_QV .ge. PARAM_FIRST_SCALAR) &
640 CALL add_a2a(moist_tendf(ims,kms,jms,P_QV),RQVBLTEN, &
642 ids,ide, jds, jde, kds, kde, &
643 ims, ime, jms, jme, kms, kme, &
644 its, ite, jts, jte, kts, kte )
646 if (P_QC .ge. PARAM_FIRST_SCALAR) &
647 CALL add_a2a(moist_tendf(ims,kms,jms,P_QC),RQCBLTEN, &
649 ids,ide, jds, jde, kds, kde, &
650 ims, ime, jms, jme, kms, kme, &
651 its, ite, jts, jte, kts, kte )
653 if (P_QI .ge. PARAM_FIRST_SCALAR) &
654 CALL add_a2a(moist_tendf(ims,kms,jms,P_QI),RQIBLTEN, &
656 ids,ide, jds, jde, kds, kde, &
657 ims, ime, jms, jme, kms, kme, &
658 its, ite, jts, jte, kts, kte )
660 IF(.not. adv_moist_cond)THEN
662 if (P_QT .ge. PARAM_FIRST_SCALAR) &
663 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQCBLTEN, &
665 ids,ide, jds, jde, kds, kde, &
666 ims, ime, jms, jme, kms, kme, &
667 its, ite, jts, jte, kts, kte )
669 if (P_QT .ge. PARAM_FIRST_SCALAR) &
670 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQIBLTEN, &
672 ids,ide, jds, jde, kds, kde, &
673 ims, ime, jms, jme, kms, kme, &
674 its, ite, jts, jte, kts, kte )
677 CASE (MYNNPBLSCHEME2,MYNNPBLSCHEME3)
679 CALL add_a2a(rt_tendf,RTHBLTEN,config_flags, &
680 ids,ide, jds, jde, kds, kde, &
681 ims, ime, jms, jme, kms, kme, &
682 its, ite, jts, jte, kts, kte )
684 CALL add_a2c_u(ru_tendf,RUBLTEN,config_flags, &
685 ids,ide, jds, jde, kds, kde, &
686 ims, ime, jms, jme, kms, kme, &
687 its, ite, jts, jte, kts, kte )
689 CALL add_a2c_v(rv_tendf,RVBLTEN,config_flags, &
690 ids,ide, jds, jde, kds, kde, &
691 ims, ime, jms, jme, kms, kme, &
692 its, ite, jts, jte, kts, kte )
694 if (P_QV .ge. PARAM_FIRST_SCALAR) &
695 CALL add_a2a(moist_tendf(ims,kms,jms,P_QV),RQVBLTEN, &
697 ids,ide, jds, jde, kds, kde, &
698 ims, ime, jms, jme, kms, kme, &
699 its, ite, jts, jte, kts, kte )
701 IF(.not. adv_moist_cond)THEN
703 if (P_QT .ge. PARAM_FIRST_SCALAR) &
704 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQCBLTEN, &
706 ids,ide, jds, jde, kds, kde, &
707 ims, ime, jms, jme, kms, kme, &
708 its, ite, jts, jte, kts, kte )
710 if (P_QT .ge. PARAM_FIRST_SCALAR) &
711 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQIBLTEN, &
713 ids,ide, jds, jde, kds, kde, &
714 ims, ime, jms, jme, kms, kme, &
715 its, ite, jts, jte, kts, kte )
719 if (P_QC .ge. PARAM_FIRST_SCALAR) &
720 CALL add_a2a(moist_tendf(ims,kms,jms,P_QC),RQCBLTEN, &
722 ids,ide, jds, jde, kds, kde, &
723 ims, ime, jms, jme, kms, kme, &
724 its, ite, jts, jte, kts, kte )
726 if (P_QI .ge. PARAM_FIRST_SCALAR) &
727 CALL add_a2a(moist_tendf(ims,kms,jms,P_QI),RQIBLTEN, &
729 ids,ide, jds, jde, kds, kde, &
730 ims, ime, jms, jme, kms, kme, &
731 its, ite, jts, jte, kts, kte )
737 CALL add_a2a(rt_tendf,RTHBLTEN,config_flags, &
738 ids,ide, jds, jde, kds, kde, &
739 ims, ime, jms, jme, kms, kme, &
740 its, ite, jts, jte, kts, kte )
742 CALL add_a2c_u(ru_tendf,RUBLTEN,config_flags, &
743 ids,ide, jds, jde, kds, kde, &
744 ims, ime, jms, jme, kms, kme, &
745 its, ite, jts, jte, kts, kte )
747 CALL add_a2c_v(rv_tendf,RVBLTEN,config_flags, &
748 ids,ide, jds, jde, kds, kde, &
749 ims, ime, jms, jme, kms, kme, &
750 its, ite, jts, jte, kts, kte )
752 if (P_QV .ge. PARAM_FIRST_SCALAR)&
753 CALL add_a2a(moist_tendf(ims,kms,jms,P_QV),RQVBLTEN, &
755 ids,ide, jds, jde, kds, kde, &
756 ims, ime, jms, jme, kms, kme, &
757 its, ite, jts, jte, kts, kte )
759 if (P_QC .ge. PARAM_FIRST_SCALAR)&
760 CALL add_a2a(moist_tendf(ims,kms,jms,P_QC),RQCBLTEN, &
762 ids,ide, jds, jde, kds, kde, &
763 ims, ime, jms, jme, kms, kme, &
764 its, ite, jts, jte, kts, kte )
766 if (P_QI .ge. PARAM_FIRST_SCALAR)&
767 CALL add_a2a(moist_tendf(ims,kms,jms,P_QI),RQIBLTEN, &
769 ids,ide, jds, jde, kds, kde, &
770 ims, ime, jms, jme, kms, kme, &
771 its, ite, jts, jte, kts, kte )
772 IF(.not. adv_moist_cond)THEN
774 if (P_QT .ge. PARAM_FIRST_SCALAR)&
775 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQCBLTEN, &
777 ids,ide, jds, jde, kds, kde, &
778 ims, ime, jms, jme, kms, kme, &
779 its, ite, jts, jte, kts, kte )
781 if (P_QT .ge. PARAM_FIRST_SCALAR)&
782 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQIBLTEN, &
784 ids,ide, jds, jde, kds, kde, &
785 ims, ime, jms, jme, kms, kme, &
786 its, ite, jts, jte, kts, kte )
791 CALL add_a2a(rt_tendf,RTHBLTEN,config_flags, &
792 ids,ide, jds, jde, kds, kde, &
793 ims, ime, jms, jme, kms, kme, &
794 its, ite, jts, jte, kts, kte )
796 CALL add_a2c_u(ru_tendf,RUBLTEN,config_flags, &
797 ids,ide, jds, jde, kds, kde, &
798 ims, ime, jms, jme, kms, kme, &
799 its, ite, jts, jte, kts, kte )
801 CALL add_a2c_v(rv_tendf,RVBLTEN,config_flags, &
802 ids,ide, jds, jde, kds, kde, &
803 ims, ime, jms, jme, kms, kme, &
804 its, ite, jts, jte, kts, kte )
806 if (P_QV .ge. PARAM_FIRST_SCALAR) &
807 CALL add_a2a(moist_tendf(ims,kms,jms,P_QV),RQVBLTEN, &
809 ids,ide, jds, jde, kds, kde, &
810 ims, ime, jms, jme, kms, kme, &
811 its, ite, jts, jte, kts, kte )
813 IF(.not. adv_moist_cond)THEN
815 if (P_QT .ge. PARAM_FIRST_SCALAR) &
816 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQCBLTEN, &
818 ids,ide, jds, jde, kds, kde, &
819 ims, ime, jms, jme, kms, kme, &
820 its, ite, jts, jte, kts, kte )
824 if (P_QC .ge. PARAM_FIRST_SCALAR) &
825 CALL add_a2a(moist_tendf(ims,kms,jms,P_QC),RQCBLTEN, &
827 ids,ide, jds, jde, kds, kde, &
828 ims, ime, jms, jme, kms, kme, &
829 its, ite, jts, jte, kts, kte )
832 CASE (CAMUWPBLSCHEME)
833 CALL add_a2a(rt_tendf,RTHBLTEN,config_flags, &
834 ids,ide, jds, jde, kds, kde, &
835 ims, ime, jms, jme, kms, kme, &
836 its, ite, jts, jte, kts, kte )
838 CALL add_a2c_u(ru_tendf,RUBLTEN,config_flags, &
839 ids,ide, jds, jde, kds, kde, &
840 ims, ime, jms, jme, kms, kme, &
841 its, ite, jts, jte, kts, kte )
843 CALL add_a2c_v(rv_tendf,RVBLTEN,config_flags, &
844 ids,ide, jds, jde, kds, kde, &
845 ims, ime, jms, jme, kms, kme, &
846 its, ite, jts, jte, kts, kte )
848 if (P_QV .ge. PARAM_FIRST_SCALAR) &
849 CALL add_a2a(moist_tendf(ims,kms,jms,P_QV),RQVBLTEN, &
851 ids,ide, jds, jde, kds, kde, &
852 ims, ime, jms, jme, kms, kme, &
853 its, ite, jts, jte, kts, kte )
855 IF(.not. adv_moist_cond)THEN
857 if (P_QT .ge. PARAM_FIRST_SCALAR) &
858 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQCBLTEN, &
860 ids,ide, jds, jde, kds, kde, &
861 ims, ime, jms, jme, kms, kme, &
862 its, ite, jts, jte, kts, kte )
864 if (P_QT .ge. PARAM_FIRST_SCALAR) &
865 !Balwinder.Singh@pnnl.gov : Diffuse or mix cloud ice mass mixing ratio
866 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQIBLTEN, &
868 ids,ide, jds, jde, kds, kde, &
869 ims, ime, jms, jme, kms, kme, &
870 its, ite, jts, jte, kts, kte )
871 if (P_QT .ge. PARAM_FIRST_SCALAR) &
872 !Balwinder.Singh@pnnl.gov : Diffuse or mix cloud ice number mixing ratio
873 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQNIBLTEN,&
875 ids,ide, jds, jde, kds, kde, &
876 ims, ime, jms, jme, kms, kme, &
877 its, ite, jts, jte, kts, kte )
880 if (P_QC .ge. PARAM_FIRST_SCALAR) &
881 CALL add_a2a(moist_tendf(ims,kms,jms,P_QC),RQCBLTEN, &
883 ids,ide, jds, jde, kds, kde, &
884 ims, ime, jms, jme, kms, kme, &
885 its, ite, jts, jte, kts, kte )
886 if (P_QI .ge. PARAM_FIRST_SCALAR) &
887 !Balwinder.Singh@pnnl.gov : Diffuse or mix cloud ice mass mixing ratio
888 CALL add_a2a(moist_tendf(ims,kms,jms,P_QI),RQIBLTEN, &
890 ids,ide, jds, jde, kds, kde, &
891 ims, ime, jms, jme, kms, kme, &
892 its, ite, jts, jte, kts, kte )
893 if (P_QNI .ge. PARAM_FIRST_SCALAR) &
894 !Balwinder.Singh@pnnl.gov : Diffuse or mix cloud ice number mixing ratio
895 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QNI),RQNIBLTEN,&
897 ids,ide, jds, jde, kds, kde, &
898 ims, ime, jms, jme, kms, kme, &
899 its, ite, jts, jte, kts, kte )
904 CALL add_a2a(rt_tendf,RTHBLTEN,config_flags, &
905 ids,ide, jds, jde, kds, kde, &
906 ims, ime, jms, jme, kms, kme, &
907 its, ite, jts, jte, kts, kte )
909 CALL add_a2c_u(ru_tendf,RUBLTEN,config_flags, &
910 ids,ide, jds, jde, kds, kde, &
911 ims, ime, jms, jme, kms, kme, &
912 its, ite, jts, jte, kts, kte )
914 CALL add_a2c_v(rv_tendf,RVBLTEN,config_flags, &
915 ids,ide, jds, jde, kds, kde, &
916 ims, ime, jms, jme, kms, kme, &
917 its, ite, jts, jte, kts, kte )
919 if (P_QV .ge. PARAM_FIRST_SCALAR) &
920 CALL add_a2a(moist_tendf(ims,kms,jms,P_QV),RQVBLTEN, &
922 ids,ide, jds, jde, kds, kde, &
923 ims, ime, jms, jme, kms, kme, &
924 its, ite, jts, jte, kts, kte )
926 if (P_QC .ge. PARAM_FIRST_SCALAR) &
927 CALL add_a2a(moist_tendf(ims,kms,jms,P_QC),RQCBLTEN, &
929 ids,ide, jds, jde, kds, kde, &
930 ims, ime, jms, jme, kms, kme, &
931 its, ite, jts, jte, kts, kte )
933 if (P_QI .ge. PARAM_FIRST_SCALAR) &
934 CALL add_a2a(moist_tendf(ims,kms,jms,P_QI),RQIBLTEN, &
936 ids,ide, jds, jde, kds, kde, &
937 ims, ime, jms, jme, kms, kme, &
938 its, ite, jts, jte, kts, kte )
941 CALL add_a2a(rt_tendf,RTHBLTEN,config_flags, &
942 ids,ide, jds, jde, kds, kde, &
943 ims, ime, jms, jme, kms, kme, &
944 its, ite, jts, jte, kts, kte )
946 CALL add_a2c_u(ru_tendf,RUBLTEN,config_flags, &
947 ids,ide, jds, jde, kds, kde, &
948 ims, ime, jms, jme, kms, kme, &
949 its, ite, jts, jte, kts, kte )
951 CALL add_a2c_v(rv_tendf,RVBLTEN,config_flags, &
952 ids,ide, jds, jde, kds, kde, &
953 ims, ime, jms, jme, kms, kme, &
954 its, ite, jts, jte, kts, kte )
956 if (P_QV .ge. PARAM_FIRST_SCALAR) &
957 CALL add_a2a(moist_tendf(ims,kms,jms,P_QV),RQVBLTEN, &
959 ids,ide, jds, jde, kds, kde, &
960 ims, ime, jms, jme, kms, kme, &
961 its, ite, jts, jte, kts, kte )
963 if (P_QC .ge. PARAM_FIRST_SCALAR) &
964 CALL add_a2a(moist_tendf(ims,kms,jms,P_QC),RQCBLTEN, &
966 ids,ide, jds, jde, kds, kde, &
967 ims, ime, jms, jme, kms, kme, &
968 its, ite, jts, jte, kts, kte )
970 if (P_QI .ge. PARAM_FIRST_SCALAR) &
971 CALL add_a2a(moist_tendf(ims,kms,jms,P_QI),RQIBLTEN, &
973 ids,ide, jds, jde, kds, kde, &
974 ims, ime, jms, jme, kms, kme, &
975 its, ite, jts, jte, kts, kte )
978 ! this is for WRFPlus only
979 !---------------------------
980 CASE (SURFDRAGSCHEME)
982 CALL add_a2c_u(ru_tendf,RUBLTEN,config_flags, &
983 ids,ide, jds, jde, kds, kde, &
984 ims, ime, jms, jme, kms, kme, &
985 its, ite, jts, jte, kts, kte )
987 CALL add_a2c_v(rv_tendf,RVBLTEN,config_flags, &
988 ids,ide, jds, jde, kds, kde, &
989 ims, ime, jms, jme, kms, kme, &
990 its, ite, jts, jte, kts, kte )
995 print*,'phy_bl_ten: The pbl scheme does not exist'
999 END SUBROUTINE phy_bl_ten
1001 !=================================================================
1002 SUBROUTINE phy_cu_ten(config_flags,rk_step,n_moist,n_scalar, &
1003 rt_tendf,ru_tendf,rv_tendf, &
1004 RUCUTEN,RVCUTEN,RTHCUTEN, &
1005 RQVCUTEN,RQCCUTEN,RQRCUTEN, &
1006 RQICUTEN,RQSCUTEN,RQCNCUTEN,RQINCUTEN, &
1008 scalar_tendf,adv_moist_cond, &
1009 ids, ide, jds, jde, kds, kde, &
1010 ims, ime, jms, jme, kms, kme, &
1011 its, ite, jts, jte, kts, kte )
1012 !-----------------------------------------------------------------
1014 !-----------------------------------------------------------------
1015 TYPE(grid_config_rec_type ) , INTENT(IN ) :: config_flags
1017 INTEGER , INTENT(IN) :: ids, ide, jds, jde, kds, kde, &
1018 ims, ime, jms, jme, kms, kme, &
1019 its, ite, jts, jte, kts, kte, &
1020 n_moist, n_scalar, rk_step
1022 LOGICAL , INTENT(IN) :: adv_moist_cond
1024 REAL , DIMENSION(ims:ime, kms:kme, jms:jme, n_moist), &
1025 INTENT(INOUT) :: moist_tendf
1027 REAL , DIMENSION(ims:ime, kms:kme, jms:jme, n_scalar), &
1028 INTENT(INOUT) :: scalar_tendf
1030 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(IN ) :: &
1042 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(INOUT) :: &
1052 SELECT CASE (config_flags%cu_physics)
1055 CALL add_a2a(rt_tendf,RTHCUTEN,config_flags, &
1056 ids,ide, jds, jde, kds, kde, &
1057 ims, ime, jms, jme, kms, kme, &
1058 its, ite, jts, jte, kts, kte )
1060 if (P_QV .ge. PARAM_FIRST_SCALAR) &
1061 CALL add_a2a(moist_tendf(ims,kms,jms,P_QV),RQVCUTEN, &
1063 ids,ide, jds, jde, kds, kde, &
1064 ims, ime, jms, jme, kms, kme, &
1065 its, ite, jts, jte, kts, kte )
1067 if (P_QC .ge. PARAM_FIRST_SCALAR) &
1068 CALL add_a2a(moist_tendf(ims,kms,jms,P_QC),RQCCUTEN, &
1070 ids,ide, jds, jde, kds, kde, &
1071 ims, ime, jms, jme, kms, kme, &
1072 its, ite, jts, jte, kts, kte )
1074 if (P_QR .ge. PARAM_FIRST_SCALAR) &
1075 CALL add_a2a(moist_tendf(ims,kms,jms,P_QR),RQRCUTEN, &
1077 ids,ide, jds, jde, kds, kde, &
1078 ims, ime, jms, jme, kms, kme, &
1079 its, ite, jts, jte, kts, kte )
1081 if (P_QI .ge. PARAM_FIRST_SCALAR) &
1082 CALL add_a2a(moist_tendf(ims,kms,jms,P_QI),RQICUTEN, &
1084 ids,ide, jds, jde, kds, kde, &
1085 ims, ime, jms, jme, kms, kme, &
1086 its, ite, jts, jte, kts, kte )
1088 if (P_QS .ge. PARAM_FIRST_SCALAR) &
1089 CALL add_a2a(moist_tendf(ims,kms,jms,P_QS),RQSCUTEN, &
1091 ids,ide, jds, jde, kds, kde, &
1092 ims, ime, jms, jme, kms, kme, &
1093 its, ite, jts, jte, kts, kte )
1095 IF(.not. adv_moist_cond)THEN
1097 if (P_QT .ge. PARAM_FIRST_SCALAR) &
1098 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQCCUTEN, &
1100 ids,ide, jds, jde, kds, kde, &
1101 ims, ime, jms, jme, kms, kme, &
1102 its, ite, jts, jte, kts, kte )
1104 if (P_QT .ge. PARAM_FIRST_SCALAR) &
1105 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQRCUTEN, &
1107 ids,ide, jds, jde, kds, kde, &
1108 ims, ime, jms, jme, kms, kme, &
1109 its, ite, jts, jte, kts, kte )
1111 if (P_QT .ge. PARAM_FIRST_SCALAR) &
1112 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQICUTEN, &
1114 ids,ide, jds, jde, kds, kde, &
1115 ims, ime, jms, jme, kms, kme, &
1116 its, ite, jts, jte, kts, kte )
1118 if (P_QT .ge. PARAM_FIRST_SCALAR) &
1119 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQSCUTEN, &
1121 ids,ide, jds, jde, kds, kde, &
1122 ims, ime, jms, jme, kms, kme, &
1123 its, ite, jts, jte, kts, kte )
1128 CALL add_a2a(rt_tendf,RTHCUTEN, &
1130 ids,ide, jds, jde, kds, kde, &
1131 ims, ime, jms, jme, kms, kme, &
1132 its, ite, jts, jte, kts, kte )
1134 if (P_QV .ge. PARAM_FIRST_SCALAR) &
1135 CALL add_a2a(moist_tendf(ims,kms,jms,P_QV),RQVCUTEN, &
1137 ids,ide, jds, jde, kds, kde, &
1138 ims, ime, jms, jme, kms, kme, &
1139 its, ite, jts, jte, kts, kte )
1141 CASE (KFETASCHEME, KFCUPSCHEME)!BSINGH - Added KFCUPSCHEME for CuP
1142 CALL add_a2a(rt_tendf,RTHCUTEN,config_flags, &
1143 ids,ide, jds, jde, kds, kde, &
1144 ims, ime, jms, jme, kms, kme, &
1145 its, ite, jts, jte, kts, kte )
1147 if (P_QV .ge. PARAM_FIRST_SCALAR) &
1148 CALL add_a2a(moist_tendf(ims,kms,jms,P_QV),RQVCUTEN, &
1150 ids,ide, jds, jde, kds, kde, &
1151 ims, ime, jms, jme, kms, kme, &
1152 its, ite, jts, jte, kts, kte )
1154 if (P_QC .ge. PARAM_FIRST_SCALAR) &
1155 CALL add_a2a(moist_tendf(ims,kms,jms,P_QC),RQCCUTEN, &
1157 ids,ide, jds, jde, kds, kde, &
1158 ims, ime, jms, jme, kms, kme, &
1159 its, ite, jts, jte, kts, kte )
1161 if (P_QR .ge. PARAM_FIRST_SCALAR) &
1162 CALL add_a2a(moist_tendf(ims,kms,jms,P_QR),RQRCUTEN, &
1164 ids,ide, jds, jde, kds, kde, &
1165 ims, ime, jms, jme, kms, kme, &
1166 its, ite, jts, jte, kts, kte )
1168 if (P_QI .ge. PARAM_FIRST_SCALAR) &
1169 CALL add_a2a(moist_tendf(ims,kms,jms,P_QI),RQICUTEN, &
1171 ids,ide, jds, jde, kds, kde, &
1172 ims, ime, jms, jme, kms, kme, &
1173 its, ite, jts, jte, kts, kte )
1175 if (P_QS .ge. PARAM_FIRST_SCALAR) &
1176 CALL add_a2a(moist_tendf(ims,kms,jms,P_QS),RQSCUTEN, &
1178 ids,ide, jds, jde, kds, kde, &
1179 ims, ime, jms, jme, kms, kme, &
1180 its, ite, jts, jte, kts, kte )
1182 IF(.not. adv_moist_cond)THEN
1184 if (P_QT .ge. PARAM_FIRST_SCALAR) &
1185 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQCCUTEN, &
1187 ids,ide, jds, jde, kds, kde, &
1188 ims, ime, jms, jme, kms, kme, &
1189 its, ite, jts, jte, kts, kte )
1191 if (P_QT .ge. PARAM_FIRST_SCALAR) &
1192 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQRCUTEN, &
1194 ids,ide, jds, jde, kds, kde, &
1195 ims, ime, jms, jme, kms, kme, &
1196 its, ite, jts, jte, kts, kte )
1198 if (P_QT .ge. PARAM_FIRST_SCALAR) &
1199 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQICUTEN, &
1201 ids,ide, jds, jde, kds, kde, &
1202 ims, ime, jms, jme, kms, kme, &
1203 its, ite, jts, jte, kts, kte )
1205 if (P_QT .ge. PARAM_FIRST_SCALAR) &
1206 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQSCUTEN, &
1208 ids,ide, jds, jde, kds, kde, &
1209 ims, ime, jms, jme, kms, kme, &
1210 its, ite, jts, jte, kts, kte )
1214 CASE (MSKFSCHEME)!JTR: Separate MSKF for cmt
1215 CALL add_a2a(rt_tendf,RTHCUTEN,config_flags, &
1216 ids,ide, jds, jde, kds, kde, &
1217 ims, ime, jms, jme, kms, kme, &
1218 its, ite, jts, jte, kts, kte )
1220 CALL add_a2c_u(ru_tendf,RUCUTEN,config_flags, &
1221 ids,ide, jds, jde, kds, kde, &
1222 ims, ime, jms, jme, kms, kme, &
1223 its, ite, jts, jte, kts, kte )
1225 CALL add_a2c_v(rv_tendf,RVCUTEN,config_flags, &
1226 ids,ide, jds, jde, kds, kde, &
1227 ims, ime, jms, jme, kms, kme, &
1228 its, ite, jts, jte, kts, kte )
1230 if (P_QV .ge. PARAM_FIRST_SCALAR) &
1231 CALL add_a2a(moist_tendf(ims,kms,jms,P_QV),RQVCUTEN, &
1233 ids,ide, jds, jde, kds, kde, &
1234 ims, ime, jms, jme, kms, kme, &
1235 its, ite, jts, jte, kts, kte )
1237 if (P_QC .ge. PARAM_FIRST_SCALAR) &
1238 CALL add_a2a(moist_tendf(ims,kms,jms,P_QC),RQCCUTEN, &
1240 ids,ide, jds, jde, kds, kde, &
1241 ims, ime, jms, jme, kms, kme, &
1242 its, ite, jts, jte, kts, kte )
1244 if (P_QR .ge. PARAM_FIRST_SCALAR) &
1245 CALL add_a2a(moist_tendf(ims,kms,jms,P_QR),RQRCUTEN, &
1247 ids,ide, jds, jde, kds, kde, &
1248 ims, ime, jms, jme, kms, kme, &
1249 its, ite, jts, jte, kts, kte )
1251 if (P_QI .ge. PARAM_FIRST_SCALAR) &
1252 CALL add_a2a(moist_tendf(ims,kms,jms,P_QI),RQICUTEN, &
1254 ids,ide, jds, jde, kds, kde, &
1255 ims, ime, jms, jme, kms, kme, &
1256 its, ite, jts, jte, kts, kte )
1258 if (P_QS .ge. PARAM_FIRST_SCALAR) &
1259 CALL add_a2a(moist_tendf(ims,kms,jms,P_QS),RQSCUTEN, &
1261 ids,ide, jds, jde, kds, kde, &
1262 ims, ime, jms, jme, kms, kme, &
1263 its, ite, jts, jte, kts, kte )
1265 IF(.not. adv_moist_cond)THEN
1267 if (P_QT .ge. PARAM_FIRST_SCALAR) &
1268 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQCCUTEN, &
1270 ids,ide, jds, jde, kds, kde, &
1271 ims, ime, jms, jme, kms, kme, &
1272 its, ite, jts, jte, kts, kte )
1274 if (P_QT .ge. PARAM_FIRST_SCALAR) &
1275 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQRCUTEN, &
1277 ids,ide, jds, jde, kds, kde, &
1278 ims, ime, jms, jme, kms, kme, &
1279 its, ite, jts, jte, kts, kte )
1281 if (P_QT .ge. PARAM_FIRST_SCALAR) &
1282 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQICUTEN, &
1284 ids,ide, jds, jde, kds, kde, &
1285 ims, ime, jms, jme, kms, kme, &
1286 its, ite, jts, jte, kts, kte )
1288 if (P_QT .ge. PARAM_FIRST_SCALAR) &
1289 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQSCUTEN, &
1291 ids,ide, jds, jde, kds, kde, &
1292 ims, ime, jms, jme, kms, kme, &
1293 its, ite, jts, jte, kts, kte )
1298 CASE (GDSCHEME, G3SCHEME, GFSCHEME)
1299 CALL add_a2a(rt_tendf,RTHCUTEN,config_flags, &
1300 ids,ide, jds, jde, kds, kde, &
1301 ims, ime, jms, jme, kms, kme, &
1302 its, ite, jts, jte, kts, kte )
1304 if (P_QV .ge. PARAM_FIRST_SCALAR) &
1305 CALL add_a2a(moist_tendf(ims,kms,jms,P_QV),RQVCUTEN, &
1307 ids,ide, jds, jde, kds, kde, &
1308 ims, ime, jms, jme, kms, kme, &
1309 its, ite, jts, jte, kts, kte )
1311 if (P_QC .ge. PARAM_FIRST_SCALAR) &
1312 CALL add_a2a(moist_tendf(ims,kms,jms,P_QC),RQCCUTEN, &
1314 ids,ide, jds, jde, kds, kde, &
1315 ims, ime, jms, jme, kms, kme, &
1316 its, ite, jts, jte, kts, kte )
1318 if (P_QI .ge. PARAM_FIRST_SCALAR) &
1319 CALL add_a2a(moist_tendf(ims,kms,jms,P_QI),RQICUTEN, &
1321 ids,ide, jds, jde, kds, kde, &
1322 ims, ime, jms, jme, kms, kme, &
1323 its, ite, jts, jte, kts, kte )
1325 IF(.not. adv_moist_cond)THEN
1327 if (P_QT .ge. PARAM_FIRST_SCALAR) &
1328 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQCCUTEN, &
1330 ids,ide, jds, jde, kds, kde, &
1331 ims, ime, jms, jme, kms, kme, &
1332 its, ite, jts, jte, kts, kte )
1334 if (P_QT .ge. PARAM_FIRST_SCALAR) &
1335 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQICUTEN, &
1337 ids,ide, jds, jde, kds, kde, &
1338 ims, ime, jms, jme, kms, kme, &
1339 its, ite, jts, jte, kts, kte )
1343 CASE (KSASSCHEME,NSASSCHEME)
1344 CALL add_a2a(rt_tendf,RTHCUTEN,config_flags, &
1345 ids,ide, jds, jde, kds, kde, &
1346 ims, ime, jms, jme, kms, kme, &
1347 its, ite, jts, jte, kts, kte )
1349 CALL add_a2c_u(ru_tendf,RUCUTEN,config_flags, &
1350 ids,ide, jds, jde, kds, kde, &
1351 ims, ime, jms, jme, kms, kme, &
1352 its, ite, jts, jte, kts, kte )
1354 CALL add_a2c_v(rv_tendf,RVCUTEN,config_flags, &
1355 ids,ide, jds, jde, kds, kde, &
1356 ims, ime, jms, jme, kms, kme, &
1357 its, ite, jts, jte, kts, kte )
1359 if (P_QV .ge. PARAM_FIRST_SCALAR) &
1360 CALL add_a2a(moist_tendf(ims,kms,jms,P_QV),RQVCUTEN, &
1362 ids,ide, jds, jde, kds, kde, &
1363 ims, ime, jms, jme, kms, kme, &
1364 its, ite, jts, jte, kts, kte )
1366 if (P_QC .ge. PARAM_FIRST_SCALAR) &
1367 CALL add_a2a(moist_tendf(ims,kms,jms,P_QC),RQCCUTEN, &
1369 ids,ide, jds, jde, kds, kde, &
1370 ims, ime, jms, jme, kms, kme, &
1371 its, ite, jts, jte, kts, kte )
1373 if (P_QI .ge. PARAM_FIRST_SCALAR) &
1374 CALL add_a2a(moist_tendf(ims,kms,jms,P_QI),RQICUTEN, &
1376 ids,ide, jds, jde, kds, kde, &
1377 ims, ime, jms, jme, kms, kme, &
1378 its, ite, jts, jte, kts, kte )
1380 IF(.not. adv_moist_cond)THEN
1382 if (P_QT .ge. PARAM_FIRST_SCALAR) &
1383 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQCCUTEN, &
1385 ids,ide, jds, jde, kds, kde, &
1386 ims, ime, jms, jme, kms, kme, &
1387 its, ite, jts, jte, kts, kte )
1389 if (P_QT .ge. PARAM_FIRST_SCALAR) &
1390 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQICUTEN, &
1392 ids,ide, jds, jde, kds, kde, &
1393 ims, ime, jms, jme, kms, kme, &
1394 its, ite, jts, jte, kts, kte )
1398 CASE (SASSCHEME,OSASSCHEME,SCALESASSCHEME)
1399 CALL add_a2a(rt_tendf,RTHCUTEN,config_flags, &
1400 ids,ide, jds, jde, kds, kde, &
1401 ims, ime, jms, jme, kms, kme, &
1402 its, ite, jts, jte, kts, kte )
1404 if (P_QV .ge. PARAM_FIRST_SCALAR) &
1405 CALL add_a2a(moist_tendf(ims,kms,jms,P_QV),RQVCUTEN, &
1407 ids,ide, jds, jde, kds, kde, &
1408 ims, ime, jms, jme, kms, kme, &
1409 its, ite, jts, jte, kts, kte )
1411 if (P_QC .ge. PARAM_FIRST_SCALAR) &
1412 CALL add_a2a(moist_tendf(ims,kms,jms,P_QC),RQCCUTEN, &
1414 ids,ide, jds, jde, kds, kde, &
1415 ims, ime, jms, jme, kms, kme, &
1416 its, ite, jts, jte, kts, kte )
1418 if (P_QI .ge. PARAM_FIRST_SCALAR) &
1419 CALL add_a2a(moist_tendf(ims,kms,jms,P_QI),RQICUTEN, &
1421 ids,ide, jds, jde, kds, kde, &
1422 ims, ime, jms, jme, kms, kme, &
1423 its, ite, jts, jte, kts, kte )
1425 IF(.not. adv_moist_cond)THEN
1427 if (P_QT .ge. PARAM_FIRST_SCALAR) &
1428 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQCCUTEN, &
1430 ids,ide, jds, jde, kds, kde, &
1431 ims, ime, jms, jme, kms, kme, &
1432 its, ite, jts, jte, kts, kte )
1434 if (P_QT .ge. PARAM_FIRST_SCALAR) &
1435 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQICUTEN, &
1437 ids,ide, jds, jde, kds, kde, &
1438 ims, ime, jms, jme, kms, kme, &
1439 its, ite, jts, jte, kts, kte )
1444 CALL add_a2c_u(ru_tendf,RUCUTEN,config_flags, &
1445 ids,ide, jds, jde, kds, kde, &
1446 ims, ime, jms, jme, kms, kme, &
1447 its, ite, jts, jte, kts, kte )
1449 CALL add_a2c_v(rv_tendf,RVCUTEN,config_flags, &
1450 ids,ide, jds, jde, kds, kde, &
1451 ims, ime, jms, jme, kms, kme, &
1452 its, ite, jts, jte, kts, kte )
1454 CALL add_a2a(rt_tendf,RTHCUTEN,config_flags, &
1455 ids,ide, jds, jde, kds, kde, &
1456 ims, ime, jms, jme, kms, kme, &
1457 its, ite, jts, jte, kts, kte )
1459 if (P_QV .ge. PARAM_FIRST_SCALAR) &
1460 CALL add_a2a(moist_tendf(ims,kms,jms,P_QV),RQVCUTEN, &
1462 ids,ide, jds, jde, kds, kde, &
1463 ims, ime, jms, jme, kms, kme, &
1464 its, ite, jts, jte, kts, kte )
1466 if (P_QC .ge. PARAM_FIRST_SCALAR) &
1467 CALL add_a2a(moist_tendf(ims,kms,jms,P_QC),RQCCUTEN, &
1469 ids,ide, jds, jde, kds, kde, &
1470 ims, ime, jms, jme, kms, kme, &
1471 its, ite, jts, jte, kts, kte )
1473 if (P_QI .ge. PARAM_FIRST_SCALAR) &
1474 CALL add_a2a(moist_tendf(ims,kms,jms,P_QI),RQICUTEN, &
1476 ids,ide, jds, jde, kds, kde, &
1477 ims, ime, jms, jme, kms, kme, &
1478 its, ite, jts, jte, kts, kte )
1480 if (P_QNC .ge. PARAM_FIRST_SCALAR) &!BSINGH - QNC scalar
1481 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QNC),RQCNCUTEN, &
1483 ids,ide, jds, jde, kds, kde, &
1484 ims, ime, jms, jme, kms, kme, &
1485 its, ite, jts, jte, kts, kte )
1486 if (P_QNI .ge. PARAM_FIRST_SCALAR) &!BSINGH - QNI scalar
1487 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QNI),RQINCUTEN, &
1489 ids,ide, jds, jde, kds, kde, &
1490 ims, ime, jms, jme, kms, kme, &
1491 its, ite, jts, jte, kts, kte )
1494 IF(.not. adv_moist_cond)THEN
1496 if (P_QT .ge. PARAM_FIRST_SCALAR) &
1497 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQCCUTEN, &
1499 ids,ide, jds, jde, kds, kde, &
1500 ims, ime, jms, jme, kms, kme, &
1501 its, ite, jts, jte, kts, kte )
1503 if (P_QT .ge. PARAM_FIRST_SCALAR) &
1504 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQICUTEN, &
1506 ids,ide, jds, jde, kds, kde, &
1507 ims, ime, jms, jme, kms, kme, &
1508 its, ite, jts, jte, kts, kte )
1512 CASE (TIEDTKESCHEME, NTIEDTKESCHEME)
1513 CALL add_a2a(rt_tendf,RTHCUTEN,config_flags, &
1514 ids,ide, jds, jde, kds, kde, &
1515 ims, ime, jms, jme, kms, kme, &
1516 its, ite, jts, jte, kts, kte )
1518 CALL add_a2c_u(ru_tendf,RUCUTEN,config_flags, &
1519 ids,ide, jds, jde, kds, kde, &
1520 ims, ime, jms, jme, kms, kme, &
1521 its, ite, jts, jte, kts, kte )
1523 CALL add_a2c_v(rv_tendf,RVCUTEN,config_flags, &
1524 ids,ide, jds, jde, kds, kde, &
1525 ims, ime, jms, jme, kms, kme, &
1526 its, ite, jts, jte, kts, kte )
1528 if (P_QV .ge. PARAM_FIRST_SCALAR) &
1529 CALL add_a2a(moist_tendf(ims,kms,jms,P_QV),RQVCUTEN, &
1531 ids,ide, jds, jde, kds, kde, &
1532 ims, ime, jms, jme, kms, kme, &
1533 its, ite, jts, jte, kts, kte )
1535 if (P_QC .ge. PARAM_FIRST_SCALAR) &
1536 CALL add_a2a(moist_tendf(ims,kms,jms,P_QC),RQCCUTEN, &
1538 ids,ide, jds, jde, kds, kde, &
1539 ims, ime, jms, jme, kms, kme, &
1540 its, ite, jts, jte, kts, kte )
1542 if (P_QI .ge. PARAM_FIRST_SCALAR) &
1543 CALL add_a2a(moist_tendf(ims,kms,jms,P_QI),RQICUTEN, &
1545 ids,ide, jds, jde, kds, kde, &
1546 ims, ime, jms, jme, kms, kme, &
1547 its, ite, jts, jte, kts, kte )
1549 IF(.not. adv_moist_cond)THEN
1551 if (P_QT .ge. PARAM_FIRST_SCALAR) &
1552 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQCCUTEN, &
1554 ids,ide, jds, jde, kds, kde, &
1555 ims, ime, jms, jme, kms, kme, &
1556 its, ite, jts, jte, kts, kte )
1558 if (P_QT .ge. PARAM_FIRST_SCALAR) &
1559 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQICUTEN, &
1561 ids,ide, jds, jde, kds, kde, &
1562 ims, ime, jms, jme, kms, kme, &
1563 its, ite, jts, jte, kts, kte )
1567 #if ( WRFPLUS == 1 )
1568 ! this is for WRFPlus only
1569 !-------------------------------
1571 CALL add_a2a(rt_tendf,RTHCUTEN,config_flags, &
1572 ids,ide, jds, jde, kds, kde, &
1573 ims, ime, jms, jme, kms, kme, &
1574 its, ite, jts, jte, kts, kte )
1576 if (P_QV .ge. PARAM_FIRST_SCALAR) &
1577 CALL add_a2a(moist_tendf(ims,kms,jms,P_QV),RQVCUTEN, &
1579 ids,ide, jds, jde, kds, kde, &
1580 ims, ime, jms, jme, kms, kme, &
1581 its, ite, jts, jte, kts, kte )
1583 IF(.not. adv_moist_cond)THEN
1585 if (P_QC .ge. PARAM_FIRST_SCALAR) &
1586 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQCCUTEN, &
1588 ids,ide, jds, jde, kds, kde, &
1589 ims, ime, jms, jme, kms, kme, &
1590 its, ite, jts, jte, kts, kte )
1592 if (P_QI .ge. PARAM_FIRST_SCALAR) &
1593 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QT),RQICUTEN, &
1595 ids,ide, jds, jde, kds, kde, &
1596 ims, ime, jms, jme, kms, kme, &
1597 its, ite, jts, jte, kts, kte )
1606 END SUBROUTINE phy_cu_ten
1608 !=================================================================
1609 SUBROUTINE phy_shcu_ten(config_flags,rk_step,n_moist,n_scalar, &
1610 rt_tendf,ru_tendf,rv_tendf, &
1611 RUSHTEN,RVSHTEN,RTHSHTEN, &
1612 RQVSHTEN,RQCSHTEN,RQRSHTEN, &
1613 RQISHTEN,RQSSHTEN,RQGSHTEN,RQCNSHTEN, &
1614 RQINSHTEN,moist_tendf,scalar_tendf, &
1615 ids, ide, jds, jde, kds, kde, &
1616 ims, ime, jms, jme, kms, kme, &
1617 its, ite, jts, jte, kts, kte )
1618 !-----------------------------------------------------------------
1620 !-----------------------------------------------------------------
1621 TYPE(grid_config_rec_type ) , INTENT(IN ) :: config_flags
1623 INTEGER , INTENT(IN) :: ids, ide, jds, jde, kds, kde, &
1624 ims, ime, jms, jme, kms, kme, &
1625 its, ite, jts, jte, kts, kte, &
1626 n_moist, n_scalar, rk_step
1628 REAL , DIMENSION(ims:ime, kms:kme, jms:jme, n_moist), &
1629 INTENT(INOUT) :: moist_tendf
1631 REAL , DIMENSION(ims:ime, kms:kme, jms:jme, n_scalar), &
1632 INTENT(INOUT) :: scalar_tendf
1634 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(IN ) :: &
1647 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(INOUT) :: &
1656 SELECT CASE (config_flags%shcu_physics)
1658 CASE (CAMUWSHCUSCHEME)
1659 CALL add_a2c_u(ru_tendf,RUSHTEN,config_flags, &
1660 ids,ide, jds, jde, kds, kde, &
1661 ims, ime, jms, jme, kms, kme, &
1662 its, ite, jts, jte, kts, kte )
1664 CALL add_a2c_v(rv_tendf,RVSHTEN,config_flags, &
1665 ids,ide, jds, jde, kds, kde, &
1666 ims, ime, jms, jme, kms, kme, &
1667 its, ite, jts, jte, kts, kte )
1669 CALL add_a2a(rt_tendf,RTHSHTEN,config_flags, &
1670 ids,ide, jds, jde, kds, kde, &
1671 ims, ime, jms, jme, kms, kme, &
1672 its, ite, jts, jte, kts, kte )
1674 if (P_QV .ge. PARAM_FIRST_SCALAR) &
1675 CALL add_a2a(moist_tendf(ims,kms,jms,P_QV),RQVSHTEN, &
1677 ids,ide, jds, jde, kds, kde, &
1678 ims, ime, jms, jme, kms, kme, &
1679 its, ite, jts, jte, kts, kte )
1681 if (P_QC .ge. PARAM_FIRST_SCALAR) &
1682 CALL add_a2a(moist_tendf(ims,kms,jms,P_QC),RQCSHTEN, &
1684 ids,ide, jds, jde, kds, kde, &
1685 ims, ime, jms, jme, kms, kme, &
1686 its, ite, jts, jte, kts, kte )
1688 if (P_QR .ge. PARAM_FIRST_SCALAR) &
1689 CALL add_a2a(moist_tendf(ims,kms,jms,P_QR),RQRSHTEN, &
1691 ids,ide, jds, jde, kds, kde, &
1692 ims, ime, jms, jme, kms, kme, &
1693 its, ite, jts, jte, kts, kte )
1695 if (P_QI .ge. PARAM_FIRST_SCALAR) &
1696 CALL add_a2a(moist_tendf(ims,kms,jms,P_QI),RQISHTEN, &
1698 ids,ide, jds, jde, kds, kde, &
1699 ims, ime, jms, jme, kms, kme, &
1700 its, ite, jts, jte, kts, kte )
1702 if (P_QS .ge. PARAM_FIRST_SCALAR) &
1703 CALL add_a2a(moist_tendf(ims,kms,jms,P_QS),RQSSHTEN, &
1705 ids,ide, jds, jde, kds, kde, &
1706 ims, ime, jms, jme, kms, kme, &
1707 its, ite, jts, jte, kts, kte )
1709 if (P_QG .ge. PARAM_FIRST_SCALAR) &
1710 CALL add_a2a(moist_tendf(ims,kms,jms,P_QG),RQGSHTEN, &
1712 ids,ide, jds, jde, kds, kde, &
1713 ims, ime, jms, jme, kms, kme, &
1714 its, ite, jts, jte, kts, kte )
1715 if (P_QNC .ge. PARAM_FIRST_SCALAR) &
1716 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QNC),RQCNSHTEN, &
1718 ids,ide, jds, jde, kds, kde, &
1719 ims, ime, jms, jme, kms, kme, &
1720 its, ite, jts, jte, kts, kte )
1721 if (P_QNI .ge. PARAM_FIRST_SCALAR) &
1722 CALL add_a2a(scalar_tendf(ims,kms,jms,P_QNI),RQINSHTEN, &
1724 ids,ide, jds, jde, kds, kde, &
1725 ims, ime, jms, jme, kms, kme, &
1726 its, ite, jts, jte, kts, kte )
1729 CASE (GRIMSSHCUSCHEME)
1730 CALL add_a2a(rt_tendf,RTHSHTEN,config_flags, &
1731 ids,ide, jds, jde, kds, kde, &
1732 ims, ime, jms, jme, kms, kme, &
1733 its, ite, jts, jte, kts, kte )
1735 if (P_QV .ge. PARAM_FIRST_SCALAR) &
1736 CALL add_a2a(moist_tendf(ims,kms,jms,P_QV),RQVSHTEN, &
1738 ids,ide, jds, jde, kds, kde, &
1739 ims, ime, jms, jme, kms, kme, &
1740 its, ite, jts, jte, kts, kte )
1742 if (P_QC .ge. PARAM_FIRST_SCALAR) &
1743 CALL add_a2a(moist_tendf(ims,kms,jms,P_QC),RQCSHTEN, &
1745 ids,ide, jds, jde, kds, kde, &
1746 ims, ime, jms, jme, kms, kme, &
1747 its, ite, jts, jte, kts, kte )
1749 if (P_QI .ge. PARAM_FIRST_SCALAR) &
1750 CALL add_a2a(moist_tendf(ims,kms,jms,P_QI),RQISHTEN, &
1752 ids,ide, jds, jde, kds, kde, &
1753 ims, ime, jms, jme, kms, kme, &
1754 its, ite, jts, jte, kts, kte )
1756 CASE (NSCVSHCUSCHEME)
1757 CALL add_a2a(rt_tendf,RTHSHTEN,config_flags, &
1758 ids,ide, jds, jde, kds, kde, &
1759 ims, ime, jms, jme, kms, kme, &
1760 its, ite, jts, jte, kts, kte )
1762 CALL add_a2c_u(ru_tendf,RUSHTEN,config_flags, &
1763 ids,ide, jds, jde, kds, kde, &
1764 ims, ime, jms, jme, kms, kme, &
1765 its, ite, jts, jte, kts, kte )
1767 CALL add_a2c_v(rv_tendf,RVSHTEN,config_flags, &
1768 ids,ide, jds, jde, kds, kde, &
1769 ims, ime, jms, jme, kms, kme, &
1770 its, ite, jts, jte, kts, kte )
1772 if (P_QV .ge. PARAM_FIRST_SCALAR) &
1773 CALL add_a2a(moist_tendf(ims,kms,jms,P_QV),RQVSHTEN, &
1775 ids,ide, jds, jde, kds, kde, &
1776 ims, ime, jms, jme, kms, kme, &
1777 its, ite, jts, jte, kts, kte )
1779 if (P_QC .ge. PARAM_FIRST_SCALAR) &
1780 CALL add_a2a(moist_tendf(ims,kms,jms,P_QC),RQCSHTEN, &
1782 ids,ide, jds, jde, kds, kde, &
1783 ims, ime, jms, jme, kms, kme, &
1784 its, ite, jts, jte, kts, kte )
1786 if (P_QI .ge. PARAM_FIRST_SCALAR) &
1787 CALL add_a2a(moist_tendf(ims,kms,jms,P_QI),RQISHTEN, &
1789 ids,ide, jds, jde, kds, kde, &
1790 ims, ime, jms, jme, kms, kme, &
1791 its, ite, jts, jte, kts, kte )
1793 CASE (DENGSHCUSCHEME)
1794 CALL add_a2c_u(ru_tendf,RUSHTEN,config_flags, &
1795 ids,ide, jds, jde, kds, kde, &
1796 ims, ime, jms, jme, kms, kme, &
1797 its, ite, jts, jte, kts, kte )
1799 CALL add_a2c_v(rv_tendf,RVSHTEN,config_flags, &
1800 ids,ide, jds, jde, kds, kde, &
1801 ims, ime, jms, jme, kms, kme, &
1802 its, ite, jts, jte, kts, kte )
1804 CALL add_a2a(rt_tendf,RTHSHTEN,config_flags, &
1805 ids,ide, jds, jde, kds, kde, &
1806 ims, ime, jms, jme, kms, kme, &
1807 its, ite, jts, jte, kts, kte )
1809 if (P_QV .ge. PARAM_FIRST_SCALAR) &
1810 CALL add_a2a(moist_tendf(ims,kms,jms,P_QV),RQVSHTEN, &
1812 ids,ide, jds, jde, kds, kde, &
1813 ims, ime, jms, jme, kms, kme, &
1814 its, ite, jts, jte, kts, kte )
1816 if (P_QC .ge. PARAM_FIRST_SCALAR) &
1817 CALL add_a2a(moist_tendf(ims,kms,jms,P_QC),RQCSHTEN, &
1819 ids,ide, jds, jde, kds, kde, &
1820 ims, ime, jms, jme, kms, kme, &
1821 its, ite, jts, jte, kts, kte )
1823 if (P_QR .ge. PARAM_FIRST_SCALAR) &
1824 CALL add_a2a(moist_tendf(ims,kms,jms,P_QR),RQRSHTEN, &
1826 ids,ide, jds, jde, kds, kde, &
1827 ims, ime, jms, jme, kms, kme, &
1828 its, ite, jts, jte, kts, kte )
1836 END SUBROUTINE phy_shcu_ten
1838 !=================================================================
1839 SUBROUTINE phy_fg_ten(config_flags,rk_step,n_moist, &
1840 rph_tendf,rt_tendf,ru_tendf,rv_tendf, &
1841 mu_tendf, moist_tendf, &
1842 RUNDGDTEN,RVNDGDTEN,RTHNDGDTEN, &
1843 RPHNDGDTEN,RQVNDGDTEN,RMUNDGDTEN, &
1844 ids, ide, jds, jde, kds, kde, &
1845 ims, ime, jms, jme, kms, kme, &
1846 its, ite, jts, jte, kts, kte )
1847 !-----------------------------------------------------------------
1849 !-----------------------------------------------------------------
1850 TYPE(grid_config_rec_type) , INTENT(IN ) :: config_flags
1852 INTEGER , INTENT(IN) :: ids, ide, jds, jde, kds, kde, &
1853 ims, ime, jms, jme, kms, kme, &
1854 its, ite, jts, jte, kts, kte, &
1857 REAL , DIMENSION(ims:ime, kms:kme, jms:jme, n_moist), &
1858 INTENT(INOUT) :: moist_tendf
1860 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(IN ) :: &
1867 REAL, DIMENSION(ims:ime, jms:jme), INTENT(IN ) :: RMUNDGDTEN
1869 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(INOUT):: &
1875 REAL, DIMENSION(ims:ime, jms:jme), INTENT(INOUT):: mu_tendf
1879 INTEGER :: i,j,k,IBGN,IEND,JBGN,JEND
1881 !-----------------------------------------------------------------
1883 SELECT CASE(config_flags%grid_fdda)
1887 CALL add_a2a(rt_tendf,RTHNDGDTEN,config_flags, &
1888 ids,ide, jds, jde, kds, kde, &
1889 ims, ime, jms, jme, kms, kme, &
1890 its, ite, jts, jte, kts, kte )
1892 ! note fdda u and v tendencies are staggered
1893 CALL add_c2c_u(ru_tendf,RUNDGDTEN,config_flags, &
1894 ids,ide, jds, jde, kds, kde, &
1895 ims, ime, jms, jme, kms, kme, &
1896 its, ite, jts, jte, kts, kte )
1898 CALL add_c2c_v(rv_tendf,RVNDGDTEN,config_flags, &
1899 ids,ide, jds, jde, kds, kde, &
1900 ims, ime, jms, jme, kms, kme, &
1901 its, ite, jts, jte, kts, kte )
1903 CALL add_a2a(mu_tendf,RMUNDGDTEN,config_flags, &
1904 ids,ide, jds, jde, kds, kds, &
1905 ims, ime, jms, jme, kms, kms, &
1906 its, ite, jts, jte, kts, kts )
1908 if (P_QV .ge. PARAM_FIRST_SCALAR) &
1909 CALL add_a2a(moist_tendf(ims,kms,jms,P_QV),RQVNDGDTEN, &
1911 ids,ide, jds, jde, kds, kde, &
1912 ims, ime, jms, jme, kms, kme, &
1913 its, ite, jts, jte, kts, kte )
1917 ! note fdda u and v tendencies are staggered
1918 CALL add_c2c_u(ru_tendf,RUNDGDTEN,config_flags, &
1919 ids,ide, jds, jde, kds, kde, &
1920 ims, ime, jms, jme, kms, kme, &
1921 its, ite, jts, jte, kts, kte )
1923 CALL add_c2c_v(rv_tendf,RVNDGDTEN,config_flags, &
1924 ids,ide, jds, jde, kds, kde, &
1925 ims, ime, jms, jme, kms, kme, &
1926 its, ite, jts, jte, kts, kte )
1928 CALL add_a2a(rt_tendf,RTHNDGDTEN,config_flags, &
1929 ids,ide, jds, jde, kds, kde, &
1930 ims, ime, jms, jme, kms, kme, &
1931 its, ite, jts, jte, kts, kte )
1933 CALL add_a2a_ph(rph_tendf,RPHNDGDTEN,config_flags, &
1934 ids,ide, jds, jde, kds, kde, &
1935 ims, ime, jms, jme, kms, kme, &
1936 its, ite, jts, jte, kts, kte )
1938 if (P_QV .ge. PARAM_FIRST_SCALAR) &
1939 CALL add_a2a(moist_tendf(ims,kms,jms,P_QV),RQVNDGDTEN,&
1941 ids,ide, jds, jde, kds, kde, &
1942 ims, ime, jms, jme, kms, kme, &
1943 its, ite, jts, jte, kts, kte )
1949 END SUBROUTINE phy_fg_ten
1951 !=================================================================
1952 SUBROUTINE phy_fr_ten(config_flags,rk_step,n_moist, &
1953 rt_tendf,ru_tendf,rv_tendf, &
1954 mu_tendf, moist_tendf, &
1955 rthfrten,rqvfrten, &
1956 ids, ide, jds, jde, kds, kde, &
1957 ims, ime, jms, jme, kms, kme, &
1958 its, ite, jts, jte, kts, kte )
1959 !-----------------------------------------------------------------
1960 USE module_state_description, ONLY : &
1961 FIRE_SFIRE1, FIRE_SFIRE
1962 !-----------------------------------------------------------------
1964 !-----------------------------------------------------------------
1965 TYPE(grid_config_rec_type) , INTENT(IN ) :: config_flags
1967 INTEGER , INTENT(IN) :: ids, ide, jds, jde, kds, kde, &
1968 ims, ime, jms, jme, kms, kme, &
1969 its, ite, jts, jte, kts, kte, &
1972 REAL , DIMENSION(ims:ime, kms:kme, jms:jme, n_moist), &
1973 INTENT(INOUT) :: moist_tendf
1975 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(IN ) :: &
1979 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(INOUT):: &
1984 REAL, DIMENSION(ims:ime, jms:jme), INTENT(INOUT):: mu_tendf
1988 INTEGER :: i,j,k,IBGN,IEND,JBGN,JEND
1990 !-----------------------------------------------------------------
1992 SELECT CASE(config_flags%ifire)
1994 CASE (FIRE_SFIRE1, FIRE_SFIRE)
1996 CALL add_a2a(rt_tendf,rthfrten, &
1998 ids,ide, jds, jde, kds, kde, &
1999 ims, ime, jms, jme, kms, kme, &
2000 its, ite, jts, jte, kts, kte )
2002 CALL add_a2a(moist_tendf(ims,kms,jms,P_QV),rqvfrten, &
2004 ids,ide, jds, jde, kds, kde, &
2005 ims, ime, jms, jme, kms, kme, &
2006 its, ite, jts, jte, kts, kte )
2012 END SUBROUTINE phy_fr_ten
2014 !----------------------------------------------------------------------
2015 SUBROUTINE advance_ppt(RTHCUTEN,RQVCUTEN,RQCCUTEN,RQRCUTEN, &
2016 CLDFRA_CUP, & ! add LD 01/11/2012 !BSINGH - Added for CuP
2017 RQICUTEN,RQSCUTEN, &
2018 RAINC,RAINCV,RAINSH,PRATEC,PRATESH, &
2019 NCA, HTOP,HBOT,CUTOP,CUBOT, &
2020 CUPPT, DT, config_flags, &
2021 ids,ide, jds,jde, kds,kde, &
2022 ims,ime, jms,jme, kms,kme, &
2023 its,ite, jts,jte, kts,kte )
2024 !----------------------------------------------------------------------
2025 USE module_state_description
2028 #if ( WRFPLUS == 1 )
2029 USE module_cu_du ! Added by Zhuxiao
2031 !----------------------------------------------------------------------
2033 !----------------------------------------------------------------------
2034 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
2036 INTEGER, INTENT(IN ) :: &
2037 ids,ide, jds,jde, kds,kde, &
2038 ims,ime, jms,jme, kms,kme, &
2039 its,ite, jts,jte, kts,kte
2042 REAL, DIMENSION( ims:ime, kms:kme, jms:jme ), &
2043 INTENT(INOUT) :: RTHCUTEN, &
2049 CLDFRA_CUP ! add LD 01/11/2012 !BSINGH - For CuP
2051 REAL, DIMENSION( ims:ime , jms:jme ), &
2052 INTENT(INOUT) :: RAINC, &
2063 REAL, INTENT(IN) :: DT
2067 INTEGER :: i,j,k,i_start,i_end,j_start,j_end,k_start,k_end
2068 INTEGER :: NCUTOP, NCUBOT
2070 !-----------------------------------------------------------------
2072 IF (config_flags%cu_physics .eq. 0) return
2074 ! SET START AND END POINTS FOR TILES
2077 i_end = min( ite,ide-1 )
2079 j_end = min( jte,jde-1 )
2081 ! IF( config_flags%nested .or. config_flags%specified ) THEN
2082 ! i_start = max( its,ids+1 )
2083 ! i_end = min( ite,ide-2 )
2084 ! j_start = max( jts,jds+1 )
2085 ! j_end = min( jte,jde-2 )
2089 k_end = min( kte, kde-1 )
2091 ! Update total cumulus scheme precipitation
2095 DO J = j_start,j_end
2096 DO i = i_start,i_end
2097 RAINC(I,J) = RAINC(I,J) + PRATEC(I,J)*DT
2098 RAINSH(I,J) = RAINSH(I,J) + PRATESH(I,J)*DT
2099 CUPPT(I,J) = CUPPT(I,J) + (PRATEC(I,J)+PRATESH(I,J))*DT/1000.
2103 SELECT CASE (config_flags%cu_physics)
2107 DO J = j_start,j_end
2108 DO i = i_start,i_end
2110 IF ( NCA(I,J) .GT. 0 ) THEN
2112 IF ( NINT(NCA(I,J) / DT) .le. 0 ) THEN
2114 ! set tendency to zero
2117 DO k = k_start,k_end
2122 if (P_QI .ge. PARAM_FIRST_SCALAR) RQICUTEN(i,k,j)=0.
2123 if (P_QS .ge. PARAM_FIRST_SCALAR) RQSCUTEN(i,k,j)=0.
2127 NCA(I,J)=NCA(I,J)-DT ! Decrease NCA
2134 CASE (BMJSCHEME, CAMZMSCHEME)
2136 DO J = j_start,j_end
2137 DO i = i_start,i_end
2139 ! HTOP, HBOT FOR GFDL RADIATION
2140 NCUTOP=NINT(CUTOP(I,J))
2141 NCUBOT=NINT(CUBOT(I,J))
2142 IF(NCUTOP>1.AND.NCUTOP<KDE)THEN
2143 HTOP(I,J)=MAX(CUTOP(I,J),HTOP(I,J))
2145 IF(NCUBOT>0.AND.NCUBOT<KDE)THEN
2146 HBOT(I,J)=MIN(CUBOT(I,J),HBOT(I,J))
2152 CASE (KFETASCHEME, MSKFSCHEME, KFCUPSCHEME)!BSINGH - added KFCUPSCHEME for CuP
2154 DO J = j_start,j_end
2155 DO i = i_start,i_end
2157 ! HTOP, HBOT FOR GFDL RADIATION
2158 NCUTOP=NINT(CUTOP(I,J))
2159 NCUBOT=NINT(CUBOT(I,J))
2160 IF(NCUTOP>1.AND.NCUTOP<KDE)THEN
2161 HTOP(I,J)=MAX(CUTOP(I,J),HTOP(I,J))
2163 IF(NCUBOT>0.AND.NCUBOT<KDE)THEN
2164 HBOT(I,J)=MIN(CUBOT(I,J),HBOT(I,J))
2167 IF ( NCA(I,J) .GT. 0 ) THEN
2169 IF ( NINT(NCA(I,J) / DT) .LE. 1 ) THEN
2171 ! set tendency to zero
2174 DO k = k_start,k_end
2179 if (P_QI .ge. PARAM_FIRST_SCALAR) RQICUTEN(i,k,j)=0.
2180 if (P_QS .ge. PARAM_FIRST_SCALAR) RQSCUTEN(i,k,j)=0.
2184 NCA(I,J)=NCA(I,J)-DT ! Decrease NCA
2185 ! NCA(I,J)=NCA(I,J)-1. ! Decrease NCA
2192 IF ( config_flags%cu_physics == kfcupscheme ) THEN
2193 DO J = j_start,j_end
2194 DO i = i_start,i_end
2195 IF ( NCA(I,J) .GT. 0 ) THEN
2196 IF ( NINT(NCA(I,J) / DT) .LE. 1 ) THEN
2197 DO k = k_start,k_end
2198 CLDFRA_CUP(i,k,j)=0. ! By LKB 12/22/11 01/11/2012 !BSINGH - For CuP
2206 #if ( WRFPLUS == 1 )
2207 ! this is for WRFPlus only
2208 !---------------------------
2211 DO J = j_start,j_end
2212 DO i = i_start,i_end
2214 IF ( NCA(I,J) .GT. 0 ) THEN
2216 IF ( NINT(NCA(I,J) / DT) .le. 0 ) THEN
2218 ! set tendency to zero
2221 DO k = k_start,k_end
2227 NCA(I,J)=NCA(I,J)-DT ! Decrease NCA
2239 END SUBROUTINE advance_ppt
2241 SUBROUTINE add_a2a(lvar,rvar,config_flags, &
2242 ids,ide, jds, jde, kds, kde, &
2243 ims, ime, jms, jme, kms, kme, &
2244 its, ite, jts, jte, kts, kte )
2245 !------------------------------------------------------------
2247 !------------------------------------------------------------
2248 TYPE(grid_config_rec_type), INTENT(IN) :: config_flags
2250 INTEGER , INTENT(IN ) :: ids, ide, jds, jde, kds, kde, &
2251 ims, ime, jms, jme, kms, kme, &
2252 its, ite, jts, jte, kts, kte
2254 REAL, DIMENSION(ims:ime,kms:kme,jms:jme),INTENT(IN ) ::&
2256 REAL, DIMENSION(ims:ime,kms:kme,jms:jme),INTENT(INOUT) ::&
2260 INTEGER :: i,j,k,i_start,i_end,j_start,j_end,ktf
2263 i_end = MIN(ite,ide-1)
2265 j_end = MIN(jte,jde-1)
2266 ktf = min(kte,kde-1)
2268 IF ( config_flags%specified .or. &
2269 config_flags%nested) i_start = MAX(ids+1,its)
2270 IF ( config_flags%specified .or. &
2271 config_flags%nested) i_end = MIN(ide-2,ite)
2272 IF ( config_flags%specified .or. &
2273 config_flags%nested) j_start = MAX(jds+1,jts)
2274 IF ( config_flags%specified .or. &
2275 config_flags%nested) j_end = MIN(jde-2,jte)
2276 IF ( config_flags%periodic_x ) i_start = its
2277 IF ( config_flags%periodic_x ) i_end = MIN( ite, ide-1 )
2279 DO j = j_start,j_end
2281 DO i = i_start,i_end
2282 lvar(i,k,j) = lvar(i,k,j) + rvar(i,k,j)
2287 END SUBROUTINE add_a2a
2289 SUBROUTINE add_a2a_ph(lvar,rvar,config_flags, &
2290 ids,ide, jds, jde, kds, kde, &
2291 ims, ime, jms, jme, kms, kme, &
2292 its, ite, jts, jte, kts, kte )
2293 !------------------------------------------------------------
2295 !------------------------------------------------------------
2296 TYPE(grid_config_rec_type), INTENT(IN) :: config_flags
2298 INTEGER , INTENT(IN ) :: ids, ide, jds, jde, kds, kde, &
2299 ims, ime, jms, jme, kms, kme, &
2300 its, ite, jts, jte, kts, kte
2302 REAL, DIMENSION(ims:ime,kms:kme,jms:jme),INTENT(IN ) ::&
2304 REAL, DIMENSION(ims:ime,kms:kme,jms:jme),INTENT(INOUT) ::&
2308 INTEGER :: i,j,k,i_start,i_end,j_start,j_end
2311 i_end = MIN(ite,ide-1)
2313 j_end = MIN(jte,jde-1)
2315 IF ( config_flags%specified .or. &
2316 config_flags%nested) i_start = MAX(ids+1,its)
2317 IF ( config_flags%specified .or. &
2318 config_flags%nested) i_end = MIN(ide-2,ite)
2319 IF ( config_flags%specified .or. &
2320 config_flags%nested) j_start = MAX(jds+1,jts)
2321 IF ( config_flags%specified .or. &
2322 config_flags%nested) j_end = MIN(jde-2,jte)
2323 IF ( config_flags%periodic_x ) i_start = its
2324 IF ( config_flags%periodic_x ) i_end = MIN( ite, ide-1 )
2326 DO j = j_start,j_end
2328 DO i = i_start,i_end
2329 lvar(i,k,j) = lvar(i,k,j) + rvar(i,k,j)
2334 END SUBROUTINE add_a2a_ph
2336 !------------------------------------------------------------
2337 SUBROUTINE add_a2c_u(lvar,rvar,config_flags, &
2338 ids,ide, jds, jde, kds, kde, &
2339 ims, ime, jms, jme, kms, kme, &
2340 its, ite, jts, jte, kts, kte )
2341 !------------------------------------------------------------
2342 !------------------------------------------------------------
2344 !------------------------------------------------------------
2346 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
2348 INTEGER , INTENT(IN ) :: ids, ide, jds, jde, kds, kde, &
2349 ims, ime, jms, jme, kms, kme, &
2350 its, ite, jts, jte, kts, kte
2352 REAL, DIMENSION(ims:ime,kms:kme,jms:jme),INTENT(IN ) ::&
2354 REAL, DIMENSION(ims:ime,kms:kme,jms:jme),INTENT(INOUT) ::&
2359 INTEGER :: i,j,k,i_start,i_end,j_start,j_end,ktf
2366 j_end = MIN(jte,jde-1)
2368 IF ( config_flags%specified .or. &
2369 config_flags%nested) i_start = MAX(ids+1,its)
2370 IF ( config_flags%specified .or. &
2371 config_flags%nested) i_end = MIN(ide-1,ite)
2372 IF ( config_flags%specified .or. &
2373 config_flags%nested) j_start = MAX(jds+1,jts)
2374 IF ( config_flags%specified .or. &
2375 config_flags%nested) j_end = MIN(jde-2,jte)
2376 IF ( config_flags%periodic_x ) i_start = its
2377 IF ( config_flags%periodic_x ) i_end = ite
2379 DO j = j_start,j_end
2381 DO i = i_start,i_end
2382 lvar(i,k,j) = lvar(i,k,j) + &
2383 0.5*(rvar(i,k,j)+rvar(i-1,k,j))
2388 END SUBROUTINE add_a2c_u
2390 !------------------------------------------------------------
2391 SUBROUTINE add_a2c_v(lvar,rvar,config_flags, &
2392 ids,ide, jds, jde, kds, kde, &
2393 ims, ime, jms, jme, kms, kme, &
2394 its, ite, jts, jte, kts, kte )
2395 !------------------------------------------------------------
2396 !------------------------------------------------------------
2398 !------------------------------------------------------------
2400 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
2402 INTEGER , INTENT(IN ) :: ids, ide, jds, jde, kds, kde, &
2403 ims, ime, jms, jme, kms, kme, &
2404 its, ite, jts, jte, kts, kte
2406 REAL, DIMENSION(ims:ime,kms:kme,jms:jme),INTENT(IN ) ::&
2408 REAL, DIMENSION(ims:ime,kms:kme,jms:jme),INTENT(INOUT) ::&
2413 INTEGER :: i,j,k,i_start,i_end,j_start,j_end,ktf
2418 i_end = MIN(ite,ide-1)
2422 IF ( config_flags%specified .or. &
2423 config_flags%nested) i_start = MAX(ids+1,its)
2424 IF ( config_flags%specified .or. &
2425 config_flags%nested) i_end = MIN(ide-2,ite)
2426 IF ( config_flags%specified .or. &
2427 config_flags%nested) j_start = MAX(jds+1,jts)
2428 IF ( config_flags%specified .or. &
2429 config_flags%nested) j_end = MIN(jde-1,jte)
2430 IF ( config_flags%periodic_x ) i_start = its
2431 IF ( config_flags%periodic_x ) i_end = MIN( ite, ide-1 )
2433 DO j = j_start,j_end
2435 DO i = i_start,i_end
2436 lvar(i,k,j) = lvar(i,k,j) + &
2437 0.5*(rvar(i,k,j)+rvar(i,k,j-1))
2442 END SUBROUTINE add_a2c_v
2444 !------------------------------------------------------------
2445 SUBROUTINE add_c2c_u(lvar,rvar,config_flags, &
2446 ids,ide, jds, jde, kds, kde, &
2447 ims, ime, jms, jme, kms, kme, &
2448 its, ite, jts, jte, kts, kte )
2449 !------------------------------------------------------------
2450 !------------------------------------------------------------
2452 !------------------------------------------------------------
2454 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
2456 INTEGER , INTENT(IN ) :: ids, ide, jds, jde, kds, kde, &
2457 ims, ime, jms, jme, kms, kme, &
2458 its, ite, jts, jte, kts, kte
2460 REAL, DIMENSION(ims:ime,kms:kme,jms:jme),INTENT(IN ) ::&
2462 REAL, DIMENSION(ims:ime,kms:kme,jms:jme),INTENT(INOUT) ::&
2467 INTEGER :: i,j,k,i_start,i_end,j_start,j_end,ktf
2474 j_end = MIN(jte,jde-1)
2477 IF ( config_flags%specified .or. &
2478 config_flags%nested) i_start = MAX(ids+1,its)
2479 IF ( config_flags%specified .or. &
2480 config_flags%nested) i_end = MIN(ide-1,ite)
2481 IF ( config_flags%specified .or. &
2482 config_flags%nested) j_start = MAX(jds+1,jts)
2483 IF ( config_flags%specified .or. &
2484 config_flags%nested) j_end = MIN(jde-2,jte)
2486 ! write(*,'(a,6i4)') 'call c2cu, i_start, i_end, j_start, j_end=', i_start, i_end, j_start, j_end
2488 DO j = j_start,j_end
2490 DO i = i_start,i_end
2491 lvar(i,k,j) = lvar(i,k,j) + rvar(i,k,j)
2496 END SUBROUTINE add_c2c_u
2498 SUBROUTINE add_c2c_v(lvar,rvar,config_flags, &
2499 ids,ide, jds, jde, kds, kde, &
2500 ims, ime, jms, jme, kms, kme, &
2501 its, ite, jts, jte, kts, kte )
2502 !------------------------------------------------------------
2503 !------------------------------------------------------------
2505 !------------------------------------------------------------
2507 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
2509 INTEGER , INTENT(IN ) :: ids, ide, jds, jde, kds, kde, &
2510 ims, ime, jms, jme, kms, kme, &
2511 its, ite, jts, jte, kts, kte
2513 REAL, DIMENSION(ims:ime,kms:kme,jms:jme),INTENT(IN ) ::&
2515 REAL, DIMENSION(ims:ime,kms:kme,jms:jme),INTENT(INOUT) ::&
2520 INTEGER :: i,j,k,i_start,i_end,j_start,j_end,ktf
2525 i_end = MIN(ite,ide-1)
2529 IF ( config_flags%specified .or. &
2530 config_flags%nested) i_start = MAX(ids+1,its)
2531 IF ( config_flags%specified .or. &
2532 config_flags%nested) i_end = MIN(ide-2,ite)
2533 IF ( config_flags%specified .or. &
2534 config_flags%nested) j_start = MAX(jds+1,jts)
2535 IF ( config_flags%specified .or. &
2536 config_flags%nested) j_end = MIN(jde-1,jte)
2538 ! write(*,'(a,6i4)') 'call c2cv, i_start, i_end, j_start, j_end=', i_start, i_end, j_start, j_end
2540 DO j = j_start,j_end
2542 DO i = i_start,i_end
2543 lvar(i,k,j) = lvar(i,k,j) + rvar(i,k,j)
2548 END SUBROUTINE add_c2c_v
2552 END MODULE module_physics_addtendc