Evenly Spaced Streamlines 2D

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.

4 Responses 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.

    • Dan Lipsa says:

      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.

      • 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.

        • Dan Lipsa says:

          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.

Questions or comments are always welcome!