13 #define PROFILE_START(name) call fapp_start(name, 1, 1)
14 #define PROFILE_STOP(name) call fapp_stop (name, 1, 1)
16 #define PROFILE_START(name)
17 #define PROFILE_STOP(name)
32 #if defined DEBUG || defined QUICKDEBUG
59 #define F2H(k,p,idx) (CDZ(k+p-1)*GSQRT(k+p-1,i,j,idx)/(CDZ(k)*GSQRT(k,i,j,idx)+CDZ(k+1)*GSQRT(k+1,i,j,idx)))
61 # define F2H(k,p,idx) 0.5_RP
68 integer,
private,
parameter :: NB = 1
69 integer,
private,
parameter :: VA_FVM_HEVI = 0
87 character(len=*),
intent(in) :: atmos_dyn_type
88 integer,
intent(out) :: va_out
89 character(len=H_SHORT),
intent(out) :: var_name(:)
90 character(len=H_MID),
intent(out) :: var_desc(:)
91 character(len=H_SHORT),
intent(out) :: var_unit(:)
94 if ( atmos_dyn_type /=
'FVM-HEVI' .AND. atmos_dyn_type /=
'HEVI' )
then
95 log_error(
"ATMOS_DYN_Tstep_short_fvm_hevi_regist",*)
'ATMOS_DYN_TYPE is not FVM-HEVI. Check!'
105 log_info(
"ATMOS_DYN_Tstep_short_fvm_hevi_regist",*)
'Register additional prognostic variables (HEVI)'
106 if ( va_out < 1 )
then
107 log_info_cont(*)
'=> nothing.'
119 log_info(
"ATMOS_DYN_Tstep_short_fvm_hevi_setup",*)
'HEVI Setup'
126 DENS_RK, MOMZ_RK, MOMX_RK, MOMY_RK, RHOT_RK, &
129 DENS0, MOMZ0, MOMX0, MOMY0, RHOT0, &
130 DENS, MOMZ, MOMX, MOMY, RHOT, &
131 DENS_t, MOMZ_t, MOMX_t, MOMY_t, RHOT_t, &
133 DPRES0, RT2P, CORIOLI, &
134 num_diff, wdamp_coef, divdmp_coef, DDIV, &
135 FLAG_FCT_MOMENTUM, FLAG_FCT_T, &
136 FLAG_FCT_ALONG_STREAM, &
137 CDZ, FDZ, FDX, FDY, &
138 RCDZ, RCDX, RCDY, RFDZ, RFDX, RFDY, &
139 PHI, GSQRT, J13G, J23G, J33G, MAPF, &
140 REF_dens, REF_rhot, &
141 BND_W, BND_E, BND_S, BND_N, TwoD, &
146 rdry => const_rdry, &
147 cvdry => const_cvdry, &
148 cpdry => const_cpdry, &
151 grav => const_grav, &
180 matrix_solver_tridiagonal, &
184 real(
rp),
intent(out) :: dens_rk(
ka,
ia,
ja)
185 real(
rp),
intent(out) :: momz_rk(
ka,
ia,
ja)
186 real(
rp),
intent(out) :: momx_rk(
ka,
ia,
ja)
187 real(
rp),
intent(out) :: momy_rk(
ka,
ia,
ja)
188 real(
rp),
intent(out) :: rhot_rk(
ka,
ia,
ja)
192 real(
rp),
intent(inout) :: mflx_hi(
ka,
ia,
ja,3)
193 real(
rp),
intent(out) :: tflx_hi(
ka,
ia,
ja,3)
195 real(
rp),
intent(in),
target :: dens0(
ka,
ia,
ja)
196 real(
rp),
intent(in),
target :: momz0(
ka,
ia,
ja)
197 real(
rp),
intent(in),
target :: momx0(
ka,
ia,
ja)
198 real(
rp),
intent(in),
target :: momy0(
ka,
ia,
ja)
199 real(
rp),
intent(in),
target :: rhot0(
ka,
ia,
ja)
201 real(
rp),
intent(in) :: dens(
ka,
ia,
ja)
202 real(
rp),
intent(in) :: momz(
ka,
ia,
ja)
203 real(
rp),
intent(in) :: momx(
ka,
ia,
ja)
204 real(
rp),
intent(in) :: momy(
ka,
ia,
ja)
205 real(
rp),
intent(in) :: rhot(
ka,
ia,
ja)
207 real(
rp),
intent(in) :: dens_t(
ka,
ia,
ja)
208 real(
rp),
intent(in) :: momz_t(
ka,
ia,
ja)
209 real(
rp),
intent(in) :: momx_t(
ka,
ia,
ja)
210 real(
rp),
intent(in) :: momy_t(
ka,
ia,
ja)
211 real(
rp),
intent(in) :: rhot_t(
ka,
ia,
ja)
216 real(
rp),
intent(in) :: dpres0(
ka,
ia,
ja)
217 real(
rp),
intent(in) :: rt2p(
ka,
ia,
ja)
218 real(
rp),
intent(in) :: corioli(
ia,
ja)
219 real(
rp),
intent(in) :: num_diff(
ka,
ia,
ja,5,3)
220 real(
rp),
intent(in) :: wdamp_coef(
ka)
221 real(
rp),
intent(in) :: divdmp_coef
222 real(
rp),
intent(in) :: ddiv(
ka,
ia,
ja)
224 logical,
intent(in) :: flag_fct_momentum
225 logical,
intent(in) :: flag_fct_t
226 logical,
intent(in) :: flag_fct_along_stream
228 real(
rp),
intent(in) :: cdz(
ka)
229 real(
rp),
intent(in) :: fdz(
ka-1)
230 real(
rp),
intent(in) :: fdx(
ia-1)
231 real(
rp),
intent(in) :: fdy(
ja-1)
232 real(
rp),
intent(in) :: rcdz(
ka)
233 real(
rp),
intent(in) :: rcdx(
ia)
234 real(
rp),
intent(in) :: rcdy(
ja)
235 real(
rp),
intent(in) :: rfdz(
ka-1)
236 real(
rp),
intent(in) :: rfdx(
ia-1)
237 real(
rp),
intent(in) :: rfdy(
ja-1)
239 real(
rp),
intent(in) :: phi (
ka,
ia,
ja)
240 real(
rp),
intent(in) :: gsqrt (
ka,
ia,
ja,7)
241 real(
rp),
intent(in) :: j13g (
ka,
ia,
ja,7)
242 real(
rp),
intent(in) :: j23g (
ka,
ia,
ja,7)
243 real(
rp),
intent(in) :: j33g
244 real(
rp),
intent(in) :: mapf (
ia,
ja,2,4)
245 real(
rp),
intent(in) :: ref_dens(
ka,
ia,
ja)
246 real(
rp),
intent(in) :: ref_rhot(
ka,
ia,
ja)
248 logical,
intent(in) :: bnd_w
249 logical,
intent(in) :: bnd_e
250 logical,
intent(in) :: bnd_s
251 logical,
intent(in) :: bnd_n
252 logical,
intent(in) :: twod
254 real(
rp),
intent(in) :: dtrk
255 logical,
intent(in) :: last
289 real(
rp) :: pt(
ka,lsize)
290 real(
rp) :: ci(
ks:
ke-1,lsize)
291 real(
rp) :: co(
ks:
ke-1,lsize)
292 real(
rp) :: f1(
ks:
ke-1,lsize)
293 real(
rp) :: f2(
ks:
ke-1,lsize)
294 real(
rp) :: f3(
ks:
ke-1,lsize)
297 real(
rp) :: work(
kmax-1,4)
300 integer :: iis, iie, jjs, jje
301 integer ::
k, i, j, ii
304 integer,
parameter :: l = 1
314 qflx_hi(:,:,:,:) = undef
315 qflx_j13(:,:,:) = undef
316 qflx_j23(:,:,:) = undef
319 #if defined DEBUG || defined QUICKDEBUG
320 dens_rk( 1:
ks-1,:,:) = undef
321 dens_rk(
ke+1:
ka ,:,:) = undef
322 momz_rk( 1:
ks-1,:,:) = undef
323 momz_rk(
ke+1:
ka ,:,:) = undef
324 momx_rk( 1:
ks-1,:,:) = undef
325 momx_rk(
ke+1:
ka ,:,:) = undef
326 momy_rk( 1:
ks-1,:,:) = undef
327 momy_rk(
ke+1:
ka ,:,:) = undef
328 rhot_rk( 1:
ks-1,:,:) = undef
329 rhot_rk(
ke+1:
ka ,:,:) = undef
330 prog_rk( 1:
ks-1,:,:,:) = undef
331 prog_rk(
ke+1:
ka ,:,:,:) = undef
344 if ( bnd_w ) ifs_off = 0
345 if ( bnd_s ) jfs_off = 0
372 profile_start(
"hevi_pres")
377 do i = iis, min(iie+1,
ia)
380 call check( __line__, dpres0(
k,i,j) )
381 call check( __line__, rt2p(
k,i,j) )
382 call check( __line__, rhot(
k,i,j) )
383 call check( __line__, ref_rhot(
k,i,j) )
385 dpres(
k,i,j) = dpres0(
k,i,j) + rt2p(
k,i,j) * ( rhot(
k,i,j) - ref_rhot(
k,i,j) )
387 dpres(
ks-1,i,j) = dpres0(
ks-1,i,j) - dens(
ks,i,j) * ( phi(
ks-1,i,j) - phi(
ks+1,i,j) )
388 dpres(
ke+1,i,j) = dpres0(
ke+1,i,j) - dens(
ke,i,j) * ( phi(
ke+1,i,j) - phi(
ke-1,i,j) )
392 profile_stop(
"hevi_pres")
396 profile_start(
"hevi_mflx_z")
406 call check( __line__, momy(
k+1,
is,j) )
407 call check( __line__, momy(
k+1,
is,j-1) )
408 call check( __line__, momy(
k ,
is,j) )
409 call check( __line__, momy(
k ,
is,j-1) )
412 * ( momy(
k+1,
is,j)+momy(
k+1,
is,j-1) &
413 + momy(
k ,
is,j)+momy(
k ,
is,j-1) ) &
414 + gsqrt(
k,
is,j,
i_xyw) / mapf(
is,j,2,
i_xy) * num_diff(
k,
is,j,
i_dens,
zdir)
425 mflx_hi(
ks-1,i,j,
zdir) = 0.0_rp
428 call check( __line__, momx(
k+1,i ,j) )
429 call check( __line__, momx(
k+1,i-1,j) )
430 call check( __line__, momx(
k ,i ,j) )
431 call check( __line__, momx(
k ,i+1,j) )
432 call check( __line__, momy(
k+1,i,j) )
433 call check( __line__, momy(
k+1,i,j-1) )
434 call check( __line__, momy(
k ,i,j) )
435 call check( __line__, momy(
k ,i,j-1) )
438 * ( momx(
k+1,i,j)+momx(
k+1,i-1,j) &
439 + momx(
k ,i,j)+momx(
k ,i-1,j) ) &
440 + j23g(
k,i,j,
i_xyw) * 0.25_rp / mapf(i,j,1,
i_xy) &
441 * ( momy(
k+1,i,j)+momy(
k+1,i,j-1) &
442 + momy(
k ,i,j)+momy(
k ,i,j-1) ) &
443 + gsqrt(
k,i,j,
i_xyw) / ( mapf(i,j,1,
i_xy)*mapf(i,j,2,
i_xy) ) * num_diff(
k,i,j,
i_dens,
zdir)
445 mflx_hi(
ke ,i,j,
zdir) = 0.0_rp
451 k = iundef; i = iundef; j = iundef
453 profile_stop(
"hevi_mflx_z")
455 if ( .not. twod )
then
456 profile_start(
"hevi_mflx_x")
457 iss = max(iis-1,
is-ifs_off)
468 call check( __line__, momx(
k,i,j) )
478 k = iundef; i = iundef; j = iundef
480 profile_stop(
"hevi_mflx_x")
487 do j = max(jjs-1,
js-jfs_off), min(jje,
jeh)
492 call check( __line__, momy(
k,i,j) )
502 k = iundef; i = iundef; j = iundef
506 profile_start(
"hevi_sr")
520 call check( __line__, dens0(
k,
is,j) )
523 call check( __line__, dens_t(
k,
is,j) )
526 advch = - ( mflx_hi(
k,
is,j,
ydir)-mflx_hi(
k ,
is,j-1,
ydir) ) * rcdy(j)
527 sr(
k,
is,j) = ( advcv + advch ) * mapf(
is,j,2,
i_xy) / gsqrt(
k,
is,j,
i_xyz) + dens_t(
k,
is,j)
550 call check( __line__, dens0(
k,i,j) )
551 call check( __line__, mflx_hi(
k ,i ,j ,
xdir) )
552 call check( __line__, mflx_hi(
k ,i-1,j ,
xdir) )
553 call check( __line__, mflx_hi(
k ,i ,j ,
ydir) )
554 call check( __line__, mflx_hi(
k ,i ,j-1,
ydir) )
555 call check( __line__, dens_t(
k,i,j) )
557 advcv = - ( mflx_hi(
k,i,j,
zdir)-mflx_hi(
k-1,i ,j,
zdir) ) * rcdz(
k)
558 advch = - ( ( mflx_hi(
k,i,j,
xdir)-mflx_hi(
k ,i-1,j,
xdir) ) * rcdx(i) &
559 + ( mflx_hi(
k,i,j,
ydir)-mflx_hi(
k ,i, j-1,
ydir) ) * rcdy(j) )
560 sr(
k,i,j) = ( advcv + advch ) * mapf(i,j,1,
i_xy) * mapf(i,j,2,
i_xy) / gsqrt(
k,i,j,
i_xyz) + dens_t(
k,i,j)
563 advch_t(
k,i,j,
i_dens) = ( advch + advcv ) * mapf(i,j,1,
i_xy) * mapf(i,j,2,
i_xy) / gsqrt(
k,i,j,
i_xyz)
572 k = iundef; i = iundef; j = iundef
574 profile_stop(
"hevi_sr")
580 profile_start(
"hevi_momz_qflxhi_z")
583 gsqrt(:,:,:,
i_xyz), j33g, &
587 profile_stop(
"hevi_momz_qflxhi_z")
589 profile_start(
"hevi_momz_qflxj")
593 gsqrt(:,:,:,
i_xyz), j13g(:,:,:,
i_xyz), mapf(:,:,:,
i_xy), &
598 gsqrt(:,:,:,
i_xyz), j23g(:,:,:,
i_xyz), mapf(:,:,:,
i_xy), &
601 profile_stop(
"hevi_momz_qflxj")
604 if ( .not. twod )
then
605 profile_start(
"hevi_momz_qflxhi_x")
612 profile_stop(
"hevi_momz_qflxhi_x")
616 profile_start(
"hevi_momz_qflxhi_y")
623 profile_stop(
"hevi_momz_qflxhi_y")
626 profile_start(
"hevi_sw")
644 call check( __line__, qflx_j23(
k ,
is,j) )
645 call check( __line__, qflx_j23(
k-1,
is,j) )
648 call check( __line__, ddiv(
k ,
is,j) )
649 call check( __line__, ddiv(
k+1,
is,j) )
650 call check( __line__, momz0(
k,
is,j) )
651 call check( __line__, momz_t(
k,
is,j) )
654 + qflx_j23(
k,
is,j) - qflx_j23(
k-1,
is,j ) ) * rfdz(
k)
655 advch = - ( qflx_hi(
k,
is,j,
ydir) - qflx_hi(
k,
is,j-1,
ydir) ) * rcdy(j) &
657 wdmp = - wdamp_coef(
k) * momz0(
k,
is,j)
658 div = divdmp_coef / dtrk * ( ddiv(
k+1,
is,j)-ddiv(
k,
is,j) ) * fdz(
k)
659 sw(
k,
is,j) = ( advcv + advch ) / gsqrt(
k,
is,j,
i_xyw) &
660 + wdmp + div + momz_t(
k,
is,j)
665 wdmp_t(
k,
is,j) = wdmp
666 ddiv_t(
k,
is,j,1) = div
688 call check( __line__, qflx_hi(
k ,i ,j ,
zdir) )
689 call check( __line__, qflx_hi(
k-1,i ,j ,
zdir) )
690 call check( __line__, qflx_j13(
k ,i ,j) )
691 call check( __line__, qflx_j13(
k-1,i ,j) )
692 call check( __line__, qflx_j23(
k ,i ,j) )
693 call check( __line__, qflx_j23(
k-1,i ,j) )
694 call check( __line__, qflx_hi(
k ,i ,j ,
xdir) )
695 call check( __line__, qflx_hi(
k ,i-1,j ,
xdir) )
696 call check( __line__, qflx_hi(
k ,i ,j ,
ydir) )
697 call check( __line__, qflx_hi(
k ,i ,j-1,
ydir) )
698 call check( __line__, ddiv(
k ,i,j) )
699 call check( __line__, ddiv(
k+1,i,j) )
700 call check( __line__, momz0(
k,i,j) )
701 call check( __line__, momz_t(
k,i,j) )
703 advcv = - ( qflx_hi(
k,i,j,
zdir) - qflx_hi(
k-1,i ,j ,
zdir) &
704 + qflx_j13(
k,i,j) - qflx_j13(
k-1,i ,j ) &
705 + qflx_j23(
k,i,j) - qflx_j23(
k-1,i ,j ) ) * rfdz(
k)
706 advch = - ( ( qflx_hi(
k,i,j,
xdir) - qflx_hi(
k,i-1,j ,
xdir) ) * rcdx(i) &
707 + ( qflx_hi(
k,i,j,
ydir) - qflx_hi(
k,i ,j-1,
ydir) ) * rcdy(j) ) &
708 * mapf(i,j,1,
i_xy) * mapf(i,j,2,
i_xy)
709 wdmp = - wdamp_coef(
k) * momz0(
k,i,j)
710 div = divdmp_coef / dtrk * ( ddiv(
k+1,i,j)-ddiv(
k,i,j) ) * fdz(
k)
711 sw(
k,i,j) = ( advcv + advch ) / gsqrt(
k,i,j,
i_xyw) &
712 + wdmp + div + momz_t(
k,i,j)
718 ddiv_t(
k,i,j,1) = div
726 profile_stop(
"hevi_sw")
728 k = iundef; i = iundef; j = iundef
741 call check( __line__, rhot(
k,i,j) )
742 call check( __line__, dens(
k,i,j) )
744 pott(
k,i,j) = rhot(
k,i,j) / dens(
k,i,j)
750 k = iundef; i = iundef; j = iundef
755 mflx_hi(:,:,:,
zdir), pott, gsqrt(:,:,:,
i_xyw), &
763 mflx_hi(:,:,:,
xdir), pott, gsqrt(:,:,:,
i_uyz), &
770 mflx_hi(:,:,:,
ydir), pott, gsqrt(:,:,:,
i_xvz), &
776 profile_start(
"hevi_st")
794 call check( __line__, rhot_t(
k,
is,j) )
797 advch = - ( tflx_hi(
k,
is,j,
ydir) - tflx_hi(
k ,
is,j-1,
ydir) ) * rcdy(j)
798 st(
k,
is,j) = ( advcv + advch ) * mapf(
is,j,2,
i_xy) / gsqrt(
k,
is,j,
i_xyz) + rhot_t(
k,
is,j)
821 call check( __line__, tflx_hi(
k ,i ,j ,
zdir) )
822 call check( __line__, tflx_hi(
k-1,i ,j ,
zdir) )
823 call check( __line__, tflx_hi(
k ,i ,j ,
xdir) )
824 call check( __line__, tflx_hi(
k ,i-1,j ,
xdir) )
825 call check( __line__, tflx_hi(
k ,i ,j ,
ydir) )
826 call check( __line__, tflx_hi(
k ,i ,j-1,
ydir) )
827 call check( __line__, rhot_t(
k,i,j) )
829 advcv = - ( tflx_hi(
k,i,j,
zdir) - tflx_hi(
k-1,i ,j ,
zdir) ) * rcdz(
k)
830 advch = - ( ( tflx_hi(
k,i,j,
xdir) - tflx_hi(
k ,i-1,j ,
xdir) ) * rcdx(i) &
831 + ( tflx_hi(
k,i,j,
ydir) - tflx_hi(
k ,i ,j-1,
ydir) ) * rcdy(j) )
832 st(
k,i,j) = ( advcv + advch ) * mapf(i,j,1,
i_xy) * mapf(i,j,2,
i_xy) / gsqrt(
k,i,j,
i_xyz) + rhot_t(
k,i,j)
835 advch_t(
k,i,j,
i_rhot) = ( advcv + advch ) * mapf(i,j,1,
i_xy) * mapf(i,j,2,
i_xy) / gsqrt(
k,i,j,
i_xyz)
844 k = iundef; i = iundef; j = iundef
846 profile_stop(
"hevi_st")
850 profile_start(
"hevi_solver")
865 #if defined DEBUG || defined QUICKDEBUG
884 do ii = iis, iie, lsize
886 #if defined DEBUG || defined QUICKDEBUG
902 momz(:,i,j), pott(:,i,j), gsqrt(:,i,j,
i_xyz), &
906 a(
k) = dtrk**2 * j33g * rcdz(
k) * rt2p(
k,i,j) * j33g / gsqrt(
k,i,j,
i_xyz)
908 b = grav * dtrk**2 * j33g / ( cdz(
ks+1) + cdz(
ks) )
909 f1(
ks,l) = - ( pt(
ks+1,l) * rfdz(
ks) * a(
ks+1) + b ) / gsqrt(
ks,i,j,
i_xyw)
910 f2(
ks,l) = 1.0_rp + ( pt(
ks ,l) * rfdz(
ks) * ( a(
ks+1)+a(
ks) ) ) / gsqrt(
ks,i,j,
i_xyw)
912 b = grav * dtrk**2 * j33g / ( cdz(
k+1) + cdz(
k) )
913 f1(
k,l) = - ( pt(
k+1,l) * rfdz(
k) * a(
k+1) + b ) / gsqrt(
k,i,j,
i_xyw)
914 f2(
k,l) = 1.0_rp + ( pt(
k ,l) * rfdz(
k) * ( a(
k+1)+a(
k) ) ) / gsqrt(
k,i,j,
i_xyw)
915 f3(
k,l) = - ( pt(
k-1,l) * rfdz(
k) * a(
k) - b ) / gsqrt(
k,i,j,
i_xyw)
918 b = grav * dtrk**2 * j33g / ( cdz(
ke) + cdz(
ke-1) )
919 f2(
ke-1,l) = 1.0_rp + ( pt(
ke-1,l) * rfdz(
ke-1) * ( a(
ke)+a(
ke-1) ) ) / gsqrt(
ke-1,i,j,
i_xyw)
920 f3(
ke-1,l) = - ( pt(
ke-2,l) * rfdz(
ke-1) * a(
ke-1) - b ) / gsqrt(
ke-1,i,j,
i_xyw)
923 pg = - ( dpres(
k+1,i,j) + rt2p(
k+1,i,j)*dtrk*st(
k+1,i,j) &
924 - dpres(
k ,i,j) - rt2p(
k ,i,j)*dtrk*st(
k ,i,j) ) &
925 * rfdz(
k) * j33g / gsqrt(
k,i,j,
i_xyw) &
927 * ( ( dens(
k+1,i,j) - ref_dens(
k+1,i,j) + sr(
k+1,i,j) * dtrk ) &
928 + ( dens(
k ,i,j) - ref_dens(
k ,i,j) + sr(
k ,i,j) * dtrk ) )
929 ci(
k,l) = momz(
k,i,j) + dtrk * ( pg + sw(
k,i,j) )
931 if ( lhist ) pg_t(
k,i,j,1) = pg
940 f1(:,1), f2(:,1), f3(:,1), &
946 call matrix_solver_tridiagonal(
kmax-1, 1,
kmax-1, &
947 f1(:,:), f2(:,:), f3(:,:), &
958 #ifdef DEBUG_HEVI2HEVE
960 co(
k,l) = momz(
k,i,j)
962 + j33g * momz(
k,i,j) / ( mapf(i,j,1,
i_xy) * mapf(i,j,2,
i_xy) )
964 + j33g * momz(
k,i,j) * pt(
k,l) / ( mapf(i,j,1,
i_xy) * mapf(i,j,2,
i_xy) )
966 momz_rk(
k,i,j) = momz0(
k,i,j) &
968 - j33g * ( dpres(
k+1,i,j)-dpres(
k,i,j) ) * rfdz(
k) / gsqrt(
k,i,j,
i_xyw) &
969 - grav * 0.5_rp * ( (dens(
k,i,j)-ref_dens(
k,i,j)) + (dens(
k+1,i,j)-ref_dens(
k+1,i,j)) ) &
974 + j33g * co(
k,l) / ( mapf(i,j,1,
i_xy) * mapf(i,j,2,
i_xy) )
976 + j33g * co(
k,l) * pt(
k,l) / ( mapf(i,j,1,
i_xy) * mapf(i,j,2,
i_xy) )
978 momz_rk(
k,i,j) = momz0(
k,i,j) &
979 + ( co(
k,l) - momz(
k,i,j) )
982 momz_rk(
ks-1,i,j) = 0.0_rp
983 momz_rk(
ke ,i,j) = 0.0_rp
986 advcv = - co(
ks,l) * j33g * rcdz(
ks) / gsqrt(
ks,i,j,
i_xyz)
987 dens_rk(
ks,i,j) = dens0(
ks,i,j) + dtrk * ( advcv + sr(
ks,i,j) )
989 if ( lhist ) advcv_t(
ks,i,j,
i_dens) = advcv
991 advcv = - co(
ks,l) * pt(
ks,l) * j33g * rcdz(
ks) / gsqrt(
ks,i,j,
i_xyz)
992 rhot_rk(
ks,i,j) = rhot0(
ks,i,j) + dtrk * ( advcv + st(
ks,i,j) )
994 if ( lhist ) advcv_t(
ks,i,j,
i_rhot) = advcv
998 advcv = - ( co(
k,l) - co(
k-1,l) ) &
999 * j33g * rcdz(
k) / gsqrt(
k,i,j,
i_xyz)
1000 dens_rk(
k,i,j) = dens0(
k,i,j) + dtrk * ( advcv + sr(
k,i,j) )
1002 if ( lhist ) advcv_t(
k,i,j,
i_dens) = advcv
1004 advcv = - ( co(
k,l) * pt(
k,l) - co(
k-1,l) * pt(
k-1,l) ) &
1005 * j33g * rcdz(
k) / gsqrt(
k,i,j,
i_xyz)
1006 rhot_rk(
k,i,j) = rhot0(
k,i,j) + dtrk * ( advcv + st(
k,i,j) )
1008 if ( lhist ) advcv_t(
k,i,j,
i_rhot) = advcv
1011 advcv = co(
ke-1,l) * j33g * rcdz(
ke) / gsqrt(
ke,i,j,
i_xyz)
1012 dens_rk(
ke,i,j) = dens0(
ke,i,j) + dtrk * ( advcv + sr(
ke,i,j) )
1014 if ( lhist ) advcv_t(
ke,i,j,
i_dens) = advcv
1016 advcv = co(
ke-1,l) * pt(
ke-1,l) * j33g * rcdz(
ke) / gsqrt(
ke,i,j,
i_xyz)
1017 rhot_rk(
ke,i,j) = rhot0(
ke,i,j) + dtrk * ( advcv + st(
ke,i,j) )
1019 if ( lhist ) advcv_t(
ke,i,j,
i_rhot) = advcv
1023 call check_equation( &
1025 dens(:,i,j), momz(:,i,j), rhot(:,i,j), dpres(:,i,j), &
1027 sr(:,i,j), sw(:,i,j), st(:,i,j), &
1028 j33g, gsqrt(:,i,j,:), &
1041 k = iundef; i = iundef; j = iundef
1046 profile_stop(
"hevi_solver")
1051 profile_start(
"hevi_momx")
1055 gsqrt(:,:,:,
i_uyw), j33g, &
1058 iis, iie, jjs, jje )
1062 gsqrt(:,:,:,
i_uyz), j13g(:,:,:,
i_uyw), mapf(:,:,:,
i_uy), &
1064 iis, iie, jjs, jje )
1067 gsqrt(:,:,:,
i_uyz), j23g(:,:,:,
i_uyw), mapf(:,:,:,
i_uy), &
1069 iis, iie, jjs, jje )
1079 iis, iie, jjs, jje )
1087 iis, iie, jjs, jje )
1111 call check( __line__, corioli(
is,j) )
1112 call check( __line__, momy(
k,
is,j ) )
1113 call check( __line__, momy(
k,
is,j-1) )
1114 call check( __line__, momx0(
k,
is,j) )
1117 + qflx_j23(
k,
is,j) - qflx_j23(
k-1,
is,j ) ) * rcdz(
k)
1118 advch = - ( qflx_hi(
k,
is,j,
ydir) - qflx_hi(
k ,
is,j-1,
ydir) ) * rcdy(j) &
1120 cf = 0.5_rp * corioli(
is,j) * ( momy(
k,
is,j) + momy(
k,
is,j-1) )
1121 momx_rk(
k,
is,j) = momx0(
k,
is,j) &
1122 + dtrk * ( ( advcv + advch ) / gsqrt(
k,
is,j,
i_uyz) + cf + momx_t(
k,
is,j) )
1127 pg_t(
k,
is,j,2) = 0.0_rp
1129 ddiv_t(
k,
is,j,2) = 0.0_rp
1154 call check( __line__, qflx_hi(
k ,i ,j ,
zdir) )
1155 call check( __line__, qflx_hi(
k-1,i ,j ,
zdir) )
1156 call check( __line__, qflx_hi(
k ,i ,j ,
xdir) )
1157 call check( __line__, qflx_hi(
k ,i-1,j ,
xdir) )
1158 call check( __line__, qflx_hi(
k ,i ,j ,
ydir) )
1159 call check( __line__, qflx_hi(
k ,i ,j-1,
ydir) )
1160 call check( __line__, dpres(
k,i+1,j) )
1161 call check( __line__, dpres(
k,i ,j) )
1162 call check( __line__, corioli(i ,j) )
1163 call check( __line__, corioli(i+1,j) )
1164 call check( __line__, momy(
k,i ,j ) )
1165 call check( __line__, momy(
k,i+1,j ) )
1166 call check( __line__, momy(
k,i ,j-1) )
1167 call check( __line__, momy(
k,i+1,j-1) )
1168 call check( __line__, ddiv(
k,i+1,j) )
1169 call check( __line__, ddiv(
k,i ,j) )
1170 call check( __line__, momx0(
k,i,j) )
1172 advcv = - ( qflx_hi(
k,i,j,
zdir) - qflx_hi(
k-1,i ,j ,
zdir) &
1173 + qflx_j13(
k,i,j) - qflx_j13(
k-1,i ,j ) &
1174 + qflx_j23(
k,i,j) - qflx_j23(
k-1,i ,j ) ) * rcdz(
k)
1175 advch = - ( ( qflx_hi(
k,i,j,
xdir) - qflx_hi(
k ,i-1,j ,
xdir) ) * rfdx(i) &
1176 + ( qflx_hi(
k,i,j,
ydir) - qflx_hi(
k ,i ,j-1,
ydir) ) * rcdy(j) ) &
1177 * mapf(i,j,1,
i_uy) * mapf(i,j,2,
i_uy)
1178 pg = ( ( gsqrt(
k,i+1,j,
i_xyz) * dpres(
k,i+1,j) &
1179 - gsqrt(
k,i ,j,
i_xyz) * dpres(
k,i ,j) &
1182 * 0.5_rp * ( f2h(
k,1,
i_uyz) * ( dpres(
k+1,i+1,j)+dpres(
k+1,i,j) ) &
1183 + f2h(
k,2,
i_uyz) * ( dpres(
k ,i+1,j)+dpres(
k ,i,j) ) ) &
1185 * 0.5_rp * ( f2h(
k,1,
i_uyz) * ( dpres(
k ,i+1,j)+dpres(
k ,i,j) ) &
1186 + f2h(
k,2,
i_uyz) * ( dpres(
k-1,i+1,j)+dpres(
k-1,i,j) ) ) &
1189 cf = 0.125_rp * ( corioli(i+1,j )+corioli(i,j ) ) &
1190 * ( momy(
k,i+1,j )+momy(
k,i,j ) &
1191 + momy(
k,i+1,j-1)+momy(
k,i,j-1) ) &
1192 + 0.25_rp * mapf(i,j,1,
i_uy) * mapf(i,j,2,
i_uy) &
1193 * ( momy(
k,i,j) + momy(
k,i,j-1) + momy(
k,i+1,j) + momy(
k,i+1,j-1) ) &
1194 * ( ( momy(
k,i,j) + momy(
k,i,j-1) + momy(
k,i+1,j) + momy(
k,i+1,j-1) ) * 0.25_rp &
1195 * ( 1.0_rp/mapf(i+1,j,2,
i_xy) - 1.0_rp/mapf(i,j,2,
i_xy) ) * rfdx(i) &
1197 * ( 1.0_rp/mapf(i,j,1,
i_uv) - 1.0_rp/mapf(i,j-1,1,
i_uv) ) * rcdy(j) ) &
1198 * 2.0_rp / ( dens(
k,i+1,j) + dens(
k,i,j) )
1199 div = divdmp_coef / dtrk * ( ddiv(
k,i+1,j)/mapf(i+1,j,2,
i_xy) - ddiv(
k,i,j)/mapf(i,j,1,
i_xy) ) &
1200 * mapf(i,j,1,
i_uy) * mapf(i,j,2,
i_uy) * fdx(i)
1201 momx_rk(
k,i,j) = momx0(
k,i,j) &
1202 + dtrk * ( ( advcv + advch - pg ) / gsqrt(
k,i,j,
i_uyz) + cf + div + momx_t(
k,i,j) )
1207 pg_t(
k,i,j,2) = - pg / gsqrt(
k,i,j,
i_uyz)
1209 ddiv_t(
k,i,j,2) = div
1217 profile_stop(
"hevi_momx")
1219 k = iundef; i = iundef; j = iundef
1223 profile_start(
"hevi_momy")
1227 gsqrt(:,:,:,
i_xvw), j33g, &
1230 iis, iie, jjs, jje )
1234 gsqrt(:,:,:,
i_xvz), j13g(:,:,:,
i_xvw), mapf(:,:,:,
i_xv), &
1236 iis, iie, jjs, jje )
1239 gsqrt(:,:,:,
i_xvz), j23g(:,:,:,
i_xvw), mapf(:,:,:,
i_xv), &
1241 iis, iie, jjs, jje )
1250 iis, iie, jjs, jje )
1259 iis, iie, jjs, jje )
1276 do j = jjs, min(jje,
jeh)
1284 call check( __line__, dpres(
k,
is,j ) )
1285 call check( __line__, dpres(
k,
is,j+1) )
1286 call check( __line__, corioli(
is,j ) )
1287 call check( __line__, corioli(
is,j+1) )
1288 call check( __line__, momx(
k,
is,j ) )
1289 call check( __line__, momx(
k,
is,j+1) )
1290 call check( __line__, ddiv(
k,
is,j+1) )
1291 call check( __line__, ddiv(
k,
is,j ) )
1292 call check( __line__, momy_t(
k,
is,j) )
1293 call check( __line__, momy0(
k,
is,j) )
1296 + qflx_j23(
k,
is,j) - qflx_j23(
k-1,
is,j ) ) * rcdz(
k)
1297 advch = - ( qflx_hi(
k,
is,j,
ydir) - qflx_hi(
k ,
is,j-1,
ydir) ) * rfdy(j) &
1299 pg = ( ( gsqrt(
k,
is,j+1,
i_xyz) * dpres(
k,
is,j+1) &
1303 * 0.5_rp * ( f2h(
k ,1,
i_xvz) * ( dpres(
k+1,
is,j+1)+dpres(
k+1,
is,j) ) &
1304 + f2h(
k ,2,
i_xvz) * ( dpres(
k ,
is,j+1)+dpres(
k ,
is,j) ) ) &
1306 * 0.5_rp * ( f2h(
k-1,1,
i_xvz) * ( dpres(
k ,
is,j+1)+dpres(
k ,
is,j) ) &
1307 + f2h(
k-1,2,
i_xvz) * ( dpres(
k-1,
is,j+1)+dpres(
k-1,
is,j) ) ) &
1310 cf = - 0.25_rp * ( corioli(
is,j+1)+corioli(
is,j) ) &
1311 * ( momx(
k,
is,j+1)+momx(
k,
is,j) )
1312 div = divdmp_coef / dtrk * ( ddiv(
k,
is,j+1) - ddiv(
k,
is,j) ) &
1313 * mapf(
is,j,2,
i_xv) * fdy(j)
1314 momy_rk(
k,
is,j) = momy0(
k,
is,j) &
1315 + dtrk * ( ( advcv + advch - pg ) / gsqrt(
k,
is,j,
i_xvz) + cf + div + momy_t(
k,
is,j) )
1322 ddiv_t(
k,
is,j,3) = div
1341 do j = jjs, min(jje,
jeh)
1346 call check( __line__, qflx_hi(
k ,i ,j ,
zdir) )
1347 call check( __line__, qflx_hi(
k-1,i ,j ,
zdir) )
1348 call check( __line__, qflx_hi(
k ,i ,j ,
xdir) )
1349 call check( __line__, qflx_hi(
k ,i-1,j ,
xdir) )
1350 call check( __line__, qflx_hi(
k ,i ,j ,
ydir) )
1351 call check( __line__, qflx_hi(
k ,i ,j-1,
ydir) )
1352 call check( __line__, dpres(
k,i,j ) )
1353 call check( __line__, dpres(
k,i,j+1) )
1354 call check( __line__, corioli(i,j ) )
1355 call check( __line__, corioli(i,j+1) )
1356 call check( __line__, momx(
k,i ,j ) )
1357 call check( __line__, momx(
k,i ,j+1) )
1358 call check( __line__, momx(
k,i-1,j ) )
1359 call check( __line__, momx(
k,i-1,j+1) )
1360 call check( __line__, ddiv(
k,i,j+1) )
1361 call check( __line__, ddiv(
k,i,j ) )
1362 call check( __line__, momy_t(
k,i,j) )
1363 call check( __line__, momy0(
k,i,j) )
1365 advcv = - ( qflx_hi(
k,i,j,
zdir) - qflx_hi(
k-1,i ,j ,
zdir) &
1366 + qflx_j13(
k,i,j) - qflx_j13(
k-1,i ,j ) &
1367 + qflx_j23(
k,i,j) - qflx_j23(
k-1,i ,j ) ) * rcdz(
k)
1368 advch = - ( ( qflx_hi(
k,i,j,
xdir) - qflx_hi(
k ,i-1,j ,
xdir) ) * rcdx(i) &
1369 + ( qflx_hi(
k,i,j,
ydir) - qflx_hi(
k ,i ,j-1,
ydir) ) * rfdy(j) ) &
1370 * mapf(i,j,1,
i_xv) * mapf(i,j,2,
i_xv)
1371 pg = ( ( gsqrt(
k,i,j+1,
i_xyz) * dpres(
k,i,j+1) &
1372 - gsqrt(
k,i,j ,
i_xyz) * dpres(
k,i,j ) &
1375 * 0.5_rp * ( f2h(
k ,1,
i_xvz) * ( dpres(
k+1,i,j+1)+dpres(
k+1,i,j) ) &
1376 + f2h(
k ,2,
i_xvz) * ( dpres(
k ,i,j+1)+dpres(
k ,i,j) ) ) &
1378 * 0.5_rp * ( f2h(
k-1,1,
i_xvz) * ( dpres(
k ,i,j+1)+dpres(
k ,i,j) ) &
1379 + f2h(
k-1,2,
i_xvz) * ( dpres(
k-1,i,j+1)+dpres(
k-1,i,j) ) ) &
1382 cf = - 0.125_rp * ( corioli(i ,j+1)+corioli(i ,j) ) &
1383 * ( momx(
k,i ,j+1)+momx(
k,i ,j) &
1384 + momx(
k,i-1,j+1)+momx(
k,i-1,j) ) &
1385 - 0.25_rp * mapf(i,j,1,
i_xv) * mapf(i,j,2,
i_xv) &
1386 * ( momx(
k,i,j) + momx(
k,i-1,j) + momx(
k,i,j+1) + momx(
k,i-1,j+1) ) &
1388 * ( 1.0_rp/mapf(i,j,2,
i_uv) - 1.0_rp/mapf(i-1,j,2,
i_uv) ) * rcdx(i) &
1389 - 0.25_rp * ( momx(
k,i,j)+momx(
k,i-1,j)+momx(
k,i,j+1)+momx(
k,i-1,j+1) ) &
1390 * ( 1.0_rp/mapf(i,j+1,1,
i_xy) - 1.0_rp/mapf(i,j,1,
i_xy) ) * rfdy(j) ) &
1391 * 2.0_rp / ( dens(
k,i,j+1) + dens(
k,i,j) )
1392 div = divdmp_coef / dtrk * ( ddiv(
k,i,j+1)/mapf(i,j+1,1,
i_xy) - ddiv(
k,i,j)/mapf(i,j,1,
i_xy) ) &
1393 * mapf(i,j,1,
i_xv) * mapf(i,j,2,
i_xv) * fdy(j)
1394 momy_rk(
k,i,j) = momy0(
k,i,j) &
1395 + dtrk * ( ( advcv + advch - pg ) / gsqrt(
k,i,j,
i_xvz) + cf + div + momy_t(
k,i,j) )
1400 pg_t(
k,i,j,3) = - pg / gsqrt(
k,i,j,
i_xvz)
1402 ddiv_t(
k,i,j,3) = div
1410 profile_stop(
"hevi_momy")
1412 k = iundef; i = iundef; j = iundef
1424 call file_history_in(advcv_t(:,:,:,
i_dens),
'DENS_t_advcv',
'tendency of density (vert. advection) (w/ HIST_TEND)',
'kg/m3/s' )
1425 call file_history_in(advcv_t(:,:,:,
i_momz),
'MOMZ_t_advcv',
'tendency of momentum z (vert. advection) (w/ HIST_TEND)',
'kg/m2/s2', dim_type=
'ZHXY')
1426 call file_history_in(advcv_t(:,:,:,
i_momx),
'MOMX_t_advcv',
'tendency of momentum x (vert. advection) (w/ HIST_TEND)',
'kg/m2/s2', dim_type=
'ZXHY')
1427 call file_history_in(advcv_t(:,:,:,
i_momy),
'MOMY_t_advcv',
'tendency of momentum y (vert. advection) (w/ HIST_TEND)',
'kg/m2/s2', dim_type=
'ZXYH')
1428 call file_history_in(advcv_t(:,:,:,
i_rhot),
'RHOT_t_advcv',
'tendency of rho*theta (vert. advection) (w/ HIST_TEND)',
'K kg/m3/s' )
1430 call file_history_in(advch_t(:,:,:,
i_dens),
'DENS_t_advch',
'tendency of density (horiz. advection) (w/ HIST_TEND)',
'kg/m3/s' )
1431 call file_history_in(advch_t(:,:,:,
i_momz),
'MOMZ_t_advch',
'tendency of momentum z (horiz. advection) (w/ HIST_TEND)',
'kg/m2/s2', dim_type=
'ZHXY')
1432 call file_history_in(advch_t(:,:,:,
i_momx),
'MOMX_t_advch',
'tendency of momentum x (horiz. advection) (w/ HIST_TEND)',
'kg/m2/s2', dim_type=
'ZXHY')
1433 call file_history_in(advch_t(:,:,:,
i_momy),
'MOMY_t_advch',
'tendency of momentum y (horiz. advection) (w/ HIST_TEND)',
'kg/m2/s2', dim_type=
'ZXYH')
1434 call file_history_in(advch_t(:,:,:,
i_rhot),
'RHOT_t_advch',
'tendency of rho*theta (horiz. advection) (w/ HIST_TEND)',
'K kg/m3/s' )
1436 call file_history_in(pg_t(:,:,:,1),
'MOMZ_t_pg',
'tendency of momentum z (pressure gradient) (w/ HIST_TEND)',
'kg/m2/s2', dim_type=
'ZHXY')
1438 call file_history_in(pg_t(:,:,:,2),
'MOMX_t_pg',
'tendency of momentum x (pressure gradient) (w/ HIST_TEND)',
'kg/m2/s2', dim_type=
'ZXHY')
1439 call file_history_in(pg_t(:,:,:,3),
'MOMY_t_pg',
'tendency of momentum y (pressure gradient) (w/ HIST_TEND)',
'kg/m2/s2', dim_type=
'ZXYH')
1441 call file_history_in(wdmp_t(:,:,:),
'MOMZ_t_wdamp',
'tendency of momentum z (Rayleigh damping) (w/ HIST_TEND)',
'kg/m2/s2', dim_type=
'ZHXY')
1443 call file_history_in(ddiv_t(:,:,:,1),
'MOMZ_t_ddiv',
'tendency of momentum z (divergence damping) (w/ HIST_TEND)',
'kg/m2/s2', dim_type=
'ZHXY')
1445 call file_history_in(ddiv_t(:,:,:,2),
'MOMX_t_ddiv',
'tendency of momentum x (divergence damping) (w/ HIST_TEND)',
'kg/m2/s2', dim_type=
'ZXHY')
1446 call file_history_in(ddiv_t(:,:,:,3),
'MOMY_t_ddiv',
'tendency of momentum y (divergence damping) (w/ HIST_TEND)',
'kg/m2/s2', dim_type=
'ZXYH')
1448 call file_history_in(cf_t(:,:,:,1),
'MOMX_t_cf',
'tendency of momentum x (coliolis force) (w/ HIST_TEND)',
'kg/m2/s2', dim_type=
'ZXHY')
1449 call file_history_in(cf_t(:,:,:,2),
'MOMY_t_cf',
'tendency of momentum y (coliolis force) (w/ HIST_TEND)',
'kg/m2/s2', dim_type=
'ZXYH')
1460 subroutine check_equation( &
1462 DENS, MOMZ, RHOT, DPRES, &
1477 real(
rp),
intent(in) :: vect(
ks:
ke-1)
1478 real(
rp),
intent(in) :: dens(
ka)
1479 real(
rp),
intent(in) :: momz(
ka)
1480 real(
rp),
intent(in) :: rhot(
ka)
1481 real(
rp),
intent(in) :: dpres(
ka)
1482 real(
rp),
intent(in) :: ref_dens(
ka)
1483 real(
rp),
intent(in) :: sr(
ka)
1484 real(
rp),
intent(in) :: sw(
ka)
1485 real(
rp),
intent(in) :: st(
ka)
1486 real(
rp),
intent(in) :: j33g
1487 real(
rp),
intent(in) :: g(
ka,8)
1488 real(
rp),
intent(in) :: rt2p(
ka)
1489 real(
rp),
intent(in) :: dt
1490 integer ,
intent(in) :: i
1491 integer ,
intent(in) :: j
1493 real(
rp),
parameter :: small = 1e-6_rp
1495 real(
rp) :: momz_n(
ka)
1496 real(
rp) :: dens_n(
ka)
1497 real(
rp) :: rhot_n(
ka)
1498 real(
rp) :: dpres_n(
ka)
1500 real(
rp) :: pott(
ka)
1503 real(
rp) :: error, lhs, rhs
1510 momz_n(:
ks-1) = 0.0_rp
1511 momz_n(
ke:) = 0.0_rp
1515 dens_n(
k) = dens(
k) &
1516 + dt * ( - j33g * ( momz_n(
k) - momz_n(
k-1) ) * rcdz(
k) / g(
k,
i_xyz) + sr(
k) )
1518 dens_n(
ks) = dens(
ks) &
1519 + dt * ( - j33g * momz_n(
ks) * rcdz(
ks) / g(
ks,
i_xyz) + sr(
ks) )
1520 dens_n(
ke) = dens(
ke) &
1521 + dt * ( j33g * momz_n(
ke-1) * rcdz(
ke) / g(
ke,
i_xyz) + sr(
ke) )
1525 pott(
k) = rhot(
k) / dens(
k)
1528 pt(
k) = ( 7.0_rp * ( pott(
k+1) + pott(
k ) ) &
1529 - ( pott(
k+2) + pott(
k-1) ) ) / 12.0_rp
1532 pt(
ks ) = ( pott(
ks+1) + pott(
ks ) ) * 0.5_rp
1533 pt(
ke-1) = ( pott(
ke ) + pott(
ke-1) ) * 0.5_rp
1536 rhot_n(
k) = rhot(
k) &
1537 + dt * ( - j33g * ( momz_n(
k)*pt(
k) - momz_n(
k-1)*pt(
k-1) ) * rcdz(
k) / g(
k,
i_xyz) &
1540 rhot_n(
ks) = rhot(
ks) &
1541 + dt * ( - j33g * momz_n(
ks)*pt(
ks) * rcdz(
ks) / g(
ks,
i_xyz) + st(
ks) )
1542 rhot_n(
ke) = rhot(
ke) &
1543 + dt * ( j33g * momz_n(
ke-1)*pt(
ke-1) * rcdz(
ke) / g(
ke-1,
i_xyz) + st(
ke) )
1547 dpres_n(
k) = dpres(
k) + rt2p(
k) * ( rhot_n(
k) - rhot(
k) )
1551 lhs = ( dens_n(
k) - dens(
k) ) / dt
1552 rhs = - j33g * ( momz_n(
k) - momz_n(
k-1) ) * rcdz(
k) / g(
k,
i_xyz) + sr(
k)
1553 if ( abs(lhs) < small )
then
1556 error = ( lhs - rhs ) / lhs
1558 if ( abs(error) > small )
then
1559 log_error(
"check_equation",*)
"DENS error",
k, i, j, error, lhs, rhs
1560 log_error_cont(*)eps
1566 lhs = ( momz_n(
k) - momz(
k) ) / dt
1567 rhs = - j33g * ( dpres_n(
k+1) - dpres_n(
k) ) * rfdz(
k) / g(
k,
i_xyw) &
1568 - grav * ( ( dens_n(
k+1) - ref_dens(
k+1) ) + ( dens_n(
k) - ref_dens(
k) ) ) * 0.5_rp &
1570 if ( abs(lhs) < small )
then
1573 error = ( lhs - rhs ) / lhs
1575 if ( abs(error) > small )
then
1576 log_error(
"check_equation",*)
"MOMZ error",
k, i, j, error, lhs, rhs
1577 log_error_cont(*) momz_n(
k), momz(
k), dt
1578 log_error_cont(*) - j33g * ( dpres(
k+1) - dpres(
k) ) * rfdz(
k) / g(
k,
i_xyw) &
1579 - grav * ( ( dens(
k+1) - ref_dens(
k+1) ) + ( dens(
k) - ref_dens(
k) ) ) * 0.5_rp &
1586 lhs = ( rhot_n(
k) - rhot(
k) ) / dt
1587 rhs = - j33g * ( momz_n(
k)*pt(
k) - momz_n(
k-1)*pt(
k-1) ) * rcdz(
k) / g(
k,
i_xyz) + st(
k)
1588 if ( abs(lhs) < small )
then
1591 error = ( lhs - rhs ) / lhs
1593 if ( abs(error) > small )
then
1594 log_error(
"check_equation",*)
"RHOT error",
k, i, j, error, lhs, rhs
1600 end subroutine check_equation