pyvista.DataSetFilters.streamlines_evenly_spaced_2D#
- DataSetFilters.streamlines_evenly_spaced_2D(
- vectors: str | None = None,
- start_position: VectorLike[float] | None = None,
- integrator_type: Literal[2, 4] = 2,
- step_length: float = 0.5,
- step_unit: Literal['cl', 'l'] = 'cl',
- max_steps: int = 2000,
- terminal_speed: float = 1e-12,
- interpolator_type: Literal['point', 'cell', 'p', 'c'] = 'point',
- separating_distance: float = 10.0,
- separating_distance_ratio: float = 0.5,
- closed_loop_maximum_distance: float = 0.5,
- loop_angle: float = 20.0,
- minimum_number_of_loop_points: int = 4,
- compute_vorticity: bool = True,
- progress_bar: bool = False,
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:
- vectors
str
,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_length
float
, 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_steps
int
, default: 2000 Maximum number of steps for integrating a streamline.
- terminal_speed
float
, default: 1e-12 Terminal speed value, below which integration is terminated.
- interpolator_type
str
,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_distance
float
, default: 10 The distance between streamlines expressed in
step_unit
.- separating_distance_ratio
float
, default: 0.5 Streamline integration is stopped if streamlines are closer than
SeparatingDistance*SeparatingDistanceRatio
to other streamlines.- closed_loop_maximum_distance
float
, default: 0.5 The distance between points on a streamline to determine a closed loop.
- loop_angle
float
, default: 20 The maximum angle in degrees between points to determine a closed loop.
- minimum_number_of_loop_points
int
, 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.
- vectors
- 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()
See 2D Streamlines for more examples using this filter.