SCALE-RM
Functions/Subroutines
scale_atmos_dyn_tstep_large_fvm_heve Module Reference

module Atmosphere / Dynamics More...

Functions/Subroutines

subroutine, public atmos_dyn_tstep_large_fvm_heve_setup (DENS, MOMZ, MOMX, MOMY, RHOT, QTRC, PROG, mflx_hi)
 Setup. More...
 
subroutine, public atmos_dyn_tstep_large_fvm_heve (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, QTRC0, 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_R, AQ_CV, AQ_CP, AQ_MASS, 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, wdamp_coef, divdmp_coef, FLAG_FCT_MOMENTUM, FLAG_FCT_T, FLAG_FCT_TRACER, FLAG_FCT_ALONG_STREAM, USE_AVERAGE, DTLS, DTSS, Llast)
 Dynamical Process. More...
 
subroutine check_mass (DENS, DAMP_DENS, mflx_hi, tflx_hi, GSQRT, MAPF, RCDX, RCDY, dt, step, BND_W, BND_E, BND_S, BND_N)
 

Detailed Description

module Atmosphere / Dynamics

Description
HEVE FVM scheme for large time step in Atmospheric dynamical process
Author
Team SCALE
History
NAMELIST
  • No namelist group
History Output
namedescriptionunitvariable
ALLMOM_lb_hz horizontally total momentum flux from lateral boundary kg/m2/s allmflx_lb_horizontal
DENS_t_damp tendency of dencity due to damping kg/m3/s damp_t
DENS_t_phys tendency of dencity due to physics kg/m3/s DENS_tp
MFLXX momentum flux of x-direction kg/m2/s mflx_hi
MFLXY momentum flux of y-direction kg/m2/s mflx_hi
MFLXZ momentum flux of z-direction kg/m2/s mflx_hi
MOMX_t_damp tendency of momentum x due to damping kg/m2/s2 damp_t
MOMX_t_phys tendency of momentum x due to physics kg/m2/s2 MOMX_tp
MOMY_t_damp tendency of momentum y due to damping kg/m2/s2 damp_t
MOMY_t_phys tendency of momentum y due to physics kg/m2/s2 MOMY_tp
MOMZ_t_damp tendency of momentum z due to damping kg/m2/s2 damp_t
MOMZ_t_phys tendency of momentum z due to physics kg/m2/s2 MOMZ_tp
RHOT_t_damp tendency of rho*theta temperature due to damping K kg/m3/s damp_t
RHOT_t_phys tendency of rho*theta temperature due to physics K kg/m3/s RHOT_tp
TFLXX potential temperature flux of x-direction K*kg/m2/s tflx_hi
TFLXY potential temperature flux of y-direction K*kg/m2/s tflx_hi
TFLXZ potential temperature flux of z-direction K*kg/m2/s tflx_hi
TRACER_NAME_t_damp tendency of TRACER_NAME due to damping; TRACER_NAME depends on the physics schemes, e.g., QV, QC, QR. kg/kg/s damp_t
TRACER_NAME_t_phys tendency of TRACER_NAME due to physics; TRACER_NAME depends on the physics schemes, e.g., QV, QC, QR. kg/kg/s RHOQ_tp

Function/Subroutine Documentation

◆ atmos_dyn_tstep_large_fvm_heve_setup()

subroutine, public scale_atmos_dyn_tstep_large_fvm_heve::atmos_dyn_tstep_large_fvm_heve_setup ( real(rp), dimension(ka,ia,ja), intent(inout)  DENS,
real(rp), dimension(ka,ia,ja), intent(inout)  MOMZ,
real(rp), dimension(ka,ia,ja), intent(inout)  MOMX,
real(rp), dimension(ka,ia,ja), intent(inout)  MOMY,
real(rp), dimension(ka,ia,ja), intent(inout)  RHOT,
real(rp), dimension(ka,ia,ja,qa), intent(inout)  QTRC,
real(rp), dimension(ka,ia,ja,va), intent(inout)  PROG,
real(rp), dimension(ka,ia,ja,3), intent(inout)  mflx_hi 
)

Setup.

Definition at line 95 of file scale_atmos_dyn_tstep_large_fvm_heve.F90.

References scale_comm::comm_vars8_init(), scale_const::const_ohm, scale_const::const_undef, scale_grid_index::ia, scale_grid_index::ja, scale_grid_index::ka, scale_rm_process::prc_has_e, scale_rm_process::prc_has_n, scale_rm_process::prc_has_s, scale_rm_process::prc_has_w, scale_process::prc_mpistop(), scale_tracer::qa, scale_index::va, scale_grid_index::xdir, scale_grid_index::ydir, and scale_grid_index::zdir.

Referenced by scale_atmos_dyn_tstep_large::atmos_dyn_tstep_large_setup().

95  use scale_process, only: &
97  use scale_rm_process, only: &
98  prc_has_e, &
99  prc_has_w, &
100  prc_has_n, &
101  prc_has_s
102  use scale_const, only: &
103  ohm => const_ohm, &
104  undef => const_undef
105  use scale_comm, only: &
107  implicit none
108 
109  ! MPI_RECV_INIT requires intent(inout)
110  real(RP), intent(inout) :: DENS(KA,IA,JA)
111  real(RP), intent(inout) :: MOMZ(KA,IA,JA)
112  real(RP), intent(inout) :: MOMX(KA,IA,JA)
113  real(RP), intent(inout) :: MOMY(KA,IA,JA)
114  real(RP), intent(inout) :: RHOT(KA,IA,JA)
115  real(RP), intent(inout) :: QTRC(KA,IA,JA,QA)
116  real(RP), intent(inout) :: PROG(KA,IA,JA,VA)
117  real(RP), intent(inout) :: mflx_hi(KA,IA,JA,3)
118 
119  integer :: iv, iq
120  !---------------------------------------------------------------------------
121 
122  allocate( dens_t(ka,ia,ja) )
123  allocate( momz_t(ka,ia,ja) )
124  allocate( momx_t(ka,ia,ja) )
125  allocate( momy_t(ka,ia,ja) )
126  allocate( rhot_t(ka,ia,ja) )
127  allocate( rhoq_t(ka,ia,ja,qa) )
128 
129  allocate( i_comm_prog(max(va,1)) )
130  allocate( i_comm_qtrc(qa) )
131  allocate( i_comm_rhoq_t(qa) )
132 
133  call comm_vars8_init( 'DENS', dens, i_comm_dens )
134  call comm_vars8_init( 'MOMZ', momz, i_comm_momz )
135  call comm_vars8_init( 'MOMX', momx, i_comm_momx )
136  call comm_vars8_init( 'MOMY', momy, i_comm_momy )
137  call comm_vars8_init( 'RHOT', rhot, i_comm_rhot )
138  do iv = 1, va
139  i_comm_prog(iv) = 5 + iv
140  call comm_vars8_init( 'PROG', prog(:,:,:,iv), i_comm_prog(iv) )
141  end do
142 
143  call comm_vars8_init( 'DENS_t', dens_t, i_comm_dens_t )
144  call comm_vars8_init( 'MOMZ_t', momz_t, i_comm_momz_t )
145  call comm_vars8_init( 'MOMX_t', momx_t, i_comm_momx_t )
146  call comm_vars8_init( 'MOMY_t', momy_t, i_comm_momy_t )
147  call comm_vars8_init( 'RHOT_t', rhot_t, i_comm_rhot_t )
148 
149  do iq = 1, qa
150  i_comm_rhoq_t(iq) = 5 + va + iq
151  i_comm_qtrc(iq) = 5 + va + iq
152 
153  call comm_vars8_init( 'RHOQ_t', rhoq_t(:,:,:,iq), i_comm_rhoq_t(iq) )
154  call comm_vars8_init( 'QTRC', qtrc(:,:,:,iq), i_comm_qtrc(iq) )
155  end do
156 
157  call comm_vars8_init( 'mflx_Z', mflx_hi(:,:,:,zdir), i_comm_mflx_z )
158  call comm_vars8_init( 'mflx_X', mflx_hi(:,:,:,xdir), i_comm_mflx_x )
159  call comm_vars8_init( 'mflx_Y', mflx_hi(:,:,:,ydir), i_comm_mflx_y )
160 
161  mflx_hi(:,:,:,:) = undef
162 
163  return
logical, public prc_has_n
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
integer, parameter, public zdir
logical, public prc_has_e
integer, parameter, public ydir
integer, parameter, public xdir
logical, public prc_has_s
real(rp), public const_undef
Definition: scale_const.F90:43
real(rp), public const_ohm
angular velocity of the planet [1/s]
Definition: scale_const.F90:47
integer, public ia
of whole cells: x, local, with HALO
integer, public ka
of whole cells: z, local, with HALO
module COMMUNICATION
Definition: scale_comm.F90:23
module PROCESS
module CONSTANT
Definition: scale_const.F90:14
module RM PROCESS
logical, public prc_has_w
integer, public ja
of whole cells: y, local, with HALO
Here is the call graph for this function:
Here is the caller graph for this function:

◆ atmos_dyn_tstep_large_fvm_heve()

subroutine, public scale_atmos_dyn_tstep_large_fvm_heve::atmos_dyn_tstep_large_fvm_heve ( real(rp), dimension(ka,ia,ja), intent(inout)  DENS,
real(rp), dimension(ka,ia,ja), intent(inout)  MOMZ,
real(rp), dimension(ka,ia,ja), intent(inout)  MOMX,
real(rp), dimension(ka,ia,ja), intent(inout)  MOMY,
real(rp), dimension(ka,ia,ja), intent(inout)  RHOT,
real(rp), dimension(ka,ia,ja,qa), intent(inout)  QTRC,
real(rp), dimension(ka,ia,ja,va), intent(inout)  PROG,
real(rp), dimension(ka,ia,ja), intent(inout)  DENS_av,
real(rp), dimension(ka,ia,ja), intent(inout)  MOMZ_av,
real(rp), dimension(ka,ia,ja), intent(inout)  MOMX_av,
real(rp), dimension(ka,ia,ja), intent(inout)  MOMY_av,
real(rp), dimension(ka,ia,ja), intent(inout)  RHOT_av,
real(rp), dimension(ka,ia,ja,qa), intent(inout)  QTRC_av,
real(rp), dimension(ka,ia,ja,3), intent(out)  mflx_hi,
real(rp), dimension(ka,ia,ja,3), intent(out)  tflx_hi,
real(rp), dimension(ka,ia,ja,5,3), intent(out)  num_diff,
real(rp), dimension(ka,ia,ja,3), intent(out)  num_diff_q,
real(rp), dimension(ka,ia,ja,qa), intent(in)  QTRC0,
real(rp), dimension(ka,ia,ja), intent(in)  DENS_tp,
real(rp), dimension(ka,ia,ja), intent(in)  MOMZ_tp,
real(rp), dimension(ka,ia,ja), intent(in)  MOMX_tp,
real(rp), dimension(ka,ia,ja), intent(in)  MOMY_tp,
real(rp), dimension(ka,ia,ja), intent(in)  RHOT_tp,
real(rp), dimension(ka,ia,ja,qa), intent(in)  RHOQ_tp,
real(rp), dimension(ia,ja), intent(in)  CORIOLI,
real(rp), dimension (ka), intent(in)  CDZ,
real(rp), dimension (ia), intent(in)  CDX,
real(rp), dimension (ja), intent(in)  CDY,
real(rp), dimension (ka-1), intent(in)  FDZ,
real(rp), dimension (ia-1), intent(in)  FDX,
real(rp), dimension (ja-1), intent(in)  FDY,
real(rp), dimension(ka), intent(in)  RCDZ,
real(rp), dimension(ia), intent(in)  RCDX,
real(rp), dimension(ja), intent(in)  RCDY,
real(rp), dimension(ka-1), intent(in)  RFDZ,
real(rp), dimension(ia-1), intent(in)  RFDX,
real(rp), dimension(ja-1), intent(in)  RFDY,
real(rp), dimension (ka,ia,ja), intent(in)  PHI,
real(rp), dimension(ka,ia,ja,7), intent(in)  GSQRT,
real(rp), dimension (ka,ia,ja,7), intent(in)  J13G,
real(rp), dimension (ka,ia,ja,7), intent(in)  J23G,
real(rp), intent(in)  J33G,
real(rp), dimension (ia,ja,2,4), intent(in)  MAPF,
real(rp), dimension (qa), intent(in)  AQ_R,
real(rp), dimension (qa), intent(in)  AQ_CV,
real(rp), dimension (qa), intent(in)  AQ_CP,
real(rp), dimension(qa), intent(in)  AQ_MASS,
real(rp), dimension(ka,ia,ja), intent(in)  REF_dens,
real(rp), dimension(ka,ia,ja), intent(in)  REF_pott,
real(rp), dimension (ka,ia,ja), intent(in)  REF_qv,
real(rp), dimension(ka,ia,ja), intent(in)  REF_pres,
logical, intent(in)  BND_W,
logical, intent(in)  BND_E,
logical, intent(in)  BND_S,
logical, intent(in)  BND_N,
real(rp), intent(in)  ND_COEF,
real(rp), intent(in)  ND_COEF_Q,
integer, intent(in)  ND_ORDER,
real(rp), intent(in)  ND_SFC_FACT,
logical, intent(in)  ND_USE_RS,
real(rp), dimension(ka,ia,ja), intent(in)  DAMP_DENS,
real(rp), dimension(ka,ia,ja), intent(in)  DAMP_VELZ,
real(rp), dimension(ka,ia,ja), intent(in)  DAMP_VELX,
real(rp), dimension(ka,ia,ja), intent(in)  DAMP_VELY,
real(rp), dimension(ka,ia,ja), intent(in)  DAMP_POTT,
real(rp), dimension(ka,ia,ja,bnd_qa), intent(in)  DAMP_QTRC,
real(rp), dimension(ka,ia,ja), intent(in)  DAMP_alpha_DENS,
real(rp), dimension(ka,ia,ja), intent(in)  DAMP_alpha_VELZ,
real(rp), dimension(ka,ia,ja), intent(in)  DAMP_alpha_VELX,
real(rp), dimension(ka,ia,ja), intent(in)  DAMP_alpha_VELY,
real(rp), dimension(ka,ia,ja), intent(in)  DAMP_alpha_POTT,
real(rp), dimension(ka,ia,ja,bnd_qa), intent(in)  DAMP_alpha_QTRC,
real(rp), dimension(ka), intent(in)  wdamp_coef,
real(rp), intent(in)  divdmp_coef,
logical, intent(in)  FLAG_FCT_MOMENTUM,
logical, intent(in)  FLAG_FCT_T,
logical, intent(in)  FLAG_FCT_TRACER,
logical, intent(in)  FLAG_FCT_ALONG_STREAM,
logical, intent(in)  USE_AVERAGE,
real(dp), intent(in)  DTLS,
real(dp), intent(in)  DTSS,
logical, intent(in)  Llast 
)

Dynamical Process.

Parameters
[in]phigeopotential
[in]gsqrtvertical metrics {G}^1/2
[in]j13g(1,3) element of Jacobian matrix
[in]j23g(2,3) element of Jacobian matrix
[in]j33g(3,3) element of Jacobian matrix
[in]mapfmap factor
[in]ref_presreference pressure

Definition at line 194 of file scale_atmos_dyn_tstep_large_fvm_heve.F90.

References scale_atmos_boundary::atmos_boundary_smoother_fact, scale_atmos_dyn_common::atmos_dyn_divergence(), scale_atmos_dyn_common::atmos_dyn_fct(), scale_atmos_dyn_fvm_flux::atmos_dyn_fvm_fluxx_xyz, scale_atmos_dyn_fvm_flux_ud1::atmos_dyn_fvm_fluxx_xyz_ud1(), scale_atmos_dyn_fvm_flux::atmos_dyn_fvm_fluxy_xyz, scale_atmos_dyn_fvm_flux_ud1::atmos_dyn_fvm_fluxy_xyz_ud1(), scale_atmos_dyn_fvm_flux::atmos_dyn_fvm_fluxz_xyz, scale_atmos_dyn_fvm_flux_ud1::atmos_dyn_fvm_fluxz_xyz_ud1(), scale_atmos_dyn_common::atmos_dyn_numfilter_coef(), scale_atmos_dyn_common::atmos_dyn_numfilter_coef_q(), scale_atmos_dyn_tinteg_short::atmos_dyn_tinteg_short, scale_atmos_dyn_tinteg_tracer::atmos_dyn_tinteg_tracer, scale_atmos_boundary::bnd_qa, check_mass(), scale_const::const_cpdry, scale_const::const_cvdry, scale_const::const_eps, scale_const::const_pre00, scale_const::const_rdry, scale_gridtrans::i_uy, scale_gridtrans::i_uyz, scale_gridtrans::i_xv, scale_gridtrans::i_xvz, scale_gridtrans::i_xy, scale_gridtrans::i_xyw, scale_gridtrans::i_xyz, scale_grid_index::ia, scale_grid_index::ie, scale_grid_index::ieb, scale_stdio::io_fid_log, scale_stdio::io_l, scale_grid_index::is, scale_grid_index::isb, scale_grid_index::ja, scale_grid_index::je, scale_grid_index::jeb, scale_grid_index::js, scale_grid_index::jsb, scale_grid_index::ka, scale_grid_index::ke, scale_grid_index::ks, scale_prof::prof_rapend(), scale_prof::prof_rapstart(), scale_tracer::qa, scale_tracer::tracer_advc, scale_tracer::tracer_mass, scale_tracer::tracer_name, scale_index::va, scale_grid_index::xdir, scale_grid_index::ydir, and scale_grid_index::zdir.

Referenced by scale_atmos_dyn_tstep_large::atmos_dyn_tstep_large_setup().

194  use scale_const, only: &
195  eps => const_eps, &
196  p0 => const_pre00, &
197  rdry => const_rdry, &
198  cvdry => const_cvdry, &
199  cpdry => const_cpdry
200  use scale_comm, only: &
201  comm_vars8, &
202  comm_wait
203  use scale_gridtrans, only: &
204  i_xyz, &
205  i_xyw, &
206  i_uyz, &
207  i_xvz, &
208  i_xy, &
209  i_uy, &
210  i_xv
211  use scale_atmos_dyn_common, only: &
216  use scale_atmos_dyn_fvm_flux_ud1, only: &
220  use scale_atmos_dyn_fvm_flux, only: &
224  use scale_atmos_boundary, only: &
225  bnd_qa, &
226  bnd_smoother_fact => atmos_boundary_smoother_fact
227  use scale_history, only: &
228 #ifdef hist_tend
229  hist_in, &
230 #endif
231  hist_switch
232  use scale_atmos_dyn_tinteg_short, only: &
234  use scale_atmos_dyn_tinteg_tracer, only: &
236  implicit none
237 
238  real(RP), intent(inout) :: DENS(KA,IA,JA)
239  real(RP), intent(inout) :: MOMZ(KA,IA,JA)
240  real(RP), intent(inout) :: MOMX(KA,IA,JA)
241  real(RP), intent(inout) :: MOMY(KA,IA,JA)
242  real(RP), intent(inout) :: RHOT(KA,IA,JA)
243  real(RP), intent(inout) :: QTRC(KA,IA,JA,QA)
244  real(RP), intent(inout) :: PROG(KA,IA,JA,VA)
245 
246  real(RP), intent(inout) :: DENS_av(KA,IA,JA)
247  real(RP), intent(inout) :: MOMZ_av(KA,IA,JA)
248  real(RP), intent(inout) :: MOMX_av(KA,IA,JA)
249  real(RP), intent(inout) :: MOMY_av(KA,IA,JA)
250  real(RP), intent(inout) :: RHOT_av(KA,IA,JA)
251  real(RP), intent(inout) :: QTRC_av(KA,IA,JA,QA)
252 
253  real(RP), intent(out) :: mflx_hi(KA,IA,JA,3)
254  real(RP), intent(out) :: tflx_hi(KA,IA,JA,3)
255 
256  real(RP), intent(out) :: num_diff(KA,IA,JA,5,3)
257  real(RP), intent(out) :: num_diff_q(KA,IA,JA,3)
258 
259  real(RP), intent(in) :: QTRC0(KA,IA,JA,QA)
260 
261  real(RP), intent(in) :: DENS_tp(KA,IA,JA)
262  real(RP), intent(in) :: MOMZ_tp(KA,IA,JA)
263  real(RP), intent(in) :: MOMX_tp(KA,IA,JA)
264  real(RP), intent(in) :: MOMY_tp(KA,IA,JA)
265  real(RP), intent(in) :: RHOT_tp(KA,IA,JA)
266  real(RP), intent(in) :: RHOQ_tp(KA,IA,JA,QA)
267 
268  real(RP), intent(in) :: CORIOLI(IA,JA)
269 
270  real(RP), intent(in) :: CDZ (KA)
271  real(RP), intent(in) :: CDX (IA)
272  real(RP), intent(in) :: CDY (JA)
273  real(RP), intent(in) :: FDZ (KA-1)
274  real(RP), intent(in) :: FDX (IA-1)
275  real(RP), intent(in) :: FDY (JA-1)
276  real(RP), intent(in) :: RCDZ(KA)
277  real(RP), intent(in) :: RCDX(IA)
278  real(RP), intent(in) :: RCDY(JA)
279  real(RP), intent(in) :: RFDZ(KA-1)
280  real(RP), intent(in) :: RFDX(IA-1)
281  real(RP), intent(in) :: RFDY(JA-1)
282 
283  real(RP), intent(in) :: PHI (KA,IA,JA)
284  real(RP), intent(in) :: GSQRT(KA,IA,JA,7)
285  real(RP), intent(in) :: J13G (KA,IA,JA,7)
286  real(RP), intent(in) :: J23G (KA,IA,JA,7)
287  real(RP), intent(in) :: J33G
288  real(RP), intent(in) :: MAPF (IA,JA,2,4)
289 
290  real(RP), intent(in) :: AQ_R (QA)
291  real(RP), intent(in) :: AQ_CV (QA)
292  real(RP), intent(in) :: AQ_CP (QA)
293  real(RP), intent(in) :: AQ_MASS(QA)
294 
295  real(RP), intent(in) :: REF_dens(KA,IA,JA)
296  real(RP), intent(in) :: REF_pott(KA,IA,JA)
297  real(RP), intent(in) :: REF_qv (KA,IA,JA)
298  real(RP), intent(in) :: REF_pres(KA,IA,JA)
299 
300  logical, intent(in) :: BND_W
301  logical, intent(in) :: BND_E
302  logical, intent(in) :: BND_S
303  logical, intent(in) :: BND_N
304 
305  real(RP), intent(in) :: ND_COEF
306  real(RP), intent(in) :: ND_COEF_Q
307  integer, intent(in) :: ND_ORDER
308  real(RP), intent(in) :: ND_SFC_FACT
309  logical, intent(in) :: ND_USE_RS
310 
311  real(RP), intent(in) :: DAMP_DENS(KA,IA,JA)
312  real(RP), intent(in) :: DAMP_VELZ(KA,IA,JA)
313  real(RP), intent(in) :: DAMP_VELX(KA,IA,JA)
314  real(RP), intent(in) :: DAMP_VELY(KA,IA,JA)
315  real(RP), intent(in) :: DAMP_POTT(KA,IA,JA)
316  real(RP), intent(in) :: DAMP_QTRC(KA,IA,JA,BND_QA)
317 
318  real(RP), intent(in) :: DAMP_alpha_DENS(KA,IA,JA)
319  real(RP), intent(in) :: DAMP_alpha_VELZ(KA,IA,JA)
320  real(RP), intent(in) :: DAMP_alpha_VELX(KA,IA,JA)
321  real(RP), intent(in) :: DAMP_alpha_VELY(KA,IA,JA)
322  real(RP), intent(in) :: DAMP_alpha_POTT(KA,IA,JA)
323  real(RP), intent(in) :: DAMP_alpha_QTRC(KA,IA,JA,BND_QA)
324 
325  real(RP), intent(in) :: wdamp_coef(KA)
326  real(RP), intent(in) :: divdmp_coef
327 
328  logical, intent(in) :: FLAG_FCT_MOMENTUM
329  logical, intent(in) :: FLAG_FCT_T
330  logical, intent(in) :: FLAG_FCT_TRACER
331  logical, intent(in) :: FLAG_FCT_ALONG_STREAM
332 
333  logical, intent(in) :: USE_AVERAGE
334 
335  real(DP), intent(in) :: DTLS
336  real(DP), intent(in) :: DTSS
337  logical , intent(in) :: Llast
338 
339  ! for time integartion
340  real(RP) :: DENS00 (KA,IA,JA) ! saved density before small step loop
341 
342  ! diagnostic variables
343  real(RP) :: DDIV (KA,IA,JA) ! 3 dimensional divergence
344  real(RP) :: DPRES0 (KA,IA,JA) ! pressure deviation
345  real(RP) :: RT2P (KA,IA,JA) ! factor of RHOT to PRES
346  real(RP) :: REF_rhot(KA,IA,JA) ! reference of RHOT
347 
348  real(RP) :: QDRY ! dry air
349  real(RP) :: Rtot ! total R
350  real(RP) :: CVtot ! total CV
351  real(RP) :: CPtot ! total CP
352  real(RP) :: PRES ! pressure
353 #ifdef DRY
354  real(RP) :: CPovCV
355 #endif
356 
357  real(RP) :: DENS_tq(KA,IA,JA)
358  real(RP) :: diff(KA,IA,JA)
359  real(RP) :: damp
360 #ifdef HIST_TEND
361  real(RP) :: damp_t(KA,IA,JA)
362 #endif
363 
364  ! For tracer advection
365  real(RP) :: mflx_av (KA,IA,JA,3) ! rho * vel(x,y,z) @ (u,v,w)-face average
366  real(RP) :: qflx_hi (KA,IA,JA,3) ! rho * vel(x,y,z) * phi @ (u,v,w)-face high order
367  real(RP) :: qflx_lo (KA,IA,JA,3) ! rho * vel(x,y,z) * phi, monotone flux
368  real(RP) :: qflx_anti(KA,IA,JA,3) ! anti-diffusive flux
369 
370  real(RP) :: dtl
371  real(RP) :: dts
372  integer :: nstep
373 
374  integer :: IIS, IIE
375  integer :: JJS, JJE
376  integer :: i, j, k, iq, step
377  integer :: iv
378 
379  real(RP) :: diff_coef
380  !---------------------------------------------------------------------------
381 
382  call prof_rapstart("DYN_Large_Preparation", 2)
383 
384  dts = real(DTSS, kind=RP) ! short time step
385  dtl = real(DTLS, kind=RP) ! large time step
386  nstep = ceiling( ( dtl - eps ) / dts )
387  dts = dtl / nstep ! dts is divisor of dtl and smaller or equal to dtss
388 
389 #ifdef DEBUG
390  if( io_l ) write(io_fid_log,*) '*** Dynamics large time step'
391  if( io_l ) write(io_fid_log,'(1x,A,F0.2,A,F0.2,A,I0)') &
392  '*** -> DT_large, DT_small, DT_large/DT_small : ', dtl, ', ', dts, ', ', nstep
393 
394  dens00(:,:,:) = undef
395 
396  num_diff(:,:,:,:,:) = undef
397 
398  mflx_hi(:,:,:,:) = undef
399  tflx_hi(:,:,:,:) = undef
400 
401  qflx_hi(:,:,:,:) = undef
402  qflx_lo(:,:,:,:) = undef
403 #endif
404 
405 !OCL XFILL
406  dens00(:,:,:) = dens(:,:,:)
407 
408  if ( use_average ) then
409 !OCL XFILL
410  dens_av(:,:,:) = 0.0_rp
411 !OCL XFILL
412  momz_av(:,:,:) = 0.0_rp
413 !OCL XFILL
414  momx_av(:,:,:) = 0.0_rp
415 !OCL XFILL
416  momy_av(:,:,:) = 0.0_rp
417 !OCL XFILL
418  rhot_av(:,:,:) = 0.0_rp
419  endif
420 
421 #ifndef DRY
422 !OCL XFILL
423  mflx_av(:,:,:,:) = 0.0_rp
424 
425 #endif
426 
427 #ifdef DRY
428  cpovcv = cpdry / cvdry
429 #endif
430  !------------------------------------------------------------------------
431  ! prepare thermodynamical data
432  ! specific heat
433  ! pressure data ( linearization )
434  !
435  ! pres = P0 * ( R * rhot / P0 )**(CP/CV)
436  ! d pres / d rhot ~ CP*R/CV * ( R * rhot / P0 )**(R/CV)
437  ! = CP*R/CV * ( pres / P0 )**(R/CP)
438  ! = CP*R/CV * temp / pott
439  ! = CP/CV * pres / rhot
440  ! pres ~ P0 * ( R * rhot0 / P0 ) ** (CP/CV) + CV*R/CP * ( pres / P0 )**(R/CP) * rhot'
441  !------------------------------------------------------------------------
442 !OCL XFILL
443  !$omp parallel do default(none) OMP_SCHEDULE_ collapse(2) &
444  !$omp shared(JA,IA,KS,KE) &
445  !$omp shared(P0,Rdry,RHOT,AQ_R,AQ_CV,AQ_CP,QTRC,AQ_MASS,REF_rhot,REF_pres,CPdry,CVdry,QA,RT2P,DPRES0) &
446 #ifdef DRY
447  !$omp shared(CPovCV) &
448 #endif
449  !$omp private(i,j,k,iq) &
450  !$omp private(PRES,Rtot,CVtot,CPtot,QDRY)
451  do j = 1, ja
452  do i = 1, ia
453  do k = ks, ke
454 #ifdef DRY
455  pres = p0 * ( rdry * rhot(k,i,j) / p0 )**cpovcv
456  rt2p(k,i,j) = cpovcv * pres / rhot(k,i,j)
457 #else
458  rtot = 0.0_rp
459  cvtot = 0.0_rp
460  cptot = 0.0_rp
461  qdry = 1.0_rp
462  do iq = 1, qa
463  rtot = rtot + aq_r(iq) * qtrc(k,i,j,iq)
464  cvtot = cvtot + aq_cv(iq) * qtrc(k,i,j,iq)
465  cptot = cptot + aq_cp(iq) * qtrc(k,i,j,iq)
466  qdry = qdry - qtrc(k,i,j,iq) * aq_mass(iq)
467  enddo
468  rtot = rtot + rdry * qdry
469  cvtot = cvtot + cvdry * qdry
470  cptot = cptot + cpdry * qdry
471  pres = p0 * ( rtot * rhot(k,i,j) / p0 )**( cptot / cvtot )
472  rt2p(k,i,j) = cptot / cvtot * pres / rhot(k,i,j)
473 #endif
474  dpres0(k,i,j) = pres - ref_pres(k,i,j)
475  ref_rhot(k,i,j) = rhot(k,i,j)
476  end do
477  dpres0(ks-1,i,j) = dpres0(ks+1,i,j) + ( ref_pres(ks+1,i,j) - ref_pres(ks-1,i,j) )
478  dpres0(ke+1,i,j) = dpres0(ke-1,i,j) + ( ref_pres(ke-1,i,j) - ref_pres(ke+1,i,j) )
479  end do
480  end do
481 
482  call prof_rapend ("DYN_Large_Preparation", 2)
483 
484  !###########################################################################
485  ! Update DENS,MONZ,MOMX,MOMY,MOMZ,RHOT
486  !###########################################################################
487 
488  call prof_rapstart("DYN_Large_Tendency", 2)
489 
490 #ifdef HIST_TEND
491 !OCL XFILL
492  damp_t(:,:,:) = 0.0_rp
493 #endif
494 
495 !OCL XFILL
496  dens_tq(:,:,:) = 0.0_rp
497 
498  do iq = 1, bnd_qa
499 
500  !$omp parallel do private(i,j,k) OMP_SCHEDULE_ collapse(2)
501 !OCL XFILL
502  do j = js-1, je+2
503  do i = is-1, ie+2
504  do k = ks, ke
505  diff(k,i,j) = qtrc(k,i,j,iq) - damp_qtrc(k,i,j,iq)
506  enddo
507  enddo
508  enddo
509  !$omp parallel do default(none) OMP_SCHEDULE_ collapse(2) &
510  !$omp private(i,j,k,damp) &
511 #ifdef HIST_TEND
512  !$omp shared(damp_t) &
513 #endif
514  !$omp shared(JS,JE,IS,IE,KS,KE,iq) &
515  !$omp shared(RHOQ_t,RHOQ_tp,DENS_tq,DAMP_alpha_QTRC,diff,BND_SMOOTHER_FACT,DENS00,TRACER_MASS)
516 !OCL XFILL
517  do j = js, je
518  do i = is, ie
519  do k = ks, ke
520  damp = - damp_alpha_qtrc(k,i,j,iq) &
521  * ( diff(k,i,j) & ! rayleigh damping
522  - ( diff(k,i-1,j) + diff(k,i+1,j) + diff(k,i,j-1) + diff(k,i,j+1) - diff(k,i,j)*4.0_rp ) &
523  * 0.125_rp * bnd_smoother_fact ) ! horizontal smoother
524 #ifdef HIST_TEND
525  damp_t(k,i,j) = damp
526 #endif
527  damp = damp * dens00(k,i,j)
528  rhoq_t(k,i,j,iq) = rhoq_tp(k,i,j,iq) + damp
529  dens_tq(k,i,j) = dens_tq(k,i,j) + damp * tracer_mass(iq) ! only for mass tracer
530  enddo
531  enddo
532  enddo
533 #ifdef HIST_TEND
534  call hist_in(rhoq_tp(:,:,:,iq), trim(tracer_name(iq))//'_t_phys', &
535  'tendency of '//trim(tracer_name(iq))//' due to physics', 'kg/kg/s' )
536  call hist_in(damp_t, trim(tracer_name(iq))//'_t_damp', &
537  'tendency of '//trim(tracer_name(iq))//' due to damping', 'kg/kg/s' )
538 #endif
539 !OCL XFILL
540  do j = js, je
541  do i = is, ie
542  rhoq_t( 1:ks-1,i,j,iq) = 0.0_rp
543  rhoq_t(ke+1:ka ,i,j,iq) = 0.0_rp
544  enddo
545  enddo
546 
547  call comm_vars8( rhoq_t(:,:,:,iq), i_comm_rhoq_t(iq) )
548  call comm_wait ( rhoq_t(:,:,:,iq), i_comm_rhoq_t(iq), .false. )
549 
550  end do
551 
552  !$omp parallel do private(i,j,k,iq) OMP_SCHEDULE_ collapse(3)
553 !OCL XFILL
554  do iq = bnd_qa+1, qa
555  do j = 1, ja
556  do i = 1, ia
557  do k = 1, ka
558  rhoq_t(k,i,j,iq) = rhoq_tp(k,i,j,iq)
559  enddo
560  enddo
561  enddo
562  end do
563 
564  call prof_rapend ("DYN_Large_Tendency", 2)
565 
566  call prof_rapstart("DYN_Large_Boundary", 2)
567 
568  if ( bnd_w ) then
569  !$omp parallel do private(j,k) OMP_SCHEDULE_ collapse(2)
570  do j = js, je
571  do k = ks, ke
572  mflx_hi(k,is-1,j,xdir) = gsqrt(k,is-1,j,i_uyz) * momx(k,is-1,j) / mapf(is-1,j,2,i_uy)
573  enddo
574  enddo
575  end if
576  if ( bnd_e ) then
577  !$omp parallel do private(j,k) OMP_SCHEDULE_ collapse(2)
578  do j = js, je
579  do k = ks, ke
580  mflx_hi(k,ie,j,xdir) = gsqrt(k,ie,j,i_uyz) * momx(k,ie,j) / mapf(ie,j,2,i_uy)
581  enddo
582  enddo
583  end if
584  if ( bnd_s ) then
585  !$omp parallel do private(i,k) OMP_SCHEDULE_ collapse(2)
586  do i = is, ie
587  do k = ks, ke
588  mflx_hi(k,i,js-1,ydir) = gsqrt(k,i,js-1,i_xvz) * momy(k,i,js-1) / mapf(i,js-1,1,i_xv)
589  enddo
590  enddo
591  end if
592  if ( bnd_n ) then
593  !$omp parallel do private(i,k) OMP_SCHEDULE_ collapse(2)
594  do i = is, ie
595  do k = ks, ke
596  mflx_hi(k,i,je,ydir) = gsqrt(k,i,je,i_xvz) * momy(k,i,je) / mapf(i,je,1,i_xv)
597  enddo
598  enddo
599  end if
600 
601  call prof_rapend ("DYN_Large_Boundary", 2)
602 
603 
604  do step = 1, nstep
605 
606  call hist_switch( llast .AND. step == nstep )
607 
608  !-----< prepare tendency >-----
609 
610  call prof_rapstart("DYN_Large_Tendency", 2)
611 
612  !$omp parallel do private(i,j,k) OMP_SCHEDULE_ collapse(2)
613 !OCL XFILL
614  do j = js-1, je+1
615  do i = is-1, ie+1
616  do k = ks, ke
617  diff(k,i,j) = dens(k,i,j) - damp_dens(k,i,j)
618  enddo
619  enddo
620  enddo
621  !$omp parallel do default(none) OMP_SCHEDULE_ collapse(2) &
622  !$omp private(i,j,k,damp) &
623 #ifdef HIST_TEND
624  !$omp shared(damp_t) &
625 #endif
626  !$omp shared(JS,JE,IS,IE,KS,KE) &
627  !$omp shared(DAMP_alpha_DENS,diff,DENS_tq,DENS_t,DENS_tp,BND_SMOOTHER_FACT)
628 !OCL XFILL
629  do j = js, je
630  do i = is, ie
631  do k = ks, ke
632  damp = - damp_alpha_dens(k,i,j) &
633  * ( diff(k,i,j) & ! rayleigh damping
634  - ( diff(k,i-1,j) + diff(k,i+1,j) + diff(k,i,j-1) + diff(k,i,j+1) - diff(k,i,j)*4.0_rp ) &
635  * 0.125_rp * bnd_smoother_fact ) & ! horizontal smoother
636  + dens_tq(k,i,j) ! dencity change due to rayleigh damping for tracers
637  dens_t(k,i,j) = dens_tp(k,i,j) & ! tendency from physical step
638  + damp
639 #ifdef HIST_TEND
640  damp_t(k,i,j) = damp
641 #endif
642  enddo
643  enddo
644  enddo
645 !OCL XFILL
646  do j = js, je
647  do i = is, ie
648  dens_t( 1:ks-1,i,j) = 0.0_rp
649  dens_t(ke+1:ka ,i,j) = 0.0_rp
650  enddo
651  enddo
652  call comm_vars8( dens_t(:,:,:), i_comm_dens_t )
653 #ifdef HIST_TEND
654  call hist_in(dens_tp, 'DENS_t_phys', 'tendency of dencity due to physics', 'kg/m3/s' )
655  call hist_in(damp_t, 'DENS_t_damp', 'tendency of dencity due to damping', 'kg/m3/s' )
656 #endif
657 
658  !$omp parallel do private(i,j,k) OMP_SCHEDULE_ collapse(2)
659 !OCL XFILL
660  do j = js-1, je+1
661  do i = is-1, ie+1
662  do k = ks, ke-1
663  diff(k,i,j) = momz(k,i,j) - damp_velz(k,i,j) * ( dens(k,i,j)+dens(k+1,i,j) ) * 0.5_rp
664  enddo
665  enddo
666  enddo
667  !$omp parallel do default(none) OMP_SCHEDULE_ collapse(2) &
668  !$omp private(i,j,k,damp) &
669 #ifdef HIST_TEND
670  !$omp shared(damp_t) &
671 #endif
672  !$omp shared(JS,JE,IS,IE,KS,KE) &
673  !$omp shared(DAMP_alpha_VELZ,diff,BND_SMOOTHER_FACT,MOMZ_t,MOMZ_tp)
674 !OCL XFILL
675  do j = js, je
676  do i = is, ie
677  do k = ks, ke-1
678  damp = - damp_alpha_velz(k,i,j) &
679  * ( diff(k,i,j) & ! rayleigh damping
680  - ( diff(k,i-1,j) + diff(k,i+1,j) + diff(k,i,j-1) + diff(k,i,j+1) - diff(k,i,j)*4.0_rp ) &
681  * 0.125_rp * bnd_smoother_fact ) ! horizontal smoother
682 
683  momz_t(k,i,j) = momz_tp(k,i,j) & ! tendency from physical step
684  + damp
685 #ifdef HIST_TEND
686  damp_t(k,i,j) = damp
687 #endif
688  enddo
689  enddo
690  enddo
691 !OCL XFILL
692  do j = js, je
693  do i = is, ie
694  momz_t( 1:ks-1,i,j) = 0.0_rp
695  momz_t(ke:ka ,i,j) = 0.0_rp
696  enddo
697  enddo
698  call comm_vars8( momz_t(:,:,:), i_comm_momz_t )
699 #ifdef HIST_TEND
700  call hist_in(momz_tp, 'MOMZ_t_phys', 'tendency of momentum z due to physics', 'kg/m2/s2', zdim='half' )
701  call hist_in(damp_t, 'MOMZ_t_damp', 'tendency of momentum z due to damping', 'kg/m2/s2', zdim='half' )
702 #endif
703 
704  !$omp parallel do private(i,j,k) OMP_SCHEDULE_ collapse(2)
705 !OCL XFILL
706  do j = js-1, je+1
707  do i = is-1, ie+1
708  do k = ks, ke
709  diff(k,i,j) = momx(k,i,j) - damp_velx(k,i,j) * ( dens(k,i,j)+dens(k,i+1,j) ) * 0.5_rp
710  enddo
711  enddo
712  enddo
713 !OCL XFILL
714  !$omp parallel do default(none) OMP_SCHEDULE_ collapse(2) &
715  !$omp private(i,j,k,damp) &
716 #ifdef HIST_TEND
717  !$omp shared(damp_t) &
718 #endif
719  !$omp shared(JS,JE,IS,IE,KS,KE) &
720  !$omp shared(DAMP_alpha_VELX,diff,BND_SMOOTHER_FACT,MOMX_tp,MOMX_t)
721  do j = js, je
722  do i = is, ie
723  do k = ks, ke
724  damp = - damp_alpha_velx(k,i,j) &
725  * ( diff(k,i,j) & ! rayleigh damping
726  - ( diff(k,i-1,j) + diff(k,i+1,j) + diff(k,i,j-1) + diff(k,i,j+1) - diff(k,i,j)*4.0_rp ) &
727  * 0.125_rp * bnd_smoother_fact ) ! horizontal smoother
728  momx_t(k,i,j) = momx_tp(k,i,j) & ! tendency from physical step
729  + damp
730 #ifdef HIST_TEND
731  damp_t(k,i,j) = damp
732 #endif
733  enddo
734  enddo
735  enddo
736 !OCL XFILL
737  do j = js, je
738  do i = is, ie
739  momx_t( 1:ks-1,i,j) = 0.0_rp
740  momx_t(ke+1:ka ,i,j) = 0.0_rp
741  enddo
742  enddo
743  call comm_vars8( momx_t(:,:,:), i_comm_momx_t )
744 #ifdef HIST_TEND
745  call hist_in(momx_tp, 'MOMX_t_phys', 'tendency of momentum x due to physics', 'kg/m2/s2', xdim='half' )
746  call hist_in(damp_t, 'MOMX_t_damp', 'tendency of momentum x due to damping', 'kg/m2/s2', xdim='half' )
747 #endif
748 
749  !$omp parallel do private(i,j,k) OMP_SCHEDULE_ collapse(2)
750 !OCL XFILL
751  do j = js-1, je+1
752  do i = is-1, ie+1
753  do k = ks, ke
754  diff(k,i,j) = momy(k,i,j) - damp_vely(k,i,j) * ( dens(k,i,j)+dens(k,i,j+1) ) * 0.5_rp
755  enddo
756  enddo
757  enddo
758 !OCL XFILL
759  !$omp parallel do default(none) OMP_SCHEDULE_ collapse(2) &
760  !$omp private(i,j,k,damp) &
761 #ifdef HIST_TEND
762  !$omp shared(damp_t) &
763 #endif
764  !$omp shared(JS,JE,IS,IE,KS,KE) &
765  !$omp shared(DAMP_alpha_VELY,diff,BND_SMOOTHER_FACT,MOMY_tp,MOMY_t)
766  do j = js, je
767  do i = is, ie
768  do k = ks, ke
769  damp = - damp_alpha_vely(k,i,j) &
770  * ( diff(k,i,j) & ! rayleigh damping
771  - ( diff(k,i-1,j) + diff(k,i+1,j) + diff(k,i,j-1) + diff(k,i,j+1) - diff(k,i,j)*4.0_rp ) &
772  * 0.125_rp * bnd_smoother_fact ) ! horizontal smoother
773  momy_t(k,i,j) = momy_tp(k,i,j) & ! tendency from physical step
774  + damp
775 #ifdef HIST_TEND
776  damp_t(k,i,j) = damp
777 #endif
778  enddo
779  enddo
780  enddo
781 !OCL XFILL
782  do j = js, je
783  do i = is, ie
784  momy_t( 1:ks-1,i,j) = 0.0_rp
785  momy_t(ke+1:ka ,i,j) = 0.0_rp
786  enddo
787  enddo
788  call comm_vars8( momy_t(:,:,:), i_comm_momy_t )
789 #ifdef HIST_TEND
790  call hist_in(momy_tp, 'MOMY_t_phys', 'tendency of momentum y due to physics', 'kg/m2/s2', ydim='half' )
791  call hist_in(damp_t, 'MOMY_t_damp', 'tendency of momentum y due to damping', 'kg/m2/s2', ydim='half' )
792 #endif
793 
794  !$omp parallel do private(i,j,k) OMP_SCHEDULE_ collapse(2)
795 !OCL XFILL
796  do j = js-1, je+2
797  do i = is-1, ie+2
798  do k = ks, ke
799  diff(k,i,j) = rhot(k,i,j) - damp_pott(k,i,j) * dens(k,i,j)
800  enddo
801  enddo
802  enddo
803 !OCL XFILL
804  !$omp parallel do default(none) OMP_SCHEDULE_ collapse(2) &
805  !$omp private(i,j,k,damp) &
806 #ifdef HIST_TEND
807  !$omp shared(damp_t) &
808 #endif
809  !$omp shared(JS,JE,IS,IE,KS,KE) &
810  !$omp shared(DAMP_alpha_POTT,diff,BND_SMOOTHER_FACT,RHOT_t,RHOT_tp)
811  do j = js, je
812  do i = is, ie
813  do k = ks, ke
814  damp = - damp_alpha_pott(k,i,j) &
815  * ( diff(k,i,j) & ! rayleigh damping
816  - ( diff(k,i-1,j) + diff(k,i+1,j) + diff(k,i,j-1) + diff(k,i,j+1) - diff(k,i,j)*4.0_rp ) &
817  * 0.125_rp * bnd_smoother_fact ) ! horizontal smoother
818  rhot_t(k,i,j) = rhot_tp(k,i,j) & ! tendency from physical step
819  + damp
820 #ifdef HIST_TEND
821  damp_t(k,i,j) = damp
822 #endif
823  enddo
824  enddo
825  enddo
826 !OCL XFILL
827  do j = js, je
828  do i = is, ie
829  rhot_t( 1:ks-1,i,j) = 0.0_rp
830  rhot_t(ke+1:ka ,i,j) = 0.0_rp
831  enddo
832  enddo
833  call comm_vars8( rhot_t(:,:,:), i_comm_rhot_t )
834 #ifdef HIST_TEND
835  call hist_in(rhot_tp, 'RHOT_t_phys', 'tendency of rho*theta temperature due to physics', 'K kg/m3/s' )
836  call hist_in(damp_t, 'RHOT_t_damp', 'tendency of rho*theta temperature due to damping', 'K kg/m3/s' )
837 #endif
838 
839  call comm_wait ( dens_t(:,:,:), i_comm_dens_t, .false. )
840  call comm_wait ( momz_t(:,:,:), i_comm_momz_t, .false. )
841  call comm_wait ( momx_t(:,:,:), i_comm_momx_t, .false. )
842  call comm_wait ( momy_t(:,:,:), i_comm_momy_t, .false. )
843  call comm_wait ( rhot_t(:,:,:), i_comm_rhot_t, .false. )
844 
845  call prof_rapend ("DYN_Large_Tendency", 2)
846 
847  call prof_rapstart("DYN_Large_Numfilter", 2)
848 
849  !-----< prepare numerical diffusion coefficient >-----
850 
851  if ( nd_coef == 0.0_rp ) then
852 !OCL XFILL
853  num_diff(:,:,:,:,:) = 0.0_rp
854  else
855  call atmos_dyn_numfilter_coef( num_diff(:,:,:,:,:), & ! [OUT]
856  dens, momz, momx, momy, rhot, & ! [IN]
857  cdz, cdx, cdy, fdz, fdx, fdy, dts, & ! [IN]
858  ref_dens, ref_pott, & ! [IN]
859  nd_coef, nd_order, nd_sfc_fact, nd_use_rs ) ! [IN]
860  endif
861 
862  call prof_rapend ("DYN_Large_Numfilter", 2)
863 
864  if ( divdmp_coef > 0.0_rp ) then
865 
866  call atmos_dyn_divergence( ddiv, & ! (out)
867  momz, momx, momy, & ! (in)
868  gsqrt, j13g, j23g, j33g, mapf, & ! (in)
869  rcdz, rcdx, rcdy, rfdz, fdz ) ! (in)
870 
871  else
872 
873 !XFILL
874  ddiv = 0.0_rp
875 
876  end if
877 
878  !------------------------------------------------------------------------
879  ! Start short time integration
880  !------------------------------------------------------------------------
881 
882  call prof_rapstart("DYN_Short_Tinteg", 2)
883 
884  call atmos_dyn_tinteg_short( dens, momz, momx, momy, rhot, prog, & ! (inout)
885  mflx_hi, tflx_hi, & ! (inout)
886  dens_t, momz_t, momx_t, momy_t, rhot_t, & ! (in)
887  dpres0, rt2p, corioli, & ! (in)
888  num_diff, wdamp_coef, divdmp_coef, ddiv, & ! (in)
889  flag_fct_momentum, flag_fct_t, & ! (in)
890  flag_fct_along_stream, & ! (in)
891  cdz, fdz, fdx, fdy, & ! (in)
892  rcdz, rcdx, rcdy, rfdz, rfdx, rfdy, & ! (in)
893  phi, gsqrt, j13g, j23g, j33g, mapf, & ! (in)
894  ref_dens, ref_rhot, & ! (in)
895  bnd_w, bnd_e, bnd_s, bnd_n, & ! (in)
896  dts ) ! (in)
897 
898  call prof_rapend ("DYN_Short_Tinteg", 2)
899 
900 #ifdef CHECK_MASS
901  call check_mass( &
902  dens, damp_dens, &
903  mflx_hi, tflx_hi, &
904  gsqrt, mapf, &
905  rcdx, rcdy, &
906  dts, step, &
907  bnd_w, bnd_e, bnd_s, bnd_n )
908 #endif
909 
910  !$omp parallel do default(none) private(i,j,iv) OMP_SCHEDULE_ collapse(2) &
911  !$omp shared(JSB,JEB,ISB,IEB,KS,KA,DENS,MOMZ,MOMX,MOMY,RHOT,VA,PROG,KE)
912  do j = jsb, jeb
913  do i = isb, ieb
914  dens( 1:ks-1,i,j) = dens(ks,i,j)
915  momz( 1:ks-1,i,j) = momz(ks,i,j)
916  momx( 1:ks-1,i,j) = momx(ks,i,j)
917  momy( 1:ks-1,i,j) = momy(ks,i,j)
918  rhot( 1:ks-1,i,j) = rhot(ks,i,j)
919  do iv = 1, va
920  prog( 1:ks-1,i,j,iv) = prog(ks,i,j,iv)
921  end do
922  dens(ke+1:ka, i,j) = dens(ke,i,j)
923  momz(ke+1:ka, i,j) = momz(ke,i,j)
924  momx(ke+1:ka, i,j) = momx(ke,i,j)
925  momy(ke+1:ka, i,j) = momy(ke,i,j)
926  rhot(ke+1:ka, i,j) = rhot(ke,i,j)
927  do iv = 1, va
928  prog(ke+1:ka, i,j,iv) = prog(ke,i,j,iv)
929  end do
930  enddo
931  enddo
932 
933  call comm_vars8( dens(:,:,:), i_comm_dens )
934  call comm_vars8( momz(:,:,:), i_comm_momz )
935  call comm_vars8( momx(:,:,:), i_comm_momx )
936  call comm_vars8( momy(:,:,:), i_comm_momy )
937  call comm_vars8( rhot(:,:,:), i_comm_rhot )
938  do iv = 1, va
939  call comm_vars8( prog(:,:,:,iv), i_comm_prog(iv) )
940  end do
941  call comm_wait ( dens(:,:,:), i_comm_dens, .false. )
942  call comm_wait ( momz(:,:,:), i_comm_momz, .false. )
943  call comm_wait ( momx(:,:,:), i_comm_momx, .false. )
944  call comm_wait ( momy(:,:,:), i_comm_momy, .false. )
945  call comm_wait ( rhot(:,:,:), i_comm_rhot, .false. )
946  do iv = 1, va
947  call comm_wait ( prog(:,:,:,iv), i_comm_prog(iv), .false. )
948  end do
949 
950  if ( use_average ) then
951  dens_av(:,:,:) = dens_av(:,:,:) + dens(:,:,:)
952  momz_av(:,:,:) = momz_av(:,:,:) + momz(:,:,:)
953  momx_av(:,:,:) = momx_av(:,:,:) + momx(:,:,:)
954  momy_av(:,:,:) = momy_av(:,:,:) + momy(:,:,:)
955  rhot_av(:,:,:) = rhot_av(:,:,:) + rhot(:,:,:)
956  endif
957 
958 #ifndef DRY
959  mflx_av(:,:,:,:) = mflx_av(:,:,:,:) + mflx_hi(:,:,:,:)
960 #endif
961 
962  enddo ! dynamical steps
963 
964  if ( use_average ) then
965  dens_av(:,:,:) = dens_av(:,:,:) / nstep
966  momz_av(:,:,:) = momz_av(:,:,:) / nstep
967  momx_av(:,:,:) = momx_av(:,:,:) / nstep
968  momy_av(:,:,:) = momy_av(:,:,:) / nstep
969  rhot_av(:,:,:) = rhot_av(:,:,:) / nstep
970  endif
971 
972 #ifndef DRY
973  !###########################################################################
974  ! Update Tracers
975  !###########################################################################
976 
977 !OCL XFILL
978  mflx_hi(:,:,:,:) = mflx_av(:,:,:,:) / nstep
979 
980  call comm_vars8( mflx_hi(:,:,:,zdir), i_comm_mflx_z )
981  call comm_vars8( mflx_hi(:,:,:,xdir), i_comm_mflx_x )
982  call comm_vars8( mflx_hi(:,:,:,ydir), i_comm_mflx_y )
983  call comm_wait ( mflx_hi(:,:,:,zdir), i_comm_mflx_z, .false. )
984  call comm_wait ( mflx_hi(:,:,:,xdir), i_comm_mflx_x, .false. )
985  call comm_wait ( mflx_hi(:,:,:,ydir), i_comm_mflx_y, .false. )
986 
987  if ( use_average ) then
988 !OCL XFILL
989  qtrc_av(:,:,:,:) = 0.0_rp
990  endif
991 
992  !------------------------------------------------------------------------
993  ! Update each tracer
994  !------------------------------------------------------------------------
995 
996 #ifdef SDM
997  do iq = 1, i_qv
998 #else
999  do iq = 1, qa
1000 #endif
1001 
1002  if ( tracer_advc(iq) ) then
1003 
1004  call prof_rapstart("DYN_Large_Numfilter", 2)
1005 
1006  if ( nd_coef_q == 0.0_rp ) then
1007 !OCL XFILL
1008  num_diff_q(:,:,:,:) = 0.0_rp
1009  else
1010  call atmos_dyn_numfilter_coef_q( num_diff_q(:,:,:,:), & ! [OUT]
1011  dens00, qtrc(:,:,:,iq), & ! [IN]
1012  cdz, cdx, cdy, dtl, & ! [IN]
1013  ref_qv, iq, & ! [IN]
1014  nd_coef_q, nd_order, nd_sfc_fact, nd_use_rs ) ! [IN]
1015  endif
1016 
1017  call prof_rapend ("DYN_Large_Numfilter", 2)
1018 
1019  call prof_rapstart("DYN_Tracer_Tinteg", 2)
1020 
1021  call atmos_dyn_tinteg_tracer( &
1022  qtrc(:,:,:,iq), & ! (inout)
1023  qtrc0(:,:,:,iq), rhoq_t(:,:,:,iq), &! (in)
1024  dens00, dens, & ! (in)
1025  mflx_hi, num_diff_q, & ! (in)
1026  gsqrt, mapf(:,:,:,i_xy), & ! (in)
1027  cdz, rcdz, rcdx, rcdy, & ! (in)
1028  bnd_w, bnd_e, bnd_s, bnd_n, & ! (in)
1029  dtl, & ! (in)
1030  llast .AND. flag_fct_tracer, & ! (in)
1031  flag_fct_along_stream ) ! (in)
1032 
1033  call prof_rapend ("DYN_Tracer_Tinteg", 2)
1034 
1035  else
1036 
1037  do j = js, je
1038  do i = is, ie
1039  do k = ks, ke
1040  qtrc(k,i,j,iq) = ( qtrc0(k,i,j,iq) * dens00(k,i,j) &
1041  + rhoq_t(k,i,j,iq) * dtl ) / dens(k,i,j)
1042  end do
1043  end do
1044  end do
1045 
1046  end if
1047 
1048  if ( use_average ) then
1049  qtrc_av(:,:,:,iq) = qtrc(:,:,:,iq)
1050  endif
1051 
1052  call comm_vars8( qtrc(:,:,:,iq), i_comm_qtrc(iq) )
1053 
1054  enddo ! scalar quantities loop
1055 
1056  do iq = 1, qa
1057  call comm_wait ( qtrc(:,:,:,iq), i_comm_qtrc(iq), .false. )
1058  enddo
1059 #endif
1060 
1061  return
integer, public is
start point of inner domain: x, local
integer, public i_xvz
real(rp), public const_cvdry
specific heat (dry air,constant volume) [J/kg/K]
Definition: scale_const.F90:59
integer, public je
end point of inner domain: y, local
real(rp), public const_cpdry
specific heat (dry air,constant pressure) [J/kg/K]
Definition: scale_const.F90:58
subroutine, public atmos_dyn_fvm_fluxy_xyz_ud1(flux, mflx, val, GSQRT, num_diff, CDZ, IIS, IIE, JJS, JJE)
calculation Y-flux at XYZ
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 jeb
integer, public va
Definition: scale_index.F90:38
subroutine, public atmos_dyn_fvm_fluxz_xyz_ud1(flux, mflx, val, GSQRT, num_diff, CDZ, IIS, IIE, JJS, JJE)
calculation z-flux at XYZ
module Atmosphere / Dynamics Temporal integration
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.
integer, parameter, public zdir
procedure(flux_phi), pointer, public atmos_dyn_fvm_fluxx_xyz
integer, parameter, public ydir
integer, public ke
end point of inner domain: z, local
integer, parameter, public xdir
integer, public i_xy
module Atmosphere / Dynamics Temporal integration
real(rp), public const_rdry
specific gas constant (dry air) [J/kg/K]
Definition: scale_const.F90:57
integer, public ieb
integer, public ia
of whole cells: x, local, with HALO
module GRIDTRANS
integer, public ka
of whole cells: z, local, with HALO
integer, public i_uy
real(rp), public const_pre00
pressure reference [Pa]
Definition: scale_const.F90:90
integer, public i_xyw
module COMMUNICATION
Definition: scale_comm.F90:23
integer, public js
start point of inner domain: y, local
procedure(tinteg), pointer, public atmos_dyn_tinteg_tracer
module Atmosphere / Dynamics common
module CONSTANT
Definition: scale_const.F90:14
integer, public ks
start point of inner domain: z, local
integer, public i_xv
integer, public ie
end point of inner domain: x, local
real(rp), public const_eps
small number
Definition: scale_const.F90:36
module scale_atmos_dyn_fvm_flux
integer, public i_uyz
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.
subroutine, public atmos_dyn_divergence(DDIV, MOMZ, MOMX, MOMY, GSQRT, J13G, J23G, J33G, MAPF, RCDZ, RCDX, RCDY, RFDZ, FDZ)
module ATMOSPHERE / Boundary treatment
module HISTORY
integer, public isb
procedure(short), pointer, public atmos_dyn_tinteg_short
integer, public i_xyz
integer, public jsb
procedure(flux_phi), pointer, public atmos_dyn_fvm_fluxz_xyz
procedure(flux_phi), pointer, public atmos_dyn_fvm_fluxy_xyz
subroutine, public atmos_dyn_fvm_fluxx_xyz_ud1(flux, mflx, val, GSQRT, num_diff, CDZ, IIS, IIE, JJS, JJE)
calculation X-flux at XYZ
module scale_atmos_dyn_fvm_flux_ud1
real(rp), public atmos_boundary_smoother_fact
integer, public ja
of whole cells: y, local, with HALO
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_mass()

subroutine scale_atmos_dyn_tstep_large_fvm_heve::check_mass ( real(rp), dimension (ka,ia,ja), intent(in)  DENS,
real(rp), dimension(ka,ia,ja), intent(in)  DAMP_DENS,
real(rp), dimension (ka,ia,ja,3), intent(in)  mflx_hi,
real(rp), dimension (ka,ia,ja,3), intent(in)  tflx_hi,
real(rp), dimension (ka,ia,ja,7), intent(in)  GSQRT,
real(rp), dimension ( ia,ja,2,7), intent(in)  MAPF,
real(rp), dimension(ia), intent(in)  RCDX,
real(rp), dimension(ja), intent(in)  RCDY,
real(rp), intent(in)  dt,
integer, intent(in)  step,
logical, intent(in)  BND_W,
logical, intent(in)  BND_E,
logical, intent(in)  BND_S,
logical, intent(in)  BND_N 
)

Definition at line 1073 of file scale_atmos_dyn_tstep_large_fvm_heve.F90.

References scale_comm::comm_datatype, scale_comm::comm_world, scale_gridtrans::i_xy, scale_gridtrans::i_xyz, scale_grid_index::ie, scale_stdio::io_fid_log, scale_stdio::io_l, scale_grid_index::is, scale_grid_index::je, scale_grid_index::js, scale_grid_index::ke, scale_grid_index::kmax, scale_grid_index::ks, scale_grid_real::real_vol, scale_grid_index::xdir, scale_grid_index::ydir, and scale_grid_index::zdir.

Referenced by atmos_dyn_tstep_large_fvm_heve().

1073  use mpi
1074  use scale_grid_real, only: &
1075  vol => real_vol
1076  use scale_comm, only: &
1077  comm_datatype, &
1078  comm_world
1079  use scale_history, only: &
1080  hist_in
1081  use scale_gridtrans, only: &
1082  i_xyz, &
1083  i_xy
1084  implicit none
1085  real(RP), intent(in) :: DENS (KA,IA,JA)
1086  real(RP), intent(in) :: DAMP_DENS(KA,IA,JA)
1087  real(RP), intent(in) :: mflx_hi (KA,IA,JA,3)
1088  real(RP), intent(in) :: tflx_hi (KA,IA,JA,3)
1089  real(RP), intent(in) :: GSQRT (KA,IA,JA,7)
1090  real(RP), intent(in) :: MAPF ( IA,JA,2,7)
1091  real(RP), intent(in) :: RCDX(IA)
1092  real(RP), intent(in) :: RCDY(JA)
1093  real(RP), intent(in) :: dt
1094  integer, intent(in) :: step
1095  logical, intent(in) :: BND_W
1096  logical, intent(in) :: BND_E
1097  logical, intent(in) :: BND_S
1098  logical, intent(in) :: BND_N
1099 
1100  ! lateral boundary flux
1101  real(RP) :: mflx_lb_horizontal(KA)
1102  real(RP) :: allmflx_lb_horizontal(KA)
1103  real(RP) :: mflx_lb_total
1104  real(RP) :: mass_total
1105  real(RP) :: mass_total2
1106  real(RP) :: allmflx_lb_total
1107  real(RP) :: allmass_total
1108  real(RP) :: allmass_total2
1109 
1110  integer :: k, i, j
1111  integer :: ierr
1112 
1113 
1114  call hist_in(mflx_hi(:,:,:,zdir), 'MFLXZ', 'momentum flux of z-direction', 'kg/m2/s', zdim='half' )
1115  call hist_in(mflx_hi(:,:,:,xdir), 'MFLXX', 'momentum flux of x-direction', 'kg/m2/s', xdim='half' )
1116  call hist_in(mflx_hi(:,:,:,ydir), 'MFLXY', 'momentum flux of y-direction', 'kg/m2/s', ydim='half' )
1117 
1118  call hist_in(tflx_hi(:,:,:,zdir), 'TFLXZ', 'potential temperature flux of z-direction', 'K*kg/m2/s', zdim='half' )
1119  call hist_in(tflx_hi(:,:,:,xdir), 'TFLXX', 'potential temperature flux of x-direction', 'K*kg/m2/s', xdim='half' )
1120  call hist_in(tflx_hi(:,:,:,ydir), 'TFLXY', 'potential temperature flux of y-direction', 'K*kg/m2/s', ydim='half' )
1121 
1122  mflx_lb_total = 0.0_rp
1123  mflx_lb_horizontal(:) = 0.0_rp
1124  allmflx_lb_horizontal(:) = 0.0_rp
1125 
1126  if ( bnd_w ) then ! for western boundary
1127  i = is
1128  do j = js, je
1129  do k = ks, ke
1130  mflx_lb_total = mflx_lb_total + mflx_hi(k,i-1,j,xdir) * rcdx(i) * vol(k,i,j) &
1131  * mapf(i,j,1,i_xy) * mapf(i,j,2,i_xy) / gsqrt(k,i,j,i_xyz) * dt
1132  mflx_lb_horizontal(k) = mflx_lb_horizontal(k) + mflx_hi(k,i-1,j,xdir) * rcdx(i) * vol(k,i,j) &
1133  * mapf(i,j,1,i_xy) * mapf(i,j,2,i_xy) / gsqrt(k,i,j,i_xyz) * dt
1134 
1135  end do
1136  end do
1137  end if
1138  if ( bnd_e ) then ! for eastern boundary
1139  i = ie
1140  do j = js, je
1141  do k = ks, ke
1142  mflx_lb_total = mflx_lb_total - mflx_hi(k,i,j,xdir) * rcdx(i) * vol(k,i,j) &
1143  * mapf(i,j,1,i_xy) * mapf(i,j,2,i_xy) / gsqrt(k,i,j,i_xyz) * dt
1144  mflx_lb_horizontal(k) = mflx_lb_horizontal(k) - mflx_hi(k,i,j,xdir) * rcdx(i) * vol(k,i,j) &
1145  * mapf(i,j,1,i_xy) * mapf(i,j,2,i_xy) / gsqrt(k,i,j,i_xyz) * dt
1146  end do
1147  end do
1148  end if
1149  if ( bnd_s ) then ! for sourthern boundary
1150  j = js
1151  do i = is, ie
1152  do k = ks, ke
1153  mflx_lb_total = mflx_lb_total + mflx_hi(k,i,j-1,ydir) * rcdy(j) * vol(k,i,j) &
1154  * mapf(i,j,1,i_xy) * mapf(i,j,2,i_xy) / gsqrt(k,i,j,i_xyz) * dt
1155  mflx_lb_horizontal(k) = mflx_lb_horizontal(k) + mflx_hi(k,i,j-1,ydir) * rcdy(j) * vol(k,i,j) &
1156  * mapf(i,j,1,i_xy) * mapf(i,j,2,i_xy) / gsqrt(k,i,j,i_xyz) * dt
1157  end do
1158  end do
1159  end if
1160  if ( bnd_n ) then ! for northern boundary
1161  j = je
1162  do i = is, ie
1163  do k = ks, ke
1164  mflx_lb_total = mflx_lb_total - mflx_hi(k,i,j,ydir) * rcdy(j) * vol(k,i,j) &
1165  * mapf(i,j,1,i_xy) * mapf(i,j,2,i_xy) / gsqrt(k,i,j,i_xyz) * dt
1166  mflx_lb_horizontal(k) = mflx_lb_horizontal(k) - mflx_hi(k,i,j,ydir) * rcdy(j) * vol(k,i,j) &
1167  * mapf(i,j,1,i_xy) * mapf(i,j,2,i_xy) / gsqrt(k,i,j,i_xyz) * dt
1168  end do
1169  end do
1170  end if
1171 
1172  mass_total = 0.0_rp
1173  mass_total2 = 0.0_rp
1174 
1175  ! check total mass in the inner region
1176  do j = js, je
1177  do i = is, ie
1178  do k = ks, ke
1179  mass_total = mass_total + dens(k,i,j) * vol(k,i,j)
1180  mass_total2 = mass_total2 + damp_dens(k,i,j) * vol(k,i,j)
1181  end do
1182  end do
1183  end do
1184 
1185  call mpi_allreduce( mflx_lb_total, &
1186  allmflx_lb_total, &
1187  1, &
1188  comm_datatype, &
1189  mpi_sum, &
1190  comm_world, &
1191  ierr )
1192 
1193  if( io_l ) write(io_fid_log,'(A,1x,I1,1x,ES24.17)') 'total mflx_lb:', step, allmflx_lb_total
1194 
1195  call mpi_allreduce( mass_total, &
1196  allmass_total, &
1197  1, &
1198  comm_datatype, &
1199  mpi_sum, &
1200  comm_world, &
1201  ierr )
1202 
1203  if( io_l ) write(io_fid_log,'(A,1x,I1,1x,ES24.17)') 'total mass :', step, allmass_total
1204 
1205  call mpi_allreduce( mass_total2, &
1206  allmass_total2, &
1207  1, &
1208  comm_datatype, &
1209  mpi_sum, &
1210  comm_world, &
1211  ierr )
1212 
1213  if( io_l ) write(io_fid_log,'(A,1x,I1,1x,ES24.17)') 'total mass2 :', step, allmass_total2
1214 
1215  call mpi_allreduce( mflx_lb_horizontal(ks:ke), &
1216  allmflx_lb_horizontal(ks:ke), &
1217  kmax, &
1218  comm_datatype, &
1219  mpi_sum, &
1220  comm_world, &
1221  ierr )
1222 
1223  call hist_in(allmflx_lb_horizontal(:), 'ALLMOM_lb_hz', &
1224  'horizontally total momentum flux from lateral boundary', 'kg/m2/s' )
1225 
1226  return
integer, public is
start point of inner domain: x, local
integer, public comm_datatype
datatype of variable
Definition: scale_comm.F90:117
integer, public je
end point of inner domain: y, local
integer, parameter, public zdir
integer, parameter, public ydir
integer, public ke
end point of inner domain: z, local
integer, parameter, public xdir
integer, public i_xy
module GRIDTRANS
module GRID (real space)
integer, public comm_world
communication world ID
Definition: scale_comm.F90:118
integer, public kmax
of computational cells: z, local
module COMMUNICATION
Definition: scale_comm.F90:23
integer, public js
start point of inner domain: y, local
real(rp), dimension(:,:,:), allocatable, public real_vol
control volume [m3]
integer, public ks
start point of inner domain: z, local
integer, public ie
end point of inner domain: x, local
module HISTORY
integer, public i_xyz
Here is the caller graph for this function: