pyoculus.fields.two_waves

two_waves.py

Perturbed slab model described in S.R. Hudson, Phys. Plasmas 11, 677 (2004).

authors:
class pyoculus.fields.two_waves.TwoWaves(k=0.002)

A very simple (but still hard) system described in S.R. Hudson, Phys. Plasmas 11, 677 (2004).

The model mimics the behavior of magnetic fields in a two-wave system. The magnetic field is defined as:

\[\mathbf{B} = \nabla \rho \times \nabla \theta + \nabla\phi\times \nabla\chi(\rho, \theta, \phi)\]

The Hamiltonian \(\chi\) associated to the magnetic field is:

\[\chi(\rho, \theta, \phi) = \frac{\rho^2}{2} - k \left[ \frac{1}{2} \cos (2\theta - \phi) + \frac{1}{3} \cos(3\theta - 2\phi) \right]\]

The components of the magnetic fields are thus given by:

\[B^\rho = - k \left[ \sin (2\theta - \phi) + \sin(3\theta - 2\phi)\right], \quad B^\theta = \rho , \quad B^\phi = 1\]

And using the \(\phi\) variable as a time variable of the Hamiltonian system gives for the derivatives of \(\rho, \theta\):

\[\dot{\rho} = \frac{B^\rho}{B^\phi} \quad \dot{\theta} = \frac{B^\theta}{B^\phi}\]
k

Parameter giving the strength of the perturbation.

Type:

float

property k

Parameter giving the strength of the perturbation.

B(coords, *args)

! Returns magnetic fields @param coordinates @param *args extra parameters @returns the contravariant magnetic fields

dBdX(coords, *args)

! Returns magnetic fields @param coordinates @param *args extra parameters @returns B, dBdX, the contravariant magnetic fields, the derivatives of them

A(coords, *args)

Returns the contravariant components of the vector potential at given coordinates.

Parameters:
  • coords (array) – The coordinates at which to calculate the vector potential.

  • *args – Additional parameters.

convert_coords(incoords)
! Convert coordinates for Poincare plots

@param incoords

$(p,q,t) $

@returns

$(p,q mbox{mod} 2pi,t mbox{mod} 2pi) $

B_many(x1arr, x2arr, x3arr, input1D=True, *args)

! Returns magnetic fields, with multipy coordinate inputs @param x1arr the first coordinates. Should have the same length as the other two if input1D=True. @param x2arr the second coordinates. Should have the same length as the other two if input1D=True. @param x3arr the third coordinates. Should have the same length as the other two if input1D=True. @param input1D if False, create a meshgrid with sarr, tarr and zarr, if True, treat them as a list of points @param *args extra parameters @returns the contravariant magnetic fields

dBdX_many(x1arr, x2arr, x3arr, input1D=True, *args)

! Returns magnetic fields @param x1arr the first coordinates. Should have the same length as the other two if input1D=True. @param x2arr the second coordinates. Should have the same length as the other two if input1D=True. @param x3arr the third coordinates. Should have the same length as the other two if input1D=True. @param input1D if False, create a meshgrid with sarr, tarr and zarr, if True, treat them as a list of points @param *args extra parameters @returns B, dBdX, the contravariant magnetic fields, the derivatives of them