Streamlines
Generates smooth streamlines (particle traces) through any vector field. Regular grids (e.g. Fast CFD) are read directly with bilinear interpolation; scattered points use Inverse Distance Weighting. 4th-order Runge-Kutta integration, optional speed-coloured tubes.
Overview
Generates smooth streamlines (particle traces) through any vector field using Inverse Distance Weighting.
Inputs (12)
- FieldPoints (Point): The locations of the vector field data
- FieldVectors (Vector): The vectors corresponding to each FieldPoint
- SeedPoints (Point): The starting locations for the streamlines
- StepSize (Number): Distance to move per integration step
- MaxSteps (Integer): Maximum number of steps per streamline (per direction)
- SearchRadius (Number): Scattered points only: radius to search for blending local vectors (ignored for regular grids)
- MoveUp (Number): Visual Z-offset to prevent clashing with the analysis mesh
- Direction (Integer): 1 = both ways from each seed (default), 0 = downstream only, -1 = upstream only
- MinSpeed (Number): Lines stop where the field is slower than this (m/s)
- TubeRadius (Number): Radius of the speed-coloured tube mesh (0 = no tubes)
- Palette (Text): Tube colours by local speed (palette name, e.g. Wind, Turbo, Viridis)
- Run (Boolean): Optional. False = skip the analysis and keep showing the last results (cached). Share one toggle with the Analysis Dashboard to switch everything on/off together.
Outputs (5)
- Streamlines (Curve): The generated streamline curves
- Info (Text): Component documentation and stats
- Speeds (Number): Local field speed at every streamline vertex (one branch per streamline)
- Tubes (Mesh): One mesh of tubes coloured by local speed (needs TubeRadius > 0)
- Dashboard Data (Text): JSON legend payload for the tube colours
Method, assumptions and simplifications
The same notes appear in the component's Info output.
Method
- Field: if FieldPoints lie on a regular XY lattice (holes allowed, spacing = most common gap between coordinates, 5 % tolerance), vectors are read with bilinear interpolation from the 4 surrounding cells, needing at least 3 of them. Otherwise inverse distance weighting with weights 1 / d² over points within SearchRadius in plan is used.
- Only the X and Y components of FieldVectors are used; the ground height Z is interpolated the same way so lines drape over the field points.
- From each SeedPoint a line is integrated with 4th-order Runge-Kutta on the unit direction field, so each step advances StepSize along the line; Direction 1 traces upstream and downstream and joins them, 0 downstream only, −1 upstream only.
- A line stops when it leaves the field (or reaches a missing grid cell such as a building), local speed drops below MinSpeed, it stalls, it returns within StepSize / 2 of its seed after more than 8 steps, or after MaxSteps.
- Points are lifted by MoveUp. Speeds are the local vector magnitudes at each vertex; with TubeRadius above 0 a 6-sided tube mesh is built, coloured by speed between the overall minimum and maximum using Palette (default Wind).
Assumptions
- FieldVectors are velocities in m/s (MinSpeed and the legend use m/s).
- The flow is essentially horizontal (2.5D).
Simplifications and limits
- Steady field: lines are streamlines of a single snapshot, not particle paths through time-varying flow.
- Inverse distance weighting smooths the field and does not respect obstacles; with scattered points lines stop at buildings only if no field point lies within SearchRadius.
- Tube colours are relative to the speed range of this run.
Workflow
- Fast CFD or a wind engine grid points and vectors -> FieldPoints and FieldVectors; seed points along the upwind edge -> SeedPoints.
- Tubes -> preview; Dashboard Data -> Legend Geometry.
References
- Press W.H. et al., Numerical Recipes: classical 4th-order Runge-Kutta integration.
- Shepard D. (1968), A two-dimensional interpolation function for irregularly-spaced data (inverse distance weighting).