SCALE-RM
scale_atmos_dyn_tinteg_short_rk4.F90
Go to the documentation of this file.
1 !-------------------------------------------------------------------------------
14 !-------------------------------------------------------------------------------
15 #include "inc_openmp.h"
17  !-----------------------------------------------------------------------------
18  !
19  !++ used modules
20  !
21  use scale_precision
22  use scale_stdio
23  use scale_prof
25  use scale_index
26  use scale_tracer
27 #if defined DEBUG || defined QUICKDEBUG
28  use scale_debug, only: &
29  check
30  use scale_const, only: &
31  undef => const_undef, &
32  iundef => const_undef2
33 #endif
34  !-----------------------------------------------------------------------------
35  implicit none
36  private
37  !-----------------------------------------------------------------------------
38  !
39  !++ Public procedure
40  !
43 
44  !-----------------------------------------------------------------------------
45  !
46  !++ Public parameters & variables
47  !
48  !-----------------------------------------------------------------------------
49  !
50  !++ Private procedure
51  !
52  !-----------------------------------------------------------------------------
53  !
54  !++ Private parameters & variables
55  !
56  real(RP), private, allocatable :: DENS_RK1(:,:,:) ! prognostic variables (+1/4 step)
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(:,:,:) ! prognostic variables (+2/4 step)
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(:,:,:) ! prognostic variables (+3/4 step)
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(:,:,:,:)
74 
75  ! for communication
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(:)
82 
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(:)
89 
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(:)
96 
97  !-----------------------------------------------------------------------------
98 contains
99  !-----------------------------------------------------------------------------
102  tinteg_type )
103  use scale_process, only: &
105  use scale_const, only: &
106  undef => const_undef
107  use scale_comm, only: &
109  implicit none
110 
111  character(len=*) :: tinteg_type
112 
113  integer :: iv
114  !---------------------------------------------------------------------------
115 
116  if ( tinteg_type /= 'RK4' ) then
117  write(*,*) 'xxx TINTEG_TYPE is not RK4. Check!'
118  call prc_mpistop
119  end if
120 
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) )
126 
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) )
132 
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) )
138 
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)) )
145 
146  call comm_vars8_init( 'DENS_RK1', dens_rk1, i_comm_dens_rk1 )
147  call comm_vars8_init( 'MOMZ_RK1', momz_rk1, i_comm_momz_rk1 )
148  call comm_vars8_init( 'MOMX_RK1', momx_rk1, i_comm_momx_rk1 )
149  call comm_vars8_init( 'MOMY_RK1', momy_rk1, i_comm_momy_rk1 )
150  call comm_vars8_init( 'RHOT_RK1', rhot_rk1, i_comm_rhot_rk1 )
151  do iv = 1, va
152  i_comm_prog_rk1(iv) = 5 + iv
153  call comm_vars8_init( 'PROG_RK1', prog_rk1(:,:,:,iv), i_comm_prog_rk1(iv) )
154  enddo
155 
156  call comm_vars8_init( 'DENS_RK2', dens_rk2, i_comm_dens_rk2 )
157  call comm_vars8_init( 'MOMZ_RK2', momz_rk2, i_comm_momz_rk2 )
158  call comm_vars8_init( 'MOMX_RK2', momx_rk2, i_comm_momx_rk2 )
159  call comm_vars8_init( 'MOMY_RK2', momy_rk2, i_comm_momy_rk2 )
160  call comm_vars8_init( 'RHOT_RK2', rhot_rk2, i_comm_rhot_rk2 )
161  do iv = 1, va
162  i_comm_prog_rk2(iv) = 5 + iv
163  call comm_vars8_init( 'PROG_RK2', prog_rk2(:,:,:,iv), i_comm_prog_rk2(iv) )
164  enddo
165 
166  call comm_vars8_init( 'DENS_RK3', dens_rk3, i_comm_dens_rk3 )
167  call comm_vars8_init( 'MOMZ_RK3', momz_rk3, i_comm_momz_rk3 )
168  call comm_vars8_init( 'MOMX_RK3', momx_rk3, i_comm_momx_rk3 )
169  call comm_vars8_init( 'MOMY_RK3', momy_rk3, i_comm_momy_rk3 )
170  call comm_vars8_init( 'RHOT_RK3', rhot_rk3, i_comm_rhot_rk3 )
171  do iv = 1, va
172  i_comm_prog_rk3(iv) = 5 + iv
173  call comm_vars8_init( 'PROG_RK3', prog_rk3(:,:,:,iv), i_comm_prog_rk3(iv) )
174  enddo
175 
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
182 
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
189 
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
196 
197  return
198  end subroutine atmos_dyn_tinteg_short_rk4_setup
199 
200  !-----------------------------------------------------------------------------
202  subroutine atmos_dyn_tinteg_short_rk4( &
203  DENS, MOMZ, MOMX, MOMY, RHOT, PROG, &
204  mflx_hi, tflx_hi, &
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, &
215  dt )
216  use scale_comm, only: &
217  comm_vars8, &
218  comm_wait
219  use scale_atmos_dyn_tstep_short, only: &
220  atmos_dyn_tstep => atmos_dyn_tstep_short
221  use scale_atmos_dyn_common, only: &
223  implicit none
224 
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)
231 
232  real(RP), intent(inout) :: mflx_hi(ka,ia,ja,3)
233  real(RP), intent(inout) :: tflx_hi(ka,ia,ja,3)
234 
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)
240 
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)
248 
249  logical, intent(in) :: flag_fct_momentum
250  logical, intent(in) :: flag_fct_t
251  logical, intent(in) :: flag_fct_along_stream
252 
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)
263 
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)
270 
271  real(RP), intent(in) :: ref_pres(ka,ia,ja)
272  real(RP), intent(in) :: ref_dens(ka,ia,ja)
273 
274  logical, intent(in) :: bnd_w
275  logical, intent(in) :: bnd_e
276  logical, intent(in) :: bnd_s
277  logical, intent(in) :: bnd_n
278 
279  real(RP), intent(in) :: dt
280 
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)
286  real(RP) :: prog0(ka,ia,ja,va)
287 
288  real(RP) :: mflx_hi_rk(ka,ia,ja,3,3)
289  real(RP) :: tflx_hi_rk(ka,ia,ja,3,3)
290 
291  real(RP) :: dtrk
292 
293  integer :: i, j, k, iv, n
294  !---------------------------------------------------------------------------
295 
296  call prof_rapstart("DYN_RK4_Prep",3)
297 
298 #ifdef DEBUG
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
305 
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
312 
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
319 
320  mflx_hi_rk(:,:,:,:,:) = undef
321  tflx_hi_rk(:,:,:,:,:) = undef
322 #endif
323 
324 #ifdef QUICKDEBUG
325  mflx_hi( 1:ks-1,:,:,:) = undef
326  mflx_hi(ke+1:ka ,:,:,:) = undef
327 #endif
328 
329 !OCL XFILL
330  dens0 = dens
331 !OCL XFILL
332  momz0 = momz
333 !OCL XFILL
334  momx0 = momx
335 !OCL XFILL
336  momy0 = momy
337 !OCL XFILL
338  rhot0 = rhot
339 !OCL XFILL
340  if ( va > 0 ) prog0 = prog
341 
342  if ( bnd_w ) then
343  do j = js, je
344  do k = ks, ke
345  mflx_hi_rk(k,is-1,j,2,:) = mflx_hi(k,is-1,j,2)
346  end do
347  end do
348  end if
349  if ( bnd_e ) then
350  do j = js, je
351  do k = ks, ke
352  mflx_hi_rk(k,ie,j,2,:) = mflx_hi(k,ie,j,2)
353  end do
354  end do
355  end if
356  if ( bnd_s ) then
357  do i = is, ie
358  do k = ks, ke
359  mflx_hi_rk(k,i,js-1,3,:) = mflx_hi(k,i,js-1,3)
360  end do
361  end do
362  end if
363  if ( bnd_n ) then
364  do i = is, ie
365  do k = ks, ke
366  mflx_hi_rk(k,i,je,3,:) = mflx_hi(k,i,je,3)
367  end do
368  end do
369  end if
370 
371  call prof_rapend ("DYN_RK4_Prep",3)
372 
373  !------------------------------------------------------------------------
374  ! Start RK
375  !------------------------------------------------------------------------
376 
377  !##### RK1 : PROG0,PROG->PROG_RK1 #####
378 
379  call prof_rapstart("DYN_RK4",3)
380 
381  dtrk = dt / 2.0_rp
382 
383  call atmos_dyn_tstep( dens_rk1, momz_rk1, momx_rk1, momy_rk1, rhot_rk1, & ! [OUT]
384  prog_rk1, & ! [OUT]
385  mflx_hi_rk(:,:,:,:,1), tflx_hi_rk(:,:,:,:,1), & ! [INOUT]
386  dens0, momz0, momx0, momy0, rhot0, & ! [IN]
387  dens, momz, momx, momy, rhot, & ! [IN]
388  dens_t, momz_t, momx_t, momy_t, rhot_t, & ! [IN]
389  prog0, prog, & ! [IN]
390  rtot, cvtot, corioli, & ! [IN]
391  num_diff, wdamp_coef, divdmp_coef, ddiv, & ! [IN]
392  flag_fct_momentum, flag_fct_t, & ! [IN]
393  flag_fct_along_stream, & ! [IN]
394  cdz, fdz, fdx, fdy, & ! [IN]
395  rcdz, rcdx, rcdy, rfdz, rfdx, rfdy, & ! [IN]
396  phi, gsqrt, j13g, j23g, j33g, mapf, & ! [IN]
397  ref_pres, ref_dens, & ! [IN]
398  bnd_w, bnd_e, bnd_s, bnd_n, & ! [IN]
399  dtrk, .false. ) ! [IN]
400 
401  call prof_rapend ("DYN_RK4",3)
402  call prof_rapstart("DYN_RK4_BND",3)
403 
404  call atmos_dyn_copy_boundary( dens_rk1, momz_rk1, momx_rk1, momy_rk1, rhot_rk1, & ! [INOUT]
405  prog_rk1, & ! [INOUT]
406  dens0, momz0, momx0, momy0, rhot0, & ! [IN]
407  prog0, & ! [IN]
408  bnd_w, bnd_e, bnd_s, bnd_n ) ! [IN]
409 
410  call prof_rapend ("DYN_RK4_BND",3)
411 
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 )
417  do iv = 1, va
418  call comm_vars8( prog_rk1(:,:,:,iv), i_comm_prog_rk1(iv) )
419  enddo
420 
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. )
426  do iv = 1, va
427  call comm_wait ( prog_rk1(:,:,:,iv), i_comm_prog_rk1(iv), .false. )
428  enddo
429 
430  !##### RK2 : PROG0,PROG_RK1->PROG_RK2 #####
431 
432  call prof_rapstart("DYN_RK4",3)
433 
434  dtrk = dt / 2.0_rp
435 
436  call atmos_dyn_tstep( dens_rk2, momz_rk2, momx_rk2, momy_rk2, rhot_rk2, & ! [OUT]
437  prog_rk2, & ! [OUT]
438  mflx_hi_rk(:,:,:,:,2), tflx_hi_rk(:,:,:,:,2), & ! [INOUT]
439  dens0, momz0, momx0, momy0, rhot0, & ! [IN]
440  dens_rk1, momz_rk1, momx_rk1, momy_rk1, rhot_rk1, & ! [IN]
441  dens_t, momz_t, momx_t, momy_t, rhot_t, & ! [IN]
442  prog0, prog_rk1, & ! [IN]
443  rtot, cvtot, corioli, & ! [IN]
444  num_diff, wdamp_coef, divdmp_coef, ddiv, & ! [IN]
445  flag_fct_momentum, flag_fct_t, & ! [IN]
446  flag_fct_along_stream, & ! [IN]
447  cdz, fdz, fdx, fdy, & ! [IN]
448  rcdz, rcdx, rcdy, rfdz, rfdx, rfdy, & ! [IN]
449  phi, gsqrt, j13g, j23g, j33g, mapf, & ! [IN]
450  ref_pres, ref_dens, & ! [IN]
451  bnd_w, bnd_e, bnd_s, bnd_n, & ! [IN]
452  dtrk, .false. ) ! [IN]
453 
454  call prof_rapend ("DYN_RK4",3)
455  call prof_rapstart("DYN_RK4_BND",3)
456 
457  call atmos_dyn_copy_boundary( dens_rk2, momz_rk2, momx_rk2, momy_rk2, rhot_rk2, & ! [INOUT]
458  prog_rk2, & ! [INOUT]
459  dens0, momz0, momx0, momy0, rhot0, & ! [IN]
460  prog0, & ! [IN]
461  bnd_w, bnd_e, bnd_s, bnd_n ) ! [IN]
462 
463  call prof_rapend ("DYN_RK4_BND",3)
464 
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 )
470  do iv = 1, va
471  call comm_vars8( prog_rk2(:,:,:,iv), i_comm_prog_rk2(iv) )
472  enddo
473 
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. )
479  do iv = 1, va
480  call comm_wait ( prog_rk2(:,:,:,iv), i_comm_prog_rk2(iv), .false. )
481  enddo
482 
483  !##### RK3 : PROG0,PROG_RK2->PROG_RK3 #####
484 
485  call prof_rapstart("DYN_RK4",3)
486 
487  dtrk = dt
488 
489  call atmos_dyn_tstep( dens_rk3, momz_rk3, momx_rk3, momy_rk3, rhot_rk3, & ! [OUT]
490  prog_rk3, & ! [OUT]
491  mflx_hi_rk(:,:,:,:,3), tflx_hi_rk(:,:,:,:,3), & ! [INOUT]
492  dens0, momz0, momx0, momy0, rhot0, & ! [IN]
493  dens_rk2, momz_rk2, momx_rk2, momy_rk2, rhot_rk2, & ! [IN]
494  dens_t, momz_t, momx_t, momy_t, rhot_t, & ! [IN]
495  prog0, prog_rk2, & ! [IN]
496  rtot, cvtot, corioli, & ! [IN]
497  num_diff, wdamp_coef, divdmp_coef, ddiv, & ! [IN]
498  flag_fct_momentum, flag_fct_t, & ! [IN]
499  flag_fct_along_stream, & ! [IN]
500  cdz, fdz, fdx, fdy, & ! [IN]
501  rcdz, rcdx, rcdy, rfdz, rfdx, rfdy, & ! [IN]
502  phi, gsqrt, j13g, j23g, j33g, mapf, & ! [IN]
503  ref_pres, ref_dens, & ! [IN]
504  bnd_w, bnd_e, bnd_s, bnd_n, & ! [IN]
505  dtrk, .false. ) ! [IN]
506 
507  call prof_rapend ("DYN_RK4",3)
508  call prof_rapstart("DYN_RK4_BND",3)
509 
510  call atmos_dyn_copy_boundary( dens_rk3, momz_rk3, momx_rk3, momy_rk3, rhot_rk3, & ! [INOUT]
511  prog_rk3, & ! [INOUT]
512  dens0, momz0, momx0, momy0, rhot0, & ! [IN]
513  prog0, & ! [IN]
514  bnd_w, bnd_e, bnd_s, bnd_n ) ! [IN]
515 
516  call prof_rapend ("DYN_RK4_BND",3)
517 
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 )
523  do iv = 1, va
524  call comm_vars8( prog_rk3(:,:,:,iv), i_comm_prog_rk3(iv) )
525  enddo
526 
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. )
532  do iv = 1, va
533  call comm_wait ( prog_rk3(:,:,:,iv), i_comm_prog_rk3(iv), .false. )
534  enddo
535 
536  !##### RK4 : PROG0,PROG_RK3->PROG #####
537 
538  call prof_rapstart("DYN_RK4",3)
539 
540  dtrk = dt
541 
542  call atmos_dyn_tstep( dens, momz, momx, momy, rhot, & ! [OUT]
543  prog, & ! [OUT]
544  mflx_hi, tflx_hi, & ! [INOUT]
545  dens0, momz0, momx0, momy0, rhot0, & ! [IN]
546  dens_rk3, momz_rk3, momx_rk3, momy_rk3, rhot_rk3, & ! [IN]
547  dens_t, momz_t, momx_t, momy_t, rhot_t, & ! [IN]
548  prog0, prog_rk3, & ! [IN]
549  rtot, cvtot, corioli, & ! [IN]
550  num_diff, wdamp_coef, divdmp_coef, ddiv, & ! [IN]
551  flag_fct_momentum, flag_fct_t, & ! [IN]
552  flag_fct_along_stream, & ! [IN]
553  cdz, fdz, fdx, fdy, & ! [IN]
554  rcdz, rcdx, rcdy, rfdz, rfdx, rfdy, & ! [IN]
555  phi, gsqrt, j13g, j23g, j33g, mapf, & ! [IN]
556  ref_pres, ref_dens, & ! [IN]
557  bnd_w, bnd_e, bnd_s, bnd_n, & ! [IN]
558  dtrk, .true. ) ! [IN]
559 
560  !$omp parallel do default(none) private(i,j,k) OMP_SCHEDULE_ collapse(2) &
561  !$omp shared(JS,JE,IS,IE,KS,KE,DENS,DENS_RK1,DENS_RK2,DENS_RK3,DENS0)
562  do j = js, je
563  do i = is, ie
564  do k = ks, ke
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 &
568  + dens(k,i,j) &
569  - dens0(k,i,j) * 3.0_rp ) / 6.0_rp
570  enddo
571  enddo
572  enddo
573 
574  do j = js, je
575  do i = is, ie
576  do k = ks, ke-1
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 &
580  + momz(k,i,j) &
581  - momz0(k,i,j) * 3.0_rp ) / 6.0_rp
582  enddo
583  enddo
584  enddo
585 
586  do j = js, je
587  do i = is, ie
588  do k = ks, ke
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 &
592  + momx(k,i,j) &
593  - momx0(k,i,j) * 3.0_rp ) / 6.0_rp
594  enddo
595  enddo
596  enddo
597 
598  do j = js, je
599  do i = is, ie
600  do k = ks, ke
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 &
604  + momy(k,i,j) &
605  - momy0(k,i,j) * 3.0_rp ) / 6.0_rp
606  enddo
607  enddo
608  enddo
609 
610  !$omp parallel do default(none) &
611  !$omp shared(JS,JE,IS,IE,KS,KE,RHOT,RHOT_RK1,RHOT_RK2,RHOT_RK3,RHOT0) &
612  !$omp private(i,j,k) OMP_SCHEDULE_ collapse(2)
613  do j = js, je
614  do i = is, ie
615  do k = ks, ke
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 &
619  + rhot(k,i,j) &
620  - rhot0(k,i,j) * 3.0_rp ) / 6.0_rp
621  enddo
622  enddo
623  enddo
624 
625  do iv = 1, va
626  do j = js, je
627  do i = is, ie
628  do k = ks, ke
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 &
632  + prog(k,i,j,iv) &
633  - prog0(k,i,j,iv) * 3.0_rp ) / 6.0_rp
634  enddo
635  enddo
636  enddo
637  enddo
638 
639 
640  do n = 1, 3
641  do j = js, je
642  do i = is, ie
643  do k = ks, ke
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
648  enddo
649  enddo
650  enddo
651  enddo
652 
653  do n = 1, 3
654  do j = js, je
655  do i = is, ie
656  do k = ks, ke
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
661  enddo
662  enddo
663  enddo
664  enddo
665 
666  call prof_rapend ("DYN_RK4",3)
667 
668  return
669  end subroutine atmos_dyn_tinteg_short_rk4
670 
integer, public is
start point of inner domain: x, local
module DEBUG
Definition: scale_debug.F90:13
integer, public je
end point of inner domain: y, local
subroutine, public prc_mpistop
Abort MPI.
integer, public va
Definition: scale_index.F90:38
subroutine, public comm_vars8_init(varname, var, vid)
Register variables.
Definition: scale_comm.F90:313
module Atmosphere / Dynamical scheme
subroutine, public atmos_dyn_tinteg_short_rk4_setup(tinteg_type)
Setup.
module STDIO
Definition: scale_stdio.F90:12
integer, public ke
end point of inner domain: z, local
subroutine, public check(current_line, v)
Undefined value checker.
Definition: scale_debug.F90:58
real(rp), public const_undef
Definition: scale_const.F90:43
module grid index
module TRACER
module Index
Definition: scale_index.F90:14
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
module COMMUNICATION
Definition: scale_comm.F90:23
integer, public js
start point of inner domain: y, local
integer, parameter, public const_undef2
undefined value (INT2)
Definition: scale_const.F90:40
module Atmosphere / Dynamics common
module PROCESS
module CONSTANT
Definition: scale_const.F90:14
integer, public ks
start point of inner domain: z, local
subroutine, public prof_rapstart(rapname_base, level)
Start raptime.
Definition: scale_prof.F90:156
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)
module profiler
Definition: scale_prof.F90:10
integer, public ie
end point of inner domain: x, local
module PRECISION
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.
subroutine, public prof_rapend(rapname_base, level)
Save raptime.
Definition: scale_prof.F90:204
integer, public ja
of whole cells: y, local, with HALO