1. Define the following environment variables in the user's .login or .cshrc
setenv SCRIPTLIB [full path to chimera*.*/scriptlib]
setenv CGTBINDIR [full path to directory containing single or double precision CGT executables]
2. Include the following lines at the beginning of the calling script where
env is defined to be a global variable.
lappend auto_path $env(SCRIPTLIB)
InitExecs
For an example on how to use the CGT script library in a script, see
examples/scriptlib/Sample. A tutorial on using the script library to build
grid generation script is found in the various subdirectories in examples/scriptlib.
Users should try the capsule example first before moving on to the others.
The Tcl procedures available can be categorized as follows (click on +/- to see
procedures available for the category). Some of the newer high level macros are
in experimental (alpha-test) mode and are marked by *.
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
CheckGridPlaneCheckGridPlane $ifile $gn $Tol $dir $coord Check to see if specified curves are within tolerance of a constant x/y/z plane and return those curves which are within tolerance in a list. If no curves within tolerance return 0. ifile = input grid file gn > 0, check grid gn only = 0, check all grids Tol = Tolerance of points to keep near coord dir = x/y/z/X/Y/Z coord = constant plane value Example usage: CheckGridPlane $ifile 3 1.e-4 y 0 CornAngBtwCurs $ifile $i $jfile $j Compute the angle between the last segment of curve i and first segment of curve j ifile : input file name containing the first curve i : grid number of curve in ifile jfile : input file name containing the second curve j : grid number of curve in jfile Return Value : Angle between the two curves (in degrees) E.g., set ang [CornAngBtwCurs file1.cur 2 file2.cur 7] 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), must be specified 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), must be specified 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), must be specified 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), must be specified 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), must be specified 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 GetCellNorm $GRID $NGRID $j $k Return cell normal vector. Inputs: GRID : grid filename NGRID: grid number if GRID is a multiple grid filename J: j index of the cell K: k index of the cell Returned: list of the 3 components of the normal vector 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), must be specified if input grid file contains multiple grids GetCurEndDS $ifile $dir $idx $args Return grid spacing at index idx and its neighbor in direction dir. ifile: grid filename dir: j, k, or l idx: index between 1 and jx-1 or -1 and -jx+2. (or equivalent in k or l) args: grid number if you want the dimensions of a grid within a multiple grid file (Leave blank for single grid files or first grid) GetDim $GRID $args Return the dimensions and total number of points in a grid. GRID = grid filename args = grid number (optional), must be specified 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 args Compute global bounding box for all grids in file ifile and return [list xmin xmax ymin ymax zmin zmax] ifile : input grid filename (can be plot3d or tri file) args : grid numbers in a multiple grid file for which to compute the bbox Example usage: set bbox [GetGlobalBBox $ifile] OR set bbox [GetGlobalBBox $ifile 1 3 7] 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), must be specified 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 $xyz $args Return the J,K,L location for a given X,Y,Z in a grid GRID = grid filename xyz = X coordinate of point to find nearest cell or [list X Y Z] where X,Y,Z are coordinates of point to find nearest cell args: if xyz = X then Y Z NGRID or if xyz = [list X Y Z] then NGRID NGRID = grid number (optional), must be specified if input grid file contains multiple grids 0 forces it to look through all grids The returned list contains [list $J $K $L $GN] where J,K,L = indices of the nearest point GN = grid number in which j,k,l point resides (=NGRID if NGRID is not 0) GetJKLBoundsFromBBox $GRID $NGRID $args Return the min and max J,K,L that contain all points in a grid that lie within a given bounding box. Inputs: GRID: grid filename NGRID: grid number if GRID is a multiple grid filename args : bounding box specified as XMIN, XMAX, YMIN, YMAX, ZMIN, ZMAX or the same six numbers in a list Returned: [list js ks ls je ke le] where js ks ls je ke le are the starting and ending indices in J, K, L direction 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), must be specified if input grid file contains multiple grids The returned list contains [list $JLE $KLE $LLE] where JLE,KLE,LLE = indices of leading edge GetLimitedBBox $ifile $idir $rs $re Given limited coordinate direction IDIR, coordinate range RS,RE, compute limited boundary box for all grids in file ifile and return [list ymin ymax zmin zmax] for IDIR = 1 [list xmin xmax zmin zmax] for IDIR = 2 [list xmin xmax ymin ymax] for IDIR = 3 Inputs: ifile : input grid filename (plot3d grid file) idir : limit direction (1/2/3) rs,re : start and end coordinates of limit direction Example usage: set bbox [GetLimitedBBox $ifile 2 0.0 10.0] 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. = 0 do not 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] GetNpFromSRMaxds $md $ds0 $ds1 $dsm $rat {$multig 0} Compute number of points needed given stretching function sfun, domain size md, start and end grid spacings ds0, ds1, max spacing dsm and max stretching ratio rat where the stretching function is always hyptan. 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 = number of levels of multigrid If multig > 0 , number of points np - 1 has to be a multiple of factor where factor = 2**multig. To make sure np is odd, set multig to 1. = 0 do not impose multi-griddable number of points E.g., set np [GetNpFromSRMaxds 50.0 1.e-5 0.2 0.5 1.2] GetNXray $ifile Return integer representing number of xrays in $ifile ifile : input xray file with possibly multiple xrays Example Usage: set nxray [GetNXray input_xray_file] 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), must be specified 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 InConstGridPlane $ifile $gn $tol $coord Determine if grid gn (or all grids) in ifile are on dir=coord constant plane where dir=x/y/z Inputs: ifile : input grid file name gn : >0 :grid number of the grid to check =0 : all grids tol : the entire grid must be on plane dir=coord+/-tol coord : the constant plane coordinate Returns: dir=x/y/z/xy/xz/yz/xyz/"" empty means no match combination dirs mean more than one dir satisfied the criterion Example usage: InConstGridPlane myfile.dat 0 0.00001 0.0 SamePtTest $ptA $ptB $tol Determine if points ptA, ptB are coincident up to a tolerance where ptA : first point (list containing x,y,z) ptB : second point(list containing x,y,z) tol : tolerance If the distance between points ptA and ptB is less than tolerance, return value is 1 Otherwise, it is 0 Example usage: SamePtTest $pt1 $pt2 0.0001 TrimCurve $infile $outfile $trim $cut 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 TurnAngCur $ifile $i Return the cumulative turning angle from the first to the last segment of a curve grid ifile : input file name containing the curve i : grid number of curve in ifile Return: cumulative turning angle (in degrees) Example Usage: set ang [TurnAngCur cur.1 1] GetTriInfo $ifile $itri Get information about triangle itri from ifile ifile : input file name containing a surface triangulation itri : index of the triangle you want to query Return: List containing info about the triangle [list v1 v2 v3 compNum normX normY normZ Area] Example Usage: set triArea [lindex [GetTriInfo ifile 301] 7] GetVertInfo $ifile $ivert Get information about vertex ivert from ifile ifile : input file name containing a surface triangulation ivert : index of the vertex you want to query Return: List containing info about the vertex [list X Y Z VDG normX normY normZ] Example Usage: set vertDegree [lindex [GetVertInfo ifile 301] 3]
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 ExtractXrays $infile $outfile $ixs $ixe proc ExtractXrays { } { Extract a range of xrays from a file containing multiple xrays. ifile : input file with multiple xrays ofile : output file that contains the specified subset of xrays ixs : starting index of xray subset to be extracted ixe : ending index of xray subset to be extracted Example Usage: ExtractXrays xrays.all xrays.partial 3 6 GetFileType $ifile Get info about the present file using p3dConvert ifile = input plot3d grid file Returns: iform : 0=unformatted, 1=formatted img : 0=Single, >0=number of grids in multiple grid file i3d : 0=2D, 1=3D iblnk : 0=no, 1=iblanks in file iendian : 0=Little Endian, 1=Big Endian mendian : Machine Endian: 0=Little, 1=Big iprecis : 0=Single precision, 1=Double precision Example usage: set filetype [GetFileType grid.in] set ftype [GetFileType $Par(def,cur)] set iform [lindex $ftype 0] (0=unformatted, 1=formatted) set ngrid [lindex $ftype 1] (0=Single, >0=number of grids) set is3D [lindex $ftype 2] (0=2D, 1=3D) set iblank [lindex $ftype 3] (Iblanks: 0=no, 1=yes) set fend [lindex $ftype 4] (File Endian: 0=Little Endian, 1=Big Endian) set mend [lindex $ftype 5] (Machine Endian: 0=Little Endian, 1=Big Endian) set iprecis [lindex $ftype 6] (Precision: 0=Single, 1=Double) 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 $args Convert PLOT3D grid file from multiple to single grid format. Do conversion only if file contains only one grid. mfile = input PLOT3D grid file (unformatted multiple grid format) args = sfile sfile = output PLOT3D grid file (unformatted single grid format, if not specified, outputs in mfile) Examples: P3Dm2s a.dat or P3Dm2s a.dat b.dat P3Ds2m $sfile $args Convert PLOT3D grid file from single to multiple grid format. Do conversion only if file is single grid format. sfile = input PLOT3D grid file (unformatted single grid format) args = mfile mfile = output PLOT3D grid file (unformatted multiple grid format) Examples: P3Ds2m a.dat or P3Ds2m a.dat b.dat RemoveFiles $root $is $ie Remove files with rootname root with extensions from is to ie. Example Usage: RemoveFiles A 2 5 RemoveFilesN $args Remove multiple lists of files with rootname root with extensions from is to ie Example Usage: RemoveFilesN [list A 2 5] [list r 0 7] [list t 1 9] 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 = beginning grid number (optional, default = 1) ie = end grid number (optional, default = -1 where -1 means the last grid in ifile) E.g., SplitGrids ifile.vol "t" 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/TRIGED 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 DeleteGrids $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,je,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] ExtractTriComp $ifile $ofile $compnum Extract all triangles with component ids given by compnum from input tri file ifile and write result to ofile, where compnum is a list containing the component ids. Both ifile and ofile are assumed to be Cart3D unformatted tri files. E.g., ExtractTriComp input_tri_file output_tri_file 9 ExtractTriComp input_tri_file output_tri_file [list 2 4 8 10] 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 point outwards from volume, and write surfaces to surfile. If args is empty, extract all all 6 faces (j=1,j=jmax,k=1,k=kmax,l=1,l=lmax); 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 volume mesh file surfile = output file with extracted surfaces args = optional arguments (can specify any or all) each argument can be just the keyword (jmin jmax kmin kmax lmin lmax) or a list with the keyword followed by a number e.g. [list jmin jminidx] [list jmax jmaxidx] [list kmin kminidx] [list kmax kmaxidx] \ [list lmin lminidx] [list lmax lmaxidx] where jminidx is the index value of the minimum plane in j where jmaxidx is the index value of the maximum plane in j kminidx, kmaxidx, lminidx, and lmaxidx are similar in k and l directions. E.g., ExtractVolFaces box.vol box.cutter extracts all 6 min and max faces (j=1,j=-1,k=1,k=-1,l=1,l=-1) ExtractVolFaces box.vol box.cutter jmin kmin extracts just the j=1, and k=1 faces ExtractVolFaces box.vol box.cutter [list jmin 5] kmin [list kmax -10] extracts the j=5, k=1, and k=-10 face ExtractVolFaces box.vol box.cutter jmin [list jmax -5] [list kmin 20] kmax lmin lmax extracts j=1,j=-5,k=20,k=-1,l=1, and l=-1 faces ExtractVolFaces box.vol box.cutter [list jmin 30] [list jmax -4] [list kmin 30] [list kmax -30] \ lmin [list lmax -20] extracts j=30,j=-4,k=30,k=-30,l=1, and l=-20 faces GedAddRemoveIB $ifile $ofile $iarib Add or remove iblanks from ifile and write to ofile Both ifile and ofile are assumed to be plot3d multiple grid unformatted files. E.g., GedAddRemoveIB input_grid_file output_grid_file iarib iarib = 1 (add iblanks) 0 (remove iblanks) GedCopySurIB $ifile $ofile Copy surface grid iblanks at L=1 to all L layers Input: ifile Output: ofile Both ifile and ofile are assumed to be plot3d multiple grid unformatted files. E.g, GedCopySurIB input_grid_file output_grid_file GedResetIB $ifile $ofile $args Reset iblank value from ibvo to ibvn in given subset js,je,ks,ke,ls,le from grid n. Both ifile and ofile are assumed to be plot3d multiple grid unformatted files. Each set of grid, subset range, original and new iblank values are contained a list in args where args may contain one or more lists Single list contains 3 or 9 elements: [list n ibvo ibvn] (assumes entire grid is reset) or [list n js je ks ke ls le ibvo ibvn] n = grid number in ifile js,je,ks,ke,ls,le = j,k,l start and end indices of subset ibvo = original iblank value ibvn = new iblank value E.g., GedResetIB input_grid_file output_grid_file [list 5 0 1] [list 12 0 1] GedResetIB input_grid_file output_grid_file \ [list 5 1 25 3 -3 1 1 0 1] [list 12 3 -6 1 -1 1 1 0 1] 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, and optional concatenation with original, for input grid file ifile and write result to ofile Both ifile and ofile are assumed to be plot3d multiple grid unformatted files. The optional concatenation command only works when ifile contains just one grid for now. Note that for the contenation to work, the reverse direction should be in the mirror direction. 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 only k/K reverse K index only l/L reverse L index only j12/J12 reverse in J followed by concatenation of old-new in J j21/J21 reverse in J followed by concatenation of new-old in J k12/K12 reverse in K followed by concatenation of old-new in K k21/K21 reverse in K followed by concatenation of new-old in K l12/L12 reverse in L followed by concatenation of old-new in L l21/L21 reverse in L followed by concatenation of new-old in L 0 do not reverse anything 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. Example usage: GedMirror input_grid_file output_grid_file x j or GedMirror input_grid_file output_grid_file y k [list 2 4 6] or GedMirror input_grid_file output_grid_file x k12 GedRemoveCoinPts $ifile $ofile $dir $tol Remove consecutive coincident points in given direction ifile = input PLOT3D multiple grid filename (unformatted) ofile = output PLOT3D multiple grid filename (unformatted) dir = 1/j/J search in j-direction for coincident points 2/k/K search in k-direction for coincident points 3/l/L search in l-direction for coincident points tol = tolerance for distance between consecutive points to be considered coincident E.g., GedRemoveCoinPts test1.crv test2.crv j 1.e-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 Both ifile and ofile are assumed to be plot3d multiple grid unformatted files. 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 mat rotate using user-defined 3x3 matrix ang = rotation angle in degrees for axis = x, y, z, or user-defined = [list c11 c12 c13 c21 c22 c23 c31 c32 c33] for user-defined 3x3 rotation matrix args = grid_list for axis = x, y or z, or mat = 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 ] Example usage: GedRotate input_grid_file output_grid_file x 45.0 or GedRotate input_grid_file output_grid_file user 15.0 \ [list 0.0 1.0 1.0 2.0 3.0 4.0] [list 2 4 6] or GedRotate input_grid_file output_grid_file mat [list 0.5 0.2 0.1 0.0 1.0 -1.0 -2.0 1.5 -1.0] 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 and write result to ofile. Both ifile and ofile are assumed to be plot3d multiple grid unformatted files. ifile = input PLOT3D multiple grid filename (unformatted) ofile = output PLOT3D multiple grid filename (unformatted) abs(gn) = grid number in ifile to split gn > 0 write resulting split grids (including unsplit grids in ifile) to ofile gn < 0 write resulting split grids to a sequence of individual grid files with root name = ofile, e.g., ofile.1, ofile.2, ..., ofile.n where n is one more than the number of split indices idir = j/k/l or J/K/L ind = split index (can be a list, indices are assumed to be positive integers) novrlp = number overlap points Example usage: GedSplitjkl input_grid_file output_grid_file 2 j 9 1 GedSplitjkl input_grid_file output_grid_file 2 j [list 9 17 21] 1 GedSplitjkl input_grid_file root -2 j [list 9 17 21] 1 (output files: root.1, root.2, root.3, root.4) GedSplitTurnAng $ifile $ofile $turnang Split all grids in input grid file ifile and write result to ofile at grid points where the local turning angle is larger than turnang in degrees. Both ifile and ofile are assumed to be plot3d multiple grid unformatted files. ifile = input PLOT3D multiple grid filename (unformatted) ofile = output PLOT3D multiple grid filename (unformatted) turnang = local turning angle in degrees Example usage: GedSplitTurnAng input_grid_file output_grid_file 15.0 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, or at a given point with coordinates (xsp,ysp,zsp) and write result to ofile. Return distance between specified point and split point for split at point option. Both ifile and ofile are assumed to be plot3d multiple grid unformatted files. gn = grid number in ifile to split dir = x/y/z/X/Y/Z x, y, or z direction (coord is a single real number) 0/1 split at given point (coord is a list of 3 real numbers) if dir is 0, do not overwrite end points of split curves with specified split point, if dir is 1, overwrite end points of split curves with specified split point coord = split coordinate (for single direction split) [list xsp ysp zsp] for split at given point 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) Example usage: GedSplitxyz input_grid_file output_grid_file 2 x 0.5 writesp GedSplitxyz input_grid_file output_grid_file1 2 x 0.5 write12 output_grid_file2 GedSplitxyz input_grid_file output_grid_file 2 0 [list 0.5 1.0 0.0] writesp GedSplitxyzN $ifile $ofileroot $gn $dir $coord Split a curve grid in input grid file ifile at specified direction x/y/z a given list of coordinates [list sp1 sp2 ....] and write split grids to output files ofileroot.1, ofileroot.2, ... etc. The total number of split grid files is one more than the number of break points supplied in the coord list. ifile and ofiles are assumed to be plot3d multiple grid unformatted files. ofileroot = root name for outfiles output files will have names ofileroot.1, ofileroot.2, etc. gn = grid number in ifile to split dir = x/y/z/X/Y/Z x, y, or z direction (coord is a single real number) coord = split coordinate list (x, y or z coordinates of split locations) [list sp1 sp2 sp3 ... spn] Example usage: GedSplitxyzN input_grid_file s 1 x [list 0.25 0.5 0.75] 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] GenOvr2DGrids $ifile $ofile Given ifile single slice 2-D grid in J/K, and at y=0 plane, create ofile in OVERFLOW 2-D mode format by adding extra slices at y=+/- 1. Both ifile and ofile are assumed to be plot3d multiple grid unformatted files. E.g., GenOvr2DGrods input_grid_file output_grid_file 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.# 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 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] RotateAxisymSurToAxis $ifile $ofile $ind $axis $args Take an axisymmetric surface in an arbitrary orientation, and rotate it so that it lies along a specified axis. ifile = input file containing the axisymmetric surface ofile = axisymmetric surface in the axis-aligned orientation ind = j or k ; the periodic index (perpendicular to the symmetry axis) axis = x, y, or z ; the alignment axis args = gn [list js je ks ke ls le ] meth gn = grid number of the surface to rotate (gn must be specified if ifile contains mupliple grids) js je ks ke ls le = subset used to determine the nozzle axis meth = 0 or 1 ; method used to compute the centroid of the front and rear faces 0 : average of all the points on the face 1 : average of j or k = 1 and jmax or kmax divided by 2 points (default) Returns the rotation vector and angle Example usage: RotateAxisymSurToAxis a.srf b.srf k x 4 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] TriMirror $ifile $ofile $mplane Do mirror for input grid file ifile and write result to ofile. Both ifile and ofile are assumed to be Cart3D unformatted tri files. mplane = x/X mirror about x=0 plane y/Y mirror about y=0 plane z/Z mirror about z=0 plane Example usage: TriMirror input_tri_file output_tri_file y 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] TriScale $ifile $ofile $scale Scale input triangulation by user specified scaling parameters in x, y, and z ifile = input triangulaiton filename in the Cart3D unformatted file ofile = output (scaled) triangulation filename (Cart3D unformatted file) scale = s or [list sx sy sz] s = scale in all directions by this factor sx = scale in x direction by this factor sy = scale in y direction by this factor sz = scale in z direction by this factor Example usage: TriScale input_tri_file output_tri_file [list 0.5] TriScale input_tri_file output_tri_file [list 0.5 3.0 2.2] TriSeparate $ifile $ofile {$seed 0} {$angle 0} args Separate a surface triangulation so that each physical part has its own tag Default is to break disjoint bodies; If a non-zero seed triangle is specified, starts the search from that triangle If a non-zero angle is specified, separates bodies at sharp edges Can extract a list of separated component numbers if specified in args. ifile = Name of input tri file (Must have .tri or .triq extension) ofile = Name of output tri file (Must have .tri or .triq extension) seed = Triangle number of the seed triangle. (Optional; Default: 0) 0 means go through all triangles. angle = Defines the angle at which an edge is considered sharp. (Optional; Default: 0) 0 means separate disjoint bodies only. args = compList compList = list of components that the user wants to extract Example usage: TriSeparate a.tri b.tri or TriSeparate a.tri b.tri 221 30 or TriSeparate a.tri b.tri 221 30 [list 1 3] 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 VecRotate $fromVec $toVec $args Compute and return the axis and angle of rotation between the fromVec and toVec vectors. The base or center of rotation is assumed to be at the origin unless specified by the user in args. If an ifile and ofile are provided, rotate grid(s) in ifile and output them in ofile. fromVec = [list fVx fVy fVz] A user-specified initial vector (e.g. body axis). toVec = x, y, z, or [list toVx toVy toVz] where x means rotate to be parallel to the x axis (similar for y and z) [list toVx toVy toVz] means rotate so that the final orientation is parallel to this vector. args = center ifile ofile grid_list center = [list cx cy cz] point about which rotation will occur. (Default: 0,0,0) ifile = name of input file (Optional). If not specified, the angle of rotation is returned. ofile = name of output file (Optional). grid_list = list of grid numbers to apply the rotation to (Optional, default: all grids). Returns the rotation vector (base and head pair) and angle (in degrees) Example: set rotInfo [VecRotate $vec1 y] set rotVec [lindex $rotInfo 0] set ang [lindex $rotInfo 1] where rotVec is the base/head pair [list bx by bz hx hy hz]. and ang is the angle of rotation in degrees. or set rotInfo [VecRotate $vec1 $vec2] or set rotInfo [VecRotate $vec1 $vec2 [list 2.0 1.1 30.0]] or set rotInfo [VecRotate $vec1 $vec2 [list 2.0 1.1 30.0] a.dat a_rotated.dat] or set rotInfo [VecRotate $vec1 $vec2 [list 2.0 1.1 30.0] a.dat a_rotated.dat [list 1 3]]
Grid Modification Functions
AutoConcatGrids $ifile $ofile $ispec $tol Automatically detect which grids in the input grid file (ifile) can be concatenated. Concatenate the grids and write to ofile. Both ifile and ofile are assumed to be plot3d multiple grid unformatted files. ifile : input grid filename(s) (ifile can be a list of filenames) ofile : output grid filename ispec : 1/2 (Absolute/Relative distance for tolerance, relative is done to longest bounding box dimension over all grids) tol : tolerance Example usage: AutoConcatGrids input_grid_file output_grid_file 1 0.001 or AutoConcatGrids [list ifile1 ifile2] output_grid_file 1 0.001 AutoReorderCurs $ifile $ofile $tol $dir Reorder a set of curves from end point to end point in a given direction. ifile : input file with multiple curves Each set of consecutive curves must share a common vertex. ofile : output file that contains reordered curves tol : considers 2 curves connected if the distance between endpoints is less than tol. dir : +x/+y/+z/+X/+Y/+Z/-x/-y/-z/-X/-Y/-Z/0 : positive x means x(jmax)-x(1) >0 : negative x means x(jmax)-x(1) <0 : similarly for y and z : 0 means no direction checks Return value: number of loops created Example usage: AutoReorderCurs input_grid_file output_grid_file 0.001 +x OR set nloops [AutoReorderCurs input_grid_file output_grid_file 0.001 -y] OrganizeCurs $curin $curout Look at the end points of each curve, and attempts to group them to be "periodic curves", or lines grouped by dominant x,y, or z length. It then sorts/reorders the curves, so they are all arranged in order of ascending x, y, or z, flipping the orientation if necessary. Circles are all then sorted in ascending x Lastly, for all the lines, x lines: sort by z, then y, then x y lines: sort by x, then z, then y z lines: sort by x, then y, then z E.g., OrganizeCurs infile outfile 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] Splitcurbycur $cur2split $curref $splitarg Splits the "cur2split" curve in order of "curref" Code will loop through each curve in "curref" and test the end points, and uses GetJkl to see if the points lie near the cur2split + tolerance (tolerance can be user specified). Curref curves need to be in ascending order (based on the cur2split). If a valid split is not found, it will stop. Split files will have a $splitfile.1 $splitfile.2 ....$splitfile.end Tolerance for the endpoint search can be specified by making the $splitarg into a list [list $splitfile tol] eg. [list mycurout 1.25] If a negative number is specified, it will force the split Example usage: Splitcurbycur mycur tmp.cur mycursplit Splitcurbycur mycur tmp.cur [list mycurout -1] ### force split Splitcurbycur mycur tmp.cur [list mycurout 1.25] SplitPeriGrid $ifile $ofile $idir $nfringe Split periodic grid in ifile into two grids in ofile with idir as the split direction. ifile = input grid file (must contain only one grid) ofile = output grid file (contains two grids) idir = split direction = periodic direction (j/k/l/J/K/L) nfringe = number of fringe points E.g., SplitPeriGrid input_file output_file j 2 SplitToMPIGrids $gfile $ofile $ovroutfile {nosort 0} Given original grid file, and OVERFLOW output file containing MPI split grids information, write a new grid file containing the split grids gfile = original multiple grid filename ofile = output split grid filename ovroutfile = OVERFLOW output filename nosort = 0 perform automatic subset sorting by grid numbers (default) 1 do not perform automatic subset sorting by grid numbers E.g., SplitToMPIGrids grid.in grid.split run.out SplitToMPIGrids grid.in grid.split run.out 1 SplitToMPIQs $qfile $ofile $ovroutfile {nosort 0} Given original q file, and OVERFLOW output file containing MPI split grids information, write a new q file containing the split grids qfile = original multiple grid q filename ofile = output split q filename ovroutfile = OVERFLOW output filename nosort = 0 perform automatic subset sorting by grid numbers (default) 1 do not perform automatic subset sorting by grid numbers E.g., SplitToMPIQs q.save q.split run.out SplitToMPIQs q.save q.split run.out 1 SplitToNgrids $ifile $ofile $nsplit $idir $iper $novrlp {npmax 10000000} 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. If nsplit = 0, the number of split grids is determined by the max number of points in a split grid (npmax). The split direction can be specified by the input idir (j/k/l), or if idir = 0, the split direction is automatically chosen to be the direction with the largest grid dimension. The number of split grids and idir are returned. ifile = input PLOT3D multiple grid filename (unformatted) ofile = output PLOT3D multiple grid filename (unformatted) nsplit > 0 number of pieces to split input grid into = 0 auto determine number of split grids based on npmax idir = j/k/l or J/K/L (index direction of split) = 0 (auto determine split direction by taking the direction with largest grid dimension) iper = 0/1 (split direction is non-periodic/periodic) novrlp = number of overlap points (has to be odd number) npmax = max number of grid points in one split grid (default is 10 million) E.g., SplitToNgrids test.dat test1.dat 4 j 0 3 set rlist [SplitToNgrids input_grid_file output_grid_file 0 0 0 5 12000000] where [lindex $rlist 0] = nsplit, [lindex $rlist 1] = idir TrimToBBox $ifile $ofile $trim $inflate $args Trim grid to retain what is inside a given bounding box. Get the jkl bounds in ifile that include the grid in the bounding box and extract the subset inside the jkl bounds. ifile : input file with a plot3d grid ofile : output file that contains a trimmed plot3d grid trim : 0 if any part of the grid is in the BBox, extract entire grid (eliminates grids that have nothing to do with BBox) 1 extract only the part of each grid that is inside the BBox inflate: A list of 3 numbers by which to inflate the BBox in x ,y and z args : bounding box (specified as 6 numbers: xmin, xmax, ymin, ymax, zmin, zmax; OR a list containing the same six numbers) Returns: a list of the grids (any part of which is) inside the BBox Example usage: TrimToBBox input_grid_file output_grid_file 0 1.0 0.0 100 0.0 100 0 20 OR TrimToBBox input_grid_file output_grid_file 0 [list 1.1 1.5 3] 0.0 100 0.0 100 0 20 OR set bbox [list 0.0 100 0.0 100 0 20] TrimToBBox input_grid_file output_grid_file 0 [list 1.1 1.5 3] $bbox
Grid Redistribution Functions
* AutoRedistCurs $ifile $ofile $dslist $sr $dir $mardir $scaleFactor $args Automatically detect curve spacing parameters based on user input for each curve segment. Srap each segment according to the computed parameters. ifile : input file with multiple curves that are ordered Each set of consecutive curves must share a common vertex. ofile : output file that contains a single curve (result of concat) dslist : List of grid spacing parameters [list $dsg $dsf $dsb $dtheta $R] dsg : global maximum spacing dsf : spacing at the front (j=1) of the 1st segment (negative dsf indicates a hard value, otherwise the value is adjusted for dtheta) dsb : spacing at the back (j=jmax) of the last segment (negative dsb indicates a hard value, otherwise the value is adjusted for dtheta) dtheta : required angular resolution ( for curved segments ) R : corner spacing refinement factor (Higher R means more refinement at corners). sr : Stretching ratio dir : if the curve is in a dir=0 plane, then that direction(x, y, or z) otherwise 0 mardir : 1 for normal marching direction for determining convex/concave -1 for opposite marching direction scaleFactor: scale factor is a multiplier to all dslist parameters Must be >0, default=1.0 (If <=0 is specified, R=1.0) args : refFile : if 3D, name of ref. surface Example usage: AutoRedistCurs input_grid_file output_grid_file [list 1.0 0.25 0.3 5 1.0] 1.2 y 1 1.0 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 RedistTFIOppoCurSet $ifile $ofile $idir $imode $ispec $multig $par $dels $dele { delu 0.0 } Given curve set in ifile, redistribute all curves to same number of grid points using prescribed redistribution parameters. The curve with the longest arc length is used to determine the number of grid points. This procedure is currently good for ispec=1,2,3,5. The number of grid points used is returned. ifile = input plot3d multiple grid curves file (single file containing multiple curve grids), or [list c.1 c.2 ... c.n] (list of input filenames, each containing one curve) ofile = output plot3d multiple grid curves file (single file containing multiple curve grids), or [list cr.1 cr.2 ... cr.n] (list of output filenames, each containing one curve) idir = j or J (for projection) -j or -J (for no projection) 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) 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 number of points - 1 is a multiple of 2**multig =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, optional otherwise) Example usage: set np [RedistTFIOppoCurSet input_file output_file -j 1 5 1 1.2 0.1 0.2 0.5] 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) -j/-k/-l or -J/-K/-L (for no projection) 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 (Level 1)
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" 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 CreateMultiBBoxXrayMap $cutfile $idir $nbin $ds $xryfile $args Create X-ray maps by splitting bounding box in idir direction into nbin chunks cutfile = hole cutter filename with just one cutter (needs to be structured surface mesh for now) idir = multi box direction (x/y/z or 1/2/3) nbin = number of boxes in idir direction ds = X-ray image plane spacing xryfile = output X-ray filename args = [list binnum ds] ... use this to override default ds in binnum E.g., CreateMultiBBoxXrayMap wing.cut 2 5 0.01 wing.xry CreateMultiBBoxXrayMap wing.cut 2 5 0.01 wing.xry [list 2 0.005] CreateNACAFoil $digits $chord $opente $plane $nphalf $Xstretch $StretchFact $cfile $line INPUTS: digits NACA 4 SERIES - mpxx m = max chamber in percent of chord p = max chamber location in tenths of chord xx = max thickness in percent of chord NACA 5 SERIES - CAAxx CAA = mean line destination NOTE: works only for AA: 10,20,30,40,50,21,31,41,51 chord - chord length opente - 0 = open trailing edge - 1 = closed trailing edge plane - x/y/z = construct airfoil in constant x, y or z plane nphalf - number of grid points on upper or lower half (uneven number prefered for grid spacing) Xstretch - 0 = equal stretching in x direction - 1 = cosine stretching in x direction - 2 = hyperbol stretching in x direction StretchFact - stretching factor in floating point. Smaaler value stronger stretch OUTPUTS: cfile - plot 3-D curves file line - number of points on each line in curve 3-D file G. Stich : Scriptlib method for Creating a NACA 4-digits airfoil section based on CreateNACAFoil script from W. Chan 2010 CreateNACAFoil4 $digits $chord $opente $plane $nphalf $cfile Create NACA 4 digit series airfoil in PLOT3D curve file. Inputs digits = mpxx = 4 series NACA airfoil where m = max camber in percent of chord p = max camber location in tenths of chord xx = max thickness in percent of chord, or = [list mpxx thetaX thetaY] where mpxx is the same as above and it is common to ignore the camber line slope parameter theta. So, thetaX = 0 Do NOT apply camber line slope correction in x 1 Apply camber line slope correction in x, and thetaY = 0 Do NOT apply camber line slope correction in y 1 Apply camber line slope correction in y chord = chord length opente = 0 closed trailing edge 1 open trailing edge plane = x/y/z = construct airfoil in constant x, y, or z plane (x plane: y is streamwise y plane: x is streamwise z plane: x is streamwise) nphalf = number of grid points on upper or lower half Output cfile = plot3d 3-d curves file Example usage: CreateNACAFoil4 0012 1.0 z naca0012.cur CreateNACAFoil5 $digits $chord $opente $plane $nphalf $cfile Create NACA 5 digit series airfoil (modified from CreateNACAFoil.tcl) Note: The only NACA 5 series airfoils are defined for AAA here as one of the following: 210, 220, 230, 240, 250. So, there are only airfoils defined for those AAA values in the "digits" input. Inputs digits = AAAxx = 5 series NACA airfoil where AAA = mean line designation xx = max thickness in percent of chord can also be a list: [list AAAxx thetaX thetaY] where mpxx is the same as above and thetaX = 0 Do NOT apply camber line slope correction in x 1 Apply camber line slope correction in x and thetaY = 0 Do NOT apply camber line slope correction in y 1 Apply camber line slope correction in y chord = chord length opente = 0 closed trailing edge 1 open trailing edge plane = x/y/z = construct airfoil in constant x, y, or z plane (x plane: y is streamwise y plane: x is streamwise z plane: x is streamwise) nphalf = number of grid points on upper or lower half Output cfile = plot3d 3-d curves file Example usage: CreateNACAFoil5 23012 1.0 z naca23012.cur CreateParsecFoil $params $chord $plane $nphalf $cfile Inputs params: A list of 11 parameters controlling the parsec airfoil shape 1. rle = Leading-edge radius (limits: 00.1 should only be used with thick airfoils 2. xup = Upper crest X location (limits: 0<=xup<=1) 0 is leading edge(LE), 1 is trailing edge(TE) 3. yup = Upper crest Y location (limits: -0.1<=yup<=0.5) - is below centerline, positive is above 4. yxxup = Upper crest curvature (limits: -10<=yxxup<=10) 0 is flat 5. xlo = Lower crest X location (limits: 0<=xlo<=1) 0 is leading edge(LE), 1 is trailing edge(TE) 6. ylo = Lower crest Y location (limits: -0.5<=ylo<=0.1) - is below centerline, positive is above 7. yxxlo = Lower crest curvature (limits: -10<=yxxlo<=10) 0 is flat 8. yte = Trailing edge(TE) ordinate (limits: -0.5<=yte<=0.5) 0 means TE on the centerline 9. alpha_te = The angle that the TE bisector makes with the horizontal [deg.] (limits: -0.5<=alpha_te<=0.5) 0 means symmetric TE 10. beta_te = The TE angle [deg.] (limits: 0<=beta_te<=150) 0 is collapsed TE, >90 is a wide angled TE 11. del_yte = TE thickness (limits: 0<=del_yte<=0.2) 0 is sharp TE, 0.2 is thick, blunt TE Note: please keep in mind that not all combinations of the parameters give a topologically valid airfoil chord: airfoil chord length plane: The plane in which the airfoil lies Output cfile = plot3d 3-d curves file Example usage: CreateParsecFoil [list 0.5 0.5 0.5 -2 0.5 -0.5 2 0 0 135 0] 1.0 z 201 parsec.foil CreatePointxyz $ofile $xyz $args Create point at (x,y,z) and write result to ofile in plot3d unformatted multiple grid format. ofile = output PLOT3D multiple grid filename (unformatted) xyz = [list x y z] or x x, y, z are coordinates of the point args = y z only needed if xyz = x Example usage: CreatePointxyz output_grid_file 1.0 2.0 3.0 or set xyz [list 1.0 2.0 3.0] CreatePointxyz output_grid_file $xyz CreatePWLCurve $ofile $x $y $z $rpar Create piece-wise linear curve using line segments. Inputs include end point coordinates, and point distribution information. Write result to ofile in plot3d unformatted multiple grid format. ofile = output grid file name x = list containing x coordinates of points that define line segments y = list containing y coordinates of points that define line segments z = list containing z coordinates of points that define line segments rpar = list containing redistribution options for each segment [list imode ispec par dels dele delu] imode = 1 (absolute spacing) 2 (relative 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 par = see ispec above dels, dele = start and end spacing delu = max global spacing (ispec=5 only) Number of elements in x, y, and z list determines the total number of points. If all coordinates are the same for any one of x, y, or z, the list can contain only one element. Number of piece-wise linear segments is the number of elements minus one. Example usage: CreatePWLCurve output_grid_file [list 0.0 1.0 2.0] [list 0.0] [list 1.0 2.0 3.0] \ [list [list 1 5 1.2 0.1 0.1 0.2] \ [list 1 3 1.0 0.1 0.1] ] CreateSeamCur $ifile $ofile $imode $args Use seamcr or seamcrt to get a curve from a reference surface ifile = reference surface file (can be structured surface panels or a tri file) ofile = output curve grids file imode = 1 Extract and concatenate sharp edges to form seam curves Need isym and ang in args 2 Intersect with specified Cartesian Plane to form seam curves Need isym and coord in args 3 Connect a given vertex pair using existing edges Need npair (For tri files only) 4 Connect a given vertex pair directly (for tri files only) args = if (imode==1) then isym angle where isym = 0 surface geometry not bounded by a symmetry plane 1 surface geometry bounded by x constant symmetry plane 2 surface geometry bounded by y constant symmetry plane 3 surface geometry bounded by z constant symmetry plane angle = an edge is picked as a seam edge if the surface normals of the two adjacent triangles deviate from each other by ANG degrees ( e.g., a flat plate would have ANG=0 ) elseif (imode==2) then isym coord where isym = x/y/z Cartesian cutting plane coord = coordinate of Cartesian cutting plane elseif (imode==3 or 4) then [list v1 v2] ... = pairs of vertices to connect Note: Modes 3 and 4 are for tri files only. Examples: CreateSeamCur a.sur a.cur 1 0 30 CreateSeamCur a.sur c.cur 2 3 3 CreateSeamCur a.tri b.cur 1 2 22.0 CreateSeamCur a.tri b.cur 2 2 0.5 CreateSeamCur a.tri b.cur 3 [list 1 21] [list 22 46] CreateSeamCur a.tri b.cur 4 [list 1 21] [list 22 46] [list 2 13] 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. If single grid is in ofile, it is automatically converted to multiple grid format. 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 and are 0 by default) strlist = [list kmax rmax etamx deta dfar] for variable marching ditance, use [list kmax rmax etamx1 deta1 dfar1 jnod1 etamx2 deta2 dfar2 jnod2...] smulist = [list smu itsvol tim nsmoo nsub] (tim, nsmoo optional and are 0 by default) (nsub optional and is 1 by default) 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 0.0 0 4] ] GenHypSurGrids abc.def abc.cur abd.sur 1 0 \ [list 1 [list -1 -1] [0 1.2 \ 3.0 0.010 0.02 1 \ 1.5 0.005 0.02 15 \ 3.0 0.010 0.02 -1] \ [list 0.5 20] ] GenHypVolGrid $sfile $vfile $strlist $bclist $smulist {$mode "normal"} Generate hyperbolic volume grid from input surface grid file sfile and write result to volume grid file vfile. Both files are assumed to be plot3d unformatted grid files containing one grid. Report negative Jacobians if found. 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) mlevel = number of multigrid levels to use with iopt=2 (optional, default=0) 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, default: 1) timj,timk = tim factors (optional, default: 0.0) imeth = dissipation method (optional, default: 2) 0 constant coef. dissipation 1 spatially-varying coef. dissipation 2 severe convex corners treated by solving averaging eqns. 3 severe convex corners treated by angle-bisecting predictor mode = normal (delete all output files on exit) (optional argument, default: normal) debug (retain all output files on exit) 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] GenHypVolGrid_GU $sfile $vfile $strlist $bclist $smulist {$mode "normal"} Generate hyperbolic volume grid from input surface grid file sfile and write result to volume grid file vfile. Both files are assumed to be plot3d unformatted grid files containing one grid. Report negative Jacobians if found. Added geouni option for stretching function to start with geometric up to given final spacing and then continue with final spacing uniformly. 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/geouni (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) mlevel = number of multigrid levels to use with iopt=2 (optional, default=0) 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) imeth = dissipation method (optional) 0 constant coef. dissipation 1 spatially-varying coef. dissipation 2 severe convex corners treated by solving averaging eqns. 3 severe convex corners treated by angle-bisecting predictor mode = normal (delete all output files on exit) (optional argument) debug (retain all output files on exit) E.g., GenHypVolGrid_GU abc.sur abc.vol [list geouni specsr 1.2 30.0 1.e-5 0.75] [list 10 10 -1 -1] [list 0.5 5] GenHypVolThread $args Purpose: This procedure is designed to allow for GenHypVolGrid to be used in parallel. The inputs into this procedure are identical to the inputs for GenHypVolGrids.tcl. Inputs: args is a set of lists where each element is a list containing all of the inputs needed for GenHypVolGrid. If multiple lists, where each list is a set of inputs for one volume mesh, are provided, all volume meshes will be created in parallel. Each such list contains the following inputs. sfile = surface mesh file vfile = volume mesh file For geometric or hyptan strlist = stretching function list [list strfn iopt par md ds de (klayer) (mlevel)] For multiple L-layers hyptan (hyptan_ml) strlist = [list strfn iopt1 par1 md1 ds1 de1 dsmax1 (mlevel1) \ iopt2 par2 md2 ds2 de2 dsmax2 (mlevel2) \ ... ioptn parn mdn dsn den dsmaxn (mleveln) ] strfn = geometric/hyptan/hyptan_ml (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) mlevel = number of multigrid levels to use with iopt=2 (optional, default=0) bclist = boundary conditions list [list ibcja ibcjb ibcka ibckb] smulist = smoothing parameters list [list smu2 itsvol nsub timj timk imeth] smu2 = smoothing coef itsvol = number of volume smoothing steps nsub = number of sub-steps (optional) timj,timk = tim factors (optional) imeth = dissipation method (optional) 0 constant coef. dissipation 1 spatially-varying coef. dissipation 2 severe convex corners treated by solving averaging eqns. 3 severe convex corners treated by angle-bisecting predictor mode = normal delete all output files on exit (optional, default = normal) debug retain all output files on exit verbose reports when individual grids are finished generating SAP: For some reason, James did not code the mode to pass through. Example usage: GenHypVolThread [list abc.sur abc.vol \ [list geometric specnp 45 30.0 1.e-5 0.0] \ [list 10 10 -1 -1] [list 0.5 5]]\ [list grid.sur grid.vol \ [list geometric specnp 45 30.0 1.e-5 0.0] \ [list 2 2 -1 -1] [list 1.5 60]] 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] or [list c1 c2 np dels dele rmax] where c1, c2 = curve numbers in initial curves file np = number of points between curves rmax = max stretching ratio (np is disregarded if rmax is specified) 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] GenTFIOppoCurGrids [list test.cur test.def] tfi.sur [list 6 10 0 0.1 0.25 1.2] 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 GenWakeBox $ifile $ofile $TEtype $args Generate a box grid with an input wing volume grid as reference Output ofile is in plot3d multiple zone format. ifile = name of input wing volume mesh file ofile = output file name TEtype = sharp OR [list jbot jtop] If sharp, just type in "sharp" If blunt, Assuming that the airfoil is defined in the j direction, enter the j index of the bottom and the top in a list. args = TESubs Zdz Xdx RN IJB ExtD All args are optional. If specifying some and not others, enter -1 for defaults. TESubs = [list Subset1 Subset2 ...] Each subset must be in the form [list gn js je ks ke ls le] and must define the curve that is the traling edge gn = grid number js = minimum j-index defining the trailing edge je = maximum j-index defining the trailing edge ks = minimum k-index defining the trailing edge ke = maximum k-index defining the trailing edge ls = minimum l-index defining the trailing edge le = maximum l-index defining the trailing edge Set TESub=-1 to get defaults, Default: j=1 curve in gn=1 (i.e. [list 1 1 1 1 -1 1 1]) Note: You can not set TESub = -1 [list 2 5 20 1 -1 1 1] Either specify all subsets or -1 for the default subset. Zdz = [list Zmx dzTE dzFar SRz zcTE zcFar] Assuming the treftz plane lies in yz where y is spanwise, Zmx = box size in z dzTE = delta z spacing at TE dzFar = delta z in far field SRz = stretching ratio zcTE = distance of the constant spacing region at TE (-1 means auto-compute) zcFar = distance of the constant spacing region at the downstream boundary (-1 means auto-compute) Set Zdz=-1 to get defaults (Computed by wakegr) Xdx = [list Xmx dxTE dxFar SRx] Assuming x is the streamwise direction, Xmx = box size in x dxTE = delta x spacing at TE dxFar = delta x in far field (down-stream) SRx = stretching ratio Set Xdx=-1 to get defaults (Computed by wakegr) RN = (-1 to get wakegr computed defaults) IJB = (-1 to get wakegr computed defaults) dExt = distance to extrude from the tip (-1 to get wakegr computed defaults) Examples: GenWakeBox htail.vol htailwakebox.vol sharp Here, deafaults are used for all args. GenWakeBox htail.vol htailwakebox.vol sharp [list 1 7 7 1 -1 1 1] Here, the TE is the j=7 line and deafaults are used for the rest. GenWakeBox vtail.vol vtailwakebox.vol sharp \ [list 1 1 1 $k1 -1 1 1] [list 2 1 1 1 -1 1 1] [list 5 75 75 1 $k2 1 1] -1 -1 -1 -1 0.0 Here, 3 different grids contribute to the TE (grids 1 2 and 5). Zdz, Xdx, RN, and IJB =-1 to get defaults. We do not want to extend the box to capture a tip vortex, so dExt=0.0 GrowSrf $infile $reffile $outfile $ibdir $curfile 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 curfile: Optional curve file. The curves in this file are combined with the initial curve file that is extracted from the input grid. If the following SURGRD input variables are undefined, they will be given the listed default values listed below. 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(nsmoo) 5 SurIn(ave_etamx) 0 SurIn(srmax) 1.0 If SurIn(ave_etamx) = 1 the values of etamax are averaged for all nnod. Note: The SurIn variable is a global array and is populated with values from the grid if not specified. These values will remain populated for subsequent calls to GrowSrf. This can lead to unexpected results if GrowSrf is used on a different grid (with different spacings) within the same script. To prevent this behavior, unset the SurIn variable, as shown in the example below. Example: global SurIn set SurIn(ibcja) 10 set SurIn(ibcjb) 10 set SurIn(kmax) 21 set SurIn(smu) 2.0 set SurIn(itsvol) 20 Growsrf collar.dat wing.dba collar2.dat -2 unset SurIn 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 XryScale $ifile $ofile $bbox $scx $scy $scz Scale xrays in ifile by (scx,scy,scz) and write to ofile. E.g., XryScale input.xry output.xry 0.5 1.0 1.0 XryTranslate $ifile $ofile $dx $dy $dz Translate xrays in ifile by (dx,dy,dz) and write to ofile. E.g., XryTranslate input.xry output.xry 0.5 -1.5 1.0
Grid Generation Functions (Level 2)
AutoBuildConnectors $ifile $ofile $tol Automatically build connector curves in gaps between consecutive curves. Incoming curves are assumed to be ordered. ifile : input file with multiple curves that are ordered ofile : output file that contains a single contiguous curve tol : connector is built if distance between endpoints of 2 consecutive curves is larger than tol Return value: the number of connectors built Example usage: AutoBuildConnectors input_grid_file output_grid_file 0.0001 AutoConcatFlatCurs $ifile $ofile $args Concatenate consecutive curve segments that are flat with respect to each other by automatically detecting curve turn angle and corner angle between adjacent curve segments. ifile : input file with multiple curves that are ordered Each set of consecutive curves must share a common vertex. ofile : output file that contains same set of curves with flat curves concatenated args : takes angleTolerance (in degrees) as argument to decide if consecutive curves are flat (Optional, default: 2 deg.) Example usage: AutoConcatFlatCurs input_grid_file output_grid_file * AutoFindControlCurs $ifile $reffile $ofile $tol $args Extract sharp surface feature curves for a given surface geometry in the locality defined by the curves in ifile. First, look for sharp features (curve end points) in the curve set in ifile where consecutive curve segments meet at an angle > AngTol (default 30 deg). Option 1 - reffile is a set of curves. Check if end point of any curve in reffile matches the sharp features found in ifile. If so, add this curve to ofile. Then look for other curves in reffile connected to this initial control curve and concatenate if the angle between initial control curve and new curve is < sharpAng (default: 30 deg.) Option 2 - reffile is a set of structured surface grids. Look for sharp lines in constant j or k on the surface grids that matches the sharp features found in ifile. If found, clip the constant j or k lines at the sharp features on ifile. A surface triangulation file refTri is then used to determine which side of the clipped curves to keep. The side that is not on the given triangulation is extracted and written to ofile. ifile : input file with multiple curves that are ordered (each set of consecutive curves must share a common vertex) reffile: reference curve file name (contains possible control curves) OR reference surface grid file name (from which control curves must be found) ofile : output file that contains the control curves tol : tolerance for point match args : AngTol -- angle below which the segment connecting to a control curve segment is accepted (Optional, default:30 deg) sharpAng -- angle above which the corner is considered sharp (Optional, default:30 deg) refTri -- reference triangulation file name (contains protuberance triangulation to project onto, Optional) Example usage: AutoFindControlCurs input_grid_file ref_curve_file output_grid_file 0.001 0 OR AutoFindControlCurs input_grid_file ref_curve_file output_grid_file 0.001 0 30 30 * BuildAxisymCur $ifile $ofile $dslist $sr $tol $mardir $scaleFactor $args Create a single curve that can be revolved to make an axi-symmetric surface. -check to see which plane the curve is in -put all points in that plane -Build missing segments -concatenate flat segments -Automatically detect curve spacing parameters based on user input -Srap each segment according to the computed parameters. -Concat segments into a component curve. ifile : input file with multiple curves that are ordered Each set of consecutive curves must share a common vertex. ofile : output file that contains a single curve (result of concat) dslist : list of spacing parameters [list $dsg $dsf $dsb $dtheta] dsg : global maximum spacing dsf : spacing at the front (j=1) of the 1st segment dsb : spacing at the back (j=jmax) of the last segment dtheta : delta angle in degrees in curved segments R : corner refinement parameter (larger R for finer spacing) sr : Stretching ratio tol : Tolerance for detecting coincident points mardir : 1 for normal marching direction for determining convex/concave -1 for opposite marching direction scaleFactor: scale factor is a multiplier to all dslist parameters args : if no args are specified, nothing is done at the ends and a concatenated curve is output Otherwise, args is list of 4 numbers [list jaendv jeendv jaendh jeendh] jaendv : Add a vertical line to the front end (-1/0/len) jeendv : Add a vertical line to the back end (-1/0/len) -1 : close to axis (if curve is in y=0 plane, close to z=0) 0 : do nothing len : Add vertical line of length len jaendh : create a horizontal sting at j=1 (0/1) jeendh : create a horizontal sting at j=jmax(0/1) autoconcat: 0 to turn autoconcat off, 1 to turn it on Example usage: BuildAxisymCur input_grid_file output_grid_file \ [list 1.0 0.25 0.3 0.2] 1.2 0.0001 1 1.0 OR BuildAxisymCur input_grid_file output_grid_file \ [list 1.0 0.25 0.3 0.2] 1.2 0.0001 1 1.0 [list -1 0.2 0] 0 BuildClosedNozExitGrids $ifile $ofile $cutfile $xfile $lipth $sr $dslist $npcore $jbellbase Given nozzle surface grid up to external lip, build appended nozzle surface grid with wrap around to exit plane, and exit plane core grid. Nozzle axis can be arbitrarily oriented. Input ifile = input nozzle surface grid (j from base to lip, k around) lipth = nozzle lip thickness sr = grid spacing stretching ratio dslist = [list dslip dsaxis dsglob dsxray] dslip = grid spacing on exit plane at lip dsaxis = grid spacing on exit plane at axis dsglob = max grid spacing on exit plane dsxray = X-ray image spacing npcore = number of points to extract starting from exit plane axis to construct core grid jbellbase = j index in input nozzle surface grid file to use for extrapolation and construction of X-ray cutter Output ofile = output surface grids file with 2 grids Grid 1: nozzle collar surface grid with wrap around over onto nozzle exit plane Grid 2: nozzle exit plane core grid cutfile = X-ray cutter for closed nozzle xfile = X-ray file for closed nozzle Return [list njlip njexit] : njlip = number of points from outer lip to inner lip, njexit = number of points on entire exit plane from external lip to axis BuildGeneralPlumeGrids $ifile $ofile $pfile $hfile $xfile $lipth $distn $dists $spangle $srn $srs \ $dsaxis $dsnlip $dsnfar $dsnglob $dssnear $dssfar $dssglob $npcirc \ $lcore $lcut $jcut $args Given nozzle surface grid up to external lip, build appended nozzle surface grid with wrap around to plume face, and plume axisymmetric volume grid, and plume core grid. Nozzle axis can be arbitrarily oriented. ifile = input nozzle surface grid (j from base to lip, k around) lipth = nozzle lip thickness distn = distance from nozzle lip to outer boundary normal to lip at exit plane (unit is in multiples of nozzle radius) dists = distance from nozzle exit to downstream boundary (unit is in multiples of nozzle radius) spangle = spread angle of plume grid in degrees srn = stretching ratio in normal direction srs = stretching ratio in streamwise direction dsaxis = normal grid spacing on plume grid at axis dsnlip = normal grid spacing on plume grid at lip dsnfar = normal grid spacing on plume grid at outer boundary dsnglob = max normal grid spacing on plume grid dssnear = grid spacing streamwise at nozzle exit dssfar = grid spacing streamwise at downstream boundary dssglob = max grid spacing streamwise npcirc = number of circumferential points lcore = L-shell of plume grid used to generate core lcut = L-shell of plume grid used to create Xray jcut = jcut_max (jcut contains 1 element only, jcut_min set to 1), or = [list jcut_min jcut_max] (jcut is a list with 2 elements), where jcut_min is J index at upstream end of plume grid used to create Xray jcut_max is J index at downstream end of plume grid used to create Xray args = npwrap matchLip unifar npwrap = number of points beyond lip thickness on exit plane grid to wrap back to the original grid matchLip = extract lip ring and make sure it is a part of the plume grid in the near-field (at j=1) 0 : do not match 1 : match the lip exactly (default) unifar = make down-stream boundary (j=jmax) uniform or similar to near-field (j=1) 0 : spacing kept similar to near-field 1 : make uniform spacing (default) Output ofile = output nozzle surface grid with wrap around section on plume plane pfile = output plume axisymmetric and core volume grids (2 grids) hflie = output hole cutter surfaces file for plume xflie = output xray file for plume Return [list nj1 nj2 nj3] = number of points on exit plane, from axis to inner lip, from inner lip to outer lip, from outer lip to outer boundary CreateAirfoilComponent $nsection $airfoil $digits $chord $spanlen $sweeple \ $dsspans $dsspang $srspan $opente $dihedral $twist $plane $nphalf $sfile Create wing grid from two or more airfoil sections. At least two airfoil sections have to be specified: one at the root and one at the tip. More sections can be specified in the middle too. Linear interpolation is used to connect the sections. Each section will be created in the x, y, or z=0 plane prescribed by plane. The first section will be located at the x/y/z=0 plane, and subsequent sections will be added in the +x, +y, or +z directions. Inputs nsection = number of airfoil sections that defines the wing ( >= 2, at least one at root and one at tip) airfoil = list containing airfoil name for each section (root to tip) (NACA, parsec, and custom are accepted for now) [list NACA parsec naca custom ...] digits = list containing specification digits for each airfoil section (root to tip) = mpxx for NACA 4-digit series where m = max camber in percent of chord p = max camber location in tenths of chord xx = max thickness in percent of chord = Lpqxx for NACA 5-digit series where L = camber (The design lift coeff is 3L/2) p = max camber location in tenths of chord q = 0 for standard, 1 for reflexed-camber (for zero pitching moment) xx = max thickness in percent of chord (Only 210xx, 220xx, 230xx, 240xx, 250xx are presently available) = plist for parsec where plist = [list rle xup yup yxxup xlo ylo yxxlo yte alpha_te beta_te del_yte] rle = Leading-edge radiu xup = Upper crest X location yup = Upper crest Y location yxxup = Upper crest curvature xlo = Lower crest X location ylo = Lower crest Y location yxxlo = Lower crest curvature yte = Trailing edge(TE) ordinate alpha_te = The angle that the TE bisector makes with the horizontal beta_te = The TE bisection angle del_yte = TE thickness = filename for custom where filename = name of file containing the coordinates of the airfoil in a multiple-grid unformatted plot3d format. The number of points on the upper/lower surface must = nphalf [list mpxx plist filename ...] chord = list containing chord length for each section (root to tip) [list chord1 chord2 ...] spanlen = list containing span length for each section (root to tip) = number of sections minus one [list spanlen1 ...] sweeple = list containing leading edge sweep angles in degrees for each section (root to tip) = number of sections minus one [list sweeple1 ...] dsspans = list containing span spacing at each span station (root to tip) [list spansp1 spansp2...] dsspang = list containing max span spacing between each span station (root to tip) = number of sections minus one [list spang1 ...] srspan = max stretching ratio in span direction opente = 0 closed trailing edge 1 open trailing edge dihedral = dihedral angle in degrees (positive is upwards) twist = twist angle in degrees (un-implemented yet) plane = x/y/z (direction to build airfoil sections on) nphalf = number of grid points on upper or lower half of airfoil Output sfile = plot3d surface grid file for wing Return list containing [list np1 np2 ...] number of points between each span station Example usage: CreateAirfoilComponent 2 [list NACA NACA] [list 0012 0011] [list 1.0 0.3] [list 6.0] [list 10.0] \ [list 0.05] [list 0.1] 1.2 0 5.0 0.0 y 201 wing.sur 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] CreateAxisCapN $sfile $cfile $axisloc $npextr {$gridtype "full"} {$nsmoo 0} 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. This is a general version of CreateAxisCap that allows the singular axis to be pointing in an arbitrary direction (coded by Darby Vicker, JSC). 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 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) gridtype = "quarter", "half" or "full" For a quarter grid, extract 2 edges (the min and max edges) and make a 2-curve TFI (non-opposite edge) surface between the 2 curves. For a half grid, extract 3 edges (the min, max and (max+1)/2 edge) and TFI surfaces using all of these curves. The dimension in the periodic direction must be odd. For a full (periodic) grid, extract 4 edges ( 1, 1+n, 1+2n, 1+3n, where n = (max-1)/4) ) and TFI surfaces using all of these curves. The default is "full". The grid dimension in the periodic direction minus 1 must be divisible by 4. nsmoo = number of smoothing iterations to perform. This will help reduce kinks on patches over areas of high-curvature. Example usage: CreateAxisCapN cyl.sur cylcap.sur ja 9 CreateAxisCapN cyl.sur cylcap.sur ja 9 quarter CreateAxisCapN cyl.sur cylcap.sur ja 9 quarter 100 CreateCore $ifile $ofile $lcore $nkcore $eps $half Take a half (symmetric about y=0 or z=0 plane) or full pipe surface or volume grid and generate an H-topology core grid to fill the internal space. Both ifile and ofile are unformatted plot3d multiple grid files. args is an optional argument and contains one or more of the arguments discussed below in that order. ifile = input filename (can be a volume grid of the pipe or a surface grid) ofile = output filename lcore = L index of the volume grid to use as a reference 1 if surface is provided in ifile nkcore = 0 auto-determine number of points in K and L in core, (Optional, Default: 0) > 0 use NKCORE for number of points in K and L in core eps = 0 do not disturb default boundaries for ICORE = 2 (Optional, Default: 0) 1 disturb default boundaries to the full amount for ICORE = 2 0 < eps < 1 disturb default boundaries by some for ICORE = 2 half = 0 auto-detect (Optional, Default: 0) +y halfbody on the positive side of y=const -y halfbody on the negative side of y=const +z halfbody on the positive side of z=const -z halfbody on the negative side of z=const E.g., CreateCore WT.vol tmp.dat -10 0 1.0 +y 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] CreateFrustumGrids $sfile $iend $icap $length $diam $npcirc $srat $ds $centroid $axis Create frustum surface grids given length, diameter (diameter1 and diameter2), grid spacings, coordinates of centroid, and axis vector. If diameter1 and diameter2 are equal, the result reduces to a cylinder. Grids are first created for a frustum that lies along the z-axis with centroid at (0,0,0). The it is transformed to the desired position and orientation. This proc is the same as CreateCylGrids except for an additional continous-slope end cap option coded by Henry Lee. note: curve is first drawn such that the axis of revolution is on the x-axis then rotated to the z-axis (to preserve code), diameter 1 will be placed on the +x half, prior to rotation and end up on the -z half sfile = output PLOT3D surface grid filename iend = 2 digit number ab where a represents end option at end 1, and b represents end option at end 2 Options: a = 1 open end 2 flat end 3 hemispherical end (length of frustum includes end hemispheres) 4 hemispherical end with continuous slope (length of frustum includes end hemispheres) Similarly for b For older single digit code, 0 is equivalent to 22, 1 is equivalent to 33 icap = 0 generate frustum grid with singular axes at ends (1 grid, no caps) 1 generate frustum grids with cap grids at ends (additional grid for each flat or hemispherical end) (extracts 9 points, with 5 overlapping) length = length of frustum including end caps if prescribed diam = diameter of cylinder if it is a list containing a single element = diameters of frustum if it is a list containing 2 elements ( [list diameter1 diameter2] ) 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 frustum centroid axis = [list xa ya za] xa ya za = vector along major axis of frustum Example usage: Round ended cylinder at both ends CreateFrustumGrids cyl.sur 33 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] Flat ended frustum at both ends CreateFrustumGrids cyl.sur 22 1 9.0 [list 2.0 1.0] 181 1.2 \ [list 0.2 0.01 0.02] [list 3.0 4.0 5.0] [list 1.0 2.0 3.0] Open ended cylinder at one end and flat end at the other end CreateFrustumGrids cyl.sur 12 1 9.0 2.0 181 1.2 [list 0.2 0.01 0.02] [list 3.0 4.0 5.0] [list 1.0 2.0 3.0] CreateFrustumVol $ofile $DiamIn $DiamOut $length $npcirc $sr $vrat $dssur $dsvol $centroid $axis Given input diameter in front and back for both inner and outer frustum, create a volume grid between the 2 frustums ofile = output file name DiamIn = Inner frustum diameters [list D1 D2] for a frustum (D1= front diameter, D2=back diameter) D1 for a cylinder DiamOut = Outer frustum diameter in the same format as DiamIn length = Frustum length npcirc = number of points in the azimuthal direction sr = surface grid max stretching ratio in axial direction vrat = not used dssur = [list ispec par dsglob dscorn dsaxis] ispec = 1 through 5 (see srap for details) par = stretching ratio or num. of points (see srap for details) dsglob = max grid spacing length-wise (axial direction) dscorn = grid spacing at corner dsaxis = grid spacing at center of circular end faces dsvol = [list ispec par dsInner dsOuter dsglob] ispec = 1 through 5 (see srap for details) par = stretching ratio or num. of points (see srap for details) dsInner = max grid spacing at inner cylinder (L=1) dsOuter = max grid spacing at outer cylinder (L=Lmax) dsglob = max grid spacing in the L-direction centroid = [list xc yc zc] xc,yc,zc = coordinates of frustum centroid axis = [list xa ya za] xa ya za = vector along major axis of frustum Example usage: CreateFrustumVol frus.vol 1.0 2.5 2.0 121 1.2 1.0 [list 1 121 0.2 0.01 0.02] [list 5 1.2 0.1 0.3 0.4] [list 3.0 4.0 5.0] [list 1.0 2.0 3.0] CreateSphereGrids $sfile $diam $npcirc $args Create a sphere surface grid(s) sfile = output PLOT3D surface grid filename diam = Diameter of the sphere npcirc = Number of points around the sphere (Optional; Default: 361) args = xc yc zc ncap xc = x coordinate of the center of the sphere yc = y coordinate of the center of the sphere zc = z coordinate of the center of the sphere ncap = number of points to put a cap at both ends Example usage: CreateSphereGrids sphere.dat 2.0 181 5 0 0 9 CreateTruncatedWingCap $ifile $ofile $gn $jle $ktip $perle $perte $args Script to generate cap for wing grids. Wing grid is assumed to be a dp unformatted plot3d file. It is also assumed to have an odd number of points in the J direction. ex: 101, 201, etc. The normal direction is assumed to be facing outside of the wing. ifile : input grid filename (ifile is the wing grid with k spanwise from root to tip and periodic j from lower trailing edge to upper trailing edge) ofile : output grid filename gn : grid number of the wing grid where the tip is jle : leading edge index of the grid ktip : k location of the tip (usually 1 or -1) perle : percentage of the chord near the leading edge that is not preserved perte : percentage of the chord near the trailing edge that is not preserved args : splist strlist lesmu tesmu splist=[list jstr dsle dste dsg] jstr: stretching ratio dsle: ds at the leading edge dste: ds at the trailing edge dsg : global maximum ds strlist=[list npts kstr etamx deta dfar] npts : number of points in k(marching) direction (0 if using kstr) kstr : stretching ratio etamx: total marching distance deta : initial grid spacing dfar : final grid spacing lesm=[list lesmu leitsvol letim lensmoo] (tim, nsmoo optional) lesmu : Explicit smoothing coefficient for LE grid leitsvol: Number of times LE is smoothed letim : TIM factor for smoothing in marching direction (0<=TIM<=3) lensmoo : Number of smoothing steps for LE grid tesm=[list tesmu teitsvol tetim tensmoo] (tim, nsmoo optional) tesmu : Explicit smoothing coefficient for TE grid teitsvol: Number of times TE is smoothed tetim : TIM factor for smoothing in marching direction (0<=TIM<=3) tensmoo : Number of smoothing steps for TE grid lebc: Boundary condition for LE marching onto wing surface tebc: Boundary condition for TE marching onto wing surface Example usage: CreateTruncatedWingCap ifile ofile 1 101 -1 10 20 [list 1.2 0.02 0.01 0.1] [list 31 1.15 0.1 0.002 0.01] ExtractCompFootprintCurs $ifile $reffile $ofile $rfile $tol Finds the curves on ifile that lie along the surface of reffile and returns these curves in ofile ifile = input file name (contains all curves from which footprint is to be extracted) reffile = input reference surface (structured or triangulation surface on which footprint resides) ofile = output file name containing the footprint curves rfile = output file name containing the non-footprint curves tol = footprint curve identified if MAX(projected distance) < tol Returns a list containing grid numbers of the footprint curves Example usage: set clist [ExtractCompFootprintCurs all.cur main.sur footprint.cur remainder.cur 1.e-4] ExtractCursInHalfPlane $ifile $ofile $dir $coord $tol $proj Extract curves from a multiple curves file (ifile) that fall inside a given half plane. Curves that stradle the plane boundary will be trimmed appropriately. Results are written to ofile. Both ifile and ofile are assumed to be plot3d multiple grid unformatted files. Inputs: ifile = input grid file ofile = output grid file dir = +x/+y/+z/+X/+Y/+Z/-x/-y/-z/-X/-Y/-Z if +, keep all values greater than coord, if -, keep all values less than coord coord = split coordinate tol = tolerance of points to keep near coord proj = 1/0 auto project points within tolerance onto plane Example usage: ExtractCursInHalfPlane input_grid_file output_grid_file +y 0 0.001 0 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] RotateToSymPlane $ifile $ofile $plane $tol Automatically rotate grids to lie symmetrically about the y=0 or z=0 plane. The angle of rotation (in degrees) needed is automatically determined and returned. It is assumed that the rotation axis is x, and the symmetry plane can be either y=0 or z=0. ifile = input grid file ofile = output grid file plane = either y/z. if y, component will be rotated to y = 0 plane. otherwise, it will be rotated to z = 0. tol = tolerance for convergence to y or z symmetry This routine is good for upto 4 digit accuracy past the decimal (or tol=0.0001) Return Values: [list angle_of_rotation angle_of_boundingbox] Example Usage: set angs [RotateToSymPlane $ifile $ofile y 0.0001] set theta [lindex $angs 0] set BBang [lindex $angs 1]
Grid Generation Functions (Level 3)
* BuildAxisymGrids $ifile $cfile $sfile $vfile $axis $ang \ $ends $cpar $spar $vpar {$strlist ""} {$smulist ""} Given a set of ordered curves on a symmetry plane, auto build connectors if needed, auto redistribute grid points and create axisymmetric surface and volume grids. If ifile contains one curve only, skip the curve redistribution step. Assume axis is x and 360 full body for now. Coding for boundary conditions for volume cap grids can become more complex with half and quarter caps. ifile = input PLOT3D multiple curves filename cfile = output PLOT3D redistributed curve grid filename sfile = output PLOT3D surface grids filename vfile = output PLOT3D volume grids filename axis = x/X revolve about x axis y/Y revolve about y axis z/Z revolve about z axis ang = revolution angle in degrees ends = list containing ends treatment [list vlenfr vlenbk hlenfr hlenbk] vlenfr : Add a line to the front end by dropping down to axis vlenbk : Add a line to the back end by dropping down to axis 0 : do nothing -1 : Add line down to axis (if curve is in y=0 plane, close down to z=0) >0 : Add line of length vlenfr/vlenbk hlenfr : Add an axial line to the front end hlenbk : Add an axial line to the back end 0 : do nothing >0 : Add axial line of length hlenfr/hlenbk (along +/- x direction) Drop line is added first, followed by axial line cpar = list containing curve redistribution parameters [list dsg dsf dsb dtheta R sr tol mardir scaleFactor] dsg = global maximum spacing dsf = spacing at the front (j=1) of the 1st segment dsb = spacing at the back (j=jmax) of the last segment dtheta = angular resolution at grid points on curve segments in degrees R = corner refinement parameter (larger R for finer spacing) sr = Stretching ratio tol = Tolerance for detecting coincident points mardir = 1 for normal marching direction for determining convex/concave -1 for opposite marching direction scaleFactor = factor used to multiply all input grid spacings spar = list containing surface grid parameters [list gens npcirc capfr capbk nsmoo] gens = 0 do not generate surface grid 1 generate surface grid npcirc = number of points in circumferential direction (assuming uniform spacing) capnpfr/capnpbk = 0 do not put cap grid in front/back > 0 generate cap grid in front/back with capnpfr/capnpbk number of points in cap half initial curve nsmoo = number of smoothing steps for cap vpar = list containing volume grid parameters [list genv ibca ibcb] genv = 0 do not generate volume grid 1 generate volume grid ibca,ibcb = BC for 2-D volume grid slice at front/back end < -1 splay = -1 free floating = 1/2/3 constant x/y/z plane splay = cap volume grid splay bc for all 4 boundaries capmd = cap volume grid marching distance strlist = list containing volume grid stretching function parameters smulist = list containing volume grid smoothing parameters Example usage: BuildAxisymGrids test.cur test.cur test.sur test.vol x 360.0 [list 0 2.5 0 20.0] \ [list 1.0 0.1 0.2 2.0 1.2 0.0001 1 1.0] \ [list 1 361 9 9 1] \ [list 1 3 3 -5 10.0] \ [list hyptan specsr 1.2 30.0 1.e-5 0.0 2] [list 0.5 20]
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/X/1 rotate about x axis y/Y/2 rotate about y axis z/Z/3 rotate about z axis user/general rotate about user-defined axis mat rotate using user-defined 3x3 matrix ang = rotation angle in degrees for axis = x, y, z, or user-defined = [list c11 c12 c13 c21 c22 c23 c31 c32 c33] for axis=mat 3x3 rotation matrix args = vec_list for axis = user/general where 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., DupRotate test.dat test1.dat 5 x 60.0 DupRotate fin1.sur fins.sur 3 user 90.0 [list 0.0 0.0 0.0 13.077 7.55 0.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
Grid Projection Functions
Project $ifile $rfile $uvfile $ofile $igrds $rgrds $args Project grids in one file onto the grids in another using PROGRD. (Coded by Alan Schwing, JSC) ifile = input grid file rfile = reference grid file uvfile = output uv grid file ofile = output grid file igrds = grids in ifile to project (-1 = all grids) e.g. [list -1] or [list 1 4 6 7] rgrds = grids in rfile to project onto (-1 = all grids) e.g. [list -1] or [list 1 4 6 7] args = optional arguments for PROGRD parameters in the following format [ list imode pdir popt sdir sopt ] or [ list js je ks ke ls le ] or [ list imode pdir popt sdir sopt js je ks ke ls le ] optional named arguments for -gtol [val] and -nosnchk can also be included [ list imode pdir popt sdir sopt -gtol -10.0 -nosnchk] imode = 1,2,3,11,12 - reference the PROGRD man page for more details pdir projection direction = x x-direction = y y-direction = z z-direction = n normal popt projection option if active point is outside reference family = 0 Do not move point. = 1 Project point to closest cell on reference family. = 2 Project point to extrapolated surface of reference family. sdir indicates the direction to shift grid points and is used if active subset is a surface, curve or point. = 0 move only points defined in active subsets = j/J J-direction by same increment = k/K K-direction by same increment = l/L L-direction by same increment sopt indicates the options when shifting grid points and is used if active subset is a surface, curve or point. = 1 move all points in J/K/L direction by same inc. as surface point. = 2 move near half of points in J/K/L direction by same inc. as surface point. = 3 hold opposite boundary fixed in J/K/L direction and redistribute intermediate points based on arclength. js je J start and end for subset of input grid(s) to be projected Defaults to js = 1 je = -1 ks ke K start and end for subset of input grid(s) to be projected Defaults to ks = 1 ke = -1 ls le L start and end for subset of input grid(s) to be projected Defaults to ls = 1 le = 1 Returns: dmax = maximum projection distance Examples: set dkmax [Project a.dat a.ref a.uv a.pro 1 -1] or set dkmax [ Project a.dat a.ref a.uv a.pro 1 [list 1 4 6] ] or set dkmax [ Project a.dat a.ref a.uv a.pro 1 [list 1 4 6] [list 1 z 2 0 3] ] or set dkmax [ Project a.dat a.ref a.uv a.pro 1 [list 1 4 6] [list 2 -2 1 -1 1 1] ] or set dkmax [ Project a.dat a.ref a.uv a.pro 1 [list 1 4 6] [list 1 z 2 0 3 2 -2 1 -1 1 1] ] ProjectColAndCapOB $ifile $ofile $mode $overwrite $report Project outer boundaries of protuberance collar and cap grids to each other. ifile = input plot3d grid file with 2 grids (surface or volume) Grid 1: collar grid with J direction going around, and K direction from centerline of protuberance down to the stack Grid 2: cap grid with J direction streamwise and K direction such that a constant K index lines up with the symmetry plane of the protuberance ofile = output plot3d grid file with 2 grids with outer boundaries projected to each other mode = half (half protub., K=1 of grid 2 lies on symmetry plane) full (full protub., periodic in J for grid 1) overwrite = 1 overwrite ifile with ofile 0 do not overwrite ifile with ofile report = 1 return max distance moved 0 do not return max distance moved ProjectColToStack $ifile $rfile $ofile $overwrite $report Project outer boundaries of protuberance collar to stack surface at the protuberance final circumferential location ifile = input plot3d grid file with 1 grid (surface or volume) containing collar grid of protuberance with J direction going around, and K direction from centerline of protuberance to the stack (projection is done at all J, K=-2,-1) rfile = input plot3d stack surface grid file containing one or more grids (supply only what is needed for better efficiency) ofile = output plot3d grid file with 1 grid for projected protuberance collar grid overwrite = 1 overwrite ifile with ofile 0 do not overwrite ifile with ofile report = 1 return max distance moved 0 do not return max distance moved ProjectCompSur $ifile $ofile $nfringe $overwrite $report $args Project nfringe layers of points on outer boundaries of every surface grid in ifile to each other. ifile = input plot3d surface grid file ofile = output plot3d surface grid file with outer boundary layers projected to each other nfringe = number of fringe layers overwrite = 1 overwrite ifile with ofile 0 do not overwrite ifile with ofile report = 1 return max distance moved 0 do not return max distance moved args : for each grid with one or two periodic directions, provide grid number and periodic direction (j/k/jk) (default is all grids are non-periodic) Usage: ProjectCompSur input_grid_file output_grid_file 2 1 1 [list 2 j] [list 6 k] [list 10 jk]
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]. CrossV $A $B Return normalized cross product between vectors A and B in list [list $Nx $Ny $Nz] where A = [list Ax Ay Az] and B = [list Bx By Bz] 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 DotProdV $A $B $Nor Return dot product product between vectors A and B. 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. ListToShortStr $x Sort integer list and return string in short hand notation. iList = a list of integers Return a short-hand notation string of the form: "1-3 5 7-9 20" Example Usage: set newstr [ListToShortStr [list 20 1 5 3 7 8 9 2]] newstr will be set to "1-3 5 7-9 20" 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] ScaleVec $scale $A If scale is a single scalar, multiply each element of A by scale. If scale is a list with the same length as A, multiple each element of A with the corresponding element in scale. Return resulting list. ShortStrToList $shStr Process string in short hand notation, and return sorted integer list. shStr = short string of numbers (e.g. "1-3 5 7-9 20") Return a sorted list: [list 1 2 3 4 5 7 8 9 20] Example Usage: set newList [ShortStrToList "1-3 5 7-9 20"] SplitStrToFields $str Given string str, split into fields return fields in list. Spaces are ignored in between fields. Example usage: set rlist [SplitStrToFields $str] SubtractVec $A $B Return list [list ($Ax - $Bx) ($Ay - $By) ($Az - $Bz)] VecLen $Ax $Ay $Az Return vector length for (Ax,Ay,Az)
FOMOCO/DCF/OVERFLOW Namelist File Input/Output
AddBCInfo $gcomp $gn $sublist {$bcparlist ""} Add a BC for grid $gn in $gcomp.vol gcomp = name of volume mesh file gn = local grid number (in gcomp.vol) of the grid associated with this subset sublist = [list bctype ibdir jmin jmax kmin kmax lmin lmax compname] bctype = Overflow boundary condition type (see OVERFLOW-2 manual) ibdirstr = boundary condition direction (+L/-L/+K/-K/+J/-J) jmin = minimum j in the subset (optional) jmax = maximum j in the subset (optional) kmin = minimum k in the subset (optional) kmax = maximum k in the subset (optional) lmin = minimum l in the subset (optional) lmax = maximum l in the subset (optional) compname = name of c3p component (optional) Note: If jmin, jmax, etc. are not supplied, apply bc to entire grid plane otherwise, specify all 6 range indices (jmin, jmax, kmin, kmax, lmin, lmax) Note: compname is used to specify c3p hole cutting components. compname can be specified even if the 6 range indices are not. bcparlist = [list bcfile bcpar1 bcpar2] (optional) bcfile = overflow boundary condition file name (see OVERFLOW-2 manual) bcpar1 = overflow boundary condition parameter (see OVERFLOW-2 manual) bcpar2 = overflow boundary condition parameter (see OVERFLOW-2 manual) Note: The bcfile name can appear anywhere, or not appear at all. bcpar1 and bcpar2 must be specified in that order, though bcpar2 is optional. The specification, therefore, is dependent on the requirements of the BC. e.g., BC 41 requires the user to specify BCPAR1, and BCPAR2. The user, therefore, does not need to specify BCFILE. However, BC 42 requires BCFILE and BCPAR1 and BCPAR2 are optional. So the user must specify them in the above order. Example usage: AddBCInfo fuselage 1 [list 5 +L] or AddBCInfo fuselage 1 [list 5 +L "forwardFuse"] or AddBCInfo fuselage 1 [list 5 +L 5 -5 14 101 1 1] or AddBCInfo fuselage 1 [list 5 +L 5 -5 14 101 1 1 "forwardFuse"] [list 1.0 1.2 "mybc.dat"] AddBrickInfo $toggle {$autoBrk -1} $args Add information for Off-body grid generation (goes into the Overflow Input file). Defaults are the same as Overflow for all optional arguments. toggle = on/off : Turns Automatic off-body mesh generation on or off. autoBrk = [list ds dfar center bclist fixBnd minbuf ofringe] autoBrk specifies the automatic off-body grid generation inputs ds = Spacing of level-1 (finest) off-body grids. (Must be specified if toggle is set to on.) dfar = Distance to far-field boundary (Optional, Default: 5) center = [list xc yc zc] The coordinates of the ceter of the off-body grid system. (Optional, Default: Same as the center of the near-body system) bclist = [list bcxmin bcxmax bcymin bcymax bczmin bczmax] Boundary Condition type for each far-field boundary. (Optional, Default: 47, see OVERFLOW manual for BC Types) fixBnd = [list xmin xminloc zmax zmaxloc...] User-specified Physical location of the box bondaries. Only one of the boundaries in each direction may be specified. xmin, xmax, ymin, ymax, zmin, zmax are tags that specify which directio. xminloc is the location of the minimum boundary in the x direction. (Optional, Default: Determined using dfar) minbuf = Minimum buffer width between levels. (Optional, Default: 4) ofringe= Number of fringe points for the off-body grids. (Optional, Default: See Overflow Manual) args = usrBrk = [list bbox1 bbox2 bbox3 bbox4...] (Optional, Default: No user-specified bricks) usrBrk specifies the user-specified brick inputs Can define as many bboxes as needed, where each bbox is as follows. bbox = bounding box of the user specified region. ([list xmn xmx ymn ymx zmn zmx]) Example Usage: AddBrickInfo on [list 0.01] or AddBrickInfo on [list 0.1 1000.0 [list 30.0 0.0 0.0] [list 47 47 17 47 47 47] [list xmin -1000.0 ymin 0.0] or AddBrickInfo on [list 0.1] [list [list 0 1 -1 2 0 50] [list -1 0 -2 -1 -50 0]] AddCutterID $cutter $args Add a cutter ID cutter = name of cutter (can be a list of cutters) args = list containing the number of Xrays in cutters for which a .xry file does not exist. (Same order as the cutters). Example usage: AddCutterID "cutter" or AddCutterID [list fuse wing canard] or AddCutterID [list fuse wing canard] [list 2 1 1] AddFomocoMegacomp $megacompName $clist {$iref 1} Add information for a FOMOCO mega component. megacompName = name of fomoco mega component clist = list of regular compoenents that belong to megacompName iref = reference quantity set (optional; Default: 1) Example usage: AddFomocoMegacomp "wingbody" [list fuselage wing] AddFomocoSubset $comp $sublist Add a fomoco subset to component $comp. $sublist contains the subset information. comp = name of fomoco component that this subset belongs to sublist = [list gcomp nsurf ibdir jmin jmax kmin kmax lmin lmax] gcomp = name of volume mesh file gn = local grid number (in cccomp.vol) of the grid associated with this subset ibdir = boundary condition direction (1=j, 2=k, 3=l) jmin = minimum j in the subset jmax = maximum j in the subset kmin = minimum k in the subset kmax = maximum k in the subset lmin = minimum l in the subset lmax = maximum l in the subset Example usage: AddFomocoSubset "fuselage" [list fuselage 1 3 1 -1 1 -1 1 1] AddGridNames $comp $name Create a name for grid number gn in file gcomp.vol comp = name of volume file is gcomp.vol name = list of grid names Example usage: AddGridNames wing [list "WingBodyCollar" "InnerWing" "outerWing" "wingTip"] AddGridType $comp $type Indicate grid type for grids in gcomp.vol comp = name of volume file is gcomp.vol type = list of grid types containing a type for each grid in gcomp.vol curvi = curvilinear cartu = uniform Cartesian carts = stretched Cartesian Example usage: AddGridType wing curvi (all grids in wing are curvilinear) or AddGridType wing [list curvi cartu cartu carts] (grid 1 in wing.vol is curvilinear, grids 2 and 3 are uniform Cartesian, grid 4 is stretched Cartesian) AddGroup $grname $comp $args Define a group of grids from comp.vol. (For example a cutee group that can be cut by any cutter) grname = name of group comp = basename of volume mesh file (e.g. wing for wing.vol) args: [list g1 g2] (optional) [Default: all grids in $comp.vol] list of local grid numbers (in $comp.vol) that define the group Example usage: AddGroup mainfuse fuselage [list 2 3] ModifyXrayBodyID $ifile $ofile $newID $args Modify the body ID of a list (or range) of Xrays and write to outfile ifile : input xray file with possibly multiple xrays ofile : output xray file with modified body IDs newID : new body ID args : there are two possible options in args Option 1. If there are two integers, ixs ixe, then this specifies the range of xray entities which will have the new body IDs Option 2. If there is a single list, xlist, then this specified the list of xray entities which will have the new body IDs Example Usage: ModifyXrayBodyID input_xray_file output_xray_file 3 2 8 ModifyXrayBodyID input_xray_file output_xray_file 3 [list 3 5 20] ProcessBCInfo $gridlist $args Process the info in bc.in files to create the inputs necessary for an Overflow input file. bc.in files associated with each item in gridlist is processed. Best Practice: Call this routine once from the master script after all components are made. gridlist = list of grid file names Each name in the list must have an associated .vol file and a .bc.in file. args = gridFile gridNamesFile gridFile = name of output grid file. [Optional, Default: grid.in] gridNamesFile = name of output file containing the names of all grids. [Optional, Default: gridnames.txt] Returns: Ovr(ngrid) = total number of grids in gridlist Example usage: ProcessBCInfo [list fuselage wing canard vertTail] ProcessFomoInfo $rootlist Process Fomo array info in fomo.in files to get ready for writing fomoco input file. fomo.in files associated with each rootname in rootlist is processed. Also process mega components list to convert name list to integer list. Best Practice: Call this routine once from the master script after all components are made. rootlist = list of rootnames for configuration The cumulative global grid number for the last grid in rootname r in the rootlist is stored in Par($r,ggn). The incoming instructions are associated with file $r.fomo.in For each rootname, its subsets are read from $r.fomo.in and assigned to the specified component. Note that variable Fomo($r,cnsub) is a counter for the configuration component while the variable Fomo($cname,nsub) is a counter for the fomoco component. Fomo($cname,nsub) = number of subsets in component cname Example usage: ProcessFomoInfo wing or ProcessFomoInfo [list fuselage wing] 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 SetCutterCutee $cutter $args Set hole cutter and cutee instruction. This method is more user friendly than SetOvrHoleCutInstr. Calls SetOvrHoleCutInstr. cutter: Name of the cutter (assumes first xray in the Par($cutter,xid) position; user may specify other xrays with xidL or all xrays in cutter by setting xidL=0). args : cuteeNames or [list cuteeName xidL xdelta] At least one cutee must be specified. cuteeNames = Names of all cutees separated by spaces cuteeName = Name of the cutee xidL = local xray index of hole cutter (If cutter.xry has 3 xrays and you want the third one, xidL = 3) (Optional; Default: 0; value of 0 means all xrays in cutter) xdelta = offset distance for hole (Must be specified if Par(cutter,cutee,xdelta) is not specified) User must set the following variables Par(cutter,xid) = the xray index of the cutter in the xrays.in file AddCutter is recoomanded for specifying xid. Par(cutter,cutee,xdelta) = offset distance of the hole made from the cutter when cutting cutee. Par(cutee,glist) = A list of the global grid numbers to be cut AddGroup is recommanded for specifying cutee grid list. A cuttee with empty or non-existent glist is ignored. Example usage: To only cut off-body grids: SetCutterCutee fuselage To cut only the wing with the fuselage x-ray: SetCutterCutee fuselage wing To use values specified in the Par array with the first cutter xray: SetCutterCutee fuselage wing htail pylon To cut wing with the 3rd xray in the fuselage cutter: SetCutterCutee fuselage [list wing 3] boxes To override the xdelta in the Par array to cut the wing with the second xray, cut wingbox with all fuselage x-rays, and boxes with the third x-ray: SetCutterCutee fuselage [list wing 2 0.1] wingbox [list boxes 3] SetGridBC $gridname $sublist {$bcparlist ""} {$family ""} {$group ""} Set the OVERFLOW boundary condition parameters for a grid named gridname. gridname = name of grid to apply BC to sublist = [list ibtype ibdirstr jmin jmax kmin kmax lmin lmax compname] ibtype = Overflow boundary condition type (see OVERFLOW-2 manual) ibdirstr = boundary condition direction (+L/-L/+K/-K/+J/-J) jmin = minimum j in the subset (optional) jmax = maximum j in the subset (optional) kmin = minimum k in the subset (optional) kmax = maximum k in the subset (optional) lmin = minimum l in the subset (optional) lmax = maximum l in the subset (optional) compname = name of c3p component (optional) Note: If jmin, jmax, etc. are not supplied, apply bc to entire grid plane otherwise, specify all 6 range indices (jmin, jmax, kmin, kmax, lmin, lmax) Note: compname is used to specify c3p hole cutting components. compname can be specified even if the 6 range indices are not. bcparlist = [list bcfile bcpar1 bcpar2] (optional) bcfile = overflow boundary condition file name (see OVERFLOW-2 manual) bcpar1 = overflow boundary condition parameter (see OVERFLOW-2 manual) bcpar2 = overflow boundary condition parameter (see OVERFLOW-2 manual) Note: The bcfile name can appear anywhere, or not appear at all. bcpar1 must be specified before bcpar2, though bcpar2 is optional. The specification, therefore, is dependent on the requirements of the BC. e.g.: BC 41 requires the user to specify BCPAR1, and BCPAR2. The user, therefore, does not need to specify BCFILE. However, BC 42 requires BCFILE and BCPAR1 and BCPAR2 are optional. So the user must specify them in the above order. family = name of family that this grid belongs to. group = name of a group of grids that can be used as cutee grids. Example usage: SetGridBC fuselage [list 5 +L] or SetGridBC fuselage [list 5 +L "forwardFuse"] or SetGridBC fuselage [list 5 +L 5 -5 14 101 1 1] or SetGridBC fuselage [list 5 +L 5 -5 14 101 1 1] [list ] "fuse" "fuse" or SetGridBC symPlane [list 42 +L "forwardFuse"] [list "mybc.dat" 1.0 1.2] or SetGridBC symPlane [list 42 +L "forwardFuse"] [list "mybc.dat" 1.0] or SetGridBC symPlane [list 42 +L "forwardFuse"] [list "mybc.dat" 1.0] "fuse" or SetGridBC symPlane [list 42 +L "forwardFuse"] [list "mybc.dat" 1.0] "fuse" "fuse" 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 3 further args are possible: BCFILE, BCPAR1, BCPAR2 The order above is the order of preference, but the arguments are optional based on the needs of a BC. e.g., BC 41 requires the user to specify BCPAR1, and BCPAR2. The user, therefore, does not need to specify BCFILE. However, BC 42 requires BCFILE and BCPAR1 and 2 are optional. So the user can specify them in the above order. 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] UpdateGoSubs $args Update go.sub data file created by pogs when a grid dimension has changed. Each element of args is a list containing [list n iadja iadjb iadka iadkb] n = grid number iadja = number of extra layers in j=1 direction (usually > 0 but can be < 0) iadjb = number of extra layers in j=nj direction (usually > 0 but can be < 0) iadka = number of extra layers in k=1 direction (usually > 0 but can be < 0) iadkb = number of extra layers in k=nk direction (usually > 0 but can be < 0) Example usage: UpdateGoSubs [list 5 0 0 2 0] [list 11 0 3 0 0] WriteBCInfo $rootname Create a boundary condition (BC) information file named rootname.bc.in, given information in the BC array for each grid in rootname.vol rootname = name of volume mesh file If AddGroup was called, the user specified group names will be used in addition to the default group. The default group, named $rootname, contains all grids in rootname.vol Example usage: WriteBCInfo wing WriteC3pInpFile {$parfile c3p.i} Write c3p input file. Information is based on the global Par, Ovr, and Fomo arrays. parfile = c3p input parameters filename (optional. Default: c3p.i) Example usage: WriteC3PInpFile c3p.i Example for setting inputs: set Ovr(lfringe) 2 set Ovr(dqual) 0.5 set Ovr(c3p,isym) 2 set Ovr(c3p,lobfrac) 0.8 set Ovr(c3p,ncspec) 1 set Ovr(c3p,cspec,1) "fuselage, 0.05, 0.007, -0.001, 2.0, 0.001, 1 compname,dsx,dsy,ztol,mhmsc,epsexp,revnor" set Ovr(c3p,ngspec) 1 set Ovr(c3p,gspec,1) "10, 7, 0.5, 0.7, 0.4, 3 gn,npnocut,dnocutc,lobfrac,dcutf,nlook" set Ovr(c3p,ncutspec) 1 set Ovr(c3p,cutspec,1) "rocketbot, exclude, 2" set Ovr(c3p,nisbox) 2 Blank these subsets of the grid (format of subset: gn,js,je,ks,ke,ls,le) set Ovr(c3p,isbox,1) " 29, 1, 2, 1, -1, 1, -1," Use the ibox cutter to cut the list of grids in glist (negative gn indicates cutter) set Ovr(c3p,isbox,2,ibox) "-13, 1, -1, 1, -12, 1, 63" The ibox cutter will be applied to all grids in glist glist is specified as ranges denoted by : or - along with comma separated list. set Ovr(c3p,isbox,2,glist) "21:22,25,29" set Ovr(c3p,npsbox) 1 Blank all points inside the bbox specified as: x1,x2,y1,y2,z1,z2 set Ovr(c3p,isbox,1,bbox) "0.0, 1.0, 0.0, 1.5, 0.0, 2.0" The bbox cutter will be applied to all grids in glist set Ovr(c3p,isbox,1,glist) "5:8,11,14-19" WriteFomoInfo $rootname Create a fomoco file ($rootname.fomo.in) given information in the Fomo array for component $rootname Example usage: WriteFomoInfo wing WriteFomocoInpFile $parfile $writetot Write mixsur/overint input file. Information is based on the global Par and Fomo arrays. parfile = fomoco input parameters filename writetot = 1 add one more component that is the total of all components 0 do not add total component Assume the following information in arrays Par and Fomo Given: Par(complist) = list of components used to assemble grid.in e.g., [list las us srb] where grid in is constructed by combining las.vol, us.vol and srb.vol in the order specified Par(comp,ng) = number of grids in component comp e.g., set Par(las,ng) 3 Fomo(complist) = list of components to be included in fomoco input file e.g., [list las lasnoz1 lasnoz2 usrcs] Fomo(ncomp) : if defined - use first Fomo(ncomp) components in Fomo(complist) for fomoco computation if not defined - use all components in Fomo(complist) for fomoco computation Fomo(comp,nsub) = number of subsets in component comp Fomo(comp,i) = list of information for ith subset of component comp where the list is given by [list cname gnl ibdir js je ks ke ls le] where cname = name of component containing the subset gnl = local grid number in that file js,je,ks,ke,ls,le = j,k,l indices of subset e.g., set Fomo(rcstop,1) [list rcscol 3 3 1 -1 1 21 1 1] set Fomo(rcstop,2) [list rcscap 3 3 1 -1 1 -1 1 1] Optional inputs: Fomo(comp,npri) = number of priority pairs for component comp (default=0) Fomo(comp,pri,i) = list containing priority pairs of ith priority of component comp where list is given by [list s1 s2] with s1, s2 = subset numbers in the priority pair Fomo(writecomps) = list of components names to write at end of fomoco input file (could be a regular or a mega component) (if this variable does not exist, all regular and mega components are written) Fomo(writetri) = 0 do not write component triangulations to file (default) 1 write component triangulations to file Fomo(fsmach) = Freestream Mach number (default=0.0) Fomo(alpha) = Freestream angle of attack (degrees) (default=-360.0) Fomo(beta) = Freestream yaw angle (degrees) (default=-360.0) Fomo(rey) = Freestream Reynolds number per grid unit (default=-1.0) Fomo(gaminf) = Freestream ratio of specific heats (default=-1.0) Fomo(tinf) = Freestream temperature (Rankine) (default=-1.0) Fomo(nref) = Number of reference subsets (default=1) Fomo(intpr) = 0 integrate -( p - p_inf) (default=0) 1 integrate -p Fomo(outunits) = 0 report non-dimensional coefs (default=0) 1 report dimensional coefs in S.I. units 2 report dimensional coefs in lbf/ft-libf/slugs per sec units Fomo(rhoinf) = Freestream density in dimensional units (default=1.0) Fomo(ainf) = Freestream sound speed in dimensional units (default=1.0) Fomo(grlen) = Grid unit in dimensional units (default=1.0) Fomo(refl,i) = Reference length for i-th reference set (default=1.0) Fomo(refa,i) = Reference area for i-th reference set (default=1.0) Fomo(xmc,i) = X coordinate of moment reference center for i-th reference set (default=0.0) Fomo(ymc,i) = Y coordinate of moment reference center for i-th reference set (default=0.0) Fomo(zmc,i) = Z coordinate of moment reference center for i-th reference set (default=0.0) Computed here: Par(comp,ggn) = global grid number of first grid in component comp E.g., WriteFomocoInpFile fomoco.i 1 WriteLAVABC $parfile Write boundary conditions file for LAVA flow solver. Example usage: WriteLAVABC bcfile 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 WriteOvr2InpFile $parfile $args Write OVERFLOW-2 namelist input file to parfile. This macro is meant to be used with SetOvrBCInput and SetOvrHoleCutInstr to write out the hole cut instructions and boundary conditions from a calling grid generation script. It is not meant for setting up the various run parameters such as time step, and smoothing parameters. args = bInd eInd bInd = beginning input file index eInd = ending input file index For example: WriteOvr2InpFile a 1 3 will create files a.1.inp, a.2.inp, and a.3.inp. It is assumed that the following parameters have been set by the calling script using the global array Ovr. Ovr(ngrid) = total number of near-body grids Ovr(nxcuti) = number of XRINFO hole cut instructions for j = 1, Ovr(nxcuti), define Ovr($j,idxray) = X-ray ID number of j-th instruction Ovr($j,xdelta) = hole expansion arc-length of j-th hole cut If grid numbers to cut are given by grid list, set Ovr($j,igxlist) = grid list (e.g. "3,7,9") grid start and end numbers, set Ovr($j,igxbeg) and Ovr($j,igxend) for i = 1, Ovr(ngrid), define Ovr($i,name) = string containing name for grid i Ovr($i,nbc) = number of boundary conditions for grid i for j = 1, Ovr($i,nbc), define Ovr($i,$j,ibtyp) = boundary condition type Ovr($i,$j,ibdir) = boundary condition direction (+/- 1/2/3) Ovr($i,$j,jbcs) = starting index in j direction Ovr($i,$j,jbce) = ending index in j direction Ovr($i,$j,kbcs) = starting index in k direction Ovr($i,$j,kbce) = ending index in k direction Ovr($i,$j,lbcs) = starting index in l direction Ovr($i,$j,lbce) = ending index in l direction Ovr($i,$j,bcfile) = bcfile for this boundary condition (optional, only needed for b.c.'s 34 42 45 201) Ovr($i,$j,bcpar1) = bcpar1 for this boundary condition (optional, only needed for b.c.'s 3 4 7 8 9 14 15 16 33 34 41 44 48 82 86 141 148, optional for b.c.'s 42 45 142) Ovr($i,$j,bcpar2) = bcpar1 for this boundary condition (optional, only needed for b.c.'s 34 41 141, optional for b.c.'s 42 45) Optional parameters to set from calling script: GLOBAL Ovr(restrt) = .T. or .F. [Default: .F.] in all input files. Can change it for i-th input file by specifying Ovr(restrt,$i) Ovr(nsteps) = Number of iteration steps [Default: 100] in all input files. Can change it for i-th input file by specifying Ovr(nsteps,$i) Ovr(nsave) = How often to save the overall solution. Ovr(mg) = Set multigrid to .T. or .F. in all input files.[Default: ".F."] Can change it for i-th input file by specifying Ovr(mg,$i). Ovr(fmg) = Set grid sequencing to .T. or .F. Can change it for i-th input file by specifying Ovr(fmg,$i). Ovr(fmgcyc) = Number of steps to take on coarser grids [Default: 100,200] Can change it for i-th input file by specifying Ovr(fmgcyc,$i). Ovr(nglvl) = Number of multigrid or grid-sequencing levels to use. [Default: 3] Can change it for i-th input file by specifying Ovr(nglvl,$i). Ovr(nqt) = Turbulence model [Default: 0] Ovr(qavg) = how often forces and mments are computed. [Default: 10] OMIGLOB Ovr(irun) = Run options: 0-complete run, 1-brick generation only, 2-through DCF [Default: 0] Can change it for i-th input file by specifying Ovr(irun,$i). Ovr(i6dof) = Body motion options: 0-user defined, 1-defined by inputs in $SIXINP, 2-GMP [Default: 0] GBRICK and BRKINP Ovr(gbrick) = [Default: True] Use AddBrickInfo to specify the details of the bricks. DCFGLB Ovr(lfringe) = Number of layers of fringe points [Default: 2] Ovr(dqual) = Stencil quality [Default: 1.0] Ovr(morfan) = enable/disable viscous stencil repair [Default: 0] Ovr(norfan) = number of points subject to viscous stencil repair [Default: 20] XRINFO See AddCutterCutee for details FLOINP Ovr(fsmach) = Freestream Mach number [Default: 0.5] Ovr(refmach) = Reference Mach number [Default: 0.5] Ovr(alpha) = Angle of attack (degrees) [Default: 0.0] Ovr(beta) = Yaw angle (degrees) [Default: 0.0] Ovr(rey) = Reynolds number per grid unit [Default: 0.0] Ovr(tinf) = Freestream temperature (Rankine) [Default: 518.0] Ovr(gaminf) = Freestream ratio of specific heats [Default: 1.4] GRDNAM See AddGridNames METPRM Ovr(irhs) = right hand side [Default: 0] Ovr(ilhs) = left hand side [Default: 2] Ovr(idiss) = dissipation option [Default: 3] Ovr(bimin) = low-Mach preconditioner parameter [Default: 1.0] TIMACU Ovr(itime) = Time-step scaling 0-noscaleing, 1,2-local time-step, 3-constant CFL [Default: 1] Can change it for i-th input file by specifying Ovr(itime,$i). Ovr(dt) = Time-step [Default: 0.5] Can change it for i-th input file by specifying Ovr(dt,$i). Ovr(cflmin) = Minimum CFL [Default: 2.0] Can change it for i-th input file by specifying Ovr(cflmin,$i). Ovr(cflmax) = Maximum CFL [Default: 0.0] Can change it for i-th input file by specifying Ovr(cflmax,$i). SMOACU Ovr(dis2) = 2nd-order smoothing coefficient [Default: 2.0] Can change it for i-th input file by specifying Ovr(dis2,$i). Ovr(dis4) = 4th-order smoothing coefficient [Default: 0.04] Can change it for i-th input file by specifying Ovr(dis4,$i). Ovr(FSO) = Order of the spacial differencing Euler terms. [Default: 2.0 for central, Yee, and Roe, 3.0 for Liou ad HLLC] Ovr(vepsl) = Matrix dissipation: minimum linear eigenvalue [Default: 0.0] Ovr(vepsn) = Matrix dissipation: minimum non-linear eigenvalue [Default: 0.0] Ovr(roeavg) = Matrix dissipation flag to use Roe averaging [Default: ".F."] Ovr(smoo) = smoothing options 0-spectral radius is u+c, 1-c is replaced by V/M [Default: 1.0] VISINP Ovr(visc) = include/exclude viscous terms [Default: ".T."] Ovr(itert) = Number of trub. model iterations [Default: 1] Ovr(fsot) = Order of turbulence convection differencing [Default: 1.0] Ovr(irc) = rotational/curvature correction [Default: 0] Ovr(icc) = compressibility correction [Default: 0] Ovr(itc) = temperature correction [Default: 0] Ovr(cflt) = turb. model time step = CFLT*flow solver time step [Default: 1.0] BCINP See AddBCInfo Example usage: To create a single input file (test.1.inp) and set reference Mach number: set Ovr(refmach) 0.8 WriteOvr2InpFile test.1.inp or to create a series of input files (test.1.inp, test.2.inp, and test.3.inp) with different nsteps, and CFLMAX for each file: set Ovr(restrt,1) ".F." set Ovr(restrt,2) ".T." set Ovr(restrt,3) ".T." set Ovr(nsteps,1) 5000 set Ovr(nsteps,2) 3000 set Ovr(nsteps,3) 12000 set Ovr(cflmax,1) 0.2 set Ovr(cflmax,2) 0.4 set Ovr(cflmax,3) 0.8 WriteOvr2InpFile test 1 3
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
FomoSetup $rundir $fomoifile Use mixsur to obtain fomoco files rundir = directory where the code should be run fomoifile = overflow input filename (Must have IRUN=2 for connectivity only) Examples: FomoSetup M0.6A00 wingbody_fomo.inpGeneric Program Execution and Error Checking
InitExecs Set location of CGT executables from CGTBINDIR environment variable. Example Usage: InitExec RunProg $prog $cmdln $input $resultfn {$rundir} 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) rundir = directory path of the location where the run must take place (optional) If path is not specified, run occurs in the current directory 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 Specific Program Execution and Error Checking 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 Multi-Threaded Procedure Execution (alpha testing status) ThreadCompGen $args Purpose: This prodedure is desined to allow for multiple component scripts to be run using parallel threads. Notes: As of now this script is merely aimed at running independent component scirpts with no command line arguements. In order for the component scirpts to be executed properly the following three lines should be at the top #!/bin/sh # Workaround for not knowing the location of tclsh \ exec tclsh "$0" "$@" Problems: Error messages from threads are currently not reported Inputs: args Is a list conataining a series of lists where each list has the following format: [list procname [list ofiles] [list ifiles] efile]] where the ifiles list and efile are optional procname Name of script to be run ofiles list containing the output files to be created by the script ifiles list containing any necessary input files (default=0) mfile name of stdout catch file (default thread.#.out) Example: ThreadCompGen [list [list proc1 [list p1.out1 p1.out2]]/ [list proc2 [list p2.out1 p2.out2] [list p2.inp1] proc2txt.out]]] How the above command works 1. Two different scripts are being requested to be run (proc1 and proc2) these procedures would typically look someting like $Par(basedir)/proc1.tcl. ThreadCompGen will then generate a thread for each requested process with identifiers of "thread.1" and "thread.2" These threads will generate a subdirecotry and cd into it to perform all the necessary operations, then mv all relevant information back into the run directory. 2. For each procedure a list of output files is needed. The script takes this list, parses it into the individual file names for use in CompRun.tcl and appends the names to a global output checklist. These files are what will be moved out of the thread directory and into the run directory. 3. (Optional) An input file list can be specified. This should once again look like [list $path/inp.file $path/inp.file]. This will be used to create links to the specified files within the thread subdirectory. If not specified the script will ignore this field. 4. (Optional) An efile can be specified by the user. This file will be a text file of any stdout lines that are created by the script. This file gets passed back into the run directory and then displayed onto the command line for the used with the efile name as the header. If an efile value is not specified a default value of thread.#.out is used. ThreadProcGen $args Purpose: This prodedure is desined to allow for multiple CGT procedures to be run using parallel threads. Problems: Error messages from threads are currently not reported Inputs: args Is a list conataining a series of lists where each list has the following format: [list procname [list ofiles] [list ifiles]] where the ifiles list is optional procname Procedure input line ofiles list containing the output files to be created by the script ifiles list containing any necessary input files (default=0) Example: ThreadProcGen [list [list {proc1} [list p1.out1 p1.out2]]/ [list {proc2} [list p2.out1 p2.out2] [list p2.inp1]]] How the above command works 1. Two different cgt procedures are being called (proc1 and proc1). Inside the curly brackets should be the entire procedure command that will be executed by the thread. Example: {GenUniformBox box1.vol [list js je ks ke ls le] [list dsj dsk dsl] 1 0} The above command is what the tcl interpreter will enter in the thread. 2. For each procedure a list of output files is needed. The script takes this list, parses it into the individual file names for use in ProcRun.tcl and appends the names to a global output checklist. These files are what will be moved out of the thread directory into the run directory. 3. (Optional) An input file list can be specified. This should look like [list $path/inp.file $path/inp.file]. This will be used to create links to the specified files within the thread subdirectory to allow the procedure to run. If not specified the script will ignore this field.Connectivity
RunConnectivityCode $rundir $ifile $ofile $args Use Overflow, Pegasus or C3P to obtain connectivity from a grid.in file and x.save file is created in addition to the ofile rundir = directory where the code should be run ifile = overflow input filename (Must have IRUN=2 for connectivity only when using overflow2) ofile = output filename (contains orphan information) args = np code obin mpibin ppFringe (all args are optional) np = the number of threads (Default: 1, If np>1, obin must have overflowmpi) code = either o, p or c (Default: o) o for overflow2 p for pegasus5 c for c3p obin = directory where the Overflow2, Pegasus5, or C3P executables reside (Default: current directory) mpibin = directory where the mpirun executable resides (Default: current directory) ppFringe = Number of fringes for peg_plot (Default: 2) 1 = single fringe: blank out level-2 and higher fringe points 2 = double fringe: blank out level-3 and higher fringe points 3 = all: only the minimum holes are blanked out Examples: RunConnectivityCode M0.6A00 wingbody.1.inp over.out 1 o ~/Overflow/over2.2c/bin_dp/ RunConnectivityCode M0.6A00 wingbody.1.inp over.out 16 o $HOME/Overflow/over2.2c/bin_dp/ RunConnectivityCode M0.6A00 wingbody.1.inp over.out 16 o $HOME/Overflow/over2.2c/bin_dp/ $HOME/MPI/bin RunConnectivityCode M0.6A00 wingbody.1.inp over.out 16 p ~/pegasus5.1l/bin_dp/ 3 RunConnectivityCode M0.6A00 ~/bin/ c3p.i c3p.o 16 c