freegs.geqdsk.read

Contents

freegs.geqdsk.read#

freegs.geqdsk.read(fh, machine, rtol=0.001, ntheta=8, show=False, axis=None, pause=0.0001, cocos=1, domain=None, blend=0.0, fit_sol=False, maxits=50, current_bounds=None)[source]#

Reads a G-EQDSK format file

A nonlinear solve will be performed, using Picard iteration

Parameters:
  • fh – File handle

  • machine – Machine object defining coil locations

  • rtol (float) – Relative error in nonlinear solve

  • ntheta (int) – Number of points in poloidal angle on the separatrix this is used to constrain the plasma shape

  • show (bool) – Set to true to show solution in a new figure

  • axis (Optional[Axes]) – Set to an axis for plotting. Implies show=True

  • pause (float) – Delay between output plots. If negative, waits for window to be closed

  • cocos (int) – COordinate COnventions. Not fully handled yet, only whether psi is divided by 2pi or not. if < 10 then psi is divided by 2pi, otherwise not.

  • domain (Optional[list]) – Sets the (R,Z) domain to solve for (Rmin, Rmax, Zmin, Zmax)

  • blend (float) – Weighting of the previous poloidal flux at each step of the Picard iteration. The default (0.0) is to use no blending. Blending slows convergence, but can stabilise some oscillating unstable solutions. Must be in [0, 1]

  • fit_sol (bool) – If False (default) then only the poloidal flux inside the separatrix is used to constrain the coil currents. This is particularly for reading SCENE input, which is not valid outside the separatrix. If True, the whole domain is used in the fitting. This is useful if the locations of strike points need to be constrained.

  • maxits (int) – Maximum number of iterations. Set to None for no limit. If this limit is exceeded then a RuntimeError is raised.

  • current_bounds (Optional[list]) – Optional list of tuples representing constraints on coil currents to be used when reconstructing the equilibrium from the geqdsk file. [(l1,u1),(l2,u2)...(lN,uN)]

Returns:

eq – An Equilibrium object. In addition, the following is available:

  • eq.control - The control system

  • eq._profiles - The profiles object

Return type:

Equilibrium