26 #if defined DEBUG || defined QUICKDEBUG
55 real(RP),
private,
allocatable :: DENS_RK1(:,:,:)
56 real(RP),
private,
allocatable :: MOMZ_RK1(:,:,:)
57 real(RP),
private,
allocatable :: MOMX_RK1(:,:,:)
58 real(RP),
private,
allocatable :: MOMY_RK1(:,:,:)
59 real(RP),
private,
allocatable :: RHOT_RK1(:,:,:)
60 real(RP),
private,
allocatable :: PROG_RK1(:,:,:,:)
61 real(RP),
private,
allocatable :: DENS_RK2(:,:,:)
62 real(RP),
private,
allocatable :: MOMZ_RK2(:,:,:)
63 real(RP),
private,
allocatable :: MOMX_RK2(:,:,:)
64 real(RP),
private,
allocatable :: MOMY_RK2(:,:,:)
65 real(RP),
private,
allocatable :: RHOT_RK2(:,:,:)
66 real(RP),
private,
allocatable :: PROG_RK2(:,:,:,:)
69 integer :: I_COMM_DENS_RK1 = 1
70 integer :: I_COMM_MOMZ_RK1 = 2
71 integer :: I_COMM_MOMX_RK1 = 3
72 integer :: I_COMM_MOMY_RK1 = 4
73 integer :: I_COMM_RHOT_RK1 = 5
74 integer,
allocatable :: I_COMM_PROG_RK1(:)
76 integer :: I_COMM_DENS_RK2 = 1
77 integer :: I_COMM_MOMZ_RK2 = 2
78 integer :: I_COMM_MOMX_RK2 = 3
79 integer :: I_COMM_MOMY_RK2 = 4
80 integer :: I_COMM_RHOT_RK2 = 5
81 integer,
allocatable :: I_COMM_PROG_RK2(:)
83 logical :: FLAG_WS2002
101 character(len=*) :: tinteg_type
106 select case( tinteg_type )
108 log_info(
"ATMOS_DYN_Tinteg_short_rk3_setup",*)
"RK3: Heun's method is used"
116 flag_ws2002 = .false.
117 fact_dt1 = 1.0_rp / 3.0_rp
118 fact_dt2 = 2.0_rp / 3.0_rp
120 log_info(
"ATMOS_DYN_Tinteg_short_rk3_setup",*)
"RK3: Wicker and Skamarock (2002) is used"
128 fact_dt1 = 1.0_rp / 3.0_rp
129 fact_dt2 = 1.0_rp / 2.0_rp
131 log_error(
"ATMOS_DYN_Tinteg_short_rk3_setup",*)
'TINTEG_TYPE is not RK3. Check!'
135 allocate( dens_rk1(
ka,
ia,
ja) )
136 allocate( momz_rk1(
ka,
ia,
ja) )
137 allocate( momx_rk1(
ka,
ia,
ja) )
138 allocate( momy_rk1(
ka,
ia,
ja) )
139 allocate( rhot_rk1(
ka,
ia,
ja) )
141 allocate( dens_rk2(
ka,
ia,
ja) )
142 allocate( momz_rk2(
ka,
ia,
ja) )
143 allocate( momx_rk2(
ka,
ia,
ja) )
144 allocate( momy_rk2(
ka,
ia,
ja) )
145 allocate( rhot_rk2(
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( i_comm_prog_rk1(max(
va,1)) )
150 allocate( i_comm_prog_rk2(max(
va,1)) )
158 i_comm_prog_rk1(iv) = 5 + iv
159 call comm_vars8_init(
'PROG_RK1', prog_rk1(:,:,:,iv), i_comm_prog_rk1(iv) )
168 i_comm_prog_rk2(iv) = 5 + iv
169 call comm_vars8_init(
'PROG_RK2', prog_rk2(:,:,:,iv), i_comm_prog_rk2(iv) )
172 dens_rk1(:,:,:) = undef
173 momz_rk1(:,:,:) = undef
174 momx_rk1(:,:,:) = undef
175 momy_rk1(:,:,:) = undef
176 rhot_rk1(:,:,:) = undef
177 if (
va > 0 ) prog_rk1(:,:,:,:) = undef
179 dens_rk2(:,:,:) = undef
180 momz_rk2(:,:,:) = undef
181 momx_rk2(:,:,:) = undef
182 momy_rk2(:,:,:) = undef
183 rhot_rk2(:,:,:) = undef
184 if (
va > 0 ) prog_rk2(:,:,:,:) = undef
192 DENS, MOMZ, MOMX, MOMY, RHOT, PROG, &
194 DENS_t, MOMZ_t, MOMX_t, MOMY_t, RHOT_t, &
195 DPRES0, CVtot, CORIOLI, &
196 num_diff, wdamp_coef, divdmp_coef, DDIV, &
197 FLAG_FCT_MOMENTUM, FLAG_FCT_T, &
198 FLAG_FCT_ALONG_STREAM, &
199 CDZ, FDZ, FDX, FDY, &
200 RCDZ, RCDX, RCDY, RFDZ, RFDX, RFDY, &
201 PHI, GSQRT, J13G, J23G, J33G, MAPF, &
202 REF_pres, REF_dens, &
203 BND_W, BND_E, BND_S, BND_N, TwoD, &
214 real(rp),
intent(inout) :: dens(
ka,
ia,
ja)
215 real(rp),
intent(inout) :: momz(
ka,
ia,
ja)
216 real(rp),
intent(inout) :: momx(
ka,
ia,
ja)
217 real(rp),
intent(inout) :: momy(
ka,
ia,
ja)
218 real(rp),
intent(inout) :: rhot(
ka,
ia,
ja)
219 real(rp),
intent(inout) :: prog(
ka,
ia,
ja,
va)
221 real(rp),
intent(inout) :: mflx_hi(
ka,
ia,
ja,3)
222 real(rp),
intent(out ) :: tflx_hi(
ka,
ia,
ja,3)
224 real(rp),
intent(in) :: dens_t(
ka,
ia,
ja)
225 real(rp),
intent(in) :: momz_t(
ka,
ia,
ja)
226 real(rp),
intent(in) :: momx_t(
ka,
ia,
ja)
227 real(rp),
intent(in) :: momy_t(
ka,
ia,
ja)
228 real(rp),
intent(in) :: rhot_t(
ka,
ia,
ja)
230 real(rp),
intent(in) :: dpres0(
ka,
ia,
ja)
231 real(rp),
intent(in) :: cvtot(
ka,
ia,
ja)
232 real(rp),
intent(in) :: corioli(
ia,
ja)
233 real(rp),
intent(in) :: num_diff(
ka,
ia,
ja,5,3)
234 real(rp),
intent(in) :: wdamp_coef(
ka)
235 real(rp),
intent(in) :: divdmp_coef
236 real(rp),
intent(in) :: ddiv(
ka,
ia,
ja)
238 logical,
intent(in) :: flag_fct_momentum
239 logical,
intent(in) :: flag_fct_t
240 logical,
intent(in) :: flag_fct_along_stream
242 real(rp),
intent(in) :: cdz (
ka)
243 real(rp),
intent(in) :: fdz (
ka-1)
244 real(rp),
intent(in) :: fdx (
ia-1)
245 real(rp),
intent(in) :: fdy (
ja-1)
246 real(rp),
intent(in) :: rcdz(
ka)
247 real(rp),
intent(in) :: rcdx(
ia)
248 real(rp),
intent(in) :: rcdy(
ja)
249 real(rp),
intent(in) :: rfdz(
ka-1)
250 real(rp),
intent(in) :: rfdx(
ia-1)
251 real(rp),
intent(in) :: rfdy(
ja-1)
253 real(rp),
intent(in) :: phi (
ka,
ia,
ja)
254 real(rp),
intent(in) :: gsqrt(
ka,
ia,
ja,7)
255 real(rp),
intent(in) :: j13g (
ka,
ia,
ja,7)
256 real(rp),
intent(in) :: j23g (
ka,
ia,
ja,7)
257 real(rp),
intent(in) :: j33g
258 real(rp),
intent(in) :: mapf (
ia,
ja,2,4)
260 real(rp),
intent(in) :: ref_pres(
ka,
ia,
ja)
261 real(rp),
intent(in) :: ref_dens(
ka,
ia,
ja)
263 logical,
intent(in) :: bnd_w
264 logical,
intent(in) :: bnd_e
265 logical,
intent(in) :: bnd_s
266 logical,
intent(in) :: bnd_n
267 logical,
intent(in) :: twod
269 real(rp),
intent(in) :: dt
271 real(rp) :: dens0(
ka,
ia,
ja)
272 real(rp) :: momz0(
ka,
ia,
ja)
273 real(rp) :: momx0(
ka,
ia,
ja)
274 real(rp) :: momy0(
ka,
ia,
ja)
275 real(rp) :: rhot0(
ka,
ia,
ja)
278 real(rp) :: mflx_hi_rk(
ka,
ia,
ja,3,2)
279 real(rp) :: tflx_hi_rk(
ka,
ia,
ja,3,2)
283 integer :: i, j,
k, iv, n
289 dens_rk1(:,:,:) = undef
290 momz_rk1(:,:,:) = undef
291 momx_rk1(:,:,:) = undef
292 momy_rk1(:,:,:) = undef
293 rhot_rk1(:,:,:) = undef
294 if (
va > 0 ) prog_rk1(:,:,:,:) = undef
296 dens_rk2(:,:,:) = undef
297 momz_rk2(:,:,:) = undef
298 momx_rk2(:,:,:) = undef
299 momy_rk2(:,:,:) = undef
300 rhot_rk2(:,:,:) = undef
301 if (
va > 0 ) prog_rk2(:,:,:,:) = undef
303 mflx_hi_rk(:,:,:,:,:) = undef
304 tflx_hi_rk(:,:,:,:,:) = undef
308 mflx_hi( 1:
ks-1,:,:,:) = undef
309 mflx_hi(
ke+1:
ka ,:,:,:) = undef
323 if (
va > 0 ) prog0 = prog
325 if ( bnd_w .and. (.not. twod) )
then
328 mflx_hi_rk(
k,
is-1,j,2,:) = mflx_hi(
k,
is-1,j,2)
332 if ( bnd_e .and. (.not. twod) )
then
335 mflx_hi_rk(
k,
ie,j,2,:) = mflx_hi(
k,
ie,j,2)
342 mflx_hi_rk(
k,i,
js-1,3,:) = mflx_hi(
k,i,
js-1,3)
349 mflx_hi_rk(
k,i,
je,3,:) = mflx_hi(
k,i,
je,3)
366 call atmos_dyn_tstep( dens_rk1, momz_rk1, momx_rk1, momy_rk1, rhot_rk1, &
368 mflx_hi_rk(:,:,:,:,1), tflx_hi_rk(:,:,:,:,1), &
369 dens0, momz0, momx0, momy0, rhot0, &
370 dens, momz, momx, momy, rhot, &
371 dens_t, momz_t, momx_t, momy_t, rhot_t, &
373 dpres0, cvtot, corioli, &
374 num_diff, wdamp_coef, divdmp_coef, ddiv, &
375 flag_fct_momentum, flag_fct_t, &
376 flag_fct_along_stream, &
377 cdz, fdz, fdx, fdy, &
378 rcdz, rcdx, rcdy, rfdz, rfdx, rfdy, &
379 phi, gsqrt, j13g, j23g, j33g, mapf, &
380 ref_pres, ref_dens, &
381 bnd_w, bnd_e, bnd_s, bnd_n, twod, &
389 dens0, momz0, momx0, momy0, rhot0, &
391 bnd_w, bnd_e, bnd_s, bnd_n, twod )
395 call comm_vars8( dens_rk1(:,:,:), i_comm_dens_rk1 )
396 call comm_vars8( momz_rk1(:,:,:), i_comm_momz_rk1 )
397 call comm_vars8( momx_rk1(:,:,:), i_comm_momx_rk1 )
398 call comm_vars8( momy_rk1(:,:,:), i_comm_momy_rk1 )
399 call comm_vars8( rhot_rk1(:,:,:), i_comm_rhot_rk1 )
401 call comm_vars8( prog_rk1(:,:,:,iv), i_comm_prog_rk1(iv) )
404 call comm_wait ( dens_rk1(:,:,:), i_comm_dens_rk1, .false. )
405 call comm_wait ( momz_rk1(:,:,:), i_comm_momz_rk1, .false. )
406 call comm_wait ( momx_rk1(:,:,:), i_comm_momx_rk1, .false. )
407 call comm_wait ( momy_rk1(:,:,:), i_comm_momy_rk1, .false. )
408 call comm_wait ( rhot_rk1(:,:,:), i_comm_rhot_rk1, .false. )
410 call comm_wait ( prog_rk1(:,:,:,iv), i_comm_prog_rk1(iv), .false. )
419 call atmos_dyn_tstep( dens_rk2, momz_rk2, momx_rk2, momy_rk2, rhot_rk2, &
421 mflx_hi_rk(:,:,:,:,2), tflx_hi_rk(:,:,:,:,2), &
422 dens0, momz0, momx0, momy0, rhot0, &
423 dens_rk1, momz_rk1, momx_rk1, momy_rk1, rhot_rk1, &
424 dens_t, momz_t, momx_t, momy_t, rhot_t, &
426 dpres0, cvtot, corioli, &
427 num_diff, wdamp_coef, divdmp_coef, ddiv, &
428 flag_fct_momentum, flag_fct_t, &
429 flag_fct_along_stream, &
430 cdz, fdz, fdx, fdy, &
431 rcdz, rcdx, rcdy, rfdz, rfdx, rfdy, &
432 phi, gsqrt, j13g, j23g, j33g, mapf, &
433 ref_pres, ref_dens, &
434 bnd_w, bnd_e, bnd_s, bnd_n, twod, &
442 dens0, momz0, momx0, momy0, rhot0, &
444 bnd_w, bnd_e, bnd_s, bnd_n, twod )
448 call comm_vars8( dens_rk2(:,:,:), i_comm_dens_rk2 )
449 call comm_vars8( momz_rk2(:,:,:), i_comm_momz_rk2 )
450 call comm_vars8( momx_rk2(:,:,:), i_comm_momx_rk2 )
451 call comm_vars8( momy_rk2(:,:,:), i_comm_momy_rk2 )
452 call comm_vars8( rhot_rk2(:,:,:), i_comm_rhot_rk2 )
454 call comm_vars8( prog_rk2(:,:,:,iv), i_comm_prog_rk2(iv) )
457 call comm_wait ( dens_rk2(:,:,:), i_comm_dens_rk2, .false. )
458 call comm_wait ( momz_rk2(:,:,:), i_comm_momz_rk2, .false. )
459 call comm_wait ( momx_rk2(:,:,:), i_comm_momx_rk2, .false. )
460 call comm_wait ( momy_rk2(:,:,:), i_comm_momy_rk2, .false. )
461 call comm_wait ( rhot_rk2(:,:,:), i_comm_rhot_rk2, .false. )
463 call comm_wait ( prog_rk2(:,:,:,iv), i_comm_prog_rk2(iv), .false. )
472 call atmos_dyn_tstep( dens, momz, momx, momy, rhot, &
475 dens0, momz0, momx0, momy0, rhot0, &
476 dens_rk2, momz_rk2, momx_rk2, momy_rk2, rhot_rk2, &
477 dens_t, momz_t, momx_t, momy_t, rhot_t, &
479 dpres0, cvtot, corioli, &
480 num_diff, wdamp_coef, divdmp_coef, ddiv, &
481 flag_fct_momentum, flag_fct_t, &
482 flag_fct_along_stream, &
483 cdz, fdz, fdx, fdy, &
484 rcdz, rcdx, rcdy, rfdz, rfdx, rfdy, &
485 phi, gsqrt, j13g, j23g, j33g, mapf, &
486 ref_pres, ref_dens, &
487 bnd_w, bnd_e, bnd_s, bnd_n, twod, &
490 if ( .NOT. flag_ws2002 )
then
494 dens(
k,i,j) = ( dens_rk1(
k,i,j) * 3.0_rp &
495 + dens(
k,i,j) * 3.0_rp &
496 - dens0(
k,i,j) * 2.0_rp ) / 4.0_rp
504 momz(
k,i,j) = ( momz_rk1(
k,i,j) * 3.0_rp &
505 + momz(
k,i,j) * 3.0_rp &
506 - momz0(
k,i,j) * 2.0_rp ) / 4.0_rp
514 momx(
k,i,j) = ( momx_rk1(
k,i,j) * 3.0_rp &
515 + momx(
k,i,j) * 3.0_rp &
516 - momx0(
k,i,j) * 2.0_rp ) / 4.0_rp
524 momy(
k,i,j) = ( momy_rk1(
k,i,j) * 3.0_rp &
525 + momy(
k,i,j) * 3.0_rp &
526 - momy0(
k,i,j) * 2.0_rp ) / 4.0_rp
534 rhot(
k,i,j) = ( rhot_rk1(
k,i,j) * 3.0_rp &
535 + rhot(
k,i,j) * 3.0_rp &
536 - rhot0(
k,i,j) * 2.0_rp ) / 4.0_rp
545 prog(
k,i,j,iv) = ( prog_rk1(
k,i,j,iv) * 3.0_rp &
546 + prog(
k,i,j,iv) * 3.0_rp &
547 - prog0(
k,i,j,iv) * 2.0_rp ) / 4.0_rp
557 mflx_hi(
k,i,j,n) = ( mflx_hi_rk(
k,i,j,n,1) &
558 + mflx_hi(
k,i,j,n ) * 3.0_rp ) / 4.0_rp
568 tflx_hi(
k,i,j,n) = ( tflx_hi_rk(
k,i,j,n,1) &
569 + tflx_hi(
k,i,j,n ) * 3.0_rp ) / 4.0_rp