Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding variables from Noah, NoahMP and surface layer to history file #399

Merged
merged 11 commits into from
Mar 20, 2018
Merged

Adding variables from Noah, NoahMP and surface layer to history file #399

merged 11 commits into from
Mar 20, 2018

Conversation

weiwangncar
Copy link
Collaborator

@weiwangncar weiwangncar commented Mar 7, 2018

TYPE: enhancement (no impact)

KEYWORDS: canopy resistance, LAI, wind speed, mosaic variables

SOURCE: Patrick Campbell, EPA, internal

DESCRIPTION OF CHANGES:

  1. Passing Noah’s canopy resistance (RC2) and LAI (XLAIDYN: “dynamic LAI”) from Noah for both the dominant land use and mosaic tiling option to the grid.
  2. Passing the lowest model layer WSPD variable from the surface driver to the grid now as a state variable, which could then be used (with already present USTAR) in calculating a simple and physically consistent aerodynamic resistance parameterization (RA = WSPD/USTAR^2) used in deposition calculations for coupled air quality models (e.g., WRF-CMAQ in our applications).
  3. Passing a newly calculated canopy conductance (inverse of canopy resistance, RC: uses sunlit and shaded stomatal resistances based on Bonan et al., 2011) in Noah-MP and passing out to the grid (also as RS for WRF-CMAQ consistency) to similarly extend the Noah-MP potential (as in Noah and Noah-Mosaic in 1 and 2) for physically consistent atmospheric deposition and air quality applications.
  4. Adding LAI_mosaic and RS_mosaic to collect mosaic values.
  5. Adding sf_surface_mosaic to global attribute in history file.

LIST OF MODIFIED FILES: list of changed files:
M Registry/Registry.EM_COMMON
M Registry/Registry.NMM
M dyn_em/module_first_rk_step_part1.F
M dyn_em/module_first_rk_step_part2.F
M dyn_em/solve_em.F
M phys/module_sf_noahdrv.F
M phys/module_sf_noahmpdrv.F
M phys/module_sf_noahmplsm.F
M phys/module_surface_driver.F
M share/output_wrf.F

TESTS CONDUCTED:
Before and after tests gave identical results using Jan 2000 data.
reg test mostly successful. Will run one more time when Cheyenne returns.

@@ -358,6 +362,8 @@ SUBROUTINE lsm(DZ8W,QV3D,P8W3D,T3D,TSK, &

LOGICAL, INTENT(IN ) :: myj,frpcpn

REAL, INTENT(OUT) :: RC2(ims:ime,jms:jme) !Two-way WRF-CMAQ
REAL, INTENT(OUT) :: XLAI2(ims:ime,jms:jme) !Two-way WRF-CMAQ
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency with other variable declarations, should we change these to

REAL, DIMENSION(ims:ime,jms:jme), INTENT(OUT) :: RC2                 ! Two-way WRF-CMAQ
REAL, DIMENSION(ims:ime,jms:jme), INTENT(OUT) :: XLAI2              ! Two-way WRF-CMAQ

? Essentially, to use the DIMENSION attribute?

@@ -2534,6 +2544,9 @@ SUBROUTINE lsm_mosaic(DZ8W,QV3D,P8W3D,T3D,TSK, &

LOGICAL, INTENT(IN ) :: myj,frpcpn


REAL, INTENT(OUT) :: RC2(ims:ime,jms:jme) !Two-way WRF-CMAQ
REAL, INTENT(OUT) :: XLAI2(ims:ime,jms:jme) !Two-way WRF-CMAQ
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the DIMENSION attribute here, too?


XLAI2(i,j)= LAI_mosaic_avg(i,j)
if(RC_mosaic_avg(i,j) .Gt. 0.0) Then
rc2(i,j) = 1.0/(RC_mosaic_avg(i,j))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use indentation here? (Also, why capitalize Then on the previous line?)

RS (I,J) = 1.0/RS(I,J) !Resistance
if(RSSUNXY (I,J) .le. 0.0.and.RSSHAXY(I,J).le.0.0) Then
RS (I,J) = 0.0
endif
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out-denting seems odd here. Could this logic for RS be changed to if-else-endif with indentation? Also, we could clean up the inconsistent whitespace in the if-test.

DO i = i_start(ij),i_end(ij)
wspdsfc(i,j) = wspd(i,j)
enddo
enddo
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we capitalize end do here for consistency?

@@ -1446,7 +1449,7 @@ SUBROUTINE ENERGY (parameters,ICE ,VEGTYP ,IST ,NSNOW ,NSOIL , & !in
TV ,TG ,STC ,SNOWH ,EAH ,TAH , & !inout
SNEQVO ,SNEQV ,SH2O ,SMC ,SNICE ,SNLIQ , & !inout
ALBOLD ,CM ,CH ,DX ,DZ8W ,Q2 , & !inout
TAUSS , & !inout
TAUSS ,LAISUN ,LAISHA ,RB , & !inout !LAISUN,LAISHA,RB Used in RS calc WRF-CMAQ PCC
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment not necessary

@@ -708,7 +711,7 @@ SUBROUTINE NOAHMP_SFLX (parameters, &
TV ,TG ,STC ,SNOWH ,EAH ,TAH , & !inout
SNEQVO ,SNEQV ,SH2O ,SMC ,SNICE ,SNLIQ , & !inout
ALBOLD ,CM ,CH ,DX ,DZ8W ,Q2 , & !inout
TAUSS , & !inout
TAUSS ,LAISUN ,LAISHA ,RB , & !inout !LAISUN,LAISHA,RB Used in RS calc WRF-CMAQ PCC
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment not necessary

@@ -363,7 +363,7 @@ SUBROUTINE NOAHMP_SFLX (parameters, &
SHG , SHC , SHB , EVG , EVB , GHV , & ! OUT :
GHB , IRG , IRC , IRB , TR , EVC , & ! OUT :
CHLEAF , CHUC , CHV2 , CHB2 , FPICE , PAHV , &
PAHG , PAHB , PAH &
PAHG , PAHB , PAH , LAISUN , LAISHA , RB & !OUT ! LAISUN, LAISHA, and RB Used for RS in WRF-CMAQ - PCC
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment not necessary

REAL, DIMENSION( ims:ime, jms:jme) :: RBXY ! leaf boundary layer resistance (s/m) !Used in RS for WRF-CMAQ PCC
REAL, DIMENSION( ims:ime, jms:jme) :: LAISUNXY ! sunlit leaf area index (m2/m2) !Used in RS for WRF-CMAQ PCC
REAL, DIMENSION( ims:ime, jms:jme) :: LAISHAXY ! shaded leaf area index (m2/m2) !Used in RS for WRF-CMAQ PCC

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these 2D variables necessary?

RS (I,J) = ((1.0/(RSSUNXY(I,J)+RBXY(I,J)))*LAISUNXY(I,J)) + ((1.0/(RSSHAXY(I,J)+RBXY(I,J)))*LAISHAXY(I,J))
RS (I,J) = 1.0/RS(I,J) !Resistance
IF(RSSUNXY (I,J) .le. 0.0.and.RSSHAXY(I,J).le.0.0) THEN
RS (I,J) = 0.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could be rewritten using local variables.

@@ -37,7 +37,7 @@ SUBROUTINE noahmplsm(ITIMESTEP, YR, JULIAN, COSZIN,XLAT,XLONG, & ! IN
BGAPXY, WGAPXY, TGVXY, TGBXY, CHVXY, CHBXY, & ! OUT Noah MP only
SHGXY, SHCXY, SHBXY, EVGXY, EVBXY, GHVXY, & ! OUT Noah MP only
GHBXY, IRGXY, IRCXY, IRBXY, TRXY, EVCXY, & ! OUT Noah MP only
CHLEAFXY, CHUCXY, CHV2XY, CHB2XY, & ! OUT Noah MP only
CHLEAFXY, CHUCXY, CHV2XY, CHB2XY, RS, & ! OUT Noah MP only !RS for WRF-CMAQ PCC
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these types of comments are unnecessarily specific

REAL :: LAISUN !sunlit leaf area index (m2/m2)
REAL :: LAISHA !shaded leaf area index (m2/m2)
! REAL :: LAISUN !sunlit leaf area index (m2/m2)
! REAL :: LAISHA !shaded leaf area index (m2/m2)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these three commented lines can be removed

@weiwangncar
Copy link
Collaborator Author

Code changed according to Mike's suggestions.
Mike, Do you want all CMAQ references removed from the code? There are still many.

@mgduda
Copy link
Collaborator

mgduda commented Mar 8, 2018

@weiwangncar @barlage I'm not sure whether there are general guidelines on this, but it looks like this PR will add about a dozen new variables to the default history files. Unless these fields are likely to be of interest to the general WRF user, should we consider not adding them by default, since they can be easily added with the run-time I/O capability by those who are interested?

@barlage
Copy link
Contributor

barlage commented Mar 8, 2018

@weiwangncar I only looked at the Noah-MP related code. Personally, I suggest removing all of these types of comments in mplsm and mpdrv: "!Used in WRF-CMAQ PCC" The variables are much more general than this.

Copy link
Contributor

@barlage barlage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@weiwangncar I only looked at the Noah-MP changes, but these comments seem overly specific, they are not only "used in rs for wrf-cmaq"

I've commented on the other comments to remove and rewrote the if block for clarity after removing the new variables

@@ -165,7 +165,7 @@ SUBROUTINE noahmplsm(ITIMESTEP, YR, JULIAN, COSZIN,XLAT,XLONG, & ! IN
REAL, DIMENSION( ims:ime, jms:jme ), INTENT(INOUT) :: QSFC ! bulk surface specific humidity
REAL, DIMENSION( ims:ime, jms:jme ), INTENT(INOUT) :: Z0 ! combined z0 sent to coupled model
REAL, DIMENSION( ims:ime, jms:jme ), INTENT(INOUT) :: ZNT ! combined z0 sent to coupled model

REAL, DIMENSION( ims:ime, jms:jme ), INTENT(INOUT) :: RS ! Total stomatal resistance (s/m) !Used in WRF-CMAQ PCC
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comment

@@ -362,6 +362,9 @@ SUBROUTINE noahmplsm(ITIMESTEP, YR, JULIAN, COSZIN,XLAT,XLONG, & ! IN
REAL :: SAG ! solar rad absorbed by ground (w/m2)
REAL :: RSSUN ! sunlit leaf stomatal resistance (s/m)
REAL :: RSSHA ! shaded leaf stomatal resistance (s/m)
REAL :: RB ! leaf boundary layer resistance (s/m) !Used in RS for WRF-CMAQ PCC
REAL :: LAISUN ! sunlit leaf area index (m2/m2) !Used in RS for WRF-CMAQ PCC
REAL :: LAISHA ! shaded leaf area index (m2/m2) !Used in RS for WRF-CMAQ PCC
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove three comments

REAL :: RBXY ! leaf boundary layer resistance (s/m)
REAL :: LAISUNXY ! sunlit leaf area index (m2/m2)
REAL :: LAISHAXY ! shaded leaf area index (m2/m2)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove these four lines

RB = undefined_value !For RS in WRF-CMAQ PCC
LAISUN = undefined_value !For RS in WRF-CMAQ PCC
LAISHA = undefined_value !For RS in WRF-CMAQ PCC
RS(I,J)= undefined_value !For RS in WRF-CMAQ PCC
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove these comments

@@ -798,7 +809,7 @@ SUBROUTINE noahmplsm(ITIMESTEP, YR, JULIAN, COSZIN,XLAT,XLONG, & ! IN
SHG , SHC , SHB , EVG , EVB , GHV , & ! OUT :
GHB , IRG , IRC , IRB , TR , EVC , & ! OUT :
CHLEAF , CHUC , CHV2 , CHB2 , FPICE , PAHV , &
PAHG , PAHB , PAH &
PAHG , PAHB , PAH , LAISUN , LAISHA ,RB & ! LAISUN, LAISHA, and RB Used for RS in WRF-CMAQ - PCC
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comment

@@ -486,6 +486,9 @@ SUBROUTINE NOAHMP_SFLX (parameters, &
REAL , INTENT(OUT) :: PONDING!surface ponding [mm]
REAL , INTENT(OUT) :: PONDING1!surface ponding [mm]
REAL , INTENT(OUT) :: PONDING2!surface ponding [mm]
REAL , INTENT(OUT) :: RB ! leaf boundary layer resistance (s/m) !Used in WRF-CMAQ PCC
REAL , INTENT(OUT) :: LAISUN ! sunlit leaf area index (m2/m2) !Used in WRF-CMAQ PCC
REAL , INTENT(OUT) :: LAISHA ! shaded leaf area index (m2/m2) !Used in WRF-CMAQ PCC
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comments

@@ -898,6 +909,17 @@ SUBROUTINE noahmplsm(ITIMESTEP, YR, JULIAN, COSZIN,XLAT,XLONG, & ! IN
SAGXY (I,J) = SAG
RSSUNXY (I,J) = RSSUN
RSSHAXY (I,J) = RSSHA
LAISUNXY = MAX(LAISUN, 0.0) !New variables needed for RS
LAISHAXY = MAX(LAISHA, 0.0) !New variables needed for RS
RBXY = MAX(RB, 0.0) !New variables needed for RS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the XY on the left of these three lines, since these are not output, OK to change via max command

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comments

ELSE
RS (I,J) = ((1.0/(RSSUNXY(I,J)+RBXY)*LAISUNXY) + ((1.0/(RSSHAXY(I,J)+RBXY))*LAISHAXY))
RS (I,J) = 1.0/RS(I,J) !Resistance
ENDIF
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems easier to understand and probably more efficient if:
change rssunxy(i,j) to rssun
change rsshaxy(i,j) to rssha
change rbxy, laisunxy, laishaxy to rb, laisun, laisha

@weiwangncar
Copy link
Collaborator Author

@mgduda It is also my suggestion to the code contributors. But they plead to have them in. Here is part of their reply: "I understand the desire to reduce output in the files, however, many of these changes were driven by some new CMAQ developments that would benefit the community (not just our applications) strongly from having the new small list of variables we have added to be output by default history. In fact, we are going forward making changes to the meteorological preprocessor code (MCIP) for CMAQ with the assumption that these variables may be included as history output now by default. Its not a showstopper for the small changes in #1-3, but just more streamlined for future WRF/Noah-CMAQ applications I suppose." I mentioned the the committee will decide.

@mgduda
Copy link
Collaborator

mgduda commented Mar 8, 2018

@weiwangncar @davegill Is it possible to use "packages" in WRF only to control which fields are written? For example, is there any mechanism that would allow adding a new namelist record, say, &history_fields with a new namelist option like cmaq_fields, which would activate the writing of these new fields? In general, can a package be used only for output control, and not for field allocation?

Copy link
Collaborator

@kkeene44 kkeene44 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved (Jimy)

@weiwangncar
Copy link
Collaborator Author

This PR is updated to remove all additional variables from history file. The contributor has agreed to use run-time option to add additional fields for CMAQ applications. Making existing i1 variable WSPD to a state variable, and replace the original added variable WSPDSFC. To help with CMAQ application, and to make global attribute more complete, sf_surface_mosaic is added.

@weiwangncar weiwangncar merged commit f80778c into wrf-model:master Mar 20, 2018
barlage pushed a commit to barlage/WRF that referenced this pull request Sep 25, 2018
davegill added a commit to davegill/WRF that referenced this pull request Oct 1, 2018
KEYWORDS: Noah-MP

SOURCE: Michael Barlage (NCAR)

DESCRIPTION OF CHANGES:

Bug fix introduced in wrf-model#399 where divide by zero can occur if LAI is zero. Added check in IF statement. This calculation is only for diagnostics so shouldn't change answers, except to prevent model crash.

LIST OF MODIFIED FILES:

M phys/module_sf_noahmpdrv.F

TESTS CONDUCTED:

Summer and winter 24-hr case
davegill added a commit that referenced this pull request Oct 2, 2018
#646)

TYPE: bug fix

KEYWORDS: Noah-MP

SOURCE: Michael Barlage (NCAR)

DESCRIPTION OF CHANGES:

Bug fix introduced in #399 where divide by zero can occur if LAI is zero. Added check in IF statement. This calculation is only for diagnostics so shouldn't change answers, except to prevent model crash.

Mods to release-v4.0.1, not develop. Replaces PR #633 

LIST OF MODIFIED FILES:

M phys/module_sf_noahmpdrv.F

TESTS CONDUCTED:

Summer and winter 24-hr case
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants