pyoculus.maps.tokamap

tokamap.py Contains the class Tokamap described in: Balescu, Radu, Mǎdǎlina Vlad, and F. Spineanu. “Tokamap: A Hamiltonian twist map for magnetic field lines in a toroidal geometry.” Physical Review E 58.1 (1998): 951.

This is a map that is slightly more complex than the standard map or the nontwist map, but is a two-dimensional iterated map for which it is easier to define the (monotonic) twist profile or safety factor profile.

Functions

return_f_t_pure(t)

return a pure (jax-transformable) function for the t-times applied map Used to automatically differentiate the map and get the gradients

tokamap_f_pure(y, K, w)

Tokamap as described in: Balescu, Radu, Mǎdǎlina Vlad, and F.

tokamap_frev_pure(y, K, w)

Inverse of the Tokamap as described in: Balescu, Radu, Mǎdǎlina Vlad, and F.

pyoculus.maps.tokamap.tokamap_f_pure(y, K, w)

Tokamap as described in: Balescu, Radu, Mǎdǎlina Vlad, and F. Spineanu. “Tokamap: A Hamiltonian twist map for magnetic field lines in a toroidal geometry.” Physical Review E 58.1 (1998): 951.

with W(psi) the winding function monotonically increasing from w up.

pyoculus.maps.tokamap.tokamap_frev_pure(y, K, w)

Inverse of the Tokamap as described in: Balescu, Radu, Mǎdǎlina Vlad, and F. Spineanu. “Tokamap: A Hamiltonian twist map for magnetic field lines in a toroidal geometry.” Physical Review E 58.1 (1998): 951.

The theta funtion is not directly invertible, so a simple Newtons method with analytical derivatives is used to solve for the inverse.

with W(psi) the winding function monotonically increasing from w up.

pyoculus.maps.tokamap.return_f_t_pure(t)

return a pure (jax-transformable) function for the t-times applied map Used to automatically differentiate the map and get the gradients

Note that for reverse mappings, we have to differentiate through a Newtons iteration, so the accuracy is probably bad.

class pyoculus.maps.tokamap.TokaMap(K=0, w=0.666)

two-dimensional iterated map described in: Balescu, Radu, Mǎdǎlina Vlad, and F. Spineanu. “Tokamap: A Hamiltonian twist map for magnetic field lines in a toroidal geometry.” Physical Review E 58.1 (1998): 951.

This is a map that is slightly more complex than the standard map or the nontwist map, but is a two-dimensional iterated map for which it is easier to define the (monotonic) twist profile or safety factor profile.

f(t, y0)

This method represents the mapping function. It takes a point \(y_0\) in the domain and returns its image under \(t\) application of the map.

Parameters:
  • t (float or int) – The number of times the map is applied.

  • y0 (array) – The initial point in the phase space.

df(t, y0)

Computes the Jacobian matrix of the map at \(y_0\) after \(t\) applications \(df^t = (\frac{\partial f^t}{\partial x})_{i,j}\).

Uses a cache to avoid re-creating and re-compiling functions.