Skip to content

Correct the sample_physics_winds_correction option#69

Open
tommbendall wants to merge 5 commits intoMetOffice:mainfrom
tommbendall:TBendall/smp_phys_wind_correct
Open

Correct the sample_physics_winds_correction option#69
tommbendall wants to merge 5 commits intoMetOffice:mainfrom
tommbendall:TBendall/smp_phys_wind_correct

Conversation

@tommbendall
Copy link
Contributor

@tommbendall tommbendall commented Dec 17, 2025

PR Summary

Sci/Tech Reviewer: @atb1995
Code Reviewer: @allynt

The sample_physics_winds_correction option is broken (see Issue #66). This had not been detected as it is not currently covered by the test-suite.

This PR fixes this option and improves on the current situation by making the following changes:

  • input fields to the w3_to_w2_correction_kernel are declared to depth 2: this kernel reads from a field with a depth 1 halo and is an INC kernel, so fields being read using stencils must be declared to depth 2 (they are only depth 1 by default)

  • I have unified the sample_physics_winds_correction option with the other code to perform the sample_physics_winds: the sample_physics_winds_correction option should simply activate the correction routines, but it previously also changed the method of sampling

  • it picks up a correction to the w3_to_w2_correction kernel from the Linked PR: Fix Correction to Sampling Physics Winds lfric_core#221

  • I have turned this option on in an exoplanet rose-stem test to ensure that it is covered by the test-suite

  • Linked to: Fix Correction to Sampling Physics Winds lfric_core#221

To demonstrate that this is working, I have created an artificial test in which a zonal wind component in W3 was specified to vary with latitude. This was then mapped to W2, with and without the correction option. The following plots show that grid imprinting on the meridional panel edges has been improved.

See the small divots on the meridional panel edges:
sample_phys_correction

And zoomed in on a panel edge:
sample_phys_correction_zoom

Code Quality Checklist

(Some checks are automatically carried out via the CI pipeline)

  • I have performed a self-review of my own code
  • My code follows the project's style guidelines
    style guidelines
  • Comments have been included that aid undertanding and enhance the
    readability of the code
  • My changes generate no new warnings

Testing

  • I have tested this change locally, using the LFRic Apps rose-stem suite
  • If any tests fail (rose-stem or CI) the reason is understood and
    acceptable (eg. kgo changes)
  • I have added tests to cover new functionality as appropriate (eg. system
    tests, unit tests, etc.)
  • Any new tests have been assigned an appropriate amount of compute resource
    and have tests been allocated to an appropriate testing group (i.e. the
    developer tests are for jobs which use a small amount of compute resource
    and complete in a matter of minutes)

trac.log

Test Suite Results - lfric_apps - smp_phys_wind_correct/run1

Suite Information

Item Value
Suite Name smp_phys_wind_correct/run1
Suite User thomas.bendall
Workflow Start 2026-01-15T15:18:33
Groups Run developer', 'lfric_atm_extra
Dependency Reference Main Like
casim MetOffice/casim@2025.12.1 True
jules MetOffice/jules@2025.12.1 True
lfric_apps tommbendall/lfric_apps@TBendall/StochPhysFixes False
lfric_core tommbendall/lfric_core@TBendall/smp_phys_wind_correct True
moci MetOffice/moci@2025.12.1 True
SimSys_Scripts MetOffice/SimSys_Scripts@2025.12.1 True
socrates MetOffice/socrates@2025.12.1 True
socrates-spectral MetOffice/socrates-spectral@2025.12.1 True
ukca MetOffice/ukca@2025.12.1 True

Task Information

✅ succeeded tasks - 1256

Security Considerations

  • I have reviewed my changes for potential security issues
  • Sensitive data is properly handled (if applicable)
  • Authentication and authorisation are properly implemented (if applicable)

Performance Impact

  • Performance of the code has been considered and, if applicable, suitable
    performance measurements have been conducted

AI Assistance and Attribution

  • Some of the content of this change has been produced with the assistance
    of Generative AI tool name (e.g., Met Office Github Copilot Enterprise,
    Github Copilot Personal, ChatGPT GPT-4, etc) and I have followed the
    Simulation Systems AI policy
    (including attribution labels)

Documentation

  • Where appropriate I have updated documentation related to this change and
    confirmed that it builds correctly

PSyclone Approval

  • If you have edited any psyclone related code (eg. PsyKAl-lite, Kernal
    inteface, optimisation scripts, LFRic data structure code) then please
    contact the
    tooscollabdevteam@metoffice.gov.uk

Sci/Tech Review

  • I understand this area of code and the changes being added
  • The proposed changes correspond to the pull request description
  • Documentation is sufficient (do documentation papers need updating)
  • Sufficient testing has been completed

Please alert the code reviewer via a tag when you have approved the SR

Code Review

  • All dependencies have been resolved
  • Related Issues have been properly linked and addressed
  • CLA compliance has been confirmed
  • Code quality standards have been met
  • Tests are adequate and have passed
  • Documentation is complete and accurate
  • Security considerations have been addressed
  • Performance impact is acceptable

@github-actions github-actions bot added the cla-required The CLA has not yet been signed by the author of this PR - added by GA label Dec 17, 2025
@tommbendall tommbendall added this to the Spring 2026 milestone Dec 17, 2025
@github-actions github-actions bot added cla-signed The CLA has been signed as part of this PR - added by GA and removed cla-required The CLA has not yet been signed by the author of this PR - added by GA labels Dec 17, 2025
@tommbendall tommbendall added bug Something isn't working KGO This PR contains changes to KGO cla-required The CLA has not yet been signed by the author of this PR - added by GA cla-signed The CLA has been signed as part of this PR - added by GA and removed cla-signed The CLA has been signed as part of this PR - added by GA cla-required The CLA has not yet been signed by the author of this PR - added by GA labels Dec 17, 2025
@tommbendall tommbendall self-assigned this Dec 17, 2025
@tommbendall tommbendall added Linked Core This PR is linked to a MetOffice/lfric_core PR and removed KGO This PR contains changes to KGO labels Jan 15, 2026
@tommbendall tommbendall marked this pull request as ready for review January 15, 2026 18:07
@tommbendall tommbendall requested a review from atb1995 January 16, 2026 14:29
Copy link

@atb1995 atb1995 left a comment

Choose a reason for hiding this comment

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

This code fixes the current failure on main whilst using the sample_physics_winds_correction option - passing a field of the correct stencil depth and fixing the w3_to_w2_correction kernel in the linked PR by not using a vertical level index on a 2D field. Finally, it tidies/fixes the misused previous logic for application of the correction. I'm happy that the code is well written and does what was stated in the PR.

@github-actions github-actions bot requested a review from allynt January 26, 2026 17:52
@tommbendall
Copy link
Contributor Author

Thanks for the science review, @allynt this is now ready for code review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working cla-signed The CLA has been signed as part of this PR - added by GA Linked Core This PR is linked to a MetOffice/lfric_core PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The sample_physics_wind_correction option is broken

2 participants