pyvista.DataSetFilters.streamlines_from_source#

DataSetFilters.streamlines_from_source(
source,
vectors=None,
integrator_type=45,
integration_direction='both',
surface_streamlines=False,
initial_step_length=0.5,
step_unit='cl',
min_step_length=0.01,
max_step_length=1.0,
max_steps=2000,
terminal_speed=1e-12,
max_error=1e-06,
max_time=None,
compute_vorticity=True,
rotation_scale=1.0,
interpolator_type='point',
progress_bar=False,
)[source]#

Generate streamlines of vectors from the points of a source mesh.

The integration is performed using a specified integrator, by default Runge-Kutta2. This supports integration through any type of dataset. If the dataset contains 2D cells like polygons or triangles and the surface_streamlines parameter is used, the integration is constrained to lie on the surface defined by 2D cells.

Parameters:
sourcepyvista.DataSet

The points of the source provide the starting points of the streamlines. This will override both sphere and line sources.

vectorsstr, optional

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

integrator_type{45, 2, 4}, default: 45

The integrator type to be used for streamline generation. The default is Runge-Kutta45. The recognized solvers are: RUNGE_KUTTA2 (2), RUNGE_KUTTA4 (4), and RUNGE_KUTTA45 (45). Options are 2, 4, or 45.

integration_directionstr, default: “both”

Specify whether the streamline is integrated in the upstream or downstream directions (or both). Options are 'both', 'backward', or 'forward'.

surface_streamlinesbool, default: False

Compute streamlines on a surface.

initial_step_lengthfloat, default: 0.5

Initial step size used for line integration, expressed ib length unitsL or cell length units (see step_unit parameter). either the starting size for an adaptive integrator, e.g., RK45, or the constant / fixed size for non-adaptive ones, i.e., RK2 and RK4).

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.

min_step_lengthfloat, default: 0.01

Minimum step size used for line integration, expressed in length or cell length units. Only valid for an adaptive integrator, e.g., RK45.

max_step_lengthfloat, default: 1.0

Maximum step size used for line integration, expressed in length or cell length units. Only valid for an adaptive integrator, e.g., RK45.

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.

max_errorfloat, 1e-6

Maximum error tolerated throughout streamline integration.

max_timefloat, optional

Specify the maximum length of a streamline expressed in LENGTH_UNIT.

compute_vorticitybool, default: True

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

rotation_scalefloat, default: 1.0

This can be used to scale the rate with which the streamribbons twist.

interpolator_typestr, default: “point”

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

progress_barbool, default: False

Display a progress bar to indicate progress.

Returns:
pyvista.PolyData

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

See the Streamlines example.