You can access ANSYS both interactively, using menus, and through the UNIX command line with batch files. When users first begin to use ANSYS, interactively clicking through the menus is far easier than sifting through pages of cryptic batch file commands. But do not be fooled! Easier does not mean better or faster. It turns out that solely using interactive ANSYS has several disadvantages
The main disadvantage of using batch files is that the learning curve is steep. But I figured it out, so you can too. The main advantages of batch processing ANSYS jobs are many:
A batch file is a simple ASCII file with a list of ANSYS commands. The *.log file that you generate during an interactive session can be used as the starting point for a batch file. So if you you feel the task of creating a batch file from scratch is too daunting, then start by looking in the *.log file. It is best to check the *.log file as you go along through the menus. You will learn which menu commands correspond to which ANSYS commands.
Creating the geometry is often the most difficult process to perform in a batch file. There are a few options
All right already! You want to see a batch file. I have a few examples. Feel free to run these and pilfer what you may. Remember that \eof anywhere in the file stops execution. You may wish to place an \eof before the solve command in these files.
So now you have a batch file and you want to know how to run the file to get some answers... Here is an example of running a batch file from the UNIX command-line.
unix% nohup nice +20 ansys53 -P ANSYSRF -m 48 < thole > ans.out &This will run ANSYS the batch file thole in the background. It will pipe any output to ans.out. Here is a breakdown
nohup -- UNIX command; "no hangup"; run in the background
nice +20 -- UNIX command; add 20 to process priority; this
means ANSYS will use spare CPU cycles and not steal from
the console
ansys53 -P ANSYSRF -- ANSYS with the correct license
-m 48 -- provide 48 blocks of memory (RAM) for ANSYS
There are other command-line options for ANSYS. Read the manual if you
are interested.
ANSYS has a nasty habit of creating large temp files when it is solving a problem. It continually writes and reads from these files as it is solving. It is most efficient to write these files to the local hard drive rather than to your home directory through the network. Thus, you should always run an ANSYS background job from the local scratch space. Some of the MEnet machines have large scratch spaces, others very small. Be aware and use
df -kto determine how much local disk space there is. Local disk is mounted on /. The local scratch space on most machines is located in
unix% cd /usr/tmpMake a directory to stick all you temporary stuff in. CAUTION! These temporary directories are cleaned often. Do not use for storage! When you are done, be nice and clean everything out so the next person will have plenty of space.
Once you have made an ANSYS run in the temporary directory, you can open up ANSYS interactively to look at the results. Note that the only files you need are those labeled *.db, *.log, and *.rst. The rest of the files are temp files. Remove them as they take up gobs of space and are not needed. Once you are done looking at the results, you can throw away everything but the batch file used to create the results. You can recreate the results at any time. If you really, really must save your results and geometry files, then at least archive and compress them
unix% tar -cvf - file.db file.log file.rst | gzip -9 > file.tar.gzbefore you copy them to your home directory.
Q1: How do I use the PCG solver?
A1: Once you are in the solution submenu (/solu) you can type
eqslv,pcgat the command line. From the left menus,
Solution -> Analysis Options.. -> Linear Options [EQSLV] -> Precondition CG
Q2: How do I check the unaveraged stresses?
A2: When an FEM package solves for the stresses, it does so on an element by element basis. Unless otherwise prompted, ANSYS will solve for the stresses at the Guass points and extropolate to the nodes. However, many elements share nodes. So ANSYS averages the nodal stresses computed from each of the adjacent elements. If your mesh is sufficiently small, the averaged stresses will not be very different from the unaveraged stresses---that is to say that stresses at a common node, computed from adjacent elements will not be very different. So if you plot the unaveraged stresses and the stress from one element to the next changes drastically, your mesh is not small enough. You will need to define an element table to plot the unaveraged stresses.
General Postproc -> Element Table -> Define Tableand pick the particular variable you are interested in. When you plot an item in the element table, ANSYS will prompt the user,
[PLETAB] Avglab -> No - do not avg
Q3: How do I make line/XY plots of stress vs. distance?
A3: Sure, color contours look cool, but there are often better ways of presenting data. Good old XY plots are still
To define a path in ANSYS, select
General Postproc -> Path Operations -> Define Pathfrom the lefthand menu. You must define a path by picking nodes on your model that define your desired path. Once you have selected the path, you will need to map variables onto the path,
General Postproc -> Path Operations -> Map onto Path ...You can even define variables of your own that are complex functions of known quantities (e.g. Sxx*Sxy).
Q4: How can I get ANSYS to plot line contours rather than filled contours?
Q5: How can I magnify the keypoint/node/element numbers? They're too small to read!
A5: Use
/dev,text,2,%at the ANSYS command-line. Note that % is a number that should be larger than 100 (e.g. 150 for 150% magnification).
Q6: How do import a part from Pro/E?
A6: The easiest way to trasfer a part from Pro/E to ANSYS is through an IGES file. In Pro/E select,
Part -> Interface -> Export -> IGESPro/E will prompt you with some export options. Choose the option based on what you are exporting (i.e. are you interested in surfaces? wireframe?). You will probably need to try this a few times to make certain that you have the correct information.
Once you have the IGES file, you need to import it into ANSYS. From the commandline,
/AUX15 IOPTN,IGES,0 IOPTN,MERG,1 IOPTN,SOLID,0 IOPTN,GTOLER, DEFA IGESIN,tube1,igs, finishFrom the ANSYS top menubar
File -> Import -> IGESDepending on how you chose to export the IGES file from Pro/E, ANSYS may recognize duplicate lines or points. Often, a general merge is needed.
Q7: How do I mesh a part in Pro/E?
A7: You don't. ANSYS has much better mesh capabilities than does Pro/E. For one, Pro/E cannot mapped mesh a solid with bricks. Quadratic bricks are often the best elements for a given problem. Use the above procedure for transfering a solid model from Pro/E to ANSYS.
Q8: How do I mesh a part in ANSYS
A8: Meshing is one of the most difficult parts of doing an FEM analysis. When I get around to it, I'll write some of the guidelines I use.
Q9: How can I select certain nodes in a batch file (you can't pick them with the mouse, obviously)?
A9: The different slection commands (nsel, lsel, asel) will allow you to select items based on location or some other parameters. For example, say I wanted to select all nodes with an x location between 0.05 and 0.06,
nsel,r,loc,x,0.05,0.06
But what if you want all the nodes between with an x location from 0.05 to 0.06 and a y location between 0.7 and 0.71. Just stack the node selections. Essentially, you select the nodes with y between 0.70 and 0.71 from the set of nodes with an x location between 0.05 and 0.06.
nsel,r,loc,x,0.05,0.06 nsel,a,loc,y,0.70,0.71
Q10: How can I get a count of the number of items I have selected ?
A10: The *get command will allow you to get just about any information you want about selected items and allow you to store the result in a parameter/variable. Here is an example that with count the selected nodes and put the result in NODECNT
*get,NODECNT,node,,count
Q10: How can I add logic (i.e. if-thens, etc) to my ANSYS batch file?
A11: ANSYS has much of the functionality of a programming language. In fact, much of the functionality is based on the underlying FORTRAN (sad that people use such an archaic language). You can compute parameters by calling any of the usual mathematical functions
NOTCH_MD=sqrt(NOTCH_R*NOTCH_R-DUMMY2*DUMMY2)
As another example you can use if-then logic to apply a certain load if a certain paramater (AXIAL in this case) is set
*if,AXIAL,EQ,1,then
! apply the axial force
allsel
nsel,r,loc,x,TOTAL_L-SMALLE,TOTAL_L+SMALL_E
*get,NODECNT,node,,count
f,all,fx,FAXIAL/NODECNT
*endif