Skip to content

Commit

Permalink
Merge pull request ufs-community#102 from XiaqiongZhou-NOAA/zbot
Browse files Browse the repository at this point in the history
Revise z_bot and p_bot calculation to avoid negative z_bot
  • Loading branch information
laurenchilutti authored May 12, 2021
2 parents 7739c9b + 8568172 commit 3720aea
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions driver/fvGFS/atmosphere.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1241,6 +1241,8 @@ subroutine get_bottom_mass ( t_bot, tr_bot, p_bot, z_bot, p_surf, slp )
! and surface pressure
!--------------------------------------------------------------
!--- interface variables ---
!--- p_bot: lowest layer-mean hydrostatic pressure
!--- z_bot: height depth of the lowest level above the surfae
real, intent(out), dimension(isc:iec,jsc:jec):: t_bot, p_bot, z_bot, p_surf
real, intent(out), optional, dimension(isc:iec,jsc:jec):: slp
real, intent(out), dimension(isc:iec,jsc:jec,nq):: tr_bot
Expand All @@ -1256,8 +1258,10 @@ subroutine get_bottom_mass ( t_bot, tr_bot, p_bot, z_bot, p_surf, slp )
do i=isc,iec
p_surf(i,j) = Atm(mygrid)%ps(i,j)
t_bot(i,j) = Atm(mygrid)%pt(i,j,npz)
p_bot(i,j) = Atm(mygrid)%delp(i,j,npz)/(Atm(mygrid)%peln(i,npz+1,j)-Atm(mygrid)%peln(i,npz,j))
z_bot(i,j) = rrg*t_bot(i,j)*(1. - Atm(mygrid)%pe(i,npz,j)/p_bot(i,j))
p_bot(i,j) = (Atm(mygrid)%pe(i,npz+1,j)-Atm(mygrid)%pe(i,npz,j))/ &
(log(Atm(mygrid)%pe(i,npz+1,j)/Atm(mygrid)%pe(i,npz,j)))
z_bot(i,j) = rrg*t_bot(i,j)*(Atm(mygrid)%pe(i,npz+1,j)/p_bot(i,j)-1.)

#ifdef MULTI_GASES
z_bot(i,j) = z_bot(i,j)*virq(Atm(mygrid)%q(i,j,npz,:))
#else
Expand Down Expand Up @@ -1360,6 +1364,9 @@ subroutine atmosphere_get_bottom_layer (Atm_block, DYCORE_Data)
first_time = .false.
endif

!--- p_bot: lowest layer-mean hydrostatic pressure
!--- z_bot: height depth of the lowest level above the surfae

!$OMP parallel do default (none) &
!$OMP shared (Atm_block, DYCORE_Data, Atm, mygrid, npz, kr, rrg, zvir, nq) &
!$OMP private (nb, ix, i, j, tref, nt)
Expand All @@ -1371,12 +1378,13 @@ subroutine atmosphere_get_bottom_layer (Atm_block, DYCORE_Data)
DYCORE_Data(nb)%Coupling%p_srf(ix) = Atm(mygrid)%ps(i,j)
!--- bottom layer temperature, pressure, & winds
DYCORE_Data(nb)%Coupling%t_bot(ix) = Atm(mygrid)%pt(i,j,npz)
DYCORE_Data(nb)%Coupling%p_bot(ix) = Atm(mygrid)%delp(i,j,npz)/(Atm(mygrid)%peln(i,npz+1,j)-Atm(mygrid)%peln(i,npz,j))
DYCORE_Data(nb)%Coupling%p_bot(ix) = (Atm(mygrid)%pe(i,npz+1,j)-Atm(mygrid)%pe(i,npz,j))/ &
(log(Atm(mygrid)%pe(i,npz+1,j)/Atm(mygrid)%pe(i,npz,j)))
DYCORE_Data(nb)%Coupling%u_bot(ix) = Atm(mygrid)%u_srf(i,j)
DYCORE_Data(nb)%Coupling%v_bot(ix) = Atm(mygrid)%v_srf(i,j)
!--- bottom layer height based on hydrostatic assumptions
DYCORE_Data(nb)%Coupling%z_bot(ix) = rrg*DYCORE_Data(nb)%Coupling%t_bot(ix) * &
(1. - Atm(mygrid)%pe(i,npz,j)/DYCORE_Data(nb)%Coupling%p_bot(ix))
(Atm(mygrid)%pe(i,npz+1,j)/DYCORE_Data(nb)%Coupling%p_bot(ix) - 1.)
#ifdef MULTI_GASES
DYCORE_Data(nb)%Coupling%z_bot(ix) = DYCORE_Data(nb)%Coupling%z_bot(ix)*virq(Atm(mygrid)%q(i,j,npz,:))
#else
Expand Down

0 comments on commit 3720aea

Please sign in to comment.