Skip to content

inside_plasma.m

Basic Information

 inside_plasma sets matrix "inside" to 0's & 1's for outside & inside plasma

 SYNTAX:
   inside= inside_plasma(psizr, rgefit,zgefit, rbbbs,zbbbs,...
                         psimag,psibnd, iplot,dofast);
   inside= inside_plasma(psirz, rgefit,zgefit, rbbbs,zbbbs);  minimum input

  PURPOSE: set matrix "inside" with 0's or 1's depending if inside or outside
           plasma. Uses same input as typically generated by read_gfile

  INPUTS: <default> [optional]

          psizr=   Flux on plasma grid in (nz,nr) array format (Wb)
          rgefit=  Radius vector of plasma grid (m)
          zgefit=  Z vector of plasma grid (m)
          rbbbs=   Radius vector of closed polygon plasma boundary (m)
          zbbbs=   Z vector of closed polygon plasma boundary (m)
          nbbbs=   number of elements to use in rbbbs,zbbbs
         [psimag]= Flux on axis (Wb) <max(max(psizr))>
         [psibnd]= Flux on boundary (Wb)  <average of psi on boundary>
         [iplot]=  1; plot results <0>, 2= outside plasma only
         [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>

  OUTPUTS:

          inside=  Matrix of 1's & 0's for inside or outside plasma  (nz,nr)

  RESTRICTIONS:
          rb,zb adjacent elements cant be identical.
          Not tested for coarse plasma boundary polygon mesh.

  METHOD:
          uses limits to do most screening and finally FE triangular formula

Dependencies