Skip to content
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

chgres_cube: surface.F90 interp routine is too long for future unit testing #504

Closed
LarissaReames-NOAA opened this issue May 6, 2021 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@LarissaReames-NOAA
Copy link
Collaborator

LarissaReames-NOAA commented May 6, 2021

The interp routine currently makes use of a lot of repeated, nearly-identical blocks of code: FieldRegrid+FieldGet and FieldGather+search+FieldScatter. Making use of pointer arrays, we can significantly pare down the length of this subroutine but utilizing a regrid_many and a search_many subroutine that loops over the fields to be regridded/searched for each masked area (e.g., sea ice, water, land ice, etc.). I've already verified that this approach works for part of this subroutine, and the code passes the old "regression" (system) tests. I'll need to extend this to the rest of the masked regridding sections. Testing for regrid_many will probably need to involve generation of a simple, very small test case since the routine makes use of multiple ESMF calls. Testing search_many should look very much like the test for search, but with 2 fields (and associated other variables) passed at once.

@LarissaReames-NOAA LarissaReames-NOAA self-assigned this May 6, 2021
@kgerheiser
Copy link
Contributor

I was looking at this code. Could an ESMF_FieldBundle help?

Instead of each field being its own variable, pack them into field bundles and then you can loop over them.

@LarissaReames-NOAA
Copy link
Collaborator Author

@kgerheiser That's a fantastic idea! I knew FieldBundles were used in the weather model code, but didn't make the connection here. Yes, the FieldBundle would be much more elegant than the array of pointers for the ESMF Fields. I still think I'll need to pass through an array of pointers for one of the elements (the pointer names to assign in FieldGet), but the other two pointer arrays can be substituted with FieldBundles.

@LarissaReames-NOAA LarissaReames-NOAA added the enhancement New feature or request label May 6, 2021
@LarissaReames-NOAA
Copy link
Collaborator Author

Also a bonus: the ESMF documentation for 8.1.1 says they're working on adding features for packed FieldBundles that would allow regridding of an entire bundle in a single call. This is essentially what regrid_many is doing, so we'll be able to utilize that sort of functionality (and get rid of regrid_many) when it's added to ESMF.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants