Skip to content

[PSyData] Handle derived types in a driver #2483

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
hiker opened this issue Jan 17, 2024 · 0 comments
Open

[PSyData] Handle derived types in a driver #2483

hiker opened this issue Jan 17, 2024 · 0 comments
Labels
enhancement PSyData um_physics Issues caused by trying to handle the UM physics with PSyclone

Comments

@hiker
Copy link
Collaborator

hiker commented Jan 17, 2024

While the API specific types are replaced with the corresponding plain Fortran types in a driver (e.g. an LFRic field becomes a 1D array), any module included might be using a derived type. For example, the um-physics in LFRic use:

real ::  q(tdims_l%i_start:tdims_l%i_end,tdims_l%j_start:tdims_l%j_end, &
   tdims_l%k_start:bl_levels), &
...
  DO k = 1, bl_levels
    DO j = tdims%j_start, tdims%j_end
      DO i = tdims%i_start, tdims%i_end

The declaration is handled in #2482. The kernel extraction does correctly write the values, e.g.:

      CALL extract_psy_data%PreDeclareVariable("tdims%i_end@atm_fields_bounds_mod", tdims%i_end)
      CALL extract_psy_data%PreDeclareVariable("tdims%i_start@atm_fields_bounds_mod", tdims%i_start)
      CALL extract_psy_data%PreDeclareVariable("tdims%j_end@atm_fields_bounds_mod", tdims%j_end)
      CALL extract_psy_data%PreDeclareVariable("tdims%j_start@atm_fields_bounds_mod", tdims%j_start)

But the driver does not read these files"

  call extract_psy_data%ReadVariable('tdims@atm_fields_bounds_mod', tdims)
  call extract_psy_data%ReadVariable('tdims@atm_fields_bounds_mod', tdims)
  call extract_psy_data%ReadVariable('tdims@atm_fields_bounds_mod', tdims)
  call extract_psy_data%ReadVariable('tdims@atm_fields_bounds_mod', tdims)

We need to fix the driver creation to handle this (as it is in the extraction). An easy alternative solution for a single type would be to add a generic interface for this UM array-bounds type, but the latter would be very limited in its usefulness.

@hiker hiker added enhancement PSyData um_physics Issues caused by trying to handle the UM physics with PSyclone labels Jan 17, 2024
hiker added a commit that referenced this issue Aug 29, 2024
hiker added a commit that referenced this issue Aug 29, 2024
@hiker hiker mentioned this issue Oct 12, 2024
12 tasks
hiker added a commit that referenced this issue Dec 10, 2024
hiker added a commit that referenced this issue Dec 10, 2024
hiker added a commit that referenced this issue Feb 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement PSyData um_physics Issues caused by trying to handle the UM physics with PSyclone
Projects
None yet
Development

No branches or pull requests

1 participant