nextsimhub / nextsimdg

neXtSIM_DG : next generation sea-ice model with DG
https://nextsim-dg.readthedocs.io/en/latest/?badge=latest
Apache License 2.0
10 stars 13 forks source link

Pass `ModelArray` to `Xios.write`, rather than array of `double`s #545

Closed jwallwork23 closed 3 weeks ago

jwallwork23 commented 1 month ago

Pass ModelArray to Xios.write, rather than array of doubles

Fixes #544

Task List


Change Description

In the existing implementation of the Xios class, its write method accepts a C-style array of doubles, along with its dimensions in each direction. The approach adopted here - better in line with Nextsim's approach - is to instead pass a ModelArray, which knows about both the data and dimensions. I think this change is fairly uncontroversial.

While working on this last week, @timspainNERSC said it would be preferable if runtime configuration of Nextsim-DG would not required when using Xios functionality. To address this, the changes here also make the Xios class independent of Nextsim-DG. Is this acceptable @TomMelt, or are there other reasons that we should keep the configuration code in that we aren't aware of?

Test Description

@timspainNERSC also said it would be preferable if the Xios tests are built without linking to nextsimlib, to keep them separate. As such, the Xios test build has been reworked. In the current setup, the tests build and all pass. However, the latest commit (2e83114b1fd9efda9a0b99ca7900ce0ff8d0d8a1) is a temporary hack to get the Xios test to build correctly. @TomMelt do you have any insight on how to avoid this?

Pre-Request Checklist

jwallwork23 commented 1 month ago

Note that I had to turn off clang-format to get the includes in the right order in the Xios test. (88ddbceeb12fe643251e54e156acc49b0ecc5ba3)

jwallwork23 commented 3 weeks ago

This PR is out of date and could do with splitting into separate PRs for the different issues it addresses. Closing now.