Skip to content

Comments

Remove module scope access of namelist variables by coordinate/native jacobian.#249

Open
mo-rickywong wants to merge 8 commits intoMetOffice:mainfrom
mo-rickywong:FloatJacobian
Open

Remove module scope access of namelist variables by coordinate/native jacobian.#249
mo-rickywong wants to merge 8 commits intoMetOffice:mainfrom
mo-rickywong:FloatJacobian

Conversation

@mo-rickywong
Copy link
Contributor

@mo-rickywong mo-rickywong commented Jan 27, 2026

PR Summary

Sci/Tech Reviewer:
Code Reviewer: @mo-lucy-gordon

As part of work to remove configuration namelist access from module scope, configuration variables will need to be passed
by argument. Configuration variables passed by argument to kernels is more involved, so this PR moves the use _config_mod from the Jacobian routines up to the to the kernel level in preparation of further changes.

The main changes is that namelist configuration variables:

  • coord_system
  • geometry
  • topology
  • scaled_radius

Are to be passed by argument jacobian routines, i.e.

call coordinate_jacobian(coord_system, geometry, topology, scaled_radius, &
                         ndf_chi, nqp_h, nqp_v, chi1_e, chi2_e, chi3_e,   &
                         ipanel, basis_chi, diff_basis_chi, jac, dj)

The knock-on of this is a large number of kernels/unit-tests need to be updated in lfric_core and lfric_apps. Aswell as a change to the arguments of init_chi_tranforms called in the unit_tests.

Similar changes, but to a large number of files.

Linked PRs

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)

Rose test-suite Runs Green

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 27, 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 27, 2026
@mo-rickywong mo-rickywong marked this pull request as ready for review January 27, 2026 15:48
@mo-rickywong mo-rickywong marked this pull request as draft January 27, 2026 15:52
Copy link
Contributor

@mo-lucy-gordon mo-lucy-gordon left a comment

Choose a reason for hiding this comment

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

Overall this looks good but I think there are a few duplicated typos - see the code comments.

Copy link
Contributor

@mo-lucy-gordon mo-lucy-gordon left a comment

Choose a reason for hiding this comment

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

Converted to some suggested typo changes. As these are only simple changes I will pass them to Andy to fix so we can get the tickets committed, as Ricky is away.

Co-authored-by: mo-lucy-gordon <120176477+mo-lucy-gordon@users.noreply.github.com>
@github-actions github-actions bot added cla-modified The CLA has been modified 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 labels Feb 20, 2026
@github-actions
Copy link

⚠️ Hello @mo-rickywong!

Your CLA signature was found on the base branch, but you appear to have modified the CONTRIBUTORS.md file in this PR.

Please do not edit the CONTRIBUTORS.md file. If you have already signed the CLA, revert changes to the file and your signature will be picked up.

@andrewcoughtrie
Copy link
Collaborator

I've applied the small number of spelling corrections suggested by review as @mo-rickywong is away and they are very minor changes.

topology_fully_periodic
use finite_element_config_mod, only: coord_system_xyz, &
coord_system_native
! use planet_config_mod, only: scaled_radius
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this commented out line be left here?

north_pole(1) = PI/2.0_r_def
north_pole(2) = 0.0_r_def
call init_chi_transforms(north_pole_arg=north_pole)
call init_chi_transforms(geometry_spherical,&
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
call init_chi_transforms(geometry_spherical,&
call init_chi_transforms(geometry_spherical, &

north_pole(2) = 0.0_r_def
call init_chi_transforms(north_pole_arg=north_pole)
call init_chi_transforms(geometry_spherical,&
topology, &
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
topology, &
topology, &

feign_finite_element_config, &
feign_planet_config

!use feign_config_mod, only : feign_base_mesh_config, &
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be removed instead of being commented out?

call feign_planet_config( scaling_factor=1.0_r_def )

call init_chi_transforms()
!call feign_extrusion_config( method=method_uniform, &
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be removed instead of being commented out?

pointwise_coordinate_jacobian, &
pointwise_coordinate_jacobian_inverse

! use base_mesh_config_mod, only : geometry_spherical, &
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be removed instead of being commented out?

@tommbendall
Copy link
Contributor

Apologies for sticking my oar in, I just got notified about this PR. I realise it's a technical change rather than a science one, but I'm a bit surprised it didn't need a sci/tech reviewer since it changes the API to an important science routine.

I understand the logic for this change though, so have no objections but have spotted some things that need tidying.

@mo-lucy-gordon
Copy link
Contributor

mo-lucy-gordon commented Feb 20, 2026

Apologies for sticking my oar in, I just got notified about this PR. I realise it's a technical change rather than a science one, but I'm a bit surprised it didn't need a sci/tech reviewer since it changes the API to an important science routine.

I understand the logic for this change though, so have no objections but have spotted some things that need tidying.

I presumed the comments were deliberate but Ricky is away right now so we can't ask him.

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

Labels

cla-modified The CLA has been modified as part of this PR - added by GA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants