31 #if defined DEBUG || defined QUICKDEBUG
60 real(RP),
private,
allocatable :: DENS_RK1(:,:,:)
61 real(RP),
private,
allocatable :: MOMZ_RK1(:,:,:)
62 real(RP),
private,
allocatable :: MOMX_RK1(:,:,:)
63 real(RP),
private,
allocatable :: MOMY_RK1(:,:,:)
64 real(RP),
private,
allocatable :: RHOT_RK1(:,:,:)
65 real(RP),
private,
allocatable :: PROG_RK1(:,:,:,:)
66 real(RP),
private,
allocatable :: DENS_RK2(:,:,:)
67 real(RP),
private,
allocatable :: MOMZ_RK2(:,:,:)
68 real(RP),
private,
allocatable :: MOMX_RK2(:,:,:)
69 real(RP),
private,
allocatable :: MOMY_RK2(:,:,:)
70 real(RP),
private,
allocatable :: RHOT_RK2(:,:,:)
71 real(RP),
private,
allocatable :: PROG_RK2(:,:,:,:)
72 real(RP),
private,
allocatable :: DENS_RK3(:,:,:)
73 real(RP),
private,
allocatable :: MOMZ_RK3(:,:,:)
74 real(RP),
private,
allocatable :: MOMX_RK3(:,:,:)
75 real(RP),
private,
allocatable :: MOMY_RK3(:,:,:)
76 real(RP),
private,
allocatable :: RHOT_RK3(:,:,:)
77 real(RP),
private,
allocatable :: PROG_RK3(:,:,:,:)
80 integer :: I_COMM_DENS_RK1 = 1
81 integer :: I_COMM_MOMZ_RK1 = 2
82 integer :: I_COMM_MOMX_RK1 = 3
83 integer :: I_COMM_MOMY_RK1 = 4
84 integer :: I_COMM_RHOT_RK1 = 5
85 integer,
allocatable :: I_COMM_PROG_RK1(:)
87 integer :: I_COMM_DENS_RK2 = 1
88 integer :: I_COMM_MOMZ_RK2 = 2
89 integer :: I_COMM_MOMX_RK2 = 3
90 integer :: I_COMM_MOMY_RK2 = 4
91 integer :: I_COMM_RHOT_RK2 = 5
92 integer,
allocatable :: I_COMM_PROG_RK2(:)
94 integer :: I_COMM_DENS_RK3 = 1
95 integer :: I_COMM_MOMZ_RK3 = 2
96 integer :: I_COMM_MOMX_RK3 = 3
97 integer :: I_COMM_MOMY_RK3 = 4
98 integer :: I_COMM_RHOT_RK3 = 5
99 integer,
allocatable :: I_COMM_PROG_RK3(:)
115 character(len=*) :: tinteg_type
120 if ( tinteg_type /=
'RK4' )
then
121 log_error(
"ATMOS_DYN_Tinteg_short_rk4_setup",*)
'TINTEG_TYPE is not RK4. Check!'
125 allocate( dens_rk1(
ka,
ia,
ja) )
126 allocate( momz_rk1(
ka,
ia,
ja) )
127 allocate( momx_rk1(
ka,
ia,
ja) )
128 allocate( momy_rk1(
ka,
ia,
ja) )
129 allocate( rhot_rk1(
ka,
ia,
ja) )
131 allocate( dens_rk2(
ka,
ia,
ja) )
132 allocate( momz_rk2(
ka,
ia,
ja) )
133 allocate( momx_rk2(
ka,
ia,
ja) )
134 allocate( momy_rk2(
ka,
ia,
ja) )
135 allocate( rhot_rk2(
ka,
ia,
ja) )
137 allocate( dens_rk3(
ka,
ia,
ja) )
138 allocate( momz_rk3(
ka,
ia,
ja) )
139 allocate( momx_rk3(
ka,
ia,
ja) )
140 allocate( momy_rk3(
ka,
ia,
ja) )
141 allocate( rhot_rk3(
ka,
ia,
ja) )
143 allocate( prog_rk1(
ka,
ia,
ja,max(
va,1)) )
144 allocate( prog_rk2(
ka,
ia,
ja,max(
va,1)) )
145 allocate( prog_rk3(
ka,
ia,
ja,max(
va,1)) )
146 allocate( i_comm_prog_rk1(max(
va,1)) )
147 allocate( i_comm_prog_rk2(max(
va,1)) )
148 allocate( i_comm_prog_rk3(max(
va,1)) )
156 i_comm_prog_rk1(iv) = 5 + iv
157 call comm_vars8_init(
'PROG_RK1', prog_rk1(:,:,:,iv), i_comm_prog_rk1(iv) )
166 i_comm_prog_rk2(iv) = 5 + iv
167 call comm_vars8_init(
'PROG_RK2', prog_rk2(:,:,:,iv), i_comm_prog_rk2(iv) )
176 i_comm_prog_rk3(iv) = 5 + iv
177 call comm_vars8_init(
'PROG_RK3', prog_rk3(:,:,:,iv), i_comm_prog_rk3(iv) )
180 dens_rk1(:,:,:) = undef
181 momz_rk1(:,:,:) = undef
182 momx_rk1(:,:,:) = undef
183 momy_rk1(:,:,:) = undef
184 rhot_rk1(:,:,:) = undef
185 if (
va > 0 ) prog_rk1(:,:,:,:) = undef
187 dens_rk2(:,:,:) = undef
188 momz_rk2(:,:,:) = undef
189 momx_rk2(:,:,:) = undef
190 momy_rk2(:,:,:) = undef
191 rhot_rk2(:,:,:) = undef
192 if (
va > 0 ) prog_rk2(:,:,:,:) = undef
194 dens_rk3(:,:,:) = undef
195 momz_rk3(:,:,:) = undef
196 momx_rk3(:,:,:) = undef
197 momy_rk3(:,:,:) = undef
198 rhot_rk3(:,:,:) = undef
199 if (
va > 0 ) prog_rk3(:,:,:,:) = undef
207 DENS, MOMZ, MOMX, MOMY, RHOT, PROG, &
209 DENS_t, MOMZ_t, MOMX_t, MOMY_t, RHOT_t, &
210 DPRES0, CVtot, CORIOLI, &
211 num_diff, wdamp_coef, divdmp_coef, DDIV, &
212 FLAG_FCT_MOMENTUM, FLAG_FCT_T, &
213 FLAG_FCT_ALONG_STREAM, &
214 CDZ, FDZ, FDX, FDY, &
215 RCDZ, RCDX, RCDY, RFDZ, RFDX, RFDY, &
216 PHI, GSQRT, J13G, J23G, J33G, MAPF, &
217 REF_pres, REF_dens, &
218 BND_W, BND_E, BND_S, BND_N, TwoD, &
229 real(rp),
intent(inout) :: dens(
ka,
ia,
ja)
230 real(rp),
intent(inout) :: momz(
ka,
ia,
ja)
231 real(rp),
intent(inout) :: momx(
ka,
ia,
ja)
232 real(rp),
intent(inout) :: momy(
ka,
ia,
ja)
233 real(rp),
intent(inout) :: rhot(
ka,
ia,
ja)
234 real(rp),
intent(inout) :: prog(
ka,
ia,
ja,
va)
236 real(rp),
intent(inout) :: mflx_hi(
ka,
ia,
ja,3)
237 real(rp),
intent(out) :: tflx_hi(
ka,
ia,
ja,3)
239 real(rp),
intent(in) :: dens_t(
ka,
ia,
ja)
240 real(rp),
intent(in) :: momz_t(
ka,
ia,
ja)
241 real(rp),
intent(in) :: momx_t(
ka,
ia,
ja)
242 real(rp),
intent(in) :: momy_t(
ka,
ia,
ja)
243 real(rp),
intent(in) :: rhot_t(
ka,
ia,
ja)
245 real(rp),
intent(in) :: dpres0(
ka,
ia,
ja)
246 real(rp),
intent(in) :: cvtot(
ka,
ia,
ja)
247 real(rp),
intent(in) :: corioli(
ia,
ja)
248 real(rp),
intent(in) :: num_diff(
ka,
ia,
ja,5,3)
249 real(rp),
intent(in) :: wdamp_coef(
ka)
250 real(rp),
intent(in) :: divdmp_coef
251 real(rp),
intent(in) :: ddiv(
ka,
ia,
ja)
253 logical,
intent(in) :: flag_fct_momentum
254 logical,
intent(in) :: flag_fct_t
255 logical,
intent(in) :: flag_fct_along_stream
257 real(rp),
intent(in) :: cdz (
ka)
258 real(rp),
intent(in) :: fdz (
ka-1)
259 real(rp),
intent(in) :: fdx (
ia-1)
260 real(rp),
intent(in) :: fdy (
ja-1)
261 real(rp),
intent(in) :: rcdz(
ka)
262 real(rp),
intent(in) :: rcdx(
ia)
263 real(rp),
intent(in) :: rcdy(
ja)
264 real(rp),
intent(in) :: rfdz(
ka-1)
265 real(rp),
intent(in) :: rfdx(
ia-1)
266 real(rp),
intent(in) :: rfdy(
ja-1)
268 real(rp),
intent(in) :: phi (
ka,
ia,
ja)
269 real(rp),
intent(in) :: gsqrt(
ka,
ia,
ja,7)
270 real(rp),
intent(in) :: j13g (
ka,
ia,
ja,7)
271 real(rp),
intent(in) :: j23g (
ka,
ia,
ja,7)
272 real(rp),
intent(in) :: j33g
273 real(rp),
intent(in) :: mapf (
ia,
ja,2,4)
275 real(rp),
intent(in) :: ref_pres(
ka,
ia,
ja)
276 real(rp),
intent(in) :: ref_dens(
ka,
ia,
ja)
278 logical,
intent(in) :: bnd_w
279 logical,
intent(in) :: bnd_e
280 logical,
intent(in) :: bnd_s
281 logical,
intent(in) :: bnd_n
282 logical,
intent(in) :: twod
284 real(rp),
intent(in) :: dt
286 real(rp) :: dens0(
ka,
ia,
ja)
287 real(rp) :: momz0(
ka,
ia,
ja)
288 real(rp) :: momx0(
ka,
ia,
ja)
289 real(rp) :: momy0(
ka,
ia,
ja)
290 real(rp) :: rhot0(
ka,
ia,
ja)
293 real(rp) :: mflx_hi_rk(
ka,
ia,
ja,3,3)
294 real(rp) :: tflx_hi_rk(
ka,
ia,
ja,3,3)
298 integer :: i, j,
k, iv, n
304 dens_rk1(:,:,:) = undef
305 momz_rk1(:,:,:) = undef
306 momx_rk1(:,:,:) = undef
307 momy_rk1(:,:,:) = undef
308 rhot_rk1(:,:,:) = undef
309 if (
va > 0 ) prog_rk1(:,:,:,:) = undef
311 dens_rk2(:,:,:) = undef
312 momz_rk2(:,:,:) = undef
313 momx_rk2(:,:,:) = undef
314 momy_rk2(:,:,:) = undef
315 rhot_rk2(:,:,:) = undef
316 if (
va > 0 ) prog_rk2(:,:,:,:) = undef
318 dens_rk3(:,:,:) = undef
319 momz_rk3(:,:,:) = undef
320 momx_rk3(:,:,:) = undef
321 momy_rk3(:,:,:) = undef
322 rhot_rk3(:,:,:) = undef
323 if (
va > 0 ) prog_rk3(:,:,:,:) = undef
325 mflx_hi_rk(:,:,:,:,:) = undef
326 tflx_hi_rk(:,:,:,:,:) = undef
330 mflx_hi( 1:
ks-1,:,:,:) = undef
331 mflx_hi(
ke+1:
ka ,:,:,:) = undef
345 if (
va > 0 ) prog0 = prog
347 if ( bnd_w .and. (.not. twod) )
then
350 mflx_hi_rk(
k,
is-1,j,2,:) = mflx_hi(
k,
is-1,j,2)
354 if ( bnd_e .and. (.not. twod) )
then
357 mflx_hi_rk(
k,
ie,j,2,:) = mflx_hi(
k,
ie,j,2)
364 mflx_hi_rk(
k,i,
js-1,3,:) = mflx_hi(
k,i,
js-1,3)
371 mflx_hi_rk(
k,i,
je,3,:) = mflx_hi(
k,i,
je,3)
388 call atmos_dyn_tstep( dens_rk1, momz_rk1, momx_rk1, momy_rk1, rhot_rk1, &
390 mflx_hi_rk(:,:,:,:,1), tflx_hi_rk(:,:,:,:,1), &
391 dens0, momz0, momx0, momy0, rhot0, &
392 dens, momz, momx, momy, rhot, &
393 dens_t, momz_t, momx_t, momy_t, rhot_t, &
395 dpres0, cvtot, corioli, &
396 num_diff, wdamp_coef, divdmp_coef, ddiv, &
397 flag_fct_momentum, flag_fct_t, &
398 flag_fct_along_stream, &
399 cdz, fdz, fdx, fdy, &
400 rcdz, rcdx, rcdy, rfdz, rfdx, rfdy, &
401 phi, gsqrt, j13g, j23g, j33g, mapf, &
402 ref_pres, ref_dens, &
403 bnd_w, bnd_e, bnd_s, bnd_n, twod, &
411 dens0, momz0, momx0, momy0, rhot0, &
413 bnd_w, bnd_e, bnd_s, bnd_n, twod )
417 call comm_vars8( dens_rk1(:,:,:), i_comm_dens_rk1 )
418 call comm_vars8( momz_rk1(:,:,:), i_comm_momz_rk1 )
419 call comm_vars8( momx_rk1(:,:,:), i_comm_momx_rk1 )
420 call comm_vars8( momy_rk1(:,:,:), i_comm_momy_rk1 )
421 call comm_vars8( rhot_rk1(:,:,:), i_comm_rhot_rk1 )
423 call comm_vars8( prog_rk1(:,:,:,iv), i_comm_prog_rk1(iv) )
426 call comm_wait ( dens_rk1(:,:,:), i_comm_dens_rk1, .false. )
427 call comm_wait ( momz_rk1(:,:,:), i_comm_momz_rk1, .false. )
428 call comm_wait ( momx_rk1(:,:,:), i_comm_momx_rk1, .false. )
429 call comm_wait ( momy_rk1(:,:,:), i_comm_momy_rk1, .false. )
430 call comm_wait ( rhot_rk1(:,:,:), i_comm_rhot_rk1, .false. )
432 call comm_wait ( prog_rk1(:,:,:,iv), i_comm_prog_rk1(iv), .false. )
441 call atmos_dyn_tstep( dens_rk2, momz_rk2, momx_rk2, momy_rk2, rhot_rk2, &
443 mflx_hi_rk(:,:,:,:,2), tflx_hi_rk(:,:,:,:,2), &
444 dens0, momz0, momx0, momy0, rhot0, &
445 dens_rk1, momz_rk1, momx_rk1, momy_rk1, rhot_rk1, &
446 dens_t, momz_t, momx_t, momy_t, rhot_t, &
448 dpres0, cvtot, corioli, &
449 num_diff, wdamp_coef, divdmp_coef, ddiv, &
450 flag_fct_momentum, flag_fct_t, &
451 flag_fct_along_stream, &
452 cdz, fdz, fdx, fdy, &
453 rcdz, rcdx, rcdy, rfdz, rfdx, rfdy, &
454 phi, gsqrt, j13g, j23g, j33g, mapf, &
455 ref_pres, ref_dens, &
456 bnd_w, bnd_e, bnd_s, bnd_n, twod, &
464 dens0, momz0, momx0, momy0, rhot0, &
466 bnd_w, bnd_e, bnd_s, bnd_n, twod )
470 call comm_vars8( dens_rk2(:,:,:), i_comm_dens_rk2 )
471 call comm_vars8( momz_rk2(:,:,:), i_comm_momz_rk2 )
472 call comm_vars8( momx_rk2(:,:,:), i_comm_momx_rk2 )
473 call comm_vars8( momy_rk2(:,:,:), i_comm_momy_rk2 )
474 call comm_vars8( rhot_rk2(:,:,:), i_comm_rhot_rk2 )
476 call comm_vars8( prog_rk2(:,:,:,iv), i_comm_prog_rk2(iv) )
479 call comm_wait ( dens_rk2(:,:,:), i_comm_dens_rk2, .false. )
480 call comm_wait ( momz_rk2(:,:,:), i_comm_momz_rk2, .false. )
481 call comm_wait ( momx_rk2(:,:,:), i_comm_momx_rk2, .false. )
482 call comm_wait ( momy_rk2(:,:,:), i_comm_momy_rk2, .false. )
483 call comm_wait ( rhot_rk2(:,:,:), i_comm_rhot_rk2, .false. )
485 call comm_wait ( prog_rk2(:,:,:,iv), i_comm_prog_rk2(iv), .false. )
494 call atmos_dyn_tstep( dens_rk3, momz_rk3, momx_rk3, momy_rk3, rhot_rk3, &
496 mflx_hi_rk(:,:,:,:,3), tflx_hi_rk(:,:,:,:,3), &
497 dens0, momz0, momx0, momy0, rhot0, &
498 dens_rk2, momz_rk2, momx_rk2, momy_rk2, rhot_rk2, &
499 dens_t, momz_t, momx_t, momy_t, rhot_t, &
501 dpres0, cvtot, corioli, &
502 num_diff, wdamp_coef, divdmp_coef, ddiv, &
503 flag_fct_momentum, flag_fct_t, &
504 flag_fct_along_stream, &
505 cdz, fdz, fdx, fdy, &
506 rcdz, rcdx, rcdy, rfdz, rfdx, rfdy, &
507 phi, gsqrt, j13g, j23g, j33g, mapf, &
508 ref_pres, ref_dens, &
509 bnd_w, bnd_e, bnd_s, bnd_n, twod, &
517 dens0, momz0, momx0, momy0, rhot0, &
519 bnd_w, bnd_e, bnd_s, bnd_n, twod )
523 call comm_vars8( dens_rk3(:,:,:), i_comm_dens_rk3 )
524 call comm_vars8( momz_rk3(:,:,:), i_comm_momz_rk3 )
525 call comm_vars8( momx_rk3(:,:,:), i_comm_momx_rk3 )
526 call comm_vars8( momy_rk3(:,:,:), i_comm_momy_rk3 )
527 call comm_vars8( rhot_rk3(:,:,:), i_comm_rhot_rk3 )
529 call comm_vars8( prog_rk3(:,:,:,iv), i_comm_prog_rk3(iv) )
532 call comm_wait ( dens_rk3(:,:,:), i_comm_dens_rk3, .false. )
533 call comm_wait ( momz_rk3(:,:,:), i_comm_momz_rk3, .false. )
534 call comm_wait ( momx_rk3(:,:,:), i_comm_momx_rk3, .false. )
535 call comm_wait ( momy_rk3(:,:,:), i_comm_momy_rk3, .false. )
536 call comm_wait ( rhot_rk3(:,:,:), i_comm_rhot_rk3, .false. )
538 call comm_wait ( prog_rk3(:,:,:,iv), i_comm_prog_rk3(iv), .false. )
547 call atmos_dyn_tstep( dens, momz, momx, momy, rhot, &
550 dens0, momz0, momx0, momy0, rhot0, &
551 dens_rk3, momz_rk3, momx_rk3, momy_rk3, rhot_rk3, &
552 dens_t, momz_t, momx_t, momy_t, rhot_t, &
554 dpres0, cvtot, corioli, &
555 num_diff, wdamp_coef, divdmp_coef, ddiv, &
556 flag_fct_momentum, flag_fct_t, &
557 flag_fct_along_stream, &
558 cdz, fdz, fdx, fdy, &
559 rcdz, rcdx, rcdy, rfdz, rfdx, rfdy, &
560 phi, gsqrt, j13g, j23g, j33g, mapf, &
561 ref_pres, ref_dens, &
562 bnd_w, bnd_e, bnd_s, bnd_n, twod, &
570 dens(
k,i,j) = ( dens_rk1(
k,i,j) * 2.0_rp &
571 + dens_rk2(
k,i,j) * 4.0_rp &
572 + dens_rk3(
k,i,j) * 2.0_rp &
574 - dens0(
k,i,j) * 3.0_rp ) / 6.0_rp
582 momz(
k,i,j) = ( momz_rk1(
k,i,j) * 2.0_rp &
583 + momz_rk2(
k,i,j) * 4.0_rp &
584 + momz_rk3(
k,i,j) * 2.0_rp &
586 - momz0(
k,i,j) * 3.0_rp ) / 6.0_rp
594 momx(
k,i,j) = ( momx_rk1(
k,i,j) * 2.0_rp &
595 + momx_rk2(
k,i,j) * 4.0_rp &
596 + momx_rk3(
k,i,j) * 2.0_rp &
598 - momx0(
k,i,j) * 3.0_rp ) / 6.0_rp
606 momy(
k,i,j) = ( momy_rk1(
k,i,j) * 2.0_rp &
607 + momy_rk2(
k,i,j) * 4.0_rp &
608 + momy_rk3(
k,i,j) * 2.0_rp &
610 - momy0(
k,i,j) * 3.0_rp ) / 6.0_rp
621 rhot(
k,i,j) = ( rhot_rk1(
k,i,j) * 2.0_rp &
622 + rhot_rk2(
k,i,j) * 4.0_rp &
623 + rhot_rk3(
k,i,j) * 2.0_rp &
625 - rhot0(
k,i,j) * 3.0_rp ) / 6.0_rp
634 prog(
k,i,j,iv) = ( prog_rk1(
k,i,j,iv) * 2.0_rp &
635 + prog_rk2(
k,i,j,iv) * 4.0_rp &
636 + prog_rk3(
k,i,j,iv) * 2.0_rp &
638 - prog0(
k,i,j,iv) * 3.0_rp ) / 6.0_rp
649 mflx_hi(
k,i,j,n) = ( mflx_hi_rk(
k,i,j,n,1) &
650 + mflx_hi_rk(
k,i,j,n,2) * 2.0_rp &
651 + mflx_hi_rk(
k,i,j,n,3) * 2.0_rp &
652 + mflx_hi(
k,i,j,n ) ) / 6.0_rp
662 tflx_hi(
k,i,j,n) = ( tflx_hi_rk(
k,i,j,n,1) &
663 + tflx_hi_rk(
k,i,j,n,2) * 2.0_rp &
664 + tflx_hi_rk(
k,i,j,n,3) * 2.0_rp &
665 + tflx_hi(
k,i,j,n ) ) / 6.0_rp