spacepy.pybats.trace2d¶
A set of routines for fast field line tracing. “Number crunching” is performed in C for speed.
Copyright 2010-2014 Los Alamos National Security, LLC.
Functions
Test streamline tracing by plotting vectors and associated streamlines through a simple velocity field where Vx=x, Vy=-y. |
|
Trace field lines through a dipole field to test the pybats.trace2d module. |
|
|
Given a 2D vector field, trace a streamline from a given point to the edge of the vector field. |
|
Given a 2D vector field, trace a streamline from a given point to the edge of the vector field. |
- spacepy.pybats.trace2d.test_asymtote()[source]¶
Test streamline tracing by plotting vectors and associated streamlines through a simple velocity field where Vx=x, Vy=-y.
- spacepy.pybats.trace2d.test_dipole()[source]¶
Trace field lines through a dipole field to test the pybats.trace2d module.
- spacepy.pybats.trace2d.trace2d_eul(fieldx, fieldy, xstart, ystart, gridx, gridy, maxstep=20000, ds=0.01)[source]¶
Given a 2D vector field, trace a streamline from a given point to the edge of the vector field. The field is integrated using Euler’s method. While this is faster than rk4, it is less accurate.
Only valid for regular grid with coordinates gridx, gridy. If gridx and gridy are not given, assume that xstart and ystart are normalized coordinates (e.g., position in terms of array indices.)
- spacepy.pybats.trace2d.trace2d_rk4(fieldx, fieldy, xstart, ystart, gridx, gridy, maxstep=20000, ds=0.01)[source]¶
Given a 2D vector field, trace a streamline from a given point to the edge of the vector field. The field is integrated using Runge Kutta 4. Slower than Euler, but more accurate. The higher accuracy allows for larger step sizes (ds kwarg). For a demonstration of the improved accuracy, run test_asymtote and test_dipole, bouth found in the pybats.trace2d module. Only valid for regular grid with coordinates gridx, gridy. If gridx and gridy are not given, assume that xstart and ystart are normalized coordinates (e.g., position in terms of array indices.)