1
$\begingroup$

I have a discrete two-dimensional velocity field $(u,v)$ given by (as an example)

Table[{Sin[i], Cos[i]}, {i, 0, 8 \[Pi], 0.5}, {j, 0, 8 \[Pi], 0.5}]

I can plot the streamlines using ListStreamPlot. However, say that I want to find the streamfunction $\Psi$ and from that plot the streamlines manually by finding the curves where $\Psi=constant$. In order to find $\Psi$ I then have to solve the equations

$$ udy = d\Psi \\ vdx = -d\Psi $$

However, how do I integrate these equations using my discrete velocity field?

My suggestion: Start with the first velocity component and at the first point, $u(i=1,j=1)$, and sum this along the $y$-direction, i.e. along $j$. This gives me $\Psi$ along the line $i=1$. This I can do for all $i$, and similarly for all $j$. I don't this is correct though, as it would give me two different values of $\Psi$ for a given $(i,j)$, one for $u$ and one for $v$.

$\endgroup$
  • 1
    $\begingroup$ A stream function only exists if the velocity field is divergence-free. In that case, in principle you should get the same value of $\Psi$ both ways because the integral becomes path-independent. However I don't know if that remains true for discretized data due to numerical error; maybe you want to find a least-squares solution. $\endgroup$ – Rahul Sep 30 '16 at 20:37
  • 2
    $\begingroup$ I guess your original velocity field is not divergence-free because Div[{Sin[i], Cos[i]}, {i, i}] gives Cos[i] and not 0. Therefore it does not have a stream function. If you did {Sin[j], Cos[i]} instead it would be divergence-free. $\endgroup$ – Rahul Sep 30 '16 at 22:08
  • $\begingroup$ @Rahul I tried with {Sin[j], Cos[i]} instead, but I don't get the same answer when summing along x and y. Do you know how to get a streamfunction from this discrete velocity field? $\endgroup$ – BillyJean Oct 1 '16 at 7:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.