14 #include "inc_openmp.h" 15 #define HIVI_BICGSTAB 1 58 integer,
private,
parameter :: va_fvm_hivi = 0
60 integer,
private :: itmax
61 real(RP),
private :: epsilon
63 integer,
private :: mtype
66 real(RP),
private,
parameter :: fact_n = 7.0_rp / 12.0_rp
67 real(RP),
private,
parameter :: fact_f = -1.0_rp / 12.0_rp
83 character(len=*),
intent(in) :: ATMOS_DYN_TYPE
84 integer,
intent(out) :: VA_out
85 character(len=H_SHORT),
intent(out) :: VAR_NAME(:)
86 character(len=H_MID),
intent(out) :: VAR_DESC(:)
87 character(len=H_SHORT),
intent(out) :: VAR_UNIT(:)
92 if ( atmos_dyn_type /=
'FVM-HIVI' .AND. atmos_dyn_type /=
'HIVI' )
then 93 write(*,*)
'xxx ATMOS_DYN_TYPE is not FVM-HIVI. Check!' 112 namelist / param_atmos_dyn_tstep_fvm_hivi / &
124 write(*,*)
'xxx Not Implemented yet' 130 epsilon = 0.1_rp ** (
rp*2)
134 read(
io_fid_conf,nml=param_atmos_dyn_tstep_fvm_hivi,iostat=ierr)
137 if(
io_l )
write(
io_fid_log,*)
'*** Not found namelist. Default used.' 138 elseif( ierr > 0 )
then 139 write(*,*)
'xxx Not appropriate names in namelist PARAM_ATMOS_DYN_TSTEP_FVM_HIVI. Check!' 145 mtype = mpi_double_precision
146 elseif(
rp ==
sp )
then 149 write(*,*)
'xxx Unsupported precision' 158 DENS_RK, MOMZ_RK, MOMX_RK, MOMY_RK, RHOT_RK, &
161 DENS0, MOMZ0, MOMX0, MOMY0, RHOT0, &
162 DENS, MOMZ, MOMX, MOMY, RHOT, &
163 DENS_t, MOMZ_t, MOMX_t, MOMY_t, RHOT_t, &
165 DPRES0, RT2P, CORIOLI, &
166 num_diff, divdmp_coef, DDIV, &
167 FLAG_FCT_MOMENTUM, FLAG_FCT_T, &
168 FLAG_FCT_ALONG_STREAM, &
169 CDZ, FDZ, FDX, FDY, &
170 RCDZ, RCDX, RCDY, RFDZ, RFDX, RFDY, &
171 PHI, GSQRT, J13G, J23G, J33G, MAPF, &
172 REF_dens, REF_rhot, &
173 BND_W, BND_E, BND_S, BND_N, &
218 real(RP),
intent(out) :: DENS_RK(
ka,
ia,
ja)
219 real(RP),
intent(out) :: MOMZ_RK(
ka,
ia,
ja)
220 real(RP),
intent(out) :: MOMX_RK(
ka,
ia,
ja)
221 real(RP),
intent(out) :: MOMY_RK(
ka,
ia,
ja)
222 real(RP),
intent(out) :: RHOT_RK(
ka,
ia,
ja)
224 real(RP),
intent(out) :: PROG_RK(
ka,
ia,
ja,
va)
226 real(RP),
intent(inout) :: mflx_hi(
ka,
ia,
ja,3)
227 real(RP),
intent(out) :: tflx_hi(
ka,
ia,
ja,3)
229 real(RP),
intent(in),
target :: DENS0(
ka,
ia,
ja)
230 real(RP),
intent(in),
target :: MOMZ0(
ka,
ia,
ja)
231 real(RP),
intent(in),
target :: MOMX0(
ka,
ia,
ja)
232 real(RP),
intent(in),
target :: MOMY0(
ka,
ia,
ja)
233 real(RP),
intent(in),
target :: RHOT0(
ka,
ia,
ja)
235 real(RP),
intent(in) :: DENS(
ka,
ia,
ja)
236 real(RP),
intent(in) :: MOMZ(
ka,
ia,
ja)
237 real(RP),
intent(in) :: MOMX(
ka,
ia,
ja)
238 real(RP),
intent(in) :: MOMY(
ka,
ia,
ja)
239 real(RP),
intent(in) :: RHOT(
ka,
ia,
ja)
241 real(RP),
intent(in) :: DENS_t(
ka,
ia,
ja)
242 real(RP),
intent(in) :: MOMZ_t(
ka,
ia,
ja)
243 real(RP),
intent(in) :: MOMX_t(
ka,
ia,
ja)
244 real(RP),
intent(in) :: MOMY_t(
ka,
ia,
ja)
245 real(RP),
intent(in) :: RHOT_t(
ka,
ia,
ja)
247 real(RP),
intent(in) :: PROG0(
ka,
ia,
ja,
va)
248 real(RP),
intent(in) :: PROG (
ka,
ia,
ja,
va)
250 real(RP),
intent(in) :: DPRES0(
ka,
ia,
ja)
251 real(RP),
intent(in) :: RT2P(
ka,
ia,
ja)
252 real(RP),
intent(in) :: CORIOLI(1,
ia,
ja)
253 real(RP),
intent(in) :: num_diff(
ka,
ia,
ja,5,3)
254 real(RP),
intent(in) :: divdmp_coef
255 real(RP),
intent(in) :: DDIV(
ka,
ia,
ja)
257 logical,
intent(in) :: FLAG_FCT_MOMENTUM
258 logical,
intent(in) :: FLAG_FCT_T
259 logical,
intent(in) :: FLAG_FCT_ALONG_STREAM
261 real(RP),
intent(in) :: CDZ(
ka)
262 real(RP),
intent(in) :: FDZ(
ka-1)
263 real(RP),
intent(in) :: FDX(
ia-1)
264 real(RP),
intent(in) :: FDY(
ja-1)
265 real(RP),
intent(in) :: RCDZ(
ka)
266 real(RP),
intent(in) :: RCDX(
ia)
267 real(RP),
intent(in) :: RCDY(
ja)
268 real(RP),
intent(in) :: RFDZ(
ka-1)
269 real(RP),
intent(in) :: RFDX(
ia-1)
270 real(RP),
intent(in) :: RFDY(
ja-1)
272 real(RP),
intent(in) :: PHI (
ka,
ia,
ja)
273 real(RP),
intent(in) :: GSQRT (
ka,
ia,
ja,7)
274 real(RP),
intent(in) :: J13G (
ka,
ia,
ja,7)
275 real(RP),
intent(in) :: J23G (
ka,
ia,
ja,7)
276 real(RP),
intent(in) :: J33G
277 real(RP),
intent(in) :: MAPF (
ia,
ja,2,4)
278 real(RP),
intent(in) :: REF_dens(
ka,
ia,
ja)
279 real(RP),
intent(in) :: REF_rhot(
ka,
ia,
ja)
281 logical,
intent(in) :: BND_W
282 logical,
intent(in) :: BND_E
283 logical,
intent(in) :: BND_S
284 logical,
intent(in) :: BND_N
286 real(RP),
intent(in) :: dtrk
287 real(RP),
intent(in) :: dt
291 real(RP) :: POTT(
ka,
ia,
ja)
292 real(RP) :: DDENS(
ka,
ia,
ja)
293 real(RP) :: DPRES(
ka,
ia,
ja)
294 real(RP) :: DPRES_N(
ka,
ia,
ja)
301 real(RP) :: RCs2T(
ka,
ia,
ja)
306 real(RP) :: qflx_hi (
ka,
ia,
ja,3)
307 real(RP) :: qflx_J13(
ka,
ia,
ja)
308 real(RP) :: qflx_J23(
ka,
ia,
ja)
309 real(RP) :: mflx_hi2(
ka,
ia,
ja,3)
316 real(RP) :: zero(
ka,
ia,
ja)
320 integer :: IIS, IIE, JJS, JJE
329 mflx_hi(:,:,:,:) = undef
330 mflx_hi(
ks-1,:,:,
zdir) = 0.0_rp
332 qflx_hi(:,:,:,:) = undef
333 tflx_hi(:,:,:,:) = undef
334 qflx_j13(:,:,:) = undef
335 qflx_j23(:,:,:) = undef
336 mflx_hi2(:,:,:,:) = undef
362 call check( __line__, dpres0(k,i,j) )
363 call check( __line__, rt2p(k,i,j) )
364 call check( __line__, rhot(k,i,j) )
365 call check( __line__, ref_rhot(k,i,j) )
367 dpres(k,i,j) = dpres0(k,i,j) + rt2p(k,i,j) * ( rhot(k,i,j) - ref_rhot(k,i,j) )
369 dpres(
ks-1,i,j) = dpres0(
ks-1,i,j) - dens(
ks,i,j) * ( phi(
ks-1,i,j) - phi(
ks+1,i,j) )
370 dpres(
ke+1,i,j) = dpres0(
ke+1,i,j) - dens(
ke,i,j) * ( phi(
ke+1,i,j) - phi(
ke-1,i,j) )
379 call check( __line__, dens(k,i,j) )
380 call check( __line__, ref_dens(k,i,j) )
382 ddens(k,i,j) = dens(k,i,j) - ref_dens(k,i,j)
392 call check( __line__, rhot(k,i,j) )
393 call check( __line__, dens(k,i,j) )
395 pott(k,i,j) = rhot(k,i,j) / dens(k,i,j)
400 k = iundef; i = iundef; j = iundef
408 call check( __line__, rt2p(k,i,j) )
410 rcs2t(k,i,j) = 1.0_rp / rt2p(k,i,j)
415 k = iundef; i = iundef; j = iundef
426 call check( __line__, momx(k+1,i ,j) )
427 call check( __line__, momx(k+1,i-1,j) )
428 call check( __line__, momx(k ,i ,j) )
429 call check( __line__, momx(k ,i+1,j) )
430 call check( __line__, momy(k+1,i,j) )
431 call check( __line__, momy(k+1,i,j-1) )
432 call check( __line__, momy(k ,i,j) )
433 call check( __line__, momy(k ,i,j-1) )
437 mflx_hi2(k,i,j,
zdir) = j13g(k,i,j,
i_xyw) * 0.25_rp * ( momx(k+1,i,j)+momx(k+1,i-1,j) &
438 + momx(k ,i,j)+momx(k ,i-1,j) ) &
439 + j23g(k,i,j,
i_xyw) * 0.25_rp * ( momy(k+1,i,j)+momy(k+1,i,j-1) &
440 + momy(k ,i,j)+momy(k ,i,j-1) ) &
446 k = iundef; i = iundef; j = iundef
452 mflx_hi2(
ks-1,i,j,
zdir) = 0.0_rp
453 mflx_hi2(
ke ,i,j,
zdir) = 0.0_rp
466 mflx_hi2(k,i,j,
xdir) = gsqrt(k,i,j,
i_uyz) * num_diff(k,i,j,
i_dens,
xdir)
471 k = iundef; i = iundef; j = iundef
482 mflx_hi2(k,i,j,
ydir) = gsqrt(k,i,j,
i_xvz) * num_diff(k,i,j,
i_dens,
ydir)
487 k = iundef; i = iundef; j = iundef
496 gsqrt(:,:,:,
i_xyz), j33g, &
502 gsqrt(:,:,:,
i_xyz), j13g(:,:,:,
i_xyz), mapf(:,:,:,
i_xy), &
507 gsqrt(:,:,:,
i_xyz), j23g(:,:,:,
i_xyz), mapf(:,:,:,
i_xy), &
532 call check( __line__, qflx_hi(k ,i ,j ,
zdir) )
533 call check( __line__, qflx_hi(k-1,i ,j ,
zdir) )
534 call check( __line__, qflx_j13(k ,i ,j ) )
535 call check( __line__, qflx_j13(k-1,i ,j ) )
536 call check( __line__, qflx_j23(k ,i ,j ) )
537 call check( __line__, qflx_j23(k-1,i ,j ) )
538 call check( __line__, qflx_hi(k ,i ,j ,
xdir) )
539 call check( __line__, qflx_hi(k ,i-1,j ,
xdir) )
540 call check( __line__, qflx_hi(k ,i ,j ,
ydir) )
541 call check( __line__, qflx_hi(k ,i ,j-1,
ydir) )
542 call check( __line__, ddiv(k ,i,j) )
543 call check( __line__, ddiv(k+1,i,j) )
544 call check( __line__, momz0(k,i,j) )
545 call check( __line__, momz_t(k,i,j) )
548 - ( ( qflx_hi(k,i,j,
zdir) - qflx_hi(k-1,i ,j ,
zdir) &
549 + qflx_j13(k,i,j) - qflx_j13(k-1,i ,j ) &
550 + qflx_j23(k,i,j) - qflx_j23(k-1,i ,j ) ) * rfdz(k) &
551 + ( qflx_hi(k,i,j,
xdir) - qflx_hi(k ,i-1,j ,
xdir) ) * rcdx(i) &
552 + ( qflx_hi(k,i,j,
ydir) - qflx_hi(k ,i ,j-1,
ydir) ) * rcdy(j) &
553 ) / gsqrt(k,i,j,
i_xyw) &
554 + divdmp_coef * rdt * ( ddiv(k+1,i,j)-ddiv(k,i,j) ) * fdz(k) &
560 k = iundef; i = iundef; j = iundef
565 sw(
ks-1,i,j) = 0.0_rp
570 k = iundef; i = iundef; j = iundef
579 gsqrt(:,:,:,
i_uyw), j33g, &
585 gsqrt(:,:,:,
i_uyz), j13g(:,:,:,
i_uyw), mapf(:,:,:,
i_uy), &
590 gsqrt(:,:,:,
i_uyz), j23g(:,:,:,
i_uyw), mapf(:,:,:,
i_uy), &
617 call check( __line__, qflx_hi(k ,i ,j ,
zdir) )
618 call check( __line__, qflx_hi(k-1,i ,j ,
zdir) )
619 call check( __line__, qflx_hi(k ,i ,j ,
xdir) )
620 call check( __line__, qflx_hi(k ,i-1,j ,
xdir) )
621 call check( __line__, qflx_hi(k ,i ,j ,
ydir) )
622 call check( __line__, qflx_hi(k ,i ,j-1,
ydir) )
623 call check( __line__, dpres(k+1,i+1,j) )
624 call check( __line__, dpres(k+1,i ,j) )
625 call check( __line__, dpres(k-1,i+1,j) )
626 call check( __line__, dpres(k-1,i ,j) )
627 call check( __line__, corioli(1,i ,j) )
628 call check( __line__, corioli(1,i+1,j) )
629 call check( __line__, momy(k,i ,j ) )
630 call check( __line__, momy(k,i+1,j ) )
631 call check( __line__, momy(k,i ,j-1) )
632 call check( __line__, momy(k,i+1,j-1) )
633 call check( __line__, ddiv(k,i+1,j) )
634 call check( __line__, ddiv(k,i ,j) )
635 call check( __line__, momx0(k,i,j) )
638 - ( ( qflx_hi(k,i,j,
zdir) - qflx_hi(k-1,i ,j ,
zdir) &
639 + qflx_j13(k,i,j) - qflx_j13(k-1,i ,j) &
640 + qflx_j23(k,i,j) - qflx_j23(k-1,i ,j) ) * rcdz(k) &
641 + ( qflx_hi(k,i,j,
xdir) - qflx_hi(k ,i-1,j ,
xdir) ) * rfdx(i) &
642 + ( qflx_hi(k,i,j,
ydir) - qflx_hi(k ,i ,j-1,
ydir) ) * rcdy(j) ) &
643 - ( j13g(k+1,i,j,
i_uyz) * ( dpres(k+1,i+1,j)+dpres(k+1,i,j) ) &
644 - j13g(k-1,i,j,
i_uyz) * ( dpres(k-1,i+1,j)+dpres(k-1,i,j) ) ) &
645 * 0.5_rp / ( fdz(k+1)+fdz(k) ) &
646 ) / gsqrt(k,i,j,
i_uyz) &
647 + 0.125_rp * ( corioli(1,i,j)+corioli(1,i+1,j) ) &
648 * ( momy(k,i,j)+momy(k,i+1,j)+momy(k,i,j-1)+momy(k,i+1,j-1) ) &
649 + divdmp_coef * rdt * ( ddiv(k,i+1,j)-ddiv(k,i,j) ) * fdx(i) &
655 k = iundef; i = iundef; j = iundef
663 gsqrt(:,:,:,
i_xvw), j33g, &
669 gsqrt(:,:,:,
i_xvz), j13g(:,:,:,
i_xvw), mapf(:,:,:,
i_xv), &
674 gsqrt(:,:,:,
i_xvz), j23g(:,:,:,
i_xvw), mapf(:,:,:,
i_xv), &
701 call check( __line__, qflx_hi(k ,i ,j ,
zdir) )
702 call check( __line__, qflx_hi(k-1,i ,j ,
zdir) )
703 call check( __line__, qflx_hi(k ,i ,j ,
xdir) )
704 call check( __line__, qflx_hi(k ,i-1,j ,
xdir) )
705 call check( __line__, qflx_hi(k ,i ,j ,
ydir) )
706 call check( __line__, qflx_hi(k ,i ,j-1,
ydir) )
707 call check( __line__, dpres(k+1,i,j ) )
708 call check( __line__, dpres(k+1,i,j+1) )
709 call check( __line__, dpres(k-1,i,j ) )
710 call check( __line__, dpres(k-1,i,j+1) )
711 call check( __line__, corioli(1,i,j ) )
712 call check( __line__, corioli(1,i,j+1) )
713 call check( __line__, momx(k,i ,j ) )
714 call check( __line__, momx(k,i ,j+1) )
715 call check( __line__, momx(k,i-1,j ) )
716 call check( __line__, momx(k,i-1,j+1) )
717 call check( __line__, ddiv(k,i,j+1) )
718 call check( __line__, ddiv(k,i,j ) )
719 call check( __line__, momy_t(k,i,j) )
722 ( - ( ( qflx_hi(k,i,j,
zdir) - qflx_hi(k-1,i ,j ,
zdir) &
723 + qflx_j13(k,i,j) - qflx_j13(k-1,i ,j ) &
724 + qflx_j23(k,i,j) - qflx_j23(k-1,i ,j ) ) * rcdz(k) &
725 + ( qflx_hi(k,i,j,
xdir) - qflx_hi(k ,i-1,j ,
xdir) ) * rcdx(i) &
726 + ( qflx_hi(k,i,j,
ydir) - qflx_hi(k ,i ,j-1,
ydir) ) * rfdy(j) ) &
727 - ( j23g(k+1,i,j,
i_xvz) * ( dpres(k+1,i,j+1)+dpres(k+1,i,j) ) &
728 - j23g(k-1,i,j,
i_xvz) * ( dpres(k-1,i,j+1)+dpres(k-1,i,j) ) ) &
729 * 0.5_rp / ( fdz(k+1)+fdz(k) ) &
730 ) / gsqrt(k,i,j,
i_xvz) &
731 - 0.125_rp * ( corioli(1,i ,j+1)+corioli(1,i ,j) ) &
732 * ( momx(k,i,j+1)+momx(k,i,j)+momx(k,i-1,j+1)+momx(k,i-1,j) ) &
733 + divdmp_coef * rdt * ( ddiv(k,i,j+1)-ddiv(k,i,j) ) * fdy(j) &
739 k = iundef; i = iundef; j = iundef
747 mflx_hi2(:,:,:,
zdir), pott, gsqrt(:,:,:,
i_xyw), &
754 mflx_hi2(:,:,:,
xdir), pott, gsqrt(:,:,:,
i_uyz), &
761 mflx_hi2(:,:,:,
ydir), pott, gsqrt(:,:,:,
i_xvz), &
771 call check( __line__, tflx_hi(k ,i ,j ,
zdir) )
772 call check( __line__, tflx_hi(k-1,i ,j ,
zdir) )
773 call check( __line__, tflx_hi(k ,i ,j ,
xdir) )
774 call check( __line__, tflx_hi(k ,i-1,j ,
xdir) )
775 call check( __line__, tflx_hi(k ,i ,j ,
ydir) )
776 call check( __line__, tflx_hi(k ,i ,j-1,
ydir) )
777 call check( __line__, rhot_t(k,i,j) )
780 - ( ( tflx_hi(k,i,j,
zdir) - tflx_hi(k-1,i ,j ,
zdir) ) * rcdz(k) &
781 + ( tflx_hi(k,i,j,
xdir) - tflx_hi(k ,i-1,j ,
xdir) ) * rcdx(i) &
782 + ( tflx_hi(k,i,j,
ydir) - tflx_hi(k ,i ,j-1,
ydir) ) * rcdy(j) &
783 ) / gsqrt(k,i,j,
i_xyz) &
789 k = iundef; i = iundef; j = iundef
802 call comm_vars8( su, 1 )
803 call comm_vars8( sv, 2 )
804 call comm_wait ( su, 1 )
805 call comm_wait ( sv, 2 )
816 call check( __line__, momz(k-1,i,j) )
817 call check( __line__, momz(k ,i,j) )
818 call check( __line__, momx(k,i-1,j) )
819 call check( __line__, momx(k,i ,j) )
820 call check( __line__, momy(k,i,j-1) )
821 call check( __line__, momy(k,i,j ) )
822 call check( __line__, pott(k-2,i,j) )
823 call check( __line__, pott(k-1,i,j) )
824 call check( __line__, pott(k ,i,j) )
825 call check( __line__, pott(k+1,i,j) )
826 call check( __line__, pott(k+2,i,j) )
827 call check( __line__, pott(k,i-2,j) )
828 call check( __line__, pott(k,i-1,j) )
829 call check( __line__, pott(k,i ,j) )
830 call check( __line__, pott(k,i+1,j) )
831 call check( __line__, pott(k,i+2,j) )
832 call check( __line__, pott(k,i,j-2) )
833 call check( __line__, pott(k,i,j-1) )
834 call check( __line__, pott(k,i,j ) )
835 call check( __line__, pott(k,i,j+1) )
836 call check( __line__, pott(k,i,j+2) )
837 call check( __line__, sw(k-1,i,j) )
838 call check( __line__, sw(k ,i,j) )
839 call check( __line__, su(k,i-1,j) )
840 call check( __line__, su(k,i ,j) )
841 call check( __line__, sv(k,i,j-1) )
842 call check( __line__, sv(k,i,j ) )
848 call check( __line__, st(k,i,j) )
849 call check( __line__, dpres(k-1,i,j) )
850 call check( __line__, dpres(k ,i,j) )
851 call check( __line__, dpres(k+1,i,j) )
852 call check( __line__, rt2p(k-1,i,j) )
853 call check( __line__, rt2p(k ,i,j) )
854 call check( __line__, rt2p(k+1,i,j) )
855 call check( __line__, rhot(k-1,i,j) )
856 call check( __line__, rhot(k+1,i,j) )
857 call check( __line__, ddens(k-1,i,j) )
858 call check( __line__, ddens(k+1,i,j) )
861 ( j33g * ( momz(k ,i,j) + dtrk*sw(k ,i,j) ) &
862 * ( fact_n*(pott(k+1,i,j)+pott(k ,i,j)) &
863 + fact_f*(pott(k+2,i,j)+pott(k-1,i,j)) ) &
864 - j33g * ( momz(k-1,i,j) + dtrk*sw(k-1,i,j) ) &
865 * ( fact_n*(pott(k ,i,j)+pott(k-1,i,j)) &
866 + fact_f*(pott(k+1,i,j)+pott(k-2,i,j)) ) ) * rcdz(k) &
867 + ( gsqrt(k,i ,j,
i_uyz) * ( momx(k,i ,j) + dtrk*su(k,i ,j) ) &
868 * ( fact_n*(pott(k,i+1,j)+pott(k,i ,j)) &
869 + fact_f*(pott(k,i+2,j)+pott(k,i-1,j)) ) &
870 - gsqrt(k,i-1,j,
i_uyz) * ( momx(k,i-1,j) + dtrk*su(k,i-1,j) ) &
871 * ( fact_n*(pott(k,i ,j)+pott(k,i-1,j)) &
872 + fact_f*(pott(k,i+1,j)+pott(k,i-2,j)) ) ) * rcdx(i) &
873 + ( gsqrt(k,i,j ,
i_xvz) * ( momy(k,i,j ) + dtrk*sv(k,i,j ) ) &
874 * ( fact_n*(pott(k,i,j+1)+pott(k,i,j )) &
875 + fact_f*(pott(k,i,j+2)+pott(k,i,j-1)) ) &
876 - gsqrt(k,i,j-1,
i_xvz) * ( momy(k,i,j-1) + dtrk*sv(k,i,j-1) ) &
877 * ( fact_n*(pott(k,i,j )+pott(k,i,j-1)) &
878 + fact_f*(pott(k,i,j+1)+pott(k,i,j-2)) ) ) * rcdy(j) &
879 + gsqrt(k,i,j,
i_xyz) * ( st(k,i,j) - dpres(k,i,j) * rcs2t(k,i,j) * rdt ) &
881 + grav * j33g * ( ( dpres(k+1,i,j)*rcs2t(k+1,i,j) &
882 - dpres(k-1,i,j)*rcs2t(k-1,i,j) ) &
883 - ( rhot(k+1,i,j)*ddens(k+1,i,j)/dens(k+1,i,j) &
884 - rhot(k-1,i,j)*ddens(k-1,i,j)/dens(k-1,i,j) ) &
885 ) / ( fdz(k) + fdz(k-1) )
890 k = iundef; i = iundef; j = iundef
895 call check( __line__, momz(
ks,i,j) )
896 call check( __line__, momx(
ks,i,j) )
897 call check( __line__, momy(
ks,i,j) )
898 call check( __line__, sw(
ks,i,j) )
899 call check( __line__, su(
ks,i-1,j) )
900 call check( __line__, su(
ks,i ,j) )
901 call check( __line__, sv(
ks,i,j-1) )
902 call check( __line__, sv(
ks,i,j ) )
903 call check( __line__, st(
ks,i,j) )
904 call check( __line__, pott(
ks ,i,j) )
905 call check( __line__, pott(
ks+1,i,j) )
906 call check( __line__, pott(
ks,i-2,j) )
907 call check( __line__, pott(
ks,i-1,j) )
908 call check( __line__, pott(
ks,i ,j) )
909 call check( __line__, pott(
ks,i+1,j) )
910 call check( __line__, pott(
ks,i+2,j) )
911 call check( __line__, pott(
ks,i,j-2) )
912 call check( __line__, pott(
ks,i,j-1) )
913 call check( __line__, pott(
ks,i,j ) )
914 call check( __line__, pott(
ks,i,j+1) )
915 call check( __line__, pott(
ks,i,j+2) )
919 call check( __line__, dpres(
ks ,i,j) )
920 call check( __line__, dpres(
ks+1,i,j) )
921 call check( __line__, rt2p(
ks ,i,j) )
922 call check( __line__, rt2p(
ks+1,i,j) )
923 call check( __line__, rhot(
ks+1,i,j) )
924 call check( __line__, ddens(
ks+1,i,j) )
927 ( j33g * ( momz(
ks ,i,j) + dtrk*sw(
ks ,i,j) ) &
928 * 0.5_rp*(pott(
ks+1,i,j)+pott(
ks ,i,j)) ) * rcdz(
ks) &
929 + ( gsqrt(
ks,i ,j,
i_uyz) * ( momx(
ks,i ,j) + dtrk*su(
ks,i ,j) ) &
930 * ( fact_n*(pott(
ks,i+1,j)+pott(
ks,i ,j)) &
931 + fact_f*(pott(
ks,i+2,j)+pott(
ks,i-1,j)) ) &
932 - gsqrt(
ks,i-1,j,
i_uyz) * ( momx(
ks,i-1,j) + dtrk*su(
ks,i-1,j) ) &
933 * ( fact_n*(pott(
ks,i ,j)+pott(
ks,i-1,j)) &
934 + fact_f*(pott(
ks,i+1,j)+pott(
ks,i-2,j)) ) ) * rcdx(i) &
935 + ( gsqrt(
ks,i,j ,
i_xvz) * ( momy(
ks,i,j ) + dtrk*sv(
ks,i,j ) ) &
936 * ( fact_n*(pott(
ks,i,j+1)+pott(
ks,i,j )) &
937 + fact_f*(pott(
ks,i,j+2)+pott(
ks,i,j-1)) ) &
938 - gsqrt(
ks,i,j-1,
i_xvz) * ( momy(
ks,i,j-1) + dtrk*sv(
ks,i,j-1) ) &
939 * ( fact_n*(pott(
ks,i,j )+pott(
ks,i,j-1)) &
940 + fact_f*(pott(
ks,i,j+1)+pott(
ks,i,j-2)) ) ) * rcdy(j) &
941 + gsqrt(
ks,i,j,
i_xyz) * ( st(
ks,i,j) - dpres(
ks,i,j) * rcs2t(
ks,i,j) * rdt ) &
943 + grav * j33g * 0.5_rp * ( ( dpres(
ks,i,j)+dpres(
ks+1,i,j) ) * rcs2t(
ks,i,j) &
944 - ( ddens(
ks,i,j)+ddens(
ks+1,i,j) ) * pott(
ks,i,j) ) * rcdz(
ks)
946 call check( __line__, momz(
ks ,i,j) )
947 call check( __line__, momz(
ks+1 ,i,j) )
948 call check( __line__, momx(
ks+1,i-1,j) )
949 call check( __line__, momx(
ks+1,i ,j) )
950 call check( __line__, momy(
ks+1,i,j-1) )
951 call check( __line__, momy(
ks+1,i,j ) )
952 call check( __line__, pott(
ks ,i,j) )
953 call check( __line__, pott(
ks+1 ,i,j) )
954 call check( __line__, pott(
ks+1+1,i,j) )
955 call check( __line__, pott(
ks+1+2,i,j) )
956 call check( __line__, pott(
ks+1,i-2,j) )
957 call check( __line__, pott(
ks+1,i-1,j) )
958 call check( __line__, pott(
ks+1,i ,j) )
959 call check( __line__, pott(
ks+1,i+1,j) )
960 call check( __line__, pott(
ks+1,i+2,j) )
961 call check( __line__, pott(
ks+1,i,j-2) )
962 call check( __line__, pott(
ks+1,i,j-1) )
963 call check( __line__, pott(
ks+1,i,j ) )
964 call check( __line__, pott(
ks+1,i,j+1) )
965 call check( __line__, pott(
ks+1,i,j+2) )
966 call check( __line__, sw(
ks ,i,j) )
967 call check( __line__, sw(
ks+1,i,j) )
968 call check( __line__, su(
ks+1,i-1,j) )
969 call check( __line__, su(
ks+1,i ,j) )
970 call check( __line__, sv(
ks+1,i,j-1) )
971 call check( __line__, sv(
ks+1,i,j ) )
977 call check( __line__, st(
ks+1,i,j) )
978 call check( __line__, dpres(
ks ,i,j) )
979 call check( __line__, dpres(
ks+1,i,j) )
980 call check( __line__, dpres(
ks+2,i,j) )
981 call check( __line__, rt2p(
ks ,i,j) )
982 call check( __line__, rt2p(
ks+1,i,j) )
983 call check( __line__, rt2p(
ks+2,i,j) )
984 call check( __line__, rhot(
ks ,i,j) )
985 call check( __line__, rhot(
ks+2,i,j) )
986 call check( __line__, ddens(
ks ,i,j) )
987 call check( __line__, ddens(
ks+2,i,j) )
990 ( j33g * ( momz(
ks+1,i,j) + dtrk*sw(
ks+1,i,j) ) &
991 * ( fact_n*(pott(
ks+2,i,j)+pott(
ks+1,i,j)) &
992 + fact_f*(pott(
ks+3,i,j)+pott(
ks ,i,j)) ) &
993 - j33g * ( momz(
ks+1-1,i,j) + dtrk*sw(
ks+1-1,i,j) ) &
994 * ( 0.5_rp*(pott(
ks+1,i,j)+pott(
ks,i,j)) ) ) * rcdz(
ks+1) &
995 + ( gsqrt(
ks+1,i ,j,
i_uyz) * ( momx(
ks+1,i ,j) + dtrk*su(
ks+1,i ,j) ) &
996 * ( fact_n*(pott(
ks+1,i+1,j)+pott(
ks+1,i ,j)) &
997 + fact_f*(pott(
ks+1,i+2,j)+pott(
ks+1,i-1,j)) ) &
998 - gsqrt(
ks+1,i-1,j,
i_uyz) * ( momx(
ks+1,i-1,j) + dtrk*su(
ks+1,i-1,j) ) &
999 * ( fact_n*(pott(
ks+1,i ,j)+pott(
ks+1,i-1,j)) &
1000 + fact_f*(pott(
ks+1,i+1,j)+pott(
ks+1,i-2,j)) ) ) * rcdx(i) &
1001 + ( gsqrt(
ks+1,i,j ,
i_xvz) * ( momy(
ks+1,i,j ) + dtrk*sv(
ks+1,i,j ) ) &
1002 * ( fact_n*(pott(
ks+1,i,j+1)+pott(
ks+1,i,j )) &
1003 + fact_f*(pott(
ks+1,i,j+2)+pott(
ks+1,i,j-1)) ) &
1004 - gsqrt(
ks+1,i,j-1,
i_xvz) * ( momy(
ks+1,i,j-1) + dtrk*sv(
ks+1,i,j-1) ) &
1005 * ( fact_n*(pott(
ks+1,i,j )+pott(
ks+1,i,j-1)) &
1006 + fact_f*(pott(
ks+1,i,j+1)+pott(
ks+1,i,j-2)) ) ) * rcdy(j) &
1007 + gsqrt(
ks+1,i,j,
i_xyz) * ( st(
ks+1,i,j) - dpres(
ks+1,i,j) * rcs2t(
ks+1,i,j) * rdt ) &
1009 + grav * j33g * ( ( dpres(
ks+2,i,j)*rcs2t(
ks+2,i,j) &
1010 - dpres(
ks ,i,j)*rcs2t(
ks ,i,j) ) &
1011 - ( rhot(
ks+2,i,j)*ddens(
ks+2,i,j)/dens(
ks+2,i,j) &
1012 - rhot(
ks ,i,j)*ddens(
ks ,i,j)/dens(
ks ,i,j) ) &
1013 ) / ( fdz(
ks+1) + fdz(
ks) )
1015 call check( __line__, momz(
ke-2,i,j) )
1016 call check( __line__, momz(
ke-1,i,j) )
1017 call check( __line__, momx(
ke-1,i-1,j) )
1018 call check( __line__, momx(
ke-1,i ,j) )
1019 call check( __line__, momy(
ke-1,i,j-1) )
1020 call check( __line__, momy(
ke-1,i,j ) )
1021 call check( __line__, pott(
ke-3,i,j) )
1022 call check( __line__, pott(
ke-2,i,j) )
1023 call check( __line__, pott(
ke-1,i,j) )
1024 call check( __line__, pott(
ke ,i,j) )
1025 call check( __line__, pott(
ke-1,i-2,j) )
1026 call check( __line__, pott(
ke-1,i-1,j) )
1027 call check( __line__, pott(
ke-1,i ,j) )
1028 call check( __line__, pott(
ke-1,i+1,j) )
1029 call check( __line__, pott(
ke-1,i+2,j) )
1030 call check( __line__, pott(
ke-1,i,j-2) )
1031 call check( __line__, pott(
ke-1,i,j-1) )
1032 call check( __line__, pott(
ke-1,i,j ) )
1033 call check( __line__, pott(
ke-1,i,j+1) )
1034 call check( __line__, pott(
ke-1,i,j+2) )
1035 call check( __line__, sw(
ke-2,i,j) )
1036 call check( __line__, sw(
ke-1,i,j) )
1037 call check( __line__, su(
ke-1,i-1,j) )
1038 call check( __line__, su(
ke-1,i ,j) )
1039 call check( __line__, sv(
ke-1,i,j-1) )
1040 call check( __line__, sv(
ke-1,i,j ) )
1046 call check( __line__, st(
ke-1,i,j) )
1047 call check( __line__, dpres(
ke-2,i,j) )
1048 call check( __line__, dpres(
ke-1,i,j) )
1049 call check( __line__, dpres(
ke ,i,j) )
1050 call check( __line__, rt2p(
ke-2,i,j) )
1051 call check( __line__, rt2p(
ke-1,i,j) )
1052 call check( __line__, rt2p(
ke ,i,j) )
1053 call check( __line__, rhot(
ke-2,i,j) )
1054 call check( __line__, rhot(
ke,i,j) )
1055 call check( __line__, ddens(
ke-2,i,j) )
1056 call check( __line__, ddens(
ke,i,j) )
1059 ( j33g * ( momz(
ke-1,i,j) + dtrk*sw(
ke-1,i,j) ) &
1060 * ( 0.5_rp*(pott(
ke ,i,j)+pott(
ke-1,i,j)) ) &
1061 - j33g * ( momz(
ke-2,i,j) + dtrk*sw(
ke-2,i,j) ) &
1062 * ( fact_n*(pott(
ke-1,i,j)+pott(
ke-2,i,j)) &
1063 + fact_f*(pott(
ke ,i,j)+pott(
ke-3,i,j)) ) ) * rcdz(
ke-1) &
1064 + ( gsqrt(
ke-1,i ,j,
i_uyz) * ( momx(
ke-1,i ,j) + dtrk*su(
ke-1,i ,j) ) &
1065 * ( fact_n*(pott(
ke-1,i+1,j)+pott(
ke-1,i ,j)) &
1066 + fact_f*(pott(
ke-1,i+2,j)+pott(
ke-1,i-1,j)) ) &
1067 - gsqrt(
ke-1,i-1,j,
i_uyz) * ( momx(
ke-1,i-1,j) + dtrk*su(
ke-1,i-1,j) ) &
1068 * ( fact_n*(pott(
ke-1,i ,j)+pott(
ke-1,i-1,j)) &
1069 + fact_f*(pott(
ke-1,i+1,j)+pott(
ke-1,i-2,j)) ) ) * rcdx(i) &
1070 + ( gsqrt(
ke-1,i,j ,
i_xvz) * ( momy(
ke-1,i,j ) + dtrk*sv(
ke-1,i,j ) ) &
1071 * ( fact_n*(pott(
ke-1,i,j+1)+pott(
ke-1,i,j )) &
1072 + fact_f*(pott(
ke-1,i,j+2)+pott(
ke-1,i,j-1)) ) &
1073 - gsqrt(
ke-1,i,j-1,
i_xvz) * ( momy(
ke-1,i,j-1) + dtrk*sv(
ke-1,i,j-1) ) &
1074 * ( fact_n*(pott(
ke-1,i,j )+pott(
ke-1,i,j-1)) &
1075 + fact_f*(pott(
ke-1,i,j+1)+pott(
ke-1,i,j-2)) ) ) * rcdy(j) &
1076 + gsqrt(
ke-1,i,j,
i_xyz) * ( st(
ke-1,i,j) - dpres(
ke-1,i,j) * rcs2t(
ke-1,i,j) * rdt ) &
1078 + grav * j33g * ( ( dpres(
ke ,i,j)*rcs2t(
ke ,i,j) &
1079 - dpres(
ke-2,i,j)*rcs2t(
ke-2,i,j) ) &
1080 - ( rhot(
ke ,i,j)*ddens(
ke ,i,j)/dens(
ke ,i,j) &
1081 - rhot(
ke-2,i,j)*ddens(
ke-2,i,j)/dens(
ke-2,i,j) )&
1082 ) / ( fdz(
ke-1) + fdz(
ke-1-1) )
1084 call check( __line__, momz(
ke-1,i,j) )
1085 call check( __line__, momx(
ke,i-1,j) )
1086 call check( __line__, momx(
ke,i ,j) )
1087 call check( __line__, momy(
ke,i,j-1) )
1088 call check( __line__, momy(
ke,i,j ) )
1089 call check( __line__, sw(
ke-1,i,j) )
1090 call check( __line__, su(
ke,i-1,j) )
1091 call check( __line__, su(
ke,i ,j) )
1092 call check( __line__, sv(
ke,i,j-1) )
1093 call check( __line__, sv(
ke,i,j ) )
1095 call check( __line__, pott(
ke-1,i,j) )
1096 call check( __line__, pott(
ke ,i,j) )
1097 call check( __line__, pott(
ke,i-2,j) )
1098 call check( __line__, pott(
ke,i-1,j) )
1099 call check( __line__, pott(
ke,i ,j) )
1100 call check( __line__, pott(
ke,i+1,j) )
1101 call check( __line__, pott(
ke,i+2,j) )
1102 call check( __line__, pott(
ke,i,j-2) )
1103 call check( __line__, pott(
ke,i,j-1) )
1104 call check( __line__, pott(
ke,i,j ) )
1105 call check( __line__, pott(
ke,i,j+1) )
1106 call check( __line__, pott(
ke,i,j+2) )
1112 call check( __line__, st(
ke,i,j) )
1113 call check( __line__, dpres(
ke-1,i,j) )
1114 call check( __line__, dpres(
ke ,i,j) )
1115 call check( __line__, rt2p(
ke-1,i,j) )
1116 call check( __line__, rt2p(
ke ,i,j) )
1117 call check( __line__, rhot(
ke-1,i,j) )
1118 call check( __line__, ddens(
ke-1,i,j) )
1122 - j33g * ( momz(
ke-1,i,j) + dtrk*sw(
ke-1,i,j) ) &
1123 * 0.5_rp*(pott(
ke ,i,j)+pott(
ke-1,i,j)) ) * rcdz(
ke) &
1124 + ( gsqrt(
ke,i ,j,
i_uyz) * ( momx(
ke,i ,j) + dtrk*su(
ke,i ,j) ) &
1125 * ( fact_n*(pott(
ke,i+1,j)+pott(
ke,i ,j)) &
1126 + fact_f*(pott(
ke,i+2,j)+pott(
ke,i-1,j)) ) &
1127 - gsqrt(
ke,i-1,j,
i_uyz) * ( momx(
ke,i-1,j) + dtrk*su(
ke,i-1,j) ) &
1128 * ( fact_n*(pott(
ke,i ,j)+pott(
ke,i-1,j)) &
1129 + fact_f*(pott(
ke,i+1,j)+pott(
ke,i-2,j)) ) ) * rcdx(i) &
1130 + ( gsqrt(
ke,i,j ,
i_xvz) * ( momy(
ke,i,j ) + dtrk*sv(
ke,i,j ) ) &
1131 * ( fact_n*(pott(
ke,i,j+1)+pott(
ke,i,j )) &
1132 + fact_f*(pott(
ke,i,j+2)+pott(
ke,i,j-1)) ) &
1133 - gsqrt(
ke,i,j-1,
i_xvz) * ( momy(
ke,i,j-1) + dtrk*sv(
ke,i,j-1) ) &
1134 * ( fact_n*(pott(
ke,i,j )+pott(
ke,i,j-1)) &
1135 + fact_f*(pott(
ke,i,j+1)+pott(
ke,i,j-2)) ) ) * rcdy(j) &
1136 + gsqrt(
ke,i,j,
i_xyz) * ( st(
ke,i,j) - dpres(
ke,i,j) * rcs2t(
ke,i,j) * rdt ) &
1138 + grav * j33g * 0.5_rp * ( - ( dpres(
ke,i,j)+dpres(
ke-1,i,j) ) * rcs2t(
ke,i,j) &
1139 + ( ddens(
ke,i,j)+ddens(
ke-1,i,j) ) * pott(
ke,i,j) ) * rcdz(
ke)
1143 k = iundef; i = iundef; j = iundef
1148 pott, rcs2t, grav, &
1150 rcdz, rfdz, rcdx, rfdx, rcdy,rfdy, fdz, &
1154 iis, iie, jjs, jje )
1164 call comm_vars8( dpres_n, 1 )
1165 call comm_wait ( dpres_n, 1 )
1168 call check_solver( dpres_n, m, b )
1173 call solve_multigrid
1190 call check( __line__, dpres_n(k+1,i,j) )
1191 call check( __line__, dpres_n(k ,i,j) )
1192 call check( __line__, dpres(k+1,i,j) )
1193 call check( __line__, dpres(k ,i,j) )
1194 call check( __line__, ddens(k+1,i,j) )
1195 call check( __line__, ddens(k ,i,j) )
1196 call check( __line__, ref_dens(k+1,i,j) )
1197 call check( __line__, ref_dens(k,i,j) )
1198 call check( __line__, momz0(k,i,j) )
1201 - j33g * ( dpres_n(k+1,i,j) - dpres_n(k,i,j) ) * rfdz(k) &
1202 ) / gsqrt(k,i,j,
i_uyz) &
1204 * ( ddens(k+1,i,j) &
1205 + ( dpres_n(k+1,i,j) - dpres(k+1,i,j) ) &
1206 / ( pott(k+1,i,j) * rt2p(k+1,i,j) ) &
1208 + ( dpres_n(k ,i,j) - dpres(k ,i,j) ) &
1209 / ( pott(k ,i,j) * rt2p(k ,i,j) ) ) &
1211 momz_rk(k,i,j) = momz0(k,i,j) + duvw
1212 mflx_hi(k,i,j,
zdir) = j33g * ( momz(k,i,j) + duvw )
1217 k = iundef; i = iundef; j = iundef
1221 mflx_hi(
ks-1,i,j,
zdir) = 0.0_rp
1222 mflx_hi(
ke ,i,j,
zdir) = 0.0_rp
1226 k = iundef; i = iundef; j = iundef
1238 call check( __line__, dpres_n(k,i+1,j) )
1239 call check( __line__, dpres_n(k,i ,j) )
1243 call check( __line__, su(k,i,j) )
1244 call check( __line__, momx0(k,i,j) )
1247 - ( gsqrt(k,i+1,j,
i_xyz) * dpres_n(k,i+1,j) &
1248 - gsqrt(k,i ,j,
i_xyz) * dpres_n(k,i ,j) ) * rfdx(i) &
1249 ) / gsqrt(k,i,j,
i_uyz) &
1252 momx_rk(k,i,j) = momx0(k,i,j) + duvw
1253 mflx_hi(k,i,j,
xdir) = gsqrt(k,i,j,
i_uyz) * ( momx(k,i,j) + duvw )
1258 k = iundef; i = iundef; j = iundef
1269 call check( __line__, dpres_n(k,i,j ) )
1270 call check( __line__, dpres_n(k,i,j+1) )
1274 call check( __line__, sv(k,i,j) )
1275 call check( __line__, momy0(k,i,j) )
1278 - ( gsqrt(k,i,j+1,
i_xyz) * dpres_n(k,i,j+1) &
1279 - gsqrt(k,i,j ,
i_xyz) * dpres_n(k,i,j ) ) * rfdy(j) &
1280 ) / gsqrt(k,i,j,
i_xvz) &
1282 momy_rk(k,i,j) = momy0(k,i,j) + duvw
1283 mflx_hi(k,i,j,
ydir) = gsqrt(k,i,j,
i_xvz) * ( momy(k,i,j) + duvw )
1288 k = iundef; i = iundef; j = iundef
1300 call check( __line__, mflx_hi(k,i,j,
zdir) )
1301 call check( __line__, pott(k,i-1,j) )
1302 call check( __line__, pott(k,i ,j) )
1303 call check( __line__, pott(k,i+1,j) )
1304 call check( __line__, pott(k,i+1,j) )
1307 tflx_hi(k,i,j,
zdir) = mflx_hi(k,i,j,
zdir) &
1308 * ( fact_n * ( pott(k+1,i,j) + pott(k ,i,j) ) &
1309 + fact_f * ( pott(k+2,i,j) + pott(k-1,i,j) ) )
1314 k = iundef; i = iundef; j = iundef
1319 tflx_hi(
ks-1,i,j,
zdir) = 0.0_rp
1320 tflx_hi(
ks ,i,j,
zdir) = mflx_hi(
ks ,i,j,
zdir) * 0.5_rp * ( pott(
ks+1,i,j) + pott(
ks ,i,j) )
1321 tflx_hi(
ke-1,i,j,
zdir) = mflx_hi(
ke-1,i,j,
zdir) * 0.5_rp * ( pott(
ke ,i,j) + pott(
ke-1,i,j) )
1322 tflx_hi(
ke ,i,j,
zdir) = 0.0_rp
1326 k = iundef; i = iundef; j = iundef
1334 call check( __line__, mflx_hi(k,i,j,
xdir) )
1335 call check( __line__, pott(k,i-1,j) )
1336 call check( __line__, pott(k,i ,j) )
1337 call check( __line__, pott(k,i+1,j) )
1338 call check( __line__, pott(k,i+1,j) )
1341 tflx_hi(k,i,j,
xdir) = mflx_hi(k,i,j,
xdir) &
1342 * ( fact_n * ( pott(k,i+1,j)+pott(k,i ,j) ) &
1343 + fact_f * ( pott(k,i+2,j)+pott(k,i-1,j) ) )
1348 k = iundef; i = iundef; j = iundef
1356 call check( __line__, mflx_hi(k,i,j,
ydir) )
1357 call check( __line__, pott(k,i,j-1) )
1358 call check( __line__, pott(k,i,j ) )
1359 call check( __line__, pott(k,i,j+1) )
1360 call check( __line__, pott(k,i,j+2) )
1363 tflx_hi(k,i,j,
ydir) = mflx_hi(k,i,j,
ydir) &
1364 * ( fact_n * ( pott(k,i,j+1)+pott(k,i,j ) ) &
1365 + fact_f * ( pott(k,i,j+2)+pott(k,i,j-1) ) )
1370 k = iundef; i = iundef; j = iundef
1377 rhot_rk(k,i,j) = rhot0(k,i,j) &
1378 + dtrk * ( - ( ( tflx_hi(k,i,j,
zdir) - tflx_hi(k-1,i ,j ,
zdir) ) * rcdz(k) &
1379 + ( tflx_hi(k,i,j,
xdir) - tflx_hi(k ,i-1,j ,
xdir) ) * rcdx(i) &
1380 + ( tflx_hi(k,i,j,
ydir) - tflx_hi(k ,i ,j-1,
ydir) ) * rcdy(j) ) &
1381 / gsqrt(k,i,j,
i_xyz) &
1393 mflx_hi(k,i,j,
zdir) = mflx_hi(k,i,j,
zdir) + mflx_hi2(k,i,j,
zdir)
1400 mflx_hi(k,i,j,
xdir) = mflx_hi(k,i,j,
xdir) + mflx_hi2(k,i,j,
xdir)
1407 mflx_hi(k,i,j,
ydir) = mflx_hi(k,i,j,
ydir) + mflx_hi2(k,i,j,
ydir)
1418 call check( __line__, dens0(k,i,j) )
1419 call check( __line__, mflx_hi(k ,i ,j ,
xdir) )
1420 call check( __line__, mflx_hi(k ,i-1,j ,
xdir) )
1421 call check( __line__, mflx_hi(k ,i ,j ,
ydir) )
1422 call check( __line__, mflx_hi(k ,i ,j-1,
ydir) )
1423 call check( __line__, dens_t(k,i,j) )
1425 dens_rk(k,i,j) = dens0(k,i,j) &
1426 + dtrk * ( - ( ( mflx_hi(k,i,j,
zdir)-mflx_hi(k-1,i ,j,
zdir) ) * rcdz(k) &
1427 + ( mflx_hi(k,i,j,
xdir)-mflx_hi(k ,i-1,j,
xdir) ) * rcdx(i) &
1428 + ( mflx_hi(k,i,j,
ydir)-mflx_hi(k ,i, j-1,
ydir) ) * rcdy(j) ) &
1429 / gsqrt(k,i,j,
i_xyz) &
1435 k = iundef; i = iundef; j = iundef
1441 dpres_n, dpres, rhot_rk, rhot, dens_rk, dens, b,&
1451 #ifdef HIVI_BICGSTAB 1463 real(RP),
intent(out) :: DPRES_N(
ka,
ia,
ja)
1464 real(RP),
intent(in) :: DPRES(
ka,
ia,
ja)
1465 real(RP),
intent(in) :: M(7,
ka,
ia,
ja)
1466 real(RP),
intent(in) :: B(
ka,
ia,
ja)
1474 real(RP) :: al, be, w
1476 real(RP),
pointer :: r(:,:,:)
1477 real(RP),
pointer :: rn(:,:,:)
1478 real(RP),
pointer :: swap(:,:,:)
1479 real(RP),
target :: v0(
ka,
ia,
ja)
1480 real(RP),
target :: v1(
ka,
ia,
ja)
1482 real(RP) :: norm, error, error2
1484 real(RP) :: iprod(2)
1488 integer :: iis, iie, jjs, jje
1506 call mul_matrix( v1, m, dpres )
1519 norm = norm + b(k,i,j)**2
1524 k = iundef; i = iundef; j = iundef
1532 call check( __line__, b(k,i,j) )
1533 call check( __line__, v1(k,i,j) )
1535 r(k,i,j) = b(k,i,j) - v1(k,i,j)
1540 k = iundef; i = iundef; j = iundef
1546 r0(k,i,j) = r(k,i,j)
1552 k = iundef; i = iundef; j = iundef
1559 call check( __line__, r(k,i,j) )
1560 call check( __line__, r0(k,i,j) )
1562 r0r = r0r + r0(k,i,j) * r(k,i,j)
1567 k = iundef; i = iundef; j = iundef
1576 dpres_n(k,i,j) = dpres(k,i,j)
1584 call mpi_allreduce(iprod, buf, 2, mtype, mpi_sum,
comm_world, ierror)
1597 call check( __line__, r(k,i,j) )
1599 error = error + r(k,i,j)**2
1604 k = iundef; i = iundef; j = iundef
1606 call mpi_allreduce(error, buf, 1, mtype, mpi_sum,
comm_world, ierror)
1610 if (
io_l)
write(*,*) iter, error/norm
1612 if ( sqrt(error/norm) < epsilon .OR. error > error2 )
then 1614 IF (
io_l )
write(*,*)
"Bi-CGSTAB converged:", iter
1620 call comm_vars8( p, 1 )
1621 call comm_wait ( p, 1 )
1622 call mul_matrix( mp, m, p )
1629 call check( __line__, r0(k,i,j) )
1630 call check( __line__, mp(k,i,j) )
1632 iprod(1) = iprod(1) + r0(k,i,j) * mp(k,i,j)
1637 k = iundef; i = iundef; j = iundef
1639 call mpi_allreduce(iprod, buf, 1, mtype, mpi_sum,
comm_world, ierror)
1646 call check( __line__, r(k,i,j) )
1647 call check( __line__, mp(k,i,j) )
1649 s(k,i,j) = r(k,i,j) - al*mp(k,i,j)
1654 k = iundef; i = iundef; j = iundef
1657 call comm_vars8( s, 1 )
1658 call comm_wait ( s, 1 )
1659 call mul_matrix( ms, m, s )
1666 call check( __line__, ms(k,i,j) )
1667 call check( __line__, s(k,i,j) )
1669 iprod(1) = iprod(1) + ms(k,i,j) * s(k,i,j)
1670 iprod(2) = iprod(2) + ms(k,i,j) * ms(k,i,j)
1675 k = iundef; i = iundef; j = iundef
1677 call mpi_allreduce(iprod, buf, 2, mtype, mpi_sum,
comm_world, ierror)
1691 call check( __line__, dpres_n(k,i,j) )
1692 call check( __line__, p(k,i,j) )
1693 call check( __line__, s(k,i,j) )
1695 dpres_n(k,i,j) = dpres_n(k,i,j) + al*p(k,i,j) + w*s(k,i,j)
1700 k = iundef; i = iundef; j = iundef
1707 call check( __line__, s(k,i,j) )
1708 call check( __line__, ms(k,i,j) )
1710 rn(k,i,j) = s(k,i,j) - w*ms(k,i,j)
1715 k = iundef; i = iundef; j = iundef
1722 call check( __line__, r0(k,i,j) )
1723 call check( __line__, rn(k,i,j) )
1725 iprod(1) = iprod(1) + r0(k,i,j) * rn(k,i,j)
1730 k = iundef; i = iundef; j = iundef
1738 call mpi_allreduce(iprod, r0r, 1, mtype, mpi_sum,
comm_world, ierror)
1745 call check( __line__, rn(k,i,j) )
1746 call check( __line__, p(k,i,j) )
1747 call check( __line__, mp(k,i,j) )
1749 p(k,i,j) = rn(k,i,j) + be * ( p(k,i,j) - w*mp(k,i,j) )
1754 k = iundef; i = iundef; j = iundef
1765 if ( iter >= itmax )
then 1766 write(*,*)
'xxx [atmos_dyn_hivi] Bi-CGSTAB' 1767 write(*,*)
'xxx not converged', error, norm
1776 POTT, RCs2T, GRAV, &
1778 RCDZ, RFDZ, RCDX, RFDX, RCDY, RFDY, FDZ, &
1782 IIS, IIE, JJS, JJE )
1784 real(RP),
intent(inout) :: M(7,
ka,
ia,
ja)
1785 real(RP),
intent(in) :: POTT(
ka,
ia,
ja)
1786 real(RP),
intent(in) :: RCs2T(
ka,
ia,
ja)
1787 real(RP),
intent(in) :: GRAV
1788 real(RP),
intent(in) :: G(
ka,
ia,
ja,7)
1789 real(RP),
intent(in) :: J33G
1790 real(RP),
intent(in) :: RCDZ(
ka)
1791 real(RP),
intent(in) :: RFDZ(
ka-1)
1792 real(RP),
intent(in) :: RFDX(
ia-1)
1793 real(RP),
intent(in) :: RCDX(
ia)
1794 real(RP),
intent(in) :: RCDY(
ja)
1795 real(RP),
intent(in) :: RFDY(
ja-1)
1796 real(RP),
intent(in) :: FDZ(
ka-1)
1797 real(RP),
intent(in) :: rdt
1798 real(RP),
intent(in) :: FACT_N
1799 real(RP),
intent(in) :: FACT_F
1800 integer,
intent(in) :: I_XYZ
1801 integer,
intent(in) :: I_XYW
1802 integer,
intent(in) :: IIS
1803 integer,
intent(in) :: IIE
1804 integer,
intent(in) :: JJS
1805 integer,
intent(in) :: JJE
1813 call check( __line__, pott(k-2,i,j) )
1814 call check( __line__, pott(k-1,i,j) )
1815 call check( __line__, pott(k ,i,j) )
1816 call check( __line__, pott(k+1,i,j) )
1817 call check( __line__, pott(k+2,i,j) )
1818 call check( __line__, pott(k,i-2,j) )
1819 call check( __line__, pott(k,i-1,j) )
1820 call check( __line__, pott(k,i ,j) )
1821 call check( __line__, pott(k,i+1,j) )
1822 call check( __line__, pott(k,i+2,j) )
1823 call check( __line__, pott(k,i,j-2) )
1824 call check( __line__, pott(k,i,j-1) )
1825 call check( __line__, pott(k,i,j ) )
1826 call check( __line__, pott(k,i,j+1) )
1827 call check( __line__, pott(k,i,j+2) )
1828 call check( __line__, g(k-1,i,j,i_xyw) )
1829 call check( __line__, g(k+1,i,j,i_xyw) )
1830 call check( __line__, g(k,i,j,i_xyz) )
1831 call check( __line__, rcs2t(k-1,i,j) )
1832 call check( __line__, rcs2t(k ,i,j) )
1833 call check( __line__, rcs2t(k+1,i,j) )
1837 - ( ( fact_n * (pott(k+1,i,j)+pott(k ,i,j)) &
1838 + fact_f * (pott(k+2,i,j)+pott(k-1,i,j)) ) * rfdz(k ) / g(k ,i,j,i_xyw) &
1839 + ( fact_n * (pott(k ,i,j)+pott(k-1,i,j)) &
1840 + fact_f * (pott(k+1,i,j)+pott(k-2,i,j)) ) * rfdz(k-1) / g(k-1,i,j,i_xyw) &
1841 ) * j33g * j33g * rfdz(k) &
1842 - ( ( fact_n * (pott(k,i+1,j)+pott(k,i ,j)) &
1843 + fact_f * (pott(k,i+2,j)+pott(k,i-1,j)) ) * rfdx(i ) &
1844 + ( fact_n * (pott(k,i ,j)+pott(k,i-1,j)) &
1845 + fact_f * (pott(k,i+1,j)+pott(k,i-2,j)) ) * rfdx(i-1) &
1846 ) * g(k,i,j,i_xyz) * rfdx(i) &
1847 - ( ( fact_n * (pott(k,i,j+1)+pott(k,i,j )) &
1848 + fact_f * (pott(k,i,j+2)+pott(k,i,j-1)) ) * rfdy(j ) &
1849 + ( fact_n * (pott(k,i,j )+pott(k,i,j-1)) &
1850 + fact_f * (pott(k,i,j-1)+pott(k,i,j-2)) ) * rfdy(j-1) &
1851 ) * g(k,i,j,i_xyz) * rfdy(j) &
1852 - g(k,i,j,i_xyz) * rcs2t(k,i,j) * rdt * rdt
1854 m(2,k,i,j) = j33g * j33g / g(k-1,i,j,i_xyw) &
1855 * ( fact_n * (pott(k ,i,j)+pott(k-1,i,j)) &
1856 + fact_f * (pott(k+1,i,j)+pott(k-2,i,j)) ) &
1857 * rfdz(k-1) * rcdz(k) &
1858 - grav * j33g * rcs2t(k-1,i,j) / ( fdz(k)+fdz(k-1) )
1860 m(3,k,i,j) = j33g * j33g / g(k+1,i,j,i_xyw) &
1861 * ( fact_n * (pott(k+1,i,j)+pott(k ,i,j)) &
1862 + fact_f * (pott(k+2,i,j)+pott(k-1,i,j)) ) &
1863 * rfdz(k ) * rcdz(k) &
1864 + grav * j33g * rcs2t(k+1,i,j) / ( fdz(k)+fdz(k-1) )
1869 k = iundef; i = iundef; j = iundef
1874 call check( __line__, pott(
ks ,i,j) )
1875 call check( __line__, pott(
ks+1,i,j) )
1876 call check( __line__, pott(
ks,i-2,j) )
1877 call check( __line__, pott(
ks,i-1,j) )
1878 call check( __line__, pott(
ks,i ,j) )
1879 call check( __line__, pott(
ks,i+1,j) )
1880 call check( __line__, pott(
ks,i+2,j) )
1881 call check( __line__, pott(
ks,i,j-2) )
1882 call check( __line__, pott(
ks,i,j-1) )
1883 call check( __line__, pott(
ks,i,j ) )
1884 call check( __line__, pott(
ks,i,j+1) )
1885 call check( __line__, pott(
ks,i,j+2) )
1886 call check( __line__, g(
ks,i,j,i_xyz) )
1887 call check( __line__, rcs2t(
ks,i,j) )
1888 call check( __line__, pott(
ks ,i,j) )
1889 call check( __line__, pott(
ks+1,i,j) )
1890 call check( __line__, g(
ks+1,i,j,i_xyw) )
1891 call check( __line__, rcs2t(
ks+1,i,j) )
1895 - ( 0.5_rp * (pott(
ks+1,i,j)+pott(
ks ,i,j)) * rfdz(
ks ) &
1896 ) * j33g * j33g / g(
ks ,i,j,i_xyw) * rfdz(
ks) &
1897 - ( ( fact_n * (pott(
ks,i+1,j)+pott(
ks,i ,j)) &
1898 + fact_f * (pott(
ks,i+2,j)+pott(
ks,i-1,j)) ) * rfdx(i ) &
1899 + ( fact_n * (pott(
ks,i ,j)+pott(
ks,i-1,j)) &
1900 + fact_f * (pott(
ks,i+1,j)+pott(
ks,i-2,j)) ) * rfdx(i-1) &
1901 ) * g(
ks,i,j,i_xyz) * rfdx(i) &
1902 - ( ( fact_n * (pott(
ks,i,j+1)+pott(
ks,i,j )) &
1903 + fact_f * (pott(
ks,i,j+2)+pott(
ks,i,j-1)) ) * rfdy(j ) &
1904 + ( fact_n * (pott(
ks,i,j )+pott(
ks,i,j-1)) &
1905 + fact_f * (pott(
ks,i,j-1)+pott(
ks,i,j-2)) ) * rfdy(j-1) &
1906 ) * g(
ks,i,j,i_xyz) * rfdy(j) &
1907 - g(
ks,i,j,i_xyz) * rcs2t(
ks,i,j) * rdt * rdt &
1908 + grav * j33g * 0.5_rp * rcs2t(
ks,i,j) * rcdz(
ks)
1910 m(3,
ks,i,j) = j33g * j33g / g(
ks+1,i,j,i_xyw) &
1911 * 0.5_rp * (pott(
ks+1,i,j)+pott(
ks ,i,j)) &
1912 * rfdz(
ks ) * rcdz(
ks) &
1913 + grav * j33g * 0.5_rp * rcs2t(
ks+1,i,j) * rcdz(
ks)
1915 call check( __line__, pott(
ks ,i,j) )
1916 call check( __line__, pott(
ks+1,i,j) )
1917 call check( __line__, pott(
ks+2,i,j) )
1918 call check( __line__, pott(
ks+3,i,j) )
1919 call check( __line__, pott(
ks+1,i-2,j) )
1920 call check( __line__, pott(
ks+1,i-1,j) )
1921 call check( __line__, pott(
ks+1,i ,j) )
1922 call check( __line__, pott(
ks+1,i+1,j) )
1923 call check( __line__, pott(
ks+1,i+2,j) )
1924 call check( __line__, pott(
ks+1,i,j-2) )
1925 call check( __line__, pott(
ks+1,i,j-1) )
1926 call check( __line__, pott(
ks+1,i,j ) )
1927 call check( __line__, pott(
ks+1,i,j+1) )
1928 call check( __line__, pott(
ks+1,i,j+2) )
1929 call check( __line__, g(
ks ,i,j,i_xyw) )
1930 call check( __line__, g(
ks+2,i,j,i_xyw) )
1931 call check( __line__, g(
ks+1,i,j,i_xyz) )
1932 call check( __line__, rcs2t(
ks ,i,j) )
1933 call check( __line__, rcs2t(
ks+1 ,i,j) )
1934 call check( __line__, rcs2t(
ks+2,i,j) )
1938 - ( ( fact_n * (pott(
ks+2,i,j)+pott(
ks+1,i,j)) &
1939 + fact_f * (pott(
ks+3,i,j)+pott(
ks ,i,j)) ) * rfdz(
ks+1) / g(
ks+1,i,j,i_xyw) &
1940 + 0.5_rp * (pott(
ks+1,i,j)+pott(
ks ,i,j)) * rfdz(
ks ) / g(
ks ,i,j,i_xyw) &
1941 ) * j33g * j33g * rfdz(
ks+1) &
1942 - ( ( fact_n * (pott(
ks+1,i+1,j)+pott(
ks+1,i ,j)) &
1943 + fact_f * (pott(
ks+1,i+2,j)+pott(
ks+1,i-1,j)) ) * rfdx(i ) &
1944 + ( fact_n * (pott(
ks+1,i ,j)+pott(
ks+1,i-1,j)) &
1945 + fact_f * (pott(
ks+1,i+1,j)+pott(
ks+1,i-2,j)) ) * rfdx(i-1) &
1946 ) * g(
ks+1,i,j,i_xyz) * rfdx(i) &
1947 - ( ( fact_n * (pott(
ks+1,i,j+1)+pott(
ks+1,i,j )) &
1948 + fact_f * (pott(
ks+1,i,j+2)+pott(
ks+1,i,j-1)) ) * rfdy(j ) &
1949 + ( fact_n * (pott(
ks+1,i,j )+pott(
ks+1,i,j-1)) &
1950 + fact_f * (pott(
ks+1,i,j-1)+pott(
ks+1,i,j-2)) ) * rfdy(j-1) &
1951 ) * g(
ks+1,i,j,i_xyz) * rfdy(j) &
1952 - g(
ks+1,i,j,i_xyz) * rcs2t(
ks+1,i,j) * rdt * rdt
1954 m(2,
ks+1,i,j) = j33g * j33g / g(
ks,i,j,i_xyw) &
1955 * 0.5_rp * (pott(
ks+1,i,j)+pott(
ks ,i,j)) &
1956 * rfdz(
ks ) * rcdz(
ks+1) &
1957 - grav * j33g * rcs2t(
ks ,i,j) / ( fdz(
ks+1)+fdz(
ks) )
1959 m(3,
ks+1,i,j) = j33g * j33g / g(
ks+2,i,j,i_xyw) &
1960 * ( fact_n * (pott(
ks+2,i,j)+pott(
ks+1,i,j)) &
1961 + fact_f * (pott(
ks+3,i,j)+pott(
ks ,i,j)) ) &
1962 * rfdz(
ks+1) * rcdz(
ks+1) &
1963 + grav * j33g * rcs2t(
ks+2,i,j) / ( fdz(
ks+1)+fdz(
ks) )
1965 call check( __line__, pott(
ke-3,i,j) )
1966 call check( __line__, pott(
ke-2,i,j) )
1967 call check( __line__, pott(
ke-1,i,j) )
1968 call check( __line__, pott(
ke ,i,j) )
1969 call check( __line__, pott(
ke-1,i-2,j) )
1970 call check( __line__, pott(
ke-1,i-1,j) )
1971 call check( __line__, pott(
ke-1,i ,j) )
1972 call check( __line__, pott(
ke-1,i+1,j) )
1973 call check( __line__, pott(
ke-1,i+2,j) )
1974 call check( __line__, pott(
ke-1,i,j-2) )
1975 call check( __line__, pott(
ke-1,i,j-1) )
1976 call check( __line__, pott(
ke-1,i,j ) )
1977 call check( __line__, pott(
ke-1,i,j+1) )
1978 call check( __line__, pott(
ke-1,i,j+2) )
1979 call check( __line__, g(
ke-2,i,j,i_xyw) )
1980 call check( __line__, g(
ke ,i,j,i_xyw) )
1981 call check( __line__, g(
ke-1,i,j,i_xyz) )
1982 call check( __line__, rcs2t(
ke-2,i,j) )
1983 call check( __line__, rcs2t(
ke-1,i,j) )
1984 call check( __line__, rcs2t(
ke ,i,j) )
1988 - ( 0.5_rp * (pott(
ke ,i,j)+pott(
ke-1,i,j)) * rfdz(
ke-1) / g(
ke-1,i,j,i_xyw) &
1989 + ( fact_n * (pott(
ke-1,i,j)+pott(
ke-2,i,j)) &
1990 + fact_f * (pott(
ke ,i,j)+pott(
ke-3,i,j)) ) * rfdz(
ke-2) / g(
ke-2,i,j,i_xyw) &
1991 ) * j33g * j33g * rfdz(
ke-1) &
1992 - ( ( fact_n * (pott(
ke-1,i+1,j)+pott(
ke-1,i ,j)) &
1993 + fact_f * (pott(
ke-1,i+2,j)+pott(
ke-1,i-1,j)) ) * rfdx(i ) &
1994 + ( fact_n * (pott(
ke-1,i ,j)+pott(
ke-1,i-1,j)) &
1995 + fact_f * (pott(
ke-1,i+1,j)+pott(
ke-1,i-2,j)) ) * rfdx(i-1) &
1996 ) * g(
ke-1,i,j,i_xyz) * rfdx(i) &
1997 - ( ( fact_n * (pott(
ke-1,i,j+1)+pott(
ke-1,i,j )) &
1998 + fact_f * (pott(
ke-1,i,j+2)+pott(
ke-1,i,j-1)) ) * rfdy(j ) &
1999 + ( fact_n * (pott(
ke-1,i,j )+pott(
ke-1,i,j-1)) &
2000 + fact_f * (pott(
ke-1,i,j-1)+pott(
ke-1,i,j-2)) ) * rfdy(j-1) &
2001 ) * g(
ke-1,i,j,i_xyz) * rfdy(j) &
2002 - g(
ke-1,i,j,i_xyz) * rcs2t(
ke-1,i,j) * rdt * rdt
2004 m(2,
ke-1,i,j) = j33g * j33g / g(
ke-2,i,j,i_xyw) &
2005 * ( fact_n * (pott(
ke-1,i,j)+pott(
ke-2,i,j)) &
2006 + fact_f * (pott(
ke ,i,j)+pott(
ke-3,i,j)) ) &
2007 * rfdz(
ke-2) * rcdz(
ke-1) &
2008 - grav * j33g * rcs2t(
ke-2,i,j) / ( fdz(
ke-1)+fdz(
ke-2) )
2010 m(3,
ke-1,i,j) = j33g * j33g / g(
ke ,i,j,i_xyw) &
2011 * 0.5_rp * (pott(
ke ,i,j)+pott(
ke-1,i,j)) &
2012 * rfdz(
ke-1) * rcdz(
ke-1) &
2013 + grav * j33g * rcs2t(
ke ,i,j) / ( fdz(
ke-1)+fdz(
ke-2) )
2015 call check( __line__, pott(
ke-1,i,j) )
2016 call check( __line__, pott(
ke ,i,j) )
2017 call check( __line__, pott(
ke,i-2,j) )
2018 call check( __line__, pott(
ke,i-1,j) )
2019 call check( __line__, pott(
ke,i ,j) )
2020 call check( __line__, pott(
ke,i+1,j) )
2021 call check( __line__, pott(
ke,i+2,j) )
2022 call check( __line__, pott(
ke,i,j-2) )
2023 call check( __line__, pott(
ke,i,j-1) )
2024 call check( __line__, pott(
ke,i,j ) )
2025 call check( __line__, pott(
ke,i,j+1) )
2026 call check( __line__, pott(
ke,i,j+2) )
2027 call check( __line__, g(
ke-1,i,j,i_xyw) )
2028 call check( __line__, g(
ke,i,j,i_xyz) )
2029 call check( __line__, rcs2t(
ke-1,i,j) )
2030 call check( __line__, rcs2t(
ke,i,j) )
2035 + 0.5_rp * (pott(
ke ,i,j)+pott(
ke-1,i,j)) * rfdz(
ke-1) / g(
ke-1,i,j,i_xyw) &
2036 ) * j33g * j33g * rfdz(
ke) &
2037 - ( ( fact_n * (pott(
ke,i+1,j)+pott(
ke,i ,j)) &
2038 + fact_f * (pott(
ke,i+2,j)+pott(
ke,i-1,j)) ) * rfdx(i ) &
2039 + ( fact_n * (pott(
ke,i ,j)+pott(
ke,i-1,j)) &
2040 + fact_f * (pott(
ke,i+1,j)+pott(
ke,i-2,j)) ) * rfdx(i-1) &
2041 ) * g(
ke,i,j,i_xyz) * rfdx(i) &
2042 - ( ( fact_n * (pott(
ke,i,j+1)+pott(
ke,i,j )) &
2043 + fact_f * (pott(
ke,i,j+2)+pott(
ke,i,j-1)) ) * rfdy(j ) &
2044 + ( fact_n * (pott(
ke,i,j )+pott(
ke,i,j-1)) &
2045 + fact_f * (pott(
ke,i,j-1)+pott(
ke,i,j-2)) ) * rfdy(j-1) &
2046 ) * g(
ke,i,j,i_xyz) * rfdy(j) &
2047 - g(
ke,i,j,i_xyz) * rcs2t(
ke,i,j) * rdt * rdt &
2048 - grav * j33g * 0.5_rp * rcs2t(
ke,i,j) * rcdz(
ke)
2050 m(2,
ke,i,j) = j33g * j33g / g(
ke-1,i,j,i_xyw) &
2051 * 0.5_rp * (pott(
ke ,i,j)+pott(
ke-1,i,j)) &
2052 * rfdz(
ke-1) * rcdz(
ke) &
2053 - grav * j33g * 0.5_rp * rcs2t(
ke,i,j) * rcdz(
ke)
2057 k = iundef; i = iundef; j = iundef
2064 call check( __line__, g(k,i-1,j,i_xyz) )
2065 call check( __line__, g(k,i+1,j,i_xyz) )
2066 call check( __line__, g(k,i,j-1,i_xyz) )
2067 call check( __line__, g(k,i,j+1,i_xyz) )
2068 call check( __line__, pott(k,i-2,j ) )
2069 call check( __line__, pott(k,i-1,j ) )
2070 call check( __line__, pott(k,i ,j ) )
2071 call check( __line__, pott(k,i+1,j ) )
2072 call check( __line__, pott(k,i+2,j ) )
2073 call check( __line__, pott(k,i ,j-2) )
2074 call check( __line__, pott(k,i ,j-1) )
2075 call check( __line__, pott(k,i ,j ) )
2076 call check( __line__, pott(k,i ,j+1) )
2077 call check( __line__, pott(k,i ,j+2) )
2080 m(4,k,i,j) = g(k,i-1,j,i_xyz) &
2081 * ( fact_n * (pott(k,i ,j)+pott(k,i-1,j)) &
2082 + fact_f * (pott(k,i+1,j)+pott(k,i-2,j)) ) &
2083 * rfdx(i-1) * rcdx(i)
2085 m(5,k,i,j) = g(k,i+1,j,i_xyz) &
2086 * ( fact_n * (pott(k,i+1,j)+pott(k,i ,j)) &
2087 + fact_f * (pott(k,i+2,j)+pott(k,i-1,j)) ) &
2088 * rfdx(i ) * rcdx(i)
2090 m(6,k,i,j) = g(k,i,j-1,i_xyz) &
2091 * ( fact_n * (pott(k,i,j )+pott(k,i,j-1)) &
2092 + fact_f * (pott(k,i,j+1)+pott(k,i,j-2)) ) &
2093 * rfdy(j-1) * rcdy(j)
2095 m(7,k,i,j) = g(k,i,j+1,i_xyz) &
2096 * ( fact_n * (pott(k,i,j+1)+pott(k,i,j )) &
2097 + fact_f * (pott(k,i,j+2)+pott(k,i,j-1)) ) &
2098 * rfdy(j ) * rcdy(j)
2103 k = iundef; i = iundef; j = iundef
2109 subroutine mul_matrix(V, M, C)
2111 real(RP),
intent(out) :: V(
ka,
ia,
ja)
2112 real(RP),
intent(in) :: M(7,
ka,
ia,
ja)
2113 real(RP),
intent(in) :: C(
ka,
ia,
ja)
2125 call check( __line__, m(1,k,i,j) )
2126 call check( __line__, m(2,k,i,j) )
2127 call check( __line__, m(3,k,i,j) )
2128 call check( __line__, m(4,k,i,j) )
2129 call check( __line__, m(5,k,i,j) )
2130 call check( __line__, m(6,k,i,j) )
2131 call check( __line__, m(7,k,i,j) )
2132 call check( __line__, c(k ,i ,j ) )
2133 call check( __line__, c(k-1,i ,j ) )
2134 call check( __line__, c(k+1,i ,j ) )
2135 call check( __line__, c(k ,i-1,j ) )
2136 call check( __line__, c(k ,i+1,j ) )
2137 call check( __line__, c(k ,i ,j-1) )
2138 call check( __line__, c(k ,i ,j+1) )
2140 v(k,i,j) = m(1,k,i,j) * c(k ,i ,j ) &
2141 + m(2,k,i,j) * c(k-1,i ,j ) &
2142 + m(3,k,i,j) * c(k+1,i ,j ) &
2143 + m(4,k,i,j) * c(k ,i-1,j ) &
2144 + m(5,k,i,j) * c(k ,i+1,j ) &
2145 + m(6,k,i,j) * c(k ,i ,j-1) &
2146 + m(7,k,i,j) * c(k ,i ,j+1)
2151 k = iundef; i = iundef; j = iundef
2156 call check( __line__, m(1,
ks,i,j) )
2157 call check( __line__, m(3,
ks,i,j) )
2158 call check( __line__, m(4,
ks,i,j) )
2159 call check( __line__, m(5,
ks,i,j) )
2160 call check( __line__, m(6,
ks,i,j) )
2161 call check( __line__, m(7,
ks,i,j) )
2162 call check( __line__, c(
ks ,i ,j ) )
2163 call check( __line__, c(
ks+1,i ,j ) )
2164 call check( __line__, c(
ks ,i-1,j ) )
2165 call check( __line__, c(
ks ,i+1,j ) )
2166 call check( __line__, c(
ks ,i ,j-1) )
2167 call check( __line__, c(
ks ,i ,j+1) )
2168 call check( __line__, m(1,
ke,i,j) )
2169 call check( __line__, m(2,
ke,i,j) )
2170 call check( __line__, m(4,
ke,i,j) )
2171 call check( __line__, m(5,
ke,i,j) )
2172 call check( __line__, m(6,
ke,i,j) )
2173 call check( __line__, m(7,
ke,i,j) )
2174 call check( __line__, c(
ke ,i ,j ) )
2175 call check( __line__, c(
ke-1,i ,j ) )
2176 call check( __line__, c(
ke ,i-1,j ) )
2177 call check( __line__, c(
ke ,i+1,j ) )
2178 call check( __line__, c(
ke ,i ,j-1) )
2179 call check( __line__, c(
ke ,i ,j+1) )
2181 v(
ks,i,j) = m(1,
ks,i,j) * c(
ks ,i ,j ) &
2182 + m(3,
ks,i,j) * c(
ks+1,i ,j ) &
2183 + m(4,
ks,i,j) * c(
ks ,i-1,j ) &
2184 + m(5,
ks,i,j) * c(
ks ,i+1,j ) &
2185 + m(6,
ks,i,j) * c(
ks ,i ,j-1) &
2186 + m(7,
ks,i,j) * c(
ks ,i ,j+1)
2187 v(
ke,i,j) = m(1,
ke,i,j) * c(
ke ,i ,j ) &
2188 + m(2,
ke,i,j) * c(
ke-1,i ,j ) &
2189 + m(4,
ke,i,j) * c(
ke ,i-1,j ) &
2190 + m(5,
ke,i,j) * c(
ke ,i+1,j ) &
2191 + m(6,
ke,i,j) * c(
ke ,i ,j-1) &
2192 + m(7,
ke,i,j) * c(
ke ,i ,j+1)
2196 k = iundef; i = iundef; j = iundef
2200 end subroutine mul_matrix
2203 subroutine solve_multigrid
2204 end subroutine solve_multigrid
2208 subroutine check_solver( &
2210 real(RP),
intent(in) :: DPRES(
ka,
ia,
ja)
2211 real(RP),
intent(in) :: M(7,
ka,
ia,
ja)
2212 real(RP),
intent(in) :: B(
ka,
ia,
ja)
2218 call mul_matrix(b2, m, dpres)
2223 err = abs( b2(k,i,j) - b(k,i,j) )
2224 if ( err > 1.e-5_rp .and. abs( err / b(k,i,j) ) > 1.e-5_rp )
then 2225 write(*,*)
"solver error is too large: ", k,i,j, b(k,i,j), b2(k,i,j)
2232 end subroutine check_solver
2234 subroutine check_pres( &
2240 real(RP),
intent(in) :: DPRES_N(
ka,
ia,
ja)
2241 real(RP),
intent(in) :: DPRES(
ka,
ia,
ja)
2242 real(RP),
intent(in) :: RHOT_RK(
ka,
ia,
ja)
2243 real(RP),
intent(in) :: RHOT(
ka,
ia,
ja)
2244 real(RP),
intent(in) :: DENS_RK(
ka,
ia,
ja)
2245 real(RP),
intent(in) :: DENS(
ka,
ia,
ja)
2246 real(RP),
intent(in) :: B(
ka,
ia,
ja)
2247 real(RP),
intent(in) :: RT2P(
ka,
ia,
ja)
2249 real(RP) :: lhs, rhs
2255 lhs = dpres_n(k,i,j) - dpres(k,i,j)
2256 rhs = rt2p(k,i,j) * ( rhot_rk(k,i,j) - rhot(k,i,j) )
2257 if ( abs( (lhs - rhs) / lhs ) > 1e-15 )
then 2259 write(*,*)
"error is too large: ", k,i,j, lhs, rhs, &
2260 dpres_n(k,i,j),dpres(k,i,j),rhot_rk(k,i,j),rhot(k,i,j),dens_rk(k,i,j),dens(k,i,j),b(k,i,j)
2266 end subroutine check_pres
integer, parameter, public i_rhot
integer, public is
start point of inner domain: x, local
integer, public je
end point of inner domain: y, local
subroutine, public prc_mpistop
Abort MPI.
procedure(flux_mom), pointer, public atmos_dyn_fvm_fluxx_xvz
procedure(flux_j), pointer, public atmos_dyn_fvm_fluxj23_uyz
integer, public iblock
block size for cache blocking: x
integer, parameter, public i_momx
logical, public io_l
output log or not? (this process)
integer, parameter, public zdir
integer, parameter, public i_momz
procedure(flux_j), pointer, public atmos_dyn_fvm_fluxj23_xyw
procedure(flux_phi), pointer, public atmos_dyn_fvm_fluxx_xyz
integer, parameter, public ydir
module Atmosphere / Dynamics RK
integer, public ke
end point of inner domain: z, local
procedure(flux_j), pointer, public atmos_dyn_fvm_fluxj13_xyw
integer, parameter, public xdir
subroutine, public atmos_dyn_tstep_short_fvm_hivi(DENS_RK, MOMZ_RK, MOMX_RK, MOMY_RK, RHOT_RK, PROG_RK, mflx_hi, tflx_hi, DENS0, MOMZ0, MOMX0, MOMY0, RHOT0, DENS, MOMZ, MOMX, MOMY, RHOT, DENS_t, MOMZ_t, MOMX_t, MOMY_t, RHOT_t, PROG0, PROG, DPRES0, RT2P, CORIOLI, num_diff, divdmp_coef, DDIV, FLAG_FCT_MOMENTUM, FLAG_FCT_T, FLAG_FCT_ALONG_STREAM, CDZ, FDZ, FDX, FDY, RCDZ, RCDX, RCDY, RFDZ, RFDX, RFDY, PHI, GSQRT, J13G, J23G, J33G, MAPF, REF_dens, REF_rhot, BND_W, BND_E, BND_S, BND_N, dtrk, dt)
subroutine, public atmos_dyn_tstep_short_fvm_hivi_regist(ATMOS_DYN_TYPE, VA_out, VAR_NAME, VAR_DESC, VAR_UNIT)
Register.
subroutine, public check(current_line, v)
Undefined value checker.
integer, parameter, public i_dens
integer, parameter, public i_momy
real(rp), public const_undef
procedure(flux_mom), pointer, public atmos_dyn_fvm_fluxx_xyw
procedure(flux_mom), pointer, public atmos_dyn_fvm_fluxy_xyw
integer, public ia
of x whole cells (local, with HALO)
procedure(flux_z), pointer, public atmos_dyn_fvm_fluxz_xvz
integer, public ka
of z whole cells (local, with HALO)
integer, parameter, public dp
subroutine solve_bicgstab(DPRES_N, DPRES, M, B)
real(rp), public const_pre00
pressure reference [Pa]
integer, public comm_world
communication world ID
integer, public jblock
block size for cache blocking: y
subroutine, public atmos_dyn_tstep_short_fvm_hivi_setup
Setup.
real(rp), public const_grav
standard acceleration of gravity [m/s2]
integer, public js
start point of inner domain: y, local
integer, parameter, public const_undef2
undefined value (INT2)
module Atmosphere / Dynamics common
procedure(valuew), pointer, public atmos_dyn_fvm_flux_valuew_z
integer, public ks
start point of inner domain: z, local
procedure(flux_j), pointer, public atmos_dyn_fvm_fluxj13_xvz
integer, parameter, public sp
integer, public ie
end point of inner domain: x, local
procedure(flux_z), pointer, public atmos_dyn_fvm_fluxz_uyz
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.
procedure(flux_j), pointer, public atmos_dyn_fvm_fluxj13_uyz
procedure(flux_j), pointer, public atmos_dyn_fvm_fluxj23_xvz
integer, public io_fid_conf
Config file ID.
integer, public io_fid_log
Log file ID.
subroutine make_matrix(M, POTT, RCs2T, GRAV, G, J33G, RCDZ, RFDZ, RCDX, RFDX, RCDY, RFDY, FDZ, rdt, FACT_N, FACT_F, I_XYZ, I_XYW, IIS, IIE, JJS, JJE)
integer, parameter, public rp
procedure(flux_phi), pointer, public atmos_dyn_fvm_fluxz_xyz
procedure(flux_mom), pointer, public atmos_dyn_fvm_fluxx_uyz
procedure(flux_phi), pointer, public atmos_dyn_fvm_fluxy_xyz
procedure(flux_mom), pointer, public atmos_dyn_fvm_fluxy_uyz
procedure(flux_wz), pointer, public atmos_dyn_fvm_fluxz_xyw
procedure(flux_mom), pointer, public atmos_dyn_fvm_fluxy_xvz
integer, public ja
of y whole cells (local, with HALO)