SCRIPTLIB man pages

Authors: William M. Chan and Stuart E. Rogers

Introduction

The files in the scriptlib directory contains a collection of Tcl scripts used for grid manipulation, generation and reorganization. Each file contains one or more Tcl procedures that utilize batch mode modules from Chimera Grid Tools. To use these Tcl procedures in a calling script,
 1. Define a SCRIPTLIB environment variable in the user's .login or .cshrc

    setenv SCRIPTLIB [full_path_to_chimeraxxx/scriptlib]

 2. Include the following line at the beginning of the calling script where
    env is defined to be a global variable.

    lappend auto_path $env(SCRIPTLIB)
For an example on how to use the CGT script library in a script, see examples/scriptlib/Sample.

The Tcl procedures available can be categorized as follows (click on +/- to see procedures available for the category):

Currently, the scripts in scriptlib adopt one of two methods to access the modules in CGT.
Method 1

   In the calling script, define a global variable File which stores the path
   to each CGT executable:

   set File(GRIDED) $BINDIR/grided
   set File(SRAP)   $BINDIR/srap
   ...

   where BINDIR = path to CGT executables
  
   The advantage of this method is that BINDIR can be set to the location of
   single precision or double precision executables easily.

Method 2

   In the calling script, define a global variable File which stores just the
   names of the executables:

   set File(GRIDED) grided
   set File(SRAP)   srap
   ...

   The user's path is then used to determine the location of the CGT executables.

   The following procedures adopt method 2 while all other procedures adopt method 1:
   
   GetArcLen, GetArcLoc, GetArcMinMax, GetBnds, GetCellInf, GetChord, GetDim,
   GetDz0, GetInt, GetJkl, GetLE, GetNgrid, GetTotalNp, GetXyz, TrimCurve
   GrowSrf, RespanJ, RespanK, RespanL
   




Basic Grid Functions

Dist $XYZ1 $XYZ2 / Dist $X1 $Y1 $Z1 $X2 $Y2 $Z2 Return distance between two points (can have 2 or 6 arguments). With 2 arguments: XYZ1 = list containing x,y,z of 1st point [list $X1 $Y1 $Z1] XYZ2 = list containing x,y,z of 2nd point [list $X2 $Y2 $Z2] With 6 arguments: X1,Y1,Z1,X2,Y2,Z2 = x,y,z coordinates of 1st and 2nd point E.g., set d [Dist 2.5 3.4 1.8 3.3 2.9 1.6] GetArcLen $GRID $JS $JE $KS $KE $LS $LE $NGRID Return the arc length between 2 points along a grid line. Subset defined by JS,JE,KS,KE,LS,LE must be a curve. So only one pair can have different starting and ending indices. GRID = grid filename JS,JE = starting and ending J index KS,KE = starting and ending K index LS,LE = starting and ending L index NGRID = grid number (optional), if input grid file contains multiple grids GetArcLoc $GRID $ARCN $JS $JE $KS $KE $LS $LE $NGRID Return the location of an arc distance along a grid line. Subset defined by JS,JE,KS,KE,LS,LE must be a curve. So only one pair can have different starting and ending indices. GRID = grid filename ARCN = normalized arc length (0-1) along curve. If this value is negative, it is assumed to be not normalized, but the distance in physical space. JS,JE = starting and ending J index KS,KE = starting and ending K index LS,LE = starting and ending L index NGRID = grid number (optional), if input grid file contains multiple grids The return list contains [list $J $K $L $X $Y $Z $ARC] where J,K,L = grid index at the location of the ARC along the grid line X,Y,Z = coordinates at the location of the ARC along the grid line ARC = the arc length in physical space that corresponds to the normalized ARCN in the inputs. GetArcMinMax $GRID $JS $JE $KS $KE $LS $LE $IDIR $NGRID Return min/max total arc length and location in direction IDIR over subset JS,JE,KS,KE,LS,LE. GRID = grid filename JS,JE = starting and ending J index KS,KE = starting and ending K index LS,LE = starting and ending L index DIR = 1/2/3 (J/K/L) direction NGRID = grid number (optional), if input grid file contains multiple grids The returned list contains [list $ARCMIN $IND1 $IND2 $ARCMAX $IND3 $IND4] ARCMIN = min total arc length in IDIR direction IND1,IND2 = K and L index (IDIR=1) J and L index (IDIR=2) J and K index (IDIR=3) ARCMAX = max total arc length in IDIR direction IND3,IND4 = K and L index (IDIR=1) J and L index (IDIR=2) J and K index (IDIR=3) GetBnds $GRID $JS $JE $KS $KE $LS $LE $NGRID Return the minmax bounding box of a grid. GRID = grid filename JS,JE = starting and ending J index (negative indices allowed) KS,KE = starting and ending K index (negative indices allowed) LS,LE = starting and ending L index (negative indices allowed) NGRID = grid number (optional), if input grid file contains multiple grids The returned list contains [list $XMIN $XMAX $YMIN $YMAX $ZMIN $ZMAX] GetCellInf $GRID $JS $JE $KS $KE $LS $LE $INC $NGRID Return the cell size statistics for a grid subset. Subsets must define a surface. GRID = grid filename JS,JE = starting and ending J index (negative indices allowed) KS,KE = starting and ending K index (negative indices allowed) LS,LE = starting and ending L index (negative indices allowed) INC = increment to use (e.g. 1 at a min bndry, -1 at a max bndry) NGRID = grid number (optional), if input grid file contains multiple grids The returned list contains [list DSMIN DSMAX DSAVG] where DSMIN = minimum cell size in subset DSMAX = maximum cell size in subset DSAVG = average cell size in subset GetChord $GRID $JS $JE $KS $KE $L $NGRID Return the Chord by calculating the distance between the first point in the subset, and the point that is farthest away from the first point. GRID = grid filename JS,JE = starting and ending J index (negative indices allowed) KS,KE = starting and ending K index (negative indices allowed) L = index of L shell NGRID = grid number (optional), if input grid file contains multiple grids GetDim $GRID $args Return the dimensions and total number of points in a grid. GRID = grid filename args = grid number (optional), if input grid file contains multiple grids The returned list contains [list JMAX KMAX LMAX NGRIDS NP] where JMAX, KMAX, LMAX = J, K, L dimensions of grid NGRIDS = number of grids within the file NP = number of points in grid GetDz0 $CHORD $XREF $REY $YPLUS Return the initial spacing for volume grids based on flow info. Formula comes from OVERFLOW manual, pg. 51 of version 1.7u. CHORD = length of chord XREF = distance downstream where you want to compute y+ REY = Reynolds number based on CHORD YPLUS = Multiple of y+=1 to compute y GetFileFormInfo $gfile Returns a list of four integers [list IFORM IMG I3D IBLNK] representing values for the four file attributes for PLOT3D grid file gfile IFORM = 0 unformatted single precision = 1 formatted = 2 unformatted double precision = -1 undetermined IMG = 0 single grid format = 1 multiple grid format = -1 undetermined I3D = 0 2-D format = 1 3-D format = -1 undetermined IBLNK = 0 no iblank array = 1 contains an iblank array gfile = filename of PLOT3D grid file GetGlobalBBox $ifile Return the global minmax bounding box of all grids in a multiple grid file. ifile = grid filename The returned list contains [list $XMIN $XMAX $YMIN $YMAX $ZMIN $ZMAX] GetInt $GRID $PLANE $VALUE $JS $JE $KS $KE $LS $LE $NGRID Return the intersection of a grid with a plane. Subset must define a curve. Use the WARN environment variable to turn off warning about no intersections. GRID = grid filename PLANE = 1/2/3 for X/Y/Z plane VALUE = location of PLANE JS,JE = starting and ending J index (negative indices allowed) KS,KE = starting and ending K index (negative indices allowed) LS,LE = starting and ending L index (negative indices allowed) DIR = 1/2/3 (J/K/L) direction NGRID = grid number (optional), if input grid file contains multiple grids The returned list contains [list $J $K $L $X $Y $Z] where J,K,L = indices of the intersection X,Y,Z = nearest grid point to the intersection GetJkl $GRID $X $Y $Z $NGRID Return the J,K,L location for a given X,Y,Z in a grid GRID = grid filename X,Y,Z = coordinates of point to find nearest cell NGRID = grid number (optional), if input grid file contains multiple grids The returned list contains [list $J $K $L] where J,K,L = indices of the nearest point GetLE $GRID $JS $JE $KS $KE $L $NGRID Return the indices of the leading edge within a subset. GRID = grid filename JS,JE = starting and ending J index (negative indices allowed) KS,KE = starting and ending K index (negative indices allowed) L = index of L shell NGRID = grid number (optional), if input grid file contains multiple grids The returned list contains [list $JLE $KLE $LLE] where JLE,KLE,LLE = indices of leading edge GetN $ZREG $DZ0 $DZ1 $RMAX [$NADD] [$STRFN] Return the number of points to use by calling the stretch code. The input parameters NADD and STRFN are optional. ZREG = total 1-D distance DZ0 = grid spacing at start DZ1 = grid spacing at end RMAX = stretching ratio NADD = number of extra points to account for so that the total is divisible by 4 (set for multigrid) (optional, default is 0) STRFN = h/e (hyperbolic tangent or exponential stretching) (optional, default is h) GetNe $ZREG $DZ0 $DZ1 $RMAX [$NADD] Return the number of points to use by calling the stretch code using exponential stretching. This procedure is obsolete with the optional STRFN input in GetN. It is kept for backward compatibility and exists as a wrapper for GetN with STRFN set to e. ZREG = total 1-D distance DZ0 = grid spacing at start DZ1 = grid spacing at end RMAX = stretching ratio NADD = number of extra points to account for so that the total is divisible by 4 (set for multigrid) (optional, default is 0) GetNgrid $GRID Return the number of grids in a PLOT3D file. GRID = grid filename GetNpFromSR $sfun $md $ds0 $ds1 $rat $multig Compute number of points needed given stretching function sfun, domain size md, start and end grid spacings ds0, ds1, and max stretching ratio rat. Supply optional parameter multig to get multi-griddable number of points. sfun = geometric/hyptan md = domain size ds0 = start grid spacing ds1 = end grid spacing rat = max stretching ratio multig > 0 number of levels of multigrid (optional), (np-1) has to be a multiple of 2**multig where np is the number of points. To ensure np is odd, set multig to 1. = do impose multi-griddable number of points E.g., set np [GetNpFromSR geometric 50.0 1.e-5 0.2 1.2] or set np [GetNpFromSR geometric 50.0 1.e-5 0.2 1.2 2] GetTotalNp $GRID Return the total number of points in a PLOT3D file. GRID = grid filename GetXyz $GRID $J $K $L $NGRID Return the X,Y,Z for a given J,K,L in a grid GRID = grid filename J,K,L = indices of point to find coordinates NGRID = grid number (optional), if input grid file contains multiple grids The returned list contains [list $X $Y $Z] where X,Y,Z = coordinates of point at J,K,L TrimCurve $infile $outfile $trim $cut $const Trim a curve grid at a plane. infile = unformatted PLOT3D grid file (must be a curve with jmax>1, kmax=lmax=1) outfile = output PLOT3D trimmed grid file trim = x, y, or z designation for the cutting plane, followed by + or - (e.g., x+ will trim everything greater than x=$cut) cut = value of cutting plane const = J/K for lsect

File Management

CombineGrids $gridlist $outputfn Combine PLOT3D grid files (multiple grid unformatted) in gridlist and write to one output file. gridlist = list of PLOT3D multiple grid filenames formed by [list $file_1 $file_2 ... $file_n] outputfn = output PLOT3D multiple grid filename (unformatted) E.g., CombineGrids [list file.1 file.2 file.3] file.out CombineXrays $xraylist $ishift $outputfn Combine X-ray files in xraylist and write to one output file. xraylist = list of X-ray filenames (unformatted) formed by [list $file_1 $file_2 ... $file_n] ishift = 0/1 (not shift or shift component IDs for appended X-rays) outputfn = output X-ray filename (unformatted) E.g., CombineXrays [list xray.1 xray.2] 1 xray.out DeleteGrids $ifile $ofile $glist Delete one or more grids in ifile (plot3d multiple unformatted grid format). All remaining grids are written to an unformatted plot3d multiple grid file called ofile. Grid list to be deleted is specified in glist. ifile = input PLOT3D multiple grid filename (unformatted) ofile = output PLOT3D multiple grid filename (unformatted) glist = list of grids to be deleted E.g., DeleteGrids ifile ofile [list 2 4 6] GetIfile name Find file $name by searching in every directory up from current directory, until it either finds the file, or is at the $HOME directory. If the absolute path is given as the input file $name, that name is returned, provided the file exists. If the file is found, it returns a relative pathname for the file. If the file cannot be found, the procedure reports an error and stops. This is typically used to find files such as config.tcl, inputs.tcl, etc. name = filename used for searching GetP3DFileType $ifile Return file type for PLOT3D file. ifile = input PLOT3D grid file Return [list $iform $img $i3d $iblnk] where iform = 0 unformatted single precision 1 formatted single precision 2 unformatted double precision img = 0 single grid format 1 multiple grid format i3d = 0 2-D grid format 1 3-D grid format iblnk = 0 no iblanks 1 iblanks exist E.g., set filetype [GetP3DFileType test.dat] P3DForm2Unform $ifile $ofile Convert PLOT3D multiple grid file from formatted to unformatted. ifile = input PLOT3D grid file (formatted multiple grid format) ofile = output PLOT3D grid file (unformatted multiple grid format) P3DUnform2Form $ifile $ofile Convert PLOT3D multiple grid file from unformatted to formatted. ifile = input PLOT3D grid file (unformatted multiple grid format) ofile = output PLOT3D grid file (formatted multiple grid format) P3Dm2s $mfile $sfile Convert PLOT3D grid file from multiple to single grid format. mfile = input PLOT3D grid file (unformatted multiple grid format, must contain only one grid) sfile = output PLOT3D grid file (unformatted single grid format) P3Ds2m $sfile $mfile Convert PLOT3D grid file from single to multiple grid format. sfile = input PLOT3D grid file (unformatted single grid format) mfile = output PLOT3D grid file (unformatted multiple grid format) SplitGrids $ifile $root $is $ie Split ifile into individual grid files where each output grid file contains just one grid. The ith output grid file has the filename 'root.i', and contains the ith grid from ifile, where i=is,ie. ifile = input PLOT3D multiple grid file (unformatted multiple grid format) root = rootname of output grid files (each output grid file is unformatted multiple grid format with one grid) is,ie = write grid numbers from is to ie in ifile E.g., SplitGrids ifile.vol "t" 1 5 will generate t.1, t.2, t.3, t.4, t.5 from file ifile.vol sub $args Substitute one string for another for the list of files specified Usage: sub -from EXPR1 -to EXPR2 [-suffix SFX] [-noquery] file1 [file2 file3...] where: EXPR1 is the string that will be replaced by EXPR2 (both may be regular expressions). SFX is the string that will be appended to the new file(s) after substitution (default is "_sub"). If the string is set to "", the new file(s) will be given the name of the original file, and the old file will be renamed with the suffix "_presub". -noquery will not ask the user before substituting Note: Special characters must be protected. For example, below are some examples using special characters: % sub.tcl -from 'old \$\(HOME\)' -to 'new $(HOUSE)' text.dat replaces 'old $(HOME)' with 'new $(HOUSE)'. Note that parentheses must be 'escaped' in the FROM string, but not in the TO string. % sub.tcl -from '^(This)' -to 'That' text.dat replaces the word 'This' with 'That' for lines that have 'This' in the first column. % sub.tcl -from 'PREREQ\(([^ \)]+)\)' -to 'PREREQ($file(\1))' text.dat replaces a line with: PREREQ(wing3d) with PREREQ($file(wing3d)) Here the \1 represents the 1st subgrouping match. Similarly, \2 would represent the second subgrouping, and & would represent the whole match. % sub.tcl -from 'RESTRT[ ]*=[ ]*(.FALSE.|.F.)' -to 'RESTRT = .TRUE.' replaces a line with: 'RESTRT= .FALSE.' with 'RESTRT = .TRUE.' Which $args Determine if files in args are within the path defined by the PATH environment variable. Return 0 if file not in path, return 1 if file is in path. NOTE: Make sure to call via: eval exec Which.tcl $LIST args = list of files (optional -add $additional_path to add additional path for searching)

GRIDED Functions

ConcatGrids $ifile $ofile $g1 $g2 $idir $iovrlp Concatenate grid g1 and grid g2 in input grid file in direction idir with overlap iovrlp and write result to ofile. Some error checks are done here (dimension matching checks are deferred to internal error checks in grided for now). ifile = input PLOT3D multiple grid filename (unformatted) ofile = output PLOT3D multiple grid filename (unformatted) g1, g2 = grid numbers idir = j/k/l/J/K/L iovrlp = 0/1 (no overlap/one point overlap) E.g., ConcatGrids test.dat test1.dat 7 3 j 1 ConcatGrids2 $file1 $g1 $file2 $g2 $ofile $idir $iovrlp Concatenate grid g1 from file1 and grid g2 file2 in direction idir with overlap iovrlp and write result to ofile. Some error checks are done here (dimension matching checks are deferred to internal error checks in grided for now). file1, file2 = input PLOT3D multiple grid filename (unformatted) g1, g2 = grid number from file1 and file2, respectively ofile = output PLOT3D multiple grid filename (unformatted) idir = j/k/l/J/K/L iovrlp = 0/1 (no overlap/one point overlap) E.g., ConcatGrids2 test1.dat 3 test2.dat 5 test.out k 1 ConcatGridsn $flist $ofile $idir $iovrlp Concatenate all grids from list of files in flist in direction idir with overlap iovrlp and write result to ofile. Each file in flist is assumed to contain one grid only and each file is a plot3d multiple grid unformatted file. flist = list of files in PLOT3D multiple grid filename (unformatted) ofile = output PLOT3D multiple grid filename (unformatted) idir = j/k/l/J/K/L iovrlp = 0/1 (no overlap/one point overlap) E.g., ConcatGridsn [list g.1 g.2 g.3 g.4] output_grid_file j 1 ConcatGrids2 $ifile $ofile $glist Delete one or more grids in ifile. All remaining grids are written to an unformatted plot3d multiple grid file called ofile. Grid list to be deleted is specified in glist. ifile = input PLOT3D multiple grid filename (unformatted) ofile = output PLOT3D multiple grid filename (unformatted) glist = list of grids to be deleted (format [list g1 g2 ...]) E.g., DeleteGrids input_grid_file output_grid_file [list 1 3 6] ExtractGrids $ifile $ofile $glist Extract one or more grids from ifile and write to ofile. Grids are specified via glist which is a string containing the grid numbers to write, e.g. 2,5,15-30,33 Both ifile and ofile are unformatted plot3d multiple grid files. E.g., ExtractGrids ifile.dat ofile.dat "2,5,15-30,33" ExtractSubs $ifile $ofile $args Extract one or more subsets from grids contained in ifile. Subset ranges are contained in args which contains one or more lists where each list is of the format [list n] or [list n js je ks ke ls le] or [list n js je ji ks ke ki ls le li] where n is the grid number, js,js,ks,ke,ls,le are subset ranges, ji,ki,li are increments in j/k/l and can be positive or negative. When just the grid number is specified, the entire grid is extracted. All the subsets are written to an output file called ofile. ifile = input PLOT3D multiple grid filename (unformatted) ofile = output PLOT3D multiple grid filename (unformatted) args = list of subset ranges formed by [list $subrange_1 $subrange_2 ... $subrange_n] where each subrange is of the form subrange_i = [list $n $js $je $ji $ks $ke $ki $ls $le $li] where n = grid number in ifile js,je,ks,ke,ls,le = start and end indices of j,k,l subset ji,ki,li = j,k,l increments (positive or negative) or subrange_i = [list $n $js $je $ks $ke $ls $le] where ji,ki,li are assumed to be 1 or subrange_i = [list $n] where the entire grid is extracted E.g., ExtractSubs test.dat test1.dat [list 2 1 -1 2 -2 3 3] [list 5] \ [list 3 -1 1 -1 2 -2 2 1 1 1] ExtractVolFaces $volfile $surfile $args Extract faces of a volume grid volfile (single grid PLOT3D format), swap indices to make j x k x 1 surfaces, reverse j or k index to get normal to to point outwards from volume, and write surfaces to surfile (useful for making hole cutters with X-rays). If args is empty, extract all all 6 faces; otherwise args can contain one or more of the following: jmin, jmax, kmin, kmax, lmin, lmax. If args is not empty, only the surfaces indicated are extracted. volfile = input PLOT3D single grid filename (unformatted) surfile = output PLOT3D multiple grid filename (unformatted) args = empty (extract all 6 faces) one or more of (jmin, jmax, kmin, kmax, lmin, lmax) E.g, ExtractVolFaces test.dat test.sur jmin jmax GedExtrap $ifile $ofile $iadd $dir $exopt $par $args Do extrapolation for input grid file ifile and write result to ofile. ifile = input PLOT3D multiple grid filename (unformatted) ofile = output PLOT3D multiple grid filename (unformatted) iadd = list containing number of points to add at j=1, j=jmax, k=1, k=kmax, l=1, l=lmax [list iadja iadjb iadka iadkb iadla iadlb] dir = extrpolation direction (x/y/z/tangent) exopt = 1 extrapolate using edge spacing as initial spacing 2 extrapolate using prescribed arc length as initial spacing par = stretching ratio for exopt = 1 initial arc length for exopt = 2 args = optional argument and contains a list of grid numbers to apply the commands to. If it is absent, the commands are applied to all the grids in ifile. E.g., GedExtrap test.dat test1.dat [list 0 1 0 0 0 0] tangent 1 1.2 or GedExtrap test.dat test1.dat [list 0 1 0 0 0 0] tangent 2 0.5 [list 2 4 6] GedMirror $ifile $ofile $mplane $revdir $args Do mirror followed by optional reverse in J/K/L for input grid file ifile and write result to ofile ifile = input PLOT3D multiple grid filename (unformatted) ofile = output PLOT3D multiple grid filename (unformatted) mplane = x/X mirror about x=0 plane y/Y mirror about y=0 plane z/Z mirror about z=0 plane revdir = j/J reverse J index k/K reverse K index l/L reverse L index 0 do not reverse anything args = optional argument and contains a list of grid numbers to apply the commands to. If it is absent, the commands are applied to all the grids in ifile. E.g., GedMirror test.dat test1.dat x j [list 0] or GedMirror test.dat test1.dat y k [list 2 4 6] GedRevolve $ifile $ofile $axis $ang $dopt $par $args Rotate input grid file ifile to generate surface or volume of revolution and write result to ofile. ifile = input PLOT3D multiple grid filename (unformatted) ofile = output PLOT3D multiple grid filename (unformatted) axis = x/X rotate about x axis y/Y rotate about y axis z/Z rotate about z axis user/general rotate about user-defined axis ang = rotation angle in degrees dopt = 1 uniform distribution with par points around 2 non-uniform distribution with par points around and start and end angles dds and dde 3 non-uniform distribution with max stretching ratio par and start and end angles dds and dde par = number of points circumferentially (dopt = 1,2) max stretching ratio circumferentially (dopt = 3) args = grid_list for axis = x, y or z, dopt = 1 = vec_list grid_list for axis = user/general, dopt = 1 = dangl_list grid_list for axis = x, y, or z, dopt = 2,3 = vec_list dangl_list grid_list for axis = user/general, dopt = 2,3 where grid_list contains a list of grid numbers to apply the commands to. If it is absent, the commands are applied to all the grids in ifile vec_list is a list containing base and head coordinates of the user-defined axis of rotation [ list bx by bz hx hy hz ] dang_list is a list containing delta angles at start, end and max for dopt=2 or 3 [ list dds dde ] for dopt = 2 [ list dds dde ddmax ] for dopt = 3 where dds, dde and ddmax are the start, end and max delta angles, respectively. E.g., GedRevolve test.dat test1.dat x 45.0 1 37 or GedRevolve test.dat test1.dat x 45.0 2 91 [list 5.0 10.0] [list 2 4 6] or GedRevolve test.dat test1.dat x 45.0 3 1.2 [list 5.0 1.0 10.0] [list 2 4 6] or GedRevolve test.dat test1.dat user 360.0 1 45 [list 0.0 1.0 1.0 2.0 3.0 4.0] [list 2 4 6] or GedRevolve test.dat test1.dat user 360.0 2 45 [list 0.0 1.0 1.0 2.0 3.0 4.0] [list 0.5 1.0] [list 2 8] GedRotate $ifile $ofile $axis $ang $args Do rotation for input grid file ifile and write result to ofile. ifile = input PLOT3D multiple grid filename (unformatted) ofile = output PLOT3D multiple grid filename (unformatted) axis = x/X rotate about x axis y/Y rotate about y axis z/Z rotate about z axis user/general rotate about user-defined axis ang = rotation angle in degrees args = grid_list for axis = x, y or z = vec_list grid_list for axis = user/general where grid_list contains a list of grid numbers to apply the commands to. If it is absent, the commands are applied to all the grids in ifile. vec_list is a list containing base and head coordinates of the user-defined axis of rotation [ list bx by bz hx hy hz ] E.g, GedRotate test.dat test1.dat x 45.0 or GedRotate test.dat test1.dat user 15.0 [list 0.0 1.0 1.0 2.0 3.0 4.0] [list 2 4 6] GedScale $ifile $ofile $scale $args Do scaling for input grid file ifile and write result to ofile. ifile = input PLOT3D multiple grid filename (unformatted) ofile = output PLOT3D multiple grid filename (unformatted) scale = list containing a single scale factor or scale factors in x, y and z separately, e.g. [list scale_factor], or [list scalex scaley scalez] args = optional argument and contains a list of grid numbers to apply the commands to. If it is absent, the commands are applied to all the grids in ifile. E.g, GedScale test.dat test1.dat [list 0.5] or GedScale test.dat test1.dat [list 1.0 2.0 1.0] [list 2 4 6] GedSplitjkl $ifile $ofile $gn $idir $ind $novrlp Split a grid in input grid file ifile at specified j, k, or l index and write result to ofile. ifile = input PLOT3D multiple grid filename (unformatted) ofile = output PLOT3D multiple grid filename (unformatted) gn = grid number in ifile to split idir = j/k/l or J/K/L ind = split index novrlp = number of overlap points E.g., GedSplitjkl test.dat test1.dat 2 j 9 1 GedSplitxyz $ifile $ofile $gn $dir $coord $iwrite $args Split a curve grid in input grid file ifile at specified direction x/y/z at coordinate coord and write result to ofile ifile = input PLOT3D multiple grid filename (unformatted) ofile = output PLOT3D multiple grid filename (unformatted) gn = grid number in ifile to split dir = x/y/z/X/Y/Z coord = split coordinate iwrite = writeall or -1 (write all grids to ofile) writesp or 0 (write only split grids to ofile) write1 or 1 (write only first split grid to ofile) write2 or 2 (write only second split grid to ofile) write12 or 3 (write first split grid to ofile, write second split grid to args) E.g., GedSplitxyz test.dat test1.dat 2 x 0.5 writesp or GedSplitxyz test.dat test1.dat 2 x 0.5 write12 test2.dat GedTranslate $ifile $ofile $dx $dy $dz $args Do translation (dx,dy,dz) for input grid file ifile and write result to ofile. ifile = input PLOT3D multiple grid filename (unformatted) ofile = output PLOT3D multiple grid filename (unformatted) dx,dy,dz = translation vector args = optional argument and contains a list of grid numbers to apply the commands to. If it is absent, the commands are applied to all the grids in ifile. E.g, GedTranslate test.dat test1.dat 0.1 0.2 0.3 or GedTranslate test.dat test1.dat 0.1 0.2 0.3 [list 2 4 6] ResetSurfTopo $ifile $ofile $bcja $bcjb $bcka $bckb $args Reset surface topology for grids in input file ifile and write result to ofile. Both ifile and ofile are assumed to be plot3d multiple grid unformatted files.# Note: Can handle only 1 bc change for now. Each of bcja, bcjb, bcka, bckb is a list bcja = list containing [list ibc plane coord] ibc = 0/axis/periodic/ccut/cplane ( 0 = no change axis = singular axis periodic = periodic bc ccut = C-cut cplane = constant plane ) plane = 0/x/y/z (needed only for axis, periodic and cplane) for axis: 0=no restriction, x/y/z limiting plane for periodic: 1=keep first, 2=keep last, 3=average for cplane: x/y/z = constant plane coord = coordinate of constant plane (needed only for ibc=cplane) args is an optional argument and contains a list of grid numbers to apply the commands to. If it is absent, the commands are applied to all the grids in ifile. E.g., ResetSurfTopo input_grid_file output_grid_file [list 0] [list 0] [list axis 0] [list 0] ResetSurfTopo input_grid_file output_grid_file [list cplane x 0.0] [list 0] [list 0] [list 0] [list 3] ReverseInd $ifile $ofile $cmd $args Do index reversal for specified grids in input grid file ifile and write result to ofile. ifile = input PLOT3D multiple grid filename (unformatted) ofile = output PLOT3D multiple grid filename (unformatted) cmd = list containing one or more of the following keywords: revj, revk, revl E.g., [list revk], [list revj revk] args = optional argument and contains a list of grid numbers to apply the commands to. If it is absent, the commands are applied to all the grids in the input file, e.g., [list 2 4 6] E.g., ReverseInd test.dat test1.dat [list revk] or ReverseInd test.dat test1.dat [list revj revk] [list 2 4 6] SubstituteGrid $ifile $ofile $gfile $gn Substitute grid number gn in ifile by grid in gfile and write result to ofile. Both ifile, ofile are assumed to be plot3d multiple grid unformatted files, gfile can be single or multiple grid format containing one grid. ifile = input PLOT3D multiple grid filename (unformatted) ofile = output PLOT3D multiple grid filename (unformatted) gfile = PLOT3D grid file containing one grid (unformatted) gn = grid number in ifile to be substituted by grid in gfile E.g., SubstituteGrid input_grid_file output_grid_file subst_grid_file 3 SwapInd $ifile $ofile $cmd $args Do index swapping and reversal for specified grids in input grid file ifile and write result to ofile. ifile = input PLOT3D multiple grid filename (unformatted) ofile = output PLOT3D multiple grid filename (unformatted) cmd = list containing one or more of the following keywords: swapjk, swapkl, swapjl, swapkj, swaplk, swaplj, revj, revk, revl E.g., [list swapjk] args = optional argument and contains a list of grid numbers to apply the commands to. If it is absent, the commands are applied to all the grids in the input file, e.g., [list 2 4 6] E.g., SwapInd test.dat test1.dat [list swapjk] or SwapInd test.dat test1.dat [list swapjk revj] [list 2 4 6] TriRotate $ifile $ofile $axis $ang $args Do rotation for input surface triangulation grid file ifile and write result to ofile. ifile = input CART3D surface triangulation grid filename (unformatted) ofile = output CART3D surface triangulation grid filename (unformatted) axis = x/X rotate about x axis y/Y rotate about y axis z/Z rotate about z axis user/general rotate about user-defined axis ang = rotation angle in degrees args = vec_list for axis = user/general vec_list is a list containing base and head coordinates of the user-defined axis of rotation [ list bx by bz hx hy hz ] E.g, TriRotate test.tri test1.tri x 45.0 or TriRotate test.tri test1.tri user 15.0 [list 0.0 1.0 1.0 2.0 3.0 4.0] TriTranslate $ifile $ofile $dx $dy $dz Do translation (dx,dy,dz) for input surface triangulation file ifile and write result to ofile. ifile = input CART3D surface triangulation grid filename (unformatted) ofile = output CART3D surface triangulation grid filename (unformatted) dx,dy,dz = translation vector E.g, TriTranslate test.tri test1.tri 0.1 0.2 0.3

Grid Modification Functions

ShiftPeriBnd $ifile $ofile $gn $peridir $ind Shift periodic boundary point in grid gn in ifile from 1 to ind and write result to ofile. ifile = input PLOT3D multiple grid filename (unformatted) ofile = output PLOT3D multiple grid filename (unformatted) gn = grid number in ifile to perform shifting peridir = j/k/l/J/K/L/1/2/3 periodic direction ind = index on original grid for new periodic boundary E.g., ShiftPeriBnd test.dat test1.dat 2 k 15 SmoothGrid $ifile $ofile $smoodirs $nsmoo $js $je $ks $ke $ls $le $trans Do smoothing in grid ifile (assume 1 grid only) and write smoothed grid to ofile. ifile = input PLOT3D multiple grid filename (unformatted) ofile = output PLOT3D multiple grid filename (unformatted) smoodirs = j smooth in j only k smooth in k only l smooth in l only jk / kj smooth in j and k only kl / lk smooth in k and l only jl / lj smooth in j and l only jkl smooth in j, k and l nsmoo = number of smoothing steps js,je,ks,ke,ls,le = subset to smooth trans = [list jt0 jt1 kt0 kt1 lt0 lt1] (optional) number of transition points in js,je,ks,ke,ls,le E.g., SmoothGrid test.dat test1.dat j 1 15 17 1 1 1 1 Str2Tri $ifile $ofile $tol $sameid Call str2tri to convert plot3d multiple abutting surface grids to Cart3d triangulation. Return status=0 if successful, otherwise, return status 1. ifile = input plot3d multiple surface grid file (unformatted or formatted) ofile = output Cart3d triangulation file (unformatted or formatted based on file type of ifile) tol >= 0 tolerance for duplicate point removal < 0 do not remove duplicate points sameid = 0 preserve grid number ids on triangulation component id = 1 use same id for all triangulation component id E.g., Str2Tri input_grid_file output_grid_file 0.001 1 set status [Str2Tri input_grid_file output_grid_file 0.001 1] SplitToNgrids $ifile $ofile $nsplit $idir $iper $novrlp Split a grid in input grid file ifile into nsplit pieces and write result to ofile. It is assumed that ifile has only one grid. The resulting grids do not all have the same number of points necessarily. ifile = input PLOT3D multiple grid filename (unformatted) ofile = output PLOT3D multiple grid filename (unformatted) nsplit = number of pieces to split input grid into idir = j/k/l or J/K/L (index direction of split) iper = 0/1 (split direction is non-periodic/periodic) novrlp = number of overlap points (has to be odd number) E.g., SplitToNgrids test.dat test1.dat 4 j 0 3

Grid Redistribution Functions

RespanJ $infile $outfile $jmaxnew Redistribute j-direction spacing in grid contained in file infile using recurv infile = input surface grid file outfile = output surface grid file jmaxnew = dimension in j-direction in new grid. If 0, use existing jmax Global arrays which must be defined: RespanJold : array of j-indices anchor points in old grid RespanJnew : array of j-indices at anchor points in new grid RespanDs : array of j-direction spacing at anchor points for new grid RespanK $infile $outfile $kmaxnew Redistribute k-direction spacing in grid contained in file infile using recurv infile = input surface grid file outfile = output surface grid file kmaxnew = dimension in k-direction in new grid. If 0, use existing kmax Global arrays which must be defined: RespanKold : array of k-indices anchor points in old grid RespanKnew : array of k-indices at anchor points in new grid RespanDs : array of k-direction spacing at anchor points for new grid RespanL $infile $outfile $lmaxnew Redistribute l-direction spacing in grid contained in file infile using recurv infile = input surface grid file outfile = output surface grid file lmaxnew = dimension in l-direction in new grid. If 0, use existing lmax Global arrays which must be defined: RespanLold : array of l-indices anchor points in old grid RespanLnew : array of l-indices at anchor points in new grid RespanDs : array of l-direction spacing at anchor points for new grid SrapRedist $ifile $ofile $gn $idir $imode $ispec $multig $args Redistribute grids using SRAP. Return new number of points for each segment in a list. gn > 0 grid number in ifile to redistribute = 0 redistribute all grids idir = j/k/l or J/K/L (redistribution direction) imode = 1/2 absolute or relative grid spacing ispec = 1 spec start, end spacing and number of points in par 2 spec start, end spacing and max stretching ratio in par 3 spec start, end spacing (=uniform spacing) 4 spec uniform spacing in dels, max distance deviation in par, (work J direction for curves only) 5 spec start, end spacing, max stretching ratio in par and max global spacing in delu multig >0 generate multi-griddable number of points for ispec=2,3,4,5 such that (N-1) is a multiple of 2**multig where N is the total number of points =0 do not check for multi-griddable number of points args = each element of args should be a list of parameters for each segment where the list is [list is ie par dels dele delu] is, ie = start and end index for segment par = see ispec above dels, dele = start and end spacing delu = max global spacing (ispec=5 only) E.g., SrapRedist test.dat test1.dat 1 j 1 1 1 [list 1 -1 25 0.1 0.2] or SrapRedist test.dat test1.dat 1 j 1 5 1 [list 1 -1 1.2 0.1 0.9 1.5]

Grid Generation Functions

CreateAxisCap $sfile $cfile $axispar $cappar $smupar Create cap grid over singular axis boundary of a given surface grid. It is assumed that the grid spacings are uniformly distributed in the circumferentially direction, and that there is an odd number of points in this direction. sfile = input PLOT3D multiple grid surface grid filename (contains only one grid with axis topology at one of the boundaries) cfile = output PLOT3D multiple grid surface grid filename for cap grid axispar = [list axisloc npext] axisloc = ja generate cap over singular axis at j=1 jb generate cap over singular axis at j=jmax ka generate cap over singular axis at k=1 kb generate cap over singular axis at k=kmax npextr = number of points to extract from original surface for half initial curve (recommend >= 7 for 5 point overlap or better) cappar = [list md sr dss dse idir] for md > 0.0 [list md mind1 mind2 sign] for md < 0 md > 0 marching distance for cap surface grid (idir optional) < 0 use symmetric TFI algorithm for cap (sr,dss,dse idir optional) = -1 rotate about x-axis with symmetric TFI = -2 rotate about y-axis with symmetric TFI = -3 rotate about z-axis with symmetric TFI sr = stretching ratio dss = initial spacing dse = end spacing idir = 1 generate grid in + curve direction only -1 generate grid in - curve direction only 2 generate grid in both directions (default) mind1 = j or k mirror concat index 1 mind2 = k or j mirror concat index 2 sign = +1 or -1 for rotation of tfi initial curve smupar = [list smu tim itsvol nsmoo splay] (optional) Example usage: CreateAxisCap cyl.sur cylcap.sur [list ja 9] [list 0.5 1.2 0.05 0.1 2] CreateAxisCapGrids $sfile $ofile $writemode $axispar $cappar $args Create cap grids over one or two singular axis boundaries of a given surface grid. It is assumed that the grid spacings are uniformly distributed in the circumferentially direction, and that there is an odd number of points in this direction. sfile = input PLOT3D multiple grid surface grid filename (contains only one grid with axis topology at one of the boundaries) ofile = output PLOT3D multiple grid surface grid filename for cap grids, or original plus cap grids writemode = 1 write cap grid(s) only to ofile 2 write retracted original surface grid and cap grid(s) to ofile (ensuring 5 point overlap along initial curve) axispar = [list axisloc npext] axisloc = ja generate cap over singular axis at j=1 jb generate cap over singular axis at j=jmax ka generate cap over singular axis at k=1 kb generate cap over singular axis at k=kmax npextr = number of points to extract from original surface for half initial curve (recommend >= 7 for 5 point overlap or better) cappar = [list md sr dss dse idir] for md > 0.0 [list md mind1 mind2 sign] for md < 0 md > 0 marching distance for cap surface grid (idir optional) < 0 use symmetric TFI algorithm for cap (sr,dss,dse idir optional) = -1 rotate about x-axis with symmetric TFI = -2 rotate about y-axis with symmetric TFI = -3 rotate about z-axis with symmetric TFI sr = stretching ratio dss = initial spacing dse = end spacing idir = 1 generate grid in + curve direction only -1 generate grid in - curve direction only 2 generate grid in both directions (default) mind1 = j or k mirror concat index 1 mind2 = k or j mirror concat index 2 sign = +1 or -1 for rotation of tfi initial curve args = axispar2 cappar2 where axispar2 and cappar2 are for second cap grid at a different boundary if provided E.g., CreateAxisCapGrids cyl.sur cylcap.sur 2 [list ja 9] [list 0.5 1.2 0.05 0.1] or CreateAxisCapGrids cyl.sur cylcap.sur 2 [list ja 9] [list 0.5 1.2 0.05 0.1] [list jb 9] [list 0.4 1.0 0.02 0.04] CreateCurve $dim $format $ofile $np $t1 $t2 $x {$y 0} {$z 0} Create curve grid from given analytic expressions for x, y, and z. The coordinates x, y, and z are given as strings that represent analytic functions of the independent variable t. dim = 1 1-D output: write out x only (format has to be xyz) 2 2-D output: write out x and y only 3 3-D output: write out x, y and z format = p3d (output plot3d multiple grid formatted file) xyz (output xyz formatted file, one x,y,z per line) ofile = output filename np = number of points on curve t1 = starting value of independent variable t t2 = ending value of independent variable t x = x coordinate as a function of independent variable t y = y coordinate as a function of independent variable t (not needed for dim <=1) z = z coordinate as a function of independent variable t (not needed for dim <=2) E.g., CreateCurve 2 xyz curve.dat 11 0.0 1.0 "t" "2.0*t*t + sin(0.5*t)" or CreateCurve 3 p3d curve.dat 21 0.5 2.0 "cos(t)" "sin(t)" "0.5*t*t" CreateCylGrids $sfile $iend $icap $length $diam $npcirc $srat $ds $centroid $axis Create cylinder surface grids given cylinder length, diameter, grid spacings, coordinates of centroid, and axis vector. Grids are first created for a cylinder that lies along the z axis with centroid at (0,0,0). The it is transformed to the desired position and orientation. sfile = output PLOT3D surface grid filename iend = 0 generate cylinder with flat ends 1 generate cylinder with hemispherical ends (length of cylinder includes end hemispheres) icap = 0 generate cylinder grid with singular axes at ends (1 grid, no caps) 1 generate cylinder grids with cap grids at ends (3 grids) length = length of cylinder diam = diameter of cylinder npcirc = number of points in circumferential direction srat = surface grid max stretching ratio in axial direction ds = [list dsglob dscorn dsaxis] dsglob = max grid spacing length-wise (axial direction) dscorn = grid spacing at corner dsaxis = grid spacing at center of circular end faces centroid = [list xc yc zc] xc,yc,zc = coordinates of cylinder centroid axis = [list xa ya za] xa ya za = vector along major axis of cylinder E.g., CreateCylGrids cyl.sur 1 1 9.0 2.5 181 1.2 [list 0.2 0.01 0.02] [list 3.0 4.0 5.0] [list 1.0 2.0 3.0] CreatePointxyz $ofile $x $y $z Create point grid from coordinates x, y, z and write result to ofile. ofile = output PLOT3D multiple grid filename (unformatted) x,y,z = x, y, z coordinates of point E.g., CreatePointxyz point.dat 1.0 2.0 3.0 CreateLinejkl $ifile $ofile $p1list $p2list Create line from two points in ifile and write result to ofile. ifile = input PLOT3D multiple grid filename (unformatted) ofile = output PLOT3D multiple grid filename (unformatted) p1list = list containing grid number and j,k,l index of first point [list gn j k l] p2list = list containing grid number and j,k,l index of second point E.g., CreateLinejkl test.dat test1.dat [list 2 5 5 1] [list 1 -1 -1 1] CreateLinexyz $ofile $x1 $y1 $z1 $x2 $y2 $z2 Create line from two points (x1,y1,z1) and (x2,y2,z2) and write result to ofile ofile = output PLOT3D multiple grid filename (unformatted) x1,y1,z1 = x,y,z coordinates of first point x2,y2,z2 = x,y,z coordinates of second point E.g., CreateLinexyz test1.dat 1.0 3.2 4.5 1.0 2.0 1.0 CreateXrayMap $cutfile $xryfile $ds $delta {bb ""} Create X-ray maps by calling gen_x cutfile = hole cutter filename containing cutter surfaces (PLOT3D multiple grid unformatted) xryfile = output X-ray filename ds = X-ray image plane spacing delta = max hole cut offset bb = [list xmin xmax ymin ymax zmin zmax] = optional user-specified bounding box E.g., CreateXrayMap sphere.cut sphere.xry 0.01 0.2 CreateXrayMap wing.cut wing.xry 0.01 0.2 [list -1.0 1.0 0.2 0.4 0.0 2.0] GenHypSurGrids $rsfile $icfile $ofile $iauc $ifcc $args Generate hyperbolic surface grids from reference surface file rsfile and initial curves file icfile. Resulting surface grids are written to ofile. rsfile = reference surface file icfile = reference curves file ofile = output surface grids file iauc = 0 do not auto-concat grids that share same initial curve 1 auto-concat grids that share same initial curve ifcc = 0 do not automatically follow interior reference curves 1 automatically follow interior reference curves args is a list containing one or more elements. Each element is itself a list containing the input parameters for each hyperbolic grid to be generated and is of the form: [ list $icn $bclist $strlist $smulist ] where icn = curve number (+ or - integer) bclist = [list ibcja ibcjb iafam ngbca ngbcb] (iafam, ngbca, ngbcb optional) strlist = [list kmax rmax etamx deta dfar] smulist = [list smu itsvol tim nsmoo] (tim, nsmoo optional) All files are assumed to be in plot3d multiple unformatted grid format. E.g., GenHypSurGrids abc.def abc.cur abd.sur 1 0 \ [list 1 [list -1 -1] [0 1.2 3.0 0.01 0.02] [list 0.5 20] ] \ [list -2 [list 2 -1] [0 1.2 5.0 0.1 0.5] [list 0.5 20] ] GenHypVolGrid $sfile $vfile $strlist $bclist $smulist Generate hyperbolic volume grid from input surface grid file sfile and write result to volume grid file vfile. Report negative Jacobians if found. Not all error checks are in yet. sfile = input PLOT3D surface grid filename (unformatted, single or multiple grid format with one grid) vfile = output PLOT3D volume grid filename (unformatted, single or multiple grid format with one grid) strlist = stretching function list [list strfn iopt par md ds de (klayer)] strfn = geometric/hyptan (stretching function) iopt = 1/specnp specify number of points 2/specsr specify stretching ratio par = number of points for iopt=1 stretching ratio for iopt=2 md = marching distance ds,de = start and end grid spacing klayer = number of constant spacing cells at wall (optional, default=1) bclist = boundary conditions list [list ibcja ibcjb ibcka ibckb] smulist = smoothing parameters list [list smu2 itsvol nsub timj timk] smu2 = smoothing coef itsvol = number of volume smoothing steps nsub = number of sub-steps (optional) timj,timk = tim factors (optional) E.g., GenHypVolGrid abc.sur abc.vol [list geometric specnp 45 30.0 1.e-5 0.0] [list 10 10 -1 -1] [list 0.5 5] GenStretchedBox $ofile $bbox $ds $iopt $sr $dol $multig Generate stretched box grid with inner bounding box given by bbox and grid spacings given by ds. Stretched region is described by dol. Output ofile is in plot3d multiple zone format. ofile = output file name bbox = bounding box list for inner box [ list xmin xmax ymin ymax zmin zmax ] ds = grid spacing list [ list dx dy dz ] iopt = 1 (keep ds, modify bounding box) 2 (keep bounding box, lower ds) sr = stretching ratio for stretched region dol = extension distance list [ list dolx1 dolx2 doly1 doly2 dolz1 dolz2 ] where dol?? = 0.0 for no extension > 0.0 for extension distance multig >0 generate multi-griddable number of points for ispec=2,3,4,5 such that number of points - 1 is a multiple of 2**multig =0 do not check for multi-griddable number of points E.g., GenStretchedBox box.dat [list -1.0 1.0 -1.0 1.0 0.0 2.0] \ [list 0.1 0.1 0.2] 1 1.2 [list 10.0 20.0 0.0 0.0 10.0 10.0] 1 GenTFIGrids $ifiles $ofile $args Generate transfinite interpolation grids from input files contained in ifiles and write result to ofile. TFI grids can be created from 2 adjacent curves, or 3 or 4 curves. Curves in the 3 curve option may or may not form a closed loop. Curves in the 4 curve option must form a closed loop. All files are assumed to be in plot3d multiple unformatted grid format. ifiles = list containing at least one element : the first element is a filename containing the initial curves. The second element, if supplied is the filename for the reference surface, e.g., [list $curvesfile], or [list $curvesfile $refsurfile] ofile = output PLOT3D surface grid file args = list containing one or more curve lists for each TFI grid to be generated. The number of TFI grids generated is equal to the number of lists supplied in args, e.g., [list $clist_1 $clist_2 ... $clist_n] where each clist can contain 2, 3, or 4 curve grid numbers from the initial curves file, e.g., [list 5 6], or [list 2 5 6] or [list 2 5 6 10] E.g., GenTFIGrids [list test.cur test.def] tfi.sur [list 5 6] [list 2 7 8] [list 11 12 13 14] GenTFIOppoCurGrids $ifiles $ofile $args Generate transfinite interpolation grids from input files contained in ifiles and write result to ofile. TFI grids are created from 2 opposite curves. ifiles = list containing at least one element : the first element is a filename containing the initial curves. The second element, if supplied is the filename for the reference surface, e.g., [list $curvesfile], or [list $curvesfile $refsurfile] ofile = output PLOT3D surface grid file args = list containing at least one element: each element is itself a list containing the grid numbers of the curves to be used for the TFI grid, and the parameters to be used for this grid. The number of TFI grids generated is equal to the number of lists supplied in args. E.g, [list c1 c2 np dels dele] where c1, c2 = curve numbers in initial curves file np = number of points between curves dels = start grid spacing dele = end grid spacing E.g., GenTFIOppoCurGrids [list test.cur test.def] tfi.sur [list 6 10 21 0.1 0.25] GenUniformBox $ofile $bbox $ds $iopt $multig Generate uniform box grid with bounding box given by bbox and grid spacings given by ds. Output ofile is in plot3d multiple zone format. ofile = output PLOT3D multiple grid filename (unformatted) bbox = bounding box list [list xmin xmax ymin ymax zmin zmax] ds = grid spacing list [list dx dy dz] iopt = 1 (keep ds, modify bounding box) 2 (keep bounding box, lower ds) multig >0 generate multi-griddable number of points such that (N-1) is a multiple of 2**multig where N is the number of points in j, k, or l direction =0 do not check for multi-griddable number of points E.g., GenUniformBox box.dat [list -1.0 1.0 -1.0 1.0 0.0 2.0] [list 0.1 0.1 0.2] 1 1 GrowSrf $infile $reffile $outfile $ibdir Use surgrd to grow an existing surface grid further from one of the boundaries at j=1, j=jmax, k=1, or k=kmax, along the surface of a reference grid. Values for SURGRD input variables can be passed in using the SurIn global array. infile = existing surface grid reffile = reference grid outfile = final output surface grid ibdir = defines which edge of the infile surface will grow 1 : grow from j=jmax edge -1 : grow from j=1 edge 2 : grow from k=kmax edge -2 : grow from k=1 edge If the following SURGRD input variables are undefined, they will be given the listed default values. SurIn(ibcja) -1 SurIn(ibcjb) -1 SurIn(ngbca) 1 SurIn(ngbcb) 1 SurIn(kmax) 5 SurIn(nnod) 2 SurIn(jnod,1) 1 SurIn(deta,1) copies spacing from existing surface grid SurIn(dfar,1) 0.0 SurIn(etamx,1) Computed with SurIn(deta,1), SurIn(srmax), SurIn(kmax) SurIn(jnod,2) -1 SurIn(deta,2) copies spacing form existing surface grid SurIn(dfar,2) 0.0 SurIn(etamx,2) Computed with SurIn(deta,2), SurIn(srmax), SurIn(kmax) SurIn(smu) 0.1 SurIn(tim) 0.0 SurIn(itsvol) 3 SurIn(ave_etamx) 0 SurIn(srmax) 1.0 If SurIn(ave_etamx) = 1 the values of etamax are averaged for all nnod. HalfToFullBody $ifile $ofile $refplane $args Reflect specified grids on half body about reflection plane refplane at x/y/z=0, reverse and concatenate with original grids to form full body grids. The reflection is done in the K direction only. Specified grids may or may not have the extra reflected point on the opposite side of the reflection plane. Resulting grids may be periodic but do not have to be. Both ifile and ofile are unformatted plot3d multiple grid files. args is an optional argument and contains a list of grid numbers to apply the commands to. If it is absent, the commands are applied to all the grids in ifile. ifile : input plot3d grid file ofile : output plot3d grid file refplane = x/X reflection plane at x=0 y/Y reflection plane at y=0 z/Z reflection plane at z=0 E.g., HalfToFullBody input_grid_file output_grid_file y [list 2 3 4] quick_srf $iges $entity $x Generate a quick surface grid from iges file for use with other utilities. Output filename is constructed from entity name $entity with .def extension. Superg is assumed to be in the user's path. iges = name of $iges.nigs input file entity = entity name of b-spline surface in $iges.nigs file entity names can be added with superv utility and even edited within niges file itself x = u,v (s,t) dimension quick_crv $iges $entity $x Generate a quick curve grid from iges file for use with other utilities. Output filename is constructed from entity name $entity with .def extension. RunSuperg is assumed to be in the user's path. iges = name of $iges.nigs input file entity = entity name of b-spline curve in $iges.nigs file entity names can be added with superv utility and even edited within niges file itself x = u (s) dimension

Grid Duplication Functions

DupGrids $ifile $ofile $ndup Duplicate all grids in ifile ndup times. The result contains a total of (ndup+1) copies of the original and all grids are written to ofile. ifile = input PLOT3D multiple grid filename (unformatted) ofile = output PLOT3D multiple grid filename (unformatted) ndup = number of duplications E.g., DupGrids test.dat test1.dat 5 DupRotate $ifile $ofile $ndup $axis $ang Duplicate all grids in ifile ndup times. Each set of duplicated grids are rotated by (i * ang) degrees about given axis where i goes from 1 to ndup. The result contains a total of (ndup+1) copies of the original and all grids are written to ofile. ifile = input PLOT3D multiple grid filename (unformatted) ofile = output PLOT3D multiple grid filename (unformatted) ndup = number of duplications axis = x/y/z/X/Y/Z/1/2/3 ang = rotation angle in degrees E.g., DupRotate test.dat test1.dat 5 x 60.0 DupTranslate $ifile $ofile $ndup $dx $dy $dz Duplicate all grids in ifile ndup times. Each set of duplicated grids are translated by i * (dx,dy,dz) where i goes from 1 to ndup. The result contains a total of (ndup+1) copies of the original and all grids are written to ofile. ifile = input PLOT3D multiple grid filename (unformatted) ofile = output PLOT3D multiple grid filename (unformatted) ndup = number of duplications dx,dy,dz = translation vector for each duplication E.g., DupTranslate test.dat test1.dat 5 0.25 0.0 0.0 DupXrays $ifile $ofile $idup $ndup Duplicate one or all xrays in ifile ndup times and write to ofile. ifile = input xray filename (unformatted) ofile = output xray filename (unformatted) idup = 0 duplicate all xrays in ifile > 0 duplicate xray id idup only ndup > 0 number of duplicates (total in result is NDUP+1) E.g., DupXrays xray.1 xray.out 0 3

Math Functions

Cross $Ax $Ay $Az $Bx $By $Bz Return normalized cross product between vectors (Ax,Ay,Az) and (Bx,By,Bz) in list [list $Nx $Ny $Nz]. DotProd $Ax $Ay $Az $Bx $By $Bz $Nor Return dot product product between vectors (Ax,Ay,Az) and (Bx,By,Bz). Nor = 0 do not normalize before doing dot product = 1 normalize A and B before doing dot product IsOdd $x Return 1 if x is odd, return 0 if x is even. Max $args Return max value from argument list. Min $args Return min value from argument list. NorVec $Ax $Ay $Az Return normalized vector for (Ax,Ay,Az) in list [list $Nx $Ny $Nz] VecLen $Ax $Ay $Az Return vector length for (Ax,Ay,Az)

OVERFLOW Namelist File Input/Output

ReadOvfi $FILE $NAME Parse the OVERFLOW input file and load info for grid with name NAME into the Ovr global array. FILE = name of OVERFLOW namelist input file NAME = grid name SetOvrBCInput $gn $i $ibtyp $ibdirstr $args Set the ith OVERFLOW boundary condition parameters for grid gn to store in Ovr array for output later. Use optional args to specify exact j,k,l index ranges, otherwise, 1, -1 is assumed. gn = grid number i = boundary condition number for grid gn ibtyp = boundary condition type (see OVERFLOW-2 manual) ibdirstr = +L/-L/+K/-K/+J/-J (boundary condition direction) args not supplied => apply bc to entire grid plane 1,-1 for subset ranges args supplied - 6 integers to denote js,je,ks,ke,ls,le 7th optional integer to denote bcpar1 E.g., SetOvrBCInput 3 1 5 L SetOvrBCInput 6 2 1 J 1 1 2 -2 2 -2 SetOvrHoleCutInstr $ncuti $xid $xdelta $presxlist $args Set hole cutter instruction to store in Ovr array for output later. The procedure increments the number of hole cut instructions and returns the new value. ncuti = number of hole cut instructions before the one prescribed here xid = xray id of hole cutter xdelta = offset distance for hole presxlist = 1 prescribe grid list cut by cutter in args 0 prescribe grid start and end numbers to be cut by cutter in args args = grid list for presxlist=1 (grid numbers separated by commas with no space in between) e.g., 4,7,9,15 = grid start and end indices (two grid numbers with space in between) e.g., 17 25 E.g., SetOvrHoleCutInstr 3 2 0.5 1 "4,7,9,15" SetOvrHoleCutInstr 3 2 0.5 0 [list 17 25] WriteOvfi $FILE $NAMES $args Writes portion of an OVERFLOW namelist input file for one or more zones. Input variables for NITERS, METPRM, TIMACU, SMOACU, VISINP, and BCINP namelists will be written. See doc/scripts.html for complete documentation. FILE = file name of OVERFLOW namelist input file to be written NAMES = list of root names of zones to be written args = optional input: absent => write family info in BCINP set to -nofamily => do not write family info in BCINP

Plotting Functions

ColorMap $N Return list containing rgb color for index N. Loosely based on the RANCOL subroutine in plot3d 4.0. The returned list contains [list $ir $ig $ib] where ir,ig,ib = rgb values RunPlot3d $CGTDIR $COMFILE $GRIDFILE $GRIDTYPE $args Run plot3d for any type of grid file. Assumes plot3d is in user's path. CGTDIR = location of the chimera directory for Chimera Grid Tools COMFILE = name to use for the plot3d command file GRIDFILE = name of the grid file to read in GRIDTYPE = SURFACE, VOLUME, or BOX args = more pairs of GRIDFILE,GRIDTYPE for more grid files to be read in and displayed

Program Execution and Error Checking (generic)

RunProg $prog $cmdln $input $resultfn Run program prog with input parameters file (cmdln=0), or with command line input (cmdln=1). The argument input stores the input parameters filename or the command line arguments (must be formed using the list command). Also check for code execution error and existence of list of result files in resultfn and do error handling. Assume result files list does not contain any input files needed to run prog. prog = program name assumed to be defined in global variable File($prog) cmdln = 0 run prog using input parameters file 1 run prog using command line input input = input parameters filename for prog (cmdln = 0) command line input for prog formed using list command (cmdln = 1) e.g., [list -i ifile -o ofile -jte 25] resultfn = list containing result files for prog if execution is successful, e.g., [list resultfile_1 resultfile_2 ... resultfile_n] (it is assumed that none of the result files has the same name as any of the input files expected by prog) E.g., RunProg GRIDED 0 grided.i test.dat or RunProg LSECT 1 [list -g1 test.1 -g2 test.2 -o int.cur -const j] int.cur

Program Execution and Error Checking (specific)

The following procedures run the corresponding code with error handling INPUT = input parameters file CHK_FIL = output results file args = command line input RunConmug $INPUT $CHK_FIL RunGrided $INPUT $CHK_FIL RunIntersect $CHK_FIL $args RunIntgrd $INPUT $CHK_FIL RunLsect $INPUT $CHK_FIL RunLoadis $INPUT $CHK_FIL RunMinterp $INPUT $CHK_FIL RunProgrd $INPUT $CHK_FIL RunRecurv $INPUT $CHK_FIL $args RunSetzeta $INPUT $CHK_FIL RunShftgrd $CHK_FIL $args RunSmooth $INPUT $CHK_FIL RunSmosurf $CHK_FIL $args RunSrap $INPUT $CHK_FIL RunSuperg $INPUT $CHK_FIL $args RunSurgrd $INPUT $CHK_FIL RunVpro $INPUT $CHK_FIL $args RunWingcap $CHK_FIL $args RunWkcut $CHK_FIL $args

Last modified: Sun Jan 14 14:33:00 2007