Generalized indices: mpp global field updates#1806
Generalized indices: mpp global field updates#1806J-Lentz wants to merge 18 commits intoNOAA-GFDL:mainfrom
mpp global field updates#1806Conversation
Refactor the mpp_global_field unit tests to test nonstandard dimension orders. These new tests do not currently pass, as the mpp_global_field implementation uses hardcoded dimension orders.
Test the `mpp_*_group_update` subroutines with nonstandard dimension orders. A separate module for shared unit test code has also been created.
Modify the interpolator tests to test all possible dimension orders.
The 2D tests in test_data_override_ongrid.F90 have been modified to test for generalized indices support.
Update mpp_global_field unit tests to pass `xdim` and `ydim` arguments. Fix issues with the rewritten mpp_global_field that cause build errors and test failures.
Create a new file for `arr2vec`, `vec2arr`, and `arr_init`. Add interfaces for these new subroutines to mpp_domains_mod.
| !* governing permissions and limitations under the License. | ||
| !*********************************************************************** | ||
|
|
||
| !> Pack an array into a vector |
There was a problem hiding this comment.
Hi, here to make annoying documentation requests for the chat🤖
Could there be a bit more explanation on why packing is needed and where it's used?
There was a problem hiding this comment.
I've added two sentence explanations of packing and unpacking in f42babd.
| subroutine ARR2VEC_ (arr, vec, ix, iy, is, ie, js, je) | ||
| MPP_TYPE_, intent(in) :: arr(..) !< The array to be packed | ||
| MPP_TYPE_, intent(out) :: vec(:) !< The vector to copy the data into | ||
| integer, intent(in) :: ix, iy !< Indices of the domain-decomposed dimensions |
There was a problem hiding this comment.
Just repeating what was mentioned at yesterday's meeting about ix, iy being unclear. Maybe the word axes is clearer? An example would be great
| integer, allocatable, dimension(:) :: lb, ub | ||
| integer :: n, m | ||
| integer :: i1, i2, i3, i4, i5 | ||
|
|
There was a problem hiding this comment.
short explanation of what lb and ub?
| ub(ix) = ie | ||
| ub(iy) = je | ||
|
|
||
| m = 0 |
There was a problem hiding this comment.
I've added an explanation to the declaration of lb and ub, which I think explains what this block is doing.
| end subroutine ARR2VEC_ | ||
|
|
||
| !> Unpack a vector into an array | ||
| !> @ingroup mpp_domains_mod |
There was a problem hiding this comment.
Similar requests as ARR2VEC_ above
|
|
||
| !> Initialize an assumed-rank array | ||
| !> @ingroup mpp_domains_mod | ||
| subroutine ARR_INIT_ (arr, val) |
There was a problem hiding this comment.
Comment on when to call this subroutine? When it's needed?
| MPP_TYPE_, intent(in) :: arr(..) !< The array to be packed | ||
| MPP_TYPE_, intent(out) :: vec(:) !< The vector to copy the data into | ||
| integer, intent(in) :: ix, iy !< Indices of the domain-decomposed dimensions | ||
| integer, intent(in) :: is, ie, js, je !< Starting and ending indices of the x and y dimensions |
There was a problem hiding this comment.
Likewise, examples.. something like array(is:ie, js:je) for ix=1, iy=2
and array(js:je, is:ie) for ix=2, iy=1?
There was a problem hiding this comment.
I've added some examples to the documentation for is, ie, js, je.
Use a temporary variable to store the `type(c_ptr)` when passing the result of `c_loc()` to `c_f_pointer`.
uramirez8707
left a comment
There was a problem hiding this comment.
Minor question, but this looks to me.
There was a problem hiding this comment.
Why are the changes in CMakeLists necessary?
There was a problem hiding this comment.
They're not necessary. I did some back-and-forth with Gemini trying to determine the cause of a CI build failure and while none of its suggestions ended up being the actual issue, they do seem like genuine improvements, so I kept them in the PR. I can git revert CMakeLists if anyone disagrees.
Description
This PR adds
mpp_global_fieldupdates for generalized indices, and causes the unit tests added in #1763 to pass. TheMPP_DO_GLOBAL_FIELD_3D_subroutine is renamed toMPP_GLOBAL_FIELD_, which now takes assumed-ranklocalandglobalarguments. Optionalxdimandydimarguments have also been added, which can be used to specify which dimensions are domain-decomposed.MPP_DO_GLOBAL_FIELD_A2A_3D_is removed, as are the various wrapper subroutines formpp_global_field(MPP_GLOBAL_FIELD_2D_,MPP_GLOBAL_FIELD_4D_, etc). This PR also addsmpp_domains_mod, which contains new subroutines for packing/unpacking 2D-5D arrays.How Has This Been Tested?
Builds on C5 with intel-classic.
mpp_global_fieldunit tests pass.Checklist:
make distcheckpasses