From 91f3711585b9157154bf4da7af0a5119da0fa7b9 Mon Sep 17 00:00:00 2001 From: "samuel.trahan" Date: Thu, 26 Jan 2023 18:10:07 +0000 Subject: [PATCH 1/5] GSL UPP developments up to January 2023 1. Increases precision of VIL_ON_ENTIRE_ATMOS from `4.0` to `7.0` 2. Adds an experimental diagnostic, developed for the HRRR to correct for the HRRR's low bias in cloud cover. For an FAA deliverable due Feb 2023. 3. Switches from cldfra to cldfra_bl when reading cloud fraction from INITPPOST_NETCDF --- parm/fv3lam_rrfs.xml | 2 +- parm/postxconfig-NT-fv3lam_rrfs.txt | 2 +- sorc/ncep_post.fd/CLDRAD.f | 36 ++++++++++++++++++----------- sorc/ncep_post.fd/INITPOST_NETCDF.f | 2 +- 4 files changed, 25 insertions(+), 17 deletions(-) diff --git a/parm/fv3lam_rrfs.xml b/parm/fv3lam_rrfs.xml index d5b68a93c..fd384ad89 100755 --- a/parm/fv3lam_rrfs.xml +++ b/parm/fv3lam_rrfs.xml @@ -1790,7 +1790,7 @@ VIL_ON_ENTIRE_ATMOS VIL - 4.0 + 7.0 diff --git a/parm/postxconfig-NT-fv3lam_rrfs.txt b/parm/postxconfig-NT-fv3lam_rrfs.txt index 37bbec810..034aa0234 100644 --- a/parm/postxconfig-NT-fv3lam_rrfs.txt +++ b/parm/postxconfig-NT-fv3lam_rrfs.txt @@ -9742,7 +9742,7 @@ entire_atmos_single_lyr 0 0.0 1 -4.0 +7.0 0 0 0 diff --git a/sorc/ncep_post.fd/CLDRAD.f b/sorc/ncep_post.fd/CLDRAD.f index 58bf95eb6..c506228ef 100644 --- a/sorc/ncep_post.fd/CLDRAD.f +++ b/sorc/ncep_post.fd/CLDRAD.f @@ -2098,11 +2098,18 @@ SUBROUTINE CLDRAD ! However, for RAPv5/HRRRv4, paramater 711 will be supplied as ! the GSD cloud-base height, and parameter 798 will be the ! corresponding cloud-base pressure. (J. Kenyon, 4 Nov 2019) +! -- E. James, 15 Dec 2022 +! The above experimental diagnostic, developed for the HRRR with +! lots of "add-ons" to correct for the HRRR's low bias in cloud +! cover, needs to be revised for the RRFS with its more extensive +! cloudiness. For an FAA deliverable due Feb 2023, the diagnostic +! is being modified to get rid of some of the add ons. ! Parameters 711/798: experimental ceiling diagnostic #2 (height and pressure, respectively) IF ((IGET(711)>0) .OR. (IGET(798)>0)) THEN ! set minimum cloud fraction to represent a ceiling - ceiling_thresh_cldfra = 0.4 +! ceiling_thresh_cldfra = 0.4 + ceiling_thresh_cldfra = 0.5 ! set some constants for ceiling adjustment in snow (retained from legacy algorithm, also in calvis.f) rhoice = 970. coeffp = 10.36 @@ -2192,23 +2199,24 @@ SUBROUTINE CLDRAD end do !-- end of search 2 - zceil = min(zceil1,zceil2) ! choose lower of zceil1 and zceil2 +! zceil = min(zceil1,zceil2) ! choose lower of zceil1 and zceil2 + zceil = zceil1 !-- Search for "indefinite ceiling" (vertical visibility) conditions: consider ! lowering of apparent ceiling due to falling snow (retained from legacy ! diagnostic); this is extracted from calvis.f (visibility diagnostic) - if (QQS(i,j,LM)>1.e-10) then - TV=T(I,J,lm)*(H1+D608*Q(I,J,lm)) - RHOAIR=PMID(I,J,lm)/(RD*TV) - vovermd = (1.+Q(i,j,LM))/rhoair + QQS(i,j,LM)/rhoice - concfp = QQS(i,j,LM)/vovermd*1000. - betav = coeffp*concfp**exponfp + 1.e-10 - vertvis = 1000.*min(90., const1/betav) - if (vertvis < zceil-FIS(I,J)*GI ) then ! if vertvis is more restictive than zceil found above; set zceil to vertvis - ! note that FIS is geopotential of the surface (ground), and GI is 1/g - zceil = FIS(I,J)*GI + vertvis - end if - end if +! if (QQS(i,j,LM)>1.e-10) then +! TV=T(I,J,lm)*(H1+D608*Q(I,J,lm)) +! RHOAIR=PMID(I,J,lm)/(RD*TV) +! vovermd = (1.+Q(i,j,LM))/rhoair + QQS(i,j,LM)/rhoice +! concfp = QQS(i,j,LM)/vovermd*1000. +! betav = coeffp*concfp**exponfp + 1.e-10 +! vertvis = 1000.*min(90., const1/betav) +! if (vertvis < zceil-FIS(I,J)*GI ) then ! if vertvis is more restictive than zceil found above; set zceil to vertvis +! ! note that FIS is geopotential of the surface (ground), and GI is 1/g +! zceil = FIS(I,J)*GI + vertvis +! end if +! end if ceil(I,J) = zceil ENDDO ! i loop diff --git a/sorc/ncep_post.fd/INITPOST_NETCDF.f b/sorc/ncep_post.fd/INITPOST_NETCDF.f index 046753a84..474e3519d 100644 --- a/sorc/ncep_post.fd/INITPOST_NETCDF.f +++ b/sorc/ncep_post.fd/INITPOST_NETCDF.f @@ -889,7 +889,7 @@ SUBROUTINE INITPOST_NETCDF(ncid2d,ncid3d) call read_netcdf_3d_para(ncid3d,im,jm,ista,ista_2l,iend,iend_2u,jsta,jsta_2l,jend,jend_2u, & spval,VarName,cfr(ista_2l,jsta_2l,1),lm) else - VarName='cldfra' + VarName='cldfra_bl' call read_netcdf_3d_para(ncid2d,im,jm,ista,ista_2l,iend,iend_2u,jsta,jsta_2l,jend,jend_2u, & spval,VarName,cfr(ista_2l,jsta_2l,1),lm) endif From eb8f4e3d99052118ffc5cea6abc0ce82c31da771 Mon Sep 17 00:00:00 2001 From: "samuel.trahan" Date: Fri, 27 Jan 2023 15:29:46 +0000 Subject: [PATCH 2/5] inline post bug fix: deallocate ifi arrays before next iteration of post --- sorc/ncep_post.fd/DEALLOCATE.f | 3 +++ sorc/ncep_post.fd/IFI.F | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/sorc/ncep_post.fd/DEALLOCATE.f b/sorc/ncep_post.fd/DEALLOCATE.f index 4c0c0d094..75301bfc5 100644 --- a/sorc/ncep_post.fd/DEALLOCATE.f +++ b/sorc/ncep_post.fd/DEALLOCATE.f @@ -139,6 +139,9 @@ SUBROUTINE DE_ALLOCATE deallocate(stc) deallocate(sh2o) deallocate(SLDPTH) + deallocate(CAPE) + deallocate(CIN) + deallocate(IFI_APCP) deallocate(RTDPTH) deallocate(SLLEVEL) ! diff --git a/sorc/ncep_post.fd/IFI.F b/sorc/ncep_post.fd/IFI.F index 6df7215d1..6fa255b0d 100644 --- a/sorc/ncep_post.fd/IFI.F +++ b/sorc/ncep_post.fd/IFI.F @@ -21,6 +21,9 @@ subroutine set_ifi_dims() ! Bogus fill value for flight levels to prevent a crash ifi_nflight = 60 + if(allocated(ifi_flight_levels)) then + deallocate(ifi_flight_levels) + endif allocate(ifi_flight_levels(ifi_nflight)) do i=1,ifi_nflight ifi_flight_levels(i) = 500*i @@ -176,10 +179,27 @@ subroutine make_communicators ! 929 format('Rank ',I0,' ista=',I0,' jsta=',I0) ! print 929,grid_rank,ista,jsta + if(allocated(ista_grid)) then + deallocate(ista_grid) + deallocate(jsta_grid) + deallocate(rearrange) + deallocate(rearrange_row1d) + deallocate(rearrange_row2d) + deallocate(row_ista) + deallocate(row_iend) + deallocate(row_comm_count) + deallocate(row_comm_displ) + deallocate(col_jsta) + deallocate(col_jend) + deallocate(col_comm_count) + deallocate(col_comm_displ) + endif + ! Get the start locations on every rank. We need this for the key, ! and for determining root ranks. allocate(ista_grid(size)) allocate(jsta_grid(size)) + ista_grid=-1 jsta_grid=-1 call MPI_Allgather(ista,1,MPI_INTEGER,ista_grid,1,MPI_INTEGER,mpi_comm_comp,ierr) @@ -508,6 +528,9 @@ subroutine set_ifi_dims() ! Convert from integer to real: ifi_nflight = size(config_flight_levels_feet) + if(allocated(ifi_flight_levels)) then + deallocate(ifi_flight_levels) + endif allocate(ifi_flight_levels(ifi_nflight)) ifi_flight_levels = config_flight_levels_feet From bb195dc14f9ccdbf2463d40f6c5c45b891f806e7 Mon Sep 17 00:00:00 2001 From: "Samuel Trahan (NOAA contractor)" <39415369+SamuelTrahanNOAA@users.noreply.github.com> Date: Fri, 27 Jan 2023 13:11:16 -0500 Subject: [PATCH 3/5] Update sorc/ncep_post.fd/IFI.F --- sorc/ncep_post.fd/IFI.F | 1 - 1 file changed, 1 deletion(-) diff --git a/sorc/ncep_post.fd/IFI.F b/sorc/ncep_post.fd/IFI.F index 6fa255b0d..2b910cc99 100644 --- a/sorc/ncep_post.fd/IFI.F +++ b/sorc/ncep_post.fd/IFI.F @@ -199,7 +199,6 @@ subroutine make_communicators ! and for determining root ranks. allocate(ista_grid(size)) allocate(jsta_grid(size)) - ista_grid=-1 jsta_grid=-1 call MPI_Allgather(ista,1,MPI_INTEGER,ista_grid,1,MPI_INTEGER,mpi_comm_comp,ierr) From 94e7e15c0b31c282d525544b9928fe6f06b52de3 Mon Sep 17 00:00:00 2001 From: "samuel.trahan" Date: Mon, 30 Jan 2023 18:06:20 +0000 Subject: [PATCH 4/5] automatically choose cldfra or cldfra_bl --- sorc/ncep_post.fd/INITPOST_NETCDF.f | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/sorc/ncep_post.fd/INITPOST_NETCDF.f b/sorc/ncep_post.fd/INITPOST_NETCDF.f index 474e3519d..345f104c5 100644 --- a/sorc/ncep_post.fd/INITPOST_NETCDF.f +++ b/sorc/ncep_post.fd/INITPOST_NETCDF.f @@ -153,7 +153,7 @@ SUBROUTINE INITPOST_NETCDF(ncid2d,ncid3d) integer ii,jj,js,je,iyear,imn,iday,itmp,ioutcount,istatus, & I,J,L,ll,k,kf,irtn,igdout,n,Index,nframe, & nframed2,iunitd3d,ierr,idum,iret,nrec,idrt - integer ncid3d,ncid2d,varid,nhcas + integer ncid3d,ncid2d,varid,nhcas,varid_bl,iret_bl real TSTART,TLMH,TSPH,ES,FACT,soilayert,soilayerb,zhour,dum, & tvll,pmll,tv, tx1, tx2 @@ -889,9 +889,25 @@ SUBROUTINE INITPOST_NETCDF(ncid2d,ncid3d) call read_netcdf_3d_para(ncid3d,im,jm,ista,ista_2l,iend,iend_2u,jsta,jsta_2l,jend,jend_2u, & spval,VarName,cfr(ista_2l,jsta_2l,1),lm) else - VarName='cldfra_bl' - call read_netcdf_3d_para(ncid2d,im,jm,ista,ista_2l,iend,iend_2u,jsta,jsta_2l,jend,jend_2u, & - spval,VarName,cfr(ista_2l,jsta_2l,1),lm) + + iret_bl = nf90_inq_varid(ncid2d,'cldfra_bl',varid_bl) + iret = nf90_inq_varid(ncid2d,'cldfra',varid) + + if(iret_bl==NF90_NOERR .and. iret==NF90_NOERR) then + write(0,*) 'WARNING: BOTH cldfra_bl AND cldfra ARE AVAILABLE. USING cldfra.' + VarName='cldfra' + else if(iret_bl==NF90_NOERR) then + VarName='cldfra_bl' + else if(iret==NF90_NOERR) then + VarName='cldfra' + else + VarName='nope' + endif + + if(VarName /= 'nope') then + call read_netcdf_3d_para(ncid2d,im,jm,ista,ista_2l,iend,iend_2u,jsta,jsta_2l,jend,jend_2u, & + spval,VarName,cfr(ista_2l,jsta_2l,1),lm) + endif endif ! do l=1,lm ! if(debugprint)print*,'sample ',VarName,'isa,jsa,l =' & From a351111baa88c76cf441f0df1adee9602b6406e0 Mon Sep 17 00:00:00 2001 From: "samuel.trahan" Date: Tue, 31 Jan 2023 18:38:40 +0000 Subject: [PATCH 5/5] update author info --- sorc/ncep_post.fd/CLDRAD.f | 1 + sorc/ncep_post.fd/INITPOST_NETCDF.f | 1 + 2 files changed, 2 insertions(+) diff --git a/sorc/ncep_post.fd/CLDRAD.f b/sorc/ncep_post.fd/CLDRAD.f index c506228ef..ed0aeb3c3 100644 --- a/sorc/ncep_post.fd/CLDRAD.f +++ b/sorc/ncep_post.fd/CLDRAD.f @@ -68,6 +68,7 @@ !> 2022-10-20 | Li(Kate Zhang) | Add nitrate look-up table and nitrate AOD for NASA GOCART (UFS-Aerosols). !> 2022-11-16 | Eric James | Adding total column dust, biomass burning emissions, hourly wildfire potential from RRFS !> 2022-1207 | Wen Meng | Add AOD for AQM +!> 2022-12-15 | Eric James | experimental cloud base height diagnostic from HRRR, to correct a low bias in cloud cover !> !> @author Russ Treadon W/NP2 @date 1993-08-30 SUBROUTINE CLDRAD diff --git a/sorc/ncep_post.fd/INITPOST_NETCDF.f b/sorc/ncep_post.fd/INITPOST_NETCDF.f index 345f104c5..e6220ff87 100644 --- a/sorc/ncep_post.fd/INITPOST_NETCDF.f +++ b/sorc/ncep_post.fd/INITPOST_NETCDF.f @@ -27,6 +27,7 @@ !> 2022-11-16 | Eric James | Read smoke, dust, biomass burning, and hourly wildfire potential from RRFS !> 2022-12-07 | Wen Meng | Read AOD from AQM model !> 2022-12-23 | Eric Aligo | Read six winter weather diagnostics from model +!> 2023-01-30 | Sam Trahan | Read cldfra or cldfra_bl, whichever is available !> !> @author Hui-Ya Chuang @date 2016-03-04 SUBROUTINE INITPOST_NETCDF(ncid2d,ncid3d)