Skip to content

Commit

Permalink
Restrict undefined grids from UPP computation Part 3 (#348)
Browse files Browse the repository at this point in the history
* Modify the computation at defined points.

* The second part of changes from debug mode.

* The third part of changes from debug_mode.

* The fourth part of changes from debug_mode.

* The fifth part of changes from debug_mode.

* Update per comments from code reviewer.

* Remove legacy sigma level temperature from PRSLEV dataset.

* Fix MCONV computation on undefined grids.

* Fixes for global and regional inline post in debug mode.

* Update VERSION to 10.0.9.

* Remove duplicated line.
  • Loading branch information
WenMeng-NOAA authored Aug 23, 2021
1 parent 2787388 commit a49af05
Show file tree
Hide file tree
Showing 26 changed files with 192 additions and 120 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
10.0.8
10.0.9
8 changes: 0 additions & 8 deletions parm/fv3lam.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1598,14 +1598,6 @@
<scale>5.0</scale>
</param>

<param>
<shortname>TMP_ON_SIGMA_LVL_HPC</shortname>
<pname>TMP</pname>
<scale_fact_fixed_sfc1>4</scale_fact_fixed_sfc1>
<level>9000. 8500. 8000. 7500. 7000.</level>
<scale>-4.0</scale>
</param>

<param>
<shortname>PBLREG_ON_SURFACE</shortname>
<pname>PBLREG</pname>
Expand Down
39 changes: 1 addition & 38 deletions parm/postxconfig-NT-fv3lam.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
2
219
259
258
PRSLEV
32769
ncep_nco
Expand Down Expand Up @@ -8416,43 +8416,6 @@ entire_atmos_single_lyr
?
?
?
296
TMP_ON_SIGMA_LVL_HPC
?
1
tmpl4_0
TMP
?
?
sigma_lvl
1
4
5
9000. 8500. 8000. 7500. 7000.
?
0
?
0
?
?
?
0
0.0
0
0.0
?
0
0.0
0
0.0
1
-4.0
0
0
0
?
?
?
344
PBLREG_ON_SURFACE
?
Expand Down
24 changes: 19 additions & 5 deletions sorc/ncep_post.fd/ALLOCATE_ALL.f
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ SUBROUTINE ALLOCATE_ALL()
integer ierr,jsx,jex
integer i,j,l,k
! Allocate arrays
allocate(u(im,jsta_2l:jend_2u,lm))
allocate(u(im+1,jsta_2l:jend_2u,lm))
allocate(v(im,jsta_2l:jvend_2u,lm))
allocate(t(im,jsta_2l:jend_2u,lm))
! CHUANG ADD POTENTIAL TEMP BECAUSE WRF OUTPUT THETA
Expand Down Expand Up @@ -79,9 +79,23 @@ SUBROUTINE ALLOCATE_ALL()
!$omp parallel do private(i,j,l)
do l=1,lm
do j=jsta_2l,jend_2u
do i=1,im
do i=1,im+1
u(i,j,l)=0.
enddo
enddo
enddo
!$omp parallel do private(i,j,l)
do l=1,lm
do j=jsta_2l,jvend_2u
do i=1,im
v(i,j,l)=0.
enddo
enddo
enddo
!$omp parallel do private(i,j,l)
do l=1,lm
do j=jsta_2l,jend_2u
do i=1,im
t(i,j,l)=spval
q(i,j,l)=spval
uh(i,j,l)=spval
Expand Down Expand Up @@ -810,14 +824,14 @@ SUBROUTINE ALLOCATE_ALL()
cldfra(i,j)=spval
cprate(i,j)=spval
cnvcfr(i,j)=spval
ivgtyp(i,j)=spval
isltyp(i,j)=spval
ivgtyp(i,j)=0
isltyp(i,j)=0
hbotd(i,j)=spval
htopd(i,j)=spval
hbots(i,j)=spval
htops(i,j)=spval
cldefi(i,j)=spval
islope(i,j)=spval
islope(i,j)=0
si(i,j)=spval
lspa(i,j)=spval
rswinc(i,j)=spval
Expand Down
51 changes: 18 additions & 33 deletions sorc/ncep_post.fd/BNDLYR.f
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
!! 00-01-04 JIM TUCCILLO - MPI VERSION
!! 02-01-15 MIKE BALDWIN - WRF VERSION
!! 20-11-10 JESSE MENG - USE UPP_PHYSICS MODULE
!! 21-04-01 JESSE MENG - COMPUTATION ON DEFINED POINTS ONLY
!! 21-08-20 Wen Meng - Retrict computation fro undefined points.
!!
!! USAGE: CALL BNDLYR(PBND,TBND,QBND,RHBND,UBND,VBND,
!! WBND,OMGBND,PWTBND,QCNVBND)
Expand Down Expand Up @@ -208,6 +208,18 @@ SUBROUTINE BNDLYR(PBND,TBND,QBND,RHBND,UBND,VBND, &
END IF
QSBND(I,J,LBND) = QSBND(I,J,LBND) + QSAT*DP
ENDIF
ELSE !undeined grids
PBND(I,J,LBND)=SPVAL
TBND(I,J,LBND)=SPVAL
UBND(I,J,LBND)=SPVAL
VBND(I,J,LBND)=SPVAL
WBND(I,J,LBND)=SPVAL
OMGBND(I,J,LBND)=SPVAL
QCNVBND(I,J,LBND)=SPVAL
PWTBND(I,J,LBND)=SPVAL
QBND(I,J,LBND)=SPVAL
QSBND(I,J,LBND)=SPVAL
RHBND(I,J,LBND)=SPVAL
ENDIF
ENDDO
ENDDO
Expand Down Expand Up @@ -273,9 +285,7 @@ SUBROUTINE BNDLYR(PBND,TBND,QBND,RHBND,UBND,VBND, &
DO LBND=1,NBND
DO J=JSTA,JEND
DO I=1,IM
IF(PSUM(I,J,LBND)/=0.)THEN
IF(T(I,J,LBND)<spval.and.Q(I,J,LBND)<spval.and.&
UH(I,J,LBND)<spval.and.VH(I,J,LBND)<spval) THEN
IF(PSUM(I,J,LBND)/=0..AND.TBND(I,J,LBND)<SPVAL)THEN
RPSUM = 1./PSUM(I,J,LBND)
LVLBND(I,J,LBND)= LVLBND(I,J,LBND)/NSUM(I,J,LBND)
PBND(I,J,LBND) = (PBINT(I,J,LBND)+PBINT(I,J,LBND+1))*0.5
Expand All @@ -288,18 +298,8 @@ SUBROUTINE BNDLYR(PBND,TBND,QBND,RHBND,UBND,VBND, &
VBND(I,J,LBND) = VBND(I,J,LBND)*RPSUM
END IF
WBND(I,J,LBND) = WBND(I,J,LBND)*RPSUM
IF(QCNVBND(I,J,LBND)<SPVAL) &
QCNVBND(I,J,LBND) = QCNVBND(I,J,LBND)*RPSUM
ELSE
LVLBND(I,J,LBND)= spval
PBND(I,J,LBND) = spval
TBND(I,J,LBND) = spval
QBND(I,J,LBND) = spval
OMGBND(I,J,LBND)= spval
UBND(I,J,LBND) = spval
VBND(I,J,LBND) = spval
WBND(I,J,LBND) = spval
QCNVBND(I,J,LBND)= spval
ENDIF
ENDIF
ENDDO
ENDDO
Expand All @@ -308,14 +308,9 @@ SUBROUTINE BNDLYR(PBND,TBND,QBND,RHBND,UBND,VBND, &
DO J=JSTA_M,JEND_M
DO I=2,IM-1
IF(PVSUM(I,J,LBND)/=0.)THEN
IF(UBND(I,J,LBND)<spval.and.VBND(I,J,LBND)<spval.and.PVSUM(I,J,LBND)<spval)THEN
RPVSUM = 1./PVSUM(I,J,LBND)
UBND(I,J,LBND) = UBND(I,J,LBND)*RPVSUM
VBND(I,J,LBND) = VBND(I,J,LBND)*RPVSUM
ELSE
UBND(I,J,LBND) = spval
VBND(I,J,LBND) = spval
ENDIF
ENDIF
ENDDO
ENDDO
Expand All @@ -331,7 +326,7 @@ SUBROUTINE BNDLYR(PBND,TBND,QBND,RHBND,UBND,VBND, &
DO LBND=1,NBND
DO J=JSTA,JEND
DO I=1,IM
IF(PSUM(I,J,LBND)==0.)THEN
IF(PSUM(I,J,LBND)==0..AND.PBND(I,J,LBND)<SPVAL)THEN
L = LM
PMIN = 9999999.
PBND(I,J,LBND) = (PBINT(I,J,LBND)+PBINT(I,J,LBND+1))*0.5
Expand All @@ -355,7 +350,6 @@ SUBROUTINE BNDLYR(PBND,TBND,QBND,RHBND,UBND,VBND, &
VBND(I,J,LBND) = VH(I,J,L)
END IF
WBND(I,J,LBND) = WH(I,J,L)
IF(T(I,J,LBND)<spval.and.Q(I,J,LBND)<spval)THEN
QCNVBND(I,J,LBND) = QCNVG(I,J,L)
IF(MODELNAME == 'GFS' .OR. MODELNAME == 'FV3R')THEN
ES = FPVSNEW(T(I,J,L))
Expand All @@ -367,17 +361,11 @@ SUBROUTINE BNDLYR(PBND,TBND,QBND,RHBND,UBND,VBND, &
QSBND(I,J,LBND) = QSAT
OMGBND(I,J,LBND) = OMGA(I,J,L)
PWTBND(I,J,LBND) = (Q(I,J,L)+CWM(I,J,L))*DP*GI
ELSE
QCNVBND(I,J,LBND)= spval
QSBND(I,J,LBND) = spval
OMGBND(I,J,LBND) = spval
PWTBND(I,J,LBND) = spval
ENDIF
ENDIF
!
! RH, BOUNDS CHECK
!
IF(T(I,J,LBND)<spval.and.Q(I,J,LBND)<spval)THEN
IF(QSBND(I,J,LBND)/=0..AND.QBND(I,J,LBND)<SPVAL)THEN
RHBND(I,J,LBND) = QBND(I,J,LBND)/QSBND(I,J,LBND)
IF (RHBND(I,J,LBND)>1.0) THEN
RHBND(I,J,LBND) = 1.0
Expand All @@ -387,10 +375,7 @@ SUBROUTINE BNDLYR(PBND,TBND,QBND,RHBND,UBND,VBND, &
RHBND(I,J,LBND) = 0.01
QBND(I,J,LBND) = RHBND(I,J,LBND)*QSBND(I,J,LBND)
ENDIF
ELSE
RHBND(I,J,LBND) = spval
QBND(I,J,LBND) = spval
ENDIF
ENDIF
ENDDO
ENDDO
!
Expand Down
7 changes: 6 additions & 1 deletion sorc/ncep_post.fd/CALDWP.f
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
!! AMBIENT TEMPERATURE.
!! 98-06-08 T BLACK - CONVERSION FROM 1-D TO 2-D
!! 00-01-04 JIM TUCCILLO - MPI VERSION
!! 21-07-23 Wen Meng - Retrict computation from undefined points
!!
!! USAGE: CALL CALDWP(P1D,Q1D,TDWP,T1D)
!! INPUT ARGUMENT LIST:
Expand Down Expand Up @@ -42,7 +43,7 @@ SUBROUTINE CALDWP(P1D,Q1D,TDWP,T1D)
!
! SET PARAMETERS.
use params_mod, only: eps, oneps, d001, h1m12
use ctlblk_mod, only: jsta, jend, im
use ctlblk_mod, only: jsta, jend, im, spval
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
implicit none
!
Expand All @@ -62,8 +63,12 @@ SUBROUTINE CALDWP(P1D,Q1D,TDWP,T1D)
!$omp parallel do private(i,j)
DO J=JSTA,JEND
DO I=1,IM
IF(P1D(I,j)<spval .and. Q1D(I,J)<spval) THEN
EVP(I,J) = P1D(I,J)*Q1D(I,J)/(EPS+ONEPS*Q1D(I,J))
EVP(I,J) = MAX(H1M12,EVP(I,J)*D001)
ELSE
EVP(I,J) = spval
ENDIF
ENDDO
ENDDO
!
Expand Down
3 changes: 3 additions & 0 deletions sorc/ncep_post.fd/CALLCL.f
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
!! 00-01-04 JIM TUCCILLO - MPI VERSION
!! 02-04-24 MIKE BALDWIN - WRF VERSION
!! 19-10-30 Bo CUI - REMOVE "GOTO" STATEMENT
!! 21-07-28 W Meng - Restriction compuatation from undefined grids
!!
!! USAGE: CALL CALLCL(P1D,T1D,Q1D,PLCL,ZLCL)
!! INPUT ARGUMENT LIST:
Expand Down Expand Up @@ -88,6 +89,7 @@ SUBROUTINE CALLCL(P1D,T1D,Q1D,PLCL,ZLCL)
DO 30 J=JSTA_M,JEND_M
DO 30 I=2,IM-1
! DO 30 I=1,IM
IF(P1D(I,J)<spval.and.Q1D(I,J)<spval)THEN
EVP = P1D(I,J)*Q1D(I,J)/(EPS+ONEPS*Q1D(I,J))
RMX = EPS*EVP/(P1D(I,J)-EVP)
RKAPA = 1.0 / (D2845*(1.0-D28*RMX))
Expand All @@ -107,6 +109,7 @@ SUBROUTINE CALLCL(P1D,T1D,Q1D,PLCL,ZLCL)
EXIT
ENDIF
20 CONTINUE
ENDIF
30 CONTINUE
!
! END OF ROUTINE.
Expand Down
10 changes: 8 additions & 2 deletions sorc/ncep_post.fd/CALMCVG.f
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ SUBROUTINE CALMCVG(Q1D,U1D,V1D,QCNVG)
!$omp parallel do private(i,j)
DO J=JSTA_2L,JEND_2U
DO I=1,IM
IF(U1D(I,J)<SPVAL)THEN
QCNVG(I,J) = 0.
ELSE
QCNVG(I,J) = SPVAL
ENDIF
UWND(I,J) = U1D(I,J)
VWND(I,J) = V1D(I,J)
IF (UWND(I,J) == SPVAL) UWND(I,J) = D00
Expand All @@ -97,7 +101,8 @@ SUBROUTINE CALMCVG(Q1D,U1D,V1D,QCNVG)
DO J=JSTA_M,JEND_M
DO I=2,IM-1
IF(Q1D(I,J+1)<SPVAL.AND.Q1D(I,J-1)<SPVAL.AND. &
Q1D(I+1,J)<SPVAL.AND.Q1D(I-1,J)<SPVAL) THEN
Q1D(I+1,J)<SPVAL.AND.Q1D(I-1,J)<SPVAL.AND. &
Q1D(I,J)<SPVAL) THEN
R2DX = 1./(2.*DX(I,J)) !MEB DX?
R2DY = 1./(2.*DY(I,J)) !MEB DY?
QUDX = (Q1D(I+1,J)*UWND(I+1,J)-Q1D(I-1,J)*UWND(I-1,J))*R2DX
Expand Down Expand Up @@ -141,7 +146,8 @@ SUBROUTINE CALMCVG(Q1D,U1D,V1D,QCNVG)
IEND = IM-1-MOD(J,2)
DO I=2,IEND
IF(QV(I+IHE(J),J)<SPVAL.AND.UWND(I+IHE(J),J)<SPVAL.AND.&
QV(I+IHW(J),J)<SPVAL.AND.UWND(I+IHW(J),J)<SPVAL) THEN
QV(I+IHW(J),J)<SPVAL.AND.UWND(I+IHW(J),J)<SPVAL.AND.&
QV(I,J)<SPVAL.AND.QV(I,J-1)<SPVAL.AND.QV(I,J+1)<SPVAL) THEN
R2DX = 1./(2.*DX(I,J))
R2DY = 1./(2.*DY(I,J))
QUDX = (QV(I+IHE(J),J)*UWND(I+IHE(J),J) &
Expand Down
7 changes: 7 additions & 0 deletions sorc/ncep_post.fd/CALTAU.f
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
!! 02-01-15 MIKE BALDWIN - WRF VERSION, OUTPUT IS ON MASS-POINTS
!! 05-02-23 H CHUANG - COMPUTE STRESS FOR NMM ON WIND POINTS
!! 05-07-07 BINBIN ZHOU - ADD RSM STRESS for A GRID
!! 21-07-26 W Meng - Restrict computation from undefined grids
!! USAGE: CALL CALTAU(TAUX,TAUY)
!! INPUT ARGUMENT LIST:
!! NONE
Expand Down Expand Up @@ -99,6 +100,8 @@ SUBROUTINE CALTAU(TAUX,TAUY)
DO I=1,IM
!
LMHK = NINT(LMH(I,J))
IF(EL(I,J,LMHK-1)<spval.and.Z0(I,J)<spval.and. &
UZ0(I,J)<spval.and.VZ0(I,J)<spval)THEN
!
! COMPUTE THICKNESS OF LAYER AT MASS POINT.
!
Expand Down Expand Up @@ -128,6 +131,10 @@ SUBROUTINE CALTAU(TAUX,TAUY)
ELSQR = EL(I,J,LMHK-1)*EL(I,J,LMHK-1)
TAUX(I,J) = RHO*ELSQR*DELUDZ*DELUDZ
TAUY(I,J) = RHO*ELSQR*DELVDZ*DELVDZ
ELSE
TAUX(I,J) = spval
TAUY(I,J) = spval
ENDIF

!
END DO
Expand Down
5 changes: 4 additions & 1 deletion sorc/ncep_post.fd/CALTHTE.f
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
!! 93-06-18 RUSS TREADON
!! 98-06-16 T BLACK - CONVERSION FROM 1-D TO 2-D
!! 00-01-04 JIM TUCCILLO - MPI VERSION
!! 21-07-28 W Meng - Restrict computation from undefined grids
!!
!! USAGE: CALL CALTHTE(P1D,T1D,Q1D,THTE)
!! INPUT ARGUMENT LIST:
Expand Down Expand Up @@ -40,7 +41,7 @@ SUBROUTINE CALTHTE(P1D,T1D,Q1D,THTE)
!
!
use params_mod, only: d00, eps, oneps, d01, h1m12, p1000, h1
use ctlblk_mod, only: jsta, jend, im
use ctlblk_mod, only: jsta, jend, im, spval
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
implicit none
!
Expand Down Expand Up @@ -77,6 +78,7 @@ SUBROUTINE CALTHTE(P1D,T1D,Q1D,THTE)
!$omp parallel do private(i,j,p,t,q,evp,rmx,ckapa,rkapa,arg,denom,tlcl,plcl,fac,eterm,thetae)
DO J=JSTA,JEND
DO I=1,IM
IF(P1D(I,J)<spval.and.T1D(I,J)<spval.and.Q1D(I,J)<spval)THEN
P = P1D(I,J)
T = T1D(I,J)
Q = Q1D(I,J)
Expand All @@ -92,6 +94,7 @@ SUBROUTINE CALTHTE(P1D,T1D,Q1D,THTE)
ETERM = (D3376/TLCL-D00254)*(RMX*KG2G*(H1+D81*RMX))
THETAE = T*FAC*EXP(ETERM)
THTE(I,J)= THETAE
ENDIF
ENDDO
ENDDO
!
Expand Down
Loading

0 comments on commit a49af05

Please sign in to comment.