Evenly Spaced Streamlines 2D

July 24, 2017

Motivation

VTK and ParaView provide visualization of vector fields through streamlines using vtkStreamTracer in VTK or Stream Tracer in ParaView. The ability of streamlines to create an effective visualization depends on two criteria: 1) placement of streamlines at locations where the flow needs to be visualized; and 2) Techniques to avoid streamlines crowding, as that may obstruct other visualization elements. Both randomly placing streamlines or placing them on a regular grid can lead to regions without any streamlines or regions that are too crowded.

Recently we merged in VTK – vtkEvenlySpacedStreamlines2D and ParaView – Evenly Spaced Streamlines 2D an implementation for evenly spaced streamlines for 2D datasets. This visualization method addresses both potential drawbacks of conventional streamline seeding strategies. It allows the user to control the density of streamlines while it provides good coverage of the domain. It avoids streamline crowding by terminating the current streamline when it gets too close to other streamlines. The following two images illustrate the differences between evenly spaced streamlines and randomly seeded streamlines. The first image shows equally spaced streamlines with arrow glyphs pointing to the direction of the flow.

Evenly Spaced Streamlines
Evenly spaced streamlines

The second image shows randomly seeded streamlines with approximately the same number of streamlines as the first image. Note that certain areas are not well covered while other areas are too crowded.

Randomly seeded streamlines
Randomly seeded streamlines

In the next section we present usage and implementation details for evenly spaced streamlines. We only show ParaView properties, VTK properties are easily deduced from those.

Usage

EvenlySpacedStreamlines2D works on 2D datasets parallel with the XY plane. You need to specify the StartPosition which represents the coordinates for the seed for the first streamline. From there on, all other seeds are determined automatically. The SeparatingDistance specifies how far from other streamlines a new streamline is started. SeparatingDistanceRatio specifies how close a streamline can get to other streamlines before it is terminated. If the current streamline gets closer than SeparatingDistance * SeparatingDistanceRatio to other streamlines integration stops. Loops are considered closed if they have two points at distance less than ClosedLoopMaximumDistance.

Attached is the ParaView State File used to generate the two images above and the dataset it operates on.

Implementation details

We implement the algorithm described in:
Jobard, Bruno, and Wilfrid Lefer. "Creating evenly-spaced streamlines of arbitrary density." Visualization in Scientific
Computing’97. Springer Vienna, 1997. 43-55.

The loop detection is described in:
Liu, Zhanping, Robert Moorhead, and Joe Groner. "An advanced evenly-spaced streamline placement algorithm." IEEE Transactions on Visualization and Computer Graphics 12.5 (2006): 965-972.
The algorithm works only on 2D datasets parallel with plane XY. It does not work in parallel because of its inherently serial seeding strategy. The streamlines are produced using vtkStreamTracer using only Runge-Kutta2 or Runge-Kutta4 integrators (we cannot use Runge-Kutta45 integrator). This is because the algorithm needs that points along a streamline be equally spaced. We added custom termination callbacks to vtkStreamTracer. This enables the integration to be terminated if streamlines are too close to other streamlines or if a loop is formed.

Acknowledgment

We are thankful to LLNL specifically Dean Williams for supporting this work.

12 comments to Evenly Spaced Streamlines 2D

  1. Dear,

    thanks for sharing the article!
    In my paraview (5.4.1) I cannot seem to load the Evenly Spaced Streamlines 2D package.
    Also not after enabling all plugins.

    Is this a custom plugin I need to download and add manually?

    Thanks for any pointers!

    Regards,

    Wouter.

    1. Hi Wouter,
      You don’t need a plugin for the EvenlySpacedStreamlines2D filter. It is directly available in ParaView. The best way to learn how to use this filter is to load the provided ParaView state file (use right-click Save Link as to save it) on the clt dataset.

      1. Dear Dan,

        thanks for the quick feedback!

        I tried both non-MPI and MPI versions of paraview 5.4.1 on windows and Linux.
        When I load the state file, I get errors like these:
        ERROR: In C:\bbd\7cc78367\build\superbuild\paraview\src\ParaViewCore\ServerImplementation\Core\vtkSIProxyDefinitionManager.cxx, line 526
        vtkSIProxyDefinitionManager (000002CDDBEC2750): No proxy that matches: group=filters and proxy=EvenlySpacedStreamlines2D were found.

        ERROR: In C:\bbd\7cc78367\build\superbuild\paraview\src\ParaViewCore\ServerManager\Core\vtkSMDeserializerXML.cxx, line 58
        vtkSMStateLoader (000002CE2E7EA070): Could not create a proxy of group: filters type: EvenlySpacedStreamlines2D

        If I go to filter->search I cannot find “EvenlySpacedStreamlines2D”.

        Do you have any other idea what might be wrong?

        Thanks!

        Wouter.

        1. Wouter, I just tried the Linux nightly builds and it works fine. Probably the evenly spaced streamlines were merged in after 5.4.1 was released.

  2. Hi,

    I tried this (using ParaView 5.5.0 precompiled binaries on ubuntu), but cannot get it to work on any other data than the dataset provided.
    Could you be more specific what type of data EvenlySpacedStreamlines2D needs?

    Best regards,
    Felix

    1. Felix, This works on plane XY (where XYZ are your Euclidian axes). I have a branch to make it work on any plane but I have not found the time to finish that work yet.

      1. Hi Dan,

        I really like this feature. The result is much nicer than typical streamlines.

        No pressure, but any idea when you might finish this branch so they work on any plane? Unless you know of a workaround, like transforming the dataset.

        Also, is there room to make it work on contours/iso-surfaces?

        Kind regards,
        Simon

  3. Dear Dan Lipsa,

    Thanks for the guidelines on the filter.

    My velocity field is 3D, with 13 layers in the Z direction. I wonder if there is any way to use this filter in this situation.

    Because in my analysis I will need the speed fields only in the first and last layer.

    Any suggestion?

    Thanks

  4. The vectors need to be in those planes as well or they need to be projected. If that is the case, it should work by choosing the starting point in one of those planes.

  5. Dear Dan,
    I am in a similar situation to that of Nayla.
    I have a 3D data set and I follow the path:

    calculate 2D vector using U_XiHat+U_YjHat
    take a 2D slice normal to z
    try to use the filter and he tells me I am not on a XY plane.

    Can you please give me a suggestion that might point me in the right direction?
    Thanks a lot.

    Joao

Leave a Reply to Simon WilliamsCancel reply