-
Notifications
You must be signed in to change notification settings - Fork 724
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
Conversation
phys/module_sf_noahdrv.F
Outdated
@@ -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 |
There was a problem hiding this comment.
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?
phys/module_sf_noahdrv.F
Outdated
@@ -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 |
There was a problem hiding this comment.
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?
phys/module_sf_noahdrv.F
Outdated
|
||
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)) |
There was a problem hiding this comment.
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?)
phys/module_sf_noahmpdrv.F
Outdated
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 |
There was a problem hiding this comment.
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.
phys/module_surface_driver.F
Outdated
DO i = i_start(ij),i_end(ij) | ||
wspdsfc(i,j) = wspd(i,j) | ||
enddo | ||
enddo |
There was a problem hiding this comment.
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?
phys/module_sf_noahmplsm.F
Outdated
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment not necessary
phys/module_sf_noahmplsm.F
Outdated
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment not necessary
phys/module_sf_noahmplsm.F
Outdated
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment not necessary
phys/module_sf_noahmpdrv.F
Outdated
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 | ||
|
There was a problem hiding this comment.
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?
phys/module_sf_noahmpdrv.F
Outdated
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 |
There was a problem hiding this comment.
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.
phys/module_sf_noahmpdrv.F
Outdated
@@ -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 |
There was a problem hiding this comment.
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
phys/module_sf_noahmplsm.F
Outdated
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) |
There was a problem hiding this comment.
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
Code changed according to Mike's suggestions. |
@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? |
@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. |
There was a problem hiding this 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
phys/module_sf_noahmpdrv.F
Outdated
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove comment
phys/module_sf_noahmpdrv.F
Outdated
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove three comments
phys/module_sf_noahmpdrv.F
Outdated
REAL :: RBXY ! leaf boundary layer resistance (s/m) | ||
REAL :: LAISUNXY ! sunlit leaf area index (m2/m2) | ||
REAL :: LAISHAXY ! shaded leaf area index (m2/m2) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove these four lines
phys/module_sf_noahmpdrv.F
Outdated
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove these comments
phys/module_sf_noahmpdrv.F
Outdated
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove comment
phys/module_sf_noahmplsm.F
Outdated
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove comments
phys/module_sf_noahmpdrv.F
Outdated
@@ -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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove comments
phys/module_sf_noahmpdrv.F
Outdated
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 |
There was a problem hiding this comment.
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
@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. |
@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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approved (Jimy)
…history, and use WSPD instead of WSPDSFC
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. |
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
#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
TYPE: enhancement (no impact)
KEYWORDS: canopy resistance, LAI, wind speed, mosaic variables
SOURCE: Patrick Campbell, EPA, internal
DESCRIPTION OF CHANGES:
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.