SCALE-RM
scale_atmos_dyn_tinteg_large_rk3.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 
28 #ifdef DEBUG
29  use scale_debug, only: &
30  check
31  use scale_const, only: &
32  undef => const_undef, &
33  iundef => const_undef2
34 #endif
35  !-----------------------------------------------------------------------------
36  implicit none
37  private
38  !-----------------------------------------------------------------------------
39  !
40  !++ Public procedure
41  !
44 
45  !-----------------------------------------------------------------------------
46  !
47  !++ Public parameters & variables
48  !
49  !-----------------------------------------------------------------------------
50  !
51  !++ Private procedure
52  !
53  !-----------------------------------------------------------------------------
54  !
55  !++ Private parameters & variables
56  !
57  !-----------------------------------------------------------------------------
58 contains
59 
60  !-----------------------------------------------------------------------------
63  tinteg_type )
64  use scale_process, only: &
66  use scale_const, only: &
67  undef => const_undef
68  use scale_comm, only: &
70  implicit none
71 
72  character(len=*) :: tinteg_type
73 
74  integer :: iv
75  !---------------------------------------------------------------------------
76 
77  if ( tinteg_type /= 'RK3' ) then
78  write(*,*) 'xxx TINTEG_LARGE_TYPE is not RK3. Check!'
79  call prc_mpistop
80  end if
81 
82  return
84 
85  !-----------------------------------------------------------------------------
87  subroutine atmos_dyn_tinteg_large_rk3( &
88  DENS, MOMZ, MOMX, MOMY, RHOT, QTRC, &
89  PROG, &
90  DENS_av, MOMZ_av, MOMX_av, MOMY_av, RHOT_av, QTRC_av, &
91  mflx_hi, tflx_hi, &
92  num_diff, num_diff_q, &
93  DENS_tp, MOMZ_tp, MOMX_tp, MOMY_tp, RHOT_tp, RHOQ_tp, &
94  CORIOLI, &
95  CDZ, CDX, CDY, FDZ, FDX, FDY, &
96  RCDZ, RCDX, RCDY, RFDZ, RFDX, RFDY, &
97  PHI, GSQRT, &
98  J13G, J23G, J33G, MAPF, &
99  AQ_CV, &
100  REF_dens, REF_pott, REF_qv, REF_pres, &
101  BND_W, BND_E, BND_S, BND_N, &
102  ND_COEF, ND_COEF_Q, ND_ORDER, ND_SFC_FACT, ND_USE_RS, &
103  DAMP_DENS, DAMP_VELZ, DAMP_VELX, &
104  DAMP_VELY, DAMP_POTT, DAMP_QTRC, &
105  DAMP_alpha_DENS, DAMP_alpha_VELZ, DAMP_alpha_VELX, &
106  DAMP_alpha_VELY, DAMP_alpha_POTT, DAMP_alpha_QTRC, &
107  divdmp_coef, &
108  FLAG_FCT_MOMENTUM, FLAG_FCT_T, FLAG_FCT_TRACER, &
109  FLAG_FCT_ALONG_STREAM, &
110  USE_AVERAGE, &
111  DTL, DTS )
112  use scale_const, only: &
113  rdry => const_rdry, &
114  rvap => const_rvap, &
115  cvdry => const_cvdry
116  use scale_comm, only: &
117  comm_vars8, &
118  comm_wait
119  use scale_gridtrans, only: &
120  i_xyz, &
121  i_xyw, &
122  i_uyz, &
123  i_xvz, &
124  i_xy, &
125  i_uy, &
126  i_xv
127  use scale_atmos_dyn_common, only: &
131  use scale_atmos_dyn_fvm_flux_ud1, only: &
135  use scale_atmos_dyn_fvm_flux, only: &
139  use scale_atmos_dyn_tstep_large, only: &
141  use scale_atmos_boundary, only: &
142  bnd_qa, &
143  bnd_smoother_fact => atmos_boundary_smoother_fact
144  use scale_history, only: &
145 #ifdef hist_tend
146  hist_in, &
147 #endif
148  hist_switch
149  implicit none
150 
151  real(RP), intent(inout) :: DENS(ka,ia,ja)
152  real(RP), intent(inout) :: MOMZ(ka,ia,ja)
153  real(RP), intent(inout) :: MOMX(ka,ia,ja)
154  real(RP), intent(inout) :: MOMY(ka,ia,ja)
155  real(RP), intent(inout) :: RHOT(ka,ia,ja)
156  real(RP), intent(inout) :: QTRC(ka,ia,ja,qa)
157 
158  real(RP), intent(inout) :: PROG(ka,ia,ja,va)
159 
160  real(RP), intent(inout) :: DENS_av(ka,ia,ja)
161  real(RP), intent(inout) :: MOMZ_av(ka,ia,ja)
162  real(RP), intent(inout) :: MOMX_av(ka,ia,ja)
163  real(RP), intent(inout) :: MOMY_av(ka,ia,ja)
164  real(RP), intent(inout) :: RHOT_av(ka,ia,ja)
165  real(RP), intent(inout) :: QTRC_av(ka,ia,ja,qa)
166 
167  real(RP), intent(out) :: mflx_hi(ka,ia,ja,3)
168  real(RP), intent(out) :: tflx_hi(ka,ia,ja,3)
169 
170  real(RP), intent(out) :: num_diff(ka,ia,ja,5,3)
171  real(RP), intent(out) :: num_diff_q(ka,ia,ja,3)
172 
173  real(RP), intent(in) :: DENS_tp(ka,ia,ja)
174  real(RP), intent(in) :: MOMZ_tp(ka,ia,ja)
175  real(RP), intent(in) :: MOMX_tp(ka,ia,ja)
176  real(RP), intent(in) :: MOMY_tp(ka,ia,ja)
177  real(RP), intent(in) :: RHOT_tp(ka,ia,ja)
178  real(RP), intent(in) :: RHOQ_tp(ka,ia,ja,qa)
179 
180  real(RP), intent(in) :: CORIOLI(ia,ja)
181 
182  real(RP), intent(in) :: CDZ (ka)
183  real(RP), intent(in) :: CDX (ia)
184  real(RP), intent(in) :: CDY (ja)
185  real(RP), intent(in) :: FDZ (ka-1)
186  real(RP), intent(in) :: FDX (ia-1)
187  real(RP), intent(in) :: FDY (ja-1)
188  real(RP), intent(in) :: RCDZ(ka)
189  real(RP), intent(in) :: RCDX(ia)
190  real(RP), intent(in) :: RCDY(ja)
191  real(RP), intent(in) :: RFDZ(ka-1)
192  real(RP), intent(in) :: RFDX(ia-1)
193  real(RP), intent(in) :: RFDY(ja-1)
194 
195  real(RP), intent(in) :: PHI (ka,ia,ja)
196  real(RP), intent(in) :: GSQRT(ka,ia,ja,7)
197  real(RP), intent(in) :: J13G (ka,ia,ja,7)
198  real(RP), intent(in) :: J23G (ka,ia,ja,7)
199  real(RP), intent(in) :: J33G
200  real(RP), intent(in) :: MAPF (ia,ja,2,4)
201 
202  real(RP), intent(in) :: AQ_CV(qqa)
203 
204  real(RP), intent(in) :: REF_dens(ka,ia,ja)
205  real(RP), intent(in) :: REF_pott(ka,ia,ja)
206  real(RP), intent(in) :: REF_qv (ka,ia,ja)
207  real(RP), intent(in) :: REF_pres(ka,ia,ja)
208 
209  logical, intent(in) :: BND_W
210  logical, intent(in) :: BND_E
211  logical, intent(in) :: BND_S
212  logical, intent(in) :: BND_N
213 
214  real(RP), intent(in) :: ND_COEF
215  real(RP), intent(in) :: ND_COEF_Q
216  integer, intent(in) :: ND_ORDER
217  real(RP), intent(in) :: ND_SFC_FACT
218  logical, intent(in) :: ND_USE_RS
219 
220  real(RP), intent(in) :: DAMP_DENS(ka,ia,ja)
221  real(RP), intent(in) :: DAMP_VELZ(ka,ia,ja)
222  real(RP), intent(in) :: DAMP_VELX(ka,ia,ja)
223  real(RP), intent(in) :: DAMP_VELY(ka,ia,ja)
224  real(RP), intent(in) :: DAMP_POTT(ka,ia,ja)
225  real(RP), intent(in) :: DAMP_QTRC(ka,ia,ja,bnd_qa)
226 
227  real(RP), intent(in) :: DAMP_alpha_DENS(ka,ia,ja)
228  real(RP), intent(in) :: DAMP_alpha_VELZ(ka,ia,ja)
229  real(RP), intent(in) :: DAMP_alpha_VELX(ka,ia,ja)
230  real(RP), intent(in) :: DAMP_alpha_VELY(ka,ia,ja)
231  real(RP), intent(in) :: DAMP_alpha_POTT(ka,ia,ja)
232  real(RP), intent(in) :: DAMP_alpha_QTRC(ka,ia,ja,bnd_qa)
233 
234  real(RP), intent(in) :: divdmp_coef
235 
236  logical, intent(in) :: FLAG_FCT_MOMENTUM
237  logical, intent(in) :: FLAG_FCT_T
238  logical, intent(in) :: FLAG_FCT_TRACER
239  logical, intent(in) :: FLAG_FCT_ALONG_STREAM
240 
241  logical, intent(in) :: USE_AVERAGE
242 
243  real(DP), intent(in) :: DTL
244  real(DP), intent(in) :: DTS
245 
246  ! for time integartion
247  real(RP) :: DENS0 (ka,ia,ja)
248  real(RP) :: MOMZ0 (ka,ia,ja)
249  real(RP) :: MOMX0 (ka,ia,ja)
250  real(RP) :: MOMY0 (ka,ia,ja)
251  real(RP) :: RHOT0 (ka,ia,ja)
252  real(RP) :: QTRC0 (ka,ia,ja,qa)
253  real(RP) :: PROG0 (ka,ia,ja,va)
254 
255  real(DP) :: dtrk
256 
257  logical :: last
258 
259  integer :: n, iq
260 
261  !---------------------------------------------------------------------------
262 
263  call prof_rapstart("DYN_Large_RK3_Prep", 3)
264 
265  !##### SAVE #####
266 !OCL XFILL
267  dens0(:,:,:) = dens(:,:,:)
268 !OCL XFILL
269  momz0(:,:,:) = momz(:,:,:)
270 !OCL XFILL
271  momx0(:,:,:) = momx(:,:,:)
272 !OCL XFILL
273  momy0(:,:,:) = momy(:,:,:)
274 !OCL XFILL
275  rhot0(:,:,:) = rhot(:,:,:)
276 !OCL XFILL
277  qtrc0(:,:,:,:) = qtrc(:,:,:,:)
278 
279  if ( va > 0 ) then
280 !OCL XFILL
281  prog0(:,:,:,:) = prog(:,:,:,:)
282  end if
283 
284  call prof_rapend ("DYN_Large_RK3_Prep", 3)
285 
286  !------------------------------------------------------------------------
287  ! Start RK
288  !------------------------------------------------------------------------
289 
290  call prof_rapstart("DYN_Large_RK3", 3)
291 
292  do n = 1, 3
293 
294  dtrk = dtl / real( 4-n, kind=dp )
295  last = n == 3
296 
297  if ( n > 1 ) then
298  dens = dens0
299  momz = momz0
300  momx = momx0
301  momy = momy0
302  rhot = rhot0
303  if ( va > 0 ) prog = prog0
304  end if
305 
306  call atmos_dyn_tstep_large( &
307  dens, momz, momx, momy, rhot, qtrc, prog, & ! (inout)
308  dens_av, momz_av, momx_av, momy_av, rhot_av, qtrc_av, & ! (inout)
309  mflx_hi, tflx_hi, & ! (out)
310  num_diff, num_diff_q, & ! (out)
311  qtrc0, & ! (in)
312  dens_tp, momz_tp, momx_tp, momy_tp, rhot_tp, rhoq_tp, & ! (in)
313  corioli, & ! (in)
314  cdz, cdx, cdy, fdz, fdx, fdy, & ! (in)
315  rcdz, rcdx, rcdy, rfdz, rfdx, rfdy, & ! (in)
316  phi, gsqrt, & ! (in)
317  j13g, j23g, j33g, mapf, & ! (in)
318  aq_cv, & ! (in)
319  ref_dens, ref_pott, ref_qv, ref_pres, & ! (in)
320  bnd_w, bnd_e, bnd_s, bnd_n, & ! (in)
321  nd_coef, nd_coef_q, nd_order, nd_sfc_fact, nd_use_rs, & ! (in)
322  damp_dens, damp_velz, damp_velx, & ! (in)
323  damp_vely, damp_pott, damp_qtrc, & ! (in)
324  damp_alpha_dens, damp_alpha_velz, damp_alpha_velx, & ! (in)
325  damp_alpha_vely, damp_alpha_pott, damp_alpha_qtrc, & ! (in)
326  divdmp_coef, & ! (in)
327  flag_fct_momentum, flag_fct_t, flag_fct_tracer, & ! (in)
328  flag_fct_along_stream, & ! (in)
329  use_average .AND. last, & ! (in)
330  dtrk, dts, last ) ! (in)
331 
332  end do
333 
334  call prof_rapend ("DYN_Large_RK3", 3)
335 
336  return
337  end subroutine atmos_dyn_tinteg_large_rk3
338 
module DEBUG
Definition: scale_debug.F90:13
integer, public i_xvz
real(rp), public const_cvdry
specific heat (dry air,constant volume) [J/kg/K]
Definition: scale_const.F90:59
subroutine, public prc_mpistop
Abort MPI.
subroutine, public atmos_dyn_numfilter_coef_q(num_diff_q, DENS, QTRC, CDZ, CDX, CDY, dt, REF_qv, iq, ND_COEF, ND_ORDER, ND_SFC_FACT, ND_USE_RS)
Calc coefficient of numerical filter.
integer, public va
Definition: scale_index.F90:38
subroutine, public atmos_dyn_numfilter_coef(num_diff, DENS, MOMZ, MOMX, MOMY, RHOT, CDZ, CDX, CDY, FDZ, FDX, FDY, DT, REF_dens, REF_pott, ND_COEF, ND_ORDER, ND_SFC_FACT, ND_USE_RS)
Calc coefficient of numerical filter.
subroutine, public atmos_dyn_fvm_fluxy_xyz_ud1(flux, mflx, val, GSQRT, CDZ, IIS, IIE, JJS, JJE)
calculation Y-flux at XYZ
procedure(flux_phi), pointer, public atmos_dyn_fvm_fluxx_xyz
module STDIO
Definition: scale_stdio.F90:12
integer, public qa
integer, public i_xy
module Atmosphere / Dynamical scheme
subroutine, public check(current_line, v)
Undefined value checker.
Definition: scale_debug.F90:58
real(rp), public const_rdry
specific gas constant (dry air) [J/kg/K]
Definition: scale_const.F90:57
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 x whole cells (local, with HALO)
module GRIDTRANS
subroutine, public comm_vars8_init(var, vid)
Register variables.
Definition: scale_comm.F90:328
integer, public ka
of z whole cells (local, with HALO)
integer, public i_uy
integer, parameter, public dp
Definition: dc_types.f90:27
integer, public i_xyw
integer, public qqa
subroutine, public atmos_dyn_tinteg_large_rk3_setup(tinteg_type)
Setup.
module COMMUNICATION
Definition: scale_comm.F90:23
subroutine, public atmos_dyn_fvm_fluxz_xyz_ud1(flux, mflx, val, GSQRT, CDZ, IIS, IIE, JJS, JJE)
calculation z-flux at XYZ
integer, parameter, public const_undef2
undefined value (INT2)
Definition: scale_const.F90:40
module Atmosphere / Dynamics common
module PROCESS
real(rp), parameter, public const_rvap
specific gas constant (water vapor) [J/kg/K]
Definition: scale_const.F90:65
module CONSTANT
Definition: scale_const.F90:14
subroutine, public prof_rapstart(rapname_base, level)
Start raptime.
Definition: scale_prof.F90:132
integer, public i_xv
module profiler
Definition: scale_prof.F90:10
module scale_atmos_dyn_fvm_flux
integer, public i_uyz
module PRECISION
subroutine, public atmos_dyn_tinteg_large_rk3(DENS, MOMZ, MOMX, MOMY, RHOT, QTRC, PROG, DENS_av, MOMZ_av, MOMX_av, MOMY_av, RHOT_av, QTRC_av, mflx_hi, tflx_hi, num_diff, num_diff_q, DENS_tp, MOMZ_tp, MOMX_tp, MOMY_tp, RHOT_tp, RHOQ_tp, CORIOLI, CDZ, CDX, CDY, FDZ, FDX, FDY, RCDZ, RCDX, RCDY, RFDZ, RFDX, RFDY, PHI, GSQRT, J13G, J23G, J33G, MAPF, AQ_CV, REF_dens, REF_pott, REF_qv, REF_pres, BND_W, BND_E, BND_S, BND_N, ND_COEF, ND_COEF_Q, ND_ORDER, ND_SFC_FACT, ND_USE_RS, DAMP_DENS, DAMP_VELZ, DAMP_VELX, DAMP_VELY, DAMP_POTT, DAMP_QTRC, DAMP_alpha_DENS, DAMP_alpha_VELZ, DAMP_alpha_VELX, DAMP_alpha_VELY, DAMP_alpha_POTT, DAMP_alpha_QTRC, divdmp_coef, FLAG_FCT_MOMENTUM, FLAG_FCT_T, FLAG_FCT_TRACER, FLAG_FCT_ALONG_STREAM, USE_AVERAGE, DTL, DTS)
RK3.
subroutine, public atmos_dyn_fct(qflx_anti, phi_in, DENS0, DENS, qflx_hi, qflx_lo, mflx_hi, rdz, rdx, rdy, GSQRT, MAPF, dt, flag_vect)
Flux Correction Transport Limiter.
module ATMOSPHERE / Boundary treatment
subroutine, public atmos_dyn_fvm_fluxx_xyz_ud1(flux, mflx, val, GSQRT, CDZ, IIS, IIE, JJS, JJE)
calculation X-flux at XYZ
module HISTORY
integer, public i_xyz
subroutine, public prof_rapend(rapname_base, level)
Save raptime.
Definition: scale_prof.F90:178
procedure(flux_phi), pointer, public atmos_dyn_fvm_fluxz_xyz
procedure(flux_phi), pointer, public atmos_dyn_fvm_fluxy_xyz
procedure(large), pointer, public atmos_dyn_tstep_large
module scale_atmos_dyn_fvm_flux_ud1
real(rp), public atmos_boundary_smoother_fact
integer, public ja
of y whole cells (local, with HALO)