freegsnke.machine_config module

Checks and/or calculates resistance and inductances matrices based on a provided machine description.

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/>.

freegsnke.machine_config.build_tokamak_R_and_M(tokamak)[source]

Build the resistance (R) and inductance (M) matrices for the machine within the tokamak object. This will construct R and M for the active coils (and any passive structures).

If already present, they will not be re-calculated.

# for coil-coil flux # mutual inductance = 2pi * (sum of all Greens(R_i,Z_i, R_j,Z_j) on n_i*n_j terms, where n is the number of windings)

# note that while the equation above is valid for active coils, where each filament carries the nominal current, # this is not valid for refined passive structures, where each filament carries a factor 1/n_filaments of the total current # and for which a mean of the greens (rather than the sum) should be used instead, which is accounted through the ‘multiplier’

# resistance = 2pi * (resistivity/area) * (number of loops * mean_radius) # note the multiplier is used as refined passives have number of loops = 1

Parameters:

tokamak (class) – The tokamak object.

Returns:

tokamak – Returns an object containing the (new) R and M data.

Return type:

class

freegsnke.machine_config.self_ind_circular_loop(R, dR)[source]

Calculate the self inductance of a circular loop with radius R and width dR.

Parameters:
  • R (float or ndarray) – Radial position of the loop [m].

  • dR (float or ndarray) – Radial width of the filament [m].

Returns:

Self inductance..

Return type:

float or ndarray