Skip to content

Add util calculating the streamfunction for a velocity field#5367

Open
mncrowe wants to merge 1 commit intoCliMA:mainfrom
mncrowe:main
Open

Add util calculating the streamfunction for a velocity field#5367
mncrowe wants to merge 1 commit intoCliMA:mainfrom
mncrowe:main

Conversation

@mncrowe
Copy link
Copy Markdown

@mncrowe mncrowe commented Mar 4, 2026

Currently a blank PR. The ultimate goal is to implement a streamfunction calculation for the flow, using poisson inversion (and hopefully re-using the current pressure inversion code).

If the flow is purely 2D, we can get a nice streamfunction $(u, v) = (\partial_y \psi, -\partial_x \psi)$ by solving $\nabla^2\psi = -\zeta$ where $\zeta$ is vertial vorticity.

If the flow is 3D, we can't necessarily get a 2D streamfunction at each height, $z$, as the streamfunction implicitly assumes the flow is divergence free. E.g. Consider the strain flow $(u, v, w) = (\alpha x, \alpha y, -2\alpha z)$. A streamfunction would have $\partial_x \psi = -\alpha y$ and $\partial_y \psi = \alpha x$ so second order mixed derivatives ($\partial_x\partial_y \psi$) are inconsistent.

Instead we'd need a full Helmholtz decomposition: $\textbf{u} = \nabla \phi + \nabla \times \textbf{A}$. This is non-unique so we'd need to think about a gauge condition. It's probably best to use a Coulomb condition (set $\nabla\cdot \textbf{A} = 0$) so the inversion is $\nabla^2 \textbf{A} = -\nabla\times\textbf{u}$.

Things to note:

  • sign convention? Geostrophic streamfunction often uses opposite sign to traditional streamfunction to match the pressure (which can be thought of as a geostrophic streamfunction).
  • boundary conditions on $\psi$ or $\textbf{A}$? Presumbly dependent on the BCs of the fields?
  • If the BCs aren't the same as the pressure solver (which is likely), a modified solver might be needed.

@navidcy navidcy added the feature 🌟 Something new and shiny label Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature 🌟 Something new and shiny

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants