Skip to content

Tendency application update#299

Open
grantfirl wants to merge 61 commits intoufs-community:ufs/devfrom
grantfirl:feature/tendency_cleanup
Open

Tendency application update#299
grantfirl wants to merge 61 commits intoufs-community:ufs/devfrom
grantfirl:feature/tendency_cleanup

Conversation

@grantfirl
Copy link
Collaborator

@grantfirl grantfirl commented Jul 14, 2025

Description of Changes:

See https://docs.google.com/presentation/d/1LJbCrCVGYDvm0UPo8SR4KP6fT1VFocg-xLG399qGQ1w/edit?slide=id.g371ddcb3c06_0_238#slide=id.g371ddcb3c06_0_238 for a complete description.

Main points:

  • Converts all primary schemes to return tendencies rather than modify the physics state
  • Adds code to interstitial schemes to apply tendencies based on control from the host
  • Other minor changes (including lots of metadata changes) to implement the above
  • Obsolete schemes removed:
    • GFS_MP_generic_pre.F90
    • GFS_DCNV_generic_pre.F90
    • GFS_SCNV_generic_pre.F90
    • GFS_suite_stateout_reset.F90
    • GFS_suite_stateout_update.F90
    • mp_tempo_pre.F90
    • mp_thompson_pre.F90
  • New schemes:
    • GFS_photochemistry_post.F90 (because there was no generic interstitial scheme for this to apply tendencies)
    • mynnedmf_wrapper_post.F90 (because it doesn't use GFS_PBL_generic_post.F90)

Tests Conducted:

See the linked slides. This was tested in the following ways:

  • standard UFS regression tests (should change baseline results for most/all tests that actually run physics, although changes SHOULD be similar to a compiler change; scientific results should NOT change)
  • SCM tests comparing selected suites before/after differences to compiler/debug mode differences
  • UFS tests comparing selected suites before/after differences to compiler/debug mode differences

Dependencies:

None

Documentation:

TODO

Issue (optional):

None

Contributors (optional):

@grantfirl @VanderleiVargas-NOAA

grantfirl and others added 30 commits December 12, 2024 12:07
…emove *_of_new_state (default name refers to 'current' value)
…medmfvdifq return new tendencies and new tendency application block in GFS_PBL_generic_post
- Added tendency variables (`ten_t`, `ten_u`, `ten_v`) for temperature and wind tendencies in SAMF deep and shallow convection schemes.
- Updated relevant `.meta` files to reflect changes in variable intent (`inout` -> `in` where appropriate) and added tendencies.
- Modified Interstitials (`GFS_DCNV_generic_post`, `GFS_DCNV_generic_pre`, `GFS_SCNV_generic_post`, `GFS_SCNV_generic_pre`) to directly use tendencies instead of saved state variables.
- Removed redundant saved variables (`save_u`, `save_v`, `save_t`).
- Added `delt` to post interstitials.
…endency paradigm; cleanup saving of states no longer needed
@grantfirl grantfirl force-pushed the feature/tendency_cleanup branch from 320ae9a to 5d02db8 Compare December 18, 2025 16:28
@grantfirl
Copy link
Collaborator Author

@rhaesung @yangfanglin Here are some updated plots from testing: https://docs.google.com/presentation/d/1NXsgRd_2M-zAZIPlHagYhKa8W7TcJEftaR2sxjRvkfY/edit?slide=id.p#slide=id.p

These results were obtained last week, after the code had been updated to the latest develop branch. I've added a test using the conus13km_control because it uses the FV3_HRRR suite with smoke/dust active (this wasn't tested last time).

Based on these results, I'm still satisfied that these code changes aren't changing the scientific results at all. The exception is for the RAS scheme, which we're removing anyway, so I have not debugged the failed RTs.

@rhaesung
Copy link
Collaborator

rhaesung commented Feb 2, 2026

@grantfirl Thanks so much for the great work and for sharing the latest test results — I’ve started taking a look.
By the way, would you be open to a short meeting with you and @yangfanglin to talk through how we should review this large PR from the EMC side? I think it could help us align and make the review smoother. Let me know what you think!

@grantfirl
Copy link
Collaborator Author

@grantfirl Thanks so much for the great work and for sharing the latest test results — I’ve started taking a look. By the way, would you be open to a short meeting with you and @yangfanglin to talk through how we should review this large PR from the EMC side? I think it could help us align and make the review smoother. Let me know what you think!

@rhaesung Sure, I emailed you both offline to set up a time.

Copy link
Collaborator

@rhaesung rhaesung left a comment

Choose a reason for hiding this comment

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

@grantfirl I've had a chance to go through the convection schemes in this PR. Here is a summary of the key points I've flagged.

  1. Bugs: found a few indexing errors (ntr+1 vs ntr+2), missing /dt, and skipped ten_u updates.
  2. Consistency: the internal state updates (like qv) and diagnostic units (like QLCN/QICN) - just want to ensure they all align with the new tendency framework.
  3. Metadata minor cleanup

Thanks and looking forward to your thoughts!

[pu]
standard_name = x_wind_of_new_state
standard_name = x_wind
long_name = updated x-direction wind
Copy link
Collaborator

Choose a reason for hiding this comment

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

removing 'updated' would be more accurate. The same should be applied to pv, pt, and other meta files.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point. I agree and I remember thinking it when I was making metadata edits, but I didn't bother due to long_names not being used to match anything. But, it makes sense to fix them because it can be misleading as-is. Will do.

@grantfirl
Copy link
Collaborator Author

@grantfirl I've had a chance to go through the convection schemes in this PR. Here is a summary of the key points I've flagged.

  1. Bugs: found a few indexing errors (ntr+1 vs ntr+2), missing /dt, and skipped ten_u updates.
  2. Consistency: the internal state updates (like qv) and diagnostic units (like QLCN/QICN) - just want to ensure they all align with the new tendency framework.
  3. Metadata minor cleanup

Thanks and looking forward to your thoughts!

Thanks @rhaesung for the thorough review. I'll address these right away.

@gspetro-NOAA
Copy link

@grantfirl @rhaesung Have the requested changes been addressed? The parent PRs were marked ready for review, so I wanted to check on this.

@grantfirl
Copy link
Collaborator Author

@grantfirl @rhaesung Have the requested changes been addressed? The parent PRs were marked ready for review, so I wanted to check on this.

No, I'm making the changes now. There will likely be some more testing that needs to happen beyond RTs yet too, so this shouldn't be scheduled for the merge queue yet.

Copy link
Collaborator

@rhaesung rhaesung left a comment

Choose a reason for hiding this comment

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

@grantfirl The overall direction of the refactor looks great! To bring GWD fully in line with your new framework, just a couple of points:

  1. Since generic post now handles diagnostic accumulation, please remove the manual updates in the primary schemes to avoid double-counting.
  2. Let's keep temperature tendencies alongside the wind to ensure all variables follow the same logic and maintain physical symmetry.

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.