2D Helmholtz decomposition on a C grid

Given a vector field (u,v) on an Arakawa C grid, solve for the potential chi and streamfunction psi in (u,v) = grad[chi] + curl[psi]
216 Downloads
Aktualisiert 15. Jun 2022

Lizenz anzeigen

Perform Helmholtz decomposition of a 2D vector field (such as a velocity) whose components are staggered on the Arakawa C grid, solving for chi and psi in
(u,v) = grad[chi] + curl[psi].
The C grid variables are laid out around a central point chi_{i,j} as follows:
psi_{i,j+1}----v_{i,j+1}------psi_{i+1,j+1}
| | |
u_{i,j}-------chi_{i,j}-------u_{i+1,j}
| | |
psi_{i,j}------v_{i,j}--------psi_{i+1,j}
The domain can be periodic or not, and need not be simply connected (it can have holes).
Internally, the function will select the largest connected component. Only one connected component is handled at a time. If you wish to work on a different connected component, simply preselect it -- look at the lines involving CC2periodic(bwconncomp(...)) for how to do that.
The image shows the streamfunction psi of the horizontal velocity field in the ocean at 300m depth (data from OCCA). See the example script to reproduce this result.

Zitieren als

Geoff Stanley (2024). 2D Helmholtz decomposition on a C grid (https://www.mathworks.com/matlabcentral/fileexchange/75614-2d-helmholtz-decomposition-on-a-c-grid), MATLAB Central File Exchange. Abgerufen .

Kompatibilität der MATLAB-Version
Erstellt mit R2017a
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Veröffentlicht Versionshinweise
1.0.2

Example provided

1.0.1