35 #include "inc_openmp.h" 77 integer,
private :: i_comm_dens = 1
78 integer,
private :: i_comm_momz = 2
79 integer,
private :: i_comm_momx = 3
80 integer,
private :: i_comm_momy = 4
81 integer,
private :: i_comm_rhot = 5
82 integer,
private,
allocatable :: i_comm_prog(:)
83 integer,
private,
allocatable :: i_comm_qtrc(:)
85 logical,
private :: bnd_w
86 logical,
private :: bnd_e
87 logical,
private :: bnd_s
88 logical,
private :: bnd_n
90 real(RP),
private,
allocatable :: corioli (:,:)
91 real(RP),
private,
allocatable :: mflx_hi (:,:,:,:)
93 real(RP),
private,
allocatable :: num_diff (:,:,:,:,:)
94 real(RP),
private,
allocatable :: num_diff_q(:,:,:,:)
96 logical,
private :: dyn_none = .false.
103 DYN_Tinteg_Short_TYPE, &
104 DYN_Tinteg_Tracer_TYPE, &
105 DYN_Tinteg_Large_TYPE, &
106 DYN_Tstep_Tracer_TYPE, &
107 DYN_Tstep_Large_TYPE, &
109 DYN_FVM_FLUX_TYPE_TRACER, &
110 DENS, MOMZ, MOMX, MOMY, RHOT, &
147 character(len=*),
intent(in) :: DYN_Tinteg_Short_TYPE
148 character(len=*),
intent(in) :: DYN_Tinteg_Tracer_TYPE
149 character(len=*),
intent(in) :: DYN_Tinteg_Large_TYPE
150 character(len=*),
intent(in) :: DYN_Tstep_Tracer_TYPE
151 character(len=*),
intent(in) :: DYN_Tstep_Large_TYPE
152 character(len=*),
intent(in) :: DYN_FVM_FLUX_TYPE
153 character(len=*),
intent(in) :: DYN_FVM_FLUX_TYPE_TRACER
154 real(RP),
intent(inout) :: DENS(
ka,
ia,
ja)
155 real(RP),
intent(inout) :: MOMZ(
ka,
ia,
ja)
156 real(RP),
intent(inout) :: MOMX(
ka,
ia,
ja)
157 real(RP),
intent(inout) :: MOMY(
ka,
ia,
ja)
158 real(RP),
intent(inout) :: RHOT(
ka,
ia,
ja)
159 real(RP),
intent(inout) :: QTRC(
ka,
ia,
ja,
qa)
160 real(RP),
intent(inout) :: PROG(
ka,
ia,
ja,
va)
161 real(RP),
intent(in) :: CDZ(
ka)
162 real(RP),
intent(in) :: CDX(
ia)
163 real(RP),
intent(in) :: CDY(
ja)
164 real(RP),
intent(in) :: FDZ(
ka-1)
165 real(RP),
intent(in) :: FDX(
ia-1)
166 real(RP),
intent(in) :: FDY(
ja-1)
167 logical,
intent(in) :: enable_coriolis
168 real(RP),
intent(in) :: lat(
ia,
ja)
169 logical,
optional,
intent(in) :: none
174 if (
present(none) )
then 178 allocate( i_comm_prog(max(
va,1)) )
179 allocate( i_comm_qtrc(
qa) )
181 if ( .NOT. dyn_none )
then 187 allocate( corioli(
ia,
ja) )
188 allocate( mflx_hi(
ka,
ia,
ja,3) )
189 allocate( num_diff(
ka,
ia,
ja,5,3) )
190 allocate( num_diff_q(
ka,
ia,
ja,3) )
191 mflx_hi(:,:,:,:) = undef
194 dyn_fvm_flux_type_tracer )
201 dens, momz, momx, momy, rhot, &
213 cdz, cdx, cdy, fdz, fdx, fdy )
216 if ( enable_coriolis )
then 217 corioli(:,:) = 2.0_rp * ohm * sin( lat(:,:) )
219 corioli(:,:) = 0.0_rp
231 i_comm_prog(iv) = 5 + iv
236 i_comm_qtrc(iq) = 5 +
va + iq
248 DENS, MOMZ, MOMX, MOMY, RHOT, QTRC, &
250 DENS_av, MOMZ_av, MOMX_av, MOMY_av, RHOT_av, QTRC_av, &
251 DENS_tp, MOMZ_tp, MOMX_tp, MOMY_tp, RHOT_tp, RHOQ_tp, &
252 CDZ, CDX, CDY, FDZ, FDX, FDY, &
253 RCDZ, RCDX, RCDY, RFDZ, RFDX, RFDY, &
255 J13G, J23G, J33G, MAPF, &
257 REF_dens, REF_pott, REF_qv, REF_pres, &
258 ND_COEF, ND_COEF_Q, ND_ORDER, ND_SFC_FACT, ND_USE_RS, &
259 DAMP_DENS, DAMP_VELZ, DAMP_VELX, &
260 DAMP_VELY, DAMP_POTT, DAMP_QTRC, &
261 DAMP_alpha_DENS, DAMP_alpha_VELZ, DAMP_alpha_VELX, &
262 DAMP_alpha_VELY, DAMP_alpha_POTT, DAMP_alpha_QTRC, &
264 FLAG_FCT_MOMENTUM, FLAG_FCT_T, FLAG_FCT_TRACER, &
265 FLAG_FCT_ALONG_STREAM, &
277 real(RP),
intent(inout) :: DENS(
ka,
ia,
ja)
278 real(RP),
intent(inout) :: MOMZ(
ka,
ia,
ja)
279 real(RP),
intent(inout) :: MOMX(
ka,
ia,
ja)
280 real(RP),
intent(inout) :: MOMY(
ka,
ia,
ja)
281 real(RP),
intent(inout) :: RHOT(
ka,
ia,
ja)
282 real(RP),
intent(inout) :: QTRC(
ka,
ia,
ja,
qa)
283 real(RP),
intent(inout) :: PROG(
ka,
ia,
ja,
va)
285 real(RP),
intent(inout) :: DENS_av(
ka,
ia,
ja)
286 real(RP),
intent(inout) :: MOMZ_av(
ka,
ia,
ja)
287 real(RP),
intent(inout) :: MOMX_av(
ka,
ia,
ja)
288 real(RP),
intent(inout) :: MOMY_av(
ka,
ia,
ja)
289 real(RP),
intent(inout) :: RHOT_av(
ka,
ia,
ja)
290 real(RP),
intent(inout) :: QTRC_av(
ka,
ia,
ja,
qa)
292 real(RP),
intent(in) :: DENS_tp(
ka,
ia,
ja)
293 real(RP),
intent(in) :: MOMZ_tp(
ka,
ia,
ja)
294 real(RP),
intent(in) :: MOMX_tp(
ka,
ia,
ja)
295 real(RP),
intent(in) :: MOMY_tp(
ka,
ia,
ja)
296 real(RP),
intent(in) :: RHOT_tp(
ka,
ia,
ja)
297 real(RP),
intent(in) :: RHOQ_tp(
ka,
ia,
ja,
qa)
299 real(RP),
intent(in) :: CDZ (
ka)
300 real(RP),
intent(in) :: CDX (
ia)
301 real(RP),
intent(in) :: CDY (
ja)
302 real(RP),
intent(in) :: FDZ (
ka-1)
303 real(RP),
intent(in) :: FDX (
ia-1)
304 real(RP),
intent(in) :: FDY (
ja-1)
305 real(RP),
intent(in) :: RCDZ(
ka)
306 real(RP),
intent(in) :: RCDX(
ia)
307 real(RP),
intent(in) :: RCDY(
ja)
308 real(RP),
intent(in) :: RFDZ(
ka-1)
309 real(RP),
intent(in) :: RFDX(
ia-1)
310 real(RP),
intent(in) :: RFDY(
ja-1)
312 real(RP),
intent(in) :: PHI (
ka,
ia,
ja)
313 real(RP),
intent(in) :: GSQRT(
ka,
ia,
ja,7)
314 real(RP),
intent(in) :: J13G (
ka,
ia,
ja,7)
315 real(RP),
intent(in) :: J23G (
ka,
ia,
ja,7)
316 real(RP),
intent(in) :: J33G
317 real(RP),
intent(in) :: MAPF (
ia,
ja,2,4)
319 real(RP),
intent(in) :: AQ_CV(
qqa)
321 real(RP),
intent(in) :: REF_dens(
ka,
ia,
ja)
322 real(RP),
intent(in) :: REF_pott(
ka,
ia,
ja)
323 real(RP),
intent(in) :: REF_qv (
ka,
ia,
ja)
324 real(RP),
intent(in) :: REF_pres(
ka,
ia,
ja)
325 real(RP),
intent(in) :: ND_COEF
326 real(RP),
intent(in) :: ND_COEF_Q
327 integer,
intent(in) :: ND_ORDER
328 real(RP),
intent(in) :: ND_SFC_FACT
329 logical,
intent(in) :: ND_USE_RS
331 real(RP),
intent(in) :: DAMP_DENS(
ka,
ia,
ja)
332 real(RP),
intent(in) :: DAMP_VELZ(
ka,
ia,
ja)
333 real(RP),
intent(in) :: DAMP_VELX(
ka,
ia,
ja)
334 real(RP),
intent(in) :: DAMP_VELY(
ka,
ia,
ja)
335 real(RP),
intent(in) :: DAMP_POTT(
ka,
ia,
ja)
338 real(RP),
intent(in) :: DAMP_alpha_DENS(
ka,
ia,
ja)
339 real(RP),
intent(in) :: DAMP_alpha_VELZ(
ka,
ia,
ja)
340 real(RP),
intent(in) :: DAMP_alpha_VELX(
ka,
ia,
ja)
341 real(RP),
intent(in) :: DAMP_alpha_VELY(
ka,
ia,
ja)
342 real(RP),
intent(in) :: DAMP_alpha_POTT(
ka,
ia,
ja)
343 real(RP),
intent(in) :: DAMP_alpha_QTRC(
ka,
ia,
ja,
bnd_qa)
345 real(RP),
intent(in) :: divdmp_coef
347 logical,
intent(in) :: FLAG_FCT_MOMENTUM
348 logical,
intent(in) :: FLAG_FCT_T
349 logical,
intent(in) :: FLAG_FCT_TRACER
350 logical,
intent(in) :: FLAG_FCT_ALONG_STREAM
352 logical,
intent(in) :: USE_AVERAGE
354 real(DP),
intent(in) :: DTSEC
355 real(DP),
intent(in) :: DTSEC_DYN
358 real(RP) :: DENS00 (
ka,
ia,
ja)
361 real(RP) :: tflx_hi(
ka,
ia,
ja,3)
364 integer :: i, j, k, iq
369 dt =
real(dtsec, kind=
rp)
378 dens00(k,i,j) = dens(k,i,j)
380 dens(k,i,j) = dens(k,i,j) + dens_tp(k,i,j) * dt
388 momz(k,i,j) = momz(k,i,j) + momz_tp(k,i,j) * dt
396 momx(k,i,j) = momx(k,i,j) + momx_tp(k,i,j) * dt
404 momy(k,i,j) = momy(k,i,j) + momy_tp(k,i,j) * dt
412 rhot(k,i,j) = rhot(k,i,j) + rhot_tp(k,i,j) * dt
421 qtrc(k,i,j,iq) = max( 0.0_rp, &
422 qtrc(k,i,j,iq) * dens00(k,i,j) + rhoq_tp(k,i,j,iq) * dt &
429 call comm_vars8( dens(:,:,:), i_comm_dens )
430 call comm_vars8( momz(:,:,:), i_comm_momz )
431 call comm_vars8( momx(:,:,:), i_comm_momx )
432 call comm_vars8( momy(:,:,:), i_comm_momy )
433 call comm_vars8( rhot(:,:,:), i_comm_rhot )
435 call comm_vars8( qtrc(:,:,:,iq), i_comm_qtrc(iq) )
438 call comm_wait ( dens(:,:,:), i_comm_dens, .false. )
439 call comm_wait ( momz(:,:,:), i_comm_momz, .false. )
440 call comm_wait ( momx(:,:,:), i_comm_momx, .false. )
441 call comm_wait ( momy(:,:,:), i_comm_momy, .false. )
442 call comm_wait ( rhot(:,:,:), i_comm_rhot, .false. )
444 call comm_wait ( qtrc(:,:,:,iq), i_comm_qtrc(iq), .false. )
447 if ( use_average )
then 448 dens_av(:,:,:) = dens(:,:,:)
449 momz_av(:,:,:) = momz(:,:,:)
450 momx_av(:,:,:) = momx(:,:,:)
451 momy_av(:,:,:) = momy(:,:,:)
452 rhot_av(:,:,:) = rhot(:,:,:)
453 qtrc_av(:,:,:,:) = qtrc(:,:,:,:)
465 dens_av, momz_av, momx_av, momy_av, rhot_av, qtrc_av, &
467 num_diff, num_diff_q, &
468 dens_tp, momz_tp, momx_tp, momy_tp, rhot_tp, rhoq_tp, &
470 cdz, cdx, cdy, fdz, fdx, fdy, &
471 rcdz, rcdx, rcdy, rfdz, rfdx, rfdy, &
473 j13g, j23g, j33g, mapf, &
475 ref_dens, ref_pott, ref_qv, ref_pres, &
476 bnd_w, bnd_e, bnd_s, bnd_n, &
477 nd_coef, nd_coef_q, nd_order, nd_sfc_fact, nd_use_rs, &
478 damp_dens, damp_velz, damp_velx, &
479 damp_vely, damp_pott, damp_qtrc, &
480 damp_alpha_dens, damp_alpha_velz, damp_alpha_velx, &
481 damp_alpha_vely, damp_alpha_pott, damp_alpha_qtrc, &
483 flag_fct_momentum, flag_fct_t, flag_fct_tracer, &
484 flag_fct_along_stream, &
491 call check_mass( dens, damp_dens, &
496 bnd_w, bnd_e, bnd_s, bnd_n )
504 subroutine check_mass( &
510 BND_W, BND_E, BND_S, BND_N )
524 real(RP),
intent(in) :: dens (
ka,
ia,
ja)
525 real(RP),
intent(in) :: DAMP_DENS(
ka,
ia,
ja)
526 real(RP),
intent(in) :: mflx_hi (
ka,
ia,
ja,3)
527 real(RP),
intent(in) :: tflx_hi (
ka,
ia,
ja,3)
528 real(RP),
intent(in) :: GSQRT (
ka,
ia,
ja,7)
529 real(RP),
intent(in) :: MAPF (
ia,
ja,2,7)
530 real(RP),
intent(in) :: RCDX(
ia)
531 real(RP),
intent(in) :: RCDY(
ja)
532 real(RP),
intent(in) :: dt
533 logical,
intent(in) :: BND_W
534 logical,
intent(in) :: BND_E
535 logical,
intent(in) :: BND_S
536 logical,
intent(in) :: BND_N
539 real(RP) :: mflx_lb_horizontal(
ka)
540 real(RP) :: allmflx_lb_horizontal(
ka)
541 real(RP) :: mflx_lb_total
542 real(RP) :: mass_total
543 real(RP) :: mass_total2
544 real(RP) :: allmflx_lb_total
545 real(RP) :: allmass_total
546 real(RP) :: allmass_total2
552 call hist_in(mflx_hi(:,:,:,
zdir),
'MFLXZ',
'momentum flux of z-direction',
'kg/m2/s', zdim=
'half' )
553 call hist_in(mflx_hi(:,:,:,
xdir),
'MFLXX',
'momentum flux of x-direction',
'kg/m2/s', xdim=
'half' )
554 call hist_in(mflx_hi(:,:,:,
ydir),
'MFLXY',
'momentum flux of y-direction',
'kg/m2/s', ydim=
'half' )
556 call hist_in(tflx_hi(:,:,:,
zdir),
'TFLXZ',
'potential temperature flux of z-direction',
'K*kg/m2/s', zdim=
'half' )
557 call hist_in(tflx_hi(:,:,:,
xdir),
'TFLXX',
'potential temperature flux of x-direction',
'K*kg/m2/s', xdim=
'half' )
558 call hist_in(tflx_hi(:,:,:,
ydir),
'TFLXY',
'potential temperature flux of y-direction',
'K*kg/m2/s', ydim=
'half' )
560 mflx_lb_total = 0.0_rp
561 mflx_lb_horizontal(:) = 0.0_rp
562 allmflx_lb_horizontal(:) = 0.0_rp
568 mflx_lb_total = mflx_lb_total + mflx_hi(k,i-1,j,
xdir) * rcdx(i) * vol(k,i,j) &
569 * mapf(i,j,1,
i_xy) * mapf(i,j,2,
i_xy) / gsqrt(k,i,j,
i_xyz) * dt
570 mflx_lb_horizontal(k) = mflx_lb_horizontal(k) + mflx_hi(k,i-1,j,
xdir) * rcdx(i) * vol(k,i,j) &
571 * mapf(i,j,1,
i_xy) * mapf(i,j,2,
i_xy) / gsqrt(k,i,j,
i_xyz) * dt
580 mflx_lb_total = mflx_lb_total - mflx_hi(k,i,j,
xdir) * rcdx(i) * vol(k,i,j) &
581 * mapf(i,j,1,
i_xy) * mapf(i,j,2,
i_xy) / gsqrt(k,i,j,
i_xyz) * dt
582 mflx_lb_horizontal(k) = mflx_lb_horizontal(k) - mflx_hi(k,i,j,
xdir) * rcdx(i) * vol(k,i,j) &
583 * mapf(i,j,1,
i_xy) * mapf(i,j,2,
i_xy) / gsqrt(k,i,j,
i_xyz) * dt
591 mflx_lb_total = mflx_lb_total + mflx_hi(k,i,j-1,
ydir) * rcdy(j) * vol(k,i,j) &
592 * mapf(i,j,1,
i_xy) * mapf(i,j,2,
i_xy) / gsqrt(k,i,j,
i_xyz) * dt
593 mflx_lb_horizontal(k) = mflx_lb_horizontal(k) + mflx_hi(k,i,j-1,
ydir) * rcdy(j) * vol(k,i,j) &
594 * mapf(i,j,1,
i_xy) * mapf(i,j,2,
i_xy) / gsqrt(k,i,j,
i_xyz) * dt
602 mflx_lb_total = mflx_lb_total - mflx_hi(k,i,j,
ydir) * rcdy(j) * vol(k,i,j) &
603 * mapf(i,j,1,
i_xy) * mapf(i,j,2,
i_xy) / gsqrt(k,i,j,
i_xyz) * dt
604 mflx_lb_horizontal(k) = mflx_lb_horizontal(k) - mflx_hi(k,i,j,
ydir) * rcdy(j) * vol(k,i,j) &
605 * mapf(i,j,1,
i_xy) * mapf(i,j,2,
i_xy) / gsqrt(k,i,j,
i_xyz) * dt
617 mass_total = mass_total + dens(k,i,j) * vol(k,i,j)
618 mass_total2 = mass_total2 + damp_dens(k,i,j) * vol(k,i,j)
623 call mpi_allreduce( mflx_lb_total, &
631 if(
io_l )
write(
io_fid_log,
'(A,1x,ES24.17)')
'total mflx_lb:', allmflx_lb_total
633 call mpi_allreduce( mass_total, &
641 if(
io_l )
write(
io_fid_log,
'(A,1x,ES24.17)')
'total mass :', allmass_total
643 call mpi_allreduce( mass_total2, &
651 if(
io_l )
write(
io_fid_log,
'(A,1x,ES24.17)')
'total mass2 :', allmass_total2
653 call mpi_allreduce( mflx_lb_horizontal(
ks:
ke), &
654 allmflx_lb_horizontal(
ks:
ke), &
661 call hist_in(allmflx_lb_horizontal(:),
'ALLMOM_lb_hz', &
662 'horizontally total momentum flux from lateral boundary',
'kg/m2/s' )
665 end subroutine check_mass
integer, public is
start point of inner domain: x, local
integer, public comm_datatype
datatype of variable
integer, public je
end point of inner domain: y, local
subroutine, public atmos_dyn_setup(DYN_Tinteg_Short_TYPE, DYN_Tinteg_Tracer_TYPE, DYN_Tinteg_Large_TYPE, DYN_Tstep_Tracer_TYPE, DYN_Tstep_Large_TYPE, DYN_FVM_FLUX_TYPE, DYN_FVM_FLUX_TYPE_TRACER, DENS, MOMZ, MOMX, MOMY, RHOT, QTRC, PROG, CDZ, CDX, CDY, FDZ, FDX, FDY, enable_coriolis, lat, none)
Setup.
logical, public prc_has_n
subroutine, public prc_mpistop
Abort MPI.
subroutine, public atmos_dyn(DENS, MOMZ, MOMX, MOMY, RHOT, QTRC, PROG, DENS_av, MOMZ_av, MOMX_av, MOMY_av, RHOT_av, QTRC_av, DENS_tp, MOMZ_tp, MOMX_tp, MOMY_tp, RHOT_tp, RHOQ_tp, 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, 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, DTSEC, DTSEC_DYN)
Dynamical Process.
subroutine, public atmos_dyn_tinteg_large_setup(ATMOS_DYN_Tinteg_large_TYPE)
Register.
module Atmosphere / Dynamical scheme
module Atmosphere / Dynamics Temporal integration
module Atmosphere / Dynamics Temporal integration
logical, public io_l
output log or not? (this process)
subroutine, public atmos_dyn_tstep_tracer_setup(ATMOS_DYN_TSTEP_TRACER_TYPE)
Register.
integer, parameter, public zdir
module Atmosphere / Dynamics FENT + FCT
logical, public prc_has_e
integer, parameter, public ydir
integer, public ke
end point of inner domain: z, local
integer, parameter, public xdir
module Atmosphere / Dynamical scheme
subroutine, public check(current_line, v)
Undefined value checker.
module Atmosphere / Dynamics Temporal integration
logical, public prc_has_s
real(rp), public const_undef
procedure(large), pointer, public atmos_dyn_tinteg_large
real(rp), public const_ohm
angular velocity of the planet [1/s]
integer, public ia
of x whole cells (local, with HALO)
subroutine, public comm_vars8_init(var, vid)
Register variables.
integer, public ka
of z whole cells (local, with HALO)
integer, public comm_world
communication world ID
subroutine, public atmos_dyn_filter_setup(num_diff, num_diff_q, CDZ, CDX, CDY, FDZ, FDX, FDY)
Setup.
integer, public kmax
of computational cells: z
integer, public js
start point of inner domain: y, local
integer, parameter, public const_undef2
undefined value (INT2)
module Atmosphere / Dynamics common
real(rp), dimension(:,:,:), allocatable, public real_vol
control volume [m3]
integer, public ks
start point of inner domain: z, local
subroutine, public prof_rapstart(rapname_base, level)
Start raptime.
integer, public ie
end point of inner domain: x, local
subroutine, public atmos_dyn_tstep_large_setup(Tstep_large_type, DENS, MOMZ, MOMX, MOMY, RHOT, QTRC, PROG, mflx_hi)
Register.
subroutine, public atmos_dyn_fvm_flux_setup(scheme, scheme_tracer)
setup
module scale_atmos_dyn_fvm_flux
module ATMOSPHERE / Boundary treatment
subroutine, public atmos_dyn_tinteg_short_setup(ATMOS_DYN_Tinteg_short_TYPE)
Register.
integer, public io_fid_log
Log file ID.
subroutine, public prof_rapend(rapname_base, level)
Save raptime.
logical, public prc_has_w
integer, parameter, public rp
procedure(short_setup), pointer, public atmos_dyn_tstep_short_setup
subroutine, public atmos_dyn_tinteg_tracer_setup(ATMOS_DYN_Tinteg_tracer_TYPE)
Register.
module Atmosphere / Dynamical scheme
integer, public ja
of y whole cells (local, with HALO)