pyoculus.fields.spectre_bfield
- class pyoculus.fields.spectre_bfield.SpectreBfield(SPECTRE_helper, lvol)
SPECTRE magnetic field class, which directly interfaces to a SPECTRE object in python memory
This class only deals with a single SPECTRE volume at a time, in which the field is given in s, theta, zeta coordinates. The radial coordinate s goes from -1 to 1. Theta and zeta coordinates from 0 to 2 pi.
This class is a wrapper around the SPECTRE_helper, provided by the SPECTRE code, which provides the functions to evaluate the magnetic field at given coordinates.
- classmethod from_h5_file(h5_file, lvol)
Initialize the SPECTRE magnetic field from a h5 file
- Parameters:
h5_file (str) – The path to the h5 file containing the SPECTRE data.
lvol (int) – The index of the SPECTRE volume to use, starting from 0.
- Returns:
The initialized SPECTRE magnetic field object.
- Return type:
- B(coords)
Returns the contravariant magnetic fields at the given coordinates.
- Parameters:
coords (array) – The coordinates at which to calculate the magnetic fields.
*args – Additional parameters.
- dBdX(coords)
Returns the contravariant components of the magnetic fields and their derivatives at the given coordinates.
- Parameters:
coords (array) – The coordinates at which to calculate the magnetic fields and their derivatives.
*args – Additional parameters.
- Returns:
The contravariant components of the magnetic field array: The contravariant components of the derivative of the magnetic fields
- Return type:
array
- A(coords)
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.