TRISTREAM Trace streamlines on a triangular mesh using nodal velocities
FlowP=TriStream(tri,x,y,u,v,x0,y0) computes streamlines on the triangular mesh specified by tri with nodal coordinates [x,y]. Streamlines are traced using the nodal velocities u and v, and one streamline is produced for each seed point in the input vectors [x0,y0]. Streamlines are traced until one of four conditions is met: 1) The particle travels beyond the mesh. 2) The particle intersects its own path, creating a cycle. 3) The particle enters a stagnant zone (U~V~0). 4) A maximum number of iterations is exceeded. The output of TRISTREAM is a structure array, FlowP, containing particle flowpaths, and can be displayed using PLOTTRISTREAM.
TRISTREAM follows the approach outlined in the paper "Efficient Streamline Computations on Unstructured Grids" by Mihai Dorobantu
This algorithm uses a second-order Runge-Kutta method to integrate particle paths with adaptive pseudo-time-stepping.