streamlines_from_source

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

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}, optional

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. Default is 45.

integration_directionstr, optional

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

surface_streamlinesbool, optional

Compute streamlines on a surface. Default False.

initial_step_lengthfloat, optional

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’}, optional

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: 'cl'.

min_step_lengthfloat, optional

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, optional

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, optional

Maximum number of steps for integrating a streamline. Defaults to 2000.

terminal_speedfloat, optional

Terminal speed value, below which integration is terminated.

max_errorfloat, optional

Maximum error tolerated throughout streamline integration.

max_timefloat, optional

Specify the maximum length of a streamline expressed in LENGTH_UNIT.

compute_vorticitybool, optional

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

rotation_scalefloat, optional

This can be used to scale the rate with which the streamribbons twist. The default is 1.

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

progress_barbool, optional

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.