Skip to content

Radaer api ukca side - part one run time - #41

Open
Alan J Hewitt (alanjhewitt) wants to merge 4 commits into
MetOffice:mainfrom
alanjhewitt:radaer_api_ukca_side_3
Open

Radaer api ukca side - part one run time#41
Alan J Hewitt (alanjhewitt) wants to merge 4 commits into
MetOffice:mainfrom
alanjhewitt:radaer_api_ukca_side_3

Conversation

@alanjhewitt

@alanjhewitt Alan J Hewitt (alanjhewitt) commented Jul 16, 2026

Copy link
Copy Markdown

PR Summary

Sci/Tech Reviewer: Mohit Dalvi (@mcdalvi)
Code Reviewer: Yaswant Pradhan (@yaswant)

I developed the original lfric to radaer functionality in 2020. Like a lot of developments back then, it was needed in a hurry and so I developed a fudged solution with technical debt.

We will need user flexibility soon to be able to run radaer with different user settings, hence this part one of two development.

In part one, I have introduced the user flexibility that is required for run time. Its already a very large change, and this is a natural break point for splitting a big PR.

Some hard-coded settings remain in the development (on the ukca side, this is values like i_cpnt_index), which will be removed in the part two ticket to develop the initialisation stage functionality.

Code Quality Checklist

(Some checks are automatically carried out via the CI pipeline)

  • I have performed a self-review of my own code
  • My code follows the project's style guidelines
  • Comments have been included that aid undertanding and enhance the
    readability of the code
  • My changes generate no new warnings

Testing

  • I have tested this change locally, using the UKCA rose-stem suite
  • If shared files have been modified, I have run the UM and LFRic Apps rose
    stem suites
  • If any tests fail (rose-stem or CI) the reason is understood and
    acceptable (eg. kgo changes)
  • I have added tests to cover new functionality as appropriate (eg. system
    tests, unit tests, etc.)

trac.log

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

Sci/Tech Review

  • [X ] 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 (Also tested in UKCA Box model with not impact)

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

@alanjhewitt Alan J Hewitt (alanjhewitt) added Linked Apps This PR is linked to a MetOffice/lfric_apps PR cla-signed The CLA has been signed as part of this PR - added by GA labels Jul 16, 2026
@alanjhewitt Alan J Hewitt (alanjhewitt) changed the title UKCA side changes Radaer api ukca side - part one run time Jul 16, 2026
! Subroutine Interface:
!
! Code Owner: Please refer to the UM file CodeOwners.txt
! This file belongs in section: TOP_LEVEL

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

For files in the UKCA repo, the owning Section is just 'UKCA'

l_exclude_lw, &
l_exclude_sw, &
! Modal diameters from UKCA module (input)
ukca_dry_diam_um, &

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Given that this is a LFRic-specific routine the '_um' suffix can be dropped.

aod_ukca_all_modes_um, &
aaod_ukca_all_modes_um )

USE socrates_init_mod, ONLY: n_sw_band, &

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This will introduce a SOCRATES dependency while building UKCA and interfere with stand-alone applications like the Box model. Is there an alternative way of passing these values?


USE ukca_radaer_prepare_mod, ONLY: ukca_radaer_prepare

USE um_physics_init_mod, ONLY: n_radaer_mode

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

um_physics_init_mod will introduce a LFRic dependency in the build. The value could be passed in as a ''configuration'' variable (glomap_config%)

CHARACTER(LEN=*), PARAMETER, PRIVATE :: ModuleName = 'UKCA_RADAER_LFRIC_API_MOD'

CONTAINS

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

A placeholder to remind that the routine needs to be exported to LFRic via ukca_api_mod

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

We spoke offline. Its not needed for part one, but I think this is needed for part two. Thanks for the spot though, as i would probably have missed this.

l_aod_ukca_cor_ins, l_aaod_ukca_cor_ins

! Mass thickness of layers
REAL, INTENT(IN) :: d_mass_theta_levels_um( npd_profile, npd_layer )

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

As above the _um suffix should be dropped.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I got a build error after removing all examples of _um . There three pairs of variables with otherwise the same name with r_def and r_um equivalents ( scattering, asymmetry, absorption ). I gave the r_um version a suffix _radaer .

IF (lhook) CALL dr_hook(ModuleName//':'//RoutineName, zhook_in, zhook_handle)

!-----------------------------------------------------------------------

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

A explainer on the order of the items (modes?) will help to identify which are valid or invalid for a particular component/species.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

We spoke offline. I did not develop the unusual data layout of radaer_band_average and I agree that it is confusing. I put a comment in the code to give an idea of what is going on.

These hard coded values were moved from the LFRic RADAER kernel in this joint change.

In part two, I will remove these hard coded values and instead will calculate them during the initialisation step in the same way that is done in UM module ukca_radaer_init-ukca.F90


DO k = 1, npd_ukca_aod_wavel
DO i = 1, npd_profile
aod_ukca_all_modes_um(i,k,mode_ait_sol-1) = aod_ukca_this_mode_um(i,k)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

An explanation on why the '-1' for the 3rd index is needed will help understanding. Will future additions to modes or change in order mean re-writing the indices?


DO k = 1, npd_ukca_aod_wavel
DO i = 1, npd_profile
aod_ukca_all_modes_um(i,k,mode_acc_sol-1) = aod_ukca_this_mode_um(i,k)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

See above, using '-1' for indexing

@mcdalvi

Copy link
Copy Markdown

Thanks Alan, Sci-tech Review passed
Tagging Yaswant Pradhan (@yaswant) for Code Review.

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 Linked Apps This PR is linked to a MetOffice/lfric_apps PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants