Skip to content

Upgrade adjoint mixed solver - #649

Open
DrTVockerodtMO wants to merge 32 commits into
MetOffice:mainfrom
DrTVockerodtMO:upgrade_adj_solver
Open

Upgrade adjoint mixed solver#649
DrTVockerodtMO wants to merge 32 commits into
MetOffice:mainfrom
DrTVockerodtMO:upgrade_adj_solver

Conversation

@DrTVockerodtMO

@DrTVockerodtMO DrTVockerodtMO commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

PR Summary

Sci/Tech Reviewer: Josh Colclough (@mo-joshuacolclough)
Code Reviewer: allynt

This change includes an upgrade of the adjoint mixed solver code following from #177 . I have mainly added new kernels and adjoint tests. I have also included the adjoint for one of the kernels not used yet in the adjoint solver algorithm, because the conditional section that calls it in the linear has a not yet implemented error handling in the adjoint. If/when we are ready to code this we can have this method available at the very least.

Code Quality Checklist

  • I have performed a self-review of my own code
  • My code follows the project's style guidelines
  • Comments have been included that aid understanding and enhance the readability of the code
  • My changes generate no new warnings
  • All automated checks in the CI pipeline have completed successfully

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 (e.g. kgo changes)
  • I have added tests to cover new functionality as appropriate (e.g. system tests, unit tests, etc.)
  • Any new tests have been assigned an appropriate amount of compute resource and have 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 - upgrade_adj_solver/run11

Suite Information

Item Value
Suite Name upgrade_adj_solver/run11
Suite User terence.vockerodt
Workflow Start 2026-08-19T12:20:16
Groups Run developer
Dependency Reference Main Like
casim MetOffice/casim@2026.07.1 True
jules MetOffice/jules@2026.07.1 True
lfric_apps DrTVockerodtMO/lfric_apps@upgrade_adj_solver False
lfric_core MetOffice/lfric_core@60fc29a True
moci MetOffice/moci@2026.07.1 True
SimSys_Scripts MetOffice/SimSys_Scripts@77a5166 True
socrates MetOffice/socrates@2026.07.1 True
socrates-spectral MetOffice/socrates-spectral@2026.07.1 True
ukca MetOffice/ukca@9fc2b6d True

Task Information

✅ succeeded tasks - 1218

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 (e.g. PSyKAl-lite, Kernel interface, optimisation scripts, LFRic data structure code) then please contact the TCD Team

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

@DrTVockerodtMO DrTVockerodtMO self-assigned this Jul 22, 2026
@DrTVockerodtMO

Copy link
Copy Markdown
Contributor Author

There is a problem with get_mask_r_solver trying to perform a halo exchange on a read-only field. The adjoint_tests app does use a special PSyclone config in order to get it to properly work in parallel since it uses setval_random. Since we don't use the test that gets the mask yet it might be worth just cutting that from the scope.

@github-actions github-actions Bot added the cla-modified The CLA has been modified as part of this PR - added by GA label Jul 27, 2026
@github-actions github-actions Bot removed the cla-modified The CLA has been modified as part of this PR - added by GA label Jul 28, 2026
@DrTVockerodtMO
DrTVockerodtMO marked this pull request as ready for review August 12, 2026 15:29
@DrTVockerodtMO DrTVockerodtMO added the enhancement New feature or request label Aug 12, 2026
@DrTVockerodtMO DrTVockerodtMO added this to the Autumn 2026 milestone Aug 12, 2026

@mo-joshuacolclough Josh Colclough (mo-joshuacolclough) left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks good, I have a few considerations but not enough to fail sci review.

Comment thread science/adjoint/source/algorithm/solver/adj_mixed_operator_alg_mod.x90 Outdated
@@ -0,0 +1,143 @@
!-----------------------------------------------------------------------------
! (c) Crown copyright Met Office. All rights reserved.

Choose a reason for hiding this comment

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

Wondering if these need dating? I see there are some files without dates.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was told in #428 to remove the dates so I think there is a new standard, not sure if its consistently applied though as I see some files still have the dates in.

Choose a reason for hiding this comment

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

Thanks good to know

@github-actions
github-actions Bot requested a review from allynt August 19, 2026 11:18
@DrTVockerodtMO

Copy link
Copy Markdown
Contributor Author

Oops, forgot to commit the kernel metadata fix until today, it should build properly now. I will run another dev suite!

@DrTVockerodtMO

Copy link
Copy Markdown
Contributor Author

Oops, forgot to commit the kernel metadata fix until today, it should build properly now. I will run another dev suite!

Done.

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgrade adjoint mixed solver

3 participants