2
$\begingroup$

I'm plotting velocity fields for fluid flow, and my call to Streamplot looks something like this:

StreamPlot[{vx[x, y], vy[x, y]} /. varVals, {x, -vizrange, 
  vizrange}, {y, -vizrange, vizrange}]

Based on the output, it looks like Mathematica integrates the vector field until the total path reaches some fixed length. Instead, I would like for it to integrate the field for a fixed number of steps, and then plot streamlines of whatever length results. This means that pathlines going through regions with faster fluid flow will appear longer.

Is the only option here to write my own fixed-step integrator? Thank you.

$\endgroup$
  • 2
    $\begingroup$ You might want to take a look at the StreamScale and StreamStyle options. Can you post a simple, minimal example for vx and vy for us to work with? You might also consider looking at VectorPlot, which by default scales the length of the vectors by the norm (I think) of the vector, which is essentially what you want, I think. $\endgroup$ – march Sep 4 '15 at 21:24
  • $\begingroup$ Thanks @march, I'll see if I can put together two reasonable vector fields. What I'm looking for is a little different than VectorPlot, since I essentially want the streamlines representing the paths traced out by particles in the velocity field. But I basically want to see the equivalent of a long-exposure photograph, where particles that move faster trace out longer paths. The default for this function appears to run each particle for a different amount of time, so that all the paths are the same length. $\endgroup$ – wil3 Sep 4 '15 at 21:53
  • $\begingroup$ Also, see this. $\endgroup$ – march Sep 4 '15 at 22:20
1
$\begingroup$

Perhaps

StreamPlot[Abs[y^2] {1, 0}, {x, 0, 3}, {y, 0, 9}, 
      StreamScale -> {Medium, 2, Automatic, #5 &}]

Mathematica graphics

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.