RK3.
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)
291 real(RP) :: PROG0(KA,IA,JA,VA)
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
301 call prof_rapstart(
"DYN_RK4_Prep",3)
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)
376 call prof_rapend (
"DYN_RK4_Prep",3)
384 call prof_rapstart(
"DYN_RK4",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, &
406 call prof_rapend (
"DYN_RK4",3)
407 call prof_rapstart(
"DYN_RK4_BND",3)
411 dens0, momz0, momx0, momy0, rhot0, &
413 bnd_w, bnd_e, bnd_s, bnd_n, twod )
415 call prof_rapend (
"DYN_RK4_BND",3)
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. )
437 call prof_rapstart(
"DYN_RK4",3)
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, &
459 call prof_rapend (
"DYN_RK4",3)
460 call prof_rapstart(
"DYN_RK4_BND",3)
464 dens0, momz0, momx0, momy0, rhot0, &
466 bnd_w, bnd_e, bnd_s, bnd_n, twod )
468 call prof_rapend (
"DYN_RK4_BND",3)
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. )
490 call prof_rapstart(
"DYN_RK4",3)
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, &
512 call prof_rapend (
"DYN_RK4",3)
513 call prof_rapstart(
"DYN_RK4_BND",3)
517 dens0, momz0, momx0, momy0, rhot0, &
519 bnd_w, bnd_e, bnd_s, bnd_n, twod )
521 call prof_rapend (
"DYN_RK4_BND",3)
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. )
543 call prof_rapstart(
"DYN_RK4",3)
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
671 call prof_rapend (
"DYN_RK4",3)