Skip to content

Conversation

@cjohnson-pi
Copy link

@cjohnson-pi cjohnson-pi commented Jan 21, 2026

PR Summary

Sci/Tech Reviewer: @tommbendall
Code Reviewer: @mo-marqh

#115

  • Add a new nwp_gal9 configuration in the linear integration tests (to match the default configuration for the linear_model). This includes using data read from file to initialise the tests.
  • Update the integration tests linear drivers to match the linear model driver (this required a safety switch added to gungho_step)
  • Reduce the number of tests for the semi-implicit and runge-kutta configs (as nwp_gal9 is running most tests)
  • Update the plot_convergence.sh script (this is not part of the test suite but is useful to have) - this runs the integration tests multiple times and creates plots of the data.
  • Improve how the convergence rate in the integration tests is tested.

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)

Plot convergence results

#115 (comment)

trac.log

Test Suite Results - lfric_apps - update_integration_test/run1

Suite Information

Item Value
Suite Name update_integration_test/run1
Suite User christine.johnson
Workflow Start 2026-01-28T15:09:36
Groups Run suite_default
Dependency Reference Main Like
casim MetOffice/casim@2025.12.1 True
jules MetOffice/jules@2025.12.1 True
lfric_apps cjohnson-pi/lfric_apps@update_integration_t False
lfric_core MetOffice/lfric_core@aa32824 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 - 1106

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 21, 2026
@github-actions github-actions bot removed the cla-required The CLA has not yet been signed by the author of this PR - added by GA label Jan 21, 2026
@cjohnson-pi
Copy link
Author

test

@cjohnson-pi cjohnson-pi marked this pull request as ready for review January 21, 2026 12:20
@cjohnson-pi cjohnson-pi added this to the Spring 2026 milestone Jan 22, 2026
@cjohnson-pi cjohnson-pi added the cla-signed The CLA has been signed as part of this PR - added by GA label Jan 22, 2026
Copy link
Contributor

@tommbendall tommbendall left a comment

Choose a reason for hiding this comment

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

This PR does quite a lot of things, and I have to admit to finding it difficult to navigate!

One of the larger changes seems to be to include moisture in several of the test algorithms, such as tl_test_rhs_alg_mod.x90 and tl_test_semi_imp_alg_mod.x90. There are a couple of changes that I don't understand, so have left comments on them.

It's an welcome change to use the appropriate driver level code in the control routines for the integration tests.

I appreciate the level of instructions in plot_convergence.sh. I checked out a copy of this branch and ran the script. It seems to take a very long time and hasn't finished yet -- I will report back it this fails.

@@ -123,10 +123,13 @@ module gungho_step_mod
call log_event( log_scratch_space, LOG_LEVEL_INFO )

temp_corr_io_value => get_io_value( modeldb%values, 'temperature_correction_io_value')
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems sensible to wrap the lines below in an if statement. Would it also make sense to wrap this line in an if statement about the energy correction?

Copy link
Author

Choose a reason for hiding this comment

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

Now included

@@ -0,0 +1,112 @@
##############################################################################
# (c) Crown copyright 2022 Met Office. All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should the year be 2026?

Copy link
Author

Choose a reason for hiding this comment

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

I've just moved this script from another directory, so the origin date is correct.

#!/usr/bin/env python
# -*- coding: utf-8 -*-
##############################################################################
# (c) Crown copyright 2021 Met Office. All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should the year be 2026?

Copy link
Author

Choose a reason for hiding this comment

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

as above

echo "Do not need to build the executable as $exe exists"
else
echo "$exe does not exist, so now building the executable"
cd ../../../build
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this mean we could only run this script from the plot_convergence directory? Could this be an absolutely path instead of a relative one?

Copy link
Author

Choose a reason for hiding this comment

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

Absolute paths created

plt.ylabel('Relative error')
plt.title('Validity of the tangent linear model')

#plt.show()
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know if you want to remove this comment? Or leave it in with an instruction to uncomment to show the plots?

Copy link
Author

Choose a reason for hiding this comment

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

An extra comment added

!> @param[in] norm_diff_prev Previous norm
!> @param[inout] pass_str Pass string (either PASS or FAIL)
!> @param[in] tol Test Tolerance
subroutine convergence_pass_string( norm_diff, norm_diff_prev, pass_str, tol )
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this convergence_pass_string routine be removed, and could this file import the public routine from tl_test_convergence_rate_check.f90 instead? And if not, could there be an explanation here for the extra implementation?

Copy link
Author

@cjohnson-pi cjohnson-pi Jan 28, 2026

Choose a reason for hiding this comment

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

A brief explanation has been added to the description. What has happened is the original code applied the square roots to the norms before checking in the convergence test. But I improved this so that when there are multiple variables, the convergence rate is checked for each variable and for the sum (but this needs the square root to be done after). But I kept this original code to allow the plot convergence graphs to be created.

! Clean up solvers and timestep method left over from running
! the model to set up model state and linear state
call final_si_operators()
call semi_implicit_solver_alg_final
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 semi_implicit_solver_alg_final
call semi_implicit_solver_alg_final()

Copy link
Author

Choose a reason for hiding this comment

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

corrected

setval_X( exner, n1_exner ) )
do i = 1, nummr
call invoke( setval_X( mr(i), n1_mr(i) ) )
enddo
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
enddo
end do

Copy link
Author

Choose a reason for hiding this comment

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

corrected

setval_X(ls_state(igh_d), ls_rho ), &
setval_X(ls_state(igh_p), ls_exner) )

call invoke( assign_field_random_kernel_type( random(igh_u), 1.0_r_def ) , &
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these removed because the incoming u, exner, etc fields are already initialised to random values? I'm struggling to find where that happened

Copy link
Author

Choose a reason for hiding this comment

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

yes the perturbations are now initialised from real data. This is better as we used to have set with random data and gamma values - and choosing the gamma values was tricky. The real data seems more robust.

setval_X(r_theta, theta), &
setval_X(r_rho, rho ) )

! Overwrite the moisture fields with potential temperature
Copy link
Contributor

Choose a reason for hiding this comment

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

Why?

Copy link
Author

Choose a reason for hiding this comment

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

explanation added

@mo-marqh mo-marqh self-requested a review January 27, 2026 08:51
Copy link
Contributor

@tommbendall tommbendall left a comment

Choose a reason for hiding this comment

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

Thanks for the explanation. I'm happy with the changes and that my suggestions have been addressed.

I have two final suggestions:

  1. Can you delete the applications/linear_model/plot_convergence folder?
  2. It would be nice to get the plot_convergence.sh script working if executed from a different directory. I've put a suggestion on how to do this

config_list=(nwp_gal9 semi_implicit runge_kutta)

# Define directories using the current working directory
export Linear_dir="$(dirname $PWD)"
Copy link
Contributor

Choose a reason for hiding this comment

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

So I think this command still prevents us from running the script from folders that aren't science/linear/plot_convergence. I realise this is not a big deal, but I think this suggestion will fix it:

Suggested change
export Linear_dir="$(dirname $PWD)"
SCRIPT_DIR="$(dirname "$(realpath "$BASH_SOURCE")")"
export Linear_dir="$(dirname $SCRIPT_DIR)"

I've checked that it at least starts running correctly with this change

@cjohnson-pi
Copy link
Author

Thanks for the helpful suggestions. Both addressed.

Copy link
Contributor

@tommbendall tommbendall left a comment

Choose a reason for hiding this comment

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

Thanks for the responses, this passes science review. @mo-marqh this is ready for code review

Copy link

@ss421 ss421 left a comment

Choose a reason for hiding this comment

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

This has no impact on JEDI.

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

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants