Skip to content

Enable jedi_lfric to run lfric_atm forecast configurations#512

Open
Steven Sandbach (ss421) wants to merge 26 commits into
MetOffice:mainfrom
ss421:update_forecast_config_ifdefphys
Open

Enable jedi_lfric to run lfric_atm forecast configurations#512
Steven Sandbach (ss421) wants to merge 26 commits into
MetOffice:mainfrom
ss421:update_forecast_config_ifdefphys

Conversation

@ss421
Copy link
Copy Markdown
Contributor

@ss421 Steven Sandbach (ss421) commented May 20, 2026

PR Summary

Sci/Tech Reviewer: Matt Shin (@matthewrmshin)
Code Reviewer: Ricky Wong (@mo-rickywong)

This update requires the changes applied in: #502. This branch Update forecast config ifdefphys was created from the branch in that PR: cjohnson-pi/ifdefphys. The change being applied in this PR can be seen via: cjohnson-pi/lfric_apps@ifdefphys...ss421:lfric_apps:update_forecast_config_ifdefphys

This PR updates jedi_lfric_tests to enable running of model forecast based on lfric_atm configurations. This requires setting UM_PHYSICS to true. The update largely follows the lfric_atm build configurations. I did not:

  1. Add the optimization scripts as it is not yet clear how this should be done. Some follow up work is required to better understand this.
  2. Update the build flags FFLAG_GROUPS because I encountered build issues that may be linked to Adjoint code which is included in the jedi_lfric library.

A small bug was fixed (removal of clock double tick).

Three new lfric_atm based configurations have been added: nwp_gal9-C12, nwp_gal9-C12_da and nwp_gal9-C48_MG. The existing gh-si-for-linear-C12 was removed as it was only a placeholder configuration and no longer required.

Note: The C48 test requires a new input file reference directly at: /home/users/darth/srv/mobb-data/lfric-jedi/lfric-diag/lfric_bg_mi-be607_C48_20210602_la354.nc currently and used in JEDI testing. Documentation on the file is included in: https://github.com/MetOffice/jjdocs/blob/38d5cfad6fd30cbea67e825775c5a20798490430/docs/Interfaces/ModelInterfaces/Input-Data/lfric-jedi-dir.rst?plain=1#L169

The applications/jedi_lfric_tests/integration-test was removed as it was problematic when integrating the UM physics and currently not testing anything useful. Furthermore, none of the other applications include integration tests.

  • linked MetOffice/mo-bundle#1072
  • linked JCSDA-internal/lfric-jedi#1274

Note: given the nature of this change I would like to test this branch again before the branch is merged into main.

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)

Tested via lfric-jedi: https://github.com/JCSDA-internal/lfric-jedi/pull/1274 using a sepearte branch at the head of main (see: ss421#2).

trac.log

Test Suite Results - lfric_apps - update_forecast_config_ifdefphys/run5

Suite Information

Item Value
Suite Name update_forecast_config_ifdefphys/run5
Suite User steven.sandbach
Workflow Start 2026-05-22T13:29:40
Groups Run developer
Dependency Reference Main Like
casim MetOffice/casim@2026.03.2 True
jules MetOffice/jules@2026.03.2 True
lfric_apps ss421/lfric_apps@update_forecast_config_ifdefphys False
lfric_core MetOffice/lfric_core@2026.03.2 True
moci MetOffice/moci@2026.03.2 True
SimSys_Scripts MetOffice/SimSys_Scripts@2026.03.2 True
socrates MetOffice/socrates@2026.03.2 True
socrates-spectral MetOffice/socrates-spectral@2026.03.2 True
ukca MetOffice/ukca@2026.03.2 True

Task Information

✅ succeeded tasks - 1172

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

@ss421 Steven Sandbach (ss421) added the Linked Jedi This PR is linked to a Jedi PR - this will be managed by the DA team label May 20, 2026
@ss421 Steven Sandbach (ss421) changed the title Update forecast config ifdefphys Enable jedi_lfric to run lfric_atm forecast configurations May 20, 2026
@ss421
Copy link
Copy Markdown
Contributor Author

Thanks reviewing Matt Shin (@matthewrmshin) - I see this has now been moved to code review and is now with Ricky Wong (@mo-rickywong)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code owner (build system) review: A few things seem off. Please explain why the are necessary.

Choose a reason for hiding this comment

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

If you want to override compiler arguments on a per-file bases the FFLAGS_EXTRA variable is provided for this. Did you try this and find it didn't work?

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 did not and Im not sure what I need to do to test that. Can you help with this?

I've been following the structure of lfric_atm so all of these files are based on/copies from that. From what I understand, these are profile specific and needed because the per-file flag overrides differ between profiles. The FFLAGS_EXTRA in compile_options.mk is profile agnostic.


$(info UM physics specific compile options)

include $(PROJECT_DIR)/build/fortran/$(FORTRAN_COMPILER).mk

Choose a reason for hiding this comment

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

I don't think this should be needed.

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.

This is in the equivalent lfric_atm file but I can try to remove it here.

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 tired removing that but it failed during build so it appears to be needed. The failure relates to code that is now being built. This File seems to include settings that are currently required by lfric-atm. See:

https://cylchub/services/cylc-review/view/steven.sandbach?&suite=update_forecast_config_ifdefphys1%2Frun1&no_fuzzy_time=0&path=log/job/1/build_jedi_lfric_tests_azspice_gnu_fast-debug-64bit/01/job.err

Comment thread applications/jedi_lfric_tests/Makefile Outdated
Comment on lines +54 to +59
$(Q)echo > /dev/null

include $(APPS_ROOT_DIR)/build/extract/extract_meta.mk
include $(CORE_ROOT_DIR)/infrastructure/build/lfric.mk
include $(INTERNAL_DEPENDENCIES:=/build/import.mk)
-include $(PROJECT_DIR)/build/project.mk
include build/project.mk

Choose a reason for hiding this comment

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

Why make this change?

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.

Im not sure, I made a bunch of changes to get this to work. I will try reverting it and see what happens.

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've reverted and retested and all good so committed at: 89c3bba

Comment on lines +131 to +144
$(call MESSAGE,Extracting coupled_interface component)
$(call MESSAGE,========================================)
$Q$(MAKE) $(QUIET_ARG) -f $(LFRIC_BUILD)/extract.mk \
SOURCE_DIR=$(APPS_ROOT_DIR)/interfaces/coupled_interface/source
$(call MESSAGE,========================================)
$(call MESSAGE,Extracting Gungho dynamical core)
$(call MESSAGE,========================================)
$Q$(MAKE) $(QUIET_ARG) -f $(LFRIC_BUILD)/extract.mk \
SOURCE_DIR=$(APPS_ROOT_DIR)/science/gungho/source
$(call MESSAGE,========================================)
$(call MESSAGE,Extracting UM physics)
$(call MESSAGE,========================================)
$Q$(MAKE) $(QUIET_ARG) -f $(APPS_ROOT_DIR)/build/extract/extract_physics.mk
$(call MESSAGE,========================================)

Choose a reason for hiding this comment

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

The INTERNAL_DEPENDENCIES list is provided for doing exactly this.

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.

As noted I've been following lfric_atm in the minimal way possible. I'm not sure what I tried that didn't work but I think I did try to minimize what is included here. Can I clarify on your comment: do you think it should be possible to remove all of the highlighted text (131-144)? I can try that if so.

Comment on lines +157 to +177
$(call MESSAGE,PSycloning interface components)
$(call MESSAGE,========================================)
$Q$(MAKE) $(QUIET_ARG) -f $(LFRIC_BUILD)/psyclone/psyclone_psykal.mk \
SOURCE_DIR=$(APPS_ROOT_DIR)/interfaces/coupled_interface/source \
OPTIMISATION_PATH=$(OPTIMISATION_PATH)
$Q$(MAKE) $(QUIET_ARG) -f $(LFRIC_BUILD)/psyclone/psyclone_psykal.mk \
SOURCE_DIR=$(APPS_ROOT_DIR)/interfaces/jules_interface/source \
OPTIMISATION_PATH=$(OPTIMISATION_PATH)
$Q$(MAKE) $(QUIET_ARG) -f $(LFRIC_BUILD)/psyclone/psyclone_psykal.mk \
SOURCE_DIR=$(APPS_ROOT_DIR)/interfaces/socrates_interface/source \
OPTIMISATION_PATH=$(OPTIMISATION_PATH)
$Q$(MAKE) $(QUIET_ARG) -f $(LFRIC_BUILD)/psyclone/psyclone_psykal.mk \
SOURCE_DIR=$(APPS_ROOT_DIR)/interfaces/physics_schemes_interface/source \
OPTIMISATION_PATH=$(OPTIMISATION_PATH)
$(call MESSAGE,========================================)
$(call MESSAGE,PSycloning Gungho dynamical core)
$(call MESSAGE,========================================)
$Q$(MAKE) $(QUIET_ARG) -f $(LFRIC_BUILD)/psyclone/psyclone_psykal.mk \
SOURCE_DIR=$(APPS_ROOT_DIR)/science/gungho/source \
OPTIMISATION_PATH=$(OPTIMISATION_PATH)
$(call MESSAGE,========================================)

Choose a reason for hiding this comment

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

The INTERNAL_DEPENDENCIES should do away with this as well.

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.

As with previous comment - I can test with this section (157-177) removed if you think that should work?

export FFLAGS_UM_PHYSICS = -s real64

include $(PROJECT_DIR)/build/fortran/crayftn/$(PROFILE).mk No newline at end of file
include $(PROJECT_DIR)/../lfric_atm/build/fortran/crayftn/$(PROFILE).mk

Choose a reason for hiding this comment

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

This change seems unnecessary.

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.

This is a branch from: cjohnson-pi:ifdefphys in #502 where this particular change is being added. I see you have commented on that so it will be fixed by that PR.


$(info UM physics specific compile options)

include $(LFRIC_ATM_DIR)/build/fortran/$(FORTRAN_COMPILER).mk

Choose a reason for hiding this comment

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

I don't think this should be necessary.

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.

This is a branch from: cjohnson-pi:ifdefphys in #502 where this particular change is being added. I see you have commented on that so it will be fixed by that PR.

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

Labels

Linked Jedi This PR is linked to a Jedi PR - this will be managed by the DA team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants