USAGE: [eq,eqx] = designeq(spec,tok,options,guiflag)
PURPOSE: Design an equilibrium, designeq by itself opens a GUI for specification
INPUTS: spec, structure with targets, weights, limits, locks, template
tok, Toksys description of the tokamak
options, settings and flags
guiflag, flag to open the GUI (default 0 = no GUI)
For deadstart: spec = 'circle' or 'ellipse' or 'lsn' or 'usn' or 'dn'
spec may contain structures: targets, weights, limits, locks
The solution is minimized deviation from weights*targets within limits.
Implemented targets: cc, presr (pressure versus rho), jparar (j_parallel versus rho),
rbbbs, zbbbs, rsurf, zsurf, aminor, kappa0, cpasma, betap, li, rcur, zcur,
rx1, zx1, rx2, zx2, drsep, psibry, x1rleg, x1zleg, x2rleg, x2zleg (divertor leg coords),
fun1, ..., fun9 (expressions, e.g. betap+li/2)
Set spec.template = eq0 for same turnfc, fcid, cc format, etc. as eq0
spec.cccirc assigns a circuit (with sign) to each coil in cc
For DIII-D do: PP_objs=get_PP_objs(shot), spec.buscode = [0 0 PP_objs.bus_code]
options may contain fields:
nkn, number of knots in splines for pres, fpol (default is 1)
psikn, normalized flux values from 0 to 1 for knots (default equally spaced)
idoplot, flag to plot progress of equilibrium design (default 1)
maxiter, maximum iterations (25 by default)
use_template_presr, use pressure vs rho of template equilibrium
use_template_presr_normalized, use pressure vs rho of template equilibrium but
scale magnitude depending on betap or similar targets
use_template_jparar, use the j_parallel vs rho of template equilibrium
use_template_jparar_normalized, use the j_parallel vs rho of template equilibrium but
scale by: (kj1+kj2*linspace(1,0,nr)) depending on Ip, li, or similar targets
iframe4movie, creates bitmap picture files of iteration progress
OUTPUTS: eq, designed equilibrium
eqx, extra information
METHOD: Equilibrium fitted to weighted design objectives by Newton-Rhapson iterations