tracers module

Warning! EXPERIMENTAL:

these features and functions are under development, will have bugs, and may be heavily modified in the future

Tracer particles in a vector field Uses a KDTree to find nearest vector to advect the particles

  • Requires scipy.spatial

Module Summary

functions:

tracers.trace_particles

Take a list of tracer vertices and matching velocity grid points (verts) & vectors (vecs) For each tracer

classes:

tracers.TracerState

Module Details

functions:

trace_particles(state, verts, vecs, N=5000, limit=0.5, speed=1.0, noise=0.0, height=None)[source]

Take a list of tracer vertices and matching velocity grid points (verts) & vectors (vecs) For each tracer

  • find the nearest velocity grid point

  • if within max dist: Multiply position by velocity vector

  • otherwise: Generate a new start position for tracer

Parameters:
  • state (TracerState) – Object returned from first call, pass None on first pass

  • verts (array or list) – vertices of the vector field

  • vecs (array or list) – vector values of the vector field

  • N (int) – Number of particles to seed

  • limit (float) – Distance limit over which tracers are not connected, For example if using a periodic boundary, setting limit to half the bounding box size will prevent tracer lines being connected when passing through the boundary

  • speed (float) – Speed multiplier, scaling factor for the velocity taken from the vector values

  • noise (float) – A noise factor, if set a random value is generated, multiplied by noise factor and added to each new position

  • height (float) – A fixed height value, all positions will be given this height as their Z component

Returns:

Object to hold the tracer state and track particles Pass this as first paramter on subsequent calls

Return type:

TracerState

classes:

class TracerState(verts, N=5000)[source]

Bases: object