Tuesday 18 September 2012

ANSYS Command File Creation and Execution


Generating the Command File

There are two choices to generate the command file:
  1. Directly type in the commands into a text file from scratch. This assumes a good knowledge of the ANSYS command language and the associated options.If you know what some of the commands and are unsure of others, execute the desired operation from the GUI and then go to File -> List -> Log File. This will then open up a new window showing the command line equivialent of all commands entered to this point. You may directly cut and paste from here to a text editor, or if you'd like to save the whole file, see the next item in this list.
  2. Setup and solve the problem as you normally would using the ANSYS graphic user interface (GUI). Then before you are finished, enter the command File -> Save DB Log File This saves the equivalent ANSYS commands that you entered in the GUI mode, to a text file. You can now edit this file with a text editor to clean it up, delete errors from your GUI use and make changes as desired.

Running the Command File

To run the ANSYS command file,
  • save the ASCII text commands in a text file; e.g. frame.cmd
  • start up either the GUI or text mode of ANSYS

GUI Command File Loading

To run this command file from the GUI, you would do the following:
  • From the File menu, select Read Input from.... Change to the appropriate directory where the file (frame.cmd) is stored and select it.
  • Now ANSYS will execute the commands from that file. The output window shows the progress of this procedure. Any errors and warnings will be listed in this window.
  • When it is complete, you may not have a full view of your structure in the graphic window. You may need to select Plot -> Elements or Plot -> Lines or what have you.
  • Assuming that the analysis worked properly, you can now use the post-processor to view element deflections, stress, etc.
  • If you want to fix some errors or make some changes to the command file, make those changes in a separate window in a text editor. Save those changes to disk.
  • To rerun the command file, you should first of all clear the current model from ANSYS. Select File -> Clear & Start New.
  • Then read in the file as before File -> Read Input from...

Command Line File Loading

Alternatively, you can also read in the command file right from the ANSYS command line. Assuming that you started ANSYS using the commands...
   /ansys52/bin/ansysu52
and then entered
   /show,x11c
This has now started ANSYS in the text mode and has told it what graphic device to use (in this case an X Windows, X11c, mode). At this point you could type in /menu,onbut you might not want to turn on the full graphic mode if working on a slow machine or if you are executing the program remotely. Let's assume that we don't turn the menu mode on...
If the command file is in the current directory for ANSYS, then from the ANSYS input window, type
   /input,frame,cmd
and yes that is a comma (,) between frame and cmd. If ANSYS can not find the file in the current directory, you may need to point it to the proper directory. If the file was in the directory,/myfiles/ansys/frame for example, you would use the following syntax
   /input,frame,cmd,/myfiles/ansys/frame
If you want to rerun a new or modified file, it is necessary to clear the current model in memory with the command
   /clear,start
This full procedure of loading in command files and clearing jobs and starting over again can be completed as many times as desired.

ANSYS Command Groupings

ANSYS contains hundreds of commands for generating geometry, applying loads and constraints, setting up different analysis types and post-processing. The following is only a brief summary of some of the more common commands used for structural analysis.
CategoryCommandDescriptionSyntax
Basic
Geometry
kkeypoint definitionk,kp#,xcoord,ycoord,zcoord
lstraight line creationl,kp1,kp2
larccircular arc line
(from keypoints)
larc,kp1,kp2,kp3,rad
(kp3 defines plane)
circlecircular line creation
(creates keypoints)
see online help
splinespline line through keypointsspline,kp1,kp2, ... kp6
aarea definition from keypointsa,kp1,kp2, ... kp18
alarea definition from linesa,l1,l2, ... l10
vvolume definition from keypointsv,kp1,kp2, ... kp8
vavolume definition from areasva,a1,a2, ... a10
vextcreate volume from area extrusionsee online help
vdragcreate volume by dragging area along pathsee online help
Solid Modeling
(Primitives)
rectngrectangle creationrectng,x1,x2,y1,y2
blockblock volume creationblock,x1,x2,y1,y2,z1,z2
cylindcylindrical volume creationcylind,rad1,rad2,z1,z2,theta1,theta2
spherespherical volume creationsphere,rad1,rad2,theta1,theta2
prism
cone
torus
various volume creation commandssee online help
Boolean Operationsaaddadds separate areas to create single areaaadd,a1,a2, ... a9
agluecreates new areas by glueing
(properties remain separate)
aglue,a1,a2, ... a9
asbacreat new area by area substractionasba,a1,a2
ainacreate new area by area intersectionaina,a1,a2, ... a9
vadd
vlgue
vsbv
vinv
volume boolean operationssee online help
Elements &
Meshing
etdefines element typeet,number,type
may define as many as required; current type is set by type
typeset current element type pointertype,number
rdefine real constants for elementsr,number,r1,r2, ... r6
may define as many as required; current type is set by real
realsets current real constant pointerreal,number
mpsets material properties for elementsmp,label,number,c0,c1, ... c4
may define as many as required; current type is set by mat
matsets current material property pointermat,number
esizesets size or number of divisions on linesesize,size,ndivs
use either size or ndivs
eshapecontrols element shapesee online help
lmeshmesh line(s)lmesh,line1,line2,inc
or lmesh,all
ameshmesh area(s)amesh,area1,area2,inc
or amesh,all
vmeshmesh volume(s)vmesh,vol1,vol2,inc
or vmesh,all
Sets &
Selection
kselselect a subset of keypointssee online help
nselselect a subset of nodessee online help
lselselect a subjset of linessee online help
aselselect a subset of areassee online help
nslaselect nodes within selected area(s)see online help
allselselect everything
i.e. reset selection
allsel
Constraintsdkdefines a DOF constraint on a keypointdk,kp#,label,value
labels: UX,UY,UZ,ROTX,ROTY,ROTZ,ALL
ddefines a DOF constraint on a noded,node#,label,value
labels: UX,UY,UZ,ROTX,ROTY,ROTZ,ALL
dldefines (anti)symmetry DOF constraints on a linedl,line#,area#,label
labels: SYMM (symmetry); ASYM (antisymmetry)
Loadsfkdefines afk,kp#,label,value
labels: FX,FY,FZ,MX,MY,MZ
fdefines a force at a nodef,node#,label,value
labels: FX,FY,FZ,MX,MY,MZ

0 comments:

Post a Comment