freegsnke.magnetic_probes module
Class to implement magnetic probes (flux loops and pick ups at the moment): - sets up probe object, containing the types and locations of the probes - methods to extract the ‘measurements’ by each probe from an equilibrium.
Copyright 2025 UKAEA, UKRI-STFC, and The Authors, as per the COPYRIGHT and README files.
This file is part of FreeGSNKE.
FreeGSNKE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
FreeGSNKE is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
You should have received a copy of the GNU Lesser General Public License along with FreeGSNKE. If not, see <http://www.gnu.org/licenses/>.
- class freegsnke.magnetic_probes.Probes(coils_dict, magnetic_probe_data, magnetic_probe_path)[source]
Bases:
object
Class to implement magnetic probes: - flux loops: compute psi(R,Z) - pickup coils: compute B(R,phi,Z).nhat (nhat is unit vector orientation of the probe)
Inputs: - equilibrium object - contains grid, plasma profile, plasma and coil currents, coil positions. N.B:- in init/setup the eq object only provides machine /domain/position information
in methods the equilibrium provides currents and other aspects that evolve in solve().
Attributes: - floops,pickups = dictionaries with name, position, orientation of the probes - floops_positions etc. = extract individual arrays of positions, orientations etc. - floops_order / pickups_order = list of fluxloop/pickups names, if individual probe value is required - greens_psi_coils_floops = greens functions for psi, evaluated at flux loop positions - greens_br/bz_coils_pickups = greens functions for Br/Bz, evaluated at pickup coil positions - greens_psi_plasma_floops = dictionary of greens functions for psi from plasma current, evaluated at flux loop positions - greens_BrBz_plasma_pickups = dictionary of greens functions for Br and Bz from plasma, evaluated at pickup coil positions
more greens function attributes would be added if new probes area added.
Methods: - get_coil_currents(eq): returns current values in all the coils from equilibrium object. - get_plasma_current(eq): returns toroidal current values at each plasma grid point, taken from equilibrium input. - create_greens_all_coils(): returns array with greens function for each coil and probe combination. - psi_all_coils(eq): returns list of psi values at each flux loop position, summed over all coils. - psi_from_plasma(eq): returns list of psi values at each flux loop position from plasma itself. - create_greens_B_oriented_plasma(eq) : creates oriented greens functions for pickup coils. - calculate_fluxloop_value(eq): returns total flux at each probe position (sum of previous two outputs). - calculate_pickup_value(eq): returns pickup values at each probe position.
Br(eq)/ Bz(eq) : computes radial/z component of magnetic field, sum of coil and plasma contributions
Btor(eq) : extracts toroidal magnetic field (outside of plasma), evaluated at
Methods currently have floop or pickup positions as default, but these can be changed with optional argument.
- Br(eq, probe='pickups')[source]
Method to compute total radial magnetic field from coil and plasma returns array with Br at each pickup coil probe - evaluated on pickups by default, can apply to other probes too with minor modification
- BrBz_coils(eq, probe='pickups')[source]
Magnetic fields from coils, radial and z components only. evaluated on pickup positions by default.
- Btor(eq, probe='pickups')[source]
Probes outside of plasma therefore Btor = fvac/R returns array of btor for each probe position - evaluated on pickups by default, can apply to other probes too with minor modification
- Bz(eq, probe='pickups')[source]
Method to compute total z component of magnetic field from coil and plasma returns array with Bz at each pickup coil probe - evaluated on pickups by default, can apply to other probes too with minor modification
- __init__(coils_dict, magnetic_probe_data, magnetic_probe_path)[source]
Sets up the magnetic probes object if the required data is passed to it via ‘magnetic_probe_data’ or ‘magnetic_probe_path’.
- Parameters:
coils_dict (dict) – Dictionary containing the active coil data.
magnetic_probe_data (dict) – Dictionary containing the magnetic probes data.
magnetic_probe_path (str) – Path to the pickle file containing the magnetic probe data.
- calculate_pickup_value(eq, probe='pickups')[source]
Compute B.n at pickup probes, using oriented greens functions.
- create_eq_key(eq)[source]
Produces tuple (Rmin,Rmax,Zmin,Zmax,nx,ny) from equilibrium to access correct greens function.
- create_green_psi_plasma(eq, probe='floops')[source]
Compute greens function at probes from the plasma currents . - plasma current source in grid from solve. grid points contained in eq object - evaluated on flux loops by default, can apply to other probes too with minor modification
- create_greens_B_oriented_coils(eq, probe='pickups')[source]
perform dot product of greens function vector with pickup coil orientation
- create_greens_B_oriented_plasma(eq, probe='pickups')[source]
perform dot product of greens function vector with orientation
- create_greens_BrBz_plasma(eq, probe='pickups')[source]
Compute greens function at probes from the plasma currents . - plasma current source in grid from solve. grid points contained in eq object - evaluated on pickups by default, can apply to other probes too with minor modification
- create_greens_BrBz_single_coil(eq, coil_key, probe='pickups')[source]
Create array of greens functions for given coil evaluate at all pickup positions - defines array of greens for each filament at each probe. - multiplies by polarity and multiplier - then sums over filaments to return greens function for probes from a given coil - evaluated on pickups by default, can apply to other probes too with minor modification
- create_greens_psi_all_coils(eq, probe='floops')[source]
Create 2d array of greens functions for all coils and at all probe positions - array[i][j] is greens function for coil i evaluated at probe position j
- create_greens_psi_single_coil(eq, coil_key, probe='floops')[source]
Create array of greens functions for given coil evaluate at all probe positions - pos_R and pos_Z are arrays of R,Z coordinates of the probes - defines array of greens for each filament at each probe. - multiplies by polarity and multiplier - then sums over filaments to return greens function for probes from a given coil - flux loops by default, can apply to other probes too with minor modification
- get_plasma_current(eq)[source]
From equilibirium object contains toroidal current distribution on the grid, reduced to the limiter region only.
- greens_BrBz_all_coils(eq, probe='pickups')[source]
Create 2d array of greens functions for all coils and at all probe positions - array[i][j] is greens function for coil i evaluated at probe position j - evaluated on pickups by default, can apply to other probes too with minor modification
- initialise_setup(eq)[source]
Setup attributes: positions, orientations and greens functions - set probe positions and orientations - set coil positions from equilibrium object - create arrays/dictionaries of greens functions with positions of coils/plasma currents and probes
- plot(axis=None, show=True, floops=True, pickups=True, pickups_scale=0.05)[source]
Plot the magnetic probes.
axis - Specify the axis on which to plot show - Call matplotlib.pyplot.show() before returning floops - Plot the fluxloops pickups - Plot the pickup coils
- Return type:
axis object from Matplotlib