6.3.5 Streamline Chart

1. Streamline Plot

Streamlines are a family of curves that are instantaneously tangent to the velocity vector of the flow. These show the direction in which a massless fluid element will travel at any point in time.

Streamlines can be useful in fluid dynamics. For example, Bernoulli's principle, which describes the relationship between pressure and velocity in an inviscid fluid, is derived for locations along a streamline.

It needs to provide:

  • uniformly spaced ranges of x and y values (1D)

  • 2-D velocity values u and v defined on the cross-product (np.meshgrid(x, y)) of x and y.

Basic streamline plot

import plotly.figure_factory as ff
import numpy as np

x = np.linspace(-2, 2, 100)
y = np.linspace(-2, 2, 100)
Y, X = np.meshgrid(x, y)
u = -2 - X**2 + Y
v = 2 + X - Y**2

# Create streamline figure
fig = ff.create_streamline(x, y, u, v, arrow_scale=.2)
fig.show()
Basic Streamline Plot

Streamline with source points

Streamline with source points

2. Quiver Plot

A quiver plot displays velocity vectors as arrows with components (u,v) at the points (x,y). This type of plot is useful in electrical engineers to visualize electrical potential and show stress gradients in Mechanical engineering.

Basic quiver plot

Basic Quiver Plot

Quiver plot with source points

Just like the streamline plot, it is also possible to add source points to a quiver plot.

Quiver plot with source points

3. 3-D Quiver Plot

To make the graph more interesting and intuitive, we can draw a 3-D quiver plot, which is also called the "cone plot". Cone plots (also known as 3-D quiver plots) represent vector fields defined in some region of the 3-D space.

A vector field associates to each point of coordinates (x, y, z) a vector of components (u, v, w).

Simple 3-D quiver plot

Customized 3-D quiver plot

Last updated

Was this helpful?