Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:NOAA-EMC/UPP into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
KarinaAsmar-NOAA committed Mar 1, 2024
2 parents f7525f7 + 10bfc06 commit b209b6c
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 16 deletions.
79 changes: 67 additions & 12 deletions sorc/ncep_post.fd/INITPOST_NETCDF.f
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
!> 2023-10-23 | Jaymes Kenyon | Read HAILCAST diagnostic output from RRFS
!> 2024-01-12 | Wen Meng | Remove the hard-wired bucket for beyond F240
!> 2024-02-07 | Eric James | Adding reading of direct and diffuse irradiance and LAI
!> 2024-02-20 | Jaymes Kenyon | Add calculation of PBLHGUST (from INITPOST.F) to support RRFS 10-m wind gust diagnostic
!>
!> @author Hui-Ya Chuang @date 2016-03-04
!----------------------------------------------------------------------
Expand Down Expand Up @@ -95,7 +96,7 @@ SUBROUTINE INITPOST_NETCDF(ncid2d,ncid3d)
alwoutc,alwtoac,aswoutc,aswtoac,alwinc,aswinc,avgpotevp,snoavg, &
ti,aod550,du_aod550,ss_aod550,su_aod550,oc_aod550,bc_aod550,prate_max,maod,dustpm10, &
dustcb,bccb,occb,sulfcb,sscb,dustallcb,ssallcb,dustpm,sspm,pp25cb,pp10cb,no3cb,nh4cb,&
pwat, ebb, hwp, aqm_aod550, ltg1_max,ltg2_max,ltg3_max, hail_maxhailcast
pwat, ebb, hwp, aqm_aod550, ltg1_max,ltg2_max,ltg3_max, hail_maxhailcast, pblhgust
use soil, only: sldpth, sllevel, sh2o, smc, stc
use masks, only: lmv, lmh, htm, vtm, gdlat, gdlon, dx, dy, hbm2, sm, sice
use physcons_post, only: grav => con_g, fv => con_fvirt, rgas => con_rd, &
Expand Down Expand Up @@ -181,11 +182,11 @@ SUBROUTINE INITPOST_NETCDF(ncid2d,ncid3d)
REAL DUMMY(IM,JM)
!jw
integer ii,jj,js,je,iyear,imn,iday,itmp,ioutcount,istatus, &
I,J,L,ll,k,kf,irtn,igdout,n,Index,nframe, &
I,J,L,ll,k,k1,kf,irtn,igdout,n,Index,nframe, &
nframed2,iunitd3d,ierr,idum,iret,nrec,idrt
integer ncid3d,ncid2d,varid,nhcas,varid_bl,iret_bl
real TSTART,TLMH,TSPH,ES,FACT,soilayert,soilayerb,zhour,dum, &
tvll,pmll,tv, tx1, tx2
tvll,pmll,tv, tx1, tx2, zpbltop

character*20,allocatable :: recname(:)
integer, allocatable :: reclev(:), kmsk(:,:)
Expand Down Expand Up @@ -215,17 +216,19 @@ SUBROUTINE INITPOST_NETCDF(ncid2d,ncid3d)

integer, parameter :: npass2=5, npass3=30
real, parameter :: third=1.0/3.0
real, parameter :: delta_theta4gust=0.5
INTEGER, DIMENSION(2) :: ij4min, ij4max
REAL :: omgmin, omgmax
real, allocatable :: d2d(:,:), u2d(:,:), v2d(:,:), omga2d(:,:)
REAL, ALLOCATABLE :: ps2d(:,:),psx2d(:,:),psy2d(:,:)
real, allocatable :: div3d(:,:,:)
real(kind=4),allocatable :: vcrd(:,:)
real :: dum_const
real, allocatable :: ext550(:,:,:)
real, allocatable :: ext550(:,:,:),thv(:,:,:)

if (modelname == 'FV3R') then
allocate(ext550(ista_2l:iend_2u,jsta_2l:jend_2u,lm))
allocate(thv(ista_2l:iend_2u,jsta_2l:jend_2u,lm))
endif

!***********************************************************************
Expand Down Expand Up @@ -2587,30 +2590,82 @@ SUBROUTINE INITPOST_NETCDF(ncid2d,ncid3d)
if(debugprint)print*,'sample stc = ',1,stc(isa,jsa,9)
END IF
!
! E. James - 27 Sep 2022: this is for RRFS, adding smoke and dust
! extinction; it needs to be after ZINT is defined.
!
if (modelname == 'FV3R') then
do l = 1, lm
do j = jsta_2l, jend_2u
do i = ista_2l, iend_2u
!
! E. James - 27 Sep 2022: this is for RRFS, adding smoke and dust
! extinction; it needs to be after ZINT is defined.
!
if(ext550(i,j,l)<spval)then
taod5503d ( i, j, l) = ext550 ( i, j, l )
dz = ZINT( i, j, l ) - ZINT( i, j, l+1 )
aextc55 ( i, j, l ) = taod5503d ( i, j, l ) / dz
endif
if(debugprint.and.i==im/2.and.j==(jsta+jend)/2)print*,'sample taod5503d= ', &
if(debugprint.and.i==im/2.and.j==(jsta+jend)/2)print*,'sample taod5503d= ', &
i,j,l,taod5503d ( i, j, l )
if(debugprint.and.i==im/2.and.j==(jsta+jend)/2)print*,'sample dz= ', &
if(debugprint.and.i==im/2.and.j==(jsta+jend)/2)print*,'sample dz= ', &
dz
if(debugprint.and.i==im/2.and.j==(jsta+jend)/2)print*,'sample AEXTC55= ', &
if(debugprint.and.i==im/2.and.j==(jsta+jend)/2)print*,'sample AEXTC55= ', &
i,j,l,aextc55 ( i, j, l )
! J. Kenyon - 14 Feb 2024: Obtain the virtual potential
! temperature (thv) from temperature and specific humidity.
thv(i,j,l) = ( t(i,j,l) * (p1000/pint(i,j,l))**CAPA ) & ! line 1: convert temp to theta
* ( 1. + 0.61*q(i,j,l)/(1.-q(i,j,l)) ) ! line 2: convert theta to theta-v;
! note that the factor q/(1-q) converts
! specific humidity (q) to mixing ratio
end do
end do
end do
do j = jsta_2l, jend_2u
do i = ista_2l, iend_2u
! J. Kenyon - 14 Feb 2024: From the vertical profile of theta-v,
! determine an effective PBL height. This ad-hoc PBL height will
! be used solely for the 10-m wind-gust diagnostic. The approach
! that follows is essentially reproduced from INITPOST.F.
!--Check for a surface-based mixed layer, but give a
! 0.5 K "boost" to the surface theta-v.
if (thv(i,j,lm-1) < (thv(i,j,lm) + delta_theta4gust)) then
!--A mixed layer exists, so proceed. Let the PBL top
!--be defined as the lowest level where theta-v is
!--greater than (theta-v_sfc + 0.5 K).
do k = 3, lm
k1 = k
if (thv(i,j,lm-k+1) > (thv(i,j,lm) + delta_theta4gust)) &
!--PBL top found, so exit from the do-loop. The most recent
!--k1 value is the first level above the PBL top.
exit
end do
!--Find the height of k1 by linear interpolation, then
!--assign as zpbltop
zpbltop = zmid(i,j,lm-k1+1) + &
((thv(i,j,lm)+delta_theta4gust)-thv(i,j,lm-k1+1)) &
* (zmid(i,j,lm-k1+2)-zmid(i,j,lm-k1+1)) &
/ (thv(i,j,lm-k1+2) - thv(i,j,lm-k1+1))
!--Subtract surface elevation to yield PBLHGUST in AGL
PBLHGUST ( i, j ) = max(zpbltop - zint(i,j,lp1), 0.)
else
!--Mixed layer does not exist
PBLHGUST ( i, j ) = 0.
endif
end do
end do
deallocate(ext550)
end if
deallocate(thv)
end if ! (modelname == 'FV3R')
!$omp parallel do private(i,j)
do j=jsta,jend
Expand Down
9 changes: 5 additions & 4 deletions sorc/ncep_post.fd/MDLFLD.f
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
!! 23-10-17 | E James| Include hail hydrometeors in VIL computation when available
!! 24-01-07 | Y Mao | Add EDPARM IDs to the condition to call gtg_algo()
!! 24-01-24 | H Lin | switching GTG max (gtg) to gtgx3 from gtgx2 per gtg_algo() call
!! 24-02-20 | J Kenyon | Apply the PBLHGUST-related calculations to RRFS
!!
!! USAGE: CALL MDLFLD
!! INPUT ARGUMENT LIST:
Expand Down Expand Up @@ -4047,9 +4048,9 @@ SUBROUTINE MDLFLD

ENDIF
!
! CALCULATE Gust based on Ri PBL
! Calculate 10-m wind gust based on PBL height (as diagnosed from either Ri or theta-v)
IF (IGET(245)>0 .or. IGET(464)>0 .or. IGET(467)>0.or. IGET(470)>0 .or. IGET(476)>0) THEN
IF(MODELNAME=='RAPR') THEN
IF (MODELNAME=='RAPR') THEN
!tgs - 24may17 - smooth PBLHGUST
if(MAPTYPE == 6) then
if(grib=='grib2') then
Expand Down Expand Up @@ -4087,7 +4088,7 @@ SUBROUTINE MDLFLD

ZSFC=ZINT(I,J,NINT(LMH(I,J))+1)
loopL:DO L=NINT(LMH(I,J)),1,-1
IF(MODELNAME=='RAPR') THEN
IF (MODELNAME=='RAPR' .OR. MODELNAME=='FV3R') THEN
HGT=ZMID(I,J,L)
PBLHOLD=PBLHGUST(I,J)
ELSE
Expand All @@ -4107,7 +4108,7 @@ SUBROUTINE MDLFLD
if(lpbl(i,j)<1)print*,'zero lpbl',i,j,pblri(i,j),lpbl(i,j)
ENDDO
ENDDO
IF(MODELNAME=='RAPR') THEN
IF (MODELNAME=='RAPR' .OR. MODELNAME=='FV3R') THEN
CALL CALGUST(LPBL,PBLHGUST,GUST)
ELSE
CALL CALGUST(LPBL,PBLRI,GUST)
Expand Down

0 comments on commit b209b6c

Please sign in to comment.