Add an io_value type for integers#326
Open
Steve Mullerworth (stevemullerworth) wants to merge 11 commits intoMetOffice:mainfrom
Open
Add an io_value type for integers#326Steve Mullerworth (stevemullerworth) wants to merge 11 commits intoMetOffice:mainfrom
Steve Mullerworth (stevemullerworth) wants to merge 11 commits intoMetOffice:mainfrom
Conversation
28 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
Sci/Tech Reviewer: allynt
Code Reviewer: Pierre Siddall (@Pierre-siddall)
Currently, support for storing real arrays in the checkpoint dump is provided by the
io_value_typeand associated support routines in the LFRic-XIOS component. This change adds support for storing and checkpointing integer arrays.As it changes the existing API, a linked MetOffice/lfric_apps#427 PR must be committed alongside this one.
As XIOS does not have an API for writing integer data, integer values are converted to
dp_xioswhich would normally be areal64value. This is accurate for allint32numbers, but would not be shoulddp_xiosever bereal32(precision is insufficient for integer values greater than or equal to 2 to the power 24). The unit tests were written to check for this possibility.Note on implementation 1: Currently,
io_value_typeis hardwired tor_defwhich can bereal64orreal32depending on the model configuration. Therefore,r_defis explicitly stated in the updated read/write API in the LFRic-XIOS component. Like with integers, there is a conversion todp_xioswhich would have no impact on values whetherr_defis 32-bit or 64-bit.Note on implementation 2: The writing/reading of fields of different types/kinds is done through a single generic routine, such as
write_field_generic, which includes aselect typeto differentiate the types/kinds. This setup is possible because thewrite_interfaceAPI in the commonfield_parent_typerelates to thefield_parent_proxyrather than thefield_parent_type. As the IO value types do not have an equivalent proxy, the analogous write interface must refer to the specific object itself. In other words, the integer andr_defread and write interfaces take the actualinteger_io_value_typeorio_value_typeas arguments, requiring the code to define specific subroutines for reading/writing.As the read and write APIs should have different intent (the write interface should have
intent(in)), the existing abstract interface that was shared has been split into two.As indicated above, the change also adds some unit tests for the LFRic-XIOS capabilities for both real and integer arrays as previously no io_value testing existed. During this work, it was noted that the test data was not being allocated correctly, so this was tidied.
Code Quality Checklist
Testing
trac.log
Test Suite Results - lfric_core - core_chkpt_seed/run2
Suite Information
Task Information
✅ succeeded tasks - 382
Security Considerations
Performance Impact
AI Assistance and Attribution
Documentation
PSyclone Approval
Sci/Tech Review
(Please alert the code reviewer via a tag when you have approved the SR)
Code Review