Skip to content

Redundant surface variable cleanup#659

Closed
mzhangw wants to merge 9 commits into
NCAR:mainfrom
mzhangw:redund_surface
Closed

Redundant surface variable cleanup#659
mzhangw wants to merge 9 commits into
NCAR:mainfrom
mzhangw:redund_surface

Conversation

@mzhangw
Copy link
Copy Markdown
Contributor

@mzhangw mzhangw commented May 17, 2021

This effort is to address the issue.
Associated PR: NOAA-EMC/ufsatm#317

@mzhangw mzhangw changed the title Redundant surface variable cleanup (WORK IN PROGRESS) Redundant surface variable cleanup May 27, 2021
@mzhangw mzhangw marked this pull request as ready for review May 27, 2021 18:57
Copy link
Copy Markdown
Collaborator

@climbfuji climbfuji left a comment

Choose a reason for hiding this comment

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

This is looking good! A couple of changes (mainly reversing whitespace changes), please. Hopefully all regression tests pass on Hera with both compilers.

Comment thread physics/GFS_surface_composites.F90 Outdated
semis_lnd(i) = semis_rad(i)
qss_lnd(i) = qss(i)
hflx_lnd(i) = hflx(i)
qss_lnd(i) = qss(i)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please revert indentation changes in lines 198 and 199

Comment thread physics/GFS_surface_composites.F90 Outdated
weasd_ice(i) = weasd(i)
tsfc_ice(i) = tisfc(i)
tsurf_ice(i) = tisfc(i)
tsfci(i) = tisfc(i)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Same here, = were aligned previously.

Comment thread physics/GFS_surface_composites.F90 Outdated
zorl(i) = cice(i) * zorli(i) + (one - cice(i)) * zorlo(i)
tsfc(i) = tsfc_ice(i) ! over lake (and ocean when uncoupled)
tsfc(i) = tsfci(i) ! over lake (and ocean when uncoupled)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please remove extra blank line

subroutine GFS_surface_generic_pre_run (im, levs, vfrac, islmsk, isot, ivegsrc, stype, vtype, slope, &
prsik_1, prslk_1, tsfc, phil, con_g, &
sigmaf, soiltyp, vegtype, slopetyp, work3, tsurf, zlvl, &
sigmaf, soiltyp, vegtype, slopetyp, work3, zlvl, &
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This change has been made in a previous PR (#627 I think), you will see the merge conflict when you update your code.

Comment thread physics/sfc_noah_wrfv4_interstitial.F90 Outdated
weasd_save(i) = weasd(i)
snwdph_save(i) = snwdph(i)
tsfc_save(i) = tsfc(i)
!mz tsfc_save(i) = tsfc(i)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please delete instead of commenting out if really not needed (did you check the gsd diag 3d test)?

Comment thread physics/sfc_noah_wrfv4_interstitial.F90 Outdated
weasd(i) = weasd_save(i)
snwdph(i) = snwdph_save(i)
tsfc(i) = tsfc_save(i)
!mz tsfc(i) = tsfc_save(i)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Same here, pease delete instead of commenting out if really not needed.

Copy link
Copy Markdown
Collaborator

@climbfuji climbfuji left a comment

Choose a reason for hiding this comment

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

This looks good to me, thanks for updating the formatting. I will combine this PR with other PRs, so that you don't have to keep updating the PRs from main all the time.

@climbfuji
Copy link
Copy Markdown
Collaborator

@mzhangw I just discovered that the changes in your PR lead to situations where you are passing the SAME variable (i.e. same standard name) to the scheme twice with different local name. That is forbidden, not just by CCPP but also by Fortran standards. See for example sfc_nst and sfc_drv_ruc. I'll fix that in my effort to bring it up to date with the current code and combine it with Xia's changes.

@climbfuji
Copy link
Copy Markdown
Collaborator

I also get those errors from the host model variable definitions:

ERROR: Multiple definitions of standard_name surface_longwave_emissivity_over_ice in type/variable defintions

Will work on it.

@mzhangw
Copy link
Copy Markdown
Contributor Author

mzhangw commented Jul 23, 2021 via email

@climbfuji
Copy link
Copy Markdown
Collaborator

I actually don't understand how this code compiled, ran and verified against the existing baselines. The metadata parser immediately threw errors about duplicate standard names in several ccpp-physics routines. I don't remember adding this check recently, but maybe I did.

@mzhangw
Copy link
Copy Markdown
Contributor Author

mzhangw commented Jul 23, 2021 via email

@climbfuji climbfuji self-requested a review July 27, 2021 20:54
@mzhangw
Copy link
Copy Markdown
Contributor Author

mzhangw commented Jul 28, 2021

Recent code update causes some conflicts with this PR. I need revisit this PR.

@climbfuji
Copy link
Copy Markdown
Collaborator

Thanks, agreed. The code should never have compiled or run. Passing the same variable twice to a subroutine is dangerous and can have bad consequences. This PR is therefore on hold until the issues are resolved. Thanks for working on it, and sorry for not catching the problems in the first review (GitHub diff view isn't any good for this type of changes).

@mzhangw
Copy link
Copy Markdown
Contributor Author

mzhangw commented Jul 29, 2021 via email

@climbfuji
Copy link
Copy Markdown
Collaborator

The PRs did pass all RTs back in May (See my attached log). However, the surface codes have been updated significantly since then. It won't hurt to revisit it with new updates.

Even if they passed, the code was incorrect. You are not allowed to pass the same variable (e.g. same standard name) twice to a Fortran function or subroutine. Fortunately, the CCPP framework now catches these errors.

@climbfuji
Copy link
Copy Markdown
Collaborator

This PR will be replaced with a new one.

@climbfuji climbfuji closed this Aug 5, 2021
@mzhangw mzhangw deleted the redund_surface branch December 15, 2021 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants