Commit b6b6a5cc authored by Satoshi Endo's avatar Satoshi Endo
Browse files

Fixed vertical flux diagnostics.

parent f61e55f6
......@@ -271,7 +271,7 @@ SUBROUTINE crm_stat ( &
REAL, DIMENSION( ims:ime, kms:kme, jms:jme ) :: i_c, i_cc, &
iwc, lwc, ql, qf, speqv, &
thl, thv, wphy
thl, thv, wphy, dz
REAL, DIMENSION( ims:ime, jms:jme ) :: p_p, u_p, v_p, w_p, &
th_p, thv_p, thl_p, &
......@@ -420,17 +420,17 @@ SUBROUTINE crm_stat ( &
lwdnfd_tmp(:,:,:) = 0.
END SELECT
! ### Calculate w at cell middle
! ### Calculate w at cell middle, dz between mid levels
DO j = jps, min(jpe,jde-1)
DO k = kts+1, kte
DO k = kts, kte
DO i = ips, min(ipe,ide-1)
wphy(i,k,j) = fnm(k)*w(i,k,j) + fnp(k)*w(i,k-1,j)
wphy(i,k,j) = (w(i,k,j) + w(i,k+1,j))*0.5
dz(i,k,j) = z(i,k,j) - z(i,k-1,j)
END DO
END DO
END DO
wphy(:,kts,:) = 0.
wphy(:,kte+1,:) = 0.
! ### Reset the accumulated statistics variables as needed ###
IF (reset_time) &
CALL crm_stat_reset( &
......@@ -950,23 +950,24 @@ SUBROUTINE crm_stat ( &
DO j = jps, min(jpe,jde-1)
DO i = ips, min(ipe,ide-1)
uw_sgs_sum = uw_sgs_sum - m13(i,k,j)/rho(i,kts,j)
vw_sgs_sum = vw_sgs_sum - m23(i,k,j)/rho(i,kts,j)
uw_sgs_sum = uw_sgs_sum + m13(i,k,j)
vw_sgs_sum = vw_sgs_sum + m23(i,k,j)
! Originally the following is divided by dz8w, which should be dz. 20-April-2018 (HX)
wth_sgs_sum = wth_sgs_sum - (fnm(k)*xkhv(i,k,j)+fnp(k)*xkhv(i,k-1,j)) &
& *(th(i,k,j)-th(i,k-1,j)) / dz8w(i,k,j)
& *(th(i,k,j)-th(i,k-1,j)) / dz(i,k,j)
wqv_sgs_sum = wqv_sgs_sum - (fnm(k)*xkhv(i,k,j)+fnp(k)*xkhv(i,k-1,j)) &
& *(qv(i,k,j)-qv(i,k-1,j)) / dz8w(i,k,j)
& *(qv(i,k,j)-qv(i,k-1,j)) / dz(i,k,j)
wqc_sgs_sum = wqc_sgs_sum - (fnm(k)*xkhv(i,k,j)+fnp(k)*xkhv(i,k-1,j)) &
& *(qc(i,k,j)-qc(i,k-1,j)) / dz8w(i,k,j)
& *(qc(i,k,j)-qc(i,k-1,j)) / dz(i,k,j)
wqr_sgs_sum = wqr_sgs_sum - (fnm(k)*xkhv(i,k,j)+fnp(k)*xkhv(i,k-1,j)) &
& *(qr(i,k,j)-qr(i,k-1,j)) / dz8w(i,k,j)
& *(qr(i,k,j)-qr(i,k-1,j)) / dz(i,k,j)
wqi_sgs_sum = wqi_sgs_sum - (fnm(k)*xkhv(i,k,j)+fnp(k)*xkhv(i,k-1,j)) &
& *(qi(i,k,j)-qi(i,k-1,j)) / dz8w(i,k,j)
& *(qi(i,k,j)-qi(i,k-1,j)) / dz(i,k,j)
wqs_sgs_sum = wqs_sgs_sum - (fnm(k)*xkhv(i,k,j)+fnp(k)*xkhv(i,k-1,j)) &
& *(qs(i,k,j)-qs(i,k-1,j)) / dz8w(i,k,j)
& *(qs(i,k,j)-qs(i,k-1,j)) / dz(i,k,j)
wqg_sgs_sum = wqg_sgs_sum - (fnm(k)*xkhv(i,k,j)+fnp(k)*xkhv(i,k-1,j)) &
& *(qg(i,k,j)-qg(i,k-1,j)) / dz8w(i,k,j)
& *(qg(i,k,j)-qg(i,k-1,j)) / dz(i,k,j)
END DO
END DO
......@@ -1023,6 +1024,18 @@ SUBROUTINE crm_stat ( &
wqs_sgs_ave(kts) = 0.
wqg_sgs_ave(kts) = 0.
! average all these sgs fluxes onto the mid levels
do k = kts, kte-1
uw_sgs_ave(k) = (uw_sgs_ave(k)+uw_sgs_ave(k+1))*0.5
vw_sgs_ave(k) = (vw_sgs_ave(k)+vw_sgs_ave(k+1))*0.5
wqv_sgs_ave(k) = (wqv_sgs_ave(k)+wqv_sgs_ave(k+1))*0.5
wqc_sgs_ave(k) = (wqc_sgs_ave(k)+wqc_sgs_ave(k+1))*0.5
wqr_sgs_ave(k) = (wqr_sgs_ave(k)+wqr_sgs_ave(k+1))*0.5
wqi_sgs_ave(k) = (wqi_sgs_ave(k)+wqi_sgs_ave(k+1))*0.5
wqs_sgs_ave(k) = (wqs_sgs_ave(k)+wqs_sgs_ave(k+1))*0.5
wqg_sgs_ave(k) = (wqg_sgs_ave(k)+wqg_sgs_ave(k+1))*0.5
wth_sgs_ave(k) = (wth_sgs_ave(k)+wth_sgs_ave(k+1))*0.5
end do
! additional flux. use this later for total flux
wql_sgs_ave = wqc_sgs_ave + wqr_sgs_ave
......@@ -2087,3 +2100,4 @@ SUBROUTINE crm_stat_reset( &
END SUBROUTINE crm_stat_reset
END MODULE module_crm_stat
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment