SCRUNCH Mini Document R.M. Wieland February 13, 1994 The program that generates Fourier moment boundary ufiles for input to TRDAT is SCRUNCHER. The function of SCRUNCHER is to take an arbitrary plasma boundary specification in any of several forms and generate an optimized Fourier representation of that boundary in terms of Rm and Ym coefficients. The optimization algorithm was written by Steve Hirshman at Oak Ridge National Laboratory (S. P. Hirshman et al, Comp. Phys. Comm 39, 161 (1986)) SCRUNCHER can handle both up-down symmetric and asymmetric plasmas; the user specifies which one of two analysis modes to choose: Either (1) Symmetric mode, where only the up-down symmetric Rm-cos and Ym-sin terms are used in the optimization, and where the output consists of 1 1-d ufile for R0 and two 2-d ufiles for Rm(m>0) and Ym(m>0) terms. This mode is appropriate for the LEVGEO = 4 or 5 up-down symmetric equilibrium code option in TRANSP. or (2) Asymmetric mode, where the full set of terms {Rm-cos,Rm-sin,Ym-cos,Ym-sin} are used in the optimization, and where the output consists of 1 3-d ufile containing time series for all four terms. This mode is appropriate for the LEVGEO = 6 up-down asymmetric equilibrium code option in TRANSP. Running SCRUNCHER results in the following prompt: Specify data source: g for GA file; j for JET file; m for {rm,ym} entry; s for MB ufiles; u for Scruncher Ufiles; v for VMOMS {r0,a0,e,d;SYM only} entry; x to stop; Scruncher: Enter source designator to proceed : These indicate the several input modes that are available ... - - - - - - - - - - - - - - - - - - - - - - - - "M" Mode: Use this for generating a few scrunched boundary ufile points when you have a set of unscrunched moments in hand. You are prompted for, 1) shot number 2) number of internal boundary points to generate within the code in the process of generating the scrunched moment set. 3) the max "m" to be used in fitting 4) the time 5) the input (unscrunched) set of Rmc (blank delimited) 6) the input (unscrunched) set of Rms (blank delimited) 7) the input (unscrunched) set of Ymc (blank delimited) 8) the input (unscrunched) set of Yms (blank delimited) In this mode, the code also accepts indirect file input, where the file contains the information listed in (1)-(8), above. - - - - - - - - - - - - - - - - - - - - - - - - "V" Mode (Symmetric only): Use this for generating a few scrunched boundary ufile points when you have a set of "geometric" boundary parameters in hand. You are prompted for, 1) shot number 2) number of internal boundary points to generate within the code in the process of generating the scrunched moment set. 3) the time 4) the number of moments to generate 5) the "geometric" boundary parameter set, which consists of: a) R0, the major radius (in m or cm), b) a0, the minor radius (in m or cm), c) E, the elongation d) D, the triangularity (>0 for D shaped) In this mode, the code also accepts indirect file input, where the file contains the information listed in (1)-(5), above. Note that this mode will only operate in "symmetric" mode. - - - - - - - - - - - - - - - - - - - - - - - - "S" Mode: Use this for interfacing to externally supplied time dependent boundary data. (Historically, "S" mode was used in TFTR to read boundary ufiles generated by Mike Bell from his filament code analysis codes. Eventually, Mike internalized the SCRUNCH code and now generates TRDAT ready, symmetric ufiles on his own. The required input is a text file, by default named MB.D. The user is prompted for an alternate file name , to which the user can respond if so desire, and which looks like $ ty 31447mb.d 31447 07 ! line 1 shot=31447; generate up to m=7 mb: 3.500 ! time-specification-entry-line mb: 3.550 mb: 3.600 and which contains required input information on the shot number (line 1, free format) the number of moments written to the output file (line 1, free format) and on subsequent lines, a listing of 1d ufiles which contain, at the times indicated on each line, the boundary specification of the plasma given by n ufile (x,y) points, where (x,y) are the (R,Z) points of the boundary. The units are METERS. Format of the time-specification-entry-line : * The 1st field indicates in coded form the location of the ufile: xx: indicates the directory named by the logical name xx_all: **: indicates the default directory location * The 2nd field provides the time associated with the boundary ufile. The time together with the shot number are used in encoded form to name the ufile that is to be read: mb_all:t_4459_31447.bnd Thus the user must 1st write a series of 1d ufiles, each containing an (R,Z) characterization of the plasma boundary at the time(s) of interest ("tttt" msec for shot nnnnn), and which must be named by the convention T_tttt_nnnnn.BND Then the user must create an MB.D file which specifies the shot number and lists the ufiles to be processed. An example of an "S" format BND boundary ufile follows: 31447TFTR 1 0 ;-SHOT #- F(X) DATA -UF1DWR- 23-SEP-91 ;-SHOT DATE- UFILES ASCII FILE SYSTEM 23 ;-NUMBER OF ASSOCIATED SCALAR QUANTITIES- 3.6500E+00 ;-SCALAR, LABEL FOLLOWS: T0: Time s 3.3140E+01 ;-SCALAR, LABEL FOLLOWS: CV: Volume m^3 2.1393E+00 ;-SCALAR, LABEL FOLLOWS: CA: Area m^2 5.1868E+00 ;-SCALAR, LABEL FOLLOWS: CL: Length m 8.5589E+00 ;-SCALAR, LABEL FOLLOWS: QB: q_bnd 2.5089E+00 ;-SCALAR, LABEL FOLLOWS: RT: RT m 1.0565E+00 ;-SCALAR, LABEL FOLLOWS: ALPHA: Alpha 0.0000E+00 ;-SCALAR, LABEL FOLLOWS: ENORM: E_norm J 5.1235E+05 ;-SCALAR, LABEL FOLLOWS: ELM: E_lambda J 6.0536E+05 ;-SCALAR, LABEL FOLLOWS: EPM: E_param J 4.1045E+04 ;-SCALAR, LABEL FOLLOWS: ELI: E_li J 1.9568E+00 ;-SCALAR, LABEL FOLLOWS: S1: S1 intgrl 6.7243E-01 ;-SCALAR, LABEL FOLLOWS: S2: S2 intgrl 9.1023E-01 ;-SCALAR, LABEL FOLLOWS: S3: S3 intgrl 8.2641E-01 ;-SCALAR, LABEL FOLLOWS: LAMBDA: Lambda 9.7643E-01 ;-SCALAR, LABEL FOLLOWS: MUPAR: Mu_param -1.9135E+00 ;-SCALAR, LABEL FOLLOWS: FP: Pol. flux Wb 1.0461E+01 ;-SCALAR, LABEL FOLLOWS: FT: Tor. flux Wb 2.4699E+00 ;-SCALAR, LABEL FOLLOWS: RFIT: Fitted R m -1.2001E-02 ;-SCALAR, LABEL FOLLOWS: ZFIT: Fitted Z m 8.1514E-01 ;-SCALAR, LABEL FOLLOWS: AFIT: Fitted a m 8.3100E-01 ;-SCALAR, LABEL FOLLOWS: BFIT: Fitted b m 1.0000E+00 ;-SCALAR, LABEL FOLLOWS: RTCON: R_t cntrl Boundary R m ;-INDEPENDENT VARIABLE LABEL- Boundary Z m ;-DEPENDENT VARIABLE LABEL- 2 ;-PROC CODE- 0:RAW 1:AVG 2:SM. 3:AVG+SM 99 ;-# OF PTS- X, F(X) DATA FOLLOW: 1.6550E+00 1.6548E+00 1.6576E+00 1.6636E+00 1.6727E+00 1.6853E+00 1.7013E+00 1.7208E+00 1.7439E+00 1.7704E+00 1.8003E+00 1.8335E+00 1.8698E+00 1.9089E+00 1.9506E+00 1.9947E+00 2.0408E+00 2.0887E+00 2.1381E+00 2.1887E+00 2.2404E+00 2.2927E+00 2.3456E+00 2.3988E+00 2.4520E+00 2.5051E+00 2.5578E+00 2.6098E+00 2.6612E+00 2.7116E+00 2.7609E+00 2.8090E+00 2.8557E+00 2.9008E+00 2.9443E+00 2.9859E+00 3.0254E+00 3.0627E+00 3.0975E+00 3.1297E+00 3.1592E+00 3.1856E+00 3.2090E+00 3.2293E+00 3.2464E+00 3.2603E+00 3.2711E+00 3.2788E+00 3.2834E+00 3.2851E+00 3.2838E+00 3.2797E+00 3.2727E+00 3.2628E+00 3.2501E+00 3.2344E+00 3.2159E+00 3.1944E+00 3.1700E+00 3.1428E+00 3.1128E+00 3.0802E+00 3.0451E+00 3.0077E+00 2.9680E+00 2.9263E+00 2.8827E+00 2.8374E+00 2.7904E+00 2.7420E+00 2.6922E+00 2.6412E+00 2.5892E+00 2.5365E+00 2.4831E+00 2.4295E+00 2.3758E+00 2.3223E+00 2.2694E+00 2.2172E+00 2.1661E+00 2.1163E+00 2.0680E+00 2.0216E+00 1.9771E+00 1.9350E+00 1.8953E+00 1.8583E+00 1.8242E+00 1.7931E+00 1.7652E+00 1.7404E+00 1.7189E+00 1.7006E+00 1.6854E+00 1.6733E+00 1.6643E+00 1.6582E+00 1.6550E+00 0.0000E+00 -5.3839E-02 -1.0769E-01 -1.6139E-01 -2.1475E-01 -2.6756E-01 -3.1955E-01 -3.7045E-01 -4.1994E-01 -4.6775E-01 -5.1356E-01 -5.5710E-01 -5.9811E-01 -6.3637E-01 -6.7168E-01 -7.0389E-01 -7.3289E-01 -7.5859E-01 -7.8095E-01 -7.9990E-01 -8.1543E-01 -8.2750E-01 -8.3612E-01 -8.4128E-01 -8.4300E-01 -8.4134E-01 -8.3636E-01 -8.2814E-01 -8.1677E-01 -8.0235E-01 -7.8499E-01 -7.6476E-01 -7.4176E-01 -7.1605E-01 -6.8771E-01 -6.5679E-01 -6.2336E-01 -5.8752E-01 -5.4937E-01 -5.0905E-01 -4.6671E-01 -4.2256E-01 -3.7680E-01 -3.2966E-01 -2.8139E-01 -2.3221E-01 -1.8235E-01 -1.3202E-01 -8.1412E-02 -3.0692E-02 1.9986E-02 7.0482E-02 1.2066E-01 1.7037E-01 2.1947E-01 2.6780E-01 3.1516E-01 3.6137E-01 4.0623E-01 4.4954E-01 4.9111E-01 5.3078E-01 5.6839E-01 6.0382E-01 6.3696E-01 6.6772E-01 6.9601E-01 7.2174E-01 7.4478E-01 7.6501E-01 7.8229E-01 7.9646E-01 8.0736E-01 8.1483E-01 8.1874E-01 8.1900E-01 8.1554E-01 8.0834E-01 7.9743E-01 7.8284E-01 7.6467E-01 7.4301E-01 7.1796E-01 6.8964E-01 6.5818E-01 6.2372E-01 5.8642E-01 5.4648E-01 5.0410E-01 4.5954E-01 4.1302E-01 3.6482E-01 3.1518E-01 2.6438E-01 2.1263E-01 1.6015E-01 1.0712E-01 5.3692E-02 -5.7705E-06 ;----END-OF-DATA-----------------COMMENTS:----------- PRODUCED BY PROGRAM GSMOO1 [TRANSP] FROM INPUT DATA FILE: "MB_ALL:T_3650_31447.BND " USER COMMENTS: ========================================================== COMMENTS SPOOLED FROM FILE INPUT TO GSMOO1 [IPROC=2]: ON VAX-11 ON DATE: 23-SEP-91 Written by MAGFIT on 25-NOV-87 R_t calculation control parameter: 1 - - - - - - - - - - - - - - - - - - - - - - - - "G" Mode: Use this for interfacing to externally supplied time dependent boundary data from General Atomics for the DIII-D tokamak. The format for these files has been set by Chuck Greenfield at GA. The required input is a text file (by default named GA.D .. the user is prompted for an alternate file name , to which the user can respond if so desired) which looks like $ ty ga.d TRANSP$:[WIE.SCRUNCH.GA]BOUNDARY_075121_02015.DAT;1 TRANSP$:[WIE.SCRUNCH.GA]BOUNDARY_075121_02040.DAT;1 TRANSP$:[WIE.SCRUNCH.GA]BOUNDARY_075121_02065.DAT;1 TRANSP$:[WIE.SCRUNCH.GA]BOUNDARY_075121_02090.DAT;1 TRANSP$:[WIE.SCRUNCH.GA]BOUNDARY_075121_02115.DAT;1 TRANSP$:[WIE.SCRUNCH.GA]BOUNDARY_075121_02140.DAT;1 TRANSP$:[WIE.SCRUNCH.GA]BOUNDARY_075121_02165.DAT;1 TRANSP$:[WIE.SCRUNCH.GA]BOUNDARY_075121_02190.DAT;1 TRANSP$:[WIE.SCRUNCH.GA]BOUNDARY_075121_02215.DAT;1 TRANSP$:[WIE.SCRUNCH.GA]BOUNDARY_075121_02240.DAT;1 TRANSP$:[WIE.SCRUNCH.GA]BOUNDARY_075121_02265.DAT;1 TRANSP$:[WIE.SCRUNCH.GA]BOUNDARY_075121_02290.DAT;1 TRANSP$:[WIE.SCRUNCH.GA]BOUNDARY_075121_02315.DAT;1 TRANSP$:[WIE.SCRUNCH.GA]BOUNDARY_075121_02340.DAT;1 TRANSP$:[WIE.SCRUNCH.GA]BOUNDARY_075121_02365.DAT;1 TRANSP$:[WIE.SCRUNCH.GA]BOUNDARY_075121_02390.DAT;1 TRANSP$:[WIE.SCRUNCH.GA]BOUNDARY_075121_02415.DAT;1 TRANSP$:[WIE.SCRUNCH.GA]BOUNDARY_075121_02440.DAT;1 TRANSP$:[WIE.SCRUNCH.GA]BOUNDARY_075121_02465.DAT;1 TRANSP$:[WIE.SCRUNCH.GA]BOUNDARY_075121_02490.DAT;1 TRANSP$:[WIE.SCRUNCH.GA]BOUNDARY_075121_02515.DAT;1 TRANSP$:[WIE.SCRUNCH.GA]BOUNDARY_075121_02540.DAT;1 TRANSP$:[WIE.SCRUNCH.GA]BOUNDARY_075121_02565.DAT;1 TRANSP$:[WIE.SCRUNCH.GA]BOUNDARY_075121_02590.DAT;1 and which is most simply generated by issuing the DCL command $ dir/nohead/notrail/out=ga.d device:[repos]boundary*.dat where "device:[repos]" is the directory that contains the boundary data files. The file names must be of the form BOUNDARY_nnnnnn_ttttt.DAT where nnnnnn is the shot number and ttttt is the time in msec. A sample boundary data file follows: Boundary description for timeslice 75121 2015 msec Shot date: 23MAR-1992 UNITS ARE METERS Number of points: 181 Begin R-array ================================================================== 2.303 2.299 2.288 2.271 2.249 2.225 2.196 2.164 2.126 2.082 2.033 1.979 1.919 1.855 1.822 1.788 1.753 1.716 1.679 1.641 1.602 1.563 1.523 1.482 1.461 1.441 1.420 1.399 1.377 1.356 1.345 1.334 1.323 1.312 1.302 1.291 1.280 1.269 1.258 1.247 1.242 1.237 1.231 1.226 1.221 1.154 1.152 1.149 1.147 1.145 1.143 1.141 1.139 1.137 1.136 1.134 1.133 1.130 1.128 1.125 1.123 1.121 1.119 1.118 1.116 1.114 1.113 1.111 1.110 1.108 1.105 1.102 1.100 1.097 1.095 1.093 1.091 1.089 1.087 1.083 1.080 1.077 1.074 1.072 1.067 1.064 1.061 1.059 1.058 1.057 1.056 1.058 1.059 1.062 1.066 1.071 1.074 1.077 1.081 1.085 1.087 1.089 1.091 1.093 1.096 1.098 1.101 1.104 1.108 1.111 1.114 1.116 1.117 1.119 1.121 1.123 1.124 1.126 1.128 1.130 1.132 1.135 1.136 1.137 1.138 1.140 1.141 1.142 1.144 1.145 1.147 1.149 1.150 1.152 1.154 1.220 1.225 1.231 1.236 1.241 1.247 1.252 1.263 1.274 1.285 1.296 1.307 1.318 1.328 1.339 1.350 1.371 1.392 1.413 1.434 1.454 1.475 1.515 1.554 1.593 1.631 1.669 1.705 1.741 1.776 1.809 1.873 1.933 1.988 2.039 2.085 2.126 2.162 2.194 2.221 2.246 2.267 2.285 2.298 2.303 2.303 Begin z-array ================================================================== 0.000 0.073 0.145 0.217 0.288 0.359 0.431 0.504 0.576 0.646 0.713 0.779 0.842 0.904 0.933 0.961 0.988 1.014 1.038 1.062 1.083 1.104 1.123 1.141 1.150 1.159 1.168 1.176 1.184 1.192 1.196 1.200 1.205 1.209 1.212 1.216 1.219 1.223 1.226 1.228 1.230 1.231 1.232 1.233 1.234 1.204 1.199 1.193 1.187 1.181 1.175 1.168 1.161 1.155 1.148 1.141 1.133 1.119 1.104 1.089 1.074 1.059 1.043 1.028 1.013 0.998 0.983 0.968 0.953 0.939 0.910 0.882 0.855 0.827 0.800 0.774 0.748 0.722 0.697 0.648 0.600 0.555 0.510 0.467 0.385 0.306 0.229 0.155 0.082 0.009 -0.064 -0.138 -0.214 -0.293 -0.375 -0.462 -0.506 -0.551 -0.598 -0.647 -0.671 -0.696 -0.722 -0.748 -0.774 -0.801 -0.828 -0.855 -0.883 -0.911 -0.940 -0.954 -0.969 -0.984 -0.999 -1.014 -1.030 -1.045 -1.060 -1.076 -1.091 -1.107 -1.115 -1.122 -1.130 -1.137 -1.145 -1.152 -1.160 -1.167 -1.174 -1.181 -1.188 -1.195 -1.202 -1.234 -1.233 -1.232 -1.230 -1.229 -1.227 -1.226 -1.223 -1.219 -1.216 -1.212 -1.208 -1.204 -1.200 -1.196 -1.192 -1.184 -1.176 -1.168 -1.159 -1.151 -1.142 -1.125 -1.106 -1.086 -1.066 -1.043 -1.020 -0.995 -0.969 -0.942 -0.886 -0.827 -0.766 -0.703 -0.638 -0.571 -0.502 -0.432 -0.363 -0.293 -0.223 -0.153 -0.081 -0.008 0.000 - - - - - - - - - - - - - - - - - - - - - - - - "J" Mode: Use this for interfacing to time dependent boundary data from JET. The format for these files has been set by Pam Stubberfield and Denis O'Brien at JET. The required input is an ascii file containing the (R,Y) boundary data in a format such that each time slice begins with a few header lines and then follows with an (R,Y) pair per line. Time series are presented by simply appending the data as required. A sample boundary data file follows: ISHOT = 26087 TIME = 49.06 I R(CM) Z(CM) 1 414.89 -5.51 2 414.74 1.82 3 414.24 9.15 4 413.40 16.49 5 412.21 23.82 6 410.69 31.17 7 408.82 38.52 8 406.59 45.89 9 404.01 53.29 10 401.06 60.70 11 397.70 68.14 12 393.92 75.61 13 389.69 83.09 14 384.96 90.56 15 379.69 97.94 16 373.82 105.17 17 367.31 112.18 18 360.16 118.85 19 352.35 125.09 20 343.90 130.77 21 334.83 135.76 22 325.20 139.84 23 315.10 142.80 24 309.92 143.92 25 294.08 145.37 26 283.45 144.66 27 273.00 142.60 28 262.90 139.25 29 253.27 134.74 30 244.22 129.23 31 235.81 122.86 32 228.12 115.79 33 221.14 108.16 34 214.86 100.08 35 209.25 91.71 36 204.29 83.13 37 199.93 74.41 38 196.14 65.59 39 192.89 56.72 40 190.14 47.83 41 187.87 38.92 42 186.03 30.02 43 184.61 21.13 44 183.59 12.25 45 182.97 3.37 46 182.73 -5.51 47 182.88 -14.39 48 183.42 -23.28 49 184.36 -32.20 50 185.70 -41.13 51 187.45 -50.08 52 189.66 -59.05 53 192.34 -68.03 54 195.52 -76.99 55 199.25 -85.92 56 203.55 -94.76 57 208.49 -103.46 58 214.09 -111.96 59 220.39 -120.14 60 227.42 -127.85 61 235.18 -134.96 62 243.70 -141.31 63 252.88 -146.75 64 262.61 -151.15 65 272.81 -154.35 66 283.33 -156.25 67 294.01 -156.86 68 304.66 -156.17 69 315.12 -154.25 70 325.23 -151.20 71 334.89 -147.12 72 343.99 -142.16 73 352.46 -136.45 74 360.25 -130.14 75 367.39 -123.37 76 373.87 -116.27 77 379.73 -108.99 78 384.98 -101.58 79 389.68 -94.09 80 393.88 -86.59 81 397.62 -79.10 82 400.93 -71.63 83 403.85 -64.20 84 406.40 -56.80 85 408.62 -49.45 86 410.49 -42.11 87 412.04 -34.79 88 413.26 -27.47 89 414.14 -20.15 90 414.69 -12.83 91 414.89 -5.51 - - - - - - - - - - - - - - - - - - - - - - - - An example interactive session follows: > {Run SCRUNCHER} Specify data source: g for GA file; j for JET file; m for {rm,ym} entry; s for MB ufiles; u for Scruncher Ufiles; v for VMOMS {r0,a0,e,d;SYM only} entry; x to stop; Scruncher: Enter source designator to proceed : j Scruncher: Enter boundary file name (default is jetbndry.00000): bndry.26087-1 Scruncher: Enter highest moment (e.g. 6 means [m=0:6]): 4 max{rm,ym}: m= 4 enter "s" for symmetric, "a" for asymmetric fit: a enter 0 to remove z0 displacement (r,z data only): 1 Reading shot 26087 Reading time 49.06000 Scruncher: Output tabulated results to screen? (y or n) y Scruncher: Output Data -vs- Fit plots to screen? (y or n) n - Reading bndry.26087-1 Time = 49.06000 ; 91 points 1 time= 49.06000 % scrunchf call, icon=0 ORDERING SURFACE POINTS Average elongation = 1.124662 ITERATIONS RMS ERROR FORCE GRADIENT m #'s <= ON Fitting toroidal plane # 1 1 9.134E-03 1.472E-02 1.63 4 100 1.888E-03 3.251E-03 1.01 4 170 9.082E-04 7.969E-06 1.00 4 COMPUTATIONAL TIME = 1.875E+00 SECONDS ANGLE CONSTRAINTS WERE APPLIED BASED ON RM**2 + ZM**2 SPECTRUM WITH P = 4.00 AND Q = 1.00 c mb nb RmncB RmnsB ZmncB ZmnsB 0 0 2.9714E+02 0.0000E+00 -5.8825E+00 0.0000E+00 1 0 1.1543E+02 2.5926E-01 2.5926E-01 1.5091E+02 2 0 1.3417E+00 -6.9038E-02 -7.0221E-02 -1.1574E+00 3 0 5.0022E-01 3.3666E-02 2.1673E-02 -3.1304E-01 4 0 2.6517E-01 8.6190E-02 5.4782E-02 -3.6109E-02 % descur returned 4 moments mean-square deviation between points and fit= 9.0821E-04 *************************************************** * * * z * * time centroid max-abs-deviation* * [sec] [cm] [cm] * * * * 49.06000 0.0000000E+00 9.0821082E-04 * * * * [max=] 0.0000000E+00 9.0821082E-04 * * * *************************************************** - - - - - - - - - - - - - - - - - - - - - - - - Notes: 1. An optional Z-centroid offset can be "subtracted" from the input boundary point set and if so it is printed out. 2. It is possible that the code is written so as to require each BND boundary ufile to contain the same number of (R,Z) points. That is the recommended mode of operation. If the number of points is not constant, the results cannot be predicted. 3. The output Fourier moment ufiles are written to the user's default directory. The units for the moments are CENTIMETERS, as required by TRANSP.