Você está na página 1de 30

Chapter 14

Short Topics

Chapter 14 Short Topics

Overview

Training Manual

INTRO ODUCTIO ON ON TO AN NSYS - Part NSYS Part 1

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

February 7, 2006 Inventory #002268 14-2

Chapter 14 Short Topics

A. Toolbar and Abbreviations


Training Manual

INTRO ODUCTIO ON TO AN NSYS - Part P 1

An abbreviation is a short-cut to commonly used functions. It is a character string that represents one or more ANSYS commands. Whenever you define an abbreviation, it appears as a button in the ANSYS Toolbar, giving you one-button access to the desired function. There are five predefined abbreviations when you first start ANSYS, but you can modify them or add your own up to 100 total abbreviations abbreviations.

February 7, 2006 Inventory #002268 14-3

Chapter 14 Short Topics

Toolbar and Abbreviations

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

Training Manual

INTRO ODUCTIO ON TO AN NSYS - Part P 1

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

Later, to turn off line numbers, you would have to use the same menus again. again Instead, you could define three abbreviations:
LINE_ON for the command string *ABBR,LINE_ON,/pnum,line,on LINE OFF for LINE_OFF f *ABBR,LINE_OFF,/pnum,line,off *ABBR LINE OFF / li ff 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. off For example example, hit followed by to turn line numbering on and display a line plot.

February 7, 2006 Inventory #002268 14-4

Chapter 14 Short Topics

Toolbar and Abbreviations


The following information is needed for an abbreviation:

Training Manual

INTRO ODUCTIO ON TO AN NSYS - Part P 1

The short-cut name The command string it represents. 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 ABBR command to define abbreviations:


*ABBR, name, command_string

A convenient dialog box is available for this:


Utility Menu > MenuCtrls > Edit Toolbar or Utility Menu > Macro > Edit Abbreviations

February 7, 2006 Inventory #002268 14-5

Chapter 14 Short Topics

Toolbar and Abbreviations


Training Manual

INTRO ODUCTIO ON TO AN NSYS - Part P 1

Abbreviations are stored in the standard ANSYS database, so they get saved to the .db file when you save the database. You can also write abbreviations to an ASCII file, jobname.abbr:
Utility Menu > MenuCtrls > Save Toolbar or Utility Menu > Macro > Save Abbr Abbr or ABBSAV command

To restore abbreviations from a file, use:


Utility Menu > MenuCtrls > Restore Toolbar or Utility Menu > Macro > Restore Abbr or ABBRES command

February 7, 2006 Inventory #002268 14-6

Chapter 14 Short Topics

Toolbar and Abbreviations

Training Manual

INTRO ODUCTIO ON TO AN NSYS - Part Part 1

By creating a series of .abbr files and with a clever use of ABBSAV and ABBRES functions, you can create nested toolbars b tt buttons that th t bring b i up an entirely ti l new set t of f buttons b tt and d put t together a menu of your own! you master the ANSYS command language, g g , there is virtually y Once y no limit to the power and usefulness of abbreviations!

February 7, 2006 Inventory #002268 14-7

Chapter 14 Short Topics

Toolbar and Abbreviations


Demo:

Training Manual

INTRO ODUCTIO ON TO AN NSYS - Part Part 1

Resume rib.db 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 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

February 7, 2006 Inventory #002268 14-8

Chapter 14 Short Topics

B. Start File

Training Manual

INTRO ODUCTIO ON TO AN NSYS - Part P 1

Whenever you start ANSYS, it reads a start file called start100.ans (or start90.ans, start81.ans, etc. depending on ANSYS revision). You can include any commands in the start file. The most common ones are abbreviation definitions. 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 The default d f lt start t t fil file contains t i several l suggested t d abbreviations, bb i ti all ll of f them commented out. You can make a copy of it and uncomment the ones you want to use.

February 7, 2006 Inventory #002268 14-9

Chapter 14 Short Topics

C. APDL

Training Manual

INTRO ODUCTIO ON TO AN NSYS - Part P 1

APDL is an acronym for ANSYS Parametric Design Language, a powerful scripting language that allows you to parameterize your model d l and d automate t t common tasks. t k Using APDL, you can:
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, parameters including vector and matrix operations. define abbreviations (short cuts) for frequently used commands or macros. create a macro to execute a sequence of tasks, with if-then-else branching, do-loops, and user prompts.

February 7, 2006 Inventory #002268 14-10

Chapter 14 Short Topics

D. Defining g Parameters
To define a parameter, use the format N Name=Value V l
Can be typed in the input window or in the Scalar Parameters dialog (Utility Menu > Parameters > Scalar Parameters...) Name is the parameter name, thirty-two alphanumeric characters or less. Value may be a number, a previously defined parameter parameter, a mathematical function, a parametric expression, or a character string (enclosed in single quotes). Can be kept in start##.ans start## ans file for commonly used parameters, such as PI = acos(-1)

Training Manual

February 7, 2006 Inventory #002268 14-11

INTRO ODUCTIO ON TO AN NSYS - Part P 1

Chapter 14 Short Topics

...Defining g Parameters
Examples:
inrad=2.5 outrad=8.2 numholes=4 thick=outrad-inrad e=2 7e6 e=2.7e6 density=0.283 bb=cos(30) pi=acos(-1) p ( ) g=386 massdens=density/g circumf=2*pi*rad area=pi*r**2 dist=sqrt((y2 y1)**2+(x2 dist=sqrt((y2-y1) 2+(x2-x1) x1)**2) 2) slope=(y2-y1)/(x2-x1) theta=atan(slope) jobname=proj1 j p j

Training Manual

INTRO ODUCTIO ON TO AN NSYS - Part P 1

See *SET command for a list of valid function


February 7, 2006 Inventory #002268 14-12

Chapter 14 Short Topics

...Defining g Parameters

Training Manual

INTRO ODUCTIO ON TO AN NSYS - Part P 1

The examples above are scalar parameters, which have a single value either numeric or character. 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. p

xvalues =

28.7 28 7 -9.2 -2.1 51.0 0.0

filnam =

job1 j b1 job2 job3 job4 j job5

February 7, 2006 Inventory #002268 14-13

Chapter 14 Short Topics

...Defining g Parameters
Some naming rules:

Training Manual

INTRO ODUCTIO ON TO AN NSYS - Part P 1

Parameter P t names must t be b thirty-two thi t t characters h t or less, l beginning b i i with a letter. y letters, , numbers, , and the underscore character _ are Only allowed. Avoid underscore _ as starting character reserved for ANSYS use. use Names are not case-sensitive, i.e, RAD and Rad are the same. All parameters are internally stored in capital letters. Avoid common ANSYS labels such as STAT, DEFA, and ALL.

February 7, 2006 Inventory #002268 14-14

Chapter 14 Short Topics

E. Using g Parameters

Training Manual

INTRO ODUCTIO ON TO AN NSYS - Part P 1

To use a parameter, simply enter its name in the appropriate field in the dialog box or on the command. For example, to define a rectangle using the parameters w=10 and h=5,
you can use the menu: Main Menu > Preprocessor > Modeling > Create > Area > Rectangle > By 2 Corners or commands: /prep7 blc4,,,w,h

February 7, 2006 Inventory #002268 14-15

Chapter 14 Short Topics

...Using g Parameters
Note:

Training Manual

INTRO ODUCTIO ON TO AN NSYS - Part Part 1

Whenever you use parameters, Wh t ANSYS i immediately di t l substitutes b tit t their values. g in the previous p example p is stored as a 10x5 area, , The rectangle not as w x h. That is, if you change the value of w or h after creating the rectangle, the area will NOT be updated.

February 7, 2006 Inventory #002268 14-16

Chapter 14 Short Topics

...Using g Parameters
Other examples of using parameters:
jobname=proj1 /filnam,jobname /prep7 y youngs=30e6 g mp,ex,1,youngs force=500 fk,2,fy,-force y fk,6,fx,force/2 ! Jobname

Training Manual

INTRO ODUCTIO ON TO AN NSYS - Part P 1

! Youngs modulus ! Force at KP 2 ! Force at KP 6

February 7, 2006 Inventory #002268 14-17

Chapter 14 Short Topics

F. Retrieving g Database Information

Training Manual

INTRO ODUCTIO ON TO AN NSYS - Part Part 1

To retrieve information from the database and assign it to a parameter, use the *GET command or Utility Menu > Parameters > G t Scalar Get S l Data... D t A vast amount of information is available, including model and p for details. results data. Refer to the *GET command description

February 7, 2006 Inventory #002268 14-18

Chapter 14 Short Topics

...Retrieving g Database Information


Examples:
*get,x1,node,1,loc,x /post1 *get,sx25,node,25,s,x *get,uz44,node,44,u,z nsort s eqv nsort,s,eqv *get,smax,sort,,max etable,vol,volu ssum *get,totvol,ssum,,vol ! x1 = X coordinate of node 1 [CSYS]*

Training Manual

INTRO ODUCTIO ON TO AN NSYS - Part P 1

! sx25 = X stress at node 25 [RSYS]* ! uz44 = UZ displacement at node 44 [RSYS]* ! Sort nodes by von Mises stress ! smax = maximum of last sort ! Store element volumes as vol ! Sum all element table columns ! totvol = sum of vol column

*CSYS = In the active coordinate system (CSYS) RSYS = In the active results coordinate system (RSYS)

February 7, 2006 Inventory #002268 14-19

Chapter 14 Short Topics

...Retrieving g Database Information


Some data can be retrieved with a get function. E Examples: l
x1=nx(1) nn=node(2.5,3,0) /post1 ux25=ux(25) temp93=temp(93) width=distnd(23,88) ! x1 = X coordinate of node 1 [CSYS]* ! nn = node at or near (2.5,3,0) [CSYS]* ! ux25 = UX at node 25 [RSYS]* ! temp93 = temperature at node 93 ! width = distance between nodes 23 & 88

Training Manual

INTRO ODUCTIO ON TO AN NSYS - Part Part 1

*CSYS = In the active coordinate system (CSYS) RSYS = In the active results coordinate system (RSYS)

February 7, 2006 Inventory #002268 14-20

Chapter 14 Short Topics

...Retrieving g Database Information

Training Manual

INTRO ODUCTIO ON TO AN NSYS - Part NSYS Part 1

You can use a get function directly in a field, just like a parameter. For example:
k,10,kx(1),ky(3) k,11,kx(1)*2,ky(3) f,node(2,2,0),fx,100 ! KP 10 at X of KP 1, Y of KP 3 [CSYS]* ! [CSYS]* ! FX force at node(2,2,0) [CSYS]*

*CSYS = In the active coordinate system (CSYS)


February 7, 2006 Inventory #002268 14-21

Chapter 14 Short Topics

G. Batch Mode

Training Manual

INTRO ODUCTIO ON TO AN NSYS - Part P 1

In batch mode, ANSYS reads commands from an input file you supply, and writes responses to an output file. The process runs i the in th background, b k d freeing f i up your computer t for f other th work. k Of the three main phases of an analysis preprocessing, , postprocessing p p g the solution p phase is best suited for solution, batch mode. Thus a batch input file could be as simple as:
/batch resume,... ! Resume database from preprocessing session /solu solve finish

February 7, 2006 Inventory #002268 14-22

Chapter 14 Short Topics

H. Input files

Training Manual

INTRO ODUCTIO ON TO AN NSYS - Part P 1

ANSYS is a command-driven program and can accept commands from several sources:
f from GUI di dialog l boxes b (which ( hi h simply i l send d commands d to t ANSYS when you press OK or Apply) from the keyboard from input p files

An efficient way to run ANSYS, especially when you are rerunning a previous analysis, is to use input files containing the desired command sequence:
Utility Menu > File > Read Input from or the /INPUT command

(The start file is just an input file that is automatically read at startup by a built-in /input command.) The path of the input file can have a maximum length of 250 characters (path and filename) plus an eight character extension

February 7, 2006 Inventory #002268 14-23

Chapter 14 Short Topics

Input files

Training Manual

INTRO ODUCTIO ON TO AN NSYS - Part P 1

For example, you can create a file called rectangle.inp containing the following lines:
/prep7 rect,0,3,0,1 aplot ! Enter preprocessor ! Create a 3x1 rectangle

and then read it into ANSYS:


/input,rectangle,inp ! or File > Read Input from

The ! character above indicates a comment and can be used to:


annotate the input file with explanations. comment out an entire command.

Note: Cutting and pasting commands into the Input window is NOT a supported feature.

February 7, 2006 Inventory #002268 14-24

Chapter 14 Short Topics

Input files

Training Manual

INTRO ODUCTIO ON TO AN NSYS - Part P 1

When an input file ( or a macro ) is executed in the wrong module, repeated warnings occur. Upon encountering five such warnings a dialog di l box b appears allowing ll i you to t stop t and d exit it cleanly. l l You can use the log file jobname.log as an input file. Keep in g points p when you y do this: mind the following
The log file records all commands executed during an ANSYS session. Always use a copy of the log file, dont just rename it. It may be helpful to edit the copy first and: add descriptive comments clean it up by removing erroneous commands and graphics commands (/view, /focus, /dist, etc.) add prompting commands (*ASK)

February 7, 2006 Inventory #002268 14-25

Chapter 14 Short Topics

Input files
The *ASK Command

Training Manual

INTRO ODUCTIO ON TO AN NSYS - Part P 1

*ASK prompts t the th user for f input i t and d assigns i the th response to t a parameter. For example, you can modify rectangle.inp as follows:
/prep7 ! Enter preprocessor ask,w,WIDTH w WIDTH OF RECTANGLE RECTANGLE,3 3 *ask rect,0,w,0,1 ! Create a wx1 rectangle aplot

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

February 7, 2006 Inventory #002268 14-26

Chapter 14 Short Topics

Input files
*ASK, Par, Query, DVAL

Training Manual

INTRO ODUCTIO ON TO AN NSYS - Part NSYS Part 1

Par is the parameter name to which the response value is assigned. 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.

February 7, 2006 Inventory #002268 14-27

Chapter 14 Short Topics

I. Session Editor
Session Editor
Powerful ANSYS Undo 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 g OK, , the modified commands are read back into ANSYS. Main Menu > Session Editor

Training Manual

February 7, 2006 Inventory #002268 14-28

INTRO ODUCTIO ON TO AN NSYS - Part Part 1

Chapter 14 Short Topics

Summary y
Summary: D fi parameters Define t using i the th format f t Name=Value N V l .

Training Manual

INTRO ODUCTIO ON TO AN NSYS - Part P 1

Value may be a number, a previously defined parameter, a , a parametric p expression, p , or a character mathematical function, string. Use *GET or get functions to retrieve data from the ANSYS database. database ANSYS stores data in their actual form (numbers or strings), not in the form of parameter names.

February 7, 2006 Inventory #002268 14-29

Chapter 14 Short Topics

J. Workshops
Refer to your Workshop Supplement for instructions on:
W14A Abbreviations W14B 2-D Bracket Using Parameters

Training Manual

February 7, 2006 Inventory #002268 14-30

INTRO ODUCTIO ON TO AN NSYS - Part NSYS Part 1

Você também pode gostar