plasma_current.m
Function generates plasma current (pcurrt) from flux (psizr)
SYNTAX:
[pcur,jphi,cpasma]= plasma_current(psizr, pprime, ffprim,...
psimag,psibnd,...
rgefit,zgefit,...
rbbbs,zbbbs,nbbbs,...
iplot,dofast)
PURPOSE: Generate plasma current from flux and current profile information
Input is same as read_gfile input or mds_eq => eq_ga_env
pcur is almost identical to that obtained using iecurr=2 in EFIT
(error <~ 0.2 and max near boundary)
INPUTS: [default] <optional>
psizr= true flux on grid (Wb)
pprime= p' vector (pprime from read_gfile) (nt/m^2)/(Vs/rad)
ffprim= ff' vector (ffprim in read_gfile) (mT)^2/(Vs/rad)
psimag= Flux on axis (Wb) [max(max(psizr))]
psibnd= Flux on boundary (Wb) [average of flux on boundary]
rgefit= Radius vector of grid (m)
zgefit= Z vector of grid (m)
rbbbs= Radius vector of boundary (m)
zbbbs= Z vector of boundary (m)
nbbbs= number of elements in rbbbs zbbbs [length(rbbbs]
iplot= 2; 1= plot boundary, 2= contour jphi; 3= clabel [0]
dofast= 1; increases algorithm speed at risk of including some
private flux in solution. Only extreme shapes like
crescents and beans are expected to need dofast=0.
Default is dofast=0 since speed is still very fast. [0]
<cpasma>= Plasma Current (A)
OUTPUTS:
pcur = plasma current on nr,nz grid [A]
jphi= plasma current density on nr,nz grid [MA/m^2]
cpasma= plasma current = sum(sum(pcur))
Warning messages displayed if sum(sum(pcur)) and existing cpasma
are widely different. cpasma then overwritten.
NOTE: ALL UNITS ARE MKS (except jphi is MA/m^2)
CAUTION: Overwrites pcur, jphi & cpasma if read_gfile read from gfile
RESTRICTIONS:
SEE ALSO: inside_plasma
Dependencies