Skip to content

read_corsica_data.m

Basic Information

  USAGE:    equil_data = read_corsica_data(dirname,tok_data_struct)

  PURPOSE:  Read flat files made with create_corsica_flat_files.m (or .bas)

  INPUTS:   dirname, the directory with all the flat files, such as:
               sys_dims.flat  psi.flat  cc.flat  crj.flat, and many more...
               OR (for backwards compatibility) dirname can be a struct
               containing paths to sysdims.flat, psi.flat, cc.flat, crj.flat
               In this latter case only a subset of the outputs are returned
            tok_data_struct, standard toksys description of the tokamak
               tok_data_struct is used to make fcturn, turnfc, fcid, ecid
               Everything else comes from the corsica flat files in dirname.

  OUTPUTS:   equil_data, a standard toksys equilibrium structure:
    cpasma: 'Plasma current [A]'
      jphi: 'Current density on grid [MA/m^2]'
    pcurrt: 'Current within rectangular grid elements [A]'
     psizr: 'Total flux on grid [Wb]'
      pres: 'Pressure at flux values [Pa]'
    pprime: 'pprime at flux values [Pa/(Wb/rad)]'
      fpol: 'fpol at flux values'
    fprime: 'fprime at flux values'
    ffprim: 'ffprim at flux values'
      qpsi: 'q at flux values'
     bzero: 'Vacuum toroidal field at rzero [T]'
     rzero: 'Reference point for bzero [m]'
    rmaxis: 'R of magnetic axis [m]'
    zmaxis: 'Z of magnetic axis [m]'
    psimag: 'Flux at magnetic axis [Wb]'
    psibry: 'Flux at boundary [Wb]'
      rcur: 'R of current centroid [m]'
      zcur: 'Z of current centroid [m]'
     nbbbs: 'Number of boundary points = length(rbbbs)'
     rbbbs: 'R of boundary points [m]'
     zbbbs: 'Z of boundary points [m]'
      xlim: 'R of limiter [m]'
      ylim: 'Z of limiter [m]'
      rxps: 'R of X points [m]'
      zxps: 'Z of X points [m]'
    psixps: 'Flux at X points [Wb]'
        cc: 'PF coil currents in MA-turns'
       cc2: 'PF coil currents in MA-turns'
        dr: 'Radial distance between grid points [m]'
        dz: 'Vertical distance between grid points [m]'
        rg: 'Radial coordinates of grid points [m]'
        zg: 'Vertical coordinates of grid points [m]'
        nw: 'Number of radial grid points [m]'
        nh: 'Number of vertical grid points [m]'
    fcturn: 'Number of turns in PF coils = tok_data_struct.fcnturn'
    turnfc: 'ones(nff,1) (nff derived from tok_data_struct)'
      fcid: '1:nff (nff derived from tok_data_struct)'
      ecid: 'tok_data_struct.ecdata(5,:)'

  RESTRICTIONS:

  METHOD:  Reads flat files generated by create_corsica_flat_files.m
           This function converts units and saves to efit variable names
           tok_data_struct is needed to create fcturn, turnfc, ecid, fcid
           If only 4 flat files are available then the grid and limdata from
           tok_data_struct are used in findlcfs which derives psibry, psibnd.

Dependencies