30
Chapter 14 Short Topics

Intro1 M14 Short-Topics

Embed Size (px)

Citation preview

Page 1: Intro1 M14 Short-Topics

Chapter 14

Short Topics

Page 2: Intro1 M14 Short-Topics

Training Manual

Chapter 14 – Short Topics

OverviewIN

TRO

INTR

OIN

TRO

INTR

OIN

TRO

INTR

O

• In this chapter, we will present some general tips and “tricks” on how to use ANSYS more efficiently O

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIOON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

ANN

SYS N

SYS N

SYS ---PPPN

SYS N

SYS N

SYS ---PPPPart 1Part 1Part 1Part 1Part 1Part 1

February 7, 2006Inventory #002268

14-2

Page 3: Intro1 M14 Short-Topics

Training Manual

Chapter 14 – Short Topics

A. Toolbar and AbbreviationsIN

TRO

INTR

OIN

TRO

INTR

OIN

TRO

INTR

O

• An abbreviation is a short-cut to commonly used functions. It is a character string that represents one or more ANSYS commands. O

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIO

• Whenever you define an abbreviation, it appears as a button in the ANSYS Toolbar, giving you one-button access to the desired function. O

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

N

• There are five predefined abbreviations when you first start ANSYS, but you can modify them or add your own — up to 100 total abbreviations

NSYS

NSYS

NSYS ---PPP

NSYS

NSYS

NSYS ---PPP

total abbreviations.

Part 1Part 1Part 1Part 1Part 1Part 1

February 7, 2006Inventory #002268

14-3

Page 4: Intro1 M14 Short-Topics

Training Manual

Chapter 14 – Short Topics

…Toolbar and AbbreviationsIN

TRO

INTR

OIN

TRO

INTR

OIN

TRO

INTR

O

• As an example, to display line numbers on a line plot, you would need to do the following:

Utility Menu > PlotCtrls > Numbering > Line numbers On > OK

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

– Utility Menu > PlotCtrls > Numbering… > Line numbers On > OK– Utility Menu > Plot > Lines

Later, to turn off line numbers, you would have to use the same menus again

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

again.

• Instead, you could define three abbreviations:– LINE_ON for the command string *ABBR,LINE_ON,/pnum,line,on

LINE OFF f *ABBR LINE OFF / li ff

NSYS

NSYS

NSYS ---PPP

NSYS

NSYS

NSYS ---PPP

– LINE_OFF for *ABBR,LINE_OFF,/pnum,line,off– LPLOT for the command string *ABBR,LPLOT,lplot

and simply press the appropriate combinations of buttons in the toolbar to turn line numbering on or off For example hit followed by to

Part 1Part 1Part 1Part 1Part 1Part 1

turn line numbering on or off. For example, hit followed by to turn line numbering on and display a line plot.

February 7, 2006Inventory #002268

14-4

Page 5: Intro1 M14 Short-Topics

Training Manual

Chapter 14 – Short Topics

…Toolbar and AbbreviationsIN

TRO

INTR

OIN

TRO

INTR

OIN

TRO

INTR

O

• The following information is needed for an abbreviation:– The short-cut name

The command string it represents To find out the command for a particular

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

– The command string it represents. To find out the command for a particular function, first execute the function using the GUI, then list the log file (Utility Menu > List > Files > Log File).

• Use the *ABBR command to define abbreviations:

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

Use the ABBR command to define abbreviations:

– *ABBR, name, command_string

A convenient dialog box is available for this: NSYS

NSYS

NSYS ---PPP

NSYS

NSYS

NSYS ---PPP

A convenient dialog box is available for this:– Utility Menu > MenuCtrls > Edit Toolbar…– or Utility Menu > Macro > Edit Abbreviations…

Part 1Part 1Part 1Part 1Part 1Part 1

February 7, 2006Inventory #002268

14-5

Page 6: Intro1 M14 Short-Topics

Training Manual

Chapter 14 – Short Topics

…Toolbar and AbbreviationsIN

TRO

INTR

OIN

TRO

INTR

OIN

TRO

INTR

O

• Abbreviations are stored in the standard ANSYS database, so they get saved to the .db file when you save the database. O

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIO

• You can also write abbreviations to an ASCII file, jobname.abbr:– Utility Menu > MenuCtrls > Save Toolbar…– or Utility Menu > Macro > Save Abbr

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

or Utility Menu > Macro > Save Abbr…– or ABBSAV command

• To restore abbreviations from a file, use: NSYS

NSYS

NSYS ---PPP

NSYS

NSYS

NSYS ---PPP

– Utility Menu > MenuCtrls > Restore Toolbar…– or Utility Menu > Macro > Restore Abbr…– or ABBRES command Part 1

Part 1Part 1Part 1Part 1Part 1

February 7, 2006Inventory #002268

14-6

Page 7: Intro1 M14 Short-Topics

Training Manual

Chapter 14 – Short Topics

…Toolbar and AbbreviationsIN

TRO

INTR

OIN

TRO

INTR

OIN

TRO

INTR

O

• By creating a series of .abbr files and with a clever use of ABBSAVand ABBRES functions, you can create “nested” toolbars —b tt th t b i ti l t f b tt d t

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

buttons that bring up an entirely new set of buttons — and put together a menu of your own!

• Once you master the ANSYS command language, there is virtually ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

y g g , yno limit to the power and usefulness of abbreviations!

NSYS

NSYS

NSYS ---PPP

NSYS

NSYS

NSYS ---PPPPart 1

Part 1Part 1Part 1Part 1Part 1

February 7, 2006Inventory #002268

14-7

Page 8: Intro1 M14 Short-Topics

Training Manual

Chapter 14 – Short Topics

…Toolbar and AbbreviationsIN

TRO

INTR

OIN

TRO

INTR

OIN

TRO

INTR

O

• Demo:– Resume rib.db O

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIO

– Create abbreviations EPLOT, APLOT, LPLOT, KPLOT– Delete KPLOT abbreviation– Save abbreviations to file.abbr, then list the file

Now list the log file and show the ABBSAVE command (This is how

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

– Now list the log file and show the ABBSAVE command. (This is how you can find out the commands for a given function.)

– Resume rib.db again– Restore abbreviations from file.abbr and use the buttons N

SYS N

SYS N

SYS ---PPPN

SYS N

SYS N

SYS ---PPPPart 1Part 1Part 1Part 1Part 1Part 1

February 7, 2006Inventory #002268

14-8

Page 9: Intro1 M14 Short-Topics

Training Manual

Chapter 14 – Short Topics

B. Start FileIN

TRO

INTR

OIN

TRO

INTR

OIN

TRO

INTR

O

• Whenever you start ANSYS, it reads a start file called start100.ans(or start90.ans, start81.ans, etc. depending on ANSYS revision). O

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIO

• You can include any commands in the start file. The most common ones are abbreviation definitions. O

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

N

• ANSYS checks for the start file first in the working directory and then in your home directory. If no file is found, it will read the “default” start file in the ANSYS apdl directory (..\v100\ansys\apdl).

Th “d f lt” t t fil t i l t d bb i ti ll f

NSYS

NSYS

NSYS ---PPP

NSYS

NSYS

NSYS ---PPP

– The “default” start file contains several suggested abbreviations, all of them commented out. You can make a copy of it and “uncomment” the ones you want to use.

Part 1Part 1Part 1Part 1Part 1Part 1

February 7, 2006Inventory #002268

14-9

Page 10: Intro1 M14 Short-Topics

Training Manual

Chapter 14 – Short Topics

C. APDLIN

TRO

INTR

OIN

TRO

INTR

OIN

TRO

INTR

O

• APDL is an acronym for ANSYS Parametric Design Language, a powerful scripting language that allows you to parameterize your

d l d t t t k

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

model and automate common tasks.

• Using APDL, you can:– input model dimensions, material properties, etc. in terms of

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

input model dimensions, material properties, etc. in terms of parameters rather than numbers.

– retrieve information from the ANSYS database, such as a node location or maximum stress.perform mathematical calculations among parameters including

NSYS

NSYS

NSYS ---PPP

NSYS

NSYS

NSYS ---PPP

– perform mathematical calculations among parameters, including vector and matrix operations.

– define abbreviations (short cuts) for frequently used commands or macros. Part 1

Part 1Part 1Part 1Part 1Part 1

– create a macro to execute a sequence of tasks, with if-then-else branching, do-loops, and user prompts.

February 7, 2006Inventory #002268

14-10

Page 11: Intro1 M14 Short-Topics

Training Manual

Chapter 14 – Short Topics

D. Defining ParametersIN

TRO

INTR

OIN

TRO

INTR

OIN

TRO

INTR

O

• To define a parameter, use the format

N V l

gO

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIO

Name=Value– Can be typed in the input window or in

the Scalar Parameters dialog (Utility Menu > Parameters > Scalar Parameters...) O

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

N

– Name is the parameter name, thirty-two alphanumeric characters or less.

– Value may be a number, a previously defined parameter a mathematical N

SYS N

SYS N

SYS ---PPPN

SYS N

SYS N

SYS ---PPP

defined parameter, a mathematical function, a parametric expression, or a character string (enclosed in single quotes).Can be kept in start## ans file for

Part 1Part 1Part 1Part 1Part 1Part 1

– Can be kept in start##.ans file for commonly used parameters, such as PI = acos(-1)

February 7, 2006Inventory #002268

14-11

Page 12: Intro1 M14 Short-Topics

Training Manual

Chapter 14 – Short Topics

...Defining ParametersIN

TRO

INTR

OIN

TRO

INTR

OIN

TRO

INTR

O

g

• Examples:inrad=2.5 g=386 O

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIO

outrad=8.2numholes=4thick=outrad-inrade=2 7e6

massdens=density/gcircumf=2*pi*radarea=pi*r**2dist=sqrt((y2 y1)**2+(x2 x1)**2)

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

e=2.7e6density=0.283bb=cos(30)pi=acos(-1)

dist=sqrt((y2-y1) 2+(x2-x1) 2)slope=(y2-y1)/(x2-x1)theta=atan(slope)jobname=‘proj1’ N

SYS N

SYS N

SYS ---PPPN

SYS N

SYS N

SYS ---PPP

p ( ) j p j

Part 1Part 1Part 1Part 1Part 1Part 1

February 7, 2006Inventory #002268

14-12

See *SET command for a list of valid function

Page 13: Intro1 M14 Short-Topics

Training Manual

Chapter 14 – Short Topics

...Defining ParametersIN

TRO

INTR

OIN

TRO

INTR

OIN

TRO

INTR

O

g

• The examples above are scalar parameters, which have a single value — either numeric or character. O

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIO

• ANSYS also supports array parameters, which have multiple values. Both numeric and character arrays are available. Array parameters will not be discussed in this course. O

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

N

p

28 7 j b1

NSYS

NSYS

NSYS ---PPP

NSYS

NSYS

NSYS ---PPP

28.7-9.2-2.151.0

xvalues =

job1job2job3job4

filnam = Part 1Part 1Part 1Part 1Part 1Part 1

0.0 jjob5

February 7, 2006Inventory #002268

14-13

Page 14: Intro1 M14 Short-Topics

Training Manual

Chapter 14 – Short Topics

...Defining ParametersIN

TRO

INTR

OIN

TRO

INTR

OIN

TRO

INTR

O

g

Some naming rules:

P t t b thi t t h t l b i i

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

• Parameter names must be thirty-two characters or less, beginning with a letter.

• Only letters, numbers, and the underscore character are ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

y , , _allowed.

• Avoid underscore _ as starting character… reserved for ANSYS use

NSYS

NSYS

NSYS ---PPP

NSYS

NSYS

NSYS ---PPP

use.

• Names are not case-sensitive, i.e, “RAD” and “Rad” are the same. All parameters are internally stored in capital letters. Part 1

Part 1Part 1Part 1Part 1Part 1• Avoid common ANSYS labels such as STAT, DEFA, and ALL.

February 7, 2006Inventory #002268

14-14

Page 15: Intro1 M14 Short-Topics

Training Manual

Chapter 14 – Short Topics

E. Using ParametersIN

TRO

INTR

OIN

TRO

INTR

OIN

TRO

INTR

O

g

• To use a parameter, simply enter its name in the appropriate field in the dialog box or on the command. O

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIO

• For example, to define a rectangle using the parameters w=10 and h=5,

– you can use the menu: ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

you can use the menu:Main Menu > Preprocessor > Modeling > Create > Area > Rectangle > By 2 Corners

– or commands: NSYS

NSYS

NSYS ---PPP

NSYS

NSYS

NSYS ---PPP

/prep7blc4,,,w,h

Part 1Part 1Part 1Part 1Part 1Part 1

February 7, 2006Inventory #002268

14-15

Page 16: Intro1 M14 Short-Topics

Training Manual

Chapter 14 – Short Topics

...Using ParametersIN

TRO

INTR

OIN

TRO

INTR

OIN

TRO

INTR

O

g

Note:

Wh t ANSYS i di t l b tit t

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

• Whenever you use parameters, ANSYS immediately substitutes their values.

The rectangle in the previous example is stored as a 10x5 area, ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

g p p ,not as w x h. That is, if you change the value of w or h aftercreating the rectangle, the area will NOT be updated.

NSYS

NSYS

NSYS ---PPP

NSYS

NSYS

NSYS ---PPPPart 1

Part 1Part 1Part 1Part 1Part 1

February 7, 2006Inventory #002268

14-16

Page 17: Intro1 M14 Short-Topics

Training Manual

Chapter 14 – Short Topics

...Using ParametersIN

TRO

INTR

OIN

TRO

INTR

OIN

TRO

INTR

O

g

• Other examples of using parameters:jobname=‘proj1’ O

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIO

/filnam,jobname ! Jobname/prep7youngs=30e6 O

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

N

y gmp,ex,1,youngs ! Young’s modulusforce=500fk,2,fy,-force ! Force at KP 2 N

SYS N

SYS N

SYS ---PPPN

SYS N

SYS N

SYS ---PPP

yfk,6,fx,force/2 ! Force at KP 6

Part 1Part 1Part 1Part 1Part 1Part 1

February 7, 2006Inventory #002268

14-17

Page 18: Intro1 M14 Short-Topics

Training Manual

Chapter 14 – Short Topics

F. Retrieving Database InformationIN

TRO

INTR

OIN

TRO

INTR

OIN

TRO

INTR

O

g

• To retrieve information from the database and assign it to a parameter, use the *GET command or Utility Menu > Parameters > G t S l D t

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

Get Scalar Data...

• A vast amount of information is available, including model and results data. Refer to the *GET command description for details. O

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

N

p

NSYS

NSYS

NSYS ---PPP

NSYS

NSYS

NSYS ---PPPPart 1

Part 1Part 1Part 1Part 1Part 1

February 7, 2006Inventory #002268

14-18

Page 19: Intro1 M14 Short-Topics

Training Manual

Chapter 14 – Short Topics

...Retrieving Database InformationIN

TRO

INTR

OIN

TRO

INTR

OIN

TRO

INTR

O

g

• Examples:*get,x1,node,1,loc,x ! x1 = X coordinate of node 1 [CSYS]* O

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIO

/post1*get,sx25,node,25,s,x ! sx25 = X stress at node 25 [RSYS]**get,uz44,node,44,u,z ! uz44 = UZ displacement at node 44 [RSYS]*nsort s eqv ! Sort nodes by von Mises stress

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

nsort,s,eqv ! Sort nodes by von Mises stress*get,smax,sort,,max ! smax = maximum of last sortetable,vol,volu ! Store element volumes as volssum ! Sum all element table columns N

SYS N

SYS N

SYS ---PPPN

SYS N

SYS N

SYS ---PPP

*get,totvol,ssum,,vol ! totvol = sum of vol column

*CSYS = In the active coordinate system (CSYS) Part 1Part 1Part 1Part 1Part 1Part 1

RSYS = In the active results coordinate system (RSYS)

February 7, 2006Inventory #002268

14-19

Page 20: Intro1 M14 Short-Topics

Training Manual

Chapter 14 – Short Topics

...Retrieving Database InformationIN

TRO

INTR

OIN

TRO

INTR

OIN

TRO

INTR

O

g

• Some data can be retrieved with a get function.

E l

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

Examples:x1=nx(1) ! x1 = X coordinate of node 1 [CSYS]*nn=node(2.5,3,0) ! nn = node at or near (2.5,3,0) [CSYS]*/post1

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

/post1ux25=ux(25) ! ux25 = UX at node 25 [RSYS]*temp93=temp(93) ! temp93 = temperature at node 93width=distnd(23,88) ! width = distance between nodes 23 & 88 N

SYS N

SYS N

SYS ---PPPN

SYS N

SYS N

SYS ---PPPPart 1Part 1Part 1Part 1Part 1Part 1*CSYS = In the active coordinate system (CSYS)

RSYS = In the active results coordinate system (RSYS)

February 7, 2006Inventory #002268

14-20

Page 21: Intro1 M14 Short-Topics

Training Manual

Chapter 14 – Short Topics

...Retrieving Database InformationIN

TRO

INTR

OIN

TRO

INTR

OIN

TRO

INTR

O

g

• You can use a get function directly in a field, just like a parameter. For example: O

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIO

k,10,kx(1),ky(3) ! KP 10 at X of KP 1, Y of KP 3 [CSYS]*k,11,kx(1)*2,ky(3) ! [CSYS]*f,node(2,2,0),fx,100 ! FX force at node(2,2,0) [CSYS]* O

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

NNSYS

NSYS

NSYS ---PPP

NSYS

NSYS

NSYS ---PPPPart 1

Part 1Part 1Part 1Part 1Part 1

February 7, 2006Inventory #002268

14-21

*CSYS = In the active coordinate system (CSYS)

Page 22: Intro1 M14 Short-Topics

Training Manual

Chapter 14 – Short Topics

G. Batch ModeIN

TRO

INTR

OIN

TRO

INTR

OIN

TRO

INTR

O

• In batch mode, ANSYS reads commands from an input file you supply, and writes responses to an output file. The process runs i th b k d f i t f th k

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

in the background, freeing up your computer for other work.

• Of the three main phases of an analysis — preprocessing, solution, postprocessing — the solution phase is best suited for O

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

N

, p p g pbatch mode. Thus a batch input file could be as simple as:

/batchresume,... ! Resume database from preprocessing session N

SYS N

SYS N

SYS ---PPPN

SYS N

SYS N

SYS ---PPP

/solusolvefinish Part 1

Part 1Part 1Part 1Part 1Part 1

February 7, 2006Inventory #002268

14-22

Page 23: Intro1 M14 Short-Topics

Training Manual

Chapter 14 – Short Topics

H. Input filesIN

TRO

INTR

OIN

TRO

INTR

OIN

TRO

INTR

O

• ANSYS is a command-driven program and can accept commands from several sources:

f GUI di l b ( hi h i l “ d” d t ANSYS

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

– from GUI dialog boxes (which simply “send” commands to ANSYS when you press OK or Apply)

– from the keyboard– from input files O

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

N

p

• An efficient way to run ANSYS, especially when you are rerunninga previous analysis, is to use input files containing the desired command sequence: N

SYS N

SYS N

SYS ---PPPN

SYS N

SYS N

SYS ---PPP

command sequence:– Utility Menu > File > Read Input from…– or the /INPUT command

Part 1Part 1Part 1Part 1Part 1Part 1

(The start file is just an input file that is automatically read at start-up by a built-in /input command.)

• The path of the input file can have a maximum length of 250

February 7, 2006Inventory #002268

14-23

• The path of the input file can have a maximum length of 250 characters (path and filename) plus an eight character extension

Page 24: Intro1 M14 Short-Topics

Training Manual

Chapter 14 – Short Topics

…Input filesIN

TRO

INTR

OIN

TRO

INTR

OIN

TRO

INTR

O

• For example, you can create a file called rectangle.inp containing the following lines: O

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIO

/prep7 ! Enter preprocessorrect,0,3,0,1 ! Create a 3x1 rectangleaplot O

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

N

and then read it into ANSYS:/input,rectangle,inp ! or File > Read Input from…

NSYS

NSYS

NSYS ---PPP

NSYS

NSYS

NSYS ---PPP

• The ! character above indicates a comment and can be used to:– annotate the input file with explanations.– “comment out” an entire command. Part 1

Part 1Part 1Part 1Part 1Part 1• Note: Cutting and pasting commands into the Input window is

NOT a supported feature.

February 7, 2006Inventory #002268

14-24

Page 25: Intro1 M14 Short-Topics

Training Manual

Chapter 14 – Short Topics

…Input filesIN

TRO

INTR

OIN

TRO

INTR

OIN

TRO

INTR

O

• When an input file ( or a macro ) is executed in the wrong module, repeated warnings occur. Upon encountering five such warnings

di l b ll i t t d it l l

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

a dialog box appears allowing you to stop and exit cleanly.

• You can use the log file jobname.log as an input file. Keep in mind the following points when you do this: O

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

N

g p y– The log file records all commands executed during an ANSYS session.– Always use a copy of the log file, don’t just rename it.– It may be helpful to edit the copy first and: N

SYS N

SYS N

SYS ---PPPN

SYS N

SYS N

SYS ---PPP

• add descriptive comments• “clean it up” by removing erroneous commands and graphics

commands (/view, /focus, /dist, etc.)add prompting commands (*ASK)

Part 1Part 1Part 1Part 1Part 1Part 1

• add prompting commands (*ASK)

February 7, 2006Inventory #002268

14-25

Page 26: Intro1 M14 Short-Topics

Training Manual

Chapter 14 – Short Topics

…Input filesIN

TRO

INTR

OIN

TRO

INTR

OIN

TRO

INTR

O

The *ASK Command

*ASK t th f i t d i th t

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

• *ASK prompts the user for input and assigns the response to a parameter. For example, you can modify rectangle.inp as follows:

/prep7 ! Enter preprocessor*ask w WIDTH OF RECTANGLE 3

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

ask,w,WIDTH OF RECTANGLE,3rect,0,w,0,1 ! Create a wx1 rectangleaplot

Wh i t thi fil i t ANSYS ill th t

NSYS

NSYS

NSYS ---PPP

NSYS

NSYS

NSYS ---PPP

When you input this file into ANSYS, you will see the prompt shown below. Your response, say 5.2, is assigned to the parameter w, which is used in the subsequent RECT command.

Part 1Part 1Part 1Part 1Part 1Part 1

February 7, 2006Inventory #002268

14-26

Page 27: Intro1 M14 Short-Topics

Training Manual

Chapter 14 – Short Topics

…Input filesIN

TRO

INTR

OIN

TRO

INTR

OIN

TRO

INTR

O

• *ASK, Par, Query, DVAL– Par is the parameter name to which the response value is assigned. O

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIO

– Query is the prompt string, up to 32 characters. The word ENTER automatically appears as the first word of the prompt.

– DVAL is the default value assigned to Par if the response is blank. ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

ANN

SYS N

SYS N

SYS ---PPPN

SYS N

SYS N

SYS ---PPPPart 1Part 1Part 1Part 1Part 1Part 1

February 7, 2006Inventory #002268

14-27

Page 28: Intro1 M14 Short-Topics

Training Manual

Chapter 14 – Short Topics

I. Session EditorIN

TRO

INTR

OIN

TRO

INTR

OIN

TRO

INTR

O

• Session Editor– Powerful ANSYS “Undo” O

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIO

– ANSYS keeps a running copy of your log file from your last save command.

– By modifying the values in the Session Editor window and clicking OK, the modified commands O

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

N

g ,are read back into ANSYS.

– Main Menu > Session Editor…

NSYS

NSYS

NSYS ---PPP

NSYS

NSYS

NSYS ---PPPPart 1

Part 1Part 1Part 1Part 1Part 1

February 7, 2006Inventory #002268

14-28

Page 29: Intro1 M14 Short-Topics

Training Manual

Chapter 14 – Short Topics

SummaryIN

TRO

INTR

OIN

TRO

INTR

OIN

TRO

INTR

O

Summary:

D fi t i th f t N V l

yO

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIO

• Define parameters using the format Name=Value.

• Value may be a number, a previously defined parameter, a mathematical function, a parametric expression, or a character O

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

N

, p p ,string.

• Use *GET or get functions to retrieve data from the ANSYS database

NSYS

NSYS

NSYS ---PPP

NSYS

NSYS

NSYS ---PPP

database.

• ANSYS stores data in their actual form (numbers or strings), not in the form of parameter names. Part 1

Part 1Part 1Part 1Part 1Part 1

February 7, 2006Inventory #002268

14-29

Page 30: Intro1 M14 Short-Topics

Training Manual

Chapter 14 – Short Topics

J. WorkshopsIN

TRO

INTR

OIN

TRO

INTR

OIN

TRO

INTR

O

• Refer to your Workshop Supplement for instructions on:W14A Abbreviations O

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIOO

DU

CTIO

OD

UC

TIO

W14B 2-D Bracket Using Parameters

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

AN

ON

TO A

NO

N TO

ANN

SYS N

SYS N

SYS ---PPPN

SYS N

SYS N

SYS ---PPPPart 1Part 1Part 1Part 1Part 1Part 1

February 7, 2006Inventory #002268

14-30