Skip to content

Commit

Permalink
Add calculation for accumulated physics tendencies for theta, qv, u a…
Browse files Browse the repository at this point in the history
…nd v (#1583)

TYPE: enhancement

KEYWORDS: accumulated physics tendencies, diagnostics only

SOURCE: internal

DESCRIPTION OF CHANGES:
Problem:
WRF model can output physics tendencies at any output times, but they are instantaneous values.

Solution:
Add calculation to accumulate physics tendencies in any history output window for theta, qv, u and v fields. In all, 16 
new arrays are added for cumulus, microphysics, shallow cumulus, PBL and radiation. The calculation can be turned 
on by namelist switch acc_phy_tend = 1 in &physics.

LIST OF MODIFIED FILES: 
M       Registry/Registry.EM_COMMON
M       phys/module_diagnostics_driver.F
M       phys/module_diag_misc.F

TESTS CONDUCTED: 
1. Tests are conducted, and accumulated tendency output is checked.
2. Jenkins tests are all passing.

RELEASE NOTE: Sixteen accumulated physics tendencies fields for potential temperature, water vapor mixing ratio, u and v components of the wind are added, and it can be turned on by namelist option acc_phy_tend = 1 in &physics.
  • Loading branch information
weiwangncar authored Dec 16, 2021
1 parent 23c5db5 commit 22662e5
Showing 3 changed files with 166 additions and 1 deletion.
22 changes: 21 additions & 1 deletion Registry/Registry.EM_COMMON
Original file line number Diff line number Diff line change
@@ -2124,6 +2124,24 @@ state real brtemp ij dyn_em 1 - i01h "brtem
state real cldmask ij dyn_em 1 - i01h "cldmask" "Cloud mask" "-"
state real cldtopz ij dyn_em 1 - i01h "cldtopz" "Cloud top height above sea level" "m asl"
state real cldbasez ij dyn_em 1 - i01h "cldbasez" "Cloud base height above ground level" "m agl"

# Accumulated physics tendencies
state real ATHMPTEN ikj misc 1 - h "ATHMPTEN" "ACCUMULATED THETA TENDENCY DUE TO MICROPHY SCHEME" "K "
state real AQVMPTEN ikj misc 1 - h "AQVMPTEN" "ACCUMULATED Q_V TENDENCY DUE TO MICROPHY SCHEME" "kg kg-1 "
state real ATHCUTEN ikj misc 1 - h "ATHCUTEN" "ACCUMULATED THETA TENDENCY DUE TO CUMULUS SCHEME" "K "
state real AQVCUTEN ikj misc 1 - h "AQVCUTEN" "ACCUMULATED Q_V TENDENCY DUE TO CUMULUS SCHEME" "kg kg-1 "
state real AUCUTEN ikj misc 1 - h "AUCUTEN" "ACCUMULATED X WIND TENDENCY DUE TO CUMULUS SCHEME" "m s-1 "
state real AVCUTEN ikj misc 1 - h "AVCUTEN" "ACCUMULATED Y WIND TENDENCY DUE TO CUMULUS SCHEME" "m s-1 "
state real ATHSHTEN ikj misc 1 - h "ATHSHTEN" "ACCUMULATED THETA TENDENCY DUE TO SHALLOW SCHEME" "K "
state real AQVSHTEN ikj misc 1 - h "AQVSHTEN" "ACCUMULATED Q_V TENDENCY DUE TO SHALLOW SCHEME" "kg kg-1 "
state real AUSHTEN ikj misc 1 - h "AUSHTEN" "ACCUMULATED X WIND TENDENCY DUE TO SHALLOW SCHEME" "m s-1 "
state real AVSHTEN ikj misc 1 - h "AVSHTEN" "ACCUMULATED Y WIND TENDENCY DUE TO SHALLOW SCHEME" "m s-1 "
state real ATHBLTEN ikj misc 1 - h "ATHBLTEN" "ACCUMULATED THETA TENDENCY DUE TO PBL SCHEME" "K "
state real AQVBLTEN ikj misc 1 - h "AQVBLTEN" "ACCUMULATED Q_V TENDENCY DUE TO PBL SCHEME" "kg kg-1 "
state real AUBLTEN ikj misc 1 - h "AUBLTEN" "ACCUMULATED X WIND TENDENCY DUE TO PBL SCHEME" "m s-1 "
state real AVBLTEN ikj misc 1 - h "AVBLTEN" "ACCUMULATED Y WIND TENDENCY DUE TO PBL SCHEME" "m s-1 "
state real ATHRATENLW ikj misc 1 - h "ATHRATENLW" "ACCUMULATED THETA TENDENCY DUE TO LW RADIATION SCHEME" "K "
state real ATHRATENSW ikj misc 1 - h "ATHRATENSW" "ACCUMULATED THETA TENDENCY DUE TO SW RADIATION SCHEME" "K "
#
#---------------------------------------------------------------------------------------------------------------------------------------
#
@@ -2611,6 +2629,7 @@ rconfig integer morr_rimed_ice namelist,physics 1 1

rconfig integer clean_atm_diag namelist,physics 1 0 rh "clean_atm_diag" "option to switch on clean sky diagnostics (for chem)" "flag"
rconfig integer calc_clean_atm_diag derived 1 0 - "calc_clean_atm_diag" "carries decision on using clean sky diagnostics" "flag"
rconfig integer acc_phy_tend namelist,physics max_domains 0 rh "acc_phy_tend" "option to output accumulated physics tendencies" "flag"

# MAD-WRF
rconfig integer madwrf_opt namelist,physics 1 0 rh "madwrf_opt" "MAD-WRF model" "0: off, 1: Advect/diffuse hydromets, 2: Nudge advected/diffused hydrometes to model state"
@@ -3319,7 +3338,8 @@ package seabreeze2d_x ideal_case==8 - -
package les ideal_case==9 - -
# WRF-Chem specific diagnostics
package clnatmdiag calc_clean_atm_diag==1 - state:SWUPTCLN,SWDNTCLN,SWUPBCLN,SWDNBCLN,LWUPTCLN,LWDNTCLN,LWUPBCLN,LWDNBCLN

#
package acc_phys_tend acc_phy_tend==1 - state:ATHMPTEN,AQVMPTEN,ATHCUTEN,AQVCUTEN,AUCUTEN,AVCUTEN,ATHSHTEN,AQVSHTEN,AUSHTEN,AVSHTEN,ATHBLTEN,AQVBLTEN,AUBLTEN,AVBLTEN,ATHRATENLW,ATHRATENSW

#---------------------------------------------------------------------------------------------------------------------------------------
## communications
126 changes: 126 additions & 0 deletions phys/module_diag_misc.F
Original file line number Diff line number Diff line change
@@ -28,13 +28,24 @@ SUBROUTINE diagnostic_output_calc( &
,I_ACSWUPB,I_ACSWUPBC,I_ACSWDNB,I_ACSWDNBC & ! Optional
,I_ACLWUPT,I_ACLWUPTC,I_ACLWDNT,I_ACLWDNTC & ! Optional
,I_ACLWUPB,I_ACLWUPBC,I_ACLWDNB,I_ACLWDNBC & ! Optional
,athmp, aqvmp &
,athcu, aqvcu, aucu, avcu &
,athsh, aqvsh, aush, avsh &
,athbl, aqvbl, aubl, avbl &
,athralw, athrasw &
,h_diabatic, qv_diabatic &
,rthcuten, rqvcuten, rucuten, rvcuten &
,rthshten, rqvshten, rushten, rvshten &
,rthblten, rqvblten, rublten, rvblten &
,rthratenlw, rthratensw &
,dt,xtime &
,diag_print &
,bucket_mm, bucket_J &
,prec_acc_c, prec_acc_nc, snow_acc_nc &
,snowncv, prec_acc_dt, curr_secs2 &
,history_interval &
,itimestep &
,cu_used, shcu_used, acc_phy_tend &
)
!----------------------------------------------------------------------

@@ -47,6 +58,38 @@ SUBROUTINE diagnostic_output_calc( &
!-- DIAG_PRINT print control: 0 - no diagnostics; 1 - dmudt only; 2 - all
!-- DT time step (second)
!-- XTIME forecast time
!-- ACSWUPT
!-- ACSWUPTC
!-- ACSWDNT
!-- ACSWDNTC
!-- ACSWUPB
!-- ACSWUPBC
!-- ACSWDNB
!-- ACSWDNBC
!-- ACLWUPT
!-- ACLWUPTC
!-- ACLWDNT
!-- ACLWDNTC
!-- ACLWUPB
!-- ACLWUPBC
!-- ACLWDNB
!-- ACLWDNBC
!-- ATHMPTEN Accumulated theta tendency from microphysics
!-- AQVMPTEN Accumulated qv tendency from microphysics
!-- ATHCUTEN Accumulated theta tendency from cumulus physics
!-- AQVCUTEN Accumulated qv tendency from cumulus physics
!-- AUCUTEN Accumulated u-wind tendency from cumulus physics
!-- AVCUTEN Accumulated v-wind tendency from cumulus physics
!-- ATHSHTEN Accumulated theta tendency from shallow cumulus
!-- AQVSHTEN Accumulated qv tendency from shallow cumulus
!-- AUSHTEN Accumulated u-wind tendency from shallow cumulus
!-- AVSHTEN Accumulated v-wind tendency from shallow cumulus
!-- ATHBLTEN Accumulated theta tendency from pbl physics
!-- AQVBLTEN Accumulated qv tendency from pbl physics
!-- AUBLTEN Accumulated u-wind tendency from pbl physics
!-- AVBLTEN Accumulated v-wind tendency from pbl physics
!-- ATHRATENLW Accumulated theta tendency from longwave radiation
!-- ATHRATENSW Accumulated theta tendency from shortwave radiation
!-- P8W 3D pressure array at full eta levels
!-- MU dry column hydrostatic pressure
!-- RAINC cumulus scheme precipitation since hour 0
@@ -124,6 +167,21 @@ SUBROUTINE diagnostic_output_calc( &
, PK1M

REAL, INTENT(IN ) :: DT, XTIME
INTEGER, INTENT(IN ) :: cu_used, shcu_used, acc_phy_tend
REAL, DIMENSION( ims:ime, kms:kme, jms:jme ), INTENT(INOUT) ::&
athmp,aqvmp &
,athcu,aqvcu,aucu,avcu &
,athsh,aqvsh,aush,avsh &
,athbl,aqvbl,aubl,avbl &
,athralw,athrasw

REAL, DIMENSION( ims:ime, kms:kme, jms:jme ), INTENT(IN) :: &
h_diabatic,qv_diabatic &
,rthcuten,rqvcuten,rucuten,rvcuten &
,rthshten,rqvshten,rushten,rvshten &
,rthblten,rqvblten,rublten,rvblten &
,rthratenlw,rthratensw

INTEGER, DIMENSION( ims:ime , jms:jme ), INTENT(INOUT) :: &
I_RAINC, &
I_RAINNC
@@ -159,6 +217,74 @@ SUBROUTINE diagnostic_output_calc( &

INTEGER :: idump

!-----------------------------------------------------------------
! Compute physics tendency accumulations in a given time window

IF ( acc_phy_tend .gt. 0 ) THEN

! !$OMP PARALLEL DO &
! !$OMP PRIVATE ( ij )
DO ij = 1 , num_tiles

IF (mod(curr_secs2, history_interval*60.) == 0.) THEN
WRITE(outstring,*) 'Reseting accumulation to 0'
CALL wrf_debug ( 10, TRIM(outstring) )
DO j=j_start(ij),j_end(ij)
DO k=kps,kpe
DO i=i_start(ij),i_end(ij)
athmp(i,k,j) = 0.
aqvmp(i,k,j) = 0.
IF ( cu_used == 1 ) THEN
athcu(i,k,j) = 0.
aqvcu(i,k,j) = 0.
aucu(i,k,j) = 0.
avcu(i,k,j) = 0.
END IF
IF ( shcu_used == 1 ) THEN
athsh(i,k,j) = 0.
aqvsh(i,k,j) = 0.
aush(i,k,j) = 0.
avsh(i,k,j) = 0.
END IF
athbl(i,k,j) = 0.
aqvbl(i,k,j) = 0.
aubl(i,k,j) = 0.
avbl(i,k,j) = 0.
athralw(i,k,j) = 0.
athrasw(i,k,j) = 0.
ENDDO
ENDDO
ENDDO
ENDIF
DO j=j_start(ij),j_end(ij)
DO k=kps,kpe
DO i=i_start(ij),i_end(ij)
athmp(i,k,j) = athmp(i,k,j) + h_diabatic(i,k,j)*dt
aqvmp(i,k,j) = aqvmp(i,k,j) + qv_diabatic(i,k,j)*dt
IF ( cu_used == 1 ) THEN
athcu(i,k,j) = athcu(i,k,j) + rthcuten(i,k,j)*dt
aqvcu(i,k,j) = aqvcu(i,k,j) + rqvcuten(i,k,j)*dt
aucu(i,k,j) = aucu(i,k,j) + rucuten(i,k,j)*dt
avcu(i,k,j) = avcu(i,k,j) + rvcuten(i,k,j)*dt
END IF
IF ( shcu_used == 1 ) THEN
athsh(i,k,j) = athsh(i,k,j) + rthshten(i,k,j)*dt
aqvsh(i,k,j) = aqvsh(i,k,j) + rqvshten(i,k,j)*dt
aush(i,k,j) = aush(i,k,j) + rushten(i,k,j)*dt
avsh(i,k,j) = avsh(i,k,j) + rvshten(i,k,j)*dt
END IF
athbl(i,k,j) = athbl(i,k,j) + rthblten(i,k,j)*dt
aqvbl(i,k,j) = aqvbl(i,k,j) + rqvblten(i,k,j)*dt
aubl(i,k,j) = aubl(i,k,j) + rublten(i,k,j)*dt
avbl(i,k,j) = avbl(i,k,j) + rvblten(i,k,j)*dt
athralw(i,k,j) = athralw(i,k,j) + rthratenlw(i,k,j)*dt
athrasw(i,k,j) = athrasw(i,k,j) + rthratensw(i,k,j)*dt
ENDDO
ENDDO
ENDDO
ENDDO
ENDIF

!-----------------------------------------------------------------
! Handle accumulations with buckets to prevent round-off truncation in long runs
! This is done every 360 minutes assuming time step fits exactly into 360 minutes
19 changes: 19 additions & 0 deletions phys/module_diagnostics_driver.F
Original file line number Diff line number Diff line change
@@ -365,6 +365,22 @@ SUBROUTINE diagnostics_driver ( grid, config_flags, &
,I_ACLWDNT=grid%i_aclwdnt ,I_ACLWDNTC=grid%i_aclwdntc &
,I_ACLWUPB=grid%i_aclwupb ,I_ACLWUPBC=grid%i_aclwupbc &
,I_ACLWDNB=grid%i_aclwdnb ,I_ACLWDNBC=grid%i_aclwdnbc &
,athmp=grid%athmpten ,aqvmp=grid%aqvmpten &
,athcu=grid%athcuten ,aqvcu=grid%aqvcuten &
,aucu=grid%aucuten ,avcu=grid%avcuten &
,athsh=grid%athshten ,aqvsh=grid%aqvshten &
,aush=grid%aushten ,avsh=grid%avshten &
,athbl=grid%athblten ,aqvbl=grid%aqvblten &
,aubl=grid%aublten ,avbl=grid%avblten &
,athralw=grid%athratenlw ,athrasw=grid%athratensw &
,h_diabatic=grid%h_diabatic ,qv_diabatic=grid%qv_diabatic &
,rthcuten=grid%rthcuten ,rqvcuten=grid%rqvcuten &
,rucuten=grid%rucuten ,rvcuten=grid%rvcuten &
,rthshten=grid%rthshten ,rqvshten=grid%rqvshten &
,rushten=grid%rushten ,rvshten=grid%rvshten &
,rthblten=grid%rthblten ,rqvblten=grid%rqvblten &
,rublten=grid%rublten ,rvblten=grid%rvblten &
,rthratenlw=grid%rthratenlw ,rthratensw=grid%rthratensw &
! Selection flag
,DIAG_PRINT=config_flags%diag_print &
,BUCKET_MM=config_flags%bucket_mm &
@@ -376,6 +392,9 @@ SUBROUTINE diagnostics_driver ( grid, config_flags, &
,CURR_SECS2=curr_secs2 &
,HISTORY_INTERVAL=grid%history_interval &
,ITIMESTEP=grid%itimestep &
,cu_used=grid%cu_used &
,shcu_used=grid%shcu_used &
,acc_phy_tend=grid%acc_phy_tend &
! Dimension arguments
,IDS=ids,IDE=ide, JDS=jds,JDE=jde, KDS=kds,KDE=kde &
,IMS=ims,IME=ime, JMS=jms,JME=jme, KMS=kms,KME=kme &

0 comments on commit 22662e5

Please sign in to comment.