14 #define HIVI_BICGSTAB 1 28 #if defined DEBUG || defined QUICKDEBUG 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(:)
90 if ( atmos_dyn_type /=
'FVM-HIVI' .AND. atmos_dyn_type /=
'HIVI' )
then 91 log_error(
"ATMOS_DYN_Tstep_short_fvm_hivi_regist",*)
'ATMOS_DYN_TYPE is not FVM-HIVI. Check!' 101 log_info(
"ATMOS_DYN_Tstep_short_fvm_hivi_regist",*)
'Register additional prognostic variables (HIVI)' 102 if ( va_out < 1 )
then 103 log_info_cont(*)
'=> nothing.' 116 namelist / param_atmos_dyn_tstep_fvm_hivi / &
123 log_info(
"ATMOS_DYN_Tstep_short_fvm_hivi_setup",*)
'HIVI Setup' 125 log_info(
"ATMOS_DYN_Tstep_short_fvm_hivi_setup",*)
'USING Bi-CGSTAB' 127 log_info(
"ATMOS_DYN_Tstep_short_fvm_hivi_setup",*)
'USING Multi-Grid' 128 log_error(
"ATMOS_DYN_Tstep_short_fvm_hivi_setup",*)
'Not Implemented yet' 134 epsilon = 0.1_rp ** (
rp*2)
138 read(
io_fid_conf,nml=param_atmos_dyn_tstep_fvm_hivi,iostat=ierr)
141 log_info(
"ATMOS_DYN_Tstep_short_fvm_hivi_setup",*)
'Not found namelist. Default used.' 142 elseif( ierr > 0 )
then 143 log_error(
"ATMOS_DYN_Tstep_short_fvm_hivi_setup",*)
'Not appropriate names in namelist PARAM_ATMOS_DYN_TSTEP_FVM_HIVI. Check!' 146 log_nml(param_atmos_dyn_tstep_fvm_hivi)
149 mtype = mpi_double_precision
150 elseif(
rp ==
sp )
then 153 log_error(
"ATMOS_DYN_Tstep_short_fvm_hivi_setup",*)
'Unsupported precision' 162 DENS_RK, MOMZ_RK, MOMX_RK, MOMY_RK, RHOT_RK, &
165 DENS0, MOMZ0, MOMX0, MOMY0, RHOT0, &
166 DENS, MOMZ, MOMX, MOMY, RHOT, &
167 DENS_t, MOMZ_t, MOMX_t, MOMY_t, RHOT_t, &
169 DPRES0, RT2P, CORIOLI, &
170 num_diff, wdamp_coef, divdmp_coef, DDIV, &
171 FLAG_FCT_MOMENTUM, FLAG_FCT_T, &
172 FLAG_FCT_ALONG_STREAM, &
173 CDZ, FDZ, FDX, FDY, &
174 RCDZ, RCDX, RCDY, RFDZ, RFDX, RFDY, &
175 PHI, GSQRT, J13G, J23G, J33G, MAPF, &
176 REF_dens, REF_rhot, &
177 BND_W, BND_E, BND_S, BND_N, &
210 real(RP),
intent(out) :: DENS_RK(
ka,
ia,
ja)
211 real(RP),
intent(out) :: MOMZ_RK(
ka,
ia,
ja)
212 real(RP),
intent(out) :: MOMX_RK(
ka,
ia,
ja)
213 real(RP),
intent(out) :: MOMY_RK(
ka,
ia,
ja)
214 real(RP),
intent(out) :: RHOT_RK(
ka,
ia,
ja)
216 real(RP),
intent(out) :: PROG_RK(
ka,
ia,
ja,
va)
218 real(RP),
intent(inout) :: mflx_hi(
ka,
ia,
ja,3)
219 real(RP),
intent(out) :: tflx_hi(
ka,
ia,
ja,3)
221 real(RP),
intent(in),
target :: DENS0(
ka,
ia,
ja)
222 real(RP),
intent(in),
target :: MOMZ0(
ka,
ia,
ja)
223 real(RP),
intent(in),
target :: MOMX0(
ka,
ia,
ja)
224 real(RP),
intent(in),
target :: MOMY0(
ka,
ia,
ja)
225 real(RP),
intent(in),
target :: RHOT0(
ka,
ia,
ja)
227 real(RP),
intent(in) :: DENS(
ka,
ia,
ja)
228 real(RP),
intent(in) :: MOMZ(
ka,
ia,
ja)
229 real(RP),
intent(in) :: MOMX(
ka,
ia,
ja)
230 real(RP),
intent(in) :: MOMY(
ka,
ia,
ja)
231 real(RP),
intent(in) :: RHOT(
ka,
ia,
ja)
233 real(RP),
intent(in) :: DENS_t(
ka,
ia,
ja)
234 real(RP),
intent(in) :: MOMZ_t(
ka,
ia,
ja)
235 real(RP),
intent(in) :: MOMX_t(
ka,
ia,
ja)
236 real(RP),
intent(in) :: MOMY_t(
ka,
ia,
ja)
237 real(RP),
intent(in) :: RHOT_t(
ka,
ia,
ja)
239 real(RP),
intent(in) :: PROG0(
ka,
ia,
ja,
va)
240 real(RP),
intent(in) :: PROG (
ka,
ia,
ja,
va)
242 real(RP),
intent(in) :: DPRES0(
ka,
ia,
ja)
243 real(RP),
intent(in) :: RT2P(
ka,
ia,
ja)
244 real(RP),
intent(in) :: CORIOLI(1,
ia,
ja)
245 real(RP),
intent(in) :: num_diff(
ka,
ia,
ja,5,3)
246 real(RP),
intent(in) :: wdamp_coef(
ka)
247 real(RP),
intent(in) :: divdmp_coef
248 real(RP),
intent(in) :: DDIV(
ka,
ia,
ja)
250 logical,
intent(in) :: FLAG_FCT_MOMENTUM
251 logical,
intent(in) :: FLAG_FCT_T
252 logical,
intent(in) :: FLAG_FCT_ALONG_STREAM
254 real(RP),
intent(in) :: CDZ(
ka)
255 real(RP),
intent(in) :: FDZ(
ka-1)
256 real(RP),
intent(in) :: FDX(
ia-1)
257 real(RP),
intent(in) :: FDY(
ja-1)
258 real(RP),
intent(in) :: RCDZ(
ka)
259 real(RP),
intent(in) :: RCDX(
ia)
260 real(RP),
intent(in) :: RCDY(
ja)
261 real(RP),
intent(in) :: RFDZ(
ka-1)
262 real(RP),
intent(in) :: RFDX(
ia-1)
263 real(RP),
intent(in) :: RFDY(
ja-1)
265 real(RP),
intent(in) :: PHI (
ka,
ia,
ja)
266 real(RP),
intent(in) :: GSQRT (
ka,
ia,
ja,7)
267 real(RP),
intent(in) :: J13G (
ka,
ia,
ja,7)
268 real(RP),
intent(in) :: J23G (
ka,
ia,
ja,7)
269 real(RP),
intent(in) :: J33G
270 real(RP),
intent(in) :: MAPF (
ia,
ja,2,4)
271 real(RP),
intent(in) :: REF_dens(
ka,
ia,
ja)
272 real(RP),
intent(in) :: REF_rhot(
ka,
ia,
ja)
274 logical,
intent(in) :: BND_W
275 logical,
intent(in) :: BND_E
276 logical,
intent(in) :: BND_S
277 logical,
intent(in) :: BND_N
279 real(RP),
intent(in) :: dtrk
280 logical,
intent(in) :: last
284 real(RP) :: POTT(
ka,
ia,
ja)
285 real(RP) :: DDENS(
ka,
ia,
ja)
286 real(RP) :: DPRES(
ka,
ia,
ja)
287 real(RP) :: DPRES_N(
ka,
ia,
ja)
294 real(RP) :: RCs2T(
ka,
ia,
ja)
299 real(RP) :: qflx_hi (
ka,
ia,
ja,3)
300 real(RP) :: qflx_J13(
ka,
ia,
ja)
301 real(RP) :: qflx_J23(
ka,
ia,
ja)
302 real(RP) :: mflx_hi2(
ka,
ia,
ja,3)
309 real(RP) :: zero(
ka,
ia,
ja)
313 integer :: IIS, IIE, JJS, JJE
322 mflx_hi(:,:,:,:) = undef
323 mflx_hi(
ks-1,:,:,
zdir) = 0.0_rp
325 qflx_hi(:,:,:,:) = undef
326 tflx_hi(:,:,:,:) = undef
327 qflx_j13(:,:,:) = undef
328 qflx_j23(:,:,:) = undef
329 mflx_hi2(:,:,:,:) = undef
343 #if defined DEBUG || defined QUICKDEBUG 344 dens_rk( 1:
ks-1,:,:) = undef
345 dens_rk(
ke+1:
ka ,:,:) = undef
346 momz_rk( 1:
ks-1,:,:) = undef
347 momz_rk(
ke+1:
ka ,:,:) = undef
348 momx_rk( 1:
ks-1,:,:) = undef
349 momx_rk(
ke+1:
ka ,:,:) = undef
350 momy_rk( 1:
ks-1,:,:) = undef
351 momy_rk(
ke+1:
ka ,:,:) = undef
352 rhot_rk( 1:
ks-1,:,:) = undef
353 rhot_rk(
ke+1:
ka ,:,:) = undef
354 prog_rk( 1:
ks-1,:,:,:) = undef
355 prog_rk(
ke+1:
ka ,:,:,:) = undef
370 call check( __line__, dpres0(k,i,j) )
371 call check( __line__, rt2p(k,i,j) )
372 call check( __line__, rhot(k,i,j) )
373 call check( __line__, ref_rhot(k,i,j) )
375 dpres(k,i,j) = dpres0(k,i,j) + rt2p(k,i,j) * ( rhot(k,i,j) - ref_rhot(k,i,j) )
377 dpres(
ks-1,i,j) = dpres0(
ks-1,i,j) - dens(
ks,i,j) * ( phi(
ks-1,i,j) - phi(
ks+1,i,j) )
378 dpres(
ke+1,i,j) = dpres0(
ke+1,i,j) - dens(
ke,i,j) * ( phi(
ke+1,i,j) - phi(
ke-1,i,j) )
387 call check( __line__, dens(k,i,j) )
388 call check( __line__, ref_dens(k,i,j) )
390 ddens(k,i,j) = dens(k,i,j) - ref_dens(k,i,j)
400 call check( __line__, rhot(k,i,j) )
401 call check( __line__, dens(k,i,j) )
403 pott(k,i,j) = rhot(k,i,j) / dens(k,i,j)
408 k = iundef; i = iundef; j = iundef
416 call check( __line__, rt2p(k,i,j) )
418 rcs2t(k,i,j) = 1.0_rp / rt2p(k,i,j)
423 k = iundef; i = iundef; j = iundef
434 call check( __line__, momx(k+1,i ,j) )
435 call check( __line__, momx(k+1,i-1,j) )
436 call check( __line__, momx(k ,i ,j) )
437 call check( __line__, momx(k ,i+1,j) )
438 call check( __line__, momy(k+1,i,j) )
439 call check( __line__, momy(k+1,i,j-1) )
440 call check( __line__, momy(k ,i,j) )
441 call check( __line__, momy(k ,i,j-1) )
445 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) &
446 + momx(k ,i,j)+momx(k ,i-1,j) ) &
447 + j23g(k,i,j,
i_xyw) * 0.25_rp * ( momy(k+1,i,j)+momy(k+1,i,j-1) &
448 + momy(k ,i,j)+momy(k ,i,j-1) ) &
454 k = iundef; i = iundef; j = iundef
460 mflx_hi2(
ks-1,i,j,
zdir) = 0.0_rp
461 mflx_hi2(
ke ,i,j,
zdir) = 0.0_rp
474 mflx_hi2(k,i,j,
xdir) = gsqrt(k,i,j,
i_uyz) * num_diff(k,i,j,
i_dens,
xdir)
479 k = iundef; i = iundef; j = iundef
490 mflx_hi2(k,i,j,
ydir) = gsqrt(k,i,j,
i_xvz) * num_diff(k,i,j,
i_dens,
ydir)
495 k = iundef; i = iundef; j = iundef
504 gsqrt(:,:,:,
i_xyz), j33g, &
510 gsqrt(:,:,:,
i_xyz), j13g(:,:,:,
i_xyz), mapf(:,:,:,
i_xy), &
515 gsqrt(:,:,:,
i_xyz), j23g(:,:,:,
i_xyz), mapf(:,:,:,
i_xy), &
540 call check( __line__, qflx_hi(k ,i ,j ,
zdir) )
541 call check( __line__, qflx_hi(k-1,i ,j ,
zdir) )
542 call check( __line__, qflx_j13(k ,i ,j ) )
543 call check( __line__, qflx_j13(k-1,i ,j ) )
544 call check( __line__, qflx_j23(k ,i ,j ) )
545 call check( __line__, qflx_j23(k-1,i ,j ) )
546 call check( __line__, qflx_hi(k ,i ,j ,
xdir) )
547 call check( __line__, qflx_hi(k ,i-1,j ,
xdir) )
548 call check( __line__, qflx_hi(k ,i ,j ,
ydir) )
549 call check( __line__, qflx_hi(k ,i ,j-1,
ydir) )
550 call check( __line__, ddiv(k ,i,j) )
551 call check( __line__, ddiv(k+1,i,j) )
552 call check( __line__, momz0(k,i,j) )
553 call check( __line__, momz_t(k,i,j) )
556 - ( ( qflx_hi(k,i,j,
zdir) - qflx_hi(k-1,i ,j ,
zdir) &
557 + qflx_j13(k,i,j) - qflx_j13(k-1,i ,j ) &
558 + qflx_j23(k,i,j) - qflx_j23(k-1,i ,j ) ) * rfdz(k) &
559 + ( qflx_hi(k,i,j,
xdir) - qflx_hi(k ,i-1,j ,
xdir) ) * rcdx(i) &
560 + ( qflx_hi(k,i,j,
ydir) - qflx_hi(k ,i ,j-1,
ydir) ) * rcdy(j) &
561 ) / gsqrt(k,i,j,
i_xyw) &
562 - wdamp_coef(k) * momz0(k,i,j) &
563 + divdmp_coef * rdt * ( ddiv(k+1,i,j)-ddiv(k,i,j) ) * fdz(k) &
569 k = iundef; i = iundef; j = iundef
574 sw(
ks-1,i,j) = 0.0_rp
579 k = iundef; i = iundef; j = iundef
588 gsqrt(:,:,:,
i_uyw), j33g, &
594 gsqrt(:,:,:,
i_uyz), j13g(:,:,:,
i_uyw), mapf(:,:,:,
i_uy), &
599 gsqrt(:,:,:,
i_uyz), j23g(:,:,:,
i_uyw), mapf(:,:,:,
i_uy), &
626 call check( __line__, qflx_hi(k ,i ,j ,
zdir) )
627 call check( __line__, qflx_hi(k-1,i ,j ,
zdir) )
628 call check( __line__, qflx_hi(k ,i ,j ,
xdir) )
629 call check( __line__, qflx_hi(k ,i-1,j ,
xdir) )
630 call check( __line__, qflx_hi(k ,i ,j ,
ydir) )
631 call check( __line__, qflx_hi(k ,i ,j-1,
ydir) )
632 call check( __line__, dpres(k+1,i+1,j) )
633 call check( __line__, dpres(k+1,i ,j) )
634 call check( __line__, dpres(k-1,i+1,j) )
635 call check( __line__, dpres(k-1,i ,j) )
636 call check( __line__, corioli(1,i ,j) )
637 call check( __line__, corioli(1,i+1,j) )
638 call check( __line__, momy(k,i ,j ) )
639 call check( __line__, momy(k,i+1,j ) )
640 call check( __line__, momy(k,i ,j-1) )
641 call check( __line__, momy(k,i+1,j-1) )
642 call check( __line__, ddiv(k,i+1,j) )
643 call check( __line__, ddiv(k,i ,j) )
644 call check( __line__, momx0(k,i,j) )
647 - ( ( qflx_hi(k,i,j,
zdir) - qflx_hi(k-1,i ,j ,
zdir) &
648 + qflx_j13(k,i,j) - qflx_j13(k-1,i ,j) &
649 + qflx_j23(k,i,j) - qflx_j23(k-1,i ,j) ) * rcdz(k) &
650 + ( qflx_hi(k,i,j,
xdir) - qflx_hi(k ,i-1,j ,
xdir) ) * rfdx(i) &
651 + ( qflx_hi(k,i,j,
ydir) - qflx_hi(k ,i ,j-1,
ydir) ) * rcdy(j) ) &
652 - ( j13g(k+1,i,j,
i_uyz) * ( dpres(k+1,i+1,j)+dpres(k+1,i,j) ) &
653 - j13g(k-1,i,j,
i_uyz) * ( dpres(k-1,i+1,j)+dpres(k-1,i,j) ) ) &
654 * 0.5_rp / ( fdz(k+1)+fdz(k) ) &
655 ) / gsqrt(k,i,j,
i_uyz) &
656 + 0.125_rp * ( corioli(1,i,j)+corioli(1,i+1,j) ) &
657 * ( momy(k,i,j)+momy(k,i+1,j)+momy(k,i,j-1)+momy(k,i+1,j-1) ) &
658 + divdmp_coef * rdt * ( ddiv(k,i+1,j)-ddiv(k,i,j) ) * fdx(i) &
664 k = iundef; i = iundef; j = iundef
672 gsqrt(:,:,:,
i_xvw), j33g, &
678 gsqrt(:,:,:,
i_xvz), j13g(:,:,:,
i_xvw), mapf(:,:,:,
i_xv), &
683 gsqrt(:,:,:,
i_xvz), j23g(:,:,:,
i_xvw), mapf(:,:,:,
i_xv), &
710 call check( __line__, qflx_hi(k ,i ,j ,
zdir) )
711 call check( __line__, qflx_hi(k-1,i ,j ,
zdir) )
712 call check( __line__, qflx_hi(k ,i ,j ,
xdir) )
713 call check( __line__, qflx_hi(k ,i-1,j ,
xdir) )
714 call check( __line__, qflx_hi(k ,i ,j ,
ydir) )
715 call check( __line__, qflx_hi(k ,i ,j-1,
ydir) )
716 call check( __line__, dpres(k+1,i,j ) )
717 call check( __line__, dpres(k+1,i,j+1) )
718 call check( __line__, dpres(k-1,i,j ) )
719 call check( __line__, dpres(k-1,i,j+1) )
720 call check( __line__, corioli(1,i,j ) )
721 call check( __line__, corioli(1,i,j+1) )
722 call check( __line__, momx(k,i ,j ) )
723 call check( __line__, momx(k,i ,j+1) )
724 call check( __line__, momx(k,i-1,j ) )
725 call check( __line__, momx(k,i-1,j+1) )
726 call check( __line__, ddiv(k,i,j+1) )
727 call check( __line__, ddiv(k,i,j ) )
728 call check( __line__, momy_t(k,i,j) )
731 ( - ( ( qflx_hi(k,i,j,
zdir) - qflx_hi(k-1,i ,j ,
zdir) &
732 + qflx_j13(k,i,j) - qflx_j13(k-1,i ,j ) &
733 + qflx_j23(k,i,j) - qflx_j23(k-1,i ,j ) ) * rcdz(k) &
734 + ( qflx_hi(k,i,j,
xdir) - qflx_hi(k ,i-1,j ,
xdir) ) * rcdx(i) &
735 + ( qflx_hi(k,i,j,
ydir) - qflx_hi(k ,i ,j-1,
ydir) ) * rfdy(j) ) &
736 - ( j23g(k+1,i,j,
i_xvz) * ( dpres(k+1,i,j+1)+dpres(k+1,i,j) ) &
737 - j23g(k-1,i,j,
i_xvz) * ( dpres(k-1,i,j+1)+dpres(k-1,i,j) ) ) &
738 * 0.5_rp / ( fdz(k+1)+fdz(k) ) &
739 ) / gsqrt(k,i,j,
i_xvz) &
740 - 0.125_rp * ( corioli(1,i ,j+1)+corioli(1,i ,j) ) &
741 * ( momx(k,i,j+1)+momx(k,i,j)+momx(k,i-1,j+1)+momx(k,i-1,j) ) &
742 + divdmp_coef * rdt * ( ddiv(k,i,j+1)-ddiv(k,i,j) ) * fdy(j) &
748 k = iundef; i = iundef; j = iundef
756 mflx_hi2(:,:,:,
zdir), pott, gsqrt(:,:,:,
i_xyw), &
763 mflx_hi2(:,:,:,
xdir), pott, gsqrt(:,:,:,
i_uyz), &
770 mflx_hi2(:,:,:,
ydir), pott, gsqrt(:,:,:,
i_xvz), &
780 call check( __line__, tflx_hi(k ,i ,j ,
zdir) )
781 call check( __line__, tflx_hi(k-1,i ,j ,
zdir) )
782 call check( __line__, tflx_hi(k ,i ,j ,
xdir) )
783 call check( __line__, tflx_hi(k ,i-1,j ,
xdir) )
784 call check( __line__, tflx_hi(k ,i ,j ,
ydir) )
785 call check( __line__, tflx_hi(k ,i ,j-1,
ydir) )
786 call check( __line__, rhot_t(k,i,j) )
789 - ( ( tflx_hi(k,i,j,
zdir) - tflx_hi(k-1,i ,j ,
zdir) ) * rcdz(k) &
790 + ( tflx_hi(k,i,j,
xdir) - tflx_hi(k ,i-1,j ,
xdir) ) * rcdx(i) &
791 + ( tflx_hi(k,i,j,
ydir) - tflx_hi(k ,i ,j-1,
ydir) ) * rcdy(j) &
792 ) / gsqrt(k,i,j,
i_xyz) &
798 k = iundef; i = iundef; j = iundef
811 call comm_vars8( su, 1 )
812 call comm_vars8( sv, 2 )
813 call comm_wait ( su, 1 )
814 call comm_wait ( sv, 2 )
825 call check( __line__, momz(k-1,i,j) )
826 call check( __line__, momz(k ,i,j) )
827 call check( __line__, momx(k,i-1,j) )
828 call check( __line__, momx(k,i ,j) )
829 call check( __line__, momy(k,i,j-1) )
830 call check( __line__, momy(k,i,j ) )
831 call check( __line__, pott(k-2,i,j) )
832 call check( __line__, pott(k-1,i,j) )
833 call check( __line__, pott(k ,i,j) )
834 call check( __line__, pott(k+1,i,j) )
835 call check( __line__, pott(k+2,i,j) )
836 call check( __line__, pott(k,i-2,j) )
837 call check( __line__, pott(k,i-1,j) )
838 call check( __line__, pott(k,i ,j) )
839 call check( __line__, pott(k,i+1,j) )
840 call check( __line__, pott(k,i+2,j) )
841 call check( __line__, pott(k,i,j-2) )
842 call check( __line__, pott(k,i,j-1) )
843 call check( __line__, pott(k,i,j ) )
844 call check( __line__, pott(k,i,j+1) )
845 call check( __line__, pott(k,i,j+2) )
846 call check( __line__, sw(k-1,i,j) )
847 call check( __line__, sw(k ,i,j) )
848 call check( __line__, su(k,i-1,j) )
849 call check( __line__, su(k,i ,j) )
850 call check( __line__, sv(k,i,j-1) )
851 call check( __line__, sv(k,i,j ) )
857 call check( __line__, st(k,i,j) )
858 call check( __line__, dpres(k-1,i,j) )
859 call check( __line__, dpres(k ,i,j) )
860 call check( __line__, dpres(k+1,i,j) )
861 call check( __line__, rt2p(k-1,i,j) )
862 call check( __line__, rt2p(k ,i,j) )
863 call check( __line__, rt2p(k+1,i,j) )
864 call check( __line__, rhot(k-1,i,j) )
865 call check( __line__, rhot(k+1,i,j) )
866 call check( __line__, ddens(k-1,i,j) )
867 call check( __line__, ddens(k+1,i,j) )
870 ( j33g * ( momz(k ,i,j) + dtrk*sw(k ,i,j) ) &
871 * ( fact_n*(pott(k+1,i,j)+pott(k ,i,j)) &
872 + fact_f*(pott(k+2,i,j)+pott(k-1,i,j)) ) &
873 - j33g * ( momz(k-1,i,j) + dtrk*sw(k-1,i,j) ) &
874 * ( fact_n*(pott(k ,i,j)+pott(k-1,i,j)) &
875 + fact_f*(pott(k+1,i,j)+pott(k-2,i,j)) ) ) * rcdz(k) &
876 + ( gsqrt(k,i ,j,
i_uyz) * ( momx(k,i ,j) + dtrk*su(k,i ,j) ) &
877 * ( fact_n*(pott(k,i+1,j)+pott(k,i ,j)) &
878 + fact_f*(pott(k,i+2,j)+pott(k,i-1,j)) ) &
879 - gsqrt(k,i-1,j,
i_uyz) * ( momx(k,i-1,j) + dtrk*su(k,i-1,j) ) &
880 * ( fact_n*(pott(k,i ,j)+pott(k,i-1,j)) &
881 + fact_f*(pott(k,i+1,j)+pott(k,i-2,j)) ) ) * rcdx(i) &
882 + ( gsqrt(k,i,j ,
i_xvz) * ( momy(k,i,j ) + dtrk*sv(k,i,j ) ) &
883 * ( fact_n*(pott(k,i,j+1)+pott(k,i,j )) &
884 + fact_f*(pott(k,i,j+2)+pott(k,i,j-1)) ) &
885 - gsqrt(k,i,j-1,
i_xvz) * ( momy(k,i,j-1) + dtrk*sv(k,i,j-1) ) &
886 * ( fact_n*(pott(k,i,j )+pott(k,i,j-1)) &
887 + fact_f*(pott(k,i,j+1)+pott(k,i,j-2)) ) ) * rcdy(j) &
888 + gsqrt(k,i,j,
i_xyz) * ( st(k,i,j) - dpres(k,i,j) * rcs2t(k,i,j) * rdt ) &
890 + grav * j33g * ( ( dpres(k+1,i,j)*rcs2t(k+1,i,j) &
891 - dpres(k-1,i,j)*rcs2t(k-1,i,j) ) &
892 - ( rhot(k+1,i,j)*ddens(k+1,i,j)/dens(k+1,i,j) &
893 - rhot(k-1,i,j)*ddens(k-1,i,j)/dens(k-1,i,j) ) &
894 ) / ( fdz(k) + fdz(k-1) )
899 k = iundef; i = iundef; j = iundef
904 call check( __line__, momz(
ks,i,j) )
905 call check( __line__, momx(
ks,i,j) )
906 call check( __line__, momy(
ks,i,j) )
907 call check( __line__, sw(
ks,i,j) )
908 call check( __line__, su(
ks,i-1,j) )
909 call check( __line__, su(
ks,i ,j) )
910 call check( __line__, sv(
ks,i,j-1) )
911 call check( __line__, sv(
ks,i,j ) )
912 call check( __line__, st(
ks,i,j) )
913 call check( __line__, pott(
ks ,i,j) )
914 call check( __line__, pott(
ks+1,i,j) )
915 call check( __line__, pott(
ks,i-2,j) )
916 call check( __line__, pott(
ks,i-1,j) )
917 call check( __line__, pott(
ks,i ,j) )
918 call check( __line__, pott(
ks,i+1,j) )
919 call check( __line__, pott(
ks,i+2,j) )
920 call check( __line__, pott(
ks,i,j-2) )
921 call check( __line__, pott(
ks,i,j-1) )
922 call check( __line__, pott(
ks,i,j ) )
923 call check( __line__, pott(
ks,i,j+1) )
924 call check( __line__, pott(
ks,i,j+2) )
928 call check( __line__, dpres(
ks ,i,j) )
929 call check( __line__, dpres(
ks+1,i,j) )
930 call check( __line__, rt2p(
ks ,i,j) )
931 call check( __line__, rt2p(
ks+1,i,j) )
932 call check( __line__, rhot(
ks+1,i,j) )
933 call check( __line__, ddens(
ks+1,i,j) )
936 ( j33g * ( momz(
ks ,i,j) + dtrk*sw(
ks ,i,j) ) &
937 * 0.5_rp*(pott(
ks+1,i,j)+pott(
ks ,i,j)) ) * rcdz(
ks) &
938 + ( gsqrt(
ks,i ,j,
i_uyz) * ( momx(
ks,i ,j) + dtrk*su(
ks,i ,j) ) &
939 * ( fact_n*(pott(
ks,i+1,j)+pott(
ks,i ,j)) &
940 + fact_f*(pott(
ks,i+2,j)+pott(
ks,i-1,j)) ) &
941 - gsqrt(
ks,i-1,j,
i_uyz) * ( momx(
ks,i-1,j) + dtrk*su(
ks,i-1,j) ) &
942 * ( fact_n*(pott(
ks,i ,j)+pott(
ks,i-1,j)) &
943 + fact_f*(pott(
ks,i+1,j)+pott(
ks,i-2,j)) ) ) * rcdx(i) &
944 + ( gsqrt(
ks,i,j ,
i_xvz) * ( momy(
ks,i,j ) + dtrk*sv(
ks,i,j ) ) &
945 * ( fact_n*(pott(
ks,i,j+1)+pott(
ks,i,j )) &
946 + fact_f*(pott(
ks,i,j+2)+pott(
ks,i,j-1)) ) &
947 - gsqrt(
ks,i,j-1,
i_xvz) * ( momy(
ks,i,j-1) + dtrk*sv(
ks,i,j-1) ) &
948 * ( fact_n*(pott(
ks,i,j )+pott(
ks,i,j-1)) &
949 + fact_f*(pott(
ks,i,j+1)+pott(
ks,i,j-2)) ) ) * rcdy(j) &
950 + gsqrt(
ks,i,j,
i_xyz) * ( st(
ks,i,j) - dpres(
ks,i,j) * rcs2t(
ks,i,j) * rdt ) &
952 + grav * j33g * 0.5_rp * ( ( dpres(
ks,i,j)+dpres(
ks+1,i,j) ) * rcs2t(
ks,i,j) &
953 - ( ddens(
ks,i,j)+ddens(
ks+1,i,j) ) * pott(
ks,i,j) ) * rcdz(
ks)
955 call check( __line__, momz(
ks ,i,j) )
956 call check( __line__, momz(
ks+1 ,i,j) )
957 call check( __line__, momx(
ks+1,i-1,j) )
958 call check( __line__, momx(
ks+1,i ,j) )
959 call check( __line__, momy(
ks+1,i,j-1) )
960 call check( __line__, momy(
ks+1,i,j ) )
961 call check( __line__, pott(
ks ,i,j) )
962 call check( __line__, pott(
ks+1 ,i,j) )
963 call check( __line__, pott(
ks+1+1,i,j) )
964 call check( __line__, pott(
ks+1+2,i,j) )
965 call check( __line__, pott(
ks+1,i-2,j) )
966 call check( __line__, pott(
ks+1,i-1,j) )
967 call check( __line__, pott(
ks+1,i ,j) )
968 call check( __line__, pott(
ks+1,i+1,j) )
969 call check( __line__, pott(
ks+1,i+2,j) )
970 call check( __line__, pott(
ks+1,i,j-2) )
971 call check( __line__, pott(
ks+1,i,j-1) )
972 call check( __line__, pott(
ks+1,i,j ) )
973 call check( __line__, pott(
ks+1,i,j+1) )
974 call check( __line__, pott(
ks+1,i,j+2) )
975 call check( __line__, sw(
ks ,i,j) )
976 call check( __line__, sw(
ks+1,i,j) )
977 call check( __line__, su(
ks+1,i-1,j) )
978 call check( __line__, su(
ks+1,i ,j) )
979 call check( __line__, sv(
ks+1,i,j-1) )
980 call check( __line__, sv(
ks+1,i,j ) )
986 call check( __line__, st(
ks+1,i,j) )
987 call check( __line__, dpres(
ks ,i,j) )
988 call check( __line__, dpres(
ks+1,i,j) )
989 call check( __line__, dpres(
ks+2,i,j) )
990 call check( __line__, rt2p(
ks ,i,j) )
991 call check( __line__, rt2p(
ks+1,i,j) )
992 call check( __line__, rt2p(
ks+2,i,j) )
993 call check( __line__, rhot(
ks ,i,j) )
994 call check( __line__, rhot(
ks+2,i,j) )
995 call check( __line__, ddens(
ks ,i,j) )
996 call check( __line__, ddens(
ks+2,i,j) )
999 ( j33g * ( momz(
ks+1,i,j) + dtrk*sw(
ks+1,i,j) ) &
1000 * ( fact_n*(pott(
ks+2,i,j)+pott(
ks+1,i,j)) &
1001 + fact_f*(pott(
ks+3,i,j)+pott(
ks ,i,j)) ) &
1002 - j33g * ( momz(
ks+1-1,i,j) + dtrk*sw(
ks+1-1,i,j) ) &
1003 * ( 0.5_rp*(pott(
ks+1,i,j)+pott(
ks,i,j)) ) ) * rcdz(
ks+1) &
1004 + ( gsqrt(
ks+1,i ,j,
i_uyz) * ( momx(
ks+1,i ,j) + dtrk*su(
ks+1,i ,j) ) &
1005 * ( fact_n*(pott(
ks+1,i+1,j)+pott(
ks+1,i ,j)) &
1006 + fact_f*(pott(
ks+1,i+2,j)+pott(
ks+1,i-1,j)) ) &
1007 - gsqrt(
ks+1,i-1,j,
i_uyz) * ( momx(
ks+1,i-1,j) + dtrk*su(
ks+1,i-1,j) ) &
1008 * ( fact_n*(pott(
ks+1,i ,j)+pott(
ks+1,i-1,j)) &
1009 + fact_f*(pott(
ks+1,i+1,j)+pott(
ks+1,i-2,j)) ) ) * rcdx(i) &
1010 + ( gsqrt(
ks+1,i,j ,
i_xvz) * ( momy(
ks+1,i,j ) + dtrk*sv(
ks+1,i,j ) ) &
1011 * ( fact_n*(pott(
ks+1,i,j+1)+pott(
ks+1,i,j )) &
1012 + fact_f*(pott(
ks+1,i,j+2)+pott(
ks+1,i,j-1)) ) &
1013 - gsqrt(
ks+1,i,j-1,
i_xvz) * ( momy(
ks+1,i,j-1) + dtrk*sv(
ks+1,i,j-1) ) &
1014 * ( fact_n*(pott(
ks+1,i,j )+pott(
ks+1,i,j-1)) &
1015 + fact_f*(pott(
ks+1,i,j+1)+pott(
ks+1,i,j-2)) ) ) * rcdy(j) &
1016 + gsqrt(
ks+1,i,j,
i_xyz) * ( st(
ks+1,i,j) - dpres(
ks+1,i,j) * rcs2t(
ks+1,i,j) * rdt ) &
1018 + grav * j33g * ( ( dpres(
ks+2,i,j)*rcs2t(
ks+2,i,j) &
1019 - dpres(
ks ,i,j)*rcs2t(
ks ,i,j) ) &
1020 - ( rhot(
ks+2,i,j)*ddens(
ks+2,i,j)/dens(
ks+2,i,j) &
1021 - rhot(
ks ,i,j)*ddens(
ks ,i,j)/dens(
ks ,i,j) ) &
1022 ) / ( fdz(
ks+1) + fdz(
ks) )
1024 call check( __line__, momz(
ke-2,i,j) )
1025 call check( __line__, momz(
ke-1,i,j) )
1026 call check( __line__, momx(
ke-1,i-1,j) )
1027 call check( __line__, momx(
ke-1,i ,j) )
1028 call check( __line__, momy(
ke-1,i,j-1) )
1029 call check( __line__, momy(
ke-1,i,j ) )
1030 call check( __line__, pott(
ke-3,i,j) )
1031 call check( __line__, pott(
ke-2,i,j) )
1032 call check( __line__, pott(
ke-1,i,j) )
1033 call check( __line__, pott(
ke ,i,j) )
1034 call check( __line__, pott(
ke-1,i-2,j) )
1035 call check( __line__, pott(
ke-1,i-1,j) )
1036 call check( __line__, pott(
ke-1,i ,j) )
1037 call check( __line__, pott(
ke-1,i+1,j) )
1038 call check( __line__, pott(
ke-1,i+2,j) )
1039 call check( __line__, pott(
ke-1,i,j-2) )
1040 call check( __line__, pott(
ke-1,i,j-1) )
1041 call check( __line__, pott(
ke-1,i,j ) )
1042 call check( __line__, pott(
ke-1,i,j+1) )
1043 call check( __line__, pott(
ke-1,i,j+2) )
1044 call check( __line__, sw(
ke-2,i,j) )
1045 call check( __line__, sw(
ke-1,i,j) )
1046 call check( __line__, su(
ke-1,i-1,j) )
1047 call check( __line__, su(
ke-1,i ,j) )
1048 call check( __line__, sv(
ke-1,i,j-1) )
1049 call check( __line__, sv(
ke-1,i,j ) )
1055 call check( __line__, st(
ke-1,i,j) )
1056 call check( __line__, dpres(
ke-2,i,j) )
1057 call check( __line__, dpres(
ke-1,i,j) )
1058 call check( __line__, dpres(
ke ,i,j) )
1059 call check( __line__, rt2p(
ke-2,i,j) )
1060 call check( __line__, rt2p(
ke-1,i,j) )
1061 call check( __line__, rt2p(
ke ,i,j) )
1062 call check( __line__, rhot(
ke-2,i,j) )
1063 call check( __line__, rhot(
ke,i,j) )
1064 call check( __line__, ddens(
ke-2,i,j) )
1065 call check( __line__, ddens(
ke,i,j) )
1068 ( j33g * ( momz(
ke-1,i,j) + dtrk*sw(
ke-1,i,j) ) &
1069 * ( 0.5_rp*(pott(
ke ,i,j)+pott(
ke-1,i,j)) ) &
1070 - j33g * ( momz(
ke-2,i,j) + dtrk*sw(
ke-2,i,j) ) &
1071 * ( fact_n*(pott(
ke-1,i,j)+pott(
ke-2,i,j)) &
1072 + fact_f*(pott(
ke ,i,j)+pott(
ke-3,i,j)) ) ) * rcdz(
ke-1) &
1073 + ( gsqrt(
ke-1,i ,j,
i_uyz) * ( momx(
ke-1,i ,j) + dtrk*su(
ke-1,i ,j) ) &
1074 * ( fact_n*(pott(
ke-1,i+1,j)+pott(
ke-1,i ,j)) &
1075 + fact_f*(pott(
ke-1,i+2,j)+pott(
ke-1,i-1,j)) ) &
1076 - gsqrt(
ke-1,i-1,j,
i_uyz) * ( momx(
ke-1,i-1,j) + dtrk*su(
ke-1,i-1,j) ) &
1077 * ( fact_n*(pott(
ke-1,i ,j)+pott(
ke-1,i-1,j)) &
1078 + fact_f*(pott(
ke-1,i+1,j)+pott(
ke-1,i-2,j)) ) ) * rcdx(i) &
1079 + ( gsqrt(
ke-1,i,j ,
i_xvz) * ( momy(
ke-1,i,j ) + dtrk*sv(
ke-1,i,j ) ) &
1080 * ( fact_n*(pott(
ke-1,i,j+1)+pott(
ke-1,i,j )) &
1081 + fact_f*(pott(
ke-1,i,j+2)+pott(
ke-1,i,j-1)) ) &
1082 - gsqrt(
ke-1,i,j-1,
i_xvz) * ( momy(
ke-1,i,j-1) + dtrk*sv(
ke-1,i,j-1) ) &
1083 * ( fact_n*(pott(
ke-1,i,j )+pott(
ke-1,i,j-1)) &
1084 + fact_f*(pott(
ke-1,i,j+1)+pott(
ke-1,i,j-2)) ) ) * rcdy(j) &
1085 + gsqrt(
ke-1,i,j,
i_xyz) * ( st(
ke-1,i,j) - dpres(
ke-1,i,j) * rcs2t(
ke-1,i,j) * rdt ) &
1087 + grav * j33g * ( ( dpres(
ke ,i,j)*rcs2t(
ke ,i,j) &
1088 - dpres(
ke-2,i,j)*rcs2t(
ke-2,i,j) ) &
1089 - ( rhot(
ke ,i,j)*ddens(
ke ,i,j)/dens(
ke ,i,j) &
1090 - rhot(
ke-2,i,j)*ddens(
ke-2,i,j)/dens(
ke-2,i,j) )&
1091 ) / ( fdz(
ke-1) + fdz(
ke-1-1) )
1093 call check( __line__, momz(
ke-1,i,j) )
1094 call check( __line__, momx(
ke,i-1,j) )
1095 call check( __line__, momx(
ke,i ,j) )
1096 call check( __line__, momy(
ke,i,j-1) )
1097 call check( __line__, momy(
ke,i,j ) )
1098 call check( __line__, sw(
ke-1,i,j) )
1099 call check( __line__, su(
ke,i-1,j) )
1100 call check( __line__, su(
ke,i ,j) )
1101 call check( __line__, sv(
ke,i,j-1) )
1102 call check( __line__, sv(
ke,i,j ) )
1104 call check( __line__, pott(
ke-1,i,j) )
1105 call check( __line__, pott(
ke ,i,j) )
1106 call check( __line__, pott(
ke,i-2,j) )
1107 call check( __line__, pott(
ke,i-1,j) )
1108 call check( __line__, pott(
ke,i ,j) )
1109 call check( __line__, pott(
ke,i+1,j) )
1110 call check( __line__, pott(
ke,i+2,j) )
1111 call check( __line__, pott(
ke,i,j-2) )
1112 call check( __line__, pott(
ke,i,j-1) )
1113 call check( __line__, pott(
ke,i,j ) )
1114 call check( __line__, pott(
ke,i,j+1) )
1115 call check( __line__, pott(
ke,i,j+2) )
1121 call check( __line__, st(
ke,i,j) )
1122 call check( __line__, dpres(
ke-1,i,j) )
1123 call check( __line__, dpres(
ke ,i,j) )
1124 call check( __line__, rt2p(
ke-1,i,j) )
1125 call check( __line__, rt2p(
ke ,i,j) )
1126 call check( __line__, rhot(
ke-1,i,j) )
1127 call check( __line__, ddens(
ke-1,i,j) )
1131 - j33g * ( momz(
ke-1,i,j) + dtrk*sw(
ke-1,i,j) ) &
1132 * 0.5_rp*(pott(
ke ,i,j)+pott(
ke-1,i,j)) ) * rcdz(
ke) &
1133 + ( gsqrt(
ke,i ,j,
i_uyz) * ( momx(
ke,i ,j) + dtrk*su(
ke,i ,j) ) &
1134 * ( fact_n*(pott(
ke,i+1,j)+pott(
ke,i ,j)) &
1135 + fact_f*(pott(
ke,i+2,j)+pott(
ke,i-1,j)) ) &
1136 - gsqrt(
ke,i-1,j,
i_uyz) * ( momx(
ke,i-1,j) + dtrk*su(
ke,i-1,j) ) &
1137 * ( fact_n*(pott(
ke,i ,j)+pott(
ke,i-1,j)) &
1138 + fact_f*(pott(
ke,i+1,j)+pott(
ke,i-2,j)) ) ) * rcdx(i) &
1139 + ( gsqrt(
ke,i,j ,
i_xvz) * ( momy(
ke,i,j ) + dtrk*sv(
ke,i,j ) ) &
1140 * ( fact_n*(pott(
ke,i,j+1)+pott(
ke,i,j )) &
1141 + fact_f*(pott(
ke,i,j+2)+pott(
ke,i,j-1)) ) &
1142 - gsqrt(
ke,i,j-1,
i_xvz) * ( momy(
ke,i,j-1) + dtrk*sv(
ke,i,j-1) ) &
1143 * ( fact_n*(pott(
ke,i,j )+pott(
ke,i,j-1)) &
1144 + fact_f*(pott(
ke,i,j+1)+pott(
ke,i,j-2)) ) ) * rcdy(j) &
1145 + gsqrt(
ke,i,j,
i_xyz) * ( st(
ke,i,j) - dpres(
ke,i,j) * rcs2t(
ke,i,j) * rdt ) &
1147 + grav * j33g * 0.5_rp * ( - ( dpres(
ke,i,j)+dpres(
ke-1,i,j) ) * rcs2t(
ke,i,j) &
1148 + ( ddens(
ke,i,j)+ddens(
ke-1,i,j) ) * pott(
ke,i,j) ) * rcdz(
ke)
1152 k = iundef; i = iundef; j = iundef
1157 pott, rcs2t, grav, &
1159 rcdz, rfdz, rcdx, rfdx, rcdy,rfdy, fdz, &
1163 iis, iie, jjs, jje )
1173 call comm_vars8( dpres_n, 1 )
1174 call comm_wait ( dpres_n, 1 )
1177 call check_solver( dpres_n, m, b )
1182 call solve_multigrid
1199 call check( __line__, dpres_n(k+1,i,j) )
1200 call check( __line__, dpres_n(k ,i,j) )
1201 call check( __line__, dpres(k+1,i,j) )
1202 call check( __line__, dpres(k ,i,j) )
1203 call check( __line__, ddens(k+1,i,j) )
1204 call check( __line__, ddens(k ,i,j) )
1205 call check( __line__, ref_dens(k+1,i,j) )
1206 call check( __line__, ref_dens(k,i,j) )
1207 call check( __line__, momz0(k,i,j) )
1210 - j33g * ( dpres_n(k+1,i,j) - dpres_n(k,i,j) ) * rfdz(k) &
1211 ) / gsqrt(k,i,j,
i_uyz) &
1213 * ( ddens(k+1,i,j) &
1214 + ( dpres_n(k+1,i,j) - dpres(k+1,i,j) ) &
1215 / ( pott(k+1,i,j) * rt2p(k+1,i,j) ) &
1217 + ( dpres_n(k ,i,j) - dpres(k ,i,j) ) &
1218 / ( pott(k ,i,j) * rt2p(k ,i,j) ) ) &
1220 momz_rk(k,i,j) = momz0(k,i,j) + duvw
1221 mflx_hi(k,i,j,
zdir) = j33g * ( momz(k,i,j) + duvw )
1226 k = iundef; i = iundef; j = iundef
1230 mflx_hi(
ks-1,i,j,
zdir) = 0.0_rp
1231 mflx_hi(
ke ,i,j,
zdir) = 0.0_rp
1235 k = iundef; i = iundef; j = iundef
1247 call check( __line__, dpres_n(k,i+1,j) )
1248 call check( __line__, dpres_n(k,i ,j) )
1252 call check( __line__, su(k,i,j) )
1253 call check( __line__, momx0(k,i,j) )
1256 - ( gsqrt(k,i+1,j,
i_xyz) * dpres_n(k,i+1,j) &
1257 - gsqrt(k,i ,j,
i_xyz) * dpres_n(k,i ,j) ) * rfdx(i) &
1258 ) / gsqrt(k,i,j,
i_uyz) &
1261 momx_rk(k,i,j) = momx0(k,i,j) + duvw
1262 mflx_hi(k,i,j,
xdir) = gsqrt(k,i,j,
i_uyz) * ( momx(k,i,j) + duvw )
1267 k = iundef; i = iundef; j = iundef
1278 call check( __line__, dpres_n(k,i,j ) )
1279 call check( __line__, dpres_n(k,i,j+1) )
1283 call check( __line__, sv(k,i,j) )
1284 call check( __line__, momy0(k,i,j) )
1287 - ( gsqrt(k,i,j+1,
i_xyz) * dpres_n(k,i,j+1) &
1288 - gsqrt(k,i,j ,
i_xyz) * dpres_n(k,i,j ) ) * rfdy(j) &
1289 ) / gsqrt(k,i,j,
i_xvz) &
1291 momy_rk(k,i,j) = momy0(k,i,j) + duvw
1292 mflx_hi(k,i,j,
ydir) = gsqrt(k,i,j,
i_xvz) * ( momy(k,i,j) + duvw )
1297 k = iundef; i = iundef; j = iundef
1309 call check( __line__, mflx_hi(k,i,j,
zdir) )
1310 call check( __line__, pott(k,i-1,j) )
1311 call check( __line__, pott(k,i ,j) )
1312 call check( __line__, pott(k,i+1,j) )
1313 call check( __line__, pott(k,i+1,j) )
1316 tflx_hi(k,i,j,
zdir) = mflx_hi(k,i,j,
zdir) &
1317 * ( fact_n * ( pott(k+1,i,j) + pott(k ,i,j) ) &
1318 + fact_f * ( pott(k+2,i,j) + pott(k-1,i,j) ) )
1323 k = iundef; i = iundef; j = iundef
1328 tflx_hi(
ks-1,i,j,
zdir) = 0.0_rp
1329 tflx_hi(
ks ,i,j,
zdir) = mflx_hi(
ks ,i,j,
zdir) * 0.5_rp * ( pott(
ks+1,i,j) + pott(
ks ,i,j) )
1330 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) )
1331 tflx_hi(
ke ,i,j,
zdir) = 0.0_rp
1335 k = iundef; i = iundef; j = iundef
1343 call check( __line__, mflx_hi(k,i,j,
xdir) )
1344 call check( __line__, pott(k,i-1,j) )
1345 call check( __line__, pott(k,i ,j) )
1346 call check( __line__, pott(k,i+1,j) )
1347 call check( __line__, pott(k,i+1,j) )
1350 tflx_hi(k,i,j,
xdir) = mflx_hi(k,i,j,
xdir) &
1351 * ( fact_n * ( pott(k,i+1,j)+pott(k,i ,j) ) &
1352 + fact_f * ( pott(k,i+2,j)+pott(k,i-1,j) ) )
1357 k = iundef; i = iundef; j = iundef
1365 call check( __line__, mflx_hi(k,i,j,
ydir) )
1366 call check( __line__, pott(k,i,j-1) )
1367 call check( __line__, pott(k,i,j ) )
1368 call check( __line__, pott(k,i,j+1) )
1369 call check( __line__, pott(k,i,j+2) )
1372 tflx_hi(k,i,j,
ydir) = mflx_hi(k,i,j,
ydir) &
1373 * ( fact_n * ( pott(k,i,j+1)+pott(k,i,j ) ) &
1374 + fact_f * ( pott(k,i,j+2)+pott(k,i,j-1) ) )
1379 k = iundef; i = iundef; j = iundef
1386 rhot_rk(k,i,j) = rhot0(k,i,j) &
1387 + dtrk * ( - ( ( tflx_hi(k,i,j,
zdir) - tflx_hi(k-1,i ,j ,
zdir) ) * rcdz(k) &
1388 + ( tflx_hi(k,i,j,
xdir) - tflx_hi(k ,i-1,j ,
xdir) ) * rcdx(i) &
1389 + ( tflx_hi(k,i,j,
ydir) - tflx_hi(k ,i ,j-1,
ydir) ) * rcdy(j) ) &
1390 / gsqrt(k,i,j,
i_xyz) &
1402 mflx_hi(k,i,j,
zdir) = mflx_hi(k,i,j,
zdir) + mflx_hi2(k,i,j,
zdir)
1409 mflx_hi(k,i,j,
xdir) = mflx_hi(k,i,j,
xdir) + mflx_hi2(k,i,j,
xdir)
1416 mflx_hi(k,i,j,
ydir) = mflx_hi(k,i,j,
ydir) + mflx_hi2(k,i,j,
ydir)
1427 call check( __line__, dens0(k,i,j) )
1428 call check( __line__, mflx_hi(k ,i ,j ,
xdir) )
1429 call check( __line__, mflx_hi(k ,i-1,j ,
xdir) )
1430 call check( __line__, mflx_hi(k ,i ,j ,
ydir) )
1431 call check( __line__, mflx_hi(k ,i ,j-1,
ydir) )
1432 call check( __line__, dens_t(k,i,j) )
1434 dens_rk(k,i,j) = dens0(k,i,j) &
1435 + dtrk * ( - ( ( mflx_hi(k,i,j,
zdir)-mflx_hi(k-1,i ,j,
zdir) ) * rcdz(k) &
1436 + ( mflx_hi(k,i,j,
xdir)-mflx_hi(k ,i-1,j,
xdir) ) * rcdx(i) &
1437 + ( mflx_hi(k,i,j,
ydir)-mflx_hi(k ,i, j-1,
ydir) ) * rcdy(j) ) &
1438 / gsqrt(k,i,j,
i_xyz) &
1444 k = iundef; i = iundef; j = iundef
1450 dpres_n, dpres, rhot_rk, rhot, dens_rk, dens, b,&
1460 #ifdef HIVI_BICGSTAB 1472 real(RP),
intent(out) :: DPRES_N(
ka,
ia,
ja)
1473 real(RP),
intent(in) :: DPRES(
ka,
ia,
ja)
1474 real(RP),
intent(in) :: M(7,
ka,
ia,
ja)
1475 real(RP),
intent(in) :: B(
ka,
ia,
ja)
1483 real(RP) :: al, be, w
1485 real(RP),
pointer :: r(:,:,:)
1486 real(RP),
pointer :: rn(:,:,:)
1487 real(RP),
pointer :: swap(:,:,:)
1488 real(RP),
target :: v0(
ka,
ia,
ja)
1489 real(RP),
target :: v1(
ka,
ia,
ja)
1491 real(RP) :: norm, error, error2
1493 real(RP) :: iprod(2)
1497 integer :: iis, iie, jjs, jje
1515 call mul_matrix( v1, m, dpres )
1528 norm = norm + b(k,i,j)**2
1533 k = iundef; i = iundef; j = iundef
1541 call check( __line__, b(k,i,j) )
1542 call check( __line__, v1(k,i,j) )
1544 r(k,i,j) = b(k,i,j) - v1(k,i,j)
1549 k = iundef; i = iundef; j = iundef
1555 r0(k,i,j) = r(k,i,j)
1561 k = iundef; i = iundef; j = iundef
1568 call check( __line__, r(k,i,j) )
1569 call check( __line__, r0(k,i,j) )
1571 r0r = r0r + r0(k,i,j) * r(k,i,j)
1576 k = iundef; i = iundef; j = iundef
1585 dpres_n(k,i,j) = dpres(k,i,j)
1593 call mpi_allreduce(iprod, buf, 2, mtype, mpi_sum,
comm_world, ierror)
1606 call check( __line__, r(k,i,j) )
1608 error = error + r(k,i,j)**2
1613 k = iundef; i = iundef; j = iundef
1615 call mpi_allreduce(error, buf, 1, mtype, mpi_sum,
comm_world, ierror)
1619 log_info(
"solve_bicgstab",*) iter, error/norm
1621 if ( sqrt(error/norm) < epsilon .OR. error > error2 )
then 1623 log_info(
"solve_bicgstab",*)
"Bi-CGSTAB converged:", iter
1629 call comm_vars8( p, 1 )
1630 call comm_wait ( p, 1 )
1631 call mul_matrix( mp, m, p )
1638 call check( __line__, r0(k,i,j) )
1639 call check( __line__, mp(k,i,j) )
1641 iprod(1) = iprod(1) + r0(k,i,j) * mp(k,i,j)
1646 k = iundef; i = iundef; j = iundef
1648 call mpi_allreduce(iprod, buf, 1, mtype, mpi_sum,
comm_world, ierror)
1655 call check( __line__, r(k,i,j) )
1656 call check( __line__, mp(k,i,j) )
1658 s(k,i,j) = r(k,i,j) - al*mp(k,i,j)
1663 k = iundef; i = iundef; j = iundef
1666 call comm_vars8( s, 1 )
1667 call comm_wait ( s, 1 )
1668 call mul_matrix( ms, m, s )
1675 call check( __line__, ms(k,i,j) )
1676 call check( __line__, s(k,i,j) )
1678 iprod(1) = iprod(1) + ms(k,i,j) * s(k,i,j)
1679 iprod(2) = iprod(2) + ms(k,i,j) * ms(k,i,j)
1684 k = iundef; i = iundef; j = iundef
1686 call mpi_allreduce(iprod, buf, 2, mtype, mpi_sum,
comm_world, ierror)
1700 call check( __line__, dpres_n(k,i,j) )
1701 call check( __line__, p(k,i,j) )
1702 call check( __line__, s(k,i,j) )
1704 dpres_n(k,i,j) = dpres_n(k,i,j) + al*p(k,i,j) + w*s(k,i,j)
1709 k = iundef; i = iundef; j = iundef
1716 call check( __line__, s(k,i,j) )
1717 call check( __line__, ms(k,i,j) )
1719 rn(k,i,j) = s(k,i,j) - w*ms(k,i,j)
1724 k = iundef; i = iundef; j = iundef
1731 call check( __line__, r0(k,i,j) )
1732 call check( __line__, rn(k,i,j) )
1734 iprod(1) = iprod(1) + r0(k,i,j) * rn(k,i,j)
1739 k = iundef; i = iundef; j = iundef
1747 call mpi_allreduce(iprod, r0r, 1, mtype, mpi_sum,
comm_world, ierror)
1754 call check( __line__, rn(k,i,j) )
1755 call check( __line__, p(k,i,j) )
1756 call check( __line__, mp(k,i,j) )
1758 p(k,i,j) = rn(k,i,j) + be * ( p(k,i,j) - w*mp(k,i,j) )
1763 k = iundef; i = iundef; j = iundef
1774 if ( iter >= itmax )
then 1775 log_error(
"solve_bicgstab",*)
'not converged', error, norm
1784 POTT, RCs2T, GRAV, &
1786 RCDZ, RFDZ, RCDX, RFDX, RCDY, RFDY, FDZ, &
1790 IIS, IIE, JJS, JJE )
1792 real(RP),
intent(inout) :: M(7,
ka,
ia,
ja)
1793 real(RP),
intent(in) :: POTT(
ka,
ia,
ja)
1794 real(RP),
intent(in) :: RCs2T(
ka,
ia,
ja)
1795 real(RP),
intent(in) :: GRAV
1796 real(RP),
intent(in) :: G(
ka,
ia,
ja,7)
1797 real(RP),
intent(in) :: J33G
1798 real(RP),
intent(in) :: RCDZ(
ka)
1799 real(RP),
intent(in) :: RFDZ(
ka-1)
1800 real(RP),
intent(in) :: RFDX(
ia-1)
1801 real(RP),
intent(in) :: RCDX(
ia)
1802 real(RP),
intent(in) :: RCDY(
ja)
1803 real(RP),
intent(in) :: RFDY(
ja-1)
1804 real(RP),
intent(in) :: FDZ(
ka-1)
1805 real(RP),
intent(in) :: rdt
1806 real(RP),
intent(in) :: FACT_N
1807 real(RP),
intent(in) :: FACT_F
1808 integer,
intent(in) :: I_XYZ
1809 integer,
intent(in) :: I_XYW
1810 integer,
intent(in) :: IIS
1811 integer,
intent(in) :: IIE
1812 integer,
intent(in) :: JJS
1813 integer,
intent(in) :: JJE
1821 call check( __line__, pott(k-2,i,j) )
1822 call check( __line__, pott(k-1,i,j) )
1823 call check( __line__, pott(k ,i,j) )
1824 call check( __line__, pott(k+1,i,j) )
1825 call check( __line__, pott(k+2,i,j) )
1826 call check( __line__, pott(k,i-2,j) )
1827 call check( __line__, pott(k,i-1,j) )
1828 call check( __line__, pott(k,i ,j) )
1829 call check( __line__, pott(k,i+1,j) )
1830 call check( __line__, pott(k,i+2,j) )
1831 call check( __line__, pott(k,i,j-2) )
1832 call check( __line__, pott(k,i,j-1) )
1833 call check( __line__, pott(k,i,j ) )
1834 call check( __line__, pott(k,i,j+1) )
1835 call check( __line__, pott(k,i,j+2) )
1836 call check( __line__, g(k-1,i,j,i_xyw) )
1837 call check( __line__, g(k+1,i,j,i_xyw) )
1838 call check( __line__, g(k,i,j,i_xyz) )
1839 call check( __line__, rcs2t(k-1,i,j) )
1840 call check( __line__, rcs2t(k ,i,j) )
1841 call check( __line__, rcs2t(k+1,i,j) )
1845 - ( ( fact_n * (pott(k+1,i,j)+pott(k ,i,j)) &
1846 + fact_f * (pott(k+2,i,j)+pott(k-1,i,j)) ) * rfdz(k ) / g(k ,i,j,i_xyw) &
1847 + ( fact_n * (pott(k ,i,j)+pott(k-1,i,j)) &
1848 + fact_f * (pott(k+1,i,j)+pott(k-2,i,j)) ) * rfdz(k-1) / g(k-1,i,j,i_xyw) &
1849 ) * j33g * j33g * rfdz(k) &
1850 - ( ( fact_n * (pott(k,i+1,j)+pott(k,i ,j)) &
1851 + fact_f * (pott(k,i+2,j)+pott(k,i-1,j)) ) * rfdx(i ) &
1852 + ( fact_n * (pott(k,i ,j)+pott(k,i-1,j)) &
1853 + fact_f * (pott(k,i+1,j)+pott(k,i-2,j)) ) * rfdx(i-1) &
1854 ) * g(k,i,j,i_xyz) * rfdx(i) &
1855 - ( ( fact_n * (pott(k,i,j+1)+pott(k,i,j )) &
1856 + fact_f * (pott(k,i,j+2)+pott(k,i,j-1)) ) * rfdy(j ) &
1857 + ( fact_n * (pott(k,i,j )+pott(k,i,j-1)) &
1858 + fact_f * (pott(k,i,j-1)+pott(k,i,j-2)) ) * rfdy(j-1) &
1859 ) * g(k,i,j,i_xyz) * rfdy(j) &
1860 - g(k,i,j,i_xyz) * rcs2t(k,i,j) * rdt * rdt
1862 m(2,k,i,j) = j33g * j33g / g(k-1,i,j,i_xyw) &
1863 * ( fact_n * (pott(k ,i,j)+pott(k-1,i,j)) &
1864 + fact_f * (pott(k+1,i,j)+pott(k-2,i,j)) ) &
1865 * rfdz(k-1) * rcdz(k) &
1866 - grav * j33g * rcs2t(k-1,i,j) / ( fdz(k)+fdz(k-1) )
1868 m(3,k,i,j) = j33g * j33g / g(k+1,i,j,i_xyw) &
1869 * ( fact_n * (pott(k+1,i,j)+pott(k ,i,j)) &
1870 + fact_f * (pott(k+2,i,j)+pott(k-1,i,j)) ) &
1871 * rfdz(k ) * rcdz(k) &
1872 + grav * j33g * rcs2t(k+1,i,j) / ( fdz(k)+fdz(k-1) )
1877 k = iundef; i = iundef; j = iundef
1882 call check( __line__, pott(
ks ,i,j) )
1883 call check( __line__, pott(
ks+1,i,j) )
1884 call check( __line__, pott(
ks,i-2,j) )
1885 call check( __line__, pott(
ks,i-1,j) )
1886 call check( __line__, pott(
ks,i ,j) )
1887 call check( __line__, pott(
ks,i+1,j) )
1888 call check( __line__, pott(
ks,i+2,j) )
1889 call check( __line__, pott(
ks,i,j-2) )
1890 call check( __line__, pott(
ks,i,j-1) )
1891 call check( __line__, pott(
ks,i,j ) )
1892 call check( __line__, pott(
ks,i,j+1) )
1893 call check( __line__, pott(
ks,i,j+2) )
1894 call check( __line__, g(
ks,i,j,i_xyz) )
1895 call check( __line__, rcs2t(
ks,i,j) )
1896 call check( __line__, pott(
ks ,i,j) )
1897 call check( __line__, pott(
ks+1,i,j) )
1898 call check( __line__, g(
ks+1,i,j,i_xyw) )
1899 call check( __line__, rcs2t(
ks+1,i,j) )
1903 - ( 0.5_rp * (pott(
ks+1,i,j)+pott(
ks ,i,j)) * rfdz(
ks ) &
1904 ) * j33g * j33g / g(
ks ,i,j,i_xyw) * rfdz(
ks) &
1905 - ( ( fact_n * (pott(
ks,i+1,j)+pott(
ks,i ,j)) &
1906 + fact_f * (pott(
ks,i+2,j)+pott(
ks,i-1,j)) ) * rfdx(i ) &
1907 + ( fact_n * (pott(
ks,i ,j)+pott(
ks,i-1,j)) &
1908 + fact_f * (pott(
ks,i+1,j)+pott(
ks,i-2,j)) ) * rfdx(i-1) &
1909 ) * g(
ks,i,j,i_xyz) * rfdx(i) &
1910 - ( ( fact_n * (pott(
ks,i,j+1)+pott(
ks,i,j )) &
1911 + fact_f * (pott(
ks,i,j+2)+pott(
ks,i,j-1)) ) * rfdy(j ) &
1912 + ( fact_n * (pott(
ks,i,j )+pott(
ks,i,j-1)) &
1913 + fact_f * (pott(
ks,i,j-1)+pott(
ks,i,j-2)) ) * rfdy(j-1) &
1914 ) * g(
ks,i,j,i_xyz) * rfdy(j) &
1915 - g(
ks,i,j,i_xyz) * rcs2t(
ks,i,j) * rdt * rdt &
1916 + grav * j33g * 0.5_rp * rcs2t(
ks,i,j) * rcdz(
ks)
1918 m(3,
ks,i,j) = j33g * j33g / g(
ks+1,i,j,i_xyw) &
1919 * 0.5_rp * (pott(
ks+1,i,j)+pott(
ks ,i,j)) &
1920 * rfdz(
ks ) * rcdz(
ks) &
1921 + grav * j33g * 0.5_rp * rcs2t(
ks+1,i,j) * rcdz(
ks)
1923 call check( __line__, pott(
ks ,i,j) )
1924 call check( __line__, pott(
ks+1,i,j) )
1925 call check( __line__, pott(
ks+2,i,j) )
1926 call check( __line__, pott(
ks+3,i,j) )
1927 call check( __line__, pott(
ks+1,i-2,j) )
1928 call check( __line__, pott(
ks+1,i-1,j) )
1929 call check( __line__, pott(
ks+1,i ,j) )
1930 call check( __line__, pott(
ks+1,i+1,j) )
1931 call check( __line__, pott(
ks+1,i+2,j) )
1932 call check( __line__, pott(
ks+1,i,j-2) )
1933 call check( __line__, pott(
ks+1,i,j-1) )
1934 call check( __line__, pott(
ks+1,i,j ) )
1935 call check( __line__, pott(
ks+1,i,j+1) )
1936 call check( __line__, pott(
ks+1,i,j+2) )
1937 call check( __line__, g(
ks ,i,j,i_xyw) )
1938 call check( __line__, g(
ks+2,i,j,i_xyw) )
1939 call check( __line__, g(
ks+1,i,j,i_xyz) )
1940 call check( __line__, rcs2t(
ks ,i,j) )
1941 call check( __line__, rcs2t(
ks+1 ,i,j) )
1942 call check( __line__, rcs2t(
ks+2,i,j) )
1946 - ( ( fact_n * (pott(
ks+2,i,j)+pott(
ks+1,i,j)) &
1947 + fact_f * (pott(
ks+3,i,j)+pott(
ks ,i,j)) ) * rfdz(
ks+1) / g(
ks+1,i,j,i_xyw) &
1948 + 0.5_rp * (pott(
ks+1,i,j)+pott(
ks ,i,j)) * rfdz(
ks ) / g(
ks ,i,j,i_xyw) &
1949 ) * j33g * j33g * rfdz(
ks+1) &
1950 - ( ( fact_n * (pott(
ks+1,i+1,j)+pott(
ks+1,i ,j)) &
1951 + fact_f * (pott(
ks+1,i+2,j)+pott(
ks+1,i-1,j)) ) * rfdx(i ) &
1952 + ( fact_n * (pott(
ks+1,i ,j)+pott(
ks+1,i-1,j)) &
1953 + fact_f * (pott(
ks+1,i+1,j)+pott(
ks+1,i-2,j)) ) * rfdx(i-1) &
1954 ) * g(
ks+1,i,j,i_xyz) * rfdx(i) &
1955 - ( ( fact_n * (pott(
ks+1,i,j+1)+pott(
ks+1,i,j )) &
1956 + fact_f * (pott(
ks+1,i,j+2)+pott(
ks+1,i,j-1)) ) * rfdy(j ) &
1957 + ( fact_n * (pott(
ks+1,i,j )+pott(
ks+1,i,j-1)) &
1958 + fact_f * (pott(
ks+1,i,j-1)+pott(
ks+1,i,j-2)) ) * rfdy(j-1) &
1959 ) * g(
ks+1,i,j,i_xyz) * rfdy(j) &
1960 - g(
ks+1,i,j,i_xyz) * rcs2t(
ks+1,i,j) * rdt * rdt
1962 m(2,
ks+1,i,j) = j33g * j33g / g(
ks,i,j,i_xyw) &
1963 * 0.5_rp * (pott(
ks+1,i,j)+pott(
ks ,i,j)) &
1964 * rfdz(
ks ) * rcdz(
ks+1) &
1965 - grav * j33g * rcs2t(
ks ,i,j) / ( fdz(
ks+1)+fdz(
ks) )
1967 m(3,
ks+1,i,j) = j33g * j33g / g(
ks+2,i,j,i_xyw) &
1968 * ( fact_n * (pott(
ks+2,i,j)+pott(
ks+1,i,j)) &
1969 + fact_f * (pott(
ks+3,i,j)+pott(
ks ,i,j)) ) &
1970 * rfdz(
ks+1) * rcdz(
ks+1) &
1971 + grav * j33g * rcs2t(
ks+2,i,j) / ( fdz(
ks+1)+fdz(
ks) )
1973 call check( __line__, pott(
ke-3,i,j) )
1974 call check( __line__, pott(
ke-2,i,j) )
1975 call check( __line__, pott(
ke-1,i,j) )
1976 call check( __line__, pott(
ke ,i,j) )
1977 call check( __line__, pott(
ke-1,i-2,j) )
1978 call check( __line__, pott(
ke-1,i-1,j) )
1979 call check( __line__, pott(
ke-1,i ,j) )
1980 call check( __line__, pott(
ke-1,i+1,j) )
1981 call check( __line__, pott(
ke-1,i+2,j) )
1982 call check( __line__, pott(
ke-1,i,j-2) )
1983 call check( __line__, pott(
ke-1,i,j-1) )
1984 call check( __line__, pott(
ke-1,i,j ) )
1985 call check( __line__, pott(
ke-1,i,j+1) )
1986 call check( __line__, pott(
ke-1,i,j+2) )
1987 call check( __line__, g(
ke-2,i,j,i_xyw) )
1988 call check( __line__, g(
ke ,i,j,i_xyw) )
1989 call check( __line__, g(
ke-1,i,j,i_xyz) )
1990 call check( __line__, rcs2t(
ke-2,i,j) )
1991 call check( __line__, rcs2t(
ke-1,i,j) )
1992 call check( __line__, rcs2t(
ke ,i,j) )
1996 - ( 0.5_rp * (pott(
ke ,i,j)+pott(
ke-1,i,j)) * rfdz(
ke-1) / g(
ke-1,i,j,i_xyw) &
1997 + ( fact_n * (pott(
ke-1,i,j)+pott(
ke-2,i,j)) &
1998 + fact_f * (pott(
ke ,i,j)+pott(
ke-3,i,j)) ) * rfdz(
ke-2) / g(
ke-2,i,j,i_xyw) &
1999 ) * j33g * j33g * rfdz(
ke-1) &
2000 - ( ( fact_n * (pott(
ke-1,i+1,j)+pott(
ke-1,i ,j)) &
2001 + fact_f * (pott(
ke-1,i+2,j)+pott(
ke-1,i-1,j)) ) * rfdx(i ) &
2002 + ( fact_n * (pott(
ke-1,i ,j)+pott(
ke-1,i-1,j)) &
2003 + fact_f * (pott(
ke-1,i+1,j)+pott(
ke-1,i-2,j)) ) * rfdx(i-1) &
2004 ) * g(
ke-1,i,j,i_xyz) * rfdx(i) &
2005 - ( ( fact_n * (pott(
ke-1,i,j+1)+pott(
ke-1,i,j )) &
2006 + fact_f * (pott(
ke-1,i,j+2)+pott(
ke-1,i,j-1)) ) * rfdy(j ) &
2007 + ( fact_n * (pott(
ke-1,i,j )+pott(
ke-1,i,j-1)) &
2008 + fact_f * (pott(
ke-1,i,j-1)+pott(
ke-1,i,j-2)) ) * rfdy(j-1) &
2009 ) * g(
ke-1,i,j,i_xyz) * rfdy(j) &
2010 - g(
ke-1,i,j,i_xyz) * rcs2t(
ke-1,i,j) * rdt * rdt
2012 m(2,
ke-1,i,j) = j33g * j33g / g(
ke-2,i,j,i_xyw) &
2013 * ( fact_n * (pott(
ke-1,i,j)+pott(
ke-2,i,j)) &
2014 + fact_f * (pott(
ke ,i,j)+pott(
ke-3,i,j)) ) &
2015 * rfdz(
ke-2) * rcdz(
ke-1) &
2016 - grav * j33g * rcs2t(
ke-2,i,j) / ( fdz(
ke-1)+fdz(
ke-2) )
2018 m(3,
ke-1,i,j) = j33g * j33g / g(
ke ,i,j,i_xyw) &
2019 * 0.5_rp * (pott(
ke ,i,j)+pott(
ke-1,i,j)) &
2020 * rfdz(
ke-1) * rcdz(
ke-1) &
2021 + grav * j33g * rcs2t(
ke ,i,j) / ( fdz(
ke-1)+fdz(
ke-2) )
2023 call check( __line__, pott(
ke-1,i,j) )
2024 call check( __line__, pott(
ke ,i,j) )
2025 call check( __line__, pott(
ke,i-2,j) )
2026 call check( __line__, pott(
ke,i-1,j) )
2027 call check( __line__, pott(
ke,i ,j) )
2028 call check( __line__, pott(
ke,i+1,j) )
2029 call check( __line__, pott(
ke,i+2,j) )
2030 call check( __line__, pott(
ke,i,j-2) )
2031 call check( __line__, pott(
ke,i,j-1) )
2032 call check( __line__, pott(
ke,i,j ) )
2033 call check( __line__, pott(
ke,i,j+1) )
2034 call check( __line__, pott(
ke,i,j+2) )
2035 call check( __line__, g(
ke-1,i,j,i_xyw) )
2036 call check( __line__, g(
ke,i,j,i_xyz) )
2037 call check( __line__, rcs2t(
ke-1,i,j) )
2038 call check( __line__, rcs2t(
ke,i,j) )
2043 + 0.5_rp * (pott(
ke ,i,j)+pott(
ke-1,i,j)) * rfdz(
ke-1) / g(
ke-1,i,j,i_xyw) &
2044 ) * j33g * j33g * rfdz(
ke) &
2045 - ( ( fact_n * (pott(
ke,i+1,j)+pott(
ke,i ,j)) &
2046 + fact_f * (pott(
ke,i+2,j)+pott(
ke,i-1,j)) ) * rfdx(i ) &
2047 + ( fact_n * (pott(
ke,i ,j)+pott(
ke,i-1,j)) &
2048 + fact_f * (pott(
ke,i+1,j)+pott(
ke,i-2,j)) ) * rfdx(i-1) &
2049 ) * g(
ke,i,j,i_xyz) * rfdx(i) &
2050 - ( ( fact_n * (pott(
ke,i,j+1)+pott(
ke,i,j )) &
2051 + fact_f * (pott(
ke,i,j+2)+pott(
ke,i,j-1)) ) * rfdy(j ) &
2052 + ( fact_n * (pott(
ke,i,j )+pott(
ke,i,j-1)) &
2053 + fact_f * (pott(
ke,i,j-1)+pott(
ke,i,j-2)) ) * rfdy(j-1) &
2054 ) * g(
ke,i,j,i_xyz) * rfdy(j) &
2055 - g(
ke,i,j,i_xyz) * rcs2t(
ke,i,j) * rdt * rdt &
2056 - grav * j33g * 0.5_rp * rcs2t(
ke,i,j) * rcdz(
ke)
2058 m(2,
ke,i,j) = j33g * j33g / g(
ke-1,i,j,i_xyw) &
2059 * 0.5_rp * (pott(
ke ,i,j)+pott(
ke-1,i,j)) &
2060 * rfdz(
ke-1) * rcdz(
ke) &
2061 - grav * j33g * 0.5_rp * rcs2t(
ke,i,j) * rcdz(
ke)
2065 k = iundef; i = iundef; j = iundef
2072 call check( __line__, g(k,i-1,j,i_xyz) )
2073 call check( __line__, g(k,i+1,j,i_xyz) )
2074 call check( __line__, g(k,i,j-1,i_xyz) )
2075 call check( __line__, g(k,i,j+1,i_xyz) )
2076 call check( __line__, pott(k,i-2,j ) )
2077 call check( __line__, pott(k,i-1,j ) )
2078 call check( __line__, pott(k,i ,j ) )
2079 call check( __line__, pott(k,i+1,j ) )
2080 call check( __line__, pott(k,i+2,j ) )
2081 call check( __line__, pott(k,i ,j-2) )
2082 call check( __line__, pott(k,i ,j-1) )
2083 call check( __line__, pott(k,i ,j ) )
2084 call check( __line__, pott(k,i ,j+1) )
2085 call check( __line__, pott(k,i ,j+2) )
2088 m(4,k,i,j) = g(k,i-1,j,i_xyz) &
2089 * ( fact_n * (pott(k,i ,j)+pott(k,i-1,j)) &
2090 + fact_f * (pott(k,i+1,j)+pott(k,i-2,j)) ) &
2091 * rfdx(i-1) * rcdx(i)
2093 m(5,k,i,j) = g(k,i+1,j,i_xyz) &
2094 * ( fact_n * (pott(k,i+1,j)+pott(k,i ,j)) &
2095 + fact_f * (pott(k,i+2,j)+pott(k,i-1,j)) ) &
2096 * rfdx(i ) * rcdx(i)
2098 m(6,k,i,j) = g(k,i,j-1,i_xyz) &
2099 * ( fact_n * (pott(k,i,j )+pott(k,i,j-1)) &
2100 + fact_f * (pott(k,i,j+1)+pott(k,i,j-2)) ) &
2101 * rfdy(j-1) * rcdy(j)
2103 m(7,k,i,j) = g(k,i,j+1,i_xyz) &
2104 * ( fact_n * (pott(k,i,j+1)+pott(k,i,j )) &
2105 + fact_f * (pott(k,i,j+2)+pott(k,i,j-1)) ) &
2106 * rfdy(j ) * rcdy(j)
2111 k = iundef; i = iundef; j = iundef
2117 subroutine mul_matrix(V, M, C)
2119 real(RP),
intent(out) :: V(
ka,
ia,
ja)
2120 real(RP),
intent(in) :: M(7,
ka,
ia,
ja)
2121 real(RP),
intent(in) :: C(
ka,
ia,
ja)
2133 call check( __line__, m(1,k,i,j) )
2134 call check( __line__, m(2,k,i,j) )
2135 call check( __line__, m(3,k,i,j) )
2136 call check( __line__, m(4,k,i,j) )
2137 call check( __line__, m(5,k,i,j) )
2138 call check( __line__, m(6,k,i,j) )
2139 call check( __line__, m(7,k,i,j) )
2140 call check( __line__, c(k ,i ,j ) )
2141 call check( __line__, c(k-1,i ,j ) )
2142 call check( __line__, c(k+1,i ,j ) )
2143 call check( __line__, c(k ,i-1,j ) )
2144 call check( __line__, c(k ,i+1,j ) )
2145 call check( __line__, c(k ,i ,j-1) )
2146 call check( __line__, c(k ,i ,j+1) )
2148 v(k,i,j) = m(1,k,i,j) * c(k ,i ,j ) &
2149 + m(2,k,i,j) * c(k-1,i ,j ) &
2150 + m(3,k,i,j) * c(k+1,i ,j ) &
2151 + m(4,k,i,j) * c(k ,i-1,j ) &
2152 + m(5,k,i,j) * c(k ,i+1,j ) &
2153 + m(6,k,i,j) * c(k ,i ,j-1) &
2154 + m(7,k,i,j) * c(k ,i ,j+1)
2159 k = iundef; i = iundef; j = iundef
2164 call check( __line__, m(1,
ks,i,j) )
2165 call check( __line__, m(3,
ks,i,j) )
2166 call check( __line__, m(4,
ks,i,j) )
2167 call check( __line__, m(5,
ks,i,j) )
2168 call check( __line__, m(6,
ks,i,j) )
2169 call check( __line__, m(7,
ks,i,j) )
2170 call check( __line__, c(
ks ,i ,j ) )
2171 call check( __line__, c(
ks+1,i ,j ) )
2172 call check( __line__, c(
ks ,i-1,j ) )
2173 call check( __line__, c(
ks ,i+1,j ) )
2174 call check( __line__, c(
ks ,i ,j-1) )
2175 call check( __line__, c(
ks ,i ,j+1) )
2176 call check( __line__, m(1,
ke,i,j) )
2177 call check( __line__, m(2,
ke,i,j) )
2178 call check( __line__, m(4,
ke,i,j) )
2179 call check( __line__, m(5,
ke,i,j) )
2180 call check( __line__, m(6,
ke,i,j) )
2181 call check( __line__, m(7,
ke,i,j) )
2182 call check( __line__, c(
ke ,i ,j ) )
2183 call check( __line__, c(
ke-1,i ,j ) )
2184 call check( __line__, c(
ke ,i-1,j ) )
2185 call check( __line__, c(
ke ,i+1,j ) )
2186 call check( __line__, c(
ke ,i ,j-1) )
2187 call check( __line__, c(
ke ,i ,j+1) )
2189 v(
ks,i,j) = m(1,
ks,i,j) * c(
ks ,i ,j ) &
2190 + m(3,
ks,i,j) * c(
ks+1,i ,j ) &
2191 + m(4,
ks,i,j) * c(
ks ,i-1,j ) &
2192 + m(5,
ks,i,j) * c(
ks ,i+1,j ) &
2193 + m(6,
ks,i,j) * c(
ks ,i ,j-1) &
2194 + m(7,
ks,i,j) * c(
ks ,i ,j+1)
2195 v(
ke,i,j) = m(1,
ke,i,j) * c(
ke ,i ,j ) &
2196 + m(2,
ke,i,j) * c(
ke-1,i ,j ) &
2197 + m(4,
ke,i,j) * c(
ke ,i-1,j ) &
2198 + m(5,
ke,i,j) * c(
ke ,i+1,j ) &
2199 + m(6,
ke,i,j) * c(
ke ,i ,j-1) &
2200 + m(7,
ke,i,j) * c(
ke ,i ,j+1)
2204 k = iundef; i = iundef; j = iundef
2208 end subroutine mul_matrix
2211 subroutine solve_multigrid
2212 end subroutine solve_multigrid
2216 subroutine check_solver( &
2220 real(RP),
intent(in) :: DPRES(
ka,
ia,
ja)
2221 real(RP),
intent(in) :: M(7,
ka,
ia,
ja)
2222 real(RP),
intent(in) :: B(
ka,
ia,
ja)
2228 call mul_matrix(b2, m, dpres)
2233 err = abs( b2(k,i,j) - b(k,i,j) )
2234 if ( err > 1.e-5_rp .and. abs( err / b(k,i,j) ) > 1.e-5_rp )
then 2235 log_error(
"check_solver",*)
"solver error is too large: ", k,i,j, b(k,i,j), b2(k,i,j)
2242 end subroutine check_solver
2244 subroutine check_pres( &
2252 real(RP),
intent(in) :: DPRES_N(
ka,
ia,
ja)
2253 real(RP),
intent(in) :: DPRES(
ka,
ia,
ja)
2254 real(RP),
intent(in) :: RHOT_RK(
ka,
ia,
ja)
2255 real(RP),
intent(in) :: RHOT(
ka,
ia,
ja)
2256 real(RP),
intent(in) :: DENS_RK(
ka,
ia,
ja)
2257 real(RP),
intent(in) :: DENS(
ka,
ia,
ja)
2258 real(RP),
intent(in) :: B(
ka,
ia,
ja)
2259 real(RP),
intent(in) :: RT2P(
ka,
ia,
ja)
2261 real(RP) :: lhs, rhs
2267 lhs = dpres_n(k,i,j) - dpres(k,i,j)
2268 rhs = rt2p(k,i,j) * ( rhot_rk(k,i,j) - rhot(k,i,j) )
2269 if ( abs( (lhs - rhs) / lhs ) > 1e-15 )
then 2270 log_error(
"check_pres",*)
"error is too large: ", k,i,j, lhs, rhs, &
2271 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)
2277 end subroutine check_pres
integer, parameter, public i_rhot
integer, public comm_world
communication world ID
procedure(flux_mom), pointer, public atmos_dyn_fvm_fluxx_xvz
procedure(flux_j), pointer, public atmos_dyn_fvm_fluxj23_uyz
integer, public ia
of whole cells: x, local, with HALO
integer, parameter, public i_momx
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
module Atmosphere / Dynamics RK
integer, public iblock
block size for cache blocking: x
procedure(flux_j), pointer, public atmos_dyn_fvm_fluxj13_xyw
integer, public ja
of whole cells: y, local, with HALO
integer, public io_fid_conf
Config file ID.
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
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, wdamp_coef, 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, last)
integer, parameter, public i_momy
real(rp), public const_undef
procedure(flux_mom), pointer, public atmos_dyn_fvm_fluxx_xyw
integer, public is
start point of inner domain: x, local
procedure(flux_mom), pointer, public atmos_dyn_fvm_fluxy_xyw
integer, public ie
end point of inner domain: x, local
procedure(flux_z), pointer, public atmos_dyn_fvm_fluxz_xvz
integer, parameter, public ydir
module atmosphere / grid / cartesC index
integer, public ke
end point of inner domain: z, local
subroutine solve_bicgstab(DPRES_N, DPRES, M, B)
real(rp), public const_pre00
pressure reference [Pa]
integer, public je
end point of inner domain: y, local
subroutine, public atmos_dyn_tstep_short_fvm_hivi_setup
Setup.
real(rp), public const_grav
standard acceleration of gravity [m/s2]
integer, parameter, public const_undef2
undefined value (INT2)
module Atmosphere / Dynamics common
integer, public ks
start point of inner domain: z, local
integer, public jblock
block size for cache blocking: y
subroutine, public prc_abort
Abort Process.
procedure(valuew), pointer, public atmos_dyn_fvm_flux_valuew_z
integer, public js
start point of inner domain: y, local
integer, parameter, public xdir
procedure(flux_j), pointer, public atmos_dyn_fvm_fluxj13_xvz
procedure(flux_z), pointer, public atmos_dyn_fvm_fluxz_uyz
module scale_atmos_dyn_fvm_flux
integer, public ka
of whole cells: z, local, with HALO
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, parameter, public sp
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
integer, parameter, public zdir
integer, parameter, public dp
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