31 #if defined DEBUG || defined QUICKDEBUG
61 real(RP),
private,
allocatable :: DENS_RK1(:,:,:)
62 real(RP),
private,
allocatable :: MOMZ_RK1(:,:,:)
63 real(RP),
private,
allocatable :: MOMX_RK1(:,:,:)
64 real(RP),
private,
allocatable :: MOMY_RK1(:,:,:)
65 real(RP),
private,
allocatable :: RHOT_RK1(:,:,:)
66 real(RP),
private,
allocatable :: PROG_RK1(:,:,:,:)
67 real(RP),
private,
allocatable :: DENS_RK2(:,:,:)
68 real(RP),
private,
allocatable :: MOMZ_RK2(:,:,:)
69 real(RP),
private,
allocatable :: MOMX_RK2(:,:,:)
70 real(RP),
private,
allocatable :: MOMY_RK2(:,:,:)
71 real(RP),
private,
allocatable :: RHOT_RK2(:,:,:)
72 real(RP),
private,
allocatable :: PROG_RK2(:,:,:,:)
73 real(RP),
private,
allocatable :: DENS_RK3(:,:,:)
74 real(RP),
private,
allocatable :: MOMZ_RK3(:,:,:)
75 real(RP),
private,
allocatable :: MOMX_RK3(:,:,:)
76 real(RP),
private,
allocatable :: MOMY_RK3(:,:,:)
77 real(RP),
private,
allocatable :: RHOT_RK3(:,:,:)
78 real(RP),
private,
allocatable :: PROG_RK3(:,:,:,:)
81 integer :: I_COMM_DENS_RK1 = 1
82 integer :: I_COMM_MOMZ_RK1 = 2
83 integer :: I_COMM_MOMX_RK1 = 3
84 integer :: I_COMM_MOMY_RK1 = 4
85 integer :: I_COMM_RHOT_RK1 = 5
86 integer,
allocatable :: I_COMM_PROG_RK1(:)
88 integer :: I_COMM_DENS_RK2 = 1
89 integer :: I_COMM_MOMZ_RK2 = 2
90 integer :: I_COMM_MOMX_RK2 = 3
91 integer :: I_COMM_MOMY_RK2 = 4
92 integer :: I_COMM_RHOT_RK2 = 5
93 integer,
allocatable :: I_COMM_PROG_RK2(:)
95 integer :: I_COMM_DENS_RK3 = 1
96 integer :: I_COMM_MOMZ_RK3 = 2
97 integer :: I_COMM_MOMX_RK3 = 3
98 integer :: I_COMM_MOMY_RK3 = 4
99 integer :: I_COMM_RHOT_RK3 = 5
100 integer,
allocatable :: I_COMM_PROG_RK3(:)
116 character(len=*) :: tinteg_type
121 if ( tinteg_type /=
'RK4' )
then
122 log_error(
"ATMOS_DYN_Tinteg_short_rk4_setup",*)
'TINTEG_TYPE is not RK4. Check!'
126 allocate( dens_rk1(
ka,
ia,
ja) )
127 allocate( momz_rk1(
ka,
ia,
ja) )
128 allocate( momx_rk1(
ka,
ia,
ja) )
129 allocate( momy_rk1(
ka,
ia,
ja) )
130 allocate( rhot_rk1(
ka,
ia,
ja) )
133 allocate( dens_rk2(
ka,
ia,
ja) )
134 allocate( momz_rk2(
ka,
ia,
ja) )
135 allocate( momx_rk2(
ka,
ia,
ja) )
136 allocate( momy_rk2(
ka,
ia,
ja) )
137 allocate( rhot_rk2(
ka,
ia,
ja) )
140 allocate( dens_rk3(
ka,
ia,
ja) )
141 allocate( momz_rk3(
ka,
ia,
ja) )
142 allocate( momx_rk3(
ka,
ia,
ja) )
143 allocate( momy_rk3(
ka,
ia,
ja) )
144 allocate( rhot_rk3(
ka,
ia,
ja) )
147 allocate( prog_rk1(
ka,
ia,
ja,max(
va,1)) )
148 allocate( prog_rk2(
ka,
ia,
ja,max(
va,1)) )
149 allocate( prog_rk3(
ka,
ia,
ja,max(
va,1)) )
150 allocate( i_comm_prog_rk1(max(
va,1)) )
151 allocate( i_comm_prog_rk2(max(
va,1)) )
152 allocate( i_comm_prog_rk3(max(
va,1)) )
166 i_comm_prog_rk1(iv) = 5 + iv
167 call comm_vars8_init(
'PROG_RK1', prog_rk1(:,:,:,iv), i_comm_prog_rk1(iv) )
181 i_comm_prog_rk2(iv) = 5 + iv
182 call comm_vars8_init(
'PROG_RK2', prog_rk2(:,:,:,iv), i_comm_prog_rk2(iv) )
196 i_comm_prog_rk3(iv) = 5 + iv
197 call comm_vars8_init(
'PROG_RK3', prog_rk3(:,:,:,iv), i_comm_prog_rk3(iv) )
200 dens_rk1(:,:,:) = undef
201 momz_rk1(:,:,:) = undef
202 momx_rk1(:,:,:) = undef
203 momy_rk1(:,:,:) = undef
204 rhot_rk1(:,:,:) = undef
205 if (
va > 0 ) prog_rk1(:,:,:,:) = undef
207 dens_rk2(:,:,:) = undef
208 momz_rk2(:,:,:) = undef
209 momx_rk2(:,:,:) = undef
210 momy_rk2(:,:,:) = undef
211 rhot_rk2(:,:,:) = undef
212 if (
va > 0 ) prog_rk2(:,:,:,:) = undef
214 dens_rk3(:,:,:) = undef
215 momz_rk3(:,:,:) = undef
216 momx_rk3(:,:,:) = undef
217 momy_rk3(:,:,:) = undef
218 rhot_rk3(:,:,:) = undef
219 if (
va > 0 ) prog_rk3(:,:,:,:) = undef
229 deallocate( dens_rk1 )
230 deallocate( momz_rk1 )
231 deallocate( momx_rk1 )
232 deallocate( momy_rk1 )
233 deallocate( rhot_rk1 )
236 deallocate( dens_rk2 )
237 deallocate( momz_rk2 )
238 deallocate( momx_rk2 )
239 deallocate( momy_rk2 )
240 deallocate( rhot_rk2 )
243 deallocate( dens_rk3 )
244 deallocate( momz_rk3 )
245 deallocate( momx_rk3 )
246 deallocate( momy_rk3 )
247 deallocate( rhot_rk3 )
250 deallocate( prog_rk1 )
251 deallocate( prog_rk2 )
252 deallocate( prog_rk3 )
253 deallocate( i_comm_prog_rk1 )
254 deallocate( i_comm_prog_rk2 )
255 deallocate( i_comm_prog_rk3 )
262 DENS, MOMZ, MOMX, MOMY, RHOT, PROG, &
264 DENS_t, MOMZ_t, MOMX_t, MOMY_t, RHOT_t, &
265 DPRES0, CVtot, CORIOLI, &
266 num_diff, wdamp_coef, divdmp_coef, DDIV, &
267 FLAG_FCT_MOMENTUM, FLAG_FCT_T, &
268 FLAG_FCT_ALONG_STREAM, &
269 CDZ, FDZ, FDX, FDY, &
270 RCDZ, RCDX, RCDY, RFDZ, RFDX, RFDY, &
271 PHI, GSQRT, J13G, J23G, J33G, MAPF, &
272 REF_pres, REF_dens, &
273 BND_W, BND_E, BND_S, BND_N, TwoD, &
284 real(rp),
intent(inout) :: dens(
ka,
ia,
ja)
285 real(rp),
intent(inout) :: momz(
ka,
ia,
ja)
286 real(rp),
intent(inout) :: momx(
ka,
ia,
ja)
287 real(rp),
intent(inout) :: momy(
ka,
ia,
ja)
288 real(rp),
intent(inout) :: rhot(
ka,
ia,
ja)
289 real(rp),
intent(inout) :: prog(
ka,
ia,
ja,
va)
291 real(rp),
intent(inout) :: mflx_hi(
ka,
ia,
ja,3)
292 real(rp),
intent(out) :: tflx_hi(
ka,
ia,
ja,3)
294 real(rp),
intent(in) :: dens_t(
ka,
ia,
ja)
295 real(rp),
intent(in) :: momz_t(
ka,
ia,
ja)
296 real(rp),
intent(in) :: momx_t(
ka,
ia,
ja)
297 real(rp),
intent(in) :: momy_t(
ka,
ia,
ja)
298 real(rp),
intent(in) :: rhot_t(
ka,
ia,
ja)
300 real(rp),
intent(in) :: dpres0(
ka,
ia,
ja)
301 real(rp),
intent(in) :: cvtot(
ka,
ia,
ja)
302 real(rp),
intent(in) :: corioli(
ia,
ja)
303 real(rp),
intent(in) :: num_diff(
ka,
ia,
ja,5,3)
304 real(rp),
intent(in) :: wdamp_coef(
ka)
305 real(rp),
intent(in) :: divdmp_coef
306 real(rp),
intent(in) :: ddiv(
ka,
ia,
ja)
308 logical,
intent(in) :: flag_fct_momentum
309 logical,
intent(in) :: flag_fct_t
310 logical,
intent(in) :: flag_fct_along_stream
312 real(rp),
intent(in) :: cdz (
ka)
313 real(rp),
intent(in) :: fdz (
ka-1)
314 real(rp),
intent(in) :: fdx (
ia-1)
315 real(rp),
intent(in) :: fdy (
ja-1)
316 real(rp),
intent(in) :: rcdz(
ka)
317 real(rp),
intent(in) :: rcdx(
ia)
318 real(rp),
intent(in) :: rcdy(
ja)
319 real(rp),
intent(in) :: rfdz(
ka-1)
320 real(rp),
intent(in) :: rfdx(
ia-1)
321 real(rp),
intent(in) :: rfdy(
ja-1)
323 real(rp),
intent(in) :: phi (
ka,
ia,
ja)
324 real(rp),
intent(in) :: gsqrt(
ka,
ia,
ja,7)
325 real(rp),
intent(in) :: j13g (
ka,
ia,
ja,7)
326 real(rp),
intent(in) :: j23g (
ka,
ia,
ja,7)
327 real(rp),
intent(in) :: j33g
328 real(rp),
intent(in) :: mapf (
ia,
ja,2,4)
330 real(rp),
intent(in) :: ref_pres(
ka,
ia,
ja)
331 real(rp),
intent(in) :: ref_dens(
ka,
ia,
ja)
333 logical,
intent(in) :: bnd_w
334 logical,
intent(in) :: bnd_e
335 logical,
intent(in) :: bnd_s
336 logical,
intent(in) :: bnd_n
337 logical,
intent(in) :: twod
339 real(rp),
intent(in) :: dt
341 real(rp) :: dens0(
ka,
ia,
ja)
342 real(rp) :: momz0(
ka,
ia,
ja)
343 real(rp) :: momx0(
ka,
ia,
ja)
344 real(rp) :: momy0(
ka,
ia,
ja)
345 real(rp) :: rhot0(
ka,
ia,
ja)
348 real(rp) :: mflx_hi_rk(
ka,
ia,
ja,3,3)
349 real(rp) :: tflx_hi_rk(
ka,
ia,
ja,3,3)
353 integer :: i, j,
k, iv, n
369 dens_rk1(:,:,:) = undef
370 momz_rk1(:,:,:) = undef
371 momx_rk1(:,:,:) = undef
372 momy_rk1(:,:,:) = undef
373 rhot_rk1(:,:,:) = undef
374 if (
va > 0 ) prog_rk1(:,:,:,:) = undef
376 dens_rk2(:,:,:) = undef
377 momz_rk2(:,:,:) = undef
378 momx_rk2(:,:,:) = undef
379 momy_rk2(:,:,:) = undef
380 rhot_rk2(:,:,:) = undef
381 if (
va > 0 ) prog_rk2(:,:,:,:) = undef
383 dens_rk3(:,:,:) = undef
384 momz_rk3(:,:,:) = undef
385 momx_rk3(:,:,:) = undef
386 momy_rk3(:,:,:) = undef
387 rhot_rk3(:,:,:) = undef
388 if (
va > 0 ) prog_rk3(:,:,:,:) = undef
390 mflx_hi_rk(:,:,:,:,:) = undef
391 tflx_hi_rk(:,:,:,:,:) = undef
397 mflx_hi( 1:
ks-1,:,:,:) = undef
398 mflx_hi(
ke+1:
ka ,:,:,:) = undef
404 dens0(:,:,:) = dens(:,:,:)
408 momz0(:,:,:) = momz(:,:,:)
412 momx0(:,:,:) = momx(:,:,:)
416 momy0(:,:,:) = momy(:,:,:)
420 rhot0(:,:,:) = rhot(:,:,:)
425 prog0(:,:,:,:) = prog(:,:,:,:)
429 if ( bnd_w .and. (.not. twod) )
then
433 mflx_hi_rk(
k,
is-1,j,2,:) = mflx_hi(
k,
is-1,j,2)
438 if ( bnd_e .and. (.not. twod) )
then
442 mflx_hi_rk(
k,
ie,j,2,:) = mflx_hi(
k,
ie,j,2)
451 mflx_hi_rk(
k,i,
js-1,3,:) = mflx_hi(
k,i,
js-1,3)
460 mflx_hi_rk(
k,i,
je,3,:) = mflx_hi(
k,i,
je,3)
478 call atmos_dyn_tstep( dens_rk1, momz_rk1, momx_rk1, momy_rk1, rhot_rk1, &
480 mflx_hi_rk(:,:,:,:,1), tflx_hi_rk(:,:,:,:,1), &
481 dens0, momz0, momx0, momy0, rhot0, &
482 dens, momz, momx, momy, rhot, &
483 dens_t, momz_t, momx_t, momy_t, rhot_t, &
485 dpres0, cvtot, corioli, &
486 num_diff, wdamp_coef, divdmp_coef, ddiv, &
487 flag_fct_momentum, flag_fct_t, &
488 flag_fct_along_stream, &
489 cdz, fdz, fdx, fdy, &
490 rcdz, rcdx, rcdy, rfdz, rfdx, rfdy, &
491 phi, gsqrt, j13g, j23g, j33g, mapf, &
492 ref_pres, ref_dens, &
493 bnd_w, bnd_e, bnd_s, bnd_n, twod, &
501 dens0, momz0, momx0, momy0, rhot0, &
503 bnd_w, bnd_e, bnd_s, bnd_n, twod )
507 call comm_vars8( dens_rk1(:,:,:), i_comm_dens_rk1 )
508 call comm_vars8( momz_rk1(:,:,:), i_comm_momz_rk1 )
509 call comm_vars8( momx_rk1(:,:,:), i_comm_momx_rk1 )
510 call comm_vars8( momy_rk1(:,:,:), i_comm_momy_rk1 )
511 call comm_vars8( rhot_rk1(:,:,:), i_comm_rhot_rk1 )
513 call comm_vars8( prog_rk1(:,:,:,iv), i_comm_prog_rk1(iv) )
516 call comm_wait ( dens_rk1(:,:,:), i_comm_dens_rk1, .false. )
517 call comm_wait ( momz_rk1(:,:,:), i_comm_momz_rk1, .false. )
518 call comm_wait ( momx_rk1(:,:,:), i_comm_momx_rk1, .false. )
519 call comm_wait ( momy_rk1(:,:,:), i_comm_momy_rk1, .false. )
520 call comm_wait ( rhot_rk1(:,:,:), i_comm_rhot_rk1, .false. )
522 call comm_wait ( prog_rk1(:,:,:,iv), i_comm_prog_rk1(iv), .false. )
531 call atmos_dyn_tstep( dens_rk2, momz_rk2, momx_rk2, momy_rk2, rhot_rk2, &
533 mflx_hi_rk(:,:,:,:,2), tflx_hi_rk(:,:,:,:,2), &
534 dens0, momz0, momx0, momy0, rhot0, &
535 dens_rk1, momz_rk1, momx_rk1, momy_rk1, rhot_rk1, &
536 dens_t, momz_t, momx_t, momy_t, rhot_t, &
538 dpres0, cvtot, corioli, &
539 num_diff, wdamp_coef, divdmp_coef, ddiv, &
540 flag_fct_momentum, flag_fct_t, &
541 flag_fct_along_stream, &
542 cdz, fdz, fdx, fdy, &
543 rcdz, rcdx, rcdy, rfdz, rfdx, rfdy, &
544 phi, gsqrt, j13g, j23g, j33g, mapf, &
545 ref_pres, ref_dens, &
546 bnd_w, bnd_e, bnd_s, bnd_n, twod, &
554 dens0, momz0, momx0, momy0, rhot0, &
556 bnd_w, bnd_e, bnd_s, bnd_n, twod )
560 call comm_vars8( dens_rk2(:,:,:), i_comm_dens_rk2 )
561 call comm_vars8( momz_rk2(:,:,:), i_comm_momz_rk2 )
562 call comm_vars8( momx_rk2(:,:,:), i_comm_momx_rk2 )
563 call comm_vars8( momy_rk2(:,:,:), i_comm_momy_rk2 )
564 call comm_vars8( rhot_rk2(:,:,:), i_comm_rhot_rk2 )
566 call comm_vars8( prog_rk2(:,:,:,iv), i_comm_prog_rk2(iv) )
569 call comm_wait ( dens_rk2(:,:,:), i_comm_dens_rk2, .false. )
570 call comm_wait ( momz_rk2(:,:,:), i_comm_momz_rk2, .false. )
571 call comm_wait ( momx_rk2(:,:,:), i_comm_momx_rk2, .false. )
572 call comm_wait ( momy_rk2(:,:,:), i_comm_momy_rk2, .false. )
573 call comm_wait ( rhot_rk2(:,:,:), i_comm_rhot_rk2, .false. )
575 call comm_wait ( prog_rk2(:,:,:,iv), i_comm_prog_rk2(iv), .false. )
584 call atmos_dyn_tstep( dens_rk3, momz_rk3, momx_rk3, momy_rk3, rhot_rk3, &
586 mflx_hi_rk(:,:,:,:,3), tflx_hi_rk(:,:,:,:,3), &
587 dens0, momz0, momx0, momy0, rhot0, &
588 dens_rk2, momz_rk2, momx_rk2, momy_rk2, rhot_rk2, &
589 dens_t, momz_t, momx_t, momy_t, rhot_t, &
591 dpres0, cvtot, corioli, &
592 num_diff, wdamp_coef, divdmp_coef, ddiv, &
593 flag_fct_momentum, flag_fct_t, &
594 flag_fct_along_stream, &
595 cdz, fdz, fdx, fdy, &
596 rcdz, rcdx, rcdy, rfdz, rfdx, rfdy, &
597 phi, gsqrt, j13g, j23g, j33g, mapf, &
598 ref_pres, ref_dens, &
599 bnd_w, bnd_e, bnd_s, bnd_n, twod, &
607 dens0, momz0, momx0, momy0, rhot0, &
609 bnd_w, bnd_e, bnd_s, bnd_n, twod )
613 call comm_vars8( dens_rk3(:,:,:), i_comm_dens_rk3 )
614 call comm_vars8( momz_rk3(:,:,:), i_comm_momz_rk3 )
615 call comm_vars8( momx_rk3(:,:,:), i_comm_momx_rk3 )
616 call comm_vars8( momy_rk3(:,:,:), i_comm_momy_rk3 )
617 call comm_vars8( rhot_rk3(:,:,:), i_comm_rhot_rk3 )
619 call comm_vars8( prog_rk3(:,:,:,iv), i_comm_prog_rk3(iv) )
622 call comm_wait ( dens_rk3(:,:,:), i_comm_dens_rk3, .false. )
623 call comm_wait ( momz_rk3(:,:,:), i_comm_momz_rk3, .false. )
624 call comm_wait ( momx_rk3(:,:,:), i_comm_momx_rk3, .false. )
625 call comm_wait ( momy_rk3(:,:,:), i_comm_momy_rk3, .false. )
626 call comm_wait ( rhot_rk3(:,:,:), i_comm_rhot_rk3, .false. )
628 call comm_wait ( prog_rk3(:,:,:,iv), i_comm_prog_rk3(iv), .false. )
637 call atmos_dyn_tstep( dens, momz, momx, momy, rhot, &
640 dens0, momz0, momx0, momy0, rhot0, &
641 dens_rk3, momz_rk3, momx_rk3, momy_rk3, rhot_rk3, &
642 dens_t, momz_t, momx_t, momy_t, rhot_t, &
644 dpres0, cvtot, corioli, &
645 num_diff, wdamp_coef, divdmp_coef, ddiv, &
646 flag_fct_momentum, flag_fct_t, &
647 flag_fct_along_stream, &
648 cdz, fdz, fdx, fdy, &
649 rcdz, rcdx, rcdy, rfdz, rfdx, rfdy, &
650 phi, gsqrt, j13g, j23g, j33g, mapf, &
651 ref_pres, ref_dens, &
652 bnd_w, bnd_e, bnd_s, bnd_n, twod, &
661 dens(
k,i,j) = ( dens_rk1(
k,i,j) * 2.0_rp &
662 + dens_rk2(
k,i,j) * 4.0_rp &
663 + dens_rk3(
k,i,j) * 2.0_rp &
665 - dens0(
k,i,j) * 3.0_rp ) / 6.0_rp
675 momz(
k,i,j) = ( momz_rk1(
k,i,j) * 2.0_rp &
676 + momz_rk2(
k,i,j) * 4.0_rp &
677 + momz_rk3(
k,i,j) * 2.0_rp &
679 - momz0(
k,i,j) * 3.0_rp ) / 6.0_rp
689 momx(
k,i,j) = ( momx_rk1(
k,i,j) * 2.0_rp &
690 + momx_rk2(
k,i,j) * 4.0_rp &
691 + momx_rk3(
k,i,j) * 2.0_rp &
693 - momx0(
k,i,j) * 3.0_rp ) / 6.0_rp
703 momy(
k,i,j) = ( momy_rk1(
k,i,j) * 2.0_rp &
704 + momy_rk2(
k,i,j) * 4.0_rp &
705 + momy_rk3(
k,i,j) * 2.0_rp &
707 - momy0(
k,i,j) * 3.0_rp ) / 6.0_rp
720 rhot(
k,i,j) = ( rhot_rk1(
k,i,j) * 2.0_rp &
721 + rhot_rk2(
k,i,j) * 4.0_rp &
722 + rhot_rk3(
k,i,j) * 2.0_rp &
724 - rhot0(
k,i,j) * 3.0_rp ) / 6.0_rp
735 prog(
k,i,j,iv) = ( prog_rk1(
k,i,j,iv) * 2.0_rp &
736 + prog_rk2(
k,i,j,iv) * 4.0_rp &
737 + prog_rk3(
k,i,j,iv) * 2.0_rp &
739 - prog0(
k,i,j,iv) * 3.0_rp ) / 6.0_rp
749 dens0, momz0, momx0, momy0, rhot0, &
751 bnd_w, bnd_e, bnd_s, bnd_n, twod )
758 mflx_hi(
k,i,j,n) = ( mflx_hi_rk(
k,i,j,n,1) &
759 + mflx_hi_rk(
k,i,j,n,2) * 2.0_rp &
760 + mflx_hi_rk(
k,i,j,n,3) * 2.0_rp &
761 + mflx_hi(
k,i,j,n ) ) / 6.0_rp
773 tflx_hi(
k,i,j,n) = ( tflx_hi_rk(
k,i,j,n,1) &
774 + tflx_hi_rk(
k,i,j,n,2) * 2.0_rp &
775 + tflx_hi_rk(
k,i,j,n,3) * 2.0_rp &
776 + tflx_hi(
k,i,j,n ) ) / 6.0_rp