Repository navigation
Initial 3d z coordinate implementation for unstructured grids - #2933
wyatt-fluidnumerics wants to merge 7 commits into
Conversation
for more information, see https://pre-commit.ci
|
Very cool, @wyatt-fluidnumerics! I love the final animation in the tutorial! Amazing that we can get time-varying depth grid support in v4! Let me know when you want a full review |
|
@wyatt-fluidnumerics - this looks awesome. One thing I noticed is that the z interpolation in time does not do any blending between Alternatively, I could be convinced to treat this as POC and work on pairing interpolators with coordinates, much like we do with |
…/Parcels into sigma-vertical-grid-support
for more information, see https://pre-commit.ci
Description
TODO list:
tauthrough_get_positionsinto the grid search).The goal for this PR is to provide support for sigma coordinate models that utilize unstructured grids.
In nearly all sigma coordinate models, it is possible to output the z value of each node, this is fairly essential for analysis that uses a z coordinate unless, the modeler chooses to plot entirely in sigma space, or reconstruct z themself. In this case, z has dimensions of (time, zf, n_node) for unstructured horizontal grids. We can utilize this field to advect particles in z coordinates for which the native model is in sigma coordinates (I believe this approach would work for ALE as well as long as a user has z coordinate output file, though I have not looked into this at all).
The primary change here is to optionally propagate
tifrom the time search into thesearch(..., ti=None)function itself, which allows for time and vertical column indexing of the z grid during the vertical grid search (i.e. at every time step each vertical column has unique z levels). On each of these columns the vertical search runs exactly the same as before. This allows_get_positionsto return barycentric coordinates back to interpolators in the exact same format as parcels does currently.Currently, this is only implemented for unstructured grids, though the only fundamental change for structured grids is that z would be 4d (t, x, y, z) instead of 3d (t, z, n_node). Additionally, nothing changes for standard z coordinate models that use a 1d vertical grid.
The changes to each file are the following:
_get_positionspasses the time index intogrid.searchti=None, XGrid search ignores thisThere is also a new tutorial
tutorial_unstructured_sigma_coordinates.ipynbwhich demonstrates the utility. Hopefully we will be able to replace the synthetic dataset with a model dataset (I am hoping to put together a schism run for this).This draft PR is just an initial stab at the implementation for the sake of initiating discussion, @fluidnumericsJoe and I have a whiteboard with ideas to polish things and improve the scalability, we'll have an issue open soon but the biggest thing is the following:
Gridobjects, and z would also somehow need to be a part of the grid. We think it could be a good idea to give vertical coordinates their own class. This would likely be very field like, and could even implement a system similar toto_windowed_array/'to_cached_chunked_array` so that the memory foot print is reduced.Checklist
mainfor normal development,v3-supportfor v3 support)AI Disclosure