Water Flow Tutorial Exploring the Velocity Vector Field

Exploring the Velocity Vector Field

We will now explore three ways to visualize the velocity vector field of the simulation.

Plotting the Velocity Field using Vector Plots

First we will directly plot the velocity vectors that exist on the mesh nodes.

  • Start with the basic tank boundaries and water sub-volume plots outlined previously.
  • Use the time slider to select timestep = 1 (The velocity at timestep = 0 is fully zero)
  • Add a Vector plot of U
  • Open the Vector plot attributes
  • On the 1st tab (Vectors), set the Stride to 30
  • On the 2nd tab (Data), select the RdYlBu color table
  • On the 3rd tab (Glyphs)
    • Set Scale to 0.75
    • Set Arrow body to Cylinder
    • Set Geometry Quality to High

Vector Plot Attributes (Vector Tab) Vector Plot Attributes (Data Tab) Vector Plot Attributes (Glyphs Tab)

  • Click Apply and Dismiss
  • Click Draw
  • Zoom in to explore the plot results.

Dbreak3d vec plot.png

The vector plot uses glyphs to draw portions of the instantaneous vector field. The arrows are colored according to the speed at each point (the magnitude of the velocity vector). Next we will look at a more advanced technique to visualize the flow of the velocity vector field.

Streamlines at the Advancing Interface

Streamlines visualize flow by advecting a set of massless particles, initially placed at user selected seed points, through an instantaneous vector field. In our simulation, as the column of water falls it quickly pushes the water at the bottom outward and it collides with a small ledge. We can use a Streamline plot to explore the water velocity field at the advancing water front.

First we want to get an idea of where the advancing portion of the water is:

  • Start with the basic tank boundaries and water sub-volume plots outlined previously.
  • Select the Pseudocolor plot of alpha1
  • Open the Query Window (Controls->Query)
  • Execute a SpatialExtents Query with Original Data selected

Dbreak3d sext orig.png

This gives us the full extent of the fluid simulation mesh:

(0, 0.584, 0, 0.584, 0, 0.584)
  • Now execute a SpatialExtents Query with Actual Data selected.

Dbreak3d sext act.png


This gives us the extents of just the water column:

 (0, 0.146, 0, 0.275799, 0, 0.3066

With this info in hand, we can create a Streamline plot with seed points near this interface.

  • Use the time slider to select time step = 1 (The velocity at time step = 0 is fully zero)
  • Add a Streamline plot of U
  • Open the Streamline attributes
    • Under the 1st tab (Streamlines)
      • Create a Plane source at
        • Origin: 0.148 0.15 0.15
        • Normal: 1 0 0
        • Up axis: 0 1 0
        • Samples in X: 8
        • Samples in Y: 5
        • Distance in X: 0.25
        • Distance in Y: 0.25
      • For termination:
        • Set Limit maximum time elapsed for particles to .1
    • Under the 2nd tab (Appearance)
      • Select the RdYlBlu color table
      • Draw as Tubes
      • Select Show heads and Display as Cone
      • Set the heads Radius to 0.012
      • Set the heads Height:Radius Ratio to 4
    • Under the 3rd tab (Advanced)
        • Turn off all warnings

Streamline Plot Attributes (Streamlines Tab) Streamline Plot Attributes (Appearance Tab) Streamline Plot Attributes (Advanced Tab)


  • Click Apply and Dismiss
  • Click Draw

At this point save your visualization session:

  • Save the session (File->Save session as)
    • Set the file name to dbreak3d_plot_streamlines.session

You can experiment with both advancing the time slider and moving the X-origin of the plane used to define the seed points.

  • Open the Streamline attributes
  • Select time step = 3
  • Under the 1st tab (Streamlines) set:
    • Origin: 0.18 0.025 0.15
    • Distance in Y: 0.05
  • Click Apply

Dbreak3d sline ts3.png

  • Select time step = 4:
  • Under the 1st tab (Streamlines) set:
    • Origin: 0.195 0.025 0.15
    • Distance in Y: 0.05
  • Click Apply

Dbreak3d sline ts4.png

  • Select time step = 5:
  • Open the Streamline attributes
  • Under the 1st tab(Streamlines) set:
    • Origin: 0.210 0.025 0.15
    • Distance in Y: 0.05
  • Click Apply

Dbreak3d sline ts5.png

You can also exaggerate the length by increasing the termination time -- however recall there are only 0.025 seconds between each timestep. To be a better visualize of how seed points travel though the vector field as it evolves over time, we will use a pathline technique.

Using Pathlines to Understand Time Varying Flow

Pathlines extend the advection / integral curve concept of streamlines to a time varying vector field. Using pathlines we can trace the paths massless particles would take from the start to the end of the simulation, using the velocity vector field data from all output files.

To do so, we first adjust to select seed points that are well embedded in the fluid column at the beginning of the simulation.

  • Start with the Streamline plot previously outlined (you can use your dbreak3d_plot_streamlines.session or the dbreak3d_plot_streamlines.py python script)
  • Set the timer slider to time step = 0
  • Open the Streamline attributes
    • Under the 1st tab (Streamlines)
      • Create a Plane source at
        • Origin: 0.12 0.1 0.15
        • Distance in X: 0.225
        • Distance in Y: 0.2
      • For termination:
        • Set Limit maximum time elapsed for particles to 2
    • In the 3rd tab (Advanced)
      • Select Pathline
      • Select Mesh is static over time
  • Click Apply and Dismiss

Dbreak3d pathlines t1.png


Dbreak3d pathlines t2.png


This will create paths that start at timestep=0 at our seed points and travel with the flow for 2 seconds to simulation time. (This will process may take a few seconds because it will process 80 data files)

Dbreak3d pathlines 2s.png

Pathlines expose the complex flow behavior of the velocity vector field.

Lets extend the termination time to the final time of the simulation.

  • Open the Streamline attributes
    • Under the 1st tab(Streamlines)
      • For termination:
        • Set Limit maximum time elapsed for particles to 4

Dbreak3d pathlines 4s.png

At this point save your visualization session:

  • Save the session (File->Save session as)
    • Set the file name to dbreak3d_plot_pathlines.session'


Animating pathlines with a python script

The Streamline plot allows you to crop away portions of paths without recomputing the streamlines or pathlines to help support integral curve animations. You can use the dbreak3d_pathlines_animate.py to animate our pathline visualization from 0 to 4 seconds.


import os
if not os.path.isfile("dbreak3d_animate_pathlines.py"):
    os.chdir("path/to/examples/dbreak3d")
Source("dbreak3d_animate_pathlines.py")

You can easily execute this script using the Commands Window (Controls->Command)

Dbreak3d pathlines animate py.png