pencil.calc.streamlines

Traces streamlines of a vector field from z0 to z1, similar to ‘streamlines.f90’.

Classes

Stream

Contains the methods and results for the streamline tracing for a field on a grid.

Module Contents

class pencil.calc.streamlines.Stream(field, params, xx=(0, 0, 0), time=(0, 1), metric=None, splines=None)

Bases: object

Contains the methods and results for the streamline tracing for a field on a grid.

Trace a field starting from xx in any rectilinear coordinate system with constant dx, dy and dz and with a given metric.

call signature:

tracer(field, params, xx=[0, 0, 0], time=[0, 1], metric=None, splines=None):

Keyword arguments:

field:

Vector field which is integrated over with shape [n_vars, nz, ny, nx]. Its elements are the components of the field using unnormed unit-coordinate vectors.

params:

Simulation and tracer parameters.

xx:

Starting point of the field line integration with starting time.

time:

Time array for which the tracer is computed.

metric:

Metric function that takes a point [x, y, z] and an array of shape [3, 3] that has the comkponents g_ij. Use ‘None’ for Cartesian metric.

splines:

Pre-computed spline coefficients for tricubic interpolation. This can speed up the calculations greatly for repeated streamline tracing on the same data. Should be computed using scipy.ndimage.spline_filter with order=3 for each vector component, i.e.:

splines = np.array([spline_filter(field[0], order=3),

spline_filter(field[1], order=3), spline_filter(field[2], order=3)])

params
xx = (0, 0, 0)
time = (0, 1)
section_l
total_l
iterations
section_dh
total_h = 1