0% found this document useful (0 votes)
51 views25 pages

Additional ANSYS Features: Command Line Inputs

The document describes additional features in ANSYS including direct command line inputs. It discusses using the command line interface to have more flexibility than just the mouse menus. It provides examples of a simple ANSYS .log file that records all commands from an analysis and can be used to repeat the analysis. It also explains the syntax of ANSYS commands and provides a sample .log file for analyzing a 2D truss structure.

Uploaded by

sujeanette
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views25 pages

Additional ANSYS Features: Command Line Inputs

The document describes additional features in ANSYS including direct command line inputs. It discusses using the command line interface to have more flexibility than just the mouse menus. It provides examples of a simple ANSYS .log file that records all commands from an analysis and can be used to repeat the analysis. It also explains the syntax of ANSYS commands and provides a sample .log file for analyzing a 2D truss structure.

Uploaded by

sujeanette
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 25

Module 1:

Additional ANSYS features:


Command line inputs
Purpose of this module
• The module will acquaint the student with the methods
available for direct command input, and the commands
themselves.
• The mouse menu in ANSYS is good for most of the
analyses you might like to run, but it is not
comprehensive. There are features and functions in
ANSYS which do NOT have mouse utility. Furthermore,
the GUI interface cannot be used for analyses in batch
mode.
• In addition to allowing command line input or batch
analysis, understanding of the command syntax will
assist the ANSYS user in understanding the ANSYS
Help Documentation.
ANSYS Command Syntax 2
What is the command line?
• Located towards the top of the GUI interface, just
below the Utility Menu, and to the right of the
toolbar
• Space to allow for typed inputs, rather than using
the mouse menus to direct program execution
• All mouse-pick commands have command line
equivalents, but the reverse is not true;
consequently, use of the command line allows for
maximal flexibility in performance of FEA
• Commands can be input by a combination of
command line inputs and mouse picks, if desired.
ANSYS Command Syntax 3
The Command Line

ANSYS Command Syntax 4


ANSYS File system: the .log file
• Whenever a new analysis is started, ANSYS
creates several files. More files are created
during program execution.
• The most relevant file for the current
discussion is the “.log” file
• The .log file contains a record of all
commands issued in an ANSYS session, and
can be used to repeat an analysis exactly, or
modified and rerun, to analyze multiple
similar models without excessive work.
ANSYS Command Syntax 5
An example of a simple .log file
• A simple example can be found in the attached
document, “trussexample.log”
• The file “trussexample.log” was created
automatically by ANSYS as a result of an
interactive session. All commands were actually
input by mouse pick.
• A functionally similar file can be created
manually in a word processor and will run in
ANSYS just fine. The similar ( and more
compact) file is found in the attached document
“simplifiedlog.log,” repeated later in this module.
ANSYS Command Syntax 6
Explanation of the command syntax
• ANSYS commands are organized into separate
groupings; in order to find the commands you
want, it is convenient to understand the
grouping.
• Command groups include session commands,
database commands, graphics commands, and
groups for each processing module (e.g., Prep7,
Post1, etc.)
• When writing a log file for ANSYS run, you must
organize your commands by the appropriate
command groupings, as well.
ANSYS Command Syntax 7
Command Syntax, continued
• Some ANSYS commands are preceded by a slash (/) or
a star (*).
• Commands preceded by a slash indicate to the
processor that the commands which follow are to be
taken from the appropriate command grouping. For
example “/prep7” tells ANSYS that the commands which
follow are from the Preprocessor grouping. Also, “slash”
commands provide file, printout and display controls.
• Commands preceded by a star are for logical utility, such
as looping or creating a macro within the .log file.
• Comments can be inserted into the command file using
an exclamation point (!) to start the comment. A
comment can appear on the same line as a command, if
desired for documentation.
ANSYS Command Syntax 8
Command Syntax, continued
• Each ANSYS command has a syntax which
might be explained as follows:
– Each command starts with a keyword, or title
– Some commands (for example, “solve”) have only the
keyword, but most have at least one other field which
is available for use.
– Unneeded fields can be skipped or ignored. If the
unneeded fields come after all required fields, then
they can be ignored. If the unneeded fields have
subsequent necessary fields, they may be skipped by
using a comma (with or without an included space).
Examples are included in the simplified .log file to be
used as an illustration.

ANSYS Command Syntax 9


Command Syntax, continued
• Commands are not case-sensitive; my use of
UPPER CASE only in this module is just a
matter of my personal style. The commands
“/SOLU,” “/solu,” and “/SoLu” are identical in
function.
• Commands may be input in “free-form” wherein
any unneeded field may be skipped, using a
comma to proceed to the next field.
• All commands are fully defined in the ANSYS
Commands Reference, located within the
ANSYS Help utility.
ANSYS Command Syntax 10
Simplified Truss .log file
/PREP7
ET,1,LINK1
R,1,2
MP,EX,1,30e6
MP,PRXY,1,.28
N,1,0,0
N,2,60,0
N,3,120,0
N,4,60,60
TYPE,1
E,1,2
E,2,3
E,1,4
E,4,2
E,4,3
D,1,UX,0,,,,UY ! Note the three skipped fields, indicated by successive commas
D,2,UY,0
F,4,FX,-1000
F,4,FY,-200
/SOLU
SOLVE

ANSYS Command Syntax 11


Explanation of the Truss .log File
• Please refer to the previous slide or to the
text file “simplifiedlog.log”
• The commands in the file can be
somewhat rearranged without affecting the
execution. Note however, that “standard”
programming logic must be followed. For
example, you cannot successfully use a
parameter, until after that parameter has
been properly defined.

ANSYS Command Syntax 12


Explanation of the truss .log file,
continued
• The first line is “/PREP7” This command
indicates that all commands which follow,
until the next “slash” command, are from
the Prep7 group. Later in the file, there is
a command “/SOLU,” which indicates that
commands which follow are from the
Solution group.

ANSYS Command Syntax 13


Explanation of the truss .log file,
continued
• The “ET” command defines the Element Type to be used
for element type 1. In this case, the type 1 element is
“link1”.
• The exact syntax for the ET command is, from the
Commands Reference,
ET, ITYPE, Ename, KOP1, KOP2, KOP3, KOP4,
KOP5, KOP6, INOPR
• The element chosen (link1) has no “Keyopts”, hence all
fields after Ename are irrelevant, and thus ignored.
Thus, the syntax actually used in the file is “ET,1,link1”.
• All of the fields of the exact syntax are also defined in the
Commands Reference, with links to the Elements
Reference. Please refer to the Commands Reference, E
Commands, command ET for full details.
ANSYS Command Syntax 14
Explanation of the truss .log file,
continued
• The “R” command defines Real Constants,
meaning those items of information
needed to fully define an element which
cannot be defined by material properties
or node placement. These are element-
type specific, so you will need to look at
the Elements Reference to determine
which Real Constants require definition.
In this case, the number “2” represents
cross-sectional area of the truss members.
ANSYS Command Syntax 15
Explanation of the truss .log file,
continued
• The “MP” command provides material
properties. It is necessary to have one MP
command for each required material property.
In this case, I have inserted two: one which
provides the elastic modulus, and one which
defines the Poisson’s Ratio for the material.
• Note that the first field after the MP title is the
material number, so multiple materials can be
defined. Each material must have its own
commands which define elastic modulus, etc.
An example is provided later in this module.
ANSYS Command Syntax 16
Explanation of the truss .log file,
continued
• The “N” commands define the locations of the
nodes. Here there are four nodes, hence “N,1,
…”, followed by “N,2,…”, through “N,4,…”.
• The exact syntax of the N command is
N, NODE, X, Y, Z, THXY, THYZ, THZX
• Note that the two-dimensional model does not
utilize Z, and THXY, etc are unneeded. Hence,
these fields are omitted in the .log file. This is an
example of a more general rule, which allows for
“free-field” input as previously mentioned.

ANSYS Command Syntax 17


Explanation of the truss .log file,
continued
• The “E” command defines element connectivity, only. The syntax of
the E command does not define element type, real constant set or
material property set which is associated with the element.
• Element type is explicitly defined before the element E command is
issued; this is done using the “Type” command. We first issue the
Type command, then define all elements which will be of this type.
We can then issue a new Type command, and the following E
commands will reference the newly-specified type.
• The Real Constant set assigned to the element will be the first RC
set defined in the file, and material properties will default to type “1”
as well.
• The Material properties will be of type “1” by default, but can be
changed using the “MPCHG” command; all attributes of the element
may be changed using the “EMODIF” command, as needed.

ANSYS Command Syntax 18


Explanation of the truss .log file,
continued
• The “D” and “F” commands provide,
respectively, DOF constraints and loading
parameters on the model.
• The F command is fairly straight-forward,
although note that three fields at the end of the
command have been ignored. These fields
allow for complex-valued loading and “looping”
of the command to apply similar loads to more
nodes than the one initially defined.
• The D command also has omitted fields, some
of which are skipped by inclusion of consecutive
commas.
ANSYS Command Syntax 19
Explanation of the truss .log file,
concluded
• The “/Solu” command has been previously
explained
• The “Solve” command is self-explanatory.

ANSYS Command Syntax 20


How might one go about learning
the commands and syntax?
Perhaps the best way to learn is by looking in the
Analysis Guides provided in the ANSYS Help utility.
The Guides, in most cases, tell you how to input
commands for specific analyses. For an example,
please look at the ANSYS Structural Analysis
Guide, the chapter on Modal Analysis. While
reading through this chapter you would also be
directed to the Basic Analysis Guide. [NOTE: we
will cover modal analysis in a later module. I do not
suggest that you READ the stated section now, only
look at it for an example of how the guides reference
the command syntax.]
ANSYS Command Syntax 21
Additions to the example .log file
Suppose one of the truss members is to
be made of a different material than the
others. For example, let the vertical
member be of aluminum, rather than steel.
This will require two changes to the .log
file: define a new material, and make a
material property change for the relevant
element. Hence, the .log file will be as
shown on the next page.
ANSYS Command Syntax 22
Modified Example .log file:
changed material for element 4
/PREP7
ET,1,LINK1
R,1,2
MP,EX,1,30e6
MP,PRXY,1,.28
MP,EX,2,10e6 ! Additional material definition: modulus of elasticity
MP,PRXY,2,.33 ! Additional material definition: Poisson’s ratio
N,1,0,0
N,2,60,0
N,3,120,0
N,4,60,60
TYPE,1
E,1,2
E,2,3
E,1,4
E,4,2
E,4,3
MPCHG,2,4 ! Change material properties for element 4, to material 2
D,1,UX,0,,,,UY
D,2,UY,0
F,4,FX,-1000
F,4,FY,-200
/SOLU
SOLVE

ANSYS Command Syntax 23


Another Modified Example .log file:
change real constant set for an element
/PREP7
ET,1,LINK1
R,1,2
R,2,1 ! Additonal real constant set: cross-sectional area = 1
MP,EX,1,30e6
MP,PRXY,1,.28
MP,EX,2,10e6
MP,PRXY,2,.33
N,1,0,0
N,2,60,0
N,3,120,0
N,4,60,60
TYPE,1
E,1,2
E,2,3
E,1,4
E,4,2
E,4,3
MPCHG,2,4
EMODIF,4,REAL,2 ! Change RC set for element 4 to RC set 2; EMODIF -> “Element Modify”
D,1,UX,0,,,,UY
D,2,UY,0
F,4,FX,-1000
F,4,FY,-200
/SOLU
SOLVE
ANSYS Command Syntax 24
Concluding remarks
• Although there are many, many more commands which
could be explored in this module, the basic utility has
been demonstrated: use of the command line can make
ANSYS execution much more understandable (and
controllable) to the user.
• In many cases, the command line input approach
provides utility not duplicated in the GUI input approach.
• If a model is to be modified slightly and rerun, especially
if this is to be done repeatedly, use of the .log file can be
a big time-saver.
• Commands may be input into a file and run, as we have
done here, or may be input in the command line during
an interactive session.
• More will be said about command input in later modules.
ANSYS Command Syntax 25

You might also like