pyvista.DataSetFilters.streamlines_evenly_spaced_2D#

DataSetFilters.streamlines_evenly_spaced_2D(vectors=None, start_position=None, integrator_type=2, step_length=0.5, step_unit='cl', max_steps=2000, terminal_speed=1e-12, interpolator_type='point', separating_distance=10, separating_distance_ratio=0.5, closed_loop_maximum_distance=0.5, loop_angle=20, minimum_number_of_loop_points=4, compute_vorticity=True, progress_bar=False)[source]#

Generate evenly spaced streamlines on a 2D dataset.

This filter only supports datasets that lie on the xy plane, i.e. z=0. Particular care must be used to choose a separating_distance that do not result in too much memory being utilized. The default unit is cell length.

Parameters:
vectorsstr, optional

The string name of the active vector field to integrate across.

start_positionsequence[float], optional

The seed point for generating evenly spaced streamlines. If not supplied, a random position in the dataset is chosen.

integrator_type{2, 4}, default: 2

The integrator type to be used for streamline generation. The default is Runge-Kutta2. The recognized solvers are: RUNGE_KUTTA2 (2) and RUNGE_KUTTA4 (4).

step_lengthfloat, default: 0.5

Constant Step size used for line integration, expressed in length units or cell length units (see step_unit parameter).

step_unit{‘cl’, ‘l’}, default: “cl”

Uniform integration step unit. The valid unit is now limited to only LENGTH_UNIT ('l') and CELL_LENGTH_UNIT ('cl'). Default is CELL_LENGTH_UNIT.

max_stepsint, default: 2000

Maximum number of steps for integrating a streamline.

terminal_speedfloat, default: 1e-12

Terminal speed value, below which integration is terminated.

interpolator_typestr, optional

Set the type of the velocity field interpolator to locate cells during streamline integration either by points or cells. The cell locator is more robust then the point locator. Options are 'point' or 'cell' (abbreviations of 'p' and 'c' are also supported).

separating_distancefloat, default: 10

The distance between streamlines expressed in step_unit.

separating_distance_ratiofloat, default: 0.5

Streamline integration is stopped if streamlines are closer than SeparatingDistance*SeparatingDistanceRatio to other streamlines.

closed_loop_maximum_distancefloat, default: 0.5

The distance between points on a streamline to determine a closed loop.

loop_anglefloat, default: 20

The maximum angle in degrees between points to determine a closed loop.

minimum_number_of_loop_pointsint, default: 4

The minimum number of points before which a closed loop will be determined.

compute_vorticitybool, default: True

Vorticity computation at streamline points. Necessary for generating proper stream-ribbons using the vtkRibbonFilter.

progress_barbool, default: False

Display a progress bar to indicate progress.

Returns:
pyvista.PolyData

This produces polylines as the output, with each cell (i.e., polyline) representing a streamline. The attribute values associated with each streamline are stored in the cell data, whereas those associated with streamline-points are stored in the point data.

Examples

Plot evenly spaced streamlines for cylinder in a crossflow. This dataset is a multiblock dataset, and the fluid velocity is in the first block.

>>> import pyvista as pv
>>> from pyvista import examples
>>> mesh = examples.download_cylinder_crossflow()
>>> streams = mesh[0].streamlines_evenly_spaced_2D(
...     start_position=(4, 0.1, 0.0),
...     separating_distance=3,
...     separating_distance_ratio=0.2,
... )
>>> plotter = pv.Plotter()
>>> _ = plotter.add_mesh(
...     streams.tube(radius=0.02), scalars="vorticity_mag"
... )
>>> plotter.view_xy()
>>> plotter.show()
../../../_images/pyvista-DataSetFilters-streamlines_evenly_spaced_2D-1_00_00.png

See 2D Streamlines for more examples using this filter.