PSyclone icon indicating copy to clipboard operation
PSyclone copied to clipboard

Invokes can't take field_real32_type or field_real64_type

Open tommbendall opened this issue 4 months ago • 1 comments

LFRic has a couple of different levels of abstractions of fields:

  • underlying fields for different precisions: field_real32_type and field_real64_type
  • fields used for different science code bubbles: field_type, r_tran_field_type, r_solver_field_type, which directly inherit from field_real32_type or field_real64_type based on the specification of the compiler

I am running against a case in which I would like to write an algorithm and kernel to generally work for field types of all precisions. While kernels can be written as an interface for real32 and real64 implementations, we can't do this at the algorithm level, because PSyclone currently can't interpret field_real32_type and field_real64_type, e.g.:

Generation Error: The metadata for argument 'field32' in kernel 'field_stats_code' specifies that this is a real field, however it is declared as a 'field_real32_type' in the algorithm code.

This means we would currently need a separate algorithm interface for field_type, r_tran_field_type, r_solver_field_type, etc... So it would be helpful if field_real32_type and field_real64_type could be also be interpreted as field types.

PS: Apologies if this is a duplicate issue -- I had a look but couldn't spot a similar one.

tommbendall avatar Sep 30 '25 11:09 tommbendall

Thanks @tommbendall, it doesn't ring any bells so I don't think it's a duplicate. If we're lucky, it's possibly as simple as adding new entries to LFRicConstants.DATA_TYPE_MAP in lfric_constants.py. I'll take a look.

arporter avatar Sep 30 '25 12:09 arporter