26 #if defined DEBUG || defined QUICKDEBUG
56 real(RP),
private,
allocatable :: DENS_RK1(:,:,:)
57 real(RP),
private,
allocatable :: MOMZ_RK1(:,:,:)
58 real(RP),
private,
allocatable :: MOMX_RK1(:,:,:)
59 real(RP),
private,
allocatable :: MOMY_RK1(:,:,:)
60 real(RP),
private,
allocatable :: RHOT_RK1(:,:,:)
61 real(RP),
private,
allocatable :: PROG_RK1(:,:,:,:)
62 real(RP),
private,
allocatable :: DENS_RK2(:,:,:)
63 real(RP),
private,
allocatable :: MOMZ_RK2(:,:,:)
64 real(RP),
private,
allocatable :: MOMX_RK2(:,:,:)
65 real(RP),
private,
allocatable :: MOMY_RK2(:,:,:)
66 real(RP),
private,
allocatable :: RHOT_RK2(:,:,:)
67 real(RP),
private,
allocatable :: PROG_RK2(:,:,:,:)
70 integer :: I_COMM_DENS_RK1
71 integer :: I_COMM_MOMZ_RK1
72 integer :: I_COMM_MOMX_RK1
73 integer :: I_COMM_MOMY_RK1
74 integer :: I_COMM_RHOT_RK1
75 integer,
allocatable :: I_COMM_PROG_RK1(:)
77 integer :: I_COMM_DENS_RK2
78 integer :: I_COMM_MOMZ_RK2
79 integer :: I_COMM_MOMX_RK2
80 integer :: I_COMM_MOMY_RK2
81 integer :: I_COMM_RHOT_RK2
82 integer,
allocatable :: I_COMM_PROG_RK2(:)
84 logical :: FLAG_WS2002
102 character(len=*) :: tinteg_type
107 select case( tinteg_type )
109 log_info(
"ATMOS_DYN_Tinteg_short_rk3_setup",*)
"RK3: Heun's method is used"
117 flag_ws2002 = .false.
118 fact_dt1 = 1.0_rp / 3.0_rp
119 fact_dt2 = 2.0_rp / 3.0_rp
121 log_info(
"ATMOS_DYN_Tinteg_short_rk3_setup",*)
"RK3: Wicker and Skamarock (2002) is used"
129 fact_dt1 = 1.0_rp / 3.0_rp
130 fact_dt2 = 1.0_rp / 2.0_rp
132 log_error(
"ATMOS_DYN_Tinteg_short_rk3_setup",*)
'TINTEG_TYPE is not RK3. Check!'
136 allocate( dens_rk1(
ka,
ia,
ja) )
137 allocate( momz_rk1(
ka,
ia,
ja) )
138 allocate( momx_rk1(
ka,
ia,
ja) )
139 allocate( momy_rk1(
ka,
ia,
ja) )
140 allocate( rhot_rk1(
ka,
ia,
ja) )
142 allocate( dens_rk2(
ka,
ia,
ja) )
143 allocate( momz_rk2(
ka,
ia,
ja) )
144 allocate( momx_rk2(
ka,
ia,
ja) )
145 allocate( momy_rk2(
ka,
ia,
ja) )
146 allocate( rhot_rk2(
ka,
ia,
ja) )
148 allocate( prog_rk1(
ka,
ia,
ja,max(
va,1)) )
149 allocate( prog_rk2(
ka,
ia,
ja,max(
va,1)) )
150 allocate( i_comm_prog_rk1(max(
va,1)) )
151 allocate( i_comm_prog_rk2(max(
va,1)) )
164 i_comm_prog_rk1(iv) = 5 + iv
165 call comm_vars8_init(
'PROG_RK1', prog_rk1(:,:,:,iv), i_comm_prog_rk1(iv) )
180 i_comm_prog_rk2(iv) = 5 + iv
181 call comm_vars8_init(
'PROG_RK2', prog_rk2(:,:,:,iv), i_comm_prog_rk2(iv) )
184 dens_rk1(:,:,:) = undef
185 momz_rk1(:,:,:) = undef
186 momx_rk1(:,:,:) = undef
187 momy_rk1(:,:,:) = undef
188 rhot_rk1(:,:,:) = undef
189 if (
va > 0 ) prog_rk1(:,:,:,:) = undef
191 dens_rk2(:,:,:) = undef
192 momz_rk2(:,:,:) = undef
193 momx_rk2(:,:,:) = undef
194 momy_rk2(:,:,:) = undef
195 rhot_rk2(:,:,:) = undef
196 if (
va > 0 ) prog_rk2(:,:,:,:) = undef
205 deallocate( dens_rk1 )
206 deallocate( momz_rk1 )
207 deallocate( momx_rk1 )
208 deallocate( momy_rk1 )
209 deallocate( rhot_rk1 )
211 deallocate( dens_rk2 )
212 deallocate( momz_rk2 )
213 deallocate( momx_rk2 )
214 deallocate( momy_rk2 )
215 deallocate( rhot_rk2 )
217 deallocate( prog_rk1 )
218 deallocate( prog_rk2 )
219 deallocate( i_comm_prog_rk1 )
220 deallocate( i_comm_prog_rk2 )
227 DENS, MOMZ, MOMX, MOMY, RHOT, PROG, &
229 DENS_t, MOMZ_t, MOMX_t, MOMY_t, RHOT_t, &
230 DPRES0, CVtot, CORIOLI, &
231 num_diff, wdamp_coef, divdmp_coef, DDIV, &
232 FLAG_FCT_MOMENTUM, FLAG_FCT_T, &
233 FLAG_FCT_ALONG_STREAM, &
234 CDZ, FDZ, FDX, FDY, &
235 RCDZ, RCDX, RCDY, RFDZ, RFDX, RFDY, &
236 PHI, GSQRT, J13G, J23G, J33G, MAPF, &
237 REF_pres, REF_dens, &
238 BND_W, BND_E, BND_S, BND_N, TwoD, &
249 real(rp),
intent(inout) :: dens(
ka,
ia,
ja)
250 real(rp),
intent(inout) :: momz(
ka,
ia,
ja)
251 real(rp),
intent(inout) :: momx(
ka,
ia,
ja)
252 real(rp),
intent(inout) :: momy(
ka,
ia,
ja)
253 real(rp),
intent(inout) :: rhot(
ka,
ia,
ja)
254 real(rp),
intent(inout) :: prog(
ka,
ia,
ja,
va)
256 real(rp),
intent(inout) :: mflx_hi(
ka,
ia,
ja,3)
257 real(rp),
intent(out ) :: tflx_hi(
ka,
ia,
ja,3)
259 real(rp),
intent(in) :: dens_t(
ka,
ia,
ja)
260 real(rp),
intent(in) :: momz_t(
ka,
ia,
ja)
261 real(rp),
intent(in) :: momx_t(
ka,
ia,
ja)
262 real(rp),
intent(in) :: momy_t(
ka,
ia,
ja)
263 real(rp),
intent(in) :: rhot_t(
ka,
ia,
ja)
265 real(rp),
intent(in) :: dpres0(
ka,
ia,
ja)
266 real(rp),
intent(in) :: cvtot(
ka,
ia,
ja)
267 real(rp),
intent(in) :: corioli(
ia,
ja)
268 real(rp),
intent(in) :: num_diff(
ka,
ia,
ja,5,3)
269 real(rp),
intent(in) :: wdamp_coef(
ka)
270 real(rp),
intent(in) :: divdmp_coef
271 real(rp),
intent(in) :: ddiv(
ka,
ia,
ja)
273 logical,
intent(in) :: flag_fct_momentum
274 logical,
intent(in) :: flag_fct_t
275 logical,
intent(in) :: flag_fct_along_stream
277 real(rp),
intent(in) :: cdz (
ka)
278 real(rp),
intent(in) :: fdz (
ka-1)
279 real(rp),
intent(in) :: fdx (
ia-1)
280 real(rp),
intent(in) :: fdy (
ja-1)
281 real(rp),
intent(in) :: rcdz(
ka)
282 real(rp),
intent(in) :: rcdx(
ia)
283 real(rp),
intent(in) :: rcdy(
ja)
284 real(rp),
intent(in) :: rfdz(
ka-1)
285 real(rp),
intent(in) :: rfdx(
ia-1)
286 real(rp),
intent(in) :: rfdy(
ja-1)
288 real(rp),
intent(in) :: phi (
ka,
ia,
ja)
289 real(rp),
intent(in) :: gsqrt(
ka,
ia,
ja,7)
290 real(rp),
intent(in) :: j13g (
ka,
ia,
ja,7)
291 real(rp),
intent(in) :: j23g (
ka,
ia,
ja,7)
292 real(rp),
intent(in) :: j33g
293 real(rp),
intent(in) :: mapf (
ia,
ja,2,4)
295 real(rp),
intent(in) :: ref_pres(
ka,
ia,
ja)
296 real(rp),
intent(in) :: ref_dens(
ka,
ia,
ja)
298 logical,
intent(in) :: bnd_w
299 logical,
intent(in) :: bnd_e
300 logical,
intent(in) :: bnd_s
301 logical,
intent(in) :: bnd_n
302 logical,
intent(in) :: twod
304 real(rp),
intent(in) :: dt
306 real(rp) :: dens0(
ka,
ia,
ja)
307 real(rp) :: momz0(
ka,
ia,
ja)
308 real(rp) :: momx0(
ka,
ia,
ja)
309 real(rp) :: momy0(
ka,
ia,
ja)
310 real(rp) :: rhot0(
ka,
ia,
ja)
313 real(rp) :: mflx_hi_rk(
ka,
ia,
ja,3,2)
314 real(rp) :: tflx_hi_rk(
ka,
ia,
ja,3,2)
318 integer :: i, j,
k, iv, n
324 dens_rk1(:,:,:) = undef
325 momz_rk1(:,:,:) = undef
326 momx_rk1(:,:,:) = undef
327 momy_rk1(:,:,:) = undef
328 rhot_rk1(:,:,:) = undef
329 if (
va > 0 ) prog_rk1(:,:,:,:) = undef
331 dens_rk2(:,:,:) = undef
332 momz_rk2(:,:,:) = undef
333 momx_rk2(:,:,:) = undef
334 momy_rk2(:,:,:) = undef
335 rhot_rk2(:,:,:) = undef
336 if (
va > 0 ) prog_rk2(:,:,:,:) = undef
338 mflx_hi_rk(:,:,:,:,:) = undef
339 tflx_hi_rk(:,:,:,:,:) = undef
343 mflx_hi( 1:
ks-1,:,:,:) = undef
344 mflx_hi(
ke+1:
ka ,:,:,:) = undef
358 if (
va > 0 ) prog0 = prog
360 if ( bnd_w .and. (.not. twod) )
then
363 mflx_hi_rk(
k,
is-1,j,2,:) = mflx_hi(
k,
is-1,j,2)
367 if ( bnd_e .and. (.not. twod) )
then
370 mflx_hi_rk(
k,
ie,j,2,:) = mflx_hi(
k,
ie,j,2)
377 mflx_hi_rk(
k,i,
js-1,3,:) = mflx_hi(
k,i,
js-1,3)
384 mflx_hi_rk(
k,i,
je,3,:) = mflx_hi(
k,i,
je,3)
401 call atmos_dyn_tstep( dens_rk1, momz_rk1, momx_rk1, momy_rk1, rhot_rk1, &
403 mflx_hi_rk(:,:,:,:,1), tflx_hi_rk(:,:,:,:,1), &
404 dens0, momz0, momx0, momy0, rhot0, &
405 dens, momz, momx, momy, rhot, &
406 dens_t, momz_t, momx_t, momy_t, rhot_t, &
408 dpres0, cvtot, corioli, &
409 num_diff, wdamp_coef, divdmp_coef, ddiv, &
410 flag_fct_momentum, flag_fct_t, &
411 flag_fct_along_stream, &
412 cdz, fdz, fdx, fdy, &
413 rcdz, rcdx, rcdy, rfdz, rfdx, rfdy, &
414 phi, gsqrt, j13g, j23g, j33g, mapf, &
415 ref_pres, ref_dens, &
416 bnd_w, bnd_e, bnd_s, bnd_n, twod, &
424 dens0, momz0, momx0, momy0, rhot0, &
426 bnd_w, bnd_e, bnd_s, bnd_n, twod )
430 call comm_vars8( dens_rk1(:,:,:), i_comm_dens_rk1 )
431 call comm_vars8( momz_rk1(:,:,:), i_comm_momz_rk1 )
432 call comm_vars8( momx_rk1(:,:,:), i_comm_momx_rk1 )
433 call comm_vars8( momy_rk1(:,:,:), i_comm_momy_rk1 )
434 call comm_vars8( rhot_rk1(:,:,:), i_comm_rhot_rk1 )
436 call comm_vars8( prog_rk1(:,:,:,iv), i_comm_prog_rk1(iv) )
439 call comm_wait ( dens_rk1(:,:,:), i_comm_dens_rk1, .false. )
440 call comm_wait ( momz_rk1(:,:,:), i_comm_momz_rk1, .false. )
441 call comm_wait ( momx_rk1(:,:,:), i_comm_momx_rk1, .false. )
442 call comm_wait ( momy_rk1(:,:,:), i_comm_momy_rk1, .false. )
443 call comm_wait ( rhot_rk1(:,:,:), i_comm_rhot_rk1, .false. )
445 call comm_wait ( prog_rk1(:,:,:,iv), i_comm_prog_rk1(iv), .false. )
454 call atmos_dyn_tstep( dens_rk2, momz_rk2, momx_rk2, momy_rk2, rhot_rk2, &
456 mflx_hi_rk(:,:,:,:,2), tflx_hi_rk(:,:,:,:,2), &
457 dens0, momz0, momx0, momy0, rhot0, &
458 dens_rk1, momz_rk1, momx_rk1, momy_rk1, rhot_rk1, &
459 dens_t, momz_t, momx_t, momy_t, rhot_t, &
461 dpres0, cvtot, corioli, &
462 num_diff, wdamp_coef, divdmp_coef, ddiv, &
463 flag_fct_momentum, flag_fct_t, &
464 flag_fct_along_stream, &
465 cdz, fdz, fdx, fdy, &
466 rcdz, rcdx, rcdy, rfdz, rfdx, rfdy, &
467 phi, gsqrt, j13g, j23g, j33g, mapf, &
468 ref_pres, ref_dens, &
469 bnd_w, bnd_e, bnd_s, bnd_n, twod, &
477 dens0, momz0, momx0, momy0, rhot0, &
479 bnd_w, bnd_e, bnd_s, bnd_n, twod )
483 call comm_vars8( dens_rk2(:,:,:), i_comm_dens_rk2 )
484 call comm_vars8( momz_rk2(:,:,:), i_comm_momz_rk2 )
485 call comm_vars8( momx_rk2(:,:,:), i_comm_momx_rk2 )
486 call comm_vars8( momy_rk2(:,:,:), i_comm_momy_rk2 )
487 call comm_vars8( rhot_rk2(:,:,:), i_comm_rhot_rk2 )
489 call comm_vars8( prog_rk2(:,:,:,iv), i_comm_prog_rk2(iv) )
492 call comm_wait ( dens_rk2(:,:,:), i_comm_dens_rk2, .false. )
493 call comm_wait ( momz_rk2(:,:,:), i_comm_momz_rk2, .false. )
494 call comm_wait ( momx_rk2(:,:,:), i_comm_momx_rk2, .false. )
495 call comm_wait ( momy_rk2(:,:,:), i_comm_momy_rk2, .false. )
496 call comm_wait ( rhot_rk2(:,:,:), i_comm_rhot_rk2, .false. )
498 call comm_wait ( prog_rk2(:,:,:,iv), i_comm_prog_rk2(iv), .false. )
507 call atmos_dyn_tstep( dens, momz, momx, momy, rhot, &
510 dens0, momz0, momx0, momy0, rhot0, &
511 dens_rk2, momz_rk2, momx_rk2, momy_rk2, rhot_rk2, &
512 dens_t, momz_t, momx_t, momy_t, rhot_t, &
514 dpres0, cvtot, corioli, &
515 num_diff, wdamp_coef, divdmp_coef, ddiv, &
516 flag_fct_momentum, flag_fct_t, &
517 flag_fct_along_stream, &
518 cdz, fdz, fdx, fdy, &
519 rcdz, rcdx, rcdy, rfdz, rfdx, rfdy, &
520 phi, gsqrt, j13g, j23g, j33g, mapf, &
521 ref_pres, ref_dens, &
522 bnd_w, bnd_e, bnd_s, bnd_n, twod, &
525 if ( .NOT. flag_ws2002 )
then
529 dens(
k,i,j) = ( dens_rk1(
k,i,j) * 3.0_rp &
530 + dens(
k,i,j) * 3.0_rp &
531 - dens0(
k,i,j) * 2.0_rp ) / 4.0_rp
539 momz(
k,i,j) = ( momz_rk1(
k,i,j) * 3.0_rp &
540 + momz(
k,i,j) * 3.0_rp &
541 - momz0(
k,i,j) * 2.0_rp ) / 4.0_rp
549 momx(
k,i,j) = ( momx_rk1(
k,i,j) * 3.0_rp &
550 + momx(
k,i,j) * 3.0_rp &
551 - momx0(
k,i,j) * 2.0_rp ) / 4.0_rp
559 momy(
k,i,j) = ( momy_rk1(
k,i,j) * 3.0_rp &
560 + momy(
k,i,j) * 3.0_rp &
561 - momy0(
k,i,j) * 2.0_rp ) / 4.0_rp
569 rhot(
k,i,j) = ( rhot_rk1(
k,i,j) * 3.0_rp &
570 + rhot(
k,i,j) * 3.0_rp &
571 - rhot0(
k,i,j) * 2.0_rp ) / 4.0_rp
580 prog(
k,i,j,iv) = ( prog_rk1(
k,i,j,iv) * 3.0_rp &
581 + prog(
k,i,j,iv) * 3.0_rp &
582 - prog0(
k,i,j,iv) * 2.0_rp ) / 4.0_rp
592 mflx_hi(
k,i,j,n) = ( mflx_hi_rk(
k,i,j,n,1) &
593 + mflx_hi(
k,i,j,n ) * 3.0_rp ) / 4.0_rp
603 tflx_hi(
k,i,j,n) = ( tflx_hi_rk(
k,i,j,n,1) &
604 + tflx_hi(
k,i,j,n ) * 3.0_rp ) / 4.0_rp