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,on
, but 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.
Category
Command Description
Syntax
Basic
Geometry
k
keypoint
definition
k,kp#,xcoord,ycoord,zcoord
l
straight line
creation
l,kp1,kp2
larc
circular arc line
(from keypoints)
larc,kp1,kp2,kp3,rad
(kp3 defines plane)
circle
circular line
creation
(creates
keypoints)
see online help
spline
spline line
through
keypoints
spline,kp1,kp2, ... kp6
a
area definition
from keypoints
a,kp1,kp2, ... kp18
al
area definition
from lines
a,l1,l2, ... l10
v
volume
definition from
keypoints
v,kp1,kp2, ... kp8
va
volume
definition from
areas
va,a1,a2, ... a10
vext
create volume
from area
extrusion
see online help
vdrag
create volume by
dragging area
along path
see online help
Solid
Modeling
(Primitives)
rectng
rectangle
creation
rectng,x1,x2,y1,y2
block
block volume
creation
block,x1,x2,y1,y2,z1,z2
cylind
cylindrical
volume creation
cylind,rad1,rad2,z1,z2,theta1,theta2
sphere
spherical volume
creation
sphere,rad1,rad2,theta1,theta2
prism
cone
torus
various volume
creation
commands
see online help
Boolean
Operations
aadd
adds separate
areas to create
single area
aadd,a1,a2, ... a9
aglue
creates new areas
by glueing
(properties
remain separate)
aglue,a1,a2, ... a9
asba
creat new area by
area substraction
asba,a1,a2
aina
create new area
by area
intersection
aina,a1,a2, ... a9
vadd
vlgue
vsbv
vinv
volume boolean
operations
see online help
Elements &
Meshing
et
defines element
type
et,number,type
may define as many as required; current
type is set by
type
type
set current
element type
pointer
type,number
r
define real
constants for
elements
r,number,r1,r2, ... r6
may define as many as required; current
type is set by
real
real
sets current real
constant pointer
real,number
mp
sets material
properties for
elements
mp,label,number,c0,c1, ... c4
may define as many as required; current
type is set by
mat
mat
sets current
material property
pointer
mat,number
esize
sets size or
number of
divisions on lines
esize,size,ndivs
use either size or ndivs
eshape
controls element
shape
see online help
lmesh
mesh line(s)
lmesh,line1,line2,inc
or lmesh,all
amesh
mesh area(s)
amesh,area1,area2,inc
or amesh,all
vmesh
mesh volume(s)
vmesh,vol1,vol2,inc
or vmesh,all
Sets &
Selection
ksel
select a subset of
keypoints
see online help
nsel
select a subset of
nodes
see online help
lsel
select a subjset
of lines
see online help
asel
select a subset of
areas
see online help
nsla
select nodes
within selected
area(s)
see online help
allsel
select everything
i.e. reset
selection
allsel
Constraints
dk
defines a DOF
constraint on a
keypoint
dk,kp#,label,value
labels:
UX,UY,UZ,ROTX,ROTY,ROTZ,ALL
d
defines a DOF
constraint on a
node
d,node#,label,value
labels:
UX,UY,UZ,ROTX,ROTY,ROTZ,ALL
dl
defines
(anti)symmetry
DOF constraints
on a line
dl,line#,area#,label
labels: SYMM (symmetry); ASYM
(antisymmetry)
Loads
fk
defines a
fk,kp#,label,value
labels: FX,FY,FZ,MX,MY,MZ
f
defines a force at
a node
f,node#,label,value
labels: FX,FY,FZ,MX,MY,MZ