evolveq.m
USAGE: [y, e, eq, eqx] = evolveq(u,C,tok,eq0)
PURPOSE: Evolve an equilibrium.
Initialize by calling with all arguments: y = evolveq(u,C,tok,eq0)
Evolve by calling with new inputs in u: y = evolveq(u)
INPUTS: u, structure with inputs that affect the equilibrium:
cc0t: coil currents such that psizr_app = mpc*cc0t
vc0t: vessel currents such that psizr_app = mpv*vc0t
ip: plasma current
li: normalized inductance
betap: poloidal beta
If an input is missing then no change of the quantity is made.
C, output matrix such that y = C*[cc0t; vc0t; pcurrt],
where pcurrt is plasma currents within grid elements [A]
Example: C = [[mcc mcv mpc']; [mcv' mvv mpv']] outputs flux at conductors
tok, Toksys description of the tokamak
eq0, initial equilibrium
OUTPUTS: y, outputs defined by C
e, structure with all persistent variables
eq, equilibrium (returning eq increases execution time)
eqx. last analyzed equilibrium and some simulation parameters
METHOD: The equilibrium and its response matrix are persistent variables.
When the routine is called, the equilibrium is updated by the linear response to the
changes that have occurred in u, and a new output, y is calculated.
Large changes can be made in one step, evolveq estimates magnitude of nonlinear
response and divides large changes into several smaller internally.
When uncertainties in the linear response have accrued, a correction is made.
When the response matrix becomes inaccurate a new is calculated.
Dependencies