15 #include "inc_openmp.h" 27 #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(:,:,:,:)
68 real(RP),
private,
allocatable :: DENS_RK3(:,:,:)
69 real(RP),
private,
allocatable :: MOMZ_RK3(:,:,:)
70 real(RP),
private,
allocatable :: MOMX_RK3(:,:,:)
71 real(RP),
private,
allocatable :: MOMY_RK3(:,:,:)
72 real(RP),
private,
allocatable :: RHOT_RK3(:,:,:)
73 real(RP),
private,
allocatable :: PROG_RK3(:,:,:,:)
76 integer :: I_COMM_DENS_RK1 = 1
77 integer :: I_COMM_MOMZ_RK1 = 2
78 integer :: I_COMM_MOMX_RK1 = 3
79 integer :: I_COMM_MOMY_RK1 = 4
80 integer :: I_COMM_RHOT_RK1 = 5
81 integer,
allocatable :: I_COMM_PROG_RK1(:)
83 integer :: I_COMM_DENS_RK2 = 1
84 integer :: I_COMM_MOMZ_RK2 = 2
85 integer :: I_COMM_MOMX_RK2 = 3
86 integer :: I_COMM_MOMY_RK2 = 4
87 integer :: I_COMM_RHOT_RK2 = 5
88 integer,
allocatable :: I_COMM_PROG_RK2(:)
90 integer :: I_COMM_DENS_RK3 = 1
91 integer :: I_COMM_MOMZ_RK3 = 2
92 integer :: I_COMM_MOMX_RK3 = 3
93 integer :: I_COMM_MOMY_RK3 = 4
94 integer :: I_COMM_RHOT_RK3 = 5
95 integer,
allocatable :: I_COMM_PROG_RK3(:)
111 character(len=*) :: tinteg_type
116 if ( tinteg_type /=
'RK4' )
then 117 write(*,*)
'xxx TINTEG_TYPE is not RK4. Check!' 121 allocate( dens_rk1(
ka,
ia,
ja) )
122 allocate( momz_rk1(
ka,
ia,
ja) )
123 allocate( momx_rk1(
ka,
ia,
ja) )
124 allocate( momy_rk1(
ka,
ia,
ja) )
125 allocate( rhot_rk1(
ka,
ia,
ja) )
127 allocate( dens_rk2(
ka,
ia,
ja) )
128 allocate( momz_rk2(
ka,
ia,
ja) )
129 allocate( momx_rk2(
ka,
ia,
ja) )
130 allocate( momy_rk2(
ka,
ia,
ja) )
131 allocate( rhot_rk2(
ka,
ia,
ja) )
133 allocate( dens_rk3(
ka,
ia,
ja) )
134 allocate( momz_rk3(
ka,
ia,
ja) )
135 allocate( momx_rk3(
ka,
ia,
ja) )
136 allocate( momy_rk3(
ka,
ia,
ja) )
137 allocate( rhot_rk3(
ka,
ia,
ja) )
139 allocate( prog_rk1(
ka,
ia,
ja,max(
va,1)) )
140 allocate( prog_rk2(
ka,
ia,
ja,max(
va,1)) )
141 allocate( prog_rk3(
ka,
ia,
ja,max(
va,1)) )
142 allocate( i_comm_prog_rk1(max(
va,1)) )
143 allocate( i_comm_prog_rk2(max(
va,1)) )
144 allocate( i_comm_prog_rk3(max(
va,1)) )
152 i_comm_prog_rk1(iv) = 5 + iv
153 call comm_vars8_init(
'PROG_RK1', prog_rk1(:,:,:,iv), i_comm_prog_rk1(iv) )
162 i_comm_prog_rk2(iv) = 5 + iv
163 call comm_vars8_init(
'PROG_RK2', prog_rk2(:,:,:,iv), i_comm_prog_rk2(iv) )
172 i_comm_prog_rk3(iv) = 5 + iv
173 call comm_vars8_init(
'PROG_RK3', prog_rk3(:,:,:,iv), i_comm_prog_rk3(iv) )
176 dens_rk1(:,:,:) = undef
177 momz_rk1(:,:,:) = undef
178 momx_rk1(:,:,:) = undef
179 momy_rk1(:,:,:) = undef
180 rhot_rk1(:,:,:) = undef
181 if (
va > 0 ) prog_rk1(:,:,:,:) = undef
183 dens_rk2(:,:,:) = undef
184 momz_rk2(:,:,:) = undef
185 momx_rk2(:,:,:) = undef
186 momy_rk2(:,:,:) = undef
187 rhot_rk2(:,:,:) = undef
188 if (
va > 0 ) prog_rk2(:,:,:,:) = undef
190 dens_rk3(:,:,:) = undef
191 momz_rk3(:,:,:) = undef
192 momx_rk3(:,:,:) = undef
193 momy_rk3(:,:,:) = undef
194 rhot_rk3(:,:,:) = undef
195 if (
va > 0 ) prog_rk3(:,:,:,:) = undef
203 DENS, MOMZ, MOMX, MOMY, RHOT, PROG, &
205 DENS_t, MOMZ_t, MOMX_t, MOMY_t, RHOT_t, &
206 Rtot, CVtot, CORIOLI, &
207 num_diff, wdamp_coef, divdmp_coef, DDIV, &
208 FLAG_FCT_MOMENTUM, FLAG_FCT_T, &
209 FLAG_FCT_ALONG_STREAM, &
210 CDZ, FDZ, FDX, FDY, &
211 RCDZ, RCDX, RCDY, RFDZ, RFDX, RFDY, &
212 PHI, GSQRT, J13G, J23G, J33G, MAPF, &
213 REF_pres, REF_dens, &
214 BND_W, BND_E, BND_S, BND_N, &
225 real(RP),
intent(inout) :: dens(
ka,
ia,
ja)
226 real(RP),
intent(inout) :: momz(
ka,
ia,
ja)
227 real(RP),
intent(inout) :: momx(
ka,
ia,
ja)
228 real(RP),
intent(inout) :: momy(
ka,
ia,
ja)
229 real(RP),
intent(inout) :: rhot(
ka,
ia,
ja)
230 real(RP),
intent(inout) :: prog(
ka,
ia,
ja,
va)
232 real(RP),
intent(inout) :: mflx_hi(
ka,
ia,
ja,3)
233 real(RP),
intent(inout) :: tflx_hi(
ka,
ia,
ja,3)
235 real(RP),
intent(in) :: dens_t(
ka,
ia,
ja)
236 real(RP),
intent(in) :: momz_t(
ka,
ia,
ja)
237 real(RP),
intent(in) :: momx_t(
ka,
ia,
ja)
238 real(RP),
intent(in) :: momy_t(
ka,
ia,
ja)
239 real(RP),
intent(in) :: rhot_t(
ka,
ia,
ja)
241 real(RP),
intent(in) :: rtot(
ka,
ia,
ja)
242 real(RP),
intent(in) :: cvtot(
ka,
ia,
ja)
243 real(RP),
intent(in) :: corioli(
ia,
ja)
244 real(RP),
intent(in) :: num_diff(
ka,
ia,
ja,5,3)
245 real(RP),
intent(in) :: wdamp_coef(
ka)
246 real(RP),
intent(in) :: divdmp_coef
247 real(RP),
intent(in) :: ddiv(
ka,
ia,
ja)
249 logical,
intent(in) :: flag_fct_momentum
250 logical,
intent(in) :: flag_fct_t
251 logical,
intent(in) :: flag_fct_along_stream
253 real(RP),
intent(in) :: cdz (
ka)
254 real(RP),
intent(in) :: fdz (
ka-1)
255 real(RP),
intent(in) :: fdx (
ia-1)
256 real(RP),
intent(in) :: fdy (
ja-1)
257 real(RP),
intent(in) :: rcdz(
ka)
258 real(RP),
intent(in) :: rcdx(
ia)
259 real(RP),
intent(in) :: rcdy(
ja)
260 real(RP),
intent(in) :: rfdz(
ka-1)
261 real(RP),
intent(in) :: rfdx(
ia-1)
262 real(RP),
intent(in) :: rfdy(
ja-1)
264 real(RP),
intent(in) :: phi (
ka,
ia,
ja)
265 real(RP),
intent(in) :: gsqrt(
ka,
ia,
ja,7)
266 real(RP),
intent(in) :: j13g (
ka,
ia,
ja,7)
267 real(RP),
intent(in) :: j23g (
ka,
ia,
ja,7)
268 real(RP),
intent(in) :: j33g
269 real(RP),
intent(in) :: mapf (
ia,
ja,2,4)
271 real(RP),
intent(in) :: ref_pres(
ka,
ia,
ja)
272 real(RP),
intent(in) :: ref_dens(
ka,
ia,
ja)
274 logical,
intent(in) :: bnd_w
275 logical,
intent(in) :: bnd_e
276 logical,
intent(in) :: bnd_s
277 logical,
intent(in) :: bnd_n
279 real(RP),
intent(in) :: dt
281 real(RP) :: dens0(
ka,
ia,
ja)
282 real(RP) :: momz0(
ka,
ia,
ja)
283 real(RP) :: momx0(
ka,
ia,
ja)
284 real(RP) :: momy0(
ka,
ia,
ja)
285 real(RP) :: rhot0(
ka,
ia,
ja)
288 real(RP) :: mflx_hi_rk(
ka,
ia,
ja,3,3)
289 real(RP) :: tflx_hi_rk(
ka,
ia,
ja,3,3)
293 integer :: i, j, k, iv, n
299 dens_rk1(:,:,:) = undef
300 momz_rk1(:,:,:) = undef
301 momx_rk1(:,:,:) = undef
302 momy_rk1(:,:,:) = undef
303 rhot_rk1(:,:,:) = undef
304 if (
va > 0 ) prog_rk1(:,:,:,:) = undef
306 dens_rk2(:,:,:) = undef
307 momz_rk2(:,:,:) = undef
308 momx_rk2(:,:,:) = undef
309 momy_rk2(:,:,:) = undef
310 rhot_rk2(:,:,:) = undef
311 if (
va > 0 ) prog_rk2(:,:,:,:) = undef
313 dens_rk3(:,:,:) = undef
314 momz_rk3(:,:,:) = undef
315 momx_rk3(:,:,:) = undef
316 momy_rk3(:,:,:) = undef
317 rhot_rk3(:,:,:) = undef
318 if (
va > 0 ) prog_rk3(:,:,:,:) = undef
320 mflx_hi_rk(:,:,:,:,:) = undef
321 tflx_hi_rk(:,:,:,:,:) = undef
325 mflx_hi( 1:
ks-1,:,:,:) = undef
326 mflx_hi(
ke+1:
ka ,:,:,:) = undef
340 if (
va > 0 ) prog0 = prog
345 mflx_hi_rk(k,
is-1,j,2,:) = mflx_hi(k,
is-1,j,2)
352 mflx_hi_rk(k,
ie,j,2,:) = mflx_hi(k,
ie,j,2)
359 mflx_hi_rk(k,i,
js-1,3,:) = mflx_hi(k,i,
js-1,3)
366 mflx_hi_rk(k,i,
je,3,:) = mflx_hi(k,i,
je,3)
383 call atmos_dyn_tstep( dens_rk1, momz_rk1, momx_rk1, momy_rk1, rhot_rk1, &
385 mflx_hi_rk(:,:,:,:,1), tflx_hi_rk(:,:,:,:,1), &
386 dens0, momz0, momx0, momy0, rhot0, &
387 dens, momz, momx, momy, rhot, &
388 dens_t, momz_t, momx_t, momy_t, rhot_t, &
390 rtot, cvtot, corioli, &
391 num_diff, wdamp_coef, divdmp_coef, ddiv, &
392 flag_fct_momentum, flag_fct_t, &
393 flag_fct_along_stream, &
394 cdz, fdz, fdx, fdy, &
395 rcdz, rcdx, rcdy, rfdz, rfdx, rfdy, &
396 phi, gsqrt, j13g, j23g, j33g, mapf, &
397 ref_pres, ref_dens, &
398 bnd_w, bnd_e, bnd_s, bnd_n, &
406 dens0, momz0, momx0, momy0, rhot0, &
408 bnd_w, bnd_e, bnd_s, bnd_n )
412 call comm_vars8( dens_rk1(:,:,:), i_comm_dens_rk1 )
413 call comm_vars8( momz_rk1(:,:,:), i_comm_momz_rk1 )
414 call comm_vars8( momx_rk1(:,:,:), i_comm_momx_rk1 )
415 call comm_vars8( momy_rk1(:,:,:), i_comm_momy_rk1 )
416 call comm_vars8( rhot_rk1(:,:,:), i_comm_rhot_rk1 )
418 call comm_vars8( prog_rk1(:,:,:,iv), i_comm_prog_rk1(iv) )
421 call comm_wait ( dens_rk1(:,:,:), i_comm_dens_rk1, .false. )
422 call comm_wait ( momz_rk1(:,:,:), i_comm_momz_rk1, .false. )
423 call comm_wait ( momx_rk1(:,:,:), i_comm_momx_rk1, .false. )
424 call comm_wait ( momy_rk1(:,:,:), i_comm_momy_rk1, .false. )
425 call comm_wait ( rhot_rk1(:,:,:), i_comm_rhot_rk1, .false. )
427 call comm_wait ( prog_rk1(:,:,:,iv), i_comm_prog_rk1(iv), .false. )
436 call atmos_dyn_tstep( dens_rk2, momz_rk2, momx_rk2, momy_rk2, rhot_rk2, &
438 mflx_hi_rk(:,:,:,:,2), tflx_hi_rk(:,:,:,:,2), &
439 dens0, momz0, momx0, momy0, rhot0, &
440 dens_rk1, momz_rk1, momx_rk1, momy_rk1, rhot_rk1, &
441 dens_t, momz_t, momx_t, momy_t, rhot_t, &
443 rtot, cvtot, corioli, &
444 num_diff, wdamp_coef, divdmp_coef, ddiv, &
445 flag_fct_momentum, flag_fct_t, &
446 flag_fct_along_stream, &
447 cdz, fdz, fdx, fdy, &
448 rcdz, rcdx, rcdy, rfdz, rfdx, rfdy, &
449 phi, gsqrt, j13g, j23g, j33g, mapf, &
450 ref_pres, ref_dens, &
451 bnd_w, bnd_e, bnd_s, bnd_n, &
459 dens0, momz0, momx0, momy0, rhot0, &
461 bnd_w, bnd_e, bnd_s, bnd_n )
465 call comm_vars8( dens_rk2(:,:,:), i_comm_dens_rk2 )
466 call comm_vars8( momz_rk2(:,:,:), i_comm_momz_rk2 )
467 call comm_vars8( momx_rk2(:,:,:), i_comm_momx_rk2 )
468 call comm_vars8( momy_rk2(:,:,:), i_comm_momy_rk2 )
469 call comm_vars8( rhot_rk2(:,:,:), i_comm_rhot_rk2 )
471 call comm_vars8( prog_rk2(:,:,:,iv), i_comm_prog_rk2(iv) )
474 call comm_wait ( dens_rk2(:,:,:), i_comm_dens_rk2, .false. )
475 call comm_wait ( momz_rk2(:,:,:), i_comm_momz_rk2, .false. )
476 call comm_wait ( momx_rk2(:,:,:), i_comm_momx_rk2, .false. )
477 call comm_wait ( momy_rk2(:,:,:), i_comm_momy_rk2, .false. )
478 call comm_wait ( rhot_rk2(:,:,:), i_comm_rhot_rk2, .false. )
480 call comm_wait ( prog_rk2(:,:,:,iv), i_comm_prog_rk2(iv), .false. )
489 call atmos_dyn_tstep( dens_rk3, momz_rk3, momx_rk3, momy_rk3, rhot_rk3, &
491 mflx_hi_rk(:,:,:,:,3), tflx_hi_rk(:,:,:,:,3), &
492 dens0, momz0, momx0, momy0, rhot0, &
493 dens_rk2, momz_rk2, momx_rk2, momy_rk2, rhot_rk2, &
494 dens_t, momz_t, momx_t, momy_t, rhot_t, &
496 rtot, cvtot, corioli, &
497 num_diff, wdamp_coef, divdmp_coef, ddiv, &
498 flag_fct_momentum, flag_fct_t, &
499 flag_fct_along_stream, &
500 cdz, fdz, fdx, fdy, &
501 rcdz, rcdx, rcdy, rfdz, rfdx, rfdy, &
502 phi, gsqrt, j13g, j23g, j33g, mapf, &
503 ref_pres, ref_dens, &
504 bnd_w, bnd_e, bnd_s, bnd_n, &
512 dens0, momz0, momx0, momy0, rhot0, &
514 bnd_w, bnd_e, bnd_s, bnd_n )
518 call comm_vars8( dens_rk3(:,:,:), i_comm_dens_rk3 )
519 call comm_vars8( momz_rk3(:,:,:), i_comm_momz_rk3 )
520 call comm_vars8( momx_rk3(:,:,:), i_comm_momx_rk3 )
521 call comm_vars8( momy_rk3(:,:,:), i_comm_momy_rk3 )
522 call comm_vars8( rhot_rk3(:,:,:), i_comm_rhot_rk3 )
524 call comm_vars8( prog_rk3(:,:,:,iv), i_comm_prog_rk3(iv) )
527 call comm_wait ( dens_rk3(:,:,:), i_comm_dens_rk3, .false. )
528 call comm_wait ( momz_rk3(:,:,:), i_comm_momz_rk3, .false. )
529 call comm_wait ( momx_rk3(:,:,:), i_comm_momx_rk3, .false. )
530 call comm_wait ( momy_rk3(:,:,:), i_comm_momy_rk3, .false. )
531 call comm_wait ( rhot_rk3(:,:,:), i_comm_rhot_rk3, .false. )
533 call comm_wait ( prog_rk3(:,:,:,iv), i_comm_prog_rk3(iv), .false. )
542 call atmos_dyn_tstep( dens, momz, momx, momy, rhot, &
545 dens0, momz0, momx0, momy0, rhot0, &
546 dens_rk3, momz_rk3, momx_rk3, momy_rk3, rhot_rk3, &
547 dens_t, momz_t, momx_t, momy_t, rhot_t, &
549 rtot, cvtot, corioli, &
550 num_diff, wdamp_coef, divdmp_coef, ddiv, &
551 flag_fct_momentum, flag_fct_t, &
552 flag_fct_along_stream, &
553 cdz, fdz, fdx, fdy, &
554 rcdz, rcdx, rcdy, rfdz, rfdx, rfdy, &
555 phi, gsqrt, j13g, j23g, j33g, mapf, &
556 ref_pres, ref_dens, &
557 bnd_w, bnd_e, bnd_s, bnd_n, &
565 dens(k,i,j) = ( dens_rk1(k,i,j) * 2.0_rp &
566 + dens_rk2(k,i,j) * 4.0_rp &
567 + dens_rk3(k,i,j) * 2.0_rp &
569 - dens0(k,i,j) * 3.0_rp ) / 6.0_rp
577 momz(k,i,j) = ( momz_rk1(k,i,j) * 2.0_rp &
578 + momz_rk2(k,i,j) * 4.0_rp &
579 + momz_rk3(k,i,j) * 2.0_rp &
581 - momz0(k,i,j) * 3.0_rp ) / 6.0_rp
589 momx(k,i,j) = ( momx_rk1(k,i,j) * 2.0_rp &
590 + momx_rk2(k,i,j) * 4.0_rp &
591 + momx_rk3(k,i,j) * 2.0_rp &
593 - momx0(k,i,j) * 3.0_rp ) / 6.0_rp
601 momy(k,i,j) = ( momy_rk1(k,i,j) * 2.0_rp &
602 + momy_rk2(k,i,j) * 4.0_rp &
603 + momy_rk3(k,i,j) * 2.0_rp &
605 - momy0(k,i,j) * 3.0_rp ) / 6.0_rp
616 rhot(k,i,j) = ( rhot_rk1(k,i,j) * 2.0_rp &
617 + rhot_rk2(k,i,j) * 4.0_rp &
618 + rhot_rk3(k,i,j) * 2.0_rp &
620 - rhot0(k,i,j) * 3.0_rp ) / 6.0_rp
629 prog(k,i,j,iv) = ( prog_rk1(k,i,j,iv) * 2.0_rp &
630 + prog_rk2(k,i,j,iv) * 4.0_rp &
631 + prog_rk3(k,i,j,iv) * 2.0_rp &
633 - prog0(k,i,j,iv) * 3.0_rp ) / 6.0_rp
644 mflx_hi(k,i,j,n) = ( mflx_hi_rk(k,i,j,n,1) &
645 + mflx_hi_rk(k,i,j,n,2) * 2.0_rp &
646 + mflx_hi_rk(k,i,j,n,3) * 2.0_rp &
647 + mflx_hi(k,i,j,n ) ) / 6.0_rp
657 tflx_hi(k,i,j,n) = ( tflx_hi_rk(k,i,j,n,1) &
658 + tflx_hi_rk(k,i,j,n,2) * 2.0_rp &
659 + tflx_hi_rk(k,i,j,n,3) * 2.0_rp &
660 + tflx_hi(k,i,j,n ) ) / 6.0_rp
integer, public is
start point of inner domain: x, local
integer, public je
end point of inner domain: y, local
subroutine, public prc_mpistop
Abort MPI.
subroutine, public comm_vars8_init(varname, var, vid)
Register variables.
module Atmosphere / Dynamical scheme
subroutine, public atmos_dyn_tinteg_short_rk4_setup(tinteg_type)
Setup.
integer, public ke
end point of inner domain: z, local
subroutine, public check(current_line, v)
Undefined value checker.
real(rp), public const_undef
integer, public ia
of whole cells: x, local, with HALO
integer, public ka
of whole cells: z, local, with HALO
procedure(short), pointer, public atmos_dyn_tstep_short
integer, public js
start point of inner domain: y, local
integer, parameter, public const_undef2
undefined value (INT2)
module Atmosphere / Dynamics common
integer, public ks
start point of inner domain: z, local
subroutine, public prof_rapstart(rapname_base, level)
Start raptime.
subroutine, public atmos_dyn_copy_boundary(DENS, MOMZ, MOMX, MOMY, RHOT, PROG, DENS0, MOMZ0, MOMX0, MOMY0, RHOT0, PROG0, BND_W, BND_E, BND_S, BND_N)
integer, public ie
end point of inner domain: x, local
subroutine, public atmos_dyn_tinteg_short_rk4(DENS, MOMZ, MOMX, MOMY, RHOT, PROG, mflx_hi, tflx_hi, DENS_t, MOMZ_t, MOMX_t, MOMY_t, RHOT_t, Rtot, CVtot, CORIOLI, num_diff, wdamp_coef, divdmp_coef, DDIV, FLAG_FCT_MOMENTUM, FLAG_FCT_T, FLAG_FCT_ALONG_STREAM, CDZ, FDZ, FDX, FDY, RCDZ, RCDX, RCDY, RFDZ, RFDX, RFDY, PHI, GSQRT, J13G, J23G, J33G, MAPF, REF_pres, REF_dens, BND_W, BND_E, BND_S, BND_N, dt)
RK3.
module Atmosphere / Dyn Tinteg
subroutine, public prof_rapend(rapname_base, level)
Save raptime.
integer, public ja
of whole cells: y, local, with HALO