Adding variables from Noah, NoahMP and surface layer to history file#399
Adding variables from Noah, NoahMP and surface layer to history file#399weiwangncar merged 11 commits intowrf-model:masterfrom weiwangncar:cmaq
Conversation
phys/module_sf_noahdrv.F
Outdated
| 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.
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
|
|
||
|
|
||
| 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.
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.
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.
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.
Should we capitalize end do here for consistency?
phys/module_sf_noahmplsm.F
Outdated
| 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 |
phys/module_sf_noahmplsm.F
Outdated
| 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 |
phys/module_sf_noahmplsm.F
Outdated
| 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 |
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.
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 |
There was a problem hiding this comment.
I think this could be rewritten using local variables.
phys/module_sf_noahmpdrv.F
Outdated
| 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.
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.
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. |
barlage
left a comment
There was a problem hiding this comment.
@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
| 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 |
phys/module_sf_noahmpdrv.F
Outdated
| 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 |
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) | ||
|
|
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 |
phys/module_sf_noahmpdrv.F
Outdated
| 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 |
phys/module_sf_noahmplsm.F
Outdated
| 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 |
phys/module_sf_noahmpdrv.F
Outdated
| 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.
remove the XY on the left of these three lines, since these are not output, OK to change via max command
| 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.
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, |
…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.