55 real(RP),
private,
allocatable :: DENS_t(:,:,:)
56 real(RP),
private,
allocatable :: MOMZ_t(:,:,:)
57 real(RP),
private,
allocatable :: MOMX_t(:,:,:)
58 real(RP),
private,
allocatable :: MOMY_t(:,:,:)
59 real(RP),
private,
allocatable :: RHOT_t(:,:,:)
60 real(RP),
private,
allocatable,
target :: RHOQ_t(:,:,:,:)
61 real(RP),
private,
allocatable,
target :: ZERO(:,:,:)
62 real(RP),
private,
pointer :: RHOQ_tn(:,:,:)
64 real(RP),
private,
allocatable :: DENS_damp(:,:,:)
67 real(RP),
private,
allocatable,
target :: mflx(:,:,:,:)
70 integer :: I_COMM_DENS
71 integer :: I_COMM_MOMZ
72 integer :: I_COMM_MOMX
73 integer :: I_COMM_MOMY
74 integer :: I_COMM_RHOT
75 integer,
allocatable :: I_COMM_PROG(:)
77 integer :: I_COMM_DENS_t
78 integer :: I_COMM_MOMZ_t
79 integer :: I_COMM_MOMX_t
80 integer :: I_COMM_MOMY_t
81 integer :: I_COMM_RHOT_t
83 integer :: I_COMM_DENS_damp
85 integer,
allocatable :: I_COMM_RHOQ_t(:)
86 integer,
allocatable :: I_COMM_QTRC(:)
88 integer :: I_COMM_mflx_z
89 integer :: I_COMM_mflx_x
90 integer :: I_COMM_mflx_y
93 integer :: HIST_mflx(3)
94 integer :: HIST_tflx(3)
95 integer :: HIST_phys(5)
96 integer :: HIST_damp(5)
97 integer,
allocatable :: HIST_qflx(:,:)
98 integer,
allocatable :: HIST_phys_QTRC(:)
99 integer,
allocatable :: HIST_damp_QTRC(:)
102 real(RP),
allocatable,
target :: zero_x(:,:)
103 real(RP),
allocatable,
target :: zero_y(:,:)
104 integer :: MONIT_damp_mass
105 integer :: MONIT_damp_qtot
106 integer :: MONIT_mflx_west
107 integer :: MONIT_mflx_east
108 integer :: MONIT_mflx_south
109 integer :: MONIT_mflx_north
110 integer :: MONIT_qflx_west
111 integer :: MONIT_qflx_east
112 integer :: MONIT_qflx_south
113 integer :: MONIT_qflx_north
115 character(len=H_SHORT) :: EVAL_TYPE_NUMFILTER =
'TENDENCY'
123 DENS, MOMZ, MOMX, MOMY, RHOT, QTRC, PROG )
146 real(rp),
intent(inout) :: dens(
ka,
ia,
ja)
147 real(rp),
intent(inout) :: momz(
ka,
ia,
ja)
148 real(rp),
intent(inout) :: momx(
ka,
ia,
ja)
149 real(rp),
intent(inout) :: momy(
ka,
ia,
ja)
150 real(rp),
intent(inout) :: rhot(
ka,
ia,
ja)
151 real(rp),
intent(inout) :: qtrc(
ka,
ia,
ja,
qa)
152 real(rp),
intent(inout) :: prog(
ka,
ia,
ja,
va)
166 log_info(
"ATMOS_DYN_Tstep_large_fvm_heve_setup",*)
'Not found namelist. Default used.'
167 elseif( ierr > 0 )
then
168 log_error(
"ATMOS_DYN_Tstep_large_fvm_heve_setup",*)
'Not appropriate names in namelist ATMOS_DYN_TSTEP_LARGE_FVM_HEVE. Check!'
173 select case( eval_type_numfilter )
174 case(
'TENDENCY',
'FILTER' )
176 log_error(
"ATMOS_DYN_Tstep_large_fvm_heve_setup",*)
'The specfied value of EVAL_TYPE_NUMFILTER is not appropriate. Check!'
181 allocate( dens_t(
ka,
ia,
ja) )
182 allocate( momz_t(
ka,
ia,
ja) )
183 allocate( momx_t(
ka,
ia,
ja) )
184 allocate( momy_t(
ka,
ia,
ja) )
185 allocate( rhot_t(
ka,
ia,
ja) )
189 allocate( dens_damp(
ka,
ia,
ja) )
191 allocate( mflx(
ka,
ia,
ja,3) )
194 allocate( i_comm_prog(max(
va,1)) )
195 allocate( i_comm_qtrc(
qa) )
196 allocate( i_comm_rhoq_t(
qa) )
209 i_comm_prog(iv) = 5 + iv
227 i_comm_rhoq_t(iq) = 5 +
va + iq
228 i_comm_qtrc(iq) = 5 +
va + iq
241 allocate( zero(
ka,
ia,
ja) )
245 mflx(:,:,:,:) = undef
247 mflx(:,:,:,
xdir) = 0.0_rp
253 call file_history_reg(
'ZFLX_MOM',
'momentum flux of z-direction',
'kg/m2/s', &
256 call file_history_reg(
'XFLX_MOM',
'momentum flux of x-direction',
'kg/m2/s', &
259 call file_history_reg(
'YFLX_MOM',
'momentum flux of y-direction',
'kg/m2/s', &
263 call file_history_reg(
'ZFLX_RHOT',
'potential temperature flux of z-direction',
'K*kg/m2/s', &
266 call file_history_reg(
'XFLX_RHOT',
'potential temperature flux of x-direction',
'K*kg/m2/s', &
269 call file_history_reg(
'YFLX_RHOT',
'potential temperature flux of y-direction',
'K*kg/m2/s', &
273 call file_history_reg(
'DENS_t_phys',
'tendency of dencity due to physics',
'kg/m3/s', &
275 call file_history_reg(
'MOMZ_t_phys',
'tendency of momentum z due to physics',
'kg/m2/s2', &
278 call file_history_reg(
'MOMX_t_phys',
'tendency of momentum x due to physics',
'kg/m2/s2', &
281 call file_history_reg(
'MOMY_t_phys',
'tendency of momentum y due to physics',
'kg/m2/s2', &
284 call file_history_reg(
'RHOT_t_phys',
'tendency of rho*theta temperature due to physics',
'K*kg/m3/s', &
287 call file_history_reg(
'DENS_t_damp',
'tendency of dencity due to damping',
'kg/m3/s', &
289 call file_history_reg(
'MOMZ_t_damp',
'tendency of momentum z due to damping',
'kg/m2/s2', &
292 call file_history_reg(
'MOMX_t_damp',
'tendency of momentum x due to damping',
'kg/m2/s2', &
295 call file_history_reg(
'MOMY_t_damp',
'tendency of momentum y due to damping',
'kg/m2/s2', &
298 call file_history_reg(
'RHOT_t_damp',
'tendency of rho*theta temperature due to damping',
'K kg/m3/s', &
301 allocate( hist_qflx(3,
qa) )
302 allocate( hist_phys_qtrc(
qa) )
303 allocate( hist_damp_qtrc(
qa) )
322 call file_history_put( hist_mflx(iv), zero(:,:,:) )
323 call file_history_put( hist_tflx(iv), zero(:,:,:) )
326 call file_history_put( hist_phys(iv), zero(:,:,:) )
327 call file_history_put( hist_damp(iv), zero(:,:,:) )
331 call file_history_put( hist_qflx(iv,iq), zero(:,:,:) )
333 call file_history_put( hist_phys_qtrc(iq), zero(:,:,:) )
334 call file_history_put( hist_damp_qtrc(iq), zero(:,:,:) )
339 allocate( zero_x(
ka,
ja) )
340 allocate( zero_y(
ka,
ia) )
345 call monitor_reg(
"MASSTND_DAMP",
"mass tendency by the damping",
"kg", &
349 call monitor_reg(
"MASSFLX_WEST",
"mass flux at the western boundary",
"kg", &
351 dim_type=
"ZY-W", is_tendency=.true. )
352 call monitor_reg(
"MASSFLX_EAST",
"mass flux at the eastern boundary",
"kg", &
354 dim_type=
"ZY-E", is_tendency=.true. )
355 call monitor_reg(
"MASSFLX_SOUTH",
"mass flux at the southern boundary",
"kg", &
357 dim_type=
"ZX-S", is_tendency=.true. )
358 call monitor_reg(
"MASSFLX_NORTH",
"mass flux at the northern boundary",
"kg", &
360 dim_type=
"ZX-N", is_tendency=.true. )
362 call monitor_reg(
"QTOTTND_DAMP",
"water mass tendency by the damping",
"kg", &
366 call monitor_reg(
"QTOTFLX_WEST",
"water mass flux at the western boundary",
"kg", &
368 dim_type=
"ZY-W", is_tendency=.true. )
369 call monitor_reg(
"QTOTFLX_EAST",
"water mass flux at the eastern boundary",
"kg", &
371 dim_type=
"ZY-E", is_tendency=.true. )
372 call monitor_reg(
"QTOTFLX_SOUTH",
"water mass flux at the southern boundary",
"kg", &
374 dim_type=
"ZX-S", is_tendency=.true. )
375 call monitor_reg(
"QTOTFLX_NORTH",
"water mass flux at the northern boundary",
"kg", &
377 dim_type=
"ZX-N", is_tendency=.true. )
380 call monitor_put( monit_damp_mass, zero(:,:,:) )
381 call monitor_put( monit_mflx_west, zero_x(:,:) )
382 call monitor_put( monit_mflx_east, zero_x(:,:) )
383 call monitor_put( monit_mflx_south, zero_y(:,:) )
384 call monitor_put( monit_mflx_north, zero_y(:,:) )
386 call monitor_put( monit_damp_qtot, zero(:,:,:) )
387 call monitor_put( monit_qflx_west, zero_x(:,:) )
388 call monitor_put( monit_qflx_east, zero_x(:,:) )
389 call monitor_put( monit_qflx_south, zero_y(:,:) )
390 call monitor_put( monit_qflx_north, zero_y(:,:) )
408 deallocate( dens_damp )
412 deallocate( i_comm_prog )
413 deallocate( i_comm_qtrc )
414 deallocate( i_comm_rhoq_t )
419 deallocate( hist_qflx )
420 deallocate( hist_phys_qtrc )
421 deallocate( hist_damp_qtrc )
433 DENS, MOMZ, MOMX, MOMY, RHOT, QTRC, PROG, &
434 DENS_av, MOMZ_av, MOMX_av, MOMY_av, RHOT_av, QTRC_av, &
435 num_diff, num_diff_q, &
437 DENS_tp, MOMZ_tp, MOMX_tp, MOMY_tp, RHOT_tp, RHOQ_tp, &
439 CDZ, CDX, CDY, FDZ, FDX, FDY, &
440 RCDZ, RCDX, RCDY, RFDZ, RFDX, RFDY, &
442 J13G, J23G, J33G, MAPF, &
443 AQ_R, AQ_CV, AQ_CP, AQ_MASS, &
444 REF_dens, REF_pott, REF_qv, REF_pres, &
445 BND_W, BND_E, BND_S, BND_N, TwoD, &
446 ND_COEF, ND_COEF_Q, ND_LAPLACIAN_NUM, &
447 ND_SFC_FACT, ND_USE_RS, &
448 BND_QA, BND_IQ, BND_SMOOTHER_FACT, &
449 DAMP_DENS, DAMP_VELZ, DAMP_VELX, &
450 DAMP_VELY, DAMP_POTT, DAMP_QTRC, &
451 DAMP_alpha_DENS, DAMP_alpha_VELZ, DAMP_alpha_VELX, &
452 DAMP_alpha_VELY, DAMP_alpha_POTT, DAMP_alpha_QTRC, &
453 MFLUX_OFFSET_X, MFLUX_OFFSET_Y, &
454 wdamp_coef, divdmp_coef, &
455 FLAG_TRACER_SPLIT_TEND, &
456 FLAG_FCT_MOMENTUM, FLAG_FCT_T, FLAG_FCT_TRACER, &
457 FLAG_FCT_ALONG_STREAM, &
475 file_history_query, &
504 real(rp),
intent(inout) :: dens(
ka,
ia,
ja)
505 real(rp),
intent(inout) :: momz(
ka,
ia,
ja)
506 real(rp),
intent(inout) :: momx(
ka,
ia,
ja)
507 real(rp),
intent(inout) :: momy(
ka,
ia,
ja)
508 real(rp),
intent(inout) :: rhot(
ka,
ia,
ja)
509 real(rp),
intent(inout) :: qtrc(
ka,
ia,
ja,
qa)
510 real(rp),
intent(inout) :: prog(
ka,
ia,
ja,
va)
512 real(rp),
intent(inout) :: dens_av(
ka,
ia,
ja)
513 real(rp),
intent(inout) :: momz_av(
ka,
ia,
ja)
514 real(rp),
intent(inout) :: momx_av(
ka,
ia,
ja)
515 real(rp),
intent(inout) :: momy_av(
ka,
ia,
ja)
516 real(rp),
intent(inout) :: rhot_av(
ka,
ia,
ja)
517 real(rp),
intent(inout) :: qtrc_av(
ka,
ia,
ja,
qa)
519 real(rp),
intent(out) :: num_diff(
ka,
ia,
ja,5,3)
520 real(rp),
intent(out) :: num_diff_q(
ka,
ia,
ja,3)
522 real(rp),
intent(in) :: qtrc0(
ka,
ia,
ja,
qa)
524 real(rp),
intent(in) :: dens_tp(
ka,
ia,
ja)
525 real(rp),
intent(in) :: momz_tp(
ka,
ia,
ja)
526 real(rp),
intent(in) :: momx_tp(
ka,
ia,
ja)
527 real(rp),
intent(in) :: momy_tp(
ka,
ia,
ja)
528 real(rp),
intent(in) :: rhot_tp(
ka,
ia,
ja)
529 real(rp),
intent(in) :: rhoq_tp(
ka,
ia,
ja,
qa)
531 real(rp),
intent(in) :: corioli(
ia,
ja)
533 real(rp),
intent(in) :: cdz (
ka)
534 real(rp),
intent(in) :: cdx (
ia)
535 real(rp),
intent(in) :: cdy (
ja)
536 real(rp),
intent(in) :: fdz (
ka-1)
537 real(rp),
intent(in) :: fdx (
ia-1)
538 real(rp),
intent(in) :: fdy (
ja-1)
539 real(rp),
intent(in) :: rcdz(
ka)
540 real(rp),
intent(in) :: rcdx(
ia)
541 real(rp),
intent(in) :: rcdy(
ja)
542 real(rp),
intent(in) :: rfdz(
ka-1)
543 real(rp),
intent(in) :: rfdx(
ia-1)
544 real(rp),
intent(in) :: rfdy(
ja-1)
546 real(rp),
intent(in) :: phi (
ka,
ia,
ja)
547 real(rp),
intent(in) :: gsqrt(
ka,
ia,
ja,7)
548 real(rp),
intent(in) :: j13g (
ka,
ia,
ja,7)
549 real(rp),
intent(in) :: j23g (
ka,
ia,
ja,7)
550 real(rp),
intent(in) :: j33g
551 real(rp),
intent(in) :: mapf (
ia,
ja,2,4)
553 real(rp),
intent(in) :: aq_r (
qa)
554 real(rp),
intent(in) :: aq_cv (
qa)
555 real(rp),
intent(in) :: aq_cp (
qa)
556 real(rp),
intent(in) :: aq_mass(
qa)
558 real(rp),
intent(in) :: ref_dens(
ka,
ia,
ja)
559 real(rp),
intent(in) :: ref_pott(
ka,
ia,
ja)
560 real(rp),
intent(in) :: ref_qv (
ka,
ia,
ja)
561 real(rp),
intent(in) :: ref_pres(
ka,
ia,
ja)
563 logical,
intent(in) :: bnd_w
564 logical,
intent(in) :: bnd_e
565 logical,
intent(in) :: bnd_s
566 logical,
intent(in) :: bnd_n
567 logical,
intent(in) :: twod
569 real(rp),
intent(in) :: nd_coef
570 real(rp),
intent(in) :: nd_coef_q
571 integer,
intent(in) :: nd_laplacian_num
572 real(rp),
intent(in) :: nd_sfc_fact
573 logical,
intent(in) :: nd_use_rs
575 integer,
intent(in) :: bnd_qa
576 integer,
intent(in) :: bnd_iq(
qa)
577 real(rp),
intent(in) :: bnd_smoother_fact
579 real(rp),
intent(in) :: damp_dens(
ka,
ia,
ja)
580 real(rp),
intent(in) :: damp_velz(
ka,
ia,
ja)
581 real(rp),
intent(in) :: damp_velx(
ka,
ia,
ja)
582 real(rp),
intent(in) :: damp_vely(
ka,
ia,
ja)
583 real(rp),
intent(in) :: damp_pott(
ka,
ia,
ja)
584 real(rp),
intent(in) :: damp_qtrc(
ka,
ia,
ja,bnd_qa)
586 real(rp),
intent(in) :: damp_alpha_dens(
ka,
ia,
ja)
587 real(rp),
intent(in) :: damp_alpha_velz(
ka,
ia,
ja)
588 real(rp),
intent(in) :: damp_alpha_velx(
ka,
ia,
ja)
589 real(rp),
intent(in) :: damp_alpha_vely(
ka,
ia,
ja)
590 real(rp),
intent(in) :: damp_alpha_pott(
ka,
ia,
ja)
591 real(rp),
intent(in) :: damp_alpha_qtrc(
ka,
ia,
ja,bnd_qa)
592 real(rp),
intent(in) :: mflux_offset_x(
ka,
ja,2)
593 real(rp),
intent(in) :: mflux_offset_y(
ka,
ia,2)
595 real(rp),
intent(in) :: wdamp_coef(
ka)
596 real(rp),
intent(in) :: divdmp_coef
598 logical,
intent(in) :: flag_tracer_split_tend
599 logical,
intent(in) :: flag_fct_momentum
600 logical,
intent(in) :: flag_fct_t
601 logical,
intent(in) :: flag_fct_tracer
602 logical,
intent(in) :: flag_fct_along_stream
604 logical,
intent(in) :: use_average
606 integer,
intent(in) :: i_qv
608 real(
dp),
intent(in) :: dtls
609 real(
dp),
intent(in) :: dtss
610 logical ,
intent(in) :: llast
613 real(rp) :: dens00 (
ka,
ia,
ja)
614 real(rp) :: qflx (
ka,
ia,
ja,3)
617 real(rp) :: ddiv (
ka,
ia,
ja)
618 real(rp) :: dpres0 (
ka,
ia,
ja)
619 real(rp) :: rt2p (
ka,
ia,
ja)
620 real(rp) :: ref_rhot(
ka,
ia,
ja)
622 real(rp) :: dens_tq(
ka,
ia,
ja)
625 real(rp) :: damp_t_dens(
ka,
ia,
ja)
626 real(rp) :: damp_t_momz(
ka,
ia,
ja)
627 real(rp) :: damp_t_momx(
ka,
ia,
ja)
628 real(rp) :: damp_t_momy(
ka,
ia,
ja)
629 real(rp) :: damp_t_rhot(
ka,
ia,
ja)
630 real(rp) :: damp_t_qtrc(
ka,
ia,
ja)
632 real(rp) :: tflx(
ka,
ia,
ja,3)
635 real(rp) :: mflx_av(
ka,
ia,
ja,3)
645 real(rp),
target :: qflx_west (
ka,
ja)
646 real(rp),
target :: qflx_east (
ka,
ja)
647 real(rp),
target :: qflx_south(
ka,
ia)
648 real(rp),
target :: qflx_north(
ka,
ia)
649 logical :: monit_lateral_flag(3)
651 integer :: i, j,
k, iq, iqb, step
677 dts = real(dtss, kind=rp)
678 dtl = real(dtls, kind=rp)
679 nstep = ceiling( ( dtl - eps ) / dts )
682 monit_lateral_flag(
zdir) = .false.
683 monit_lateral_flag(
xdir) = monit_mflx_west > 0 .or. monit_mflx_east > 0
684 monit_lateral_flag(
ydir) = monit_mflx_south > 0 .or. monit_mflx_north > 0
687 log_info(
"ATMOS_DYN_Tstep_large_fvm_heve",*)
'Dynamics large time step'
688 log_info_cont(
'(1x,A,F0.2,A,F0.2,A,I0)') &
689 '-> DT_large, DT_small, DT_large/DT_small : ', dtl,
', ', dts,
', ', nstep
692 dens00(:,:,:) = undef
693 num_diff(:,:,:,:,:) = undef
699 dens00(:,:,:) = dens(:,:,:)
702 if ( use_average )
then
709 dens_av(
k,i,j) = 0.0_rp
710 momz_av(
k,i,j) = 0.0_rp
711 momx_av(
k,i,j) = 0.0_rp
712 momy_av(
k,i,j) = 0.0_rp
713 rhot_av(
k,i,j) = 0.0_rp
723 mflx_av(:,:,:,:) = 0.0_rp
733 qflx_west(
k,j) = 0.0_rp
734 qflx_east(
k,j) = 0.0_rp
743 qflx_south(
k,i) = 0.0_rp
744 qflx_north(
k,i) = 0.0_rp
751 dpres0, rt2p, ref_rhot, &
752 rhot, qtrc, ref_pres, aq_r, aq_cv, aq_cp, aq_mass )
765 dens_tq(:,:,:) = 0.0_rp
779 do i = max(
is-1,1), min(
ie+1,
ia)
781 diff(
k,i,j) = qtrc(
k,i,j,iq) - damp_qtrc(
k,i,j,iqb)
787 call file_history_query( hist_damp_qtrc(iq), do_put )
798 damp = - damp_alpha_qtrc(
k,
is,j,iqb) &
800 - ( diff(
k,
is,j-1) + diff(
k,
is,j+1) - diff(
k,
is,j)*2.0_rp ) &
801 * 0.25_rp * bnd_smoother_fact )
802 damp = damp * dens00(
k,
is,j)
803 if ( do_put ) damp_t_qtrc(
k,
is,j) = damp
804 rhoq_t(
k,
is,j,iq) = rhoq_tp(
k,
is,j,iq) + damp
818 diff2(
k,i,j) = diff(
k,i,j)
824 call dft_g2g(
ka,
ks,
ke,
ia,
is,
ie,
ja,
js,
je,
spnudge_qv_lm,
spnudge_qv_mm,diff2)
852 damp = - damp_alpha_qtrc(
k,i,j,iqb) &
854 - ( 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 ) &
855 * 0.125_rp * bnd_smoother_fact ) &
857 damp = damp * dens00(
k,i,j)
858 if ( do_put ) damp_t_qtrc(
k,i,j) = damp
859 rhoq_t(
k,i,j,iq) = rhoq_tp(
k,i,j,iq) + damp
868 if ( do_put )
call file_history_put( hist_damp_qtrc(iq), damp_t_qtrc(:,:,:) )
872 call comm_vars8( rhoq_t(:,:,:,iq), i_comm_rhoq_t(iq) )
873 call comm_wait ( rhoq_t(:,:,:,iq), i_comm_rhoq_t(iq), .false. )
883 rhoq_t(
k,i,j,iq) = rhoq_tp(
k,i,j,iq)
892 call file_history_put( hist_phys_qtrc(iq), rhoq_tp(:,:,:,iq) )
901 if ( bnd_w .and. (.not. twod) )
then
906 mflx(
k,
is-1,j,
xdir) = ( momx(
k,
is-1,j) + mflux_offset_x(
k,j,1) ) &
912 if ( bnd_e .and. (.not. twod) )
then
917 mflx(
k,
ie,j,
xdir) = ( momx(
k,
ie,j) + mflux_offset_x(
k,j,2) ) &
928 mflx(
k,i,
js-1,
ydir) = ( momy(
k,i,
js-1) + mflux_offset_y(
k,i,1) ) &
939 mflx(
k,i,
je,
ydir) = ( momy(
k,i,
je) + mflux_offset_y(
k,i,2) ) &
954 damp_t_dens(
k,i,j) = 0.0_rp
955 damp_t_momz(
k,i,j) = 0.0_rp
956 damp_t_momx(
k,i,j) = 0.0_rp
957 damp_t_momy(
k,i,j) = 0.0_rp
958 damp_t_rhot(
k,i,j) = 0.0_rp
977 do i = max(
is-1,1), min(
ie+1,
ia)
979 diff(
k,i,j) = dens(
k,i,j) - damp_dens(
k,i,j)
985 call file_history_query( hist_damp(1), do_put )
996 dens_damp(
k,
is,j) = - damp_alpha_dens(
k,
is,j) &
998 - ( diff(
k,
is,j-1) + diff(
k,
is,j+1) - diff(
k,
is,j)*2.0_rp ) &
999 * 0.25_rp * bnd_smoother_fact ) &
1000 + dens_tq(
k,
is,j) * ( 0.5_rp - sign( 0.5_rp, damp_alpha_dens(
k,
is,j)-eps ) )
1001 dens_t(
k,
is,j) = dens_tp(
k,
is,j) &
1003 if ( do_put ) damp_t_dens(
k,
is,j) = damp_t_dens(
k,
is,j) + dens_damp(
k,
is,j) / nstep
1018 dens_damp(
k,i,j) = - damp_alpha_dens(
k,i,j) &
1020 - ( 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 ) &
1021 * 0.125_rp * bnd_smoother_fact ) &
1022 + dens_tq(
k,i,j) * ( 0.5_rp - sign( 0.5_rp, damp_alpha_dens(
k,i,j)-eps ) )
1023 dens_t(
k,i,j) = dens_tp(
k,i,j) &
1025 if ( do_put ) damp_t_dens(
k,i,j) = damp_t_dens(
k,i,j) + dens_damp(
k,i,j) / nstep
1032 call comm_vars8( dens_damp(:,:,:), i_comm_dens_damp )
1033 call comm_vars8( dens_t(:,:,:), i_comm_dens_t )
1039 do i = max(
is-1,1), min(
ie+1,
ia)
1041 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
1047 call file_history_query( hist_damp(2), do_put )
1059 damp = - damp_alpha_velz(
k,
is,j) &
1061 - ( diff(
k,
is,j-1) + diff(
k,
is,j+1) - diff(
k,
is,j)*2.0_rp ) &
1062 * 0.25_rp * bnd_smoother_fact )
1064 momz_t(
k,
is,j) = momz_tp(
k,
is,j) &
1066 + ( dens_damp(
k,
is,j) + dens_damp(
k+1,
is,j) ) * momz(
k,
is,j) / ( dens(
k,
is,j) + dens(
k+1,
is,j) )
1067 if ( do_put ) damp_t_momz(
k,
is,j) = damp_t_momz(
k,
is,j) + damp / nstep
1083 damp = - damp_alpha_velz(
k,i,j) &
1085 - ( 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 ) &
1086 * 0.125_rp * bnd_smoother_fact )
1088 momz_t(
k,i,j) = momz_tp(
k,i,j) &
1090 + ( dens_damp(
k,i,j) + dens_damp(
k+1,i,j) ) * momz(
k,i,j) / ( dens(
k,i,j) + dens(
k+1,i,j) )
1091 if ( do_put ) damp_t_momz(
k,i,j) = damp_t_momz(
k,i,j) + damp / nstep
1102 momz_t( 1:
ks-1,i,j) = 0.0_rp
1103 momz_t(
ke:
ka ,i,j) = 0.0_rp
1107 call comm_vars8( momz_t(:,:,:), i_comm_momz_t )
1109 call comm_wait( dens_damp(:,:,:), i_comm_dens_damp )
1117 diff(
k,
is,j) = momx(
k,
is,j) - damp_velx(
k,
is,j) * dens(
k,
is,j)
1128 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
1136 call file_history_query( hist_damp(3), do_put )
1148 damp = - damp_alpha_velx(
k,
is,j) &
1150 - ( diff(
k,
is,j-1) + diff(
k,
is,j+1) - diff(
k,
is,j)*2.0_rp ) &
1151 * 0.25_rp * bnd_smoother_fact )
1152 momx_t(
k,
is,j) = momx_tp(
k,
is,j) &
1154 + dens_damp(
k,
is,j) * momx(
k,
is,j) / dens(
k,
is,j)
1155 if ( do_put ) damp_t_momx(
k,
is,j) = damp_t_momx(
k,
is,j) + damp / nstep
1169 diff3(
k,i,j) = momy(
k,i,j) - damp_vely(
k,i,j) * ( dens(
k,i,j)+dens(
k,i,j+1) ) * 0.5_rp
1181 diff2(
k,i,j) = diff(
k,i,j) / ( ( dens(
k,i,j)+dens(
k,i+1,j) ) * 0.5_rp )
1193 diff3(
k,i,j) = diff3(
k,i,j) / ( ( dens(
k,i,j)+dens(
k,i,j+1) ) * 0.5_rp )
1199 call dft_g2g_divfree(
ka,
ks,
ke,
ia,
is,
ie,
ja,
js,
je,
spnudge_uv_lm,
spnudge_uv_mm,diff2,diff3)
1207 diff2(
k,i,j) = diff2(
k,i,j) * ( dens(
k,i,j)+dens(
k,i+1,j) ) * 0.5_rp
1221 diff2(
k,i,j) = diff(
k,i,j) / ( ( dens(
k,i,j)+dens(
k,i+1,j) ) * 0.5_rp )
1227 call dft_g2g(
ka,
ks,
ke,
ia,
is,
ie,
ja,
js,
je,
spnudge_uv_lm,
spnudge_uv_mm,diff2)
1234 diff2(
k,i,j) = diff2(
k,i,j) * ( dens(
k,i,j)+dens(
k,i+1,j) ) * 0.5_rp
1249 diff2(
k,i,j) = 0.0_rp
1268 damp = - damp_alpha_velx(
k,i,j) &
1270 - ( 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 ) &
1271 * 0.125_rp * bnd_smoother_fact ) &
1273 momx_t(
k,i,j) = momx_tp(
k,i,j) &
1275 + ( dens_damp(
k,i,j) + dens_damp(
k,i+1,j) ) * momx(
k,i,j) / ( dens(
k,i,j) + dens(
k,i+1,j) )
1276 if ( do_put ) damp_t_momx(
k,i,j) = damp_t_momx(
k,i,j) + damp / nstep
1284 call comm_vars8( momx_t(:,:,:), i_comm_momx_t )
1290 do i = max(
is-1,1), min(
ie+1,
ia)
1292 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
1298 call file_history_query( hist_damp(4), do_put )
1310 damp = - damp_alpha_vely(
k,
is,j) &
1312 - ( diff(
k,
is,j-1) + diff(
k,
is,j+1) - diff(
k,
is,j)*2.0_rp ) &
1313 * 0.25_rp * bnd_smoother_fact )
1314 momy_t(
k,
is,j) = momy_tp(
k,
is,j) &
1316 + ( dens_damp(
k,
is,j) + dens_damp(
k,
is,j+1) ) * momy(
k,
is,j) / ( dens(
k,
is,j) + dens(
k,
is,j+1) )
1317 if ( do_put ) damp_t_momy(
k,
is,j) = damp_t_momy(
k,
is,j) + damp / nstep
1331 diff2(
k,i,j) = diff3(
k,i,j) * ( dens(
k,i,j)+dens(
k,i,j+1) ) * 0.5_rp
1344 diff2(
k,i,j) = diff(
k,i,j) / ( ( dens(
k,i,j)+dens(
k,i,j+1) ) * 0.5_rp )
1350 call dft_g2g(
ka,
ks,
ke,
ia,
is,
ie,
ja,
js,
je,
spnudge_uv_lm,
spnudge_uv_mm,diff2)
1358 diff2(
k,i,j) = diff2(
k,i,j) * ( dens(
k,i,j)+dens(
k,i,j+1) ) * 0.5_rp
1377 damp = - damp_alpha_vely(
k,i,j) &
1379 - ( 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 ) &
1380 * 0.125_rp * bnd_smoother_fact ) &
1382 momy_t(
k,i,j) = momy_tp(
k,i,j) &
1384 + ( dens_damp(
k,i,j) + dens_damp(
k,i,j+1) ) * momy(
k,i,j) / ( dens(
k,i,j) + dens(
k,i,j+1) )
1385 if ( do_put ) damp_t_momy(
k,i,j) = damp_t_momy(
k,i,j) + damp / nstep
1393 call comm_vars8( momy_t(:,:,:), i_comm_momy_t )
1399 do i = max(
is-1,1), min(
ie+2,
ia)
1401 diff(
k,i,j) = rhot(
k,i,j) - damp_pott(
k,i,j) * dens(
k,i,j)
1407 call file_history_query( hist_damp(5), do_put )
1419 damp = - damp_alpha_pott(
k,
is,j) &
1421 - ( diff(
k,
is,j-1) + diff(
k,
is,j+1) - diff(
k,
is,j)*2.0_rp ) &
1422 * 0.25_rp * bnd_smoother_fact )
1423 rhot_t(
k,
is,j) = rhot_tp(
k,
is,j) &
1425 + dens_damp(
k,
is,j) * rhot(
k,
is,j) / dens(
k,
is,j)
1426 if ( do_put ) damp_t_rhot(
k,
is,j) = damp_t_rhot(
k,
is,j) + damp / nstep
1439 diff2(
k,i,j) = diff(
k,i,j) / dens(
k,i,j)
1445 call dft_g2g(
ka,
ks,
ke,
ia,
is,
ie,
ja,
js,
je,
spnudge_pt_lm,
spnudge_pt_mm,diff2)
1453 diff2(
k,i,j) = diff2(
k,i,j) * dens(
k,i,j)
1467 diff2(
k,i,j) = 0.0_rp
1486 damp = - damp_alpha_pott(
k,i,j) &
1488 - ( 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 ) &
1489 * 0.125_rp * bnd_smoother_fact ) &
1491 rhot_t(
k,i,j) = rhot_tp(
k,i,j) &
1493 + dens_damp(
k,i,j) * rhot(
k,i,j) / dens(
k,i,j)
1494 if ( do_put ) damp_t_rhot(
k,i,j) = damp_t_rhot(
k,i,j) + damp / nstep
1502 call comm_vars8( rhot_t(:,:,:), i_comm_rhot_t )
1504 call comm_wait ( dens_t(:,:,:), i_comm_dens_t, .false. )
1505 call comm_wait ( momz_t(:,:,:), i_comm_momz_t, .false. )
1506 call comm_wait ( momx_t(:,:,:), i_comm_momx_t, .false. )
1507 call comm_wait ( momy_t(:,:,:), i_comm_momy_t, .false. )
1508 call comm_wait ( rhot_t(:,:,:), i_comm_rhot_t, .false. )
1515 if ( nd_coef == 0.0_rp .or. eval_type_numfilter ==
'FILTER' )
then
1519 num_diff(:,:,:,:,:) = 0.0_rp
1524 dens, momz, momx, momy, rhot, &
1525 cdz, cdx, cdy, fdz, fdx, fdy, twod, dts, &
1526 ref_dens, ref_pott, &
1527 nd_coef, nd_laplacian_num, nd_sfc_fact, nd_use_rs )
1534 if ( divdmp_coef > 0.0_rp )
then
1538 gsqrt, j13g, j23g, j33g, mapf, &
1540 rcdz, rcdx, rcdy, rfdz, fdz )
1547 ddiv(:,:,:) = 0.0_rp
1563 dens_t, momz_t, momx_t, momy_t, rhot_t, &
1564 dpres0, rt2p, corioli, &
1565 num_diff, wdamp_coef, divdmp_coef, ddiv, &
1566 flag_fct_momentum, flag_fct_t, &
1567 flag_fct_along_stream, &
1568 cdz, fdz, fdx, fdy, &
1569 rcdz, rcdx, rcdy, rfdz, rfdx, rfdy, &
1570 phi, gsqrt, j13g, j23g, j33g, mapf, &
1571 ref_dens, ref_rhot, &
1572 bnd_w, bnd_e, bnd_s, bnd_n, twod, &
1580 if ( nd_coef > 0.0_rp .and. eval_type_numfilter ==
'FILTER' )
then
1581 call comm_vars8( dens(:,:,:), i_comm_dens )
1582 call comm_vars8( momz(:,:,:), i_comm_momz )
1583 call comm_vars8( momx(:,:,:), i_comm_momx )
1584 call comm_vars8( momy(:,:,:), i_comm_momy )
1585 call comm_vars8( rhot(:,:,:), i_comm_rhot )
1586 call comm_wait ( dens(:,:,:), i_comm_dens, .false. )
1587 call comm_wait ( momz(:,:,:), i_comm_momz, .false. )
1588 call comm_wait ( momx(:,:,:), i_comm_momx, .false. )
1589 call comm_wait ( momy(:,:,:), i_comm_momy, .false. )
1590 call comm_wait ( rhot(:,:,:), i_comm_rhot, .false. )
1594 dens, momz, momx, momy, rhot, &
1595 cdz, cdx, cdy, fdz, fdx, fdy, &
1596 rcdz, rcdx, rcdy, rfdz, rfdx, rfdy, &
1598 gsqrt, mapf, ref_dens, ref_pott, &
1599 nd_coef, nd_laplacian_num, nd_sfc_fact, nd_use_rs )
1609 momz( 1:
ks-1,i,j) = 0.0_rp
1618 momz(
ke+1:
ka, i,j) = 0.0_rp
1630 call comm_vars8( dens(:,:,:), i_comm_dens )
1631 call comm_vars8( momz(:,:,:), i_comm_momz )
1632 call comm_vars8( momx(:,:,:), i_comm_momx )
1633 call comm_vars8( momy(:,:,:), i_comm_momy )
1634 call comm_vars8( rhot(:,:,:), i_comm_rhot )
1636 call comm_vars8( prog(:,:,:,iv), i_comm_prog(iv) )
1638 call comm_wait ( dens(:,:,:), i_comm_dens, .false. )
1639 call comm_wait ( momz(:,:,:), i_comm_momz, .false. )
1640 call comm_wait ( momx(:,:,:), i_comm_momx, .false. )
1641 call comm_wait ( momy(:,:,:), i_comm_momy, .false. )
1642 call comm_wait ( rhot(:,:,:), i_comm_rhot, .false. )
1644 call comm_wait ( prog(:,:,:,iv), i_comm_prog(iv), .false. )
1647 if ( use_average )
then
1653 dens_av(
k,i,j) = dens_av(
k,i,j) + dens(
k,i,j) / nstep
1654 momz_av(
k,i,j) = momz_av(
k,i,j) + momz(
k,i,j) / nstep
1655 momx_av(
k,i,j) = momx_av(
k,i,j) + momx(
k,i,j) / nstep
1656 momy_av(
k,i,j) = momy_av(
k,i,j) + momy(
k,i,j) / nstep
1657 rhot_av(
k,i,j) = rhot_av(
k,i,j) + rhot(
k,i,j) / nstep
1671 mflx_av(
k,i,j,n) = mflx_av(
k,i,j,n) + mflx(
k,i,j,n)
1695 mflx(
k,i,j,n) = mflx_av(
k,i,j,n) / nstep
1704 call comm_vars8( mflx(:,:,:,
zdir), i_comm_mflx_z )
1705 if ( .not. twod )
call comm_vars8( mflx(:,:,:,
xdir), i_comm_mflx_x )
1706 call comm_vars8( mflx(:,:,:,
ydir), i_comm_mflx_y )
1707 call comm_wait ( mflx(:,:,:,
zdir), i_comm_mflx_z, .false. )
1708 if ( .not. twod )
call comm_wait ( mflx(:,:,:,
xdir), i_comm_mflx_x, .false. )
1709 call comm_wait ( mflx(:,:,:,
ydir), i_comm_mflx_y, .false. )
1723 if ( nd_coef_q == 0.0_rp )
then
1727 num_diff_q(:,:,:,:) = 0.0_rp
1732 dens00, qtrc(:,:,:,iq), iq==i_qv, &
1733 cdz, cdx, cdy, twod, dtl, &
1735 nd_coef_q, nd_laplacian_num, nd_sfc_fact, nd_use_rs )
1742 if ( flag_tracer_split_tend )
then
1749 qtrc(
k,i,j,iq) = qtrc(
k,i,j,iq) &
1750 + rhoq_t(
k,i,j,iq) * dtl / dens(
k,i,j)
1757 rhoq_tn => rhoq_t(:,:,:,iq)
1763 qtrc0(:,:,:,iq), rhoq_tn, &
1766 gsqrt, mapf(:,:,:,
i_xy), &
1767 cdz, rcdz, rcdx, rcdy, &
1768 bnd_w, bnd_e, bnd_s, bnd_n, &
1771 llast .AND. flag_fct_tracer, &
1772 flag_fct_along_stream )
1778 call file_history_query( hist_qflx(iv,iq), do_put )
1779 if ( do_put .or. monit_lateral_flag(iv) )
then
1781 call file_history_put( hist_qflx(iv,iq), qflx(:,:,:,iv) )
1786 if ( bnd_w .and. monit_qflx_west > 0 )
then
1791 qflx_west(
k,j) = qflx_west(
k,j) + qflx(
k,
is-1,j,
xdir)
1796 if ( bnd_e .and. monit_qflx_east > 0 )
then
1801 qflx_east(
k,j) = qflx_east(
k,j) + qflx(
k,
ie,j,
xdir)
1806 if ( bnd_s .and. monit_qflx_south > 0 )
then
1811 qflx_south(
k,i) = qflx_south(
k,i) + qflx(
k,i,
js-1,
ydir)
1816 if ( bnd_n .and. monit_qflx_north > 0 )
then
1821 qflx_north(
k,i) = qflx_north(
k,i) + qflx(
k,i,
je,
ydir)
1838 qtrc(
k,i,j,iq) = ( qtrc0(
k,i,j,iq) * dens00(
k,i,j) &
1839 + rhoq_t(
k,i,j,iq) * dtl ) / dens(
k,i,j)
1847 call comm_vars8( qtrc(:,:,:,iq), i_comm_qtrc(iq) )
1849 if ( use_average )
then
1854 qtrc_av(
k,i,j,iq) = qtrc(
k,i,j,iq)
1864 call comm_wait ( qtrc(:,:,:,iq), i_comm_qtrc(iq), .false. )
1870 call file_history_put( hist_phys(1), dens_tp )
1871 call file_history_put( hist_phys(2), momz_tp )
1872 call file_history_put( hist_phys(3), momx_tp )
1873 call file_history_put( hist_phys(4), momy_tp )
1874 call file_history_put( hist_phys(5), rhot_tp )
1876 call file_history_put( hist_damp(1), damp_t_dens )
1877 call file_history_put( hist_damp(2), damp_t_momz )
1878 call file_history_put( hist_damp(3), damp_t_momx )
1879 call file_history_put( hist_damp(4), damp_t_momy )
1880 call file_history_put( hist_damp(5), damp_t_rhot )
1883 call file_history_query( hist_mflx(iv), do_put )
1884 if ( do_put .or. monit_lateral_flag(iv) )
then
1886 call file_history_put( hist_mflx(iv), mflx(:,:,:,iv) )
1891 call file_history_query( hist_tflx(iv), do_put )
1894 call file_history_put( hist_tflx(iv), tflx(:,:,:,iv) )
1899 call monitor_put( monit_damp_mass, damp_t_dens(:,:,:) )
1907 call monitor_put( monit_damp_qtot, dens_tq(:,:,:) )
1927 integer,
intent(in) :: MONIT_ID
1928 logical,
intent(in) :: BND_flag
1929 real(RP),
target,
intent(in) :: flx(:,:)
1930 real(RP),
target,
intent(in) :: flx_zero(:,:)
1932 real(RP),
pointer :: flx_ptr(:,:)
1934 if ( bnd_flag )
then
1939 call monitor_put( monit_id, flx_ptr(:,:) )
1946 integer,
intent(in) :: I_DIR
1947 real(RP),
intent(inout) :: flx(KA,IA,JA,3)
1948 real(RP),
intent(in) :: GSQRT(KA,IA,JA,7)
1949 real(RP),
intent(in) :: MAPF (IA,JA,2,4)
1956 if (i_dir ==
zdir)
then
1962 flx(k,i,j,
zdir) = flx(k,i,j,
zdir) * mapf(i,j,1,
i_xy) * mapf(i,j,2,
i_xy)
1969 if (i_dir ==
xdir)
then
1975 flx(k,i,j,
xdir) = flx(k,i,j,
xdir) * mapf(i,j,2,
i_uy) / gsqrt(k,i,j,
i_uyz)
1982 if (i_dir ==
ydir)
then
1988 flx(k,i,j,
ydir) = flx(k,i,j,
ydir) * mapf(i,j,1,
i_xv) / gsqrt(k,i,j,
i_xvz)