Generate a 2D image of the velocity field for plotting
Parameters
Name
Type
Description
Default
soln
FlowResult
A FlowResult returned by solve_flow() or read_flow_vtr().
required
direction
str
Specifies which component of the velocity vector to plot. The default is “x”. “all” will plot the magnitude of the velocity (i.e. the sum of all velocity components)
'x'
axis
int
The direction where the 2D slice should be taken. The default is 2, meaning it views the domain in the z-direction, thus shows an ‘x-y’ plane.
2
streamlines
dict or None
If None (default), no streamlines are drawn. If a dict, plt.streamplot is called on the current axes using the in-plane velocity components at the slice midpoint. Any keys in the dict are forwarded as keyword arguments to plt.streamplot (e.g. {'color': 'white', 'density': 1.5}).
None
Returns
Name
Type
Description
velocity
ndarray
A 2D array with voxel value corresponding to the velocity.