Skip to content

New function space options for coordinate fields#179

Open
tommbendall wants to merge 38 commits intoMetOffice:mainfrom
tommbendall:TBendall/CoordSpace
Open

New function space options for coordinate fields#179
tommbendall wants to merge 38 commits intoMetOffice:mainfrom
tommbendall:TBendall/CoordSpace

Conversation

@tommbendall
Copy link
Contributor

@tommbendall tommbendall commented Jan 22, 2026

PR Summary

Sci/Tech Reviewer: @thomasmelvin
Code Reviewer:

This PR picks up on the new coordinate field namelist options from MetOffice/lfric_core#238, and sets some key apps to use the new Wtheta coordinate space.

A handful of science changes were necessary to get this to work -- these are detailed below. Otherwise, the vast majority of changes involve the addition of the new namelist options into all of the required files.

Please See

This branch is built on the changes in #277, and until that is merged the diff on this PR will also include the changes from that branch. I have created PRs in my own fork to show useful diffs for reviewing:

Linked-To

  • LFRic Core#238, which contains the main science changes
  • there will also need to be a linked JEDI-LFRic PR

Blocked-By

This branch includes the changes from #277, which are necessary to be able to safely use a Wtheta space for the coordinate fields.

Blocks

The ultimate aim of this work is to facilitate moving to coord_order=2 to give a better representation of the orography.

Details

Some science changes were necessary to allow the use of a Wtheta-like coordinate space:

  1. science/gungho/source/orography/assign_orography_field_mod.F90:
  • the routines in this file assume that chi is discontinuous, and modify the DoFs in place. I have rewritten this file to make a copy of chi before the coordinates are adjusted to account for orography, which allows them to work in the case of (partial) continuity
  1. science/gungho/source/algorithm/limited_area/limited_area_masks_alg_mod.x90:
  • the coordinate_based option for specifying LBCs assumes the coordinate values are in the corner of DoFs. To ensure this still works, I copy the coordinate fields into Wchi
  1. science/gungho/source/kernel/initialisation/sample_initial_u_kernel_mod.F90 was hard-coded to use details around the lowest-order Wchi space. To avoid issues, the kernel has been changed to avoid using the chi field, and instead uses the dA_at_w2 field (which will be valid for any coordinate options)

Otherwise the changes involve picking up the Core branch:

  1. Kernels specifying the Wchi space have been changed to ANY_SPACE_9 (this is not necessary but feels safe)
  2. The new namelist options have been added to configuration.nml files
  3. New namelist options are added to any feign_configs in unit-tests
  4. The gungho_model, lfric_atm, linear_model and jedi_lfric apps use the Wtheta coordinate space

Results

The attached PDFs show plots from the gungho_model and lfric_atm test suites, indicating that the change to use a Wtheta-like coordinate space is science-neutral:

Some timing results are shown in the following table, showing changes to timing are within normal variability for this change (note that bigger savings are expected when comparing between 'Wchi' and 'Wtheta' coordinate spaces for coord_order=2)

timestepping vn3.1 with coord_space='Wchi' branch with coord_space='Wtheta'
UKV 312.62 312.38
C48 climate 333.72 335.41
C224 221.83 220.18
C896 416.21 413.34

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 Core rose-stem suite
  • If required (e.g. API changes) I have also run the LFRic Apps test suite using this branch
  • 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 - test_coord_space_apps/run27

Suite Information

Item Value
Suite Name test_coord_space_apps/run27
Suite User thomas.bendall
Workflow Start 2026-03-13T20:35:07
Groups Run all
Dependency Reference Main Like
casim MetOffice/[email protected] True
jules MetOffice/[email protected] True
lfric_apps tommbendall/lfric_apps@TBendall/TestCoordSpace False
lfric_core tommbendall/lfric_core@TBendall/CoordSpace True
moci MetOffice/[email protected] True
SimSys_Scripts MetOffice/[email protected] True
socrates MetOffice/[email protected] True
socrates-spectral MetOffice/[email protected] True
ukca MetOffice/[email protected] True

Task Information

✅ succeeded tasks - 1511

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

@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 Jan 22, 2026
@tommbendall tommbendall added enhancement New feature or request Linked Core This PR is linked to a MetOffice/lfric_core PR KGO This PR contains changes to KGO macro This PR contains a metadata upgrade macro and removed cla-required The CLA has not yet been signed by the author of this PR - added by GA labels Jan 22, 2026
@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 Jan 22, 2026
@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 Jan 23, 2026
@tommbendall tommbendall mentioned this pull request Jan 23, 2026
29 tasks
@github-actions github-actions bot removed the cla-signed The CLA has been signed as part of this PR - added by GA label Feb 23, 2026
Copy link

@iboutle iboutle left a comment

Choose a reason for hiding this comment

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

As discussed, "cbl" and "rad_gas" lfric_atm idealised tests are erroneously having their initial wind set to 0 by this, because they use smp_init_wind=true with the wtheta co-ordinate. lfric_atm uses smp_init_wind=true, because using false results in a projection being done, which leads to noisy profiles - this is the only way to get exactly what is in the namelist. I can think of 3 possible options:

  • change these tests back to using the wchi co-ordinate
  • change these tests to use the pw_linear vertical profile, with just a single value specified to replace the current constant_uv values
  • make the sample_initial_u kernel use da_at_w2 instead of chi

I have no strong preference which!

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

Labels

enhancement New feature or request KGO This PR contains changes to KGO Linked Core This PR is linked to a MetOffice/lfric_core PR macro This PR contains a metadata upgrade macro

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants