Skip to content

convergeq.m

Basic Information

  USAGE:   [ceq, eqx] = convergeq(eq,tok_data_struct,options,idoplot)

  PURPOSE: Converge equilibrium, i.e. minimize psizr_app+psizr_pla - psizr
           where psizr_app is calculated from mpc, cc and psizr_pla from mpp, jphi
           and jphi in turn is calculated using psizr, pprime, ffprim

           The converged equilibrium is on the grid in tok_data_struct
           which can be different from the grid in the original efit.

           Bus constraint such as the VFI on DIII-D can be imposed on cc

  INPUTS:  eq: An equilibrium containing at least psizr, pprime, ffprim, cc
           tok_data_struct: standard toksys object for tokamak description
           options.converrmax = upper limit on resulting flux error
             max(abs(psizr_app(:)+psizr_pla(:)-psizr(:))), default 1e-12
           options.iconstraints: (default is 3)
             0. conserve pres           and fpol as functions of normalized flux
             1: conserve pres           and total plasma current
             2: conserve thermal energy and fpol
             3: conserve thermal energy and total plasma current
           options.maxiter: maximum number of iterations, default = 25;
           options.icx: Specify a subset of cc that can change, default icx=1:nc
           options.cccirc: standard toksys assignment of circuit numbers to coils,
           options.bus_code: indices are 1 for coils on bus, 0 for others
              bus_code*cc = 0 (bus_code is row vector and cc is column vector)
              cc will be adjusted to meet the constraint: bus_code*cc = 0
              For DIII-D: PP_objs =  get_PP_objs(shot)
                          options.bus_code = [0 0 PP_objs.bus_code]
           idoplot: plot each iteration for idoplot seconds, default 0 = no plot

  OUTPUTS: ceq: structure containing converged equilibrium on tok_data_struct grid
           eqx: structure containing extra information (see eqx.descriptions)

  RESTRICTIONS: The following quantities are updated for converged equilibrium:
             rbbbs, zbbbs, jphi, psizr, pprime, ffprim, pres, fpol
                cc, psimag, psibry, cpasma, rmaxis, zmaxis, rg, zg, dr, dz
                nw, nh, psirz, ssibry, ssimag, qpsi

  METHOD:  The Newton-Rhapson method is used to converge to the solution.

Dependencies