Skip to content

Add .load() call on UxGrid.uxgrid.face_node_connectivity - #2816

Merged
wyatt-fluidnumerics merged 4 commits into
mainfrom
optimize-particle-in-cell-checks-for-UxGrids
Aug 14, 2026
Merged

Add .load() call on UxGrid.uxgrid.face_node_connectivity#2816
wyatt-fluidnumerics merged 4 commits into
mainfrom
optimize-particle-in-cell-checks-for-UxGrids

Conversation

@wyatt-fluidnumerics

@wyatt-fluidnumerics wyatt-fluidnumerics commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Description

See #2815 for major details, this PR serves to decrease the number of dask.compute calls during particle-in-cell checks and during interpolation for unstructured grids by backing the uxgrid.face_node_connectivity array with numpy rather than leaving it lazy as a dask array.

Checklist

@erikvansebille erikvansebille left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, this is a great and simple performance boost; well done on finding this @wyatt-fluidnumerics!

It's conceptually similar to the performance gain of loading the lon and lat arrays in xgrid
https://github.com/Parcels-code/Parcels/blame/c9ccd66d0e7eca4d3938512f6e5ef04eba39d6b0/src/parcels/_core/xgrid.py#L159-L161

Perhaps here also add some safeguards that the .load is only called if the array is a dask collection?

But these kinds of low-hanging fruit performance boosts are exactly what we should be looking for now; great job!

@github-project-automation github-project-automation Bot moved this from Backlog to Ready in Parcels development Aug 13, 2026
@wyatt-fluidnumerics

Copy link
Copy Markdown
Contributor Author

Great! Just added the dask collection check.

@erikvansebille erikvansebille left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now!

@wyatt-fluidnumerics
wyatt-fluidnumerics enabled auto-merge (squash) August 14, 2026 13:10
@wyatt-fluidnumerics
wyatt-fluidnumerics merged commit a4b3a89 into main Aug 14, 2026
17 of 18 checks passed
@wyatt-fluidnumerics
wyatt-fluidnumerics deleted the optimize-particle-in-cell-checks-for-UxGrids branch August 14, 2026 13:17
@github-project-automation github-project-automation Bot moved this from Ready to Done in Parcels development Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Optimization for unstrucutred grid point-in-cell checking and interpolation

2 participants