Last modified: Tue Aug 7 08:53:45 2007.
Write a file to be included in a ATHETA geometry input deck format; athwrite, grid = grid, transp = transp, gonly = gonly, file = file, $ xonly = xonly, yonly = yonly, append = append, conly = conly if keyword (grid) is set then the conductor values fit to the grid will be printed. Default is the actual spatial values. if keyword (transp) is set then x and y will be interchanged for the output. Default is X = Z and Y = R if keyword (gonly) is set then only grid parameters will be written if file is specified, the data will be written to this file. If no file is specified, a widget will inquire to determine the file if APPEND is set then the data will be appended to the file if XONLY is set then only X-grid data will be written if YONLY is set then only Y-grid data will be written if CONLY is set then only Conductor data will be written if either XONLY or YONLY are set then GONLY is set.
(See ../pfidl/tqpfidl/athwrite.pro)
This is a utility function for returning the grid parameters for a quadratic grid. Grid is of the form: Quadratic: X = x0 + A*I + B*I*I for i= 0, 1, ... Geometric: X = DX/log(R) * (R^I -1) + x0 format: GET_GRID_PARM, AXIS, A, B, X0, NP, A=a, B=b, X0= x0, NP = np where: AXIS - Axis direction = 1, 2, 3 A - Linear coefficient or (Delta X0= DX0) B - Quadratic coefficient or (Ratio coefficient -1) (R-1 is used for geometric to increase precision for a given number of numbers.) X0 - Initial value NP - Number of grid points for Quicksilver grids Note: Keywords or positional parameters may be used Example: Get grid parameters for current radial grid (direction 1) GET_GRID_PARM, 1, A, B, X, N Get the a and b coeficients for a Y grid (direction 2) GET_GRID_PARM, 2, A, BGET_GRID_PARM, 2, a = a, b = b
(See ../pfidl/tqpfidl/get_grid_parm.pro)
Read an ICEM ascii output file and generate an input file for QS Format: ICEM2QS, filename, outfile [, outfile = outfile] [, multiplier= multiplier] [, /CM] [, /INCH] [, /MICRON] [, /MIL] where fname - The name of a file If fname is not a string, DIALOG_PICKFILE will be used to select a file. outfile - Output file name. If outfile is present, the keyword is ignored. Default is the bare filename + ".out" A widget is used to confirm the name if no name is specified. multiplier - QuickSilver requires MKS units If ICEM uses other units a multiplier is required. Note: If multiplier is set, the following are ignored. CM - If set, multiplier = 1e-2 Micron - If set, multiplier = 1E-6 Inch - If set, multiplier = 2.54E-2 Mil - If set, multiplier = 2.54E-5 Example: Read a file selected and store the QS input file in 'qs_geo.dat' ICEM2QS, 0, 'qs_geo.dat' or ICEM2QS, out='qs_geo.dat' MODIFICATION HISTORY: Original version, L. P. Mix, December 22, 2002
(See ../pfidl/tqpfidl/icem2qs.pro)
Format: QS2ICEM, fname [, filename = filename] [, multiplier= multiplier] [, /CM] [, /INCH] [, /MICRON] [, /MIL] [, GXOUT = gxout] [, GYOUT = gyout] [, GZOUT = gzout] where fname - The name of the output file name. filename - Output file name. If outfile is present, the keyword is ignored. A widget is used to confirm the name if no name is specified. multiplier - QuickSilver requires MKS units If ICEM uses other units a multiplier is required. Note: If multiplier is set, the following are ignored. CM - If set, multiplier = 1e+2 Micron - If set, multiplier = 1E+6 Inch - If set, multiplier = 1/2.54E-2 Mil - If set, multiplier = 1/2.54E-5 GXOUT - actual X-grid locations - do not TQPFIDL generated points GYOUT - actual Y-grid locations - do not TQPFIDL generated points GZOUT - actual Z-grid locations - do not TQPFIDL generated points Example: simple axis qsgrid, [-55,55],[2.5,2.5], gz, /x, axes =3 qsgrid, [-55,55],[2.5,2.5], gx, /x, axes =1 qsgrid, [-100,100],[5,5], gy, /y, axes =2 qswrite, file ='data.out', /gonly qs2icem, file ='qs2icem.out' MODIFICATION HISTORY: Original version, L. P. Mix, December 22, 2002 Modified: Addded gxout, gyout, gzout keywords - lpm, 10/05/2004
(See ../pfidl/tqpfidl/qs2icem.pro)
This is designed to edit a conductor data for QS input, generate a grid, or edit the grid fitted points for tq input format: qsedit, conductor = conductor, grid = grid, reset = reset, fast = fast,xsize= xsize, ysize= ysize, tquick = tquick conductor if nonzero indicates editing conductor data if Keyword TQUICK is set then tqfit will be used. All data must be in the TQ common block reset then grid for conductors default is fast = 0 fast = 1 - unfilled diamonds fast = 0 - filled circles for the points NOTE: XCUR will print out points to the terminal if the mouse button is pressed. Note: Diagnostic paths can be generated using the SHADOW Conductor button Example: Generate conductor data from scratch qscond, [0, 10], [0, 1] ; define a region of interest qsgrid, [0, 10], [.1, .1], /x ; define a reference grid qsgrid, [0, 1], [.1, .1], /y qsedit, /cond ;edit the conductor data (if desired generate a new grid) qsedit, /grid qsfit ; Fit the data to an existing grid ; ( or use fit button in qsedit, /grid qsedit ; Edit the grid fitted conductors and add markers qswrite ; write the output to a file
(See ../pfidl/tqpfidl/qsedit.pro)
QSEDIT
(See ../pfidl/tqpfidl/qsedit.pro)
purpose: Fit conductors to the grid, does not allow slants format: QSFIT [, conductor] [ , close = close] where: conductor is an optional conductor number default is all conductors. close is an optional keyword to close all conductors NOTE: this will be with a straight line! NOTE: Close will not affect 2 point conductors example: Fit conductors in the TQ common block to the grid qsfit Fit conductors for future use in TQPOTENTIAL qsfit, /close
(See ../pfidl/tqpfidl/qsfit.pro)
format: qsgrid, x, dx, gx, inches = inches, mils = mils, cm = cm, $ multiplier = multip, xaxis = xaxis, yaxis = yaxis, ratio = ratio, gridtype = gridtype, axes = axes, quiet = quiet This procedure generates a grid with a continuous first derivative of the generating function. Either a quadratic or a geometric generating function can be used. X is an array of grid locations which are used to specify the grid interval. DX is an array of grid intervals corresponding to X locations. Note: All DX values must be less than 1/2 of the corresponding X spacing. (ie a minimum of 2 zones per grid region.) If dx is omitted then gx = x GX is the actual grid If X and DX are not specified the last values input according to the values of XAXIS and YAXIS will be used. RATIO is the smallest value of the ratio between adjacent cells. The largest value is 1.0/ratio Default is 0.9 GRIDTYPE is an integer or an array of integers which correspond to each grid region. Default is 0. If GRIDTYPE is an integer, then GRIDTYPE is set to MAKE_ARRAY(n_elements(X)-1, value = GRIDTYPE, /int) If GRIDTYPE is smaller than the number of regions, then the last value will be used for all missing values. If GRIDTYPE is an array, no elements are changed or deleted as shown in paragraph 4 under Procedure. The meaning of GRIDTYPE is as follows: 0 Normal quadratic grid generation scheme. -N If the first grid region, uniform spacing with N grid spaces. If it connects to another grid region, the upper DX value is set to the grid spacing/N Negative GRIDTYPE values are set to the max(GRIDTYPE) > 0 +N Use a geometric grid to over the grid region. Note: If DX on average changes less than 1%/zone then a quadratic grid is used. Specifically if: max(dx(0), dx(n))/min(dx(0), dx(n)) -1 gt 0.005* dist/(dx(0)+dx(n)) then a quadratic grid is used Note: If GRIDTYPE is an array, it will not be modified in QSGRID. For a continous first derivative, both X and DX cannot be specified exactly everywhere. DX is defined as the derivative of the grid generation function. The grid generation function is given by: Quadratic: x(i) = (i*b + a)*i + x(0) Geometric: x(i) = DX/log(R) * (R^i -1) + x(0) Example of GRIDTYPE. assume X = [0, 1, 2, 3], DX=[1,1,1,1], G= -[10, 20, 10] This is would be the same as to: X= X, DX= [.1, -.1, .05, .1], G = 0 explanation: dx(1, 2, 3) are set to the the X-spacing divided by the respective G. Because DX(0) is positive, it is changed to dx(1) and dx(1) is set negative. assume X = [0, 1, 2, 3], DX=[.5,1,1,1], G= [1, -20, -10] This is would be the same as to: X= X, DX= [.5, .05, -.05, .1], G = [1, 1, 1] explanation: dx(2, 3) are set to the the X-spacing divided by the respective G. Because DX(1) is positive, it is changed to dx(2) and dx(2) is set negative. Note: Because of the default limit of ratio, this particular will have an initial derivative of 0.149679 because that is as large as it can grow. assume X = [0, 1, 2, 3], DX=[-0.1,1,1,1], G= [-10, -20, -10] This is would be the same as to: X= X, DX= [-0.1, .1, .05, .1], G = 0 explanation: dx(1, 2, 3) are set to the the X-spacing divided by the respective G. Because DX(0) is already negative, we assume that it is to remain fixed. assume X = [0, 1, 2, 3], DX=[-0.1,1,1,1], G= [-10, -20, -10, 1] This is would be the same as to: X= X, DX= [-0.1, .1, .05, .1], G = 1 explanation: Same as above, but G is set to 1 because the maximum of G is 1. assume X = [0, 1, 2, 3], DX=[0.1,1,1,1], G= [-20, -20, -10, 1] This is would be the same as to: X= X, DX= [0.05,-0.05, .05, .1], G = 1 explanation: Same as the second example regarding DX but because dx(0) is positive, it is changed to dx(1) and dx(1) is set negative. BLOCKS If present, each grid region will be given the indicated block designation. If there are more regions than blocks, the last block will be used for all remaining regions. Default is BLOCKS = 1 Note: If BLOCKS is an array, then (like GRIDTYPE) it will NOT be modified in QSGRID. AXES If present, the grid axis for output will be i, j or k depending on whether AXES is 1, 2, or 3. Default is 'i' if xaxis is set or 'j' if yaxis is set. QUIET If keyword is set, no plots or informational output will be made HELPME If set, print a help message. Procedure: 1. All values of x < x(0) are deleted with the corresponding dx values 2. X values are sorted. 3. GRIDTYPE if it has fewer elements than X/DX is made into an array with the proper number of elements. 4. Negative GRIDTYPE values are resolved and any X values which are spaced closer than twice the corresponding DX values are deleted. 5. If all DX are positive: Start with smallest x and generate grid using an integer number of grids points and a best effort to match the specified DX values. If one or more negative DX values, then: Use the first negative DX value and the corresponding X value to generate a grid toward lower values. In this generation, the end points are exact, and a best effort to match the specified DX values is made. Generate the grid toward larger values by using an integer number of grids points and a best effort to match the specified DX values if dx(i) is positive or vary the endpoint to obtain in endpoint interval given exactly by the absolute value of dx(i) . Side Effects: The grid will be in WDF array 80 The derivative will be in WDF array 81 For X grids, the grid, first, second , and ratio of the derivatives are in 71 to 74 For Y grids, the grid, first, second , and ratio of the derivatives are in 75 to 78 Example; generate a uniform y grid from 0 to 10 with spacing of .05 and units of inches. qsgrid, [0, 10],[0.05, 0.05], /inches, /y generate a grid which varies from .1 to .01 to .1 in going from 0 to 5 to 10 with units of cm qsgrid, [0, 5, 10], [.1, .01, .1], /cm, /x generate a grid which has a dx of exactly 0.001 at 4 and is 0.01 near 10 and is about 0.01 at 0 for the y axis with units of mils qsgrid, [0, 4, 10], [0.01, -0.001, -0.01], /mils, /y generate a grid which has uniform spacing between 2 and 4 with 50 spaces increases geometrically at either side of the interval. qsgrid, [0, 2, 4, 6], [1, 1, -1, 1], g= [1, -50, 1], /x or qsgrid, [0, 2, 4, 6], [1, 1, 1, 1], g= [1, -50, 1], /x or qsgrid, [0, 2, 4, 6], [1, .04, -0.04, 1], /g, /x Note: The limits for the first and last regions will be changed to about 0.25 because of the default limit on the value of R for the geometric grid generator of 0.9 Note: In the first two examples the values of DX(1:2) of 1, -1 are ignored and a uniform mesh of 50 intervals is generated. Values of DX should be less than or equal to half the X spacing to prevent elimination. Note: A geometric grid with abs(dxn/dx0 - 1) less than 0.02*n reverts to a quadratic grid where n is the number of intervals
(See ../pfidl/tqpfidl/qsgrid.pro)
Write a file to be included in a QS geometry input deck format; qswrite, grid = grid, transp = transp, gonly = gonly, file = file, $ xonly = xonly, yonly = yonly, path = path, append = append if keyword (GRID) is set then the conductor values fit to the grid will be printed. Default is the actual spatial values. if keyword (TRANSP) is set then x and y will be interchanged if keyword (gonly) is set then only grid parameters will be written if file is specified, the data will be written to this file. If no file is specified, a widget will inquire to determine the file if APPEND is set then the data will be appended to the file if XONLY is set then only X-grid data will be written if YONLY is set then only Y-grid data will be written if either XONLY or YONLY are set then GONLY is set. if PATH is set, output in the form of line segments for a path integral
(See ../pfidl/tqpfidl/qswrite.pro)
Read a portion of a QSGRID generated comment string to regenerate a grid commands. Below is an example of a file: File must have "Multiplier = "line *# *# Grid generated using the following grid locations and grid spacing *# Initial-X Delta-X (Spatial Multiplier = 0.00100000) *# -16.930000 0.55889499 *# -10.430100 0.25359249 Quadratic *# -7.4666800 0.28521122 Quadratic *# -6.0756302 0.17847207 Quadratic *# -4.9217401 0.28308398 Quadratic *# -3.4692800 0.13190460 Quadratic *# -1.7009900 0.26104874 Quadratic *# 6.0110698 0.20634882 Quadratic *# 8.0273705 0.16025130 Quadratic *# 10.684400 0.15234036 Quadratic *# 12.348300 0.32305975 Quadratic *# 17.572001 0.54755701 Quadratic *# Format: QS_READ_GRID [, FILE_NAME] , /XAXIS or ,/YAXIS , _EXTRA = extrastuff [, /READONLY] [, VALUES = VALUES] [, DELTAS = DELTAS] [, MULTIPLIER = MULTIPLIER] [, NoScale = noscale] [, /HELPME] where: FILE_NAME - The file name If missing, PICKFILE will be used. /XAXIS | | - One Keyword must be set to specify the horizontal or vertical /YAXIS | axis. Note: AXES may be passed as an extra parameter Note: If Xaxis is set, yaxis is set to zero. _EXTRA - Any other valid keywords for QSGRID. /READONLY - If set, file will only be read. VALUES - Grid tie points DELTAS - Grid delta values MULTIPLIER - Grid Spatial multiplier NoScale - If set the multiplier will not be applied ot the values. HELPME - If set, a help message will be printed Side Effect: If readonly is not set, the following command is issued: QSGRID, values*multiplier, deltas*multiplier, xaxis = xaxis, yaxis=yaxis, $ multiplier = 1.0, _extra = extrastuff If NoScale is set then the command is: QSGRID, values, deltas, xaxis = xaxis, yaxis = yaxis, $ multiplier = multiplier, _extra = extrastuff Example: Read a file for the X axis. QS_READ_GRID, /x
(See ../pfidl/tqpfidl/qs_read_grid.pro)
this program reads a dxf file most of the time!! format: readdxf, x, y, loc, file, nosort = nosort, resolution = resolution layers = layers, plotall = plotall, insertblocks = insertblocks arc = arc, circle = circle, range = range where: x are the x-values y are the y-values locg is a pointer to the start locations of each conductor conductor i has values: x = xx(locg(i-1):locg(i)-1) y = yy(locg(i-1):locg(i)-1) file is the file name If not specified, pickfile will be used. nosort if present and not zero skip sorting data layers - returns the layer value for each entity plotall - if present and not zero, plots the insert blocks with a value of !p.multi = [0,2,2] unless !p.multi has a nonzero value on entry insertblocks - returns a structure of the insert blocks. values are x - xvalues y - yvalues loc - pointer to each conductor segment layer - layer value point - pointer to loc for each insert block name - insert block names resolution is optional parameter indicating how close points must be to connect them into a single conductor. Default is: resolution = max([xx, yy])/4.0e3 ARC and CIRCLE are keywords indicating the number of points to be used to make a circle or an arc. Default is 31 points maximum for both entities. The number of points is given by: NP = Circle (Default = 31) NP = Min(ARC, Angle * (ARC)/180) (Angle in degrees; Default = 31) this is a prototype code - use with caution; contact paul mix if you have problems. Splines are currently inserted as control points only! Example; Read data from a file, 'raised_cone.dxf' readdxf, x, y, loc, 'raised_cone.dxf'
(See ../pfidl/tqpfidl/readdxf.pro)
read markers from an ascii file file generated from save_markers file format: name x, y comment Name must be have one or more ascii characters. # indicates a comment and is ignored. a blank line is ignored except for the comment line Command format: RESTORE_MARKERS [, FILENAME] [/RESET] where FILENAME - Name of the file containing the marker information Default: Use pickfile RESET - If set, all current markers are removed.
(See ../pfidl/tqpfidl/restore_markers.pro)
Remove all markers on the grid format: rm_marker
(See ../pfidl/tqpfidl/rm_markers.pro)
Write markers to an ascii file SAVE_MARKERS can be used to save the markers when problem has a new grid file format: name x, y comment (May be blank) Name must be have one or more ascii characters. # indicates a comment and is ignored. a blank line is ignored except for the comment line Command format: SAVE_MARKERS [, FILENAME] [, /SPACE] where FILENAME - Name of the file containing the marker information SPACE - If set put a comment space between markers.
(See ../pfidl/tqpfidl/save_markers.pro)
Routine: Slice2Cond Format: Slice2Cond, str, xval, yval [, RESET = reset] where: str - Structure or structure array number with a conductor slice Xval - Dimension to be used for the X axis Yval - Dimension to be used for the Y axis reset - Optional keyword to be used in call to tqcond. Default = 1; All old values will be eliminated and these values added. Reset = 0 will add new conductors to existing ones. Example: Put a slice from structure 5 into the conductor structure mapping Z values to x and X values to Y. SLICE2COND, 5, 3, 1 Original version April 14, 1997. lpm
(See ../pfidl/tqpfidl/slice2cond.pro)
TQ2S Purpose: Convert a conductor fitted to a grid to a conductor structure or multiple conductor structures. Format: TQ2S [, str] [, /ALL ] where: str - Structure array array number for the first conductor Default is 50. Caution: Str can be changed for each conductor. No checks are make to insure that conductors are not overwritten. ALL - If keyword is set, then all conductors will be put into a single structure array.
(See ../pfidl/tqpfidl/tq2s.pro)
NAME: TQCHA PURPOSE: Change the prameters of a TQ common block for conductors or grids Note: Grid units are not changed. That is, if units are inches, then the grid units will remain "inches". To change grid values use the following: tqhelp, x = xout, dx = dxout, y = yout, dy = dyout to change actual values use the following: tqgrid, xout*mxdim +axdim, dxout*mxdim, mult = newmult , /x tqgrid, yout*mydim +aydim, dyout*mydim, /y where mxdim, axdim, mydim, and aydim are defined below. NEWMULT is a new scale multiplier. CATEGORY: Utility CALLING SEQUENCE: TQCHA INPUTS: None - TQ common block is modified for Conductors only KEYWORD PARAMETERS: MXDIM Multiply the X conductor values by this value MYDIM Multiply the Y conductor values by this value MADIM Multiply BOTH conductor spatial values by this value AXDIM Add this offset to the X spatial dimension AYDIM Add this offset to the Y spatial dimension AADIM Add this offset to BOTH the spatial dimensions REPLICATE If present and not zero, then the specified conductor will be replicated with the specified shift and scaling ZX If present and not zero then AXDIM will be set to the the negative of the minimum conductor X-value AXDIM will be set to the value ZY If present and not zero then AYDIM will be set to the the negative of the minimum conductor Y-value AYDIM will be set to the value HELP If present and not zero, a help message will be printed. NOTE: Multiplication and division are performed according to: Xnew = Xold * MXDIM + AXDIM OUTPUTS: NONE The specified structures are modified and stored in their original locations COMMON BLOCKS: PFIDLTQ RESTRICTIONS: At least one conductor must be defined. EXAMPLES: Shift the entire conductor assembly by 2.5 in x and 3.5 in y TQCHA, ax = 2.5, ay = 3.5 Replicate conductor 2, 9 times with a shift in x of 1.2 For i = 1, 9 do tqcha, replicate= 2, ax = i*1.2 MODIFICATION HISTORY: Original version, L. P. Mix, October 21, 1994
(See ../pfidl/tqpfidl/tqcha.pro)
This routine is intended to erase all areas outside a conductor, but requires user intervention to set up the command. See the example. Format: Tqclean [, cond_in] [, color = color] [, _extra = extrastuff] where cond_in : Conductor structure from tqhelp tqhelp, cond = cond_in color is an optional keyword indicating the color of the conductor. Default is one color = !p.background If color is an array then each conductor segment will be a different color given by each element of the color array. Colors will be recycled. Example: If color is 3 then all conductors will be blue. If color = [1, 2, 3] then the first conductor is red, the second is green and the third is blue. If there are more than 3 conductors then the colors will be recycled, ie, the fourth conductor will be red, .... Example: Assume you are plotting field data with the following command: plotstr, 3, 3, 2, 0, /xint, con= 1 where you are plotting a plane normal to the second coordinate and you observe the contour lines passing through the conductor. These lines can be erased with the following series of commands where the conductors are assumed to be in structure 1 and the grid in structure 2: tqreadcon, 1, 3, 1, 0, /reset tqedit, /cond in the editor modify the conductors so that they extend to the boundary and are closed or would be closed if first and last points are connected: for example: figure on left might have conductors on right ___________________ __________ | | | | | | (cond) | | | | |________| | ________| | | (vac) | | | |__________________| | | change the conductor to a closed block as shown below: __________ | | | (cond) | |________| Note: tqsave may be used to save the conductor configuration Now do the plot: plotstr, 3, 3, 2, 0, /xint tqclean plotstr, 1, /over ; plot the conductors if desired last Note: After the geometry has be set in TQEDIT, TQCLEAN may be called as many times as desired.
(See ../pfidl/tqpfidl/tqclean.pro)
Purpose: Store conductor data in the TQ common block Format: TQCOND,x, y, locx, replace = replace, delete= delete, reset = reset where x and y are ordered pairs defining one or more conductors NCON is the number of conductors NCON = n_elements(locx)-1 If x and y repreasent more than one conductor then locx is an array defining the start location for each conductor Note: conductor n has values given by: X = x(locx(n-1):locx(n)-1) Y = y(locx(n-1):locx(n)-1) LOCX is not required if NCON = 1 RESET set everything to initial conditions. REPLACE - Use the xy conductor values to replace one or more values Number of conductors (NCON) must equal n_elements (replace) DELETE - Delete a conductor. X, Y, and LOCX are ignored NEW - Use the xy values to add new conductors NEW is the default operation and is not checked. Conductors are numbered 1, 2, ... Example: Store a dummy conductor in the TQ common block tqcond, [0, 1], [0, 3] Read data from a dxf file and convert to cm and store in TQ common block readdxf, a, b, l, 'data.dxf' a = a*2.54 & b = b*2.54 tqcond, a, b, l
(See ../pfidl/tqpfidl/tqcond.pro)
This is designed to edit a conductor data for TQ input or edit the grid fitted points for tq input format: tqedit, conductor = conductor, reset = reset, fast = fast,xsize= xsize, ysize= ysize conductor if nonzero indicates editing conductor data All data must be in the TQ common block reset then grid for conductors default is fast = 0 fast = 1 - unfilled diamonds fast = 0 - filled circles for the points NOTE: XCUR will print out points to the terminal if the mouse button is pressed. Example: Generate conductor data from scratch tqcond, [0, 10], [0, 1] ; define a region of interest tqgrid, [0, 10], [.1, .1], /x ; define a reference grid tqgrid, [0, 1], [.1, .1], /y tqedit, /cond ;edit the conductor data (if desired generate a new grid) tqfit ; Fit the data to an existing grid tqedit ; Edit the grid fitted conductors and add markers
(See ../pfidl/tqpfidl/tqedit.pro)
TQEDIT
(See ../pfidl/tqpfidl/tqedit.pro)
purpose: Fill an array with number for conductors If an error occurs, array = 0 format: tqfill, array, x, y [, value = value] NOTE: Conductors must be closed with all bad points removed. where: Array is the grid array of integers x are the X values y are the Y values value is optional fill value, must be an integer default is the conductor number example: Return a array of the conductor locations. tqfill , array, xx, yy
(See ../pfidl/tqpfidl/tqfill.pro)
format: tqfilter, x, y, loc, layers, layers = keeplayers, xrange = xrange, yrange = yrange, xzero = xzero, yzero = yzero, zero = zero, undo=undo, quiet = quiet where x - X conductor values y - Y conductor values loc - pointer to the conductor arrays layers - optional array for the layers of each conductor element keeplayers - optional array of desired layers. xrange - desired X-range of conductors yrange - desired Y-range of conductors Note - If a single value is provided, the cursor will be used. Note - Any conductors not entirely within xrange/yrange will be eliminated. xzero - set minimum x to xzero value yzero - set minimum y to yzero value zero - set minimum x and y to zero value undo - revert to the last x, y, loc, levels values passed to tqfilter quiet - if present and not zero, no plot will be make of the final result examples Restore previous values tqfilter, a, b, c, lev, /undo Take only conductors between (0, 0) and (6, 4) tqfilter, x, y, loc, xr = [0, 6],yr = [0, 4] Set minimum x and y values to zero tqfilter, x, y, loc, zero = 0.0 Take only levels [0, 1] tqfilter, x, y, loc, lev, layers = [0, 1] Take the set of x, y, loc and layer values from previous call to tqfilter and filter for levels [0, 1, 6] tqfilter, x, y, loc, lev, lay = [0, 1, 6], /undo
(See ../pfidl/tqpfidl/tqfilter.pro)
purpose: Fit conductors to the grid format: tqfit, conductor, close = close where: conductor is an optional array specifying the conductors to be fit default is all conductors close is an optional keyword to close all conductors NOTE: this will be with a straight line! NOTE: Close will not affect 2 point conductors example: Fit conductors in the TQ common block to the grid tqfit Fit conductors for future use in TQPOTENTIAL tqfit, /close
(See ../pfidl/tqpfidl/tqfit.pro)
format: tqgrid, x, dx, gx, gdx, inches = inches, mils = mils, cm = cm, $ multiplier = multip, xaxis = xaxis, yaxis = yaxis, quiet = quiet This procedure generates a grid with a continuous first derivative using a quadratic generating function. X is an array of grid locations which are used to specify the grid interval. DX is an array of grid intervals corresponding to X locations. If dx is omitted then gx = x GX is the actual grid GDX is the actual grid spacing. QUIET - If set, no plots will be drawn For a continous first derivative, both X and DX cannot be specified exactly everywhere. Procedure: 1. All values of x < x(0) are deleted with the corresponding dx values 2. X values are sorted. 3. If all DX are positive: Start with smallest x and generate grid using an integer number of grids points and a best effort to match the specified DX values. If one or more negative DX values, then: Use the first negative DX value and the corresponding X value to generate a grid toward lower values. In this generation, the end points are exact, and a best effort to match the specified DX values is made. Generate the grid toward larger values by using an integer number of grids points and a best effort to match the specified DX values if dx(i) is positive or vary the endpoint with interval given exactly by the absolute value of dx(i) . Example; generate a uniform y grid from 0 to 10 with spacing of .05 and units of inches. tqgrid, [0, 10],[0.05, 0.05], /inches, /y generate a grid which varies from .1 to .01 to .1 in going from 0 to 5 to 10 with units of cm tqgrid, [0, 5, 10], [.1, .01, .1], /cm, /x generate a grid which has a dx of exactly 0.001 at 4 and is 0.01 near 10 and is about 0.01 at 0 for the y axis with units of mils tqgrid, [0, 4, 10], [0.01, -0.001, -0.01], /mils, /y
(See ../pfidl/tqpfidl/tqgrid.pro)
purpose: return data in TQ common block format: tqhelp, x=xout, dx=dxout, y=yout, dy=dyout, cond=condout, $ gx=gxout, gy=gyout, gxhalf = gxhalfout, gyhalf = gyhalfout markerstring = markerstring where: x and dx are TQgrid parameters for the x-grid y and dy are TQgrid parameters for the y-grid cond is the conductor structure gx and gy are the grid values. ghx, ghy are half grid values markerstring are the marker strings written to the output file Example: get the x and dx values for the current grid tqhelp, x= x, dx= dx
(See ../pfidl/tqpfidl/tqhelp.pro)
Purpose: This is primarily a plot utility for tqedit. format: tqplot, conductors = conductor , grid = lcgrid , overlay = overlay, $ mode = mode in all cases below conductors should have as many elements as conductors of value 0 or 1 where mode = 'INPUT' conductors = conductors to be plotted. If zero none plotted grid = 0 if no grid is to be plotted; otherwise, plot grid overlay = make a grid based on the conductor data. where mode = 'COND' conductors = conductors to be plotted in color. If zero, conductor is plotted dashed in white grid = 0 if no grid is to be plotted; otherwise, plot grid overlay = make a grid based on the conductor data.
(See ../pfidl/tqpfidl/tqplot.pro)
Purpose: Plot a tq conductor NOTE: This is an overplot which requires a grid. format: tqplotcon [, COLOR = color] [, FILL = fill] [, GRID = grid] [, ORIENTATION = orientation] [, _EXTRA = extrastuff] Color: Color to draw the conductor Multiple values are cycled. If nc is the number of colors and nd is the dataset number, then the dielectric color is: dielectric_color = color[nd mod nc] GRID: Draw a grid. If GRID is a structure, pass the structure to the plot command. Default parameters are: XTITLE = 'X-Axis', YTITLE = 'Y-Axis' FILL: If set, POLYFILL rather than OPLOT is used ORIENTATION: IF set, this is passed to POLYFILL for LINE FILL. If ORIENTATION eq 1, then ORIENTATION = [-45., 45.] _EXTRA: Passed to PLOT or POLYFILL. example: Plot the current conductors with fill and cycle through first 3 colors TQPLOTCON , /fill, color = [1, 2, 3] Plot the current conductors and cycle through colors Plot a grid with the following parameters {title:'Anode and Cathode',xtitle:'Radius',ytitle:'Z-Axis',xrange:[0, 3.5],xstyle:1} grid = {title:'Anode and Cathode',xtitle:'Radius',ytitle:'Z-Axis',xrange:[0,.35],xstyle:1} tqplotcon, /fill, color=1+indgen(3), grid = grid
(See ../pfidl/tqpfidl/tqplotcon.pro)
Purpose: Calculate the 2-D electrostatic field for a distribution of conductors, dielectrics, and charges. Format: tqpotential [, Es] [, Phis] [, CEs] [, niteration = niter] [, file = file] [, ei = ei] [, ej = ej] [, phi = phi] [, xgrid = xi] [, ygrid = xj] [, edensity = edensity] [, energy = energy] [, charge = charge] [, xcharge = xcharge] [, ycharge = ycharge] [, dielectric = dielectric] [, xdielectric = xdielectric] [, ydielectric = ydielectric] [, cim = cim] [, qarr = qarr] [, epsi = epsi] [, potential = pot] [, boundary=boundary] [, rerun = rerun] [, quiet = quiet] BATCH MODE [, /batch_ mode] [, maxiteration = maxiteration] [, err_convergence = convergence] [, cmissing = cmissing] [, rdielectric = rdielectric] [, coordinate = coordinate] [, conductors = conductors] [, Cvalue = cvalue ] [, boundary=boundary] [, bpotential = bpot] NOTE: Conductors, dielectrics and regions of uniform charge must must be closed on closed surfaces and fit to a grid with all bad points removed. Exception: Two point conductors are allowed. Note: Conductors are grid based; conductor values go to grid points. Slant surfaces are not allowed for dielectrics! Dielectrics are based cell based and depend on the contents of cell volume; a diagonal indicates neither an empty or full cell. Note: If conductor 4 is a dielectric and the other conductors have been fit with TQFIT, uset "QSFIT, 4" to refit the dielectric. Note: QSFIT produces the same potential distribution as TQFIT since the the nodes are the same with the two fit procedures. Note: To pass in values of the CIM and dielectric matrix. NOTE: To integrate fields to obtain potentials, use the cell centered Electric fields and the waveform INT routine to obtain accurate values. The routines "plotstr, /yint" will produce small errors if conductors do not lie on the boundary. where: The calculated potential and electric fields are stored in the 3 locations designated by Es, Phis, and CEs. Assume a grid with nx and ny full grid values Es Structure array number for the two components of the electric field, Default = Maxstructure-2 (80) (size = nx by ny) Phis Structure array number for the potential, Default = Maxstructure-1 (81) (size = nx by ny) CEs Structure array number for the cell centered Electic fields Default = Maxstructure-3 (79) (size = (nx-1) by (ny-1)) Note: Integral of a lineout of the CEs should be -Potential Niter Number of iterations required for convergence File If specified, output will be sent to a PFF file Ei Electric field matrix in the i direction This is the first component of structure Es Ej Electric field matrix in the j direction This is the second component of structure Es NOTE: Ei and Ej cannot be integrated exactly to produce the potential, PHI, because of the discontinuous nature of the field PHI Potential matrix (size = nx by ny) Xi Coordinates for the i direction, X values for Ei, Ej, PHI If RERUN < 1 then Xi are the full grid values for the CIM. Values returned will be different if system is left handed. Xj Coordinates for the j direction, Y values for Ei, Ej, PHI If RERUN < 1 then Xj are the full grid values for the CIM. Values returned will be different if system is left handed. EDensity (Ei^2 + Ej^2)*epsi*8.8541878e-12/2 (size = (nx-1) by (ny-1)) Energy Total (edensity*dx*dy) for system = 1 Total (edensity*y*dx*dy) for system = 2 Total (edensity*x*dx*dy) for system = 5 Total (edensity*x^2*dx*sin(y)dy) for system = 5 Total (edensity*radius^2*sin(x)*dx*dy) for system = 4 Total (edensity*sin(theta)*dx*y^2*dy) for system = 6 Note: Future versions will handle different coordinates. *Charge, Xcharge, Ycharge Charge can be a structure array, array number or a 2D array If a 2D array, then X/Ycharge specify the coordinates These parameters allow for non-uniform charge distributions. Units should be Coul/m^3, X and Y units are the units of the grid.(cm, inches, ...) Default = 0.0 *Dielectric, Xdielectric, Ydielectric Dielectric can be a structure array, array number or a 2D array If a 2D array, then X/Ydielectric specify the coordinates These parameters allow for non-uniform dielectric distributions. Units should be Coul/m^2, X and Y units are the units of the grid.(cm, inches, ...) Default value = epsilon default. *NOTE: If a structure array is passed, tags v1 will be used as the quantity and the x and y values will be x1 and x2 unless x and y are specified. For example: charge= 3, xcharge = 3, ycharge = 1 will use structure array 3 as a z-x plot or a z-r plot. CIM Conductor matrix. The CIM used for the calculation is returned. If RERUN < 0 then the input CIM will be used for all conductors. Values should be integers 1 to N. POT(0:N-1) contains the voltages on these conductors. A CIM must be input with values of Xi and Xj corresponding to the full grid values in the CIM for rerun < 0. IF CIM is not a LONG array it will be changed to a long array. qarr Charge matrix. The charge matrix used for the calculation will be returned. If RERUN < 1 then if CIM and QARR are the same size then QARR will be used as the charge array. epsi Relative dielectric constant matrix If RERUN < 1 then if CIM and EPSI are the same size then EPSI will be used as the dielectric array. pot Potential values, Values of the voltage on each conductor rerun If positive, the previous values for the boundary conditions, conductors, charge, and dielectric will be used as the default If the keywords: cim, qarr, or epsi contain an array then their contents will be used in the rerun. NOTE: If BATCH_MODE is set then RERUN=0 NOTE: The potentials, number of conductors, and boundary conditions may not be changed for rerun > 0. If negative, a CIM, QARR and EPSI array will be used for input. Note: If coordinates are Left-handed Xi and Xj will be interchanged on return. Full grid values will be passed in with Xi and Xj. If rerun is less than 0 then a ATHETA calculation is expected. If EPSI and QARR are single elements then a constant charge and dielectric background is expected. Default values are EPSI = 1, QARR= 0 ATHETA requires a second keyword: "boundary" BATCH_MODE: If set, all input will be from the command line. This is similar to ReRun but does not require any of the above parameters. MaxIteration: Maximum number of iterations. Must be > 10 Default: MaxIteration = 200 COORDINATE: Coordinate system for the solution 1 Cartesion x-y -1 Cartesion y-x 2 Cartesion y-z -2 Cartesion z-y 3 Cartesion z-x -3 Cartesion x-z 4 Cylindrical z-r -4 Cylindrical r-z 5 Cylindrical r-phi -4 Cylindrical phi-r 6 Spherical theta-phi -6 Spherical phi-theta 7 Spherical r-theta -7 Spherical theta-r 8 Spherical phi-r -8 Spherical r-phi IF RERUN is set: (No Default) If Coordinate is not specified, a widget will get system. If BATCH_Mode is set: Default: Coordinate =1 CMissing - Value of the missing coordinate. TQPOTENTIAL calculates a Two dimensional potential. Default - CMissing = 0.0 if Abs(coordinate) not 6 CMissing = 1.0 if Abs(coordinate) = 6 Err_Convergence: Convergence Criteria for P2D. Must be positive and less than 0.1 Note: P2D is performed in Double Precision but iteration is on the potential. Electric fields are calculated from the potentials and will have larger errors. Default: Err_Convergence = 3.0e-11 RDielectric: Default relative dielectric. Dielectric matrix will be filled with this value. Dielectric regions defined in TQEDIT will replace the default values. Conductors: An array of integers with at least as many elements as the number of conductors in tqedit. (The user can determine the correspondence between numbers and conductors in TQEDIT by toggling the conductors. Note: TQEDIT conductors begin with 1; IDL arrays begin with 0.) Values must be 0, 1, 2, or 3. Conductor[i] = 0 - Ignore the conductor = 1 - Metalic conductor = 2 - Dielectric region = 3 - Charge region CValue: An array of floats with at least as many elements as the number of conductors in tqedit. Value depends on the value of the conductor. If Conductor[i] = 0 then CValue[i] is ignored If Conductor[i] = 1 then CValue[i] is the Conductor Voltage (Volts) If Conductor[i] = 2 then CValue[i] is the Relative dielectric constant If Conductor[i] = 3 then CValue[i] is the Charge Density (Coulomb/(m*m)) BOUNDARY: 4 element array with the boundary conditions Valid values are: 0 is Periodic 1 is Mirror Boundary 2 is Conducting: This is ignored, unless batch mode. User must fill boundary cim values with conductor and set the POT value to the potential for rerun. This may be set in batch mode The order of the values is: [Left (min X), Right (Max X), Bottom (Min Y), Top (Max Y)] Any values not 0 or 1 will be set to 2 If boundary(0) is 0 then boundary(1) is ignored. If boundary(2) is 0 then boundary(3) is ignored. BPOT: If boundary[i] eq 2, then BPOT[i] is the boundary potential Ignored unless boundary[i] eq 2. BPOT must have 1 or 4 values. DEFAULT: BPOT = [0,0,0,0] if BPOT has 1 value then BPOT = make_array(4, value = float(bpot[0])) quiet May only be set with rerun > 0. If present and set, then informational text will not be printed example: The following steps can be followed to calculate a potential 1. Generate a set of conductor surfaces, dielectric surfaces, or charge distributions; for example, tqcond, x, y, loc 2. If required, edit geometry and close all surfaces. tqedit, /cond 3. Generate a grid tqgrid, [0, 100], [.2, .2], /x, /cm tqgrid, [0, 100], [.2, .2], /y 4. Fit the surfaces to the grid and close conductors tqfit, /close 5. Modify fit values to remove bad points or improve fidelity. tqedit 6. Calculate 2D fields tqpotential 7. Plot results plotstr, 80, [1,2] ; for magnitude of the field plotstr, 81 ; for the potential profile 8. Convert conductors to conductor structures in array, 1 TQ2S, 1, /all 9. Overplot conductor PLOTstr, 1, /over, col = 5 Alternatively: 1. Obtain a conductor surface and grid from a previous calculation: READSTR, 1, 3, 5 ; where conductors are in 3, 4, 5, 6, 7,8 TQREADCON, 1, 3, 1, .1 ; where the third and first dimension ; are X and Y and the slice is at 0.1 ; in the second dimension READSTR,2,2 ; read the grid from the same file TQREADGRD, 2, 3, 1, .1 ; put the grid into the TQ calculation QSFIT TQEDIT ; confirm geometry TQPOTENTIAL Another example: xi = findgen(10)/9 xj = xi/100 cim = make_array(10, 10, /long) cim(*, 0)=1 cim(*, 9)=2 pot = [0, 1] boundary = [1, 1, 2, 2] tqpotential, 1, 2, 3, cim = cim, xgrid = xi, ygrid = xj, $ potential = pot, coordinate = 1, boundary= boundary, rerun = -1
(See ../pfidl/tqpfidl/tqpotential.pro)
read a conductor into a tq conductor structure. Format: tqreadcon, dataset, x-axis, y-axis [, zvalue] [, nosort = nosort] [, _extra = extrastuff] where: dataset - Conductor structure or structure array number x-axia - 1, 2, or 3 - the x-axix coordinate value y-axia - 1, 2, or 3 - the y-axix coordinate value zvalue - optional value of the remaining coordinate. Default is to take the midpoint of the first block. nosort - if set, conductor segments will be left separate. extrastuff - valid keywords for TQCOND example; Read the structure array 2 into the tq structure with Z as x and R as y. Read all blocks. TQREADCON, 2, 3, 1 , 0
(See ../pfidl/tqpfidl/tqreadcon.pro)
read a grid into a tq gridding structure. Format: tqreadgrd, dataset, x-axis, y-axis [, zvalue] [, block = block] where: dataset - Grid structure or structure array number x-axia - 1, 2, or 3 - the x-axix coordinate value y-axia - 1, 2, or 3 - the y-axix coordinate value zvalue - optional value of the remaining coordinate. Default is to take the midpoint of the problem . block - optional block specifier, NOTE: Grid must be continuous in the specified blocks. example; Read the structure array 2 into the tq structure with Z as x and R as y. Read all blocks. TQREADGRD, 2, 3, 1
(See ../pfidl/tqpfidl/tqreadgrd.pro)
Save the data stored in WDF arrays and in structure arrays Format: TQRESTORE, file [, filename = filename] [, _EXTRA = extrastuff] where: file - File in which the data is stored Default is 'tqsaveit.sav' filename- Optional way of specifying the file name. _EXTRA - Any additional keywords recognized by RESTORE Example: Restore the data from a previous session tqrestore Restore the data from the session in file 'qs5581.sav' tqrestore, 'qs5581.sav'
(See ../pfidl/tqpfidl/tqrestore.pro)
Save the data stored in TQ common blocks Format: TQSAVE, FILE = file, _EXTRA = extrastuff where: file - File in which the data is stored Default is 'tqsaveit.sav' _EXTRA - Any additional keywords recognized by SAVE Example: Save the data from the current session tqsave Save the data from the current session in file 'qs5581.sav' tqsave, file = 'qs5581.sav'
(See ../pfidl/tqpfidl/tqsave.pro)
Name: tqset_system Purpose: Set the TQ geometry coordinate system. Normally this will be done automatically by other routines. Format: tqset_system, lcquit, offset = offset offset - optional parameter to set the position of the widget lcquit - 0 = OK pressed 1 = QUIT pressed
(See ../pfidl/tqpfidl/tqset_system.pro)