Skip to content

Commit

Permalink
netCDF output fixes
Browse files Browse the repository at this point in the history
uwt, thlradls: better long name.
vtke: fix unit and calculation. Account for non-uniform dzf, add weighting by rhof.
  • Loading branch information
fjansson committed Oct 31, 2023
1 parent 694bb28 commit 8e9a228
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/modgenstat.f90
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ subroutine initgenstat
call ncinfo(ncname(22,:),'wqlt','Total liquid water flux','kg/kg m/s','mt')
call ncinfo(ncname(23,:),'uws','SFS-momentum flux (uw)','m^2/s^2','mt')
call ncinfo(ncname(24,:),'uwr','Resolved momentum flux (uw)','m^2/s^2','mt')
call ncinfo(ncname(25,:),'uwt','Total momentum flux (vw)','m^2/s^2','mt')
call ncinfo(ncname(25,:),'uwt','Total momentum flux (uw)','m^2/s^2','mt')
call ncinfo(ncname(26,:),'vws','SFS-momentum flux (vw)','m^2/s^2','mt')
call ncinfo(ncname(27,:),'vwr','Resolved momentum flux (vw)','m^2/s^2','mt')
call ncinfo(ncname(28,:),'vwt','Total momentum flux (vw)','m^2/s^2','mt')
Expand Down
2 changes: 1 addition & 1 deletion src/modradstat.f90
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ subroutine initradstat
call ncinfo(ncname( 1,:),'thltend','Total radiative tendency','K/s','tt')
call ncinfo(ncname( 2,:),'thllwtend','Long wave radiative tendency','K/s','tt')
call ncinfo(ncname( 3,:),'thlswtend','Short wave radiative tendency','K/s','tt')
call ncinfo(ncname( 4,:),'thlradls','Large scale radiative tendency','K/s','tt')
call ncinfo(ncname( 4,:),'thlradls','Prescribed large scale radiative tendency','K/s','tt')
call ncinfo(ncname( 5,:),'lwu','Long wave upward radiative flux','W/m^2','mt')
call ncinfo(ncname( 6,:),'lwd','Long wave downward radiative flux','W/m^2','mt')
call ncinfo(ncname( 7,:),'swu','Short wave upward radiative flux','W/m^2','mt')
Expand Down
32 changes: 18 additions & 14 deletions src/modtimestat.f90
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ subroutine inittimestat
call ncinfo(ncname( 8,:),'lwp_bar','Liquid-water path','kg/m^2','time')
call ncinfo(ncname( 9,:),'lwp_max','Maximum Liquid-water path','kg/m^2','time')
call ncinfo(ncname(10,:),'wmax','Maximum vertical velocity','m/s','time')
call ncinfo(ncname(11,:),'vtke','Vertical integral of total TKE','kg/s','time')
call ncinfo(ncname(11,:),'vtke','Vertical integral of total TKE','kg/s^2','time')
call ncinfo(ncname(12,:),'lmax','Maximum liquid water specific humidity','kg/kg','time')
call ncinfo(ncname(13,:),'ustar','Surface friction velocity','m/s','time')
call ncinfo(ncname(14,:),'tstr','Turbulent temperature scale','K','time')
Expand Down Expand Up @@ -638,18 +638,22 @@ subroutine timestat
patchx = patchxnr(i)
endif

tke_totl = tke_totl + 0.5*( &
(0.5*(u0(i,j,k)+u0(i+1,j,k))+cu-u0av(k))**2 &
+(0.5*(v0(i,j,k)+v0(i,j+1,k))+cv-v0av(k))**2 &
+(0.5*(w0(i,j,k)+w0(i,j,k+1)) )**2 &
) + e120(i,j,k)**2
tke_totl = tke_totl + ( &
0.5*( &
(0.5*(u0(i,j,k)+u0(i+1,j,k))+cu-u0av(k))**2 &
+(0.5*(v0(i,j,k)+v0(i,j+1,k))+cv-v0av(k))**2 &
+(0.5*(w0(i,j,k)+w0(i,j,k+1)) )**2 &
) + e120(i,j,k)**2 &
) * dzf(k) * rhof(k)

if (lhetero) then
tke_tot_field(i,j) = tke_tot_field(i,j) + 0.5*( &
(0.5*(u0(i,j,k)+u0(i+1,j,k))+cu-u0av_patch(patchx,patchy))**2 + &
(0.5*(v0(i,j,k)+v0(i,j+1,k))+cv-v0av_patch(patchx,patchy))**2 + &
(0.5*(w0(i,j,k)+w0(i,j,k+1)) -w0av_patch(patchx,patchy))**2 &
) + e120(i,j,k)**2
tke_tot_field(i,j) = tke_tot_field(i,j) + ( &
0.5*( &
(0.5*(u0(i,j,k)+u0(i+1,j,k))+cu-u0av_patch(patchx,patchy))**2 + &
(0.5*(v0(i,j,k)+v0(i,j+1,k))+cv-v0av_patch(patchx,patchy))**2 + &
(0.5*(w0(i,j,k)+w0(i,j,k+1)) -w0av_patch(patchx,patchy))**2 &
) + e120(i,j,k)**2 &
) * dzf(k) * rhof(k)
endif
end do
end do
Expand Down Expand Up @@ -796,7 +800,7 @@ subroutine timestat
qlintav*1000., &
qlintmax*1000., &
wmax, &
tke_tot*dzf(1), &
tke_tot, &
qlmax*1000.
close(ifoutput)

Expand Down Expand Up @@ -853,7 +857,7 @@ subroutine timestat
vars( 8) = qlintav
vars( 9) = qlintmax
vars(10) = wmax
vars(11) = tke_tot*dzf(1)
vars(11) = tke_tot
vars(12) = qlmax
vars(13) = ust
vars(14) = tst
Expand Down Expand Up @@ -902,7 +906,7 @@ subroutine timestat
qlint_patch(i,j)*1000., &
qlintmax_patch(i,j)*1000., &
wmax_patch(i,j), &
tke_tot_patch(i,j)*dzf(1), &
tke_tot_patch(i,j), &
qlmax_patch(i,j)*1000.
close(ifoutput)

Expand Down

0 comments on commit 8e9a228

Please sign in to comment.