The Open FUSION Toolkit 1.0.0-6f445ef
An open-source framework for fusion and plasma science and engineering
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
torus_fourier_sensor Class Reference

Detailed Description

Interface that sets up normal magnetic field probes at a desired surface, Fourier analyze the signals, and output them for GPEC.

Public Member Functions

 __init__ (self, radial_positions, axial_positions, major_radius, helicity)
 Initialize the interface with surface.
 
 convert_to_polar (self)
 Converts (R,Z) to (theta,r) with respect to a major radius.
 
 fft2 (self, B, hamada_dphi=None)
 Performs a 2D Fast Fourier Transform in PEST/Hamada coordinates on the magnetic field matrix probed by sensors with proper Nyquist handling.
 
 field_fourier_amplitude_contour (self, t, m_min, m_max, n_min, n_max, fig, ax, hamada_dphi=None, part='r')
 Plot the real fourier amplitude of the magnetic field in the fourier space.
 
 get_B_mesh (self, t)
 Extract the mesh of magnetic sensor values at a t time step.
 
 ifft2 (self, B_n, hamada_dphi=None)
 Performs an inverse 2D Fast Fourier Transform in PEST/Hamada coordinates on the transformed magnetic field matrix with proper Nyquist handling.
 
 load_histfile (self, hist_file_path='floops.hist', norm=None)
 Loading histfile containing magnetic values at the surface collected by sensors.
 
 place_normal_sensors (self, nphi=15, filename='floops.loc', ax=None)
 Place normal sensors on the ThinCurr object.
 
 plot_1D_fourier_amplitude (self, t, harmonics, ax, toroidal_harmonics=True, hamada_dphi=None, part='r')
 Plot real fourier amplitude of 1D Fast Fourier Transform of the magnetic mesh in axis at time step t
 
 plot_2D_fourier_amplitude (self, t, harmonics, ax, toroidal_harmonics=True, hamada_dphi=None, x_type='modes', x_mode_min=None, x_mode_max=None)
 Plot the 2D Fast Fourier Transformed amplitude of the mesh of magnetic values against poloidal/toroidal harmonics/angles.
 
 plot_inverse_2D_fourier_transform (self, t, fig, ax)
 Use ifft2 to reconstruct the sensor signal at time step t
 
 plot_m_over_n_amplitude (self, m_list, n_list, t_max, dt, ax, t_min=0, hamada_dphi=None)
 Plot the 2D Fast Fourier Transformed amplitude of the magnetic field for m/n (poloidal harmonic / toroidal harmonic) mode with respect to time.
 
 plot_sensor_output (self, t, fig, ax)
 Plot the magnetic field contour of the sensors on the surface at time step t
 
 plot_sensor_output_on_surface (self, t, figs, axes)
 Plot the normal magnetic field on the surface at time step t
 
 plot_sensor_signal_against_angle (self, t, ax, theta=True)
 Plot the value of normal magnetic fields over theta/phi at at phi/theta = 0.
 
 save_surfmn (self, t, filename, eliminate_negative_n=True, scale=1e-4, hamada_dphi=None)
 Sort the Fast Fourier Transformed B mesh in PEST or Hamada coordinate at time step t and write it to a SURFMN-formatted file.
 
 sort_fft_indices_and_mesh (self, B_n_fft, n_modes, m_modes)
 Sort the Fourier Transformed B mesh and the poloidal and toroidal mode numbers generated by the FFT functions in this class while considering helicity.
 

Public Attributes

 axial_positions
 
 helicity
 
 hist_file
 
 major_radius
 
 nphi
 
 ntheta
 
 radial_positions
 
 theta_list
 

Constructor & Destructor Documentation

◆ __init__()

__init__ (   self,
  radial_positions,
  axial_positions,
  major_radius,
  helicity 
)

Initialize the interface with surface.

Parameters
radial_positionsThe R coordinates that defines the surface [ntheta]
axial_positionsThe Z coordinates that defines the surface [ntheta]
major_radiusThe major radius of the device
helicitySign of the plasma helicity

Member Function Documentation

◆ convert_to_polar()

convert_to_polar (   self)

Converts (R,Z) to (theta,r) with respect to a major radius.

◆ fft2()

fft2 (   self,
  B,
  hamada_dphi = None 
)

Performs a 2D Fast Fourier Transform in PEST/Hamada coordinates on the magnetic field matrix probed by sensors with proper Nyquist handling.

Parameters
BInput matrix of shape [ntheta,nphi]
hamada_dphiHamada phase shifts [ntheta]
Returns
B_n The Fast Fourier Transformed matrix [ntheta,nphi], n_modes The toroidal mode numbers [nphi], m_modes The poloidal mode numbers [ntheta]

◆ field_fourier_amplitude_contour()

field_fourier_amplitude_contour (   self,
  t,
  m_min,
  m_max,
  n_min,
  n_max,
  fig,
  ax,
  hamada_dphi = None,
  part = 'r' 
)

Plot the real fourier amplitude of the magnetic field in the fourier space.

Parameters
tThe time step during the time evolution
m_minThe lower limit of the poloidal harmonics to be included in the contour
m_maxThe upper limit of the poloidal harmonics to be included in the contour
n_minThe lower limit of the toroidal harmonics to be included in the contour
n_maxThe upper limit of the toroidal harmonics to be included in the contour
figMatplotlib figure for plotting
axMatplotlib axis for plotting
hamada_dphiHamada phase shifts [ntheta]
partThe part of the fourier amplitude to be plotted ('r' for real, 'i' for imaginary, 'a' for absolute)
Returns
cf The contour plot of the real fourier amplitude of the magnetic field in the fourier space
cbar The colorbar of the contour plot

◆ get_B_mesh()

get_B_mesh (   self,
  t 
)

Extract the mesh of magnetic sensor values at a t time step.

Parameters
tThe time step at which the sensor values are extracted from sensor_file
Returns
sensor_mesh Sensor values on a (theta,phi) mesh [ntheta,nphi]

◆ ifft2()

ifft2 (   self,
  B_n,
  hamada_dphi = None 
)

Performs an inverse 2D Fast Fourier Transform in PEST/Hamada coordinates on the transformed magnetic field matrix with proper Nyquist handling.

Parameters
B_nInput FFT'ed matrix of shape [ntheta,nphi]
hamada_dphiHamada phase shifts [ntheta]
Returns
B_ifft The reconstructed matrix [ntheta,nphi]

◆ load_histfile()

load_histfile (   self,
  hist_file_path = 'floops.hist',
  norm = None 
)

Loading histfile containing magnetic values at the surface collected by sensors.

Parameters
hist_file_pathPath to the histfile containing sensor values
normNormalization factor to be applied to the sensor values

◆ place_normal_sensors()

place_normal_sensors (   self,
  nphi = 15,
  filename = 'floops.loc',
  ax = None 
)

Place normal sensors on the ThinCurr object.

Parameters
nphiThe number of poloidal planes to be probed by sensors in the toroidal direction
filenameThe name of the file storing ThinCurr sensors
axMatplotlib axis for plotting
Returns
line The line object of the surface with outward normal vectors plotted on ax if it is provided

◆ plot_1D_fourier_amplitude()

plot_1D_fourier_amplitude (   self,
  t,
  harmonics,
  ax,
  toroidal_harmonics = True,
  hamada_dphi = None,
  part = 'r' 
)

Plot real fourier amplitude of 1D Fast Fourier Transform of the magnetic mesh in axis at time step t

Parameters
tThe time step during the time evolution
harmonicsArray of mode number in the axis dimension, whose real amplitudes are to be plotted against the other dimension [:]
axMatplotlib axis for plotting
toroidal_harmonicsWhether the input harmonics is toroidal or poloidal harmonics
hamada_dphiHamada phase shifts [ntheta]
partThe part of the fourier amplitude to be plotted ('r' for real, 'i' for imaginary, 'a' for absolute)
Returns
line_list The list of line objects for each harmonic in harmonics
FFTed_mesh The 1D FFTed mesh in the direction desired [ntheta,nphi]

◆ plot_2D_fourier_amplitude()

plot_2D_fourier_amplitude (   self,
  t,
  harmonics,
  ax,
  toroidal_harmonics = True,
  hamada_dphi = None,
  x_type = 'modes',
  x_mode_min = None,
  x_mode_max = None 
)

Plot the 2D Fast Fourier Transformed amplitude of the mesh of magnetic values against poloidal/toroidal harmonics/angles.

Parameters
tThe time step during the time evolution
harmonicsList of (poloidal/toroidal) modes whose amplitudes are to be visualized in y axis [:]
axMatplotlib axis for plotting
toroidal_harmonicsWhether the input harmonics is toroidal or poloidal harmonics
hamada_dphiHamada phase shifts [ntheta]
x_typeThe variable on x axis ('modes' or 'angles')
x_mode_minThe min of the (toroidal/poloidal) mode number to be visualized on x axis
x_mode_maxThe max of the (toroidal/poloidal) mode number to be visualized on x axis
Returns
real_line_list The list of line objects of real amplitudes for each harmonic in harmonics
imag_line_list The list of line objects of imaginary amplitudes for each harmonic in harmonics

◆ plot_inverse_2D_fourier_transform()

plot_inverse_2D_fourier_transform (   self,
  t,
  fig,
  ax 
)

Use ifft2 to reconstruct the sensor signal at time step t

Parameters
tThe time step of the sensor signals at which fft and ifft is to be performed
figMatplotlib figure for plotting
axMatplotlib axis for plotting
Returns
cf The contour plot of the reconstructed sensor signals on the surface at time step t
cbar The colorbar of the contour plot

◆ plot_m_over_n_amplitude()

plot_m_over_n_amplitude (   self,
  m_list,
  n_list,
  t_max,
  dt,
  ax,
  t_min = 0,
  hamada_dphi = None 
)

Plot the 2D Fast Fourier Transformed amplitude of the magnetic field for m/n (poloidal harmonic / toroidal harmonic) mode with respect to time.

Parameters
m_listThe list of m of the m/n modes to be visualized [:]
n_listThe (list of) n of the m/n modes to be visualized [:]
t_maxThe ending time step of the plot
dtThe duration of each time step in unit of seconds
axMatplotlib axis for plotting
t_minThe starting time step of the plot
hamada_dphiHamada phase shifts [ntheta]
Returns
line_list The list of line objects for each m/n mode in m_list and n_list

◆ plot_sensor_output()

plot_sensor_output (   self,
  t,
  fig,
  ax 
)

Plot the magnetic field contour of the sensors on the surface at time step t

Parameters
tThe time step during the time evolution
figMatplotlib figure for plotting
axMatplotlib axis for plotting
Returns
cf The contour plot of the sensor values on the surface at time step t
cbar The colorbar of the contour plot

◆ plot_sensor_output_on_surface()

plot_sensor_output_on_surface (   self,
  t,
  figs,
  axes 
)

Plot the normal magnetic field on the surface at time step t

Parameters
tThe time step during the time evolution
figaMaximumly two Matplotlib figures for plotting
axesTwo Matplotlib axes for plotting
Returns
lc_list The list of LineCollection objects for the two cross sections
boundary_list The list of surface boundary lines
cbar_list The list of colorbars for the LineCollection objects

◆ plot_sensor_signal_against_angle()

plot_sensor_signal_against_angle (   self,
  t,
  ax,
  theta = True 
)

Plot the value of normal magnetic fields over theta/phi at at phi/theta = 0.

Parameters
tThe time step during the time evolution
axMatplotlib axis for plotting
thetaPlot against theta (True) or phi (False)
Returns
line The line object of the plot

◆ save_surfmn()

save_surfmn (   self,
  t,
  filename,
  eliminate_negative_n = True,
  scale = 1e-4,
  hamada_dphi = None 
)

Sort the Fast Fourier Transformed B mesh in PEST or Hamada coordinate at time step t and write it to a SURFMN-formatted file.

Parameters
tThe time step at which the magnetic values are desired
filenameFilename of the file
eliminate_negative_nWhether values of negative n modes should be written to the file
scaleThe scaling of the values in the file
hamada_dphiHamada phase shifts [ntheta]

◆ sort_fft_indices_and_mesh()

sort_fft_indices_and_mesh (   self,
  B_n_fft,
  n_modes,
  m_modes 
)

Sort the Fourier Transformed B mesh and the poloidal and toroidal mode numbers generated by the FFT functions in this class while considering helicity.

Parameters
B_n_fftThe Fast Fourier Transformed B mesh, the first output of self.fft(B) [ntheta,nphi]
n_modesThe toroidal mode numbers, the second output of self.fft(B) [ntheta]
m_modesThe poloidal mode numbers, the third output of self.fft(B) [nphi]
Returns
B_n_sorted The sorted FFT'ed B mesh [ntheta,nphi], n_modes_sorted The sorted toroidal mode numbers [ntheta], m_modes_sorted The sorted poloidal mode numbers [nphi]

Member Data Documentation

◆ axial_positions

axial_positions

◆ helicity

helicity

◆ hist_file

hist_file

◆ major_radius

major_radius

◆ nphi

nphi

◆ ntheta

ntheta

◆ radial_positions

radial_positions

◆ theta_list

theta_list

The documentation for this class was generated from the following file: