2D Helmholtz decomposition on a C grid
Version 1.0.2 (5,56 ko) par
Geoff Stanley
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]
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.
Citation pour cette source
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. Récupéré le .
Compatibilité avec les versions de MATLAB
Créé avec
R2017a
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS LinuxTags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Découvrir Live Editor
Créez des scripts avec du code, des résultats et du texte formaté dans un même document exécutable.
Version | Publié le | Notes de version | |
---|---|---|---|
1.0.2 | Example provided |
||
1.0.1 |