14 #include "inc_openmp.h" 57 real(RP),
private,
allocatable :: DENS_t(:,:,:)
58 real(RP),
private,
allocatable :: MOMZ_t(:,:,:)
59 real(RP),
private,
allocatable :: MOMX_t(:,:,:)
60 real(RP),
private,
allocatable :: MOMY_t(:,:,:)
61 real(RP),
private,
allocatable :: RHOT_t(:,:,:)
62 real(RP),
private,
allocatable :: RHOQ_t(:,:,:,:)
64 real(RP),
private,
allocatable :: mflx_hi(:,:,:,:)
67 integer :: I_COMM_DENS = 1
68 integer :: I_COMM_MOMZ = 2
69 integer :: I_COMM_MOMX = 3
70 integer :: I_COMM_MOMY = 4
71 integer :: I_COMM_RHOT = 5
72 integer,
allocatable :: I_COMM_PROG(:)
74 integer :: I_COMM_DENS_t = 1
75 integer :: I_COMM_MOMZ_t = 2
76 integer :: I_COMM_MOMX_t = 3
77 integer :: I_COMM_MOMY_t = 4
78 integer :: I_COMM_RHOT_t = 5
80 integer,
allocatable :: I_COMM_RHOQ_t(:)
81 integer,
allocatable :: I_COMM_QTRC(:)
83 integer :: I_COMM_mflx_z = 1
84 integer :: I_COMM_mflx_x = 2
85 integer :: I_COMM_mflx_y = 3
93 DENS, MOMZ, MOMX, MOMY, RHOT, QTRC, PROG, &
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)
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) )
129 allocate( i_comm_prog(max(
va,1)) )
130 allocate( i_comm_qtrc(
qa) )
131 allocate( i_comm_rhoq_t(
qa) )
139 i_comm_prog(iv) = 5 + iv
150 i_comm_rhoq_t(iq) = 5 +
va + iq
151 i_comm_qtrc(iq) = 5 +
va + iq
161 mflx_hi(:,:,:,:) = undef
169 DENS, MOMZ, MOMX, MOMY, RHOT, QTRC, PROG, &
170 DENS_av, MOMZ_av, MOMX_av, MOMY_av, RHOT_av, QTRC_av, &
172 num_diff, num_diff_q, &
174 DENS_tp, MOMZ_tp, MOMX_tp, MOMY_tp, RHOT_tp, RHOQ_tp, &
176 CDZ, CDX, CDY, FDZ, FDX, FDY, &
177 RCDZ, RCDX, RCDY, RFDZ, RFDX, RFDY, &
179 J13G, J23G, J33G, MAPF, &
180 AQ_R, AQ_CV, AQ_CP, AQ_MASS, &
181 REF_dens, REF_pott, REF_qv, REF_pres, &
182 BND_W, BND_E, BND_S, BND_N, &
183 ND_COEF, ND_COEF_Q, ND_ORDER, ND_SFC_FACT, ND_USE_RS, &
184 DAMP_DENS, DAMP_VELZ, DAMP_VELX, &
185 DAMP_VELY, DAMP_POTT, DAMP_QTRC, &
186 DAMP_alpha_DENS, DAMP_alpha_VELZ, DAMP_alpha_VELX, &
187 DAMP_alpha_VELY, DAMP_alpha_POTT, DAMP_alpha_QTRC, &
190 FLAG_FCT_MOMENTUM, FLAG_FCT_T, FLAG_FCT_TRACER, &
191 FLAG_FCT_ALONG_STREAM, &
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)
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)
253 real(RP),
intent(out) :: mflx_hi(
ka,
ia,
ja,3)
254 real(RP),
intent(out) :: tflx_hi(
ka,
ia,
ja,3)
256 real(RP),
intent(out) :: num_diff(
ka,
ia,
ja,5,3)
257 real(RP),
intent(out) :: num_diff_q(
ka,
ia,
ja,3)
259 real(RP),
intent(in) :: qtrc0(
ka,
ia,
ja,
qa)
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)
268 real(RP),
intent(in) :: corioli(
ia,
ja)
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)
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)
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)
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)
300 logical,
intent(in) :: bnd_w
301 logical,
intent(in) :: bnd_e
302 logical,
intent(in) :: bnd_s
303 logical,
intent(in) :: bnd_n
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
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)
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)
325 real(RP),
intent(in) :: wdamp_coef(
ka)
326 real(RP),
intent(in) :: divdmp_coef
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
333 logical,
intent(in) :: use_average
335 real(DP),
intent(in) :: dtls
336 real(DP),
intent(in) :: dtss
337 logical ,
intent(in) :: llast
340 real(RP) :: dens00 (
ka,
ia,
ja)
343 real(RP) :: ddiv (
ka,
ia,
ja)
344 real(RP) :: dpres0 (
ka,
ia,
ja)
345 real(RP) :: rt2p (
ka,
ia,
ja)
346 real(RP) :: ref_rhot(
ka,
ia,
ja)
357 real(RP) :: dens_tq(
ka,
ia,
ja)
358 real(RP) :: diff(
ka,
ia,
ja)
361 real(RP) :: damp_t(
ka,
ia,
ja)
365 real(RP) :: mflx_av (
ka,
ia,
ja,3)
366 real(RP) :: qflx_hi (
ka,
ia,
ja,3)
367 real(RP) :: qflx_lo (
ka,
ia,
ja,3)
368 real(RP) :: qflx_anti(
ka,
ia,
ja,3)
376 integer :: i, j, k, iq, step
379 real(RP) :: diff_coef
384 dts =
real(DTSS, kind=RP) 385 dtl =
real(DTLS, kind=RP) 386 nstep = ceiling( ( dtl - eps ) / dts )
392 '*** -> DT_large, DT_small, DT_large/DT_small : ', dtl,
', ', dts,
', ', nstep
394 dens00(:,:,:) = undef
396 num_diff(:,:,:,:,:) = undef
398 mflx_hi(:,:,:,:) = undef
399 tflx_hi(:,:,:,:) = undef
401 qflx_hi(:,:,:,:) = undef
402 qflx_lo(:,:,:,:) = undef
406 dens00(:,:,:) = dens(:,:,:)
408 if ( use_average )
then 410 dens_av(:,:,:) = 0.0_rp
412 momz_av(:,:,:) = 0.0_rp
414 momx_av(:,:,:) = 0.0_rp
416 momy_av(:,:,:) = 0.0_rp
418 rhot_av(:,:,:) = 0.0_rp
423 mflx_av(:,:,:,:) = 0.0_rp
428 cpovcv = cpdry / cvdry
455 pres = p0 * ( rdry * rhot(k,i,j) / p0 )**cpovcv
456 rt2p(k,i,j) = cpovcv * pres / rhot(k,i,j)
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)
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)
474 dpres0(k,i,j) = pres - ref_pres(k,i,j)
475 ref_rhot(k,i,j) = rhot(k,i,j)
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) )
492 damp_t(:,:,:) = 0.0_rp
496 dens_tq(:,:,:) = 0.0_rp
505 diff(k,i,j) = qtrc(k,i,j,iq) - damp_qtrc(k,i,j,iq)
520 damp = - damp_alpha_qtrc(k,i,j,iq) &
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 )
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)
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' )
542 rhoq_t( 1:
ks-1,i,j,iq) = 0.0_rp
543 rhoq_t(
ke+1:
ka ,i,j,iq) = 0.0_rp
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. )
558 rhoq_t(k,i,j,iq) = rhoq_tp(k,i,j,iq)
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)
580 mflx_hi(k,
ie,j,
xdir) = gsqrt(k,
ie,j,
i_uyz) * momx(k,
ie,j) / mapf(
ie,j,2,
i_uy)
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)
596 mflx_hi(k,i,
je,
ydir) = gsqrt(k,i,
je,
i_xvz) * momy(k,i,
je) / mapf(i,
je,1,
i_xv)
606 call hist_switch( llast .AND. step == nstep )
617 diff(k,i,j) = dens(k,i,j) - damp_dens(k,i,j)
632 damp = - damp_alpha_dens(k,i,j) &
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 ) &
637 dens_t(k,i,j) = dens_tp(k,i,j) &
648 dens_t( 1:
ks-1,i,j) = 0.0_rp
649 dens_t(
ke+1:
ka ,i,j) = 0.0_rp
652 call comm_vars8( dens_t(:,:,:), i_comm_dens_t )
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' )
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
678 damp = - damp_alpha_velz(k,i,j) &
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 )
683 momz_t(k,i,j) = momz_tp(k,i,j) &
694 momz_t( 1:
ks-1,i,j) = 0.0_rp
695 momz_t(
ke:
ka ,i,j) = 0.0_rp
698 call comm_vars8( momz_t(:,:,:), i_comm_momz_t )
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' )
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
724 damp = - damp_alpha_velx(k,i,j) &
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 )
728 momx_t(k,i,j) = momx_tp(k,i,j) &
739 momx_t( 1:
ks-1,i,j) = 0.0_rp
740 momx_t(
ke+1:
ka ,i,j) = 0.0_rp
743 call comm_vars8( momx_t(:,:,:), i_comm_momx_t )
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' )
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
769 damp = - damp_alpha_vely(k,i,j) &
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 )
773 momy_t(k,i,j) = momy_tp(k,i,j) &
784 momy_t( 1:
ks-1,i,j) = 0.0_rp
785 momy_t(
ke+1:
ka ,i,j) = 0.0_rp
788 call comm_vars8( momy_t(:,:,:), i_comm_momy_t )
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' )
799 diff(k,i,j) = rhot(k,i,j) - damp_pott(k,i,j) * dens(k,i,j)
814 damp = - damp_alpha_pott(k,i,j) &
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 )
818 rhot_t(k,i,j) = rhot_tp(k,i,j) &
829 rhot_t( 1:
ks-1,i,j) = 0.0_rp
830 rhot_t(
ke+1:
ka ,i,j) = 0.0_rp
833 call comm_vars8( rhot_t(:,:,:), i_comm_rhot_t )
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' )
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. )
851 if ( nd_coef == 0.0_rp )
then 853 num_diff(:,:,:,:,:) = 0.0_rp
856 dens, momz, momx, momy, rhot, &
857 cdz, cdx, cdy, fdz, fdx, fdy, dts, &
858 ref_dens, ref_pott, &
859 nd_coef, nd_order, nd_sfc_fact, nd_use_rs )
864 if ( divdmp_coef > 0.0_rp )
then 868 gsqrt, j13g, j23g, j33g, mapf, &
869 rcdz, rcdx, rcdy, rfdz, fdz )
886 dens_t, momz_t, momx_t, momy_t, rhot_t, &
887 dpres0, rt2p, corioli, &
888 num_diff, wdamp_coef, divdmp_coef, ddiv, &
889 flag_fct_momentum, flag_fct_t, &
890 flag_fct_along_stream, &
891 cdz, fdz, fdx, fdy, &
892 rcdz, rcdx, rcdy, rfdz, rfdx, rfdy, &
893 phi, gsqrt, j13g, j23g, j33g, mapf, &
894 ref_dens, ref_rhot, &
895 bnd_w, bnd_e, bnd_s, bnd_n, &
907 bnd_w, bnd_e, bnd_s, bnd_n )
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)
920 prog( 1:
ks-1,i,j,iv) = prog(
ks,i,j,iv)
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)
928 prog(
ke+1:
ka, i,j,iv) = prog(
ke,i,j,iv)
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 )
939 call comm_vars8( prog(:,:,:,iv), i_comm_prog(iv) )
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. )
947 call comm_wait ( prog(:,:,:,iv), i_comm_prog(iv), .false. )
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(:,:,:)
959 mflx_av(:,:,:,:) = mflx_av(:,:,:,:) + mflx_hi(:,:,:,:)
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
978 mflx_hi(:,:,:,:) = mflx_av(:,:,:,:) / nstep
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. )
987 if ( use_average )
then 989 qtrc_av(:,:,:,:) = 0.0_rp
1006 if ( nd_coef_q == 0.0_rp )
then 1008 num_diff_q(:,:,:,:) = 0.0_rp
1011 dens00, qtrc(:,:,:,iq), &
1012 cdz, cdx, cdy, dtl, &
1014 nd_coef_q, nd_order, nd_sfc_fact, nd_use_rs )
1023 qtrc0(:,:,:,iq), rhoq_t(:,:,:,iq), &
1025 mflx_hi, num_diff_q, &
1026 gsqrt, mapf(:,:,:,
i_xy), &
1027 cdz, rcdz, rcdx, rcdy, &
1028 bnd_w, bnd_e, bnd_s, bnd_n, &
1030 llast .AND. flag_fct_tracer, &
1031 flag_fct_along_stream )
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)
1048 if ( use_average )
then 1049 qtrc_av(:,:,:,iq) = qtrc(:,:,:,iq)
1052 call comm_vars8( qtrc(:,:,:,iq), i_comm_qtrc(iq) )
1057 call comm_wait ( qtrc(:,:,:,iq), i_comm_qtrc(iq), .false. )
1071 BND_W, BND_E, BND_S, BND_N &
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
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
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' )
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' )
1122 mflx_lb_total = 0.0_rp
1123 mflx_lb_horizontal(:) = 0.0_rp
1124 allmflx_lb_horizontal(:) = 0.0_rp
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
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
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
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
1173 mass_total2 = 0.0_rp
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)
1185 call mpi_allreduce( mflx_lb_total, &
1193 if(
io_l )
write(
io_fid_log,
'(A,1x,I1,1x,ES24.17)')
'total mflx_lb:', step, allmflx_lb_total
1195 call mpi_allreduce( mass_total, &
1203 if(
io_l )
write(
io_fid_log,
'(A,1x,I1,1x,ES24.17)')
'total mass :', step, allmass_total
1205 call mpi_allreduce( mass_total2, &
1213 if(
io_l )
write(
io_fid_log,
'(A,1x,I1,1x,ES24.17)')
'total mass2 :', step, allmass_total2
1215 call mpi_allreduce( mflx_lb_horizontal(
ks:
ke), &
1216 allmflx_lb_horizontal(
ks:
ke), &
1223 call hist_in(allmflx_lb_horizontal(:),
'ALLMOM_lb_hz', &
1224 'horizontally total momentum flux from lateral boundary',
'kg/m2/s' )
integer, public is
start point of inner domain: x, local
integer, public comm_datatype
datatype of variable
real(rp), public const_cvdry
specific heat (dry air,constant volume) [J/kg/K]
subroutine, public atmos_dyn_tstep_large_fvm_heve_setup(DENS, MOMZ, MOMX, MOMY, RHOT, QTRC, PROG, mflx_hi)
Setup.
integer, public je
end point of inner domain: y, local
real(rp), public const_cpdry
specific heat (dry air,constant pressure) [J/kg/K]
logical, public prc_has_n
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 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.
subroutine, public atmos_dyn_fvm_fluxz_xyz_ud1(flux, mflx, val, GSQRT, num_diff, CDZ, IIS, IIE, JJS, JJE)
calculation z-flux at XYZ
subroutine, public comm_vars8_init(varname, var, vid)
Register variables.
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.
logical, public io_l
output log or not? (this process)
integer, parameter, public zdir
procedure(flux_phi), pointer, public atmos_dyn_fvm_fluxx_xyz
logical, public prc_has_e
integer, parameter, public ydir
integer, public ke
end point of inner domain: z, local
subroutine check_mass(DENS, DAMP_DENS, mflx_hi, tflx_hi, GSQRT, MAPF, RCDX, RCDY, dt, step, BND_W, BND_E, BND_S, BND_N)
integer, parameter, public xdir
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.
logical, dimension(qa_max), public tracer_advc
subroutine, public check(current_line, v)
Undefined value checker.
module Atmosphere / Dynamics Temporal integration
character(len=h_short), dimension(qa_max), public tracer_name
logical, public prc_has_s
real(rp), public const_rdry
specific gas constant (dry air) [J/kg/K]
real(rp), public const_undef
real(rp), public const_ohm
angular velocity of the planet [1/s]
integer, public ia
of whole cells: x, local, with HALO
integer, public ka
of whole cells: z, local, with HALO
real(rp), public const_pre00
pressure reference [Pa]
integer, public comm_world
communication world ID
integer, public kmax
of computational cells: z, local
integer, public js
start point of inner domain: y, local
procedure(tinteg), pointer, public atmos_dyn_tinteg_tracer
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
real(rp), public const_eps
small number
module scale_atmos_dyn_fvm_flux
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
procedure(short), pointer, public atmos_dyn_tinteg_short
integer, public io_fid_log
Log file ID.
subroutine, public prof_rapend(rapname_base, level)
Save raptime.
logical, public prc_has_w
procedure(flux_phi), pointer, public atmos_dyn_fvm_fluxz_xyz
real(rp), dimension(qa_max), public tracer_mass
procedure(flux_phi), pointer, public atmos_dyn_fvm_fluxy_xyz
module Atmosphere / Dynamics
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