SCALE-RM
scale_atmos_dyn_tinteg_tracer_rk3.F90
Go to the documentation of this file.
1 !-------------------------------------------------------------------------------
11 !-------------------------------------------------------------------------------
12 #include "scalelib.h"
14  !-----------------------------------------------------------------------------
15  !
16  !++ used modules
17  !
18  use scale_precision
19  use scale_io
20  use scale_prof
22  use scale_index
23  use scale_tracer
24 
25 #ifdef DEBUG
26  use scale_debug, only: &
27  check
28  use scale_const, only: &
29  undef => const_undef, &
30  iundef => const_undef2
31 #endif
32  !-----------------------------------------------------------------------------
33  implicit none
34  private
35  !-----------------------------------------------------------------------------
36  !
37  !++ Public procedure
38  !
41 
42  !-----------------------------------------------------------------------------
43  !
44  !++ Public parameters & variables
45  !
46  !-----------------------------------------------------------------------------
47  !
48  !++ Private procedure
49  !
50  !-----------------------------------------------------------------------------
51  !
52  !++ Private parameters & variables
53  !
54  real(RP), allocatable :: QTRC_RK1(:,:,:)
55  real(RP), allocatable :: QTRC_RK2(:,:,:)
56  integer :: I_COMM_RK1 = 1
57  integer :: I_COMM_RK2 = 1
58  !-----------------------------------------------------------------------------
59 contains
60 
61  !-----------------------------------------------------------------------------
64  tinteg_type )
65  use scale_const, only: &
66  undef => const_undef
67  use scale_prc, only: &
68  prc_abort
69  use scale_comm_cartesc, only: &
71  implicit none
72 
73  character(len=*) :: tinteg_type
74 
75  integer :: iv
76  !---------------------------------------------------------------------------
77 
78  if ( tinteg_type /= 'RK3WS2002' ) then
79  log_error("ATMOS_DYN_Tinteg_tracer_rk3_setup",*) 'TINTEG_TRACER_TYPE is not RK3WS2002. Check!'
80  call prc_abort
81  end if
82 
83  allocate( qtrc_rk1(ka,ia,ja) )
84  allocate( qtrc_rk2(ka,ia,ja) )
85  qtrc_rk1(:,:,:) = undef
86  qtrc_rk2(:,:,:) = undef
87 
88  call comm_vars8_init( 'QTRC_RK1', qtrc_rk1, i_comm_rk1 )
89  call comm_vars8_init( 'QTRC_RK2', qtrc_rk2, i_comm_rk2 )
90 
91  return
93 
94  !-----------------------------------------------------------------------------
96  subroutine atmos_dyn_tinteg_tracer_rk3( &
97  QTRC, & ! (out)
98  qflx, & ! (out)
99  qtrc0, rhoq_t, &! (in)
100  dens0, dens, & ! (in)
101  mflx_hi, num_diff, & ! (in)
102  gsqrt, mapf, & ! (in)
103  cdz, rcdz, rcdx, rcdy, & ! (in)
104  bnd_w, bnd_e, bnd_s, bnd_n, & ! (in)
105  twod, & ! (in)
106  dtl, & ! (in)
107  flag_fct_tracer, & ! (in)
108  flag_fct_along_stream ) ! (in)
109  use scale_comm_cartesc, only: &
110  comm_vars8, &
111  comm_wait
112  use scale_atmos_dyn_tstep_tracer, only: &
114  use scale_atmos_dyn_common, only: &
116  implicit none
117  real(rp), intent(inout) :: qtrc (ka,ia,ja)
118  real(rp), intent(out) :: qflx (ka,ia,ja,3)
119  real(rp), intent(in) :: qtrc0 (ka,ia,ja)
120  real(rp), intent(in) :: rhoq_t (ka,ia,ja)
121  real(rp), intent(in) :: dens0 (ka,ia,ja)
122  real(rp), intent(in) :: dens (ka,ia,ja)
123  real(rp), intent(in) :: mflx_hi (ka,ia,ja,3)
124  real(rp), intent(in) :: num_diff(ka,ia,ja,3)
125  real(rp), intent(in) :: gsqrt (ka,ia,ja,7)
126  real(rp), intent(in) :: mapf (ia,ja)
127  real(rp), intent(in) :: cdz(ka)
128  real(rp), intent(in) :: rcdz(ka)
129  real(rp), intent(in) :: rcdx(ia)
130  real(rp), intent(in) :: rcdy(ja)
131  logical, intent(in) :: bnd_w
132  logical, intent(in) :: bnd_e
133  logical, intent(in) :: bnd_s
134  logical, intent(in) :: bnd_n
135  logical, intent(in) :: twod
136  real(rp), intent(in) :: dtl
137  logical, intent(in) :: flag_fct_tracer
138  logical, intent(in) :: flag_fct_along_stream
139 
140  real(rp) :: dens_rk(ka,ia,ja)
141  real(rp) :: dtrk
142  integer :: k, i, j
143 
144  !------------------------------------------------------------------------
145  ! Start RK
146  !------------------------------------------------------------------------
147 
148  do j = js-1, je+1
149  do i = max(is-1,1), min(ie+1,ia)
150  do k = ks, ke
151  dens_rk(k,i,j) = dens0(k,i,j) &
152  + ( dens(k,i,j) - dens0(k,i,j) ) / 3.0_rp
153  end do
154  end do
155  end do
156 
157  dtrk = dtl / 3.0_rp
158  call atmos_dyn_tstep_tracer( &
159  qtrc_rk1, & ! (out)
160  qflx, & ! (out)
161  qtrc, qtrc0, rhoq_t, &! (in)
162  dens0, dens_rk, & ! (in)
163  mflx_hi, num_diff, & ! (in)
164  gsqrt, mapf, & ! (in)
165  cdz, rcdz, rcdx, rcdy, & ! (in)
166  twod, dtrk, & ! (in)
167  .false., flag_fct_along_stream ) ! (in)
168 
169  call atmos_dyn_copy_boundary_tracer( qtrc_rk1, & ! [INOUT]
170  qtrc0, & ! [IN]
171  bnd_w, bnd_e, bnd_s, bnd_n, & ! [IN]
172  twod ) ! [IN]
173 
174  call comm_vars8( qtrc_rk1(:,:,:), i_comm_rk1 )
175  call comm_wait ( qtrc_rk1(:,:,:), i_comm_rk1, .false. )
176 
177 
178  do j = js-1, je+1
179  do i = max(is-1,1), min(ie+1,ia)
180  do k = ks, ke
181  dens_rk(k,i,j) = dens0(k,i,j) &
182  + ( dens(k,i,j) - dens0(k,i,j) ) * 0.5_rp
183  end do
184  end do
185  end do
186 
187  dtrk = dtl / 2.0_rp
188  call atmos_dyn_tstep_tracer( &
189  qtrc_rk2, & ! (out)
190  qflx, & ! (out)
191  qtrc_rk1, qtrc0, rhoq_t, &! (in)
192  dens0, dens_rk, & ! (in)
193  mflx_hi, num_diff, & ! (in)
194  gsqrt, mapf, & ! (in)
195  cdz, rcdz, rcdx, rcdy, & ! (in)
196  twod, dtrk, & ! (in)
197  .false., flag_fct_along_stream ) ! (in)
198 
199  call atmos_dyn_copy_boundary_tracer( qtrc_rk2, & ! [INOUT]
200  qtrc0, & ! [IN]
201  bnd_w, bnd_e, bnd_s, bnd_n, & ! [IN]
202  twod ) ! [IN]
203 
204  call comm_vars8( qtrc_rk2(:,:,:), i_comm_rk2 )
205  call comm_wait ( qtrc_rk2(:,:,:), i_comm_rk2, .false. )
206 
207 
208  dtrk = dtl
209  call atmos_dyn_tstep_tracer( &
210  qtrc, & ! (out)
211  qflx, & ! (out)
212  qtrc_rk2, qtrc0, rhoq_t, &! (in)
213  dens0, dens, & ! (in)
214  mflx_hi, num_diff, & ! (in)
215  gsqrt, mapf, & ! (in)
216  cdz, rcdz, rcdx, rcdy, & ! (in)
217  twod, & ! (in)
218  dtrk, & ! (in)
219  flag_fct_tracer, flag_fct_along_stream ) ! (in)
220 
221  return
222  end subroutine atmos_dyn_tinteg_tracer_rk3
223 
scale_atmos_grid_cartesc_index::ke
integer, public ke
end point of inner domain: z, local
Definition: scale_atmos_grid_cartesC_index.F90:52
scale_prc::prc_abort
subroutine, public prc_abort
Abort Process.
Definition: scale_prc.F90:342
scale_atmos_dyn_tinteg_tracer_rk3::atmos_dyn_tinteg_tracer_rk3_setup
subroutine, public atmos_dyn_tinteg_tracer_rk3_setup(tinteg_type)
Setup.
Definition: scale_atmos_dyn_tinteg_tracer_rk3.F90:65
scale_index
module Index
Definition: scale_index.F90:11
scale_const::const_undef2
integer, parameter, public const_undef2
undefined value (INT2)
Definition: scale_const.F90:38
scale_atmos_dyn_tinteg_tracer_rk3
module Atmosphere / Dyn Tinteg
Definition: scale_atmos_dyn_tinteg_tracer_rk3.F90:13
scale_atmos_dyn_common
module Atmosphere / Dynamics common
Definition: scale_atmos_dyn_common.F90:12
scale_precision
module PRECISION
Definition: scale_precision.F90:14
scale_atmos_grid_cartesc_index::ka
integer, public ka
Definition: scale_atmos_grid_cartesC_index.F90:47
scale_prc
module PROCESS
Definition: scale_prc.F90:11
scale_atmos_grid_cartesc_index::ie
integer, public ie
end point of inner domain: x, local
Definition: scale_atmos_grid_cartesC_index.F90:54
scale_io
module STDIO
Definition: scale_io.F90:10
scale_tracer::k
real(rp), public k
Definition: scale_tracer.F90:44
scale_atmos_grid_cartesc_index
module atmosphere / grid / cartesC index
Definition: scale_atmos_grid_cartesC_index.F90:12
scale_const
module CONSTANT
Definition: scale_const.F90:11
scale_atmos_grid_cartesc_index::ia
integer, public ia
Definition: scale_atmos_grid_cartesC_index.F90:48
scale_comm_cartesc::comm_vars8_init
subroutine, public comm_vars8_init(varname, var, vid)
Register variables.
Definition: scale_comm_cartesC.F90:294
scale_debug::check
subroutine, public check(current_line, v)
Undefined value checker.
Definition: scale_debug.F90:56
scale_atmos_dyn_tinteg_tracer_rk3::atmos_dyn_tinteg_tracer_rk3
subroutine, public atmos_dyn_tinteg_tracer_rk3(QTRC, qflx, QTRC0, RHOQ_t, DENS0, DENS, mflx_hi, num_diff, GSQRT, MAPF, CDZ, RCDZ, RCDX, RCDY, BND_W, BND_E, BND_S, BND_N, TwoD, dtl, FLAG_FCT_TRACER, FLAG_FCT_ALONG_STREAM)
RK3.
Definition: scale_atmos_dyn_tinteg_tracer_rk3.F90:109
scale_atmos_dyn_common::atmos_dyn_copy_boundary_tracer
subroutine, public atmos_dyn_copy_boundary_tracer(QTRC, QTRC0, BND_W, BND_E, BND_S, BND_N, TwoD)
Definition: scale_atmos_dyn_common.F90:311
scale_atmos_dyn_tstep_tracer
module Atmosphere / Dynamical scheme
Definition: scale_atmos_dyn_tstep_tracer.F90:12
scale_prof
module profiler
Definition: scale_prof.F90:11
scale_atmos_grid_cartesc_index::is
integer, public is
start point of inner domain: x, local
Definition: scale_atmos_grid_cartesC_index.F90:53
scale_atmos_grid_cartesc_index::ja
integer, public ja
Definition: scale_atmos_grid_cartesC_index.F90:49
scale_tracer
module TRACER
Definition: scale_tracer.F90:12
scale_atmos_grid_cartesc_index::ks
integer, public ks
start point of inner domain: z, local
Definition: scale_atmos_grid_cartesC_index.F90:51
scale_debug
module DEBUG
Definition: scale_debug.F90:11
scale_comm_cartesc
module COMMUNICATION
Definition: scale_comm_cartesC.F90:11
scale_atmos_dyn_tstep_tracer::atmos_dyn_tstep_tracer
procedure(step), pointer, public atmos_dyn_tstep_tracer
Definition: scale_atmos_dyn_tstep_tracer.F90:72
scale_atmos_grid_cartesc_index::js
integer, public js
start point of inner domain: y, local
Definition: scale_atmos_grid_cartesC_index.F90:55
scale_const::const_undef
real(rp), public const_undef
Definition: scale_const.F90:41
scale_atmos_grid_cartesc_index::je
integer, public je
end point of inner domain: y, local
Definition: scale_atmos_grid_cartesC_index.F90:56