14 #include "inc_openmp.h" 15 #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 write(*,*)
'xxx ATMOS_DYN_TYPE is not FVM-HIVI. Check!' 101 if(
io_l )
write(
io_fid_log,*)
'*** Register additional prognostic variables (HIVI)' 102 if ( va_out < 1 )
then 116 namelist / param_atmos_dyn_tstep_fvm_hivi / &
128 write(*,*)
'xxx 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 if(
io_l )
write(
io_fid_log,*)
'*** Not found namelist. Default used.' 142 elseif( ierr > 0 )
then 143 write(*,*)
'xxx Not appropriate names in namelist PARAM_ATMOS_DYN_TSTEP_FVM_HIVI. Check!' 149 mtype = mpi_double_precision
150 elseif(
rp ==
sp )
then 153 write(*,*)
'xxx 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, &
222 real(RP),
intent(out) :: dens_rk(
ka,
ia,
ja)
223 real(RP),
intent(out) :: momz_rk(
ka,
ia,
ja)
224 real(RP),
intent(out) :: momx_rk(
ka,
ia,
ja)
225 real(RP),
intent(out) :: momy_rk(
ka,
ia,
ja)
226 real(RP),
intent(out) :: rhot_rk(
ka,
ia,
ja)
228 real(RP),
intent(out) :: prog_rk(
ka,
ia,
ja,
va)
230 real(RP),
intent(inout) :: mflx_hi(
ka,
ia,
ja,3)
231 real(RP),
intent(out) :: tflx_hi(
ka,
ia,
ja,3)
233 real(RP),
intent(in),
target :: dens0(
ka,
ia,
ja)
234 real(RP),
intent(in),
target :: momz0(
ka,
ia,
ja)
235 real(RP),
intent(in),
target :: momx0(
ka,
ia,
ja)
236 real(RP),
intent(in),
target :: momy0(
ka,
ia,
ja)
237 real(RP),
intent(in),
target :: rhot0(
ka,
ia,
ja)
239 real(RP),
intent(in) :: dens(
ka,
ia,
ja)
240 real(RP),
intent(in) :: momz(
ka,
ia,
ja)
241 real(RP),
intent(in) :: momx(
ka,
ia,
ja)
242 real(RP),
intent(in) :: momy(
ka,
ia,
ja)
243 real(RP),
intent(in) :: rhot(
ka,
ia,
ja)
245 real(RP),
intent(in) :: dens_t(
ka,
ia,
ja)
246 real(RP),
intent(in) :: momz_t(
ka,
ia,
ja)
247 real(RP),
intent(in) :: momx_t(
ka,
ia,
ja)
248 real(RP),
intent(in) :: momy_t(
ka,
ia,
ja)
249 real(RP),
intent(in) :: rhot_t(
ka,
ia,
ja)
251 real(RP),
intent(in) :: prog0(
ka,
ia,
ja,
va)
252 real(RP),
intent(in) :: prog (
ka,
ia,
ja,
va)
254 real(RP),
intent(in) :: dpres0(
ka,
ia,
ja)
255 real(RP),
intent(in) :: rt2p(
ka,
ia,
ja)
256 real(RP),
intent(in) :: corioli(1,
ia,
ja)
257 real(RP),
intent(in) :: num_diff(
ka,
ia,
ja,5,3)
258 real(RP),
intent(in) :: wdamp_coef(
ka)
259 real(RP),
intent(in) :: divdmp_coef
260 real(RP),
intent(in) :: ddiv(
ka,
ia,
ja)
262 logical,
intent(in) :: flag_fct_momentum
263 logical,
intent(in) :: flag_fct_t
264 logical,
intent(in) :: flag_fct_along_stream
266 real(RP),
intent(in) :: cdz(
ka)
267 real(RP),
intent(in) :: fdz(
ka-1)
268 real(RP),
intent(in) :: fdx(
ia-1)
269 real(RP),
intent(in) :: fdy(
ja-1)
270 real(RP),
intent(in) :: rcdz(
ka)
271 real(RP),
intent(in) :: rcdx(
ia)
272 real(RP),
intent(in) :: rcdy(
ja)
273 real(RP),
intent(in) :: rfdz(
ka-1)
274 real(RP),
intent(in) :: rfdx(
ia-1)
275 real(RP),
intent(in) :: rfdy(
ja-1)
277 real(RP),
intent(in) :: phi (
ka,
ia,
ja)
278 real(RP),
intent(in) :: gsqrt (
ka,
ia,
ja,7)
279 real(RP),
intent(in) :: j13g (
ka,
ia,
ja,7)
280 real(RP),
intent(in) :: j23g (
ka,
ia,
ja,7)
281 real(RP),
intent(in) :: j33g
282 real(RP),
intent(in) :: mapf (
ia,
ja,2,4)
283 real(RP),
intent(in) :: ref_dens(
ka,
ia,
ja)
284 real(RP),
intent(in) :: ref_rhot(
ka,
ia,
ja)
286 logical,
intent(in) :: bnd_w
287 logical,
intent(in) :: bnd_e
288 logical,
intent(in) :: bnd_s
289 logical,
intent(in) :: bnd_n
291 real(RP),
intent(in) :: dtrk
292 logical,
intent(in) :: last
296 real(RP) :: pott(
ka,
ia,
ja)
297 real(RP) :: ddens(
ka,
ia,
ja)
298 real(RP) :: dpres(
ka,
ia,
ja)
299 real(RP) :: dpres_n(
ka,
ia,
ja)
306 real(RP) :: rcs2t(
ka,
ia,
ja)
311 real(RP) :: qflx_hi (
ka,
ia,
ja,3)
312 real(RP) :: qflx_j13(
ka,
ia,
ja)
313 real(RP) :: qflx_j23(
ka,
ia,
ja)
314 real(RP) :: mflx_hi2(
ka,
ia,
ja,3)
321 real(RP) :: zero(
ka,
ia,
ja)
325 integer :: iis, iie, jjs, jje
334 mflx_hi(:,:,:,:) = undef
335 mflx_hi(
ks-1,:,:,
zdir) = 0.0_rp
337 qflx_hi(:,:,:,:) = undef
338 tflx_hi(:,:,:,:) = undef
339 qflx_j13(:,:,:) = undef
340 qflx_j23(:,:,:) = undef
341 mflx_hi2(:,:,:,:) = undef
355 #if defined DEBUG || defined QUICKDEBUG 356 dens_rk( 1:
ks-1,:,:) = undef
357 dens_rk(
ke+1:
ka ,:,:) = undef
358 momz_rk( 1:
ks-1,:,:) = undef
359 momz_rk(
ke+1:
ka ,:,:) = undef
360 momx_rk( 1:
ks-1,:,:) = undef
361 momx_rk(
ke+1:
ka ,:,:) = undef
362 momy_rk( 1:
ks-1,:,:) = undef
363 momy_rk(
ke+1:
ka ,:,:) = undef
364 rhot_rk( 1:
ks-1,:,:) = undef
365 rhot_rk(
ke+1:
ka ,:,:) = undef
366 prog_rk( 1:
ks-1,:,:,:) = undef
367 prog_rk(
ke+1:
ka ,:,:,:) = undef
382 call check( __line__, dpres0(k,i,j) )
383 call check( __line__, rt2p(k,i,j) )
384 call check( __line__, rhot(k,i,j) )
385 call check( __line__, ref_rhot(k,i,j) )
387 dpres(k,i,j) = dpres0(k,i,j) + rt2p(k,i,j) * ( rhot(k,i,j) - ref_rhot(k,i,j) )
389 dpres(
ks-1,i,j) = dpres0(
ks-1,i,j) - dens(
ks,i,j) * ( phi(
ks-1,i,j) - phi(
ks+1,i,j) )
390 dpres(
ke+1,i,j) = dpres0(
ke+1,i,j) - dens(
ke,i,j) * ( phi(
ke+1,i,j) - phi(
ke-1,i,j) )
399 call check( __line__, dens(k,i,j) )
400 call check( __line__, ref_dens(k,i,j) )
402 ddens(k,i,j) = dens(k,i,j) - ref_dens(k,i,j)
412 call check( __line__, rhot(k,i,j) )
413 call check( __line__, dens(k,i,j) )
415 pott(k,i,j) = rhot(k,i,j) / dens(k,i,j)
420 k = iundef; i = iundef; j = iundef
428 call check( __line__, rt2p(k,i,j) )
430 rcs2t(k,i,j) = 1.0_rp / rt2p(k,i,j)
435 k = iundef; i = iundef; j = iundef
446 call check( __line__, momx(k+1,i ,j) )
447 call check( __line__, momx(k+1,i-1,j) )
448 call check( __line__, momx(k ,i ,j) )
449 call check( __line__, momx(k ,i+1,j) )
450 call check( __line__, momy(k+1,i,j) )
451 call check( __line__, momy(k+1,i,j-1) )
452 call check( __line__, momy(k ,i,j) )
453 call check( __line__, momy(k ,i,j-1) )
457 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) &
458 + momx(k ,i,j)+momx(k ,i-1,j) ) &
459 + j23g(k,i,j,
i_xyw) * 0.25_rp * ( momy(k+1,i,j)+momy(k+1,i,j-1) &
460 + momy(k ,i,j)+momy(k ,i,j-1) ) &
466 k = iundef; i = iundef; j = iundef
472 mflx_hi2(
ks-1,i,j,
zdir) = 0.0_rp
473 mflx_hi2(
ke ,i,j,
zdir) = 0.0_rp
486 mflx_hi2(k,i,j,
xdir) = gsqrt(k,i,j,
i_uyz) * num_diff(k,i,j,
i_dens,
xdir)
491 k = iundef; i = iundef; j = iundef
502 mflx_hi2(k,i,j,
ydir) = gsqrt(k,i,j,
i_xvz) * num_diff(k,i,j,
i_dens,
ydir)
507 k = iundef; i = iundef; j = iundef
516 gsqrt(:,:,:,
i_xyz), j33g, &
522 gsqrt(:,:,:,
i_xyz), j13g(:,:,:,
i_xyz), mapf(:,:,:,
i_xy), &
527 gsqrt(:,:,:,
i_xyz), j23g(:,:,:,
i_xyz), mapf(:,:,:,
i_xy), &
552 call check( __line__, qflx_hi(k ,i ,j ,
zdir) )
553 call check( __line__, qflx_hi(k-1,i ,j ,
zdir) )
554 call check( __line__, qflx_j13(k ,i ,j ) )
555 call check( __line__, qflx_j13(k-1,i ,j ) )
556 call check( __line__, qflx_j23(k ,i ,j ) )
557 call check( __line__, qflx_j23(k-1,i ,j ) )
558 call check( __line__, qflx_hi(k ,i ,j ,
xdir) )
559 call check( __line__, qflx_hi(k ,i-1,j ,
xdir) )
560 call check( __line__, qflx_hi(k ,i ,j ,
ydir) )
561 call check( __line__, qflx_hi(k ,i ,j-1,
ydir) )
562 call check( __line__, ddiv(k ,i,j) )
563 call check( __line__, ddiv(k+1,i,j) )
564 call check( __line__, momz0(k,i,j) )
565 call check( __line__, momz_t(k,i,j) )
568 - ( ( qflx_hi(k,i,j,
zdir) - qflx_hi(k-1,i ,j ,
zdir) &
569 + qflx_j13(k,i,j) - qflx_j13(k-1,i ,j ) &
570 + qflx_j23(k,i,j) - qflx_j23(k-1,i ,j ) ) * rfdz(k) &
571 + ( qflx_hi(k,i,j,
xdir) - qflx_hi(k ,i-1,j ,
xdir) ) * rcdx(i) &
572 + ( qflx_hi(k,i,j,
ydir) - qflx_hi(k ,i ,j-1,
ydir) ) * rcdy(j) &
573 ) / gsqrt(k,i,j,
i_xyw) &
574 - wdamp_coef(k) * momz0(k,i,j) &
575 + divdmp_coef * rdt * ( ddiv(k+1,i,j)-ddiv(k,i,j) ) * fdz(k) &
581 k = iundef; i = iundef; j = iundef
586 sw(
ks-1,i,j) = 0.0_rp
591 k = iundef; i = iundef; j = iundef
600 gsqrt(:,:,:,
i_uyw), j33g, &
606 gsqrt(:,:,:,
i_uyz), j13g(:,:,:,
i_uyw), mapf(:,:,:,
i_uy), &
611 gsqrt(:,:,:,
i_uyz), j23g(:,:,:,
i_uyw), mapf(:,:,:,
i_uy), &
638 call check( __line__, qflx_hi(k ,i ,j ,
zdir) )
639 call check( __line__, qflx_hi(k-1,i ,j ,
zdir) )
640 call check( __line__, qflx_hi(k ,i ,j ,
xdir) )
641 call check( __line__, qflx_hi(k ,i-1,j ,
xdir) )
642 call check( __line__, qflx_hi(k ,i ,j ,
ydir) )
643 call check( __line__, qflx_hi(k ,i ,j-1,
ydir) )
644 call check( __line__, dpres(k+1,i+1,j) )
645 call check( __line__, dpres(k+1,i ,j) )
646 call check( __line__, dpres(k-1,i+1,j) )
647 call check( __line__, dpres(k-1,i ,j) )
648 call check( __line__, corioli(1,i ,j) )
649 call check( __line__, corioli(1,i+1,j) )
650 call check( __line__, momy(k,i ,j ) )
651 call check( __line__, momy(k,i+1,j ) )
652 call check( __line__, momy(k,i ,j-1) )
653 call check( __line__, momy(k,i+1,j-1) )
654 call check( __line__, ddiv(k,i+1,j) )
655 call check( __line__, ddiv(k,i ,j) )
656 call check( __line__, momx0(k,i,j) )
659 - ( ( qflx_hi(k,i,j,
zdir) - qflx_hi(k-1,i ,j ,
zdir) &
660 + qflx_j13(k,i,j) - qflx_j13(k-1,i ,j) &
661 + qflx_j23(k,i,j) - qflx_j23(k-1,i ,j) ) * rcdz(k) &
662 + ( qflx_hi(k,i,j,
xdir) - qflx_hi(k ,i-1,j ,
xdir) ) * rfdx(i) &
663 + ( qflx_hi(k,i,j,
ydir) - qflx_hi(k ,i ,j-1,
ydir) ) * rcdy(j) ) &
664 - ( j13g(k+1,i,j,
i_uyz) * ( dpres(k+1,i+1,j)+dpres(k+1,i,j) ) &
665 - j13g(k-1,i,j,
i_uyz) * ( dpres(k-1,i+1,j)+dpres(k-1,i,j) ) ) &
666 * 0.5_rp / ( fdz(k+1)+fdz(k) ) &
667 ) / gsqrt(k,i,j,
i_uyz) &
668 + 0.125_rp * ( corioli(1,i,j)+corioli(1,i+1,j) ) &
669 * ( momy(k,i,j)+momy(k,i+1,j)+momy(k,i,j-1)+momy(k,i+1,j-1) ) &
670 + divdmp_coef * rdt * ( ddiv(k,i+1,j)-ddiv(k,i,j) ) * fdx(i) &
676 k = iundef; i = iundef; j = iundef
684 gsqrt(:,:,:,
i_xvw), j33g, &
690 gsqrt(:,:,:,
i_xvz), j13g(:,:,:,
i_xvw), mapf(:,:,:,
i_xv), &
695 gsqrt(:,:,:,
i_xvz), j23g(:,:,:,
i_xvw), mapf(:,:,:,
i_xv), &
722 call check( __line__, qflx_hi(k ,i ,j ,
zdir) )
723 call check( __line__, qflx_hi(k-1,i ,j ,
zdir) )
724 call check( __line__, qflx_hi(k ,i ,j ,
xdir) )
725 call check( __line__, qflx_hi(k ,i-1,j ,
xdir) )
726 call check( __line__, qflx_hi(k ,i ,j ,
ydir) )
727 call check( __line__, qflx_hi(k ,i ,j-1,
ydir) )
728 call check( __line__, dpres(k+1,i,j ) )
729 call check( __line__, dpres(k+1,i,j+1) )
730 call check( __line__, dpres(k-1,i,j ) )
731 call check( __line__, dpres(k-1,i,j+1) )
732 call check( __line__, corioli(1,i,j ) )
733 call check( __line__, corioli(1,i,j+1) )
734 call check( __line__, momx(k,i ,j ) )
735 call check( __line__, momx(k,i ,j+1) )
736 call check( __line__, momx(k,i-1,j ) )
737 call check( __line__, momx(k,i-1,j+1) )
738 call check( __line__, ddiv(k,i,j+1) )
739 call check( __line__, ddiv(k,i,j ) )
740 call check( __line__, momy_t(k,i,j) )
743 ( - ( ( qflx_hi(k,i,j,
zdir) - qflx_hi(k-1,i ,j ,
zdir) &
744 + qflx_j13(k,i,j) - qflx_j13(k-1,i ,j ) &
745 + qflx_j23(k,i,j) - qflx_j23(k-1,i ,j ) ) * rcdz(k) &
746 + ( qflx_hi(k,i,j,
xdir) - qflx_hi(k ,i-1,j ,
xdir) ) * rcdx(i) &
747 + ( qflx_hi(k,i,j,
ydir) - qflx_hi(k ,i ,j-1,
ydir) ) * rfdy(j) ) &
748 - ( j23g(k+1,i,j,
i_xvz) * ( dpres(k+1,i,j+1)+dpres(k+1,i,j) ) &
749 - j23g(k-1,i,j,
i_xvz) * ( dpres(k-1,i,j+1)+dpres(k-1,i,j) ) ) &
750 * 0.5_rp / ( fdz(k+1)+fdz(k) ) &
751 ) / gsqrt(k,i,j,
i_xvz) &
752 - 0.125_rp * ( corioli(1,i ,j+1)+corioli(1,i ,j) ) &
753 * ( momx(k,i,j+1)+momx(k,i,j)+momx(k,i-1,j+1)+momx(k,i-1,j) ) &
754 + divdmp_coef * rdt * ( ddiv(k,i,j+1)-ddiv(k,i,j) ) * fdy(j) &
760 k = iundef; i = iundef; j = iundef
768 mflx_hi2(:,:,:,
zdir), pott, gsqrt(:,:,:,
i_xyw), &
775 mflx_hi2(:,:,:,
xdir), pott, gsqrt(:,:,:,
i_uyz), &
782 mflx_hi2(:,:,:,
ydir), pott, gsqrt(:,:,:,
i_xvz), &
792 call check( __line__, tflx_hi(k ,i ,j ,
zdir) )
793 call check( __line__, tflx_hi(k-1,i ,j ,
zdir) )
794 call check( __line__, tflx_hi(k ,i ,j ,
xdir) )
795 call check( __line__, tflx_hi(k ,i-1,j ,
xdir) )
796 call check( __line__, tflx_hi(k ,i ,j ,
ydir) )
797 call check( __line__, tflx_hi(k ,i ,j-1,
ydir) )
798 call check( __line__, rhot_t(k,i,j) )
801 - ( ( tflx_hi(k,i,j,
zdir) - tflx_hi(k-1,i ,j ,
zdir) ) * rcdz(k) &
802 + ( tflx_hi(k,i,j,
xdir) - tflx_hi(k ,i-1,j ,
xdir) ) * rcdx(i) &
803 + ( tflx_hi(k,i,j,
ydir) - tflx_hi(k ,i ,j-1,
ydir) ) * rcdy(j) &
804 ) / gsqrt(k,i,j,
i_xyz) &
810 k = iundef; i = iundef; j = iundef
823 call comm_vars8( su, 1 )
824 call comm_vars8( sv, 2 )
825 call comm_wait ( su, 1 )
826 call comm_wait ( sv, 2 )
837 call check( __line__, momz(k-1,i,j) )
838 call check( __line__, momz(k ,i,j) )
839 call check( __line__, momx(k,i-1,j) )
840 call check( __line__, momx(k,i ,j) )
841 call check( __line__, momy(k,i,j-1) )
842 call check( __line__, momy(k,i,j ) )
843 call check( __line__, pott(k-2,i,j) )
844 call check( __line__, pott(k-1,i,j) )
845 call check( __line__, pott(k ,i,j) )
846 call check( __line__, pott(k+1,i,j) )
847 call check( __line__, pott(k+2,i,j) )
848 call check( __line__, pott(k,i-2,j) )
849 call check( __line__, pott(k,i-1,j) )
850 call check( __line__, pott(k,i ,j) )
851 call check( __line__, pott(k,i+1,j) )
852 call check( __line__, pott(k,i+2,j) )
853 call check( __line__, pott(k,i,j-2) )
854 call check( __line__, pott(k,i,j-1) )
855 call check( __line__, pott(k,i,j ) )
856 call check( __line__, pott(k,i,j+1) )
857 call check( __line__, pott(k,i,j+2) )
858 call check( __line__, sw(k-1,i,j) )
859 call check( __line__, sw(k ,i,j) )
860 call check( __line__, su(k,i-1,j) )
861 call check( __line__, su(k,i ,j) )
862 call check( __line__, sv(k,i,j-1) )
863 call check( __line__, sv(k,i,j ) )
869 call check( __line__, st(k,i,j) )
870 call check( __line__, dpres(k-1,i,j) )
871 call check( __line__, dpres(k ,i,j) )
872 call check( __line__, dpres(k+1,i,j) )
873 call check( __line__, rt2p(k-1,i,j) )
874 call check( __line__, rt2p(k ,i,j) )
875 call check( __line__, rt2p(k+1,i,j) )
876 call check( __line__, rhot(k-1,i,j) )
877 call check( __line__, rhot(k+1,i,j) )
878 call check( __line__, ddens(k-1,i,j) )
879 call check( __line__, ddens(k+1,i,j) )
882 ( j33g * ( momz(k ,i,j) + dtrk*sw(k ,i,j) ) &
883 * ( fact_n*(pott(k+1,i,j)+pott(k ,i,j)) &
884 + fact_f*(pott(k+2,i,j)+pott(k-1,i,j)) ) &
885 - j33g * ( momz(k-1,i,j) + dtrk*sw(k-1,i,j) ) &
886 * ( fact_n*(pott(k ,i,j)+pott(k-1,i,j)) &
887 + fact_f*(pott(k+1,i,j)+pott(k-2,i,j)) ) ) * rcdz(k) &
888 + ( gsqrt(k,i ,j,
i_uyz) * ( momx(k,i ,j) + dtrk*su(k,i ,j) ) &
889 * ( fact_n*(pott(k,i+1,j)+pott(k,i ,j)) &
890 + fact_f*(pott(k,i+2,j)+pott(k,i-1,j)) ) &
891 - gsqrt(k,i-1,j,
i_uyz) * ( momx(k,i-1,j) + dtrk*su(k,i-1,j) ) &
892 * ( fact_n*(pott(k,i ,j)+pott(k,i-1,j)) &
893 + fact_f*(pott(k,i+1,j)+pott(k,i-2,j)) ) ) * rcdx(i) &
894 + ( gsqrt(k,i,j ,
i_xvz) * ( momy(k,i,j ) + dtrk*sv(k,i,j ) ) &
895 * ( fact_n*(pott(k,i,j+1)+pott(k,i,j )) &
896 + fact_f*(pott(k,i,j+2)+pott(k,i,j-1)) ) &
897 - gsqrt(k,i,j-1,
i_xvz) * ( momy(k,i,j-1) + dtrk*sv(k,i,j-1) ) &
898 * ( fact_n*(pott(k,i,j )+pott(k,i,j-1)) &
899 + fact_f*(pott(k,i,j+1)+pott(k,i,j-2)) ) ) * rcdy(j) &
900 + gsqrt(k,i,j,
i_xyz) * ( st(k,i,j) - dpres(k,i,j) * rcs2t(k,i,j) * rdt ) &
902 + grav * j33g * ( ( dpres(k+1,i,j)*rcs2t(k+1,i,j) &
903 - dpres(k-1,i,j)*rcs2t(k-1,i,j) ) &
904 - ( rhot(k+1,i,j)*ddens(k+1,i,j)/dens(k+1,i,j) &
905 - rhot(k-1,i,j)*ddens(k-1,i,j)/dens(k-1,i,j) ) &
906 ) / ( fdz(k) + fdz(k-1) )
911 k = iundef; i = iundef; j = iundef
916 call check( __line__, momz(
ks,i,j) )
917 call check( __line__, momx(
ks,i,j) )
918 call check( __line__, momy(
ks,i,j) )
919 call check( __line__, sw(
ks,i,j) )
920 call check( __line__, su(
ks,i-1,j) )
921 call check( __line__, su(
ks,i ,j) )
922 call check( __line__, sv(
ks,i,j-1) )
923 call check( __line__, sv(
ks,i,j ) )
924 call check( __line__, st(
ks,i,j) )
925 call check( __line__, pott(
ks ,i,j) )
926 call check( __line__, pott(
ks+1,i,j) )
927 call check( __line__, pott(
ks,i-2,j) )
928 call check( __line__, pott(
ks,i-1,j) )
929 call check( __line__, pott(
ks,i ,j) )
930 call check( __line__, pott(
ks,i+1,j) )
931 call check( __line__, pott(
ks,i+2,j) )
932 call check( __line__, pott(
ks,i,j-2) )
933 call check( __line__, pott(
ks,i,j-1) )
934 call check( __line__, pott(
ks,i,j ) )
935 call check( __line__, pott(
ks,i,j+1) )
936 call check( __line__, pott(
ks,i,j+2) )
940 call check( __line__, dpres(
ks ,i,j) )
941 call check( __line__, dpres(
ks+1,i,j) )
942 call check( __line__, rt2p(
ks ,i,j) )
943 call check( __line__, rt2p(
ks+1,i,j) )
944 call check( __line__, rhot(
ks+1,i,j) )
945 call check( __line__, ddens(
ks+1,i,j) )
948 ( j33g * ( momz(
ks ,i,j) + dtrk*sw(
ks ,i,j) ) &
949 * 0.5_rp*(pott(
ks+1,i,j)+pott(
ks ,i,j)) ) * rcdz(
ks) &
950 + ( gsqrt(
ks,i ,j,
i_uyz) * ( momx(
ks,i ,j) + dtrk*su(
ks,i ,j) ) &
951 * ( fact_n*(pott(
ks,i+1,j)+pott(
ks,i ,j)) &
952 + fact_f*(pott(
ks,i+2,j)+pott(
ks,i-1,j)) ) &
953 - gsqrt(
ks,i-1,j,
i_uyz) * ( momx(
ks,i-1,j) + dtrk*su(
ks,i-1,j) ) &
954 * ( fact_n*(pott(
ks,i ,j)+pott(
ks,i-1,j)) &
955 + fact_f*(pott(
ks,i+1,j)+pott(
ks,i-2,j)) ) ) * rcdx(i) &
956 + ( gsqrt(
ks,i,j ,
i_xvz) * ( momy(
ks,i,j ) + dtrk*sv(
ks,i,j ) ) &
957 * ( fact_n*(pott(
ks,i,j+1)+pott(
ks,i,j )) &
958 + fact_f*(pott(
ks,i,j+2)+pott(
ks,i,j-1)) ) &
959 - gsqrt(
ks,i,j-1,
i_xvz) * ( momy(
ks,i,j-1) + dtrk*sv(
ks,i,j-1) ) &
960 * ( fact_n*(pott(
ks,i,j )+pott(
ks,i,j-1)) &
961 + fact_f*(pott(
ks,i,j+1)+pott(
ks,i,j-2)) ) ) * rcdy(j) &
962 + gsqrt(
ks,i,j,
i_xyz) * ( st(
ks,i,j) - dpres(
ks,i,j) * rcs2t(
ks,i,j) * rdt ) &
964 + grav * j33g * 0.5_rp * ( ( dpres(
ks,i,j)+dpres(
ks+1,i,j) ) * rcs2t(
ks,i,j) &
965 - ( ddens(
ks,i,j)+ddens(
ks+1,i,j) ) * pott(
ks,i,j) ) * rcdz(
ks)
967 call check( __line__, momz(
ks ,i,j) )
968 call check( __line__, momz(
ks+1 ,i,j) )
969 call check( __line__, momx(
ks+1,i-1,j) )
970 call check( __line__, momx(
ks+1,i ,j) )
971 call check( __line__, momy(
ks+1,i,j-1) )
972 call check( __line__, momy(
ks+1,i,j ) )
973 call check( __line__, pott(
ks ,i,j) )
974 call check( __line__, pott(
ks+1 ,i,j) )
975 call check( __line__, pott(
ks+1+1,i,j) )
976 call check( __line__, pott(
ks+1+2,i,j) )
977 call check( __line__, pott(
ks+1,i-2,j) )
978 call check( __line__, pott(
ks+1,i-1,j) )
979 call check( __line__, pott(
ks+1,i ,j) )
980 call check( __line__, pott(
ks+1,i+1,j) )
981 call check( __line__, pott(
ks+1,i+2,j) )
982 call check( __line__, pott(
ks+1,i,j-2) )
983 call check( __line__, pott(
ks+1,i,j-1) )
984 call check( __line__, pott(
ks+1,i,j ) )
985 call check( __line__, pott(
ks+1,i,j+1) )
986 call check( __line__, pott(
ks+1,i,j+2) )
987 call check( __line__, sw(
ks ,i,j) )
988 call check( __line__, sw(
ks+1,i,j) )
989 call check( __line__, su(
ks+1,i-1,j) )
990 call check( __line__, su(
ks+1,i ,j) )
991 call check( __line__, sv(
ks+1,i,j-1) )
992 call check( __line__, sv(
ks+1,i,j ) )
998 call check( __line__, st(
ks+1,i,j) )
999 call check( __line__, dpres(
ks ,i,j) )
1000 call check( __line__, dpres(
ks+1,i,j) )
1001 call check( __line__, dpres(
ks+2,i,j) )
1002 call check( __line__, rt2p(
ks ,i,j) )
1003 call check( __line__, rt2p(
ks+1,i,j) )
1004 call check( __line__, rt2p(
ks+2,i,j) )
1005 call check( __line__, rhot(
ks ,i,j) )
1006 call check( __line__, rhot(
ks+2,i,j) )
1007 call check( __line__, ddens(
ks ,i,j) )
1008 call check( __line__, ddens(
ks+2,i,j) )
1011 ( j33g * ( momz(
ks+1,i,j) + dtrk*sw(
ks+1,i,j) ) &
1012 * ( fact_n*(pott(
ks+2,i,j)+pott(
ks+1,i,j)) &
1013 + fact_f*(pott(
ks+3,i,j)+pott(
ks ,i,j)) ) &
1014 - j33g * ( momz(
ks+1-1,i,j) + dtrk*sw(
ks+1-1,i,j) ) &
1015 * ( 0.5_rp*(pott(
ks+1,i,j)+pott(
ks,i,j)) ) ) * rcdz(
ks+1) &
1016 + ( gsqrt(
ks+1,i ,j,
i_uyz) * ( momx(
ks+1,i ,j) + dtrk*su(
ks+1,i ,j) ) &
1017 * ( fact_n*(pott(
ks+1,i+1,j)+pott(
ks+1,i ,j)) &
1018 + fact_f*(pott(
ks+1,i+2,j)+pott(
ks+1,i-1,j)) ) &
1019 - gsqrt(
ks+1,i-1,j,
i_uyz) * ( momx(
ks+1,i-1,j) + dtrk*su(
ks+1,i-1,j) ) &
1020 * ( fact_n*(pott(
ks+1,i ,j)+pott(
ks+1,i-1,j)) &
1021 + fact_f*(pott(
ks+1,i+1,j)+pott(
ks+1,i-2,j)) ) ) * rcdx(i) &
1022 + ( gsqrt(
ks+1,i,j ,
i_xvz) * ( momy(
ks+1,i,j ) + dtrk*sv(
ks+1,i,j ) ) &
1023 * ( fact_n*(pott(
ks+1,i,j+1)+pott(
ks+1,i,j )) &
1024 + fact_f*(pott(
ks+1,i,j+2)+pott(
ks+1,i,j-1)) ) &
1025 - gsqrt(
ks+1,i,j-1,
i_xvz) * ( momy(
ks+1,i,j-1) + dtrk*sv(
ks+1,i,j-1) ) &
1026 * ( fact_n*(pott(
ks+1,i,j )+pott(
ks+1,i,j-1)) &
1027 + fact_f*(pott(
ks+1,i,j+1)+pott(
ks+1,i,j-2)) ) ) * rcdy(j) &
1028 + gsqrt(
ks+1,i,j,
i_xyz) * ( st(
ks+1,i,j) - dpres(
ks+1,i,j) * rcs2t(
ks+1,i,j) * rdt ) &
1030 + grav * j33g * ( ( dpres(
ks+2,i,j)*rcs2t(
ks+2,i,j) &
1031 - dpres(
ks ,i,j)*rcs2t(
ks ,i,j) ) &
1032 - ( rhot(
ks+2,i,j)*ddens(
ks+2,i,j)/dens(
ks+2,i,j) &
1033 - rhot(
ks ,i,j)*ddens(
ks ,i,j)/dens(
ks ,i,j) ) &
1034 ) / ( fdz(
ks+1) + fdz(
ks) )
1036 call check( __line__, momz(
ke-2,i,j) )
1037 call check( __line__, momz(
ke-1,i,j) )
1038 call check( __line__, momx(
ke-1,i-1,j) )
1039 call check( __line__, momx(
ke-1,i ,j) )
1040 call check( __line__, momy(
ke-1,i,j-1) )
1041 call check( __line__, momy(
ke-1,i,j ) )
1042 call check( __line__, pott(
ke-3,i,j) )
1043 call check( __line__, pott(
ke-2,i,j) )
1044 call check( __line__, pott(
ke-1,i,j) )
1045 call check( __line__, pott(
ke ,i,j) )
1046 call check( __line__, pott(
ke-1,i-2,j) )
1047 call check( __line__, pott(
ke-1,i-1,j) )
1048 call check( __line__, pott(
ke-1,i ,j) )
1049 call check( __line__, pott(
ke-1,i+1,j) )
1050 call check( __line__, pott(
ke-1,i+2,j) )
1051 call check( __line__, pott(
ke-1,i,j-2) )
1052 call check( __line__, pott(
ke-1,i,j-1) )
1053 call check( __line__, pott(
ke-1,i,j ) )
1054 call check( __line__, pott(
ke-1,i,j+1) )
1055 call check( __line__, pott(
ke-1,i,j+2) )
1056 call check( __line__, sw(
ke-2,i,j) )
1057 call check( __line__, sw(
ke-1,i,j) )
1058 call check( __line__, su(
ke-1,i-1,j) )
1059 call check( __line__, su(
ke-1,i ,j) )
1060 call check( __line__, sv(
ke-1,i,j-1) )
1061 call check( __line__, sv(
ke-1,i,j ) )
1067 call check( __line__, st(
ke-1,i,j) )
1068 call check( __line__, dpres(
ke-2,i,j) )
1069 call check( __line__, dpres(
ke-1,i,j) )
1070 call check( __line__, dpres(
ke ,i,j) )
1071 call check( __line__, rt2p(
ke-2,i,j) )
1072 call check( __line__, rt2p(
ke-1,i,j) )
1073 call check( __line__, rt2p(
ke ,i,j) )
1074 call check( __line__, rhot(
ke-2,i,j) )
1075 call check( __line__, rhot(
ke,i,j) )
1076 call check( __line__, ddens(
ke-2,i,j) )
1077 call check( __line__, ddens(
ke,i,j) )
1080 ( j33g * ( momz(
ke-1,i,j) + dtrk*sw(
ke-1,i,j) ) &
1081 * ( 0.5_rp*(pott(
ke ,i,j)+pott(
ke-1,i,j)) ) &
1082 - j33g * ( momz(
ke-2,i,j) + dtrk*sw(
ke-2,i,j) ) &
1083 * ( fact_n*(pott(
ke-1,i,j)+pott(
ke-2,i,j)) &
1084 + fact_f*(pott(
ke ,i,j)+pott(
ke-3,i,j)) ) ) * rcdz(
ke-1) &
1085 + ( gsqrt(
ke-1,i ,j,
i_uyz) * ( momx(
ke-1,i ,j) + dtrk*su(
ke-1,i ,j) ) &
1086 * ( fact_n*(pott(
ke-1,i+1,j)+pott(
ke-1,i ,j)) &
1087 + fact_f*(pott(
ke-1,i+2,j)+pott(
ke-1,i-1,j)) ) &
1088 - gsqrt(
ke-1,i-1,j,
i_uyz) * ( momx(
ke-1,i-1,j) + dtrk*su(
ke-1,i-1,j) ) &
1089 * ( fact_n*(pott(
ke-1,i ,j)+pott(
ke-1,i-1,j)) &
1090 + fact_f*(pott(
ke-1,i+1,j)+pott(
ke-1,i-2,j)) ) ) * rcdx(i) &
1091 + ( gsqrt(
ke-1,i,j ,
i_xvz) * ( momy(
ke-1,i,j ) + dtrk*sv(
ke-1,i,j ) ) &
1092 * ( fact_n*(pott(
ke-1,i,j+1)+pott(
ke-1,i,j )) &
1093 + fact_f*(pott(
ke-1,i,j+2)+pott(
ke-1,i,j-1)) ) &
1094 - gsqrt(
ke-1,i,j-1,
i_xvz) * ( momy(
ke-1,i,j-1) + dtrk*sv(
ke-1,i,j-1) ) &
1095 * ( fact_n*(pott(
ke-1,i,j )+pott(
ke-1,i,j-1)) &
1096 + fact_f*(pott(
ke-1,i,j+1)+pott(
ke-1,i,j-2)) ) ) * rcdy(j) &
1097 + gsqrt(
ke-1,i,j,
i_xyz) * ( st(
ke-1,i,j) - dpres(
ke-1,i,j) * rcs2t(
ke-1,i,j) * rdt ) &
1099 + grav * j33g * ( ( dpres(
ke ,i,j)*rcs2t(
ke ,i,j) &
1100 - dpres(
ke-2,i,j)*rcs2t(
ke-2,i,j) ) &
1101 - ( rhot(
ke ,i,j)*ddens(
ke ,i,j)/dens(
ke ,i,j) &
1102 - rhot(
ke-2,i,j)*ddens(
ke-2,i,j)/dens(
ke-2,i,j) )&
1103 ) / ( fdz(
ke-1) + fdz(
ke-1-1) )
1105 call check( __line__, momz(
ke-1,i,j) )
1106 call check( __line__, momx(
ke,i-1,j) )
1107 call check( __line__, momx(
ke,i ,j) )
1108 call check( __line__, momy(
ke,i,j-1) )
1109 call check( __line__, momy(
ke,i,j ) )
1110 call check( __line__, sw(
ke-1,i,j) )
1111 call check( __line__, su(
ke,i-1,j) )
1112 call check( __line__, su(
ke,i ,j) )
1113 call check( __line__, sv(
ke,i,j-1) )
1114 call check( __line__, sv(
ke,i,j ) )
1116 call check( __line__, pott(
ke-1,i,j) )
1117 call check( __line__, pott(
ke ,i,j) )
1118 call check( __line__, pott(
ke,i-2,j) )
1119 call check( __line__, pott(
ke,i-1,j) )
1120 call check( __line__, pott(
ke,i ,j) )
1121 call check( __line__, pott(
ke,i+1,j) )
1122 call check( __line__, pott(
ke,i+2,j) )
1123 call check( __line__, pott(
ke,i,j-2) )
1124 call check( __line__, pott(
ke,i,j-1) )
1125 call check( __line__, pott(
ke,i,j ) )
1126 call check( __line__, pott(
ke,i,j+1) )
1127 call check( __line__, pott(
ke,i,j+2) )
1133 call check( __line__, st(
ke,i,j) )
1134 call check( __line__, dpres(
ke-1,i,j) )
1135 call check( __line__, dpres(
ke ,i,j) )
1136 call check( __line__, rt2p(
ke-1,i,j) )
1137 call check( __line__, rt2p(
ke ,i,j) )
1138 call check( __line__, rhot(
ke-1,i,j) )
1139 call check( __line__, ddens(
ke-1,i,j) )
1143 - j33g * ( momz(
ke-1,i,j) + dtrk*sw(
ke-1,i,j) ) &
1144 * 0.5_rp*(pott(
ke ,i,j)+pott(
ke-1,i,j)) ) * rcdz(
ke) &
1145 + ( gsqrt(
ke,i ,j,
i_uyz) * ( momx(
ke,i ,j) + dtrk*su(
ke,i ,j) ) &
1146 * ( fact_n*(pott(
ke,i+1,j)+pott(
ke,i ,j)) &
1147 + fact_f*(pott(
ke,i+2,j)+pott(
ke,i-1,j)) ) &
1148 - gsqrt(
ke,i-1,j,
i_uyz) * ( momx(
ke,i-1,j) + dtrk*su(
ke,i-1,j) ) &
1149 * ( fact_n*(pott(
ke,i ,j)+pott(
ke,i-1,j)) &
1150 + fact_f*(pott(
ke,i+1,j)+pott(
ke,i-2,j)) ) ) * rcdx(i) &
1151 + ( gsqrt(
ke,i,j ,
i_xvz) * ( momy(
ke,i,j ) + dtrk*sv(
ke,i,j ) ) &
1152 * ( fact_n*(pott(
ke,i,j+1)+pott(
ke,i,j )) &
1153 + fact_f*(pott(
ke,i,j+2)+pott(
ke,i,j-1)) ) &
1154 - gsqrt(
ke,i,j-1,
i_xvz) * ( momy(
ke,i,j-1) + dtrk*sv(
ke,i,j-1) ) &
1155 * ( fact_n*(pott(
ke,i,j )+pott(
ke,i,j-1)) &
1156 + fact_f*(pott(
ke,i,j+1)+pott(
ke,i,j-2)) ) ) * rcdy(j) &
1157 + gsqrt(
ke,i,j,
i_xyz) * ( st(
ke,i,j) - dpres(
ke,i,j) * rcs2t(
ke,i,j) * rdt ) &
1159 + grav * j33g * 0.5_rp * ( - ( dpres(
ke,i,j)+dpres(
ke-1,i,j) ) * rcs2t(
ke,i,j) &
1160 + ( ddens(
ke,i,j)+ddens(
ke-1,i,j) ) * pott(
ke,i,j) ) * rcdz(
ke)
1164 k = iundef; i = iundef; j = iundef
1169 pott, rcs2t, grav, &
1171 rcdz, rfdz, rcdx, rfdx, rcdy,rfdy, fdz, &
1175 iis, iie, jjs, jje )
1185 call comm_vars8( dpres_n, 1 )
1186 call comm_wait ( dpres_n, 1 )
1189 call check_solver( dpres_n, m, b )
1194 call solve_multigrid
1211 call check( __line__, dpres_n(k+1,i,j) )
1212 call check( __line__, dpres_n(k ,i,j) )
1213 call check( __line__, dpres(k+1,i,j) )
1214 call check( __line__, dpres(k ,i,j) )
1215 call check( __line__, ddens(k+1,i,j) )
1216 call check( __line__, ddens(k ,i,j) )
1217 call check( __line__, ref_dens(k+1,i,j) )
1218 call check( __line__, ref_dens(k,i,j) )
1219 call check( __line__, momz0(k,i,j) )
1222 - j33g * ( dpres_n(k+1,i,j) - dpres_n(k,i,j) ) * rfdz(k) &
1223 ) / gsqrt(k,i,j,
i_uyz) &
1225 * ( ddens(k+1,i,j) &
1226 + ( dpres_n(k+1,i,j) - dpres(k+1,i,j) ) &
1227 / ( pott(k+1,i,j) * rt2p(k+1,i,j) ) &
1229 + ( dpres_n(k ,i,j) - dpres(k ,i,j) ) &
1230 / ( pott(k ,i,j) * rt2p(k ,i,j) ) ) &
1232 momz_rk(k,i,j) = momz0(k,i,j) + duvw
1233 mflx_hi(k,i,j,
zdir) = j33g * ( momz(k,i,j) + duvw )
1238 k = iundef; i = iundef; j = iundef
1242 mflx_hi(
ks-1,i,j,
zdir) = 0.0_rp
1243 mflx_hi(
ke ,i,j,
zdir) = 0.0_rp
1247 k = iundef; i = iundef; j = iundef
1259 call check( __line__, dpres_n(k,i+1,j) )
1260 call check( __line__, dpres_n(k,i ,j) )
1264 call check( __line__, su(k,i,j) )
1265 call check( __line__, momx0(k,i,j) )
1268 - ( gsqrt(k,i+1,j,
i_xyz) * dpres_n(k,i+1,j) &
1269 - gsqrt(k,i ,j,
i_xyz) * dpres_n(k,i ,j) ) * rfdx(i) &
1270 ) / gsqrt(k,i,j,
i_uyz) &
1273 momx_rk(k,i,j) = momx0(k,i,j) + duvw
1274 mflx_hi(k,i,j,
xdir) = gsqrt(k,i,j,
i_uyz) * ( momx(k,i,j) + duvw )
1279 k = iundef; i = iundef; j = iundef
1290 call check( __line__, dpres_n(k,i,j ) )
1291 call check( __line__, dpres_n(k,i,j+1) )
1295 call check( __line__, sv(k,i,j) )
1296 call check( __line__, momy0(k,i,j) )
1299 - ( gsqrt(k,i,j+1,
i_xyz) * dpres_n(k,i,j+1) &
1300 - gsqrt(k,i,j ,
i_xyz) * dpres_n(k,i,j ) ) * rfdy(j) &
1301 ) / gsqrt(k,i,j,
i_xvz) &
1303 momy_rk(k,i,j) = momy0(k,i,j) + duvw
1304 mflx_hi(k,i,j,
ydir) = gsqrt(k,i,j,
i_xvz) * ( momy(k,i,j) + duvw )
1309 k = iundef; i = iundef; j = iundef
1321 call check( __line__, mflx_hi(k,i,j,
zdir) )
1322 call check( __line__, pott(k,i-1,j) )
1323 call check( __line__, pott(k,i ,j) )
1324 call check( __line__, pott(k,i+1,j) )
1325 call check( __line__, pott(k,i+1,j) )
1328 tflx_hi(k,i,j,
zdir) = mflx_hi(k,i,j,
zdir) &
1329 * ( fact_n * ( pott(k+1,i,j) + pott(k ,i,j) ) &
1330 + fact_f * ( pott(k+2,i,j) + pott(k-1,i,j) ) )
1335 k = iundef; i = iundef; j = iundef
1340 tflx_hi(
ks-1,i,j,
zdir) = 0.0_rp
1341 tflx_hi(
ks ,i,j,
zdir) = mflx_hi(
ks ,i,j,
zdir) * 0.5_rp * ( pott(
ks+1,i,j) + pott(
ks ,i,j) )
1342 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) )
1343 tflx_hi(
ke ,i,j,
zdir) = 0.0_rp
1347 k = iundef; i = iundef; j = iundef
1355 call check( __line__, mflx_hi(k,i,j,
xdir) )
1356 call check( __line__, pott(k,i-1,j) )
1357 call check( __line__, pott(k,i ,j) )
1358 call check( __line__, pott(k,i+1,j) )
1359 call check( __line__, pott(k,i+1,j) )
1362 tflx_hi(k,i,j,
xdir) = mflx_hi(k,i,j,
xdir) &
1363 * ( fact_n * ( pott(k,i+1,j)+pott(k,i ,j) ) &
1364 + fact_f * ( pott(k,i+2,j)+pott(k,i-1,j) ) )
1369 k = iundef; i = iundef; j = iundef
1377 call check( __line__, mflx_hi(k,i,j,
ydir) )
1378 call check( __line__, pott(k,i,j-1) )
1379 call check( __line__, pott(k,i,j ) )
1380 call check( __line__, pott(k,i,j+1) )
1381 call check( __line__, pott(k,i,j+2) )
1384 tflx_hi(k,i,j,
ydir) = mflx_hi(k,i,j,
ydir) &
1385 * ( fact_n * ( pott(k,i,j+1)+pott(k,i,j ) ) &
1386 + fact_f * ( pott(k,i,j+2)+pott(k,i,j-1) ) )
1391 k = iundef; i = iundef; j = iundef
1398 rhot_rk(k,i,j) = rhot0(k,i,j) &
1399 + dtrk * ( - ( ( tflx_hi(k,i,j,
zdir) - tflx_hi(k-1,i ,j ,
zdir) ) * rcdz(k) &
1400 + ( tflx_hi(k,i,j,
xdir) - tflx_hi(k ,i-1,j ,
xdir) ) * rcdx(i) &
1401 + ( tflx_hi(k,i,j,
ydir) - tflx_hi(k ,i ,j-1,
ydir) ) * rcdy(j) ) &
1402 / gsqrt(k,i,j,
i_xyz) &
1414 mflx_hi(k,i,j,
zdir) = mflx_hi(k,i,j,
zdir) + mflx_hi2(k,i,j,
zdir)
1421 mflx_hi(k,i,j,
xdir) = mflx_hi(k,i,j,
xdir) + mflx_hi2(k,i,j,
xdir)
1428 mflx_hi(k,i,j,
ydir) = mflx_hi(k,i,j,
ydir) + mflx_hi2(k,i,j,
ydir)
1439 call check( __line__, dens0(k,i,j) )
1440 call check( __line__, mflx_hi(k ,i ,j ,
xdir) )
1441 call check( __line__, mflx_hi(k ,i-1,j ,
xdir) )
1442 call check( __line__, mflx_hi(k ,i ,j ,
ydir) )
1443 call check( __line__, mflx_hi(k ,i ,j-1,
ydir) )
1444 call check( __line__, dens_t(k,i,j) )
1446 dens_rk(k,i,j) = dens0(k,i,j) &
1447 + dtrk * ( - ( ( mflx_hi(k,i,j,
zdir)-mflx_hi(k-1,i ,j,
zdir) ) * rcdz(k) &
1448 + ( mflx_hi(k,i,j,
xdir)-mflx_hi(k ,i-1,j,
xdir) ) * rcdx(i) &
1449 + ( mflx_hi(k,i,j,
ydir)-mflx_hi(k ,i, j-1,
ydir) ) * rcdy(j) ) &
1450 / gsqrt(k,i,j,
i_xyz) &
1456 k = iundef; i = iundef; j = iundef
1462 dpres_n, dpres, rhot_rk, rhot, dens_rk, dens, b,&
1472 #ifdef HIVI_BICGSTAB 1484 real(RP),
intent(out) :: DPRES_N(KA,IA,JA)
1485 real(RP),
intent(in) :: DPRES(KA,IA,JA)
1486 real(RP),
intent(in) :: M(7,KA,IA,JA)
1487 real(RP),
intent(in) :: B(KA,IA,JA)
1489 real(RP) :: r0(KA,IA,JA)
1491 real(RP) :: p(KA,IA,JA)
1492 real(RP) :: Mp(KA,IA,JA)
1493 real(RP) :: s(KA,IA,JA)
1494 real(RP) :: Ms(KA,IA,JA)
1495 real(RP) :: al, be, w
1497 real(RP),
pointer :: r(:,:,:)
1498 real(RP),
pointer :: rn(:,:,:)
1499 real(RP),
pointer :: swap(:,:,:)
1500 real(RP),
target :: v0(KA,IA,JA)
1501 real(RP),
target :: v1(KA,IA,JA)
1503 real(RP) :: norm, error, error2
1505 real(RP) :: iprod(2)
1509 integer :: iis, iie, jjs, jje
1527 call mul_matrix( v1, m, dpres )
1540 norm = norm + b(k,i,j)**2
1545 k = iundef; i = iundef; j = iundef
1553 call check( __line__, b(k,i,j) )
1554 call check( __line__, v1(k,i,j) )
1556 r(k,i,j) = b(k,i,j) - v1(k,i,j)
1561 k = iundef; i = iundef; j = iundef
1567 r0(k,i,j) = r(k,i,j)
1573 k = iundef; i = iundef; j = iundef
1580 call check( __line__, r(k,i,j) )
1581 call check( __line__, r0(k,i,j) )
1583 r0r = r0r + r0(k,i,j) * r(k,i,j)
1588 k = iundef; i = iundef; j = iundef
1597 dpres_n(k,i,j) = dpres(k,i,j)
1605 call mpi_allreduce(iprod, buf, 2, mtype, mpi_sum,
comm_world, ierror)
1618 call check( __line__, r(k,i,j) )
1620 error = error + r(k,i,j)**2
1625 k = iundef; i = iundef; j = iundef
1627 call mpi_allreduce(error, buf, 1, mtype, mpi_sum,
comm_world, ierror)
1631 if(
io_l )
write(*,*) iter, error/norm
1633 if ( sqrt(error/norm) < epsilon .OR. error > error2 )
then 1635 if(
io_l )
write(*,*)
"Bi-CGSTAB converged:", iter
1641 call comm_vars8( p, 1 )
1642 call comm_wait ( p, 1 )
1643 call mul_matrix( mp, m, p )
1650 call check( __line__, r0(k,i,j) )
1651 call check( __line__, mp(k,i,j) )
1653 iprod(1) = iprod(1) + r0(k,i,j) * mp(k,i,j)
1658 k = iundef; i = iundef; j = iundef
1660 call mpi_allreduce(iprod, buf, 1, mtype, mpi_sum,
comm_world, ierror)
1667 call check( __line__, r(k,i,j) )
1668 call check( __line__, mp(k,i,j) )
1670 s(k,i,j) = r(k,i,j) - al*mp(k,i,j)
1675 k = iundef; i = iundef; j = iundef
1678 call comm_vars8( s, 1 )
1679 call comm_wait ( s, 1 )
1680 call mul_matrix( ms, m, s )
1687 call check( __line__, ms(k,i,j) )
1688 call check( __line__, s(k,i,j) )
1690 iprod(1) = iprod(1) + ms(k,i,j) * s(k,i,j)
1691 iprod(2) = iprod(2) + ms(k,i,j) * ms(k,i,j)
1696 k = iundef; i = iundef; j = iundef
1698 call mpi_allreduce(iprod, buf, 2, mtype, mpi_sum,
comm_world, ierror)
1712 call check( __line__, dpres_n(k,i,j) )
1713 call check( __line__, p(k,i,j) )
1714 call check( __line__, s(k,i,j) )
1716 dpres_n(k,i,j) = dpres_n(k,i,j) + al*p(k,i,j) + w*s(k,i,j)
1721 k = iundef; i = iundef; j = iundef
1728 call check( __line__, s(k,i,j) )
1729 call check( __line__, ms(k,i,j) )
1731 rn(k,i,j) = s(k,i,j) - w*ms(k,i,j)
1736 k = iundef; i = iundef; j = iundef
1743 call check( __line__, r0(k,i,j) )
1744 call check( __line__, rn(k,i,j) )
1746 iprod(1) = iprod(1) + r0(k,i,j) * rn(k,i,j)
1751 k = iundef; i = iundef; j = iundef
1759 call mpi_allreduce(iprod, r0r, 1, mtype, mpi_sum,
comm_world, ierror)
1766 call check( __line__, rn(k,i,j) )
1767 call check( __line__, p(k,i,j) )
1768 call check( __line__, mp(k,i,j) )
1770 p(k,i,j) = rn(k,i,j) + be * ( p(k,i,j) - w*mp(k,i,j) )
1775 k = iundef; i = iundef; j = iundef
1786 if ( iter >= itmax )
then 1787 write(*,*)
'xxx [atmos_dyn_hivi] Bi-CGSTAB' 1788 write(*,*)
'xxx not converged', error, norm
1797 POTT, RCs2T, GRAV, &
1799 RCDZ, RFDZ, RCDX, RFDX, RCDY, RFDY, FDZ, &
1803 IIS, IIE, JJS, JJE )
1805 real(RP),
intent(inout) :: M(7,KA,IA,JA)
1806 real(RP),
intent(in) :: POTT(KA,IA,JA)
1807 real(RP),
intent(in) :: RCs2T(KA,IA,JA)
1808 real(RP),
intent(in) :: GRAV
1809 real(RP),
intent(in) :: G(KA,IA,JA,7)
1810 real(RP),
intent(in) :: J33G
1811 real(RP),
intent(in) :: RCDZ(KA)
1812 real(RP),
intent(in) :: RFDZ(KA-1)
1813 real(RP),
intent(in) :: RFDX(IA-1)
1814 real(RP),
intent(in) :: RCDX(IA)
1815 real(RP),
intent(in) :: RCDY(JA)
1816 real(RP),
intent(in) :: RFDY(JA-1)
1817 real(RP),
intent(in) :: FDZ(KA-1)
1818 real(RP),
intent(in) :: rdt
1819 real(RP),
intent(in) :: FACT_N
1820 real(RP),
intent(in) :: FACT_F
1821 integer,
intent(in) :: I_XYZ
1822 integer,
intent(in) :: I_XYW
1823 integer,
intent(in) :: IIS
1824 integer,
intent(in) :: IIE
1825 integer,
intent(in) :: JJS
1826 integer,
intent(in) :: JJE
1834 call check( __line__, pott(k-2,i,j) )
1835 call check( __line__, pott(k-1,i,j) )
1836 call check( __line__, pott(k ,i,j) )
1837 call check( __line__, pott(k+1,i,j) )
1838 call check( __line__, pott(k+2,i,j) )
1839 call check( __line__, pott(k,i-2,j) )
1840 call check( __line__, pott(k,i-1,j) )
1841 call check( __line__, pott(k,i ,j) )
1842 call check( __line__, pott(k,i+1,j) )
1843 call check( __line__, pott(k,i+2,j) )
1844 call check( __line__, pott(k,i,j-2) )
1845 call check( __line__, pott(k,i,j-1) )
1846 call check( __line__, pott(k,i,j ) )
1847 call check( __line__, pott(k,i,j+1) )
1848 call check( __line__, pott(k,i,j+2) )
1849 call check( __line__, g(k-1,i,j,i_xyw) )
1850 call check( __line__, g(k+1,i,j,i_xyw) )
1851 call check( __line__, g(k,i,j,i_xyz) )
1852 call check( __line__, rcs2t(k-1,i,j) )
1853 call check( __line__, rcs2t(k ,i,j) )
1854 call check( __line__, rcs2t(k+1,i,j) )
1858 - ( ( fact_n * (pott(k+1,i,j)+pott(k ,i,j)) &
1859 + fact_f * (pott(k+2,i,j)+pott(k-1,i,j)) ) * rfdz(k ) / g(k ,i,j,i_xyw) &
1860 + ( fact_n * (pott(k ,i,j)+pott(k-1,i,j)) &
1861 + fact_f * (pott(k+1,i,j)+pott(k-2,i,j)) ) * rfdz(k-1) / g(k-1,i,j,i_xyw) &
1862 ) * j33g * j33g * rfdz(k) &
1863 - ( ( fact_n * (pott(k,i+1,j)+pott(k,i ,j)) &
1864 + fact_f * (pott(k,i+2,j)+pott(k,i-1,j)) ) * rfdx(i ) &
1865 + ( fact_n * (pott(k,i ,j)+pott(k,i-1,j)) &
1866 + fact_f * (pott(k,i+1,j)+pott(k,i-2,j)) ) * rfdx(i-1) &
1867 ) * g(k,i,j,i_xyz) * rfdx(i) &
1868 - ( ( fact_n * (pott(k,i,j+1)+pott(k,i,j )) &
1869 + fact_f * (pott(k,i,j+2)+pott(k,i,j-1)) ) * rfdy(j ) &
1870 + ( fact_n * (pott(k,i,j )+pott(k,i,j-1)) &
1871 + fact_f * (pott(k,i,j-1)+pott(k,i,j-2)) ) * rfdy(j-1) &
1872 ) * g(k,i,j,i_xyz) * rfdy(j) &
1873 - g(k,i,j,i_xyz) * rcs2t(k,i,j) * rdt * rdt
1875 m(2,k,i,j) = j33g * j33g / g(k-1,i,j,i_xyw) &
1876 * ( fact_n * (pott(k ,i,j)+pott(k-1,i,j)) &
1877 + fact_f * (pott(k+1,i,j)+pott(k-2,i,j)) ) &
1878 * rfdz(k-1) * rcdz(k) &
1879 - grav * j33g * rcs2t(k-1,i,j) / ( fdz(k)+fdz(k-1) )
1881 m(3,k,i,j) = j33g * j33g / g(k+1,i,j,i_xyw) &
1882 * ( fact_n * (pott(k+1,i,j)+pott(k ,i,j)) &
1883 + fact_f * (pott(k+2,i,j)+pott(k-1,i,j)) ) &
1884 * rfdz(k ) * rcdz(k) &
1885 + grav * j33g * rcs2t(k+1,i,j) / ( fdz(k)+fdz(k-1) )
1890 k = iundef; i = iundef; j = iundef
1895 call check( __line__, pott(
ks ,i,j) )
1896 call check( __line__, pott(
ks+1,i,j) )
1897 call check( __line__, pott(
ks,i-2,j) )
1898 call check( __line__, pott(
ks,i-1,j) )
1899 call check( __line__, pott(
ks,i ,j) )
1900 call check( __line__, pott(
ks,i+1,j) )
1901 call check( __line__, pott(
ks,i+2,j) )
1902 call check( __line__, pott(
ks,i,j-2) )
1903 call check( __line__, pott(
ks,i,j-1) )
1904 call check( __line__, pott(
ks,i,j ) )
1905 call check( __line__, pott(
ks,i,j+1) )
1906 call check( __line__, pott(
ks,i,j+2) )
1907 call check( __line__, g(
ks,i,j,i_xyz) )
1908 call check( __line__, rcs2t(
ks,i,j) )
1909 call check( __line__, pott(
ks ,i,j) )
1910 call check( __line__, pott(
ks+1,i,j) )
1911 call check( __line__, g(
ks+1,i,j,i_xyw) )
1912 call check( __line__, rcs2t(
ks+1,i,j) )
1916 - ( 0.5_rp * (pott(
ks+1,i,j)+pott(
ks ,i,j)) * rfdz(
ks ) &
1917 ) * j33g * j33g / g(
ks ,i,j,i_xyw) * rfdz(
ks) &
1918 - ( ( fact_n * (pott(
ks,i+1,j)+pott(
ks,i ,j)) &
1919 + fact_f * (pott(
ks,i+2,j)+pott(
ks,i-1,j)) ) * rfdx(i ) &
1920 + ( fact_n * (pott(
ks,i ,j)+pott(
ks,i-1,j)) &
1921 + fact_f * (pott(
ks,i+1,j)+pott(
ks,i-2,j)) ) * rfdx(i-1) &
1922 ) * g(
ks,i,j,i_xyz) * rfdx(i) &
1923 - ( ( fact_n * (pott(
ks,i,j+1)+pott(
ks,i,j )) &
1924 + fact_f * (pott(
ks,i,j+2)+pott(
ks,i,j-1)) ) * rfdy(j ) &
1925 + ( fact_n * (pott(
ks,i,j )+pott(
ks,i,j-1)) &
1926 + fact_f * (pott(
ks,i,j-1)+pott(
ks,i,j-2)) ) * rfdy(j-1) &
1927 ) * g(
ks,i,j,i_xyz) * rfdy(j) &
1928 - g(
ks,i,j,i_xyz) * rcs2t(
ks,i,j) * rdt * rdt &
1929 + grav * j33g * 0.5_rp * rcs2t(
ks,i,j) * rcdz(
ks)
1931 m(3,
ks,i,j) = j33g * j33g / g(
ks+1,i,j,i_xyw) &
1932 * 0.5_rp * (pott(
ks+1,i,j)+pott(
ks ,i,j)) &
1933 * rfdz(
ks ) * rcdz(
ks) &
1934 + grav * j33g * 0.5_rp * rcs2t(
ks+1,i,j) * rcdz(
ks)
1936 call check( __line__, pott(
ks ,i,j) )
1937 call check( __line__, pott(
ks+1,i,j) )
1938 call check( __line__, pott(
ks+2,i,j) )
1939 call check( __line__, pott(
ks+3,i,j) )
1940 call check( __line__, pott(
ks+1,i-2,j) )
1941 call check( __line__, pott(
ks+1,i-1,j) )
1942 call check( __line__, pott(
ks+1,i ,j) )
1943 call check( __line__, pott(
ks+1,i+1,j) )
1944 call check( __line__, pott(
ks+1,i+2,j) )
1945 call check( __line__, pott(
ks+1,i,j-2) )
1946 call check( __line__, pott(
ks+1,i,j-1) )
1947 call check( __line__, pott(
ks+1,i,j ) )
1948 call check( __line__, pott(
ks+1,i,j+1) )
1949 call check( __line__, pott(
ks+1,i,j+2) )
1950 call check( __line__, g(
ks ,i,j,i_xyw) )
1951 call check( __line__, g(
ks+2,i,j,i_xyw) )
1952 call check( __line__, g(
ks+1,i,j,i_xyz) )
1953 call check( __line__, rcs2t(
ks ,i,j) )
1954 call check( __line__, rcs2t(
ks+1 ,i,j) )
1955 call check( __line__, rcs2t(
ks+2,i,j) )
1959 - ( ( fact_n * (pott(
ks+2,i,j)+pott(
ks+1,i,j)) &
1960 + fact_f * (pott(
ks+3,i,j)+pott(
ks ,i,j)) ) * rfdz(
ks+1) / g(
ks+1,i,j,i_xyw) &
1961 + 0.5_rp * (pott(
ks+1,i,j)+pott(
ks ,i,j)) * rfdz(
ks ) / g(
ks ,i,j,i_xyw) &
1962 ) * j33g * j33g * rfdz(
ks+1) &
1963 - ( ( fact_n * (pott(
ks+1,i+1,j)+pott(
ks+1,i ,j)) &
1964 + fact_f * (pott(
ks+1,i+2,j)+pott(
ks+1,i-1,j)) ) * rfdx(i ) &
1965 + ( fact_n * (pott(
ks+1,i ,j)+pott(
ks+1,i-1,j)) &
1966 + fact_f * (pott(
ks+1,i+1,j)+pott(
ks+1,i-2,j)) ) * rfdx(i-1) &
1967 ) * g(
ks+1,i,j,i_xyz) * rfdx(i) &
1968 - ( ( fact_n * (pott(
ks+1,i,j+1)+pott(
ks+1,i,j )) &
1969 + fact_f * (pott(
ks+1,i,j+2)+pott(
ks+1,i,j-1)) ) * rfdy(j ) &
1970 + ( fact_n * (pott(
ks+1,i,j )+pott(
ks+1,i,j-1)) &
1971 + fact_f * (pott(
ks+1,i,j-1)+pott(
ks+1,i,j-2)) ) * rfdy(j-1) &
1972 ) * g(
ks+1,i,j,i_xyz) * rfdy(j) &
1973 - g(
ks+1,i,j,i_xyz) * rcs2t(
ks+1,i,j) * rdt * rdt
1975 m(2,
ks+1,i,j) = j33g * j33g / g(
ks,i,j,i_xyw) &
1976 * 0.5_rp * (pott(
ks+1,i,j)+pott(
ks ,i,j)) &
1977 * rfdz(
ks ) * rcdz(
ks+1) &
1978 - grav * j33g * rcs2t(
ks ,i,j) / ( fdz(
ks+1)+fdz(
ks) )
1980 m(3,
ks+1,i,j) = j33g * j33g / g(
ks+2,i,j,i_xyw) &
1981 * ( fact_n * (pott(
ks+2,i,j)+pott(
ks+1,i,j)) &
1982 + fact_f * (pott(
ks+3,i,j)+pott(
ks ,i,j)) ) &
1983 * rfdz(
ks+1) * rcdz(
ks+1) &
1984 + grav * j33g * rcs2t(
ks+2,i,j) / ( fdz(
ks+1)+fdz(
ks) )
1986 call check( __line__, pott(
ke-3,i,j) )
1987 call check( __line__, pott(
ke-2,i,j) )
1988 call check( __line__, pott(
ke-1,i,j) )
1989 call check( __line__, pott(
ke ,i,j) )
1990 call check( __line__, pott(
ke-1,i-2,j) )
1991 call check( __line__, pott(
ke-1,i-1,j) )
1992 call check( __line__, pott(
ke-1,i ,j) )
1993 call check( __line__, pott(
ke-1,i+1,j) )
1994 call check( __line__, pott(
ke-1,i+2,j) )
1995 call check( __line__, pott(
ke-1,i,j-2) )
1996 call check( __line__, pott(
ke-1,i,j-1) )
1997 call check( __line__, pott(
ke-1,i,j ) )
1998 call check( __line__, pott(
ke-1,i,j+1) )
1999 call check( __line__, pott(
ke-1,i,j+2) )
2000 call check( __line__, g(
ke-2,i,j,i_xyw) )
2001 call check( __line__, g(
ke ,i,j,i_xyw) )
2002 call check( __line__, g(
ke-1,i,j,i_xyz) )
2003 call check( __line__, rcs2t(
ke-2,i,j) )
2004 call check( __line__, rcs2t(
ke-1,i,j) )
2005 call check( __line__, rcs2t(
ke ,i,j) )
2009 - ( 0.5_rp * (pott(
ke ,i,j)+pott(
ke-1,i,j)) * rfdz(
ke-1) / g(
ke-1,i,j,i_xyw) &
2010 + ( fact_n * (pott(
ke-1,i,j)+pott(
ke-2,i,j)) &
2011 + fact_f * (pott(
ke ,i,j)+pott(
ke-3,i,j)) ) * rfdz(
ke-2) / g(
ke-2,i,j,i_xyw) &
2012 ) * j33g * j33g * rfdz(
ke-1) &
2013 - ( ( fact_n * (pott(
ke-1,i+1,j)+pott(
ke-1,i ,j)) &
2014 + fact_f * (pott(
ke-1,i+2,j)+pott(
ke-1,i-1,j)) ) * rfdx(i ) &
2015 + ( fact_n * (pott(
ke-1,i ,j)+pott(
ke-1,i-1,j)) &
2016 + fact_f * (pott(
ke-1,i+1,j)+pott(
ke-1,i-2,j)) ) * rfdx(i-1) &
2017 ) * g(
ke-1,i,j,i_xyz) * rfdx(i) &
2018 - ( ( fact_n * (pott(
ke-1,i,j+1)+pott(
ke-1,i,j )) &
2019 + fact_f * (pott(
ke-1,i,j+2)+pott(
ke-1,i,j-1)) ) * rfdy(j ) &
2020 + ( fact_n * (pott(
ke-1,i,j )+pott(
ke-1,i,j-1)) &
2021 + fact_f * (pott(
ke-1,i,j-1)+pott(
ke-1,i,j-2)) ) * rfdy(j-1) &
2022 ) * g(
ke-1,i,j,i_xyz) * rfdy(j) &
2023 - g(
ke-1,i,j,i_xyz) * rcs2t(
ke-1,i,j) * rdt * rdt
2025 m(2,
ke-1,i,j) = j33g * j33g / g(
ke-2,i,j,i_xyw) &
2026 * ( fact_n * (pott(
ke-1,i,j)+pott(
ke-2,i,j)) &
2027 + fact_f * (pott(
ke ,i,j)+pott(
ke-3,i,j)) ) &
2028 * rfdz(
ke-2) * rcdz(
ke-1) &
2029 - grav * j33g * rcs2t(
ke-2,i,j) / ( fdz(
ke-1)+fdz(
ke-2) )
2031 m(3,
ke-1,i,j) = j33g * j33g / g(
ke ,i,j,i_xyw) &
2032 * 0.5_rp * (pott(
ke ,i,j)+pott(
ke-1,i,j)) &
2033 * rfdz(
ke-1) * rcdz(
ke-1) &
2034 + grav * j33g * rcs2t(
ke ,i,j) / ( fdz(
ke-1)+fdz(
ke-2) )
2036 call check( __line__, pott(
ke-1,i,j) )
2037 call check( __line__, pott(
ke ,i,j) )
2038 call check( __line__, pott(
ke,i-2,j) )
2039 call check( __line__, pott(
ke,i-1,j) )
2040 call check( __line__, pott(
ke,i ,j) )
2041 call check( __line__, pott(
ke,i+1,j) )
2042 call check( __line__, pott(
ke,i+2,j) )
2043 call check( __line__, pott(
ke,i,j-2) )
2044 call check( __line__, pott(
ke,i,j-1) )
2045 call check( __line__, pott(
ke,i,j ) )
2046 call check( __line__, pott(
ke,i,j+1) )
2047 call check( __line__, pott(
ke,i,j+2) )
2048 call check( __line__, g(
ke-1,i,j,i_xyw) )
2049 call check( __line__, g(
ke,i,j,i_xyz) )
2050 call check( __line__, rcs2t(
ke-1,i,j) )
2051 call check( __line__, rcs2t(
ke,i,j) )
2056 + 0.5_rp * (pott(
ke ,i,j)+pott(
ke-1,i,j)) * rfdz(
ke-1) / g(
ke-1,i,j,i_xyw) &
2057 ) * j33g * j33g * rfdz(
ke) &
2058 - ( ( fact_n * (pott(
ke,i+1,j)+pott(
ke,i ,j)) &
2059 + fact_f * (pott(
ke,i+2,j)+pott(
ke,i-1,j)) ) * rfdx(i ) &
2060 + ( fact_n * (pott(
ke,i ,j)+pott(
ke,i-1,j)) &
2061 + fact_f * (pott(
ke,i+1,j)+pott(
ke,i-2,j)) ) * rfdx(i-1) &
2062 ) * g(
ke,i,j,i_xyz) * rfdx(i) &
2063 - ( ( fact_n * (pott(
ke,i,j+1)+pott(
ke,i,j )) &
2064 + fact_f * (pott(
ke,i,j+2)+pott(
ke,i,j-1)) ) * rfdy(j ) &
2065 + ( fact_n * (pott(
ke,i,j )+pott(
ke,i,j-1)) &
2066 + fact_f * (pott(
ke,i,j-1)+pott(
ke,i,j-2)) ) * rfdy(j-1) &
2067 ) * g(
ke,i,j,i_xyz) * rfdy(j) &
2068 - g(
ke,i,j,i_xyz) * rcs2t(
ke,i,j) * rdt * rdt &
2069 - grav * j33g * 0.5_rp * rcs2t(
ke,i,j) * rcdz(
ke)
2071 m(2,
ke,i,j) = j33g * j33g / g(
ke-1,i,j,i_xyw) &
2072 * 0.5_rp * (pott(
ke ,i,j)+pott(
ke-1,i,j)) &
2073 * rfdz(
ke-1) * rcdz(
ke) &
2074 - grav * j33g * 0.5_rp * rcs2t(
ke,i,j) * rcdz(
ke)
2078 k = iundef; i = iundef; j = iundef
2085 call check( __line__, g(k,i-1,j,i_xyz) )
2086 call check( __line__, g(k,i+1,j,i_xyz) )
2087 call check( __line__, g(k,i,j-1,i_xyz) )
2088 call check( __line__, g(k,i,j+1,i_xyz) )
2089 call check( __line__, pott(k,i-2,j ) )
2090 call check( __line__, pott(k,i-1,j ) )
2091 call check( __line__, pott(k,i ,j ) )
2092 call check( __line__, pott(k,i+1,j ) )
2093 call check( __line__, pott(k,i+2,j ) )
2094 call check( __line__, pott(k,i ,j-2) )
2095 call check( __line__, pott(k,i ,j-1) )
2096 call check( __line__, pott(k,i ,j ) )
2097 call check( __line__, pott(k,i ,j+1) )
2098 call check( __line__, pott(k,i ,j+2) )
2101 m(4,k,i,j) = g(k,i-1,j,i_xyz) &
2102 * ( fact_n * (pott(k,i ,j)+pott(k,i-1,j)) &
2103 + fact_f * (pott(k,i+1,j)+pott(k,i-2,j)) ) &
2104 * rfdx(i-1) * rcdx(i)
2106 m(5,k,i,j) = g(k,i+1,j,i_xyz) &
2107 * ( fact_n * (pott(k,i+1,j)+pott(k,i ,j)) &
2108 + fact_f * (pott(k,i+2,j)+pott(k,i-1,j)) ) &
2109 * rfdx(i ) * rcdx(i)
2111 m(6,k,i,j) = g(k,i,j-1,i_xyz) &
2112 * ( fact_n * (pott(k,i,j )+pott(k,i,j-1)) &
2113 + fact_f * (pott(k,i,j+1)+pott(k,i,j-2)) ) &
2114 * rfdy(j-1) * rcdy(j)
2116 m(7,k,i,j) = g(k,i,j+1,i_xyz) &
2117 * ( fact_n * (pott(k,i,j+1)+pott(k,i,j )) &
2118 + fact_f * (pott(k,i,j+2)+pott(k,i,j-1)) ) &
2119 * rfdy(j ) * rcdy(j)
2124 k = iundef; i = iundef; j = iundef
2130 subroutine mul_matrix(V, M, C)
2132 real(RP),
intent(out) :: V(KA,IA,JA)
2133 real(RP),
intent(in) :: M(7,KA,IA,JA)
2134 real(RP),
intent(in) :: C(KA,IA,JA)
2146 call check( __line__, m(1,k,i,j) )
2147 call check( __line__, m(2,k,i,j) )
2148 call check( __line__, m(3,k,i,j) )
2149 call check( __line__, m(4,k,i,j) )
2150 call check( __line__, m(5,k,i,j) )
2151 call check( __line__, m(6,k,i,j) )
2152 call check( __line__, m(7,k,i,j) )
2153 call check( __line__, c(k ,i ,j ) )
2154 call check( __line__, c(k-1,i ,j ) )
2155 call check( __line__, c(k+1,i ,j ) )
2156 call check( __line__, c(k ,i-1,j ) )
2157 call check( __line__, c(k ,i+1,j ) )
2158 call check( __line__, c(k ,i ,j-1) )
2159 call check( __line__, c(k ,i ,j+1) )
2161 v(k,i,j) = m(1,k,i,j) * c(k ,i ,j ) &
2162 + m(2,k,i,j) * c(k-1,i ,j ) &
2163 + m(3,k,i,j) * c(k+1,i ,j ) &
2164 + m(4,k,i,j) * c(k ,i-1,j ) &
2165 + m(5,k,i,j) * c(k ,i+1,j ) &
2166 + m(6,k,i,j) * c(k ,i ,j-1) &
2167 + m(7,k,i,j) * c(k ,i ,j+1)
2172 k = iundef; i = iundef; j = iundef
2177 call check( __line__, m(1,
ks,i,j) )
2178 call check( __line__, m(3,
ks,i,j) )
2179 call check( __line__, m(4,
ks,i,j) )
2180 call check( __line__, m(5,
ks,i,j) )
2181 call check( __line__, m(6,
ks,i,j) )
2182 call check( __line__, m(7,
ks,i,j) )
2183 call check( __line__, c(
ks ,i ,j ) )
2184 call check( __line__, c(
ks+1,i ,j ) )
2185 call check( __line__, c(
ks ,i-1,j ) )
2186 call check( __line__, c(
ks ,i+1,j ) )
2187 call check( __line__, c(
ks ,i ,j-1) )
2188 call check( __line__, c(
ks ,i ,j+1) )
2189 call check( __line__, m(1,
ke,i,j) )
2190 call check( __line__, m(2,
ke,i,j) )
2191 call check( __line__, m(4,
ke,i,j) )
2192 call check( __line__, m(5,
ke,i,j) )
2193 call check( __line__, m(6,
ke,i,j) )
2194 call check( __line__, m(7,
ke,i,j) )
2195 call check( __line__, c(
ke ,i ,j ) )
2196 call check( __line__, c(
ke-1,i ,j ) )
2197 call check( __line__, c(
ke ,i-1,j ) )
2198 call check( __line__, c(
ke ,i+1,j ) )
2199 call check( __line__, c(
ke ,i ,j-1) )
2200 call check( __line__, c(
ke ,i ,j+1) )
2202 v(
ks,i,j) = m(1,
ks,i,j) * c(
ks ,i ,j ) &
2203 + m(3,
ks,i,j) * c(
ks+1,i ,j ) &
2204 + m(4,
ks,i,j) * c(
ks ,i-1,j ) &
2205 + m(5,
ks,i,j) * c(
ks ,i+1,j ) &
2206 + m(6,
ks,i,j) * c(
ks ,i ,j-1) &
2207 + m(7,
ks,i,j) * c(
ks ,i ,j+1)
2208 v(
ke,i,j) = m(1,
ke,i,j) * c(
ke ,i ,j ) &
2209 + m(2,
ke,i,j) * c(
ke-1,i ,j ) &
2210 + m(4,
ke,i,j) * c(
ke ,i-1,j ) &
2211 + m(5,
ke,i,j) * c(
ke ,i+1,j ) &
2212 + m(6,
ke,i,j) * c(
ke ,i ,j-1) &
2213 + m(7,
ke,i,j) * c(
ke ,i ,j+1)
2217 k = iundef; i = iundef; j = iundef
2221 end subroutine mul_matrix
2224 subroutine solve_multigrid
2225 end subroutine solve_multigrid
2229 subroutine check_solver( &
2231 real(RP),
intent(in) :: DPRES(KA,IA,JA)
2232 real(RP),
intent(in) :: M(7,KA,IA,JA)
2233 real(RP),
intent(in) :: B(KA,IA,JA)
2235 real(RP) :: B2(KA,IA,JA)
2239 call mul_matrix(b2, m, dpres)
2244 err = abs( b2(k,i,j) - b(k,i,j) )
2245 if ( err > 1.e-5_rp .and. abs( err / b(k,i,j) ) > 1.e-5_rp )
then 2246 write(*,*)
"solver error is too large: ", k,i,j, b(k,i,j), b2(k,i,j)
2253 end subroutine check_solver
2255 subroutine check_pres( &
2261 real(RP),
intent(in) :: DPRES_N(KA,IA,JA)
2262 real(RP),
intent(in) :: DPRES(KA,IA,JA)
2263 real(RP),
intent(in) :: RHOT_RK(KA,IA,JA)
2264 real(RP),
intent(in) :: RHOT(KA,IA,JA)
2265 real(RP),
intent(in) :: DENS_RK(KA,IA,JA)
2266 real(RP),
intent(in) :: DENS(KA,IA,JA)
2267 real(RP),
intent(in) :: B(KA,IA,JA)
2268 real(RP),
intent(in) :: RT2P(KA,IA,JA)
2270 real(RP) :: lhs, rhs
2276 lhs = dpres_n(k,i,j) - dpres(k,i,j)
2277 rhs = rt2p(k,i,j) * ( rhot_rk(k,i,j) - rhot(k,i,j) )
2278 if ( abs( (lhs - rhs) / lhs ) > 1e-15 )
then 2280 write(*,*)
"error is too large: ", k,i,j, lhs, rhs, &
2281 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)
2287 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_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
procedure(flux_mom), pointer, public atmos_dyn_fvm_fluxy_xyw
logical, public io_nml
output log or not? (for namelist, this process)
integer, public ia
of whole cells: x, local, with HALO
procedure(flux_z), pointer, public atmos_dyn_fvm_fluxz_xvz
integer, public ka
of whole cells: z, local, with HALO
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, 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, parameter, public sp
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
integer, parameter, public dp
procedure(flux_mom), pointer, public atmos_dyn_fvm_fluxx_uyz
integer, public io_fid_nml
Log file ID (only for output namelist)
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 whole cells: y, local, with HALO