8
Verifying Pressures Workshop 9 Macro Basics

2_ws09.ppt

Embed Size (px)

Citation preview

Page 1: 2_ws09.ppt

Verifying Pressures

Workshop 9Macro Basics

Page 2: 2_ws09.ppt

October 30, 2001

Inventory #001572

W9-2

INTR

OD

UCTIO

N TO

AN

SYS 6.0 - Part 2IN

TRO

DU

CTION

TO A

NSYS 6.0 - Part 2

Workshop Supplement

9. Macro BasicsVerifying Pressures• Create a macro called SFEPLOT to

verify and plot the pressure applied on a specified face of a surface effect element. The macro should have arguments as follows:

SFEPLOT, TYPE, FACE

where TYPE is the element type number for SURF154 and FACE is the face number for which effective pressure is desired.

• Given: A database file containing a "bolt load" applied on a plate with a hole.

Page 3: 2_ws09.ppt

October 30, 2001

Inventory #001572

W9-3

INTR

OD

UCTIO

N TO

AN

SYS 6.0 - Part 2IN

TRO

DU

CTION

TO A

NSYS 6.0 - Part 2

Workshop Supplement

9. Macro BasicsVerifying Pressures1. Enter ANSYS in the working directory specified by your instructor using “bpressure”

as the jobname.

2. Resume the “bpressure.db1” database file.

3. Enter Solution and solve.

4. Enter POST1 and plot SY stresses.

Page 4: 2_ws09.ppt

October 30, 2001

Inventory #001572

W9-4

INTR

OD

UCTIO

N TO

AN

SYS 6.0 - Part 2IN

TRO

DU

CTION

TO A

NSYS 6.0 - Part 2

Workshop Supplement

9. Macro BasicsVerifying Pressures5. Now do the operations you want the macro to do. We can then use the

corresponding commands from the log file to create the macro.

a) Select elements of type 1 (SURF154 elements) and all nodes attached to them:– Utility Menu > Select > Entities …

• Choose [Elements], [By Attributes], "Elem type Num" and "From Full"• Min,Max,Inc = 1• [Apply]• Choose [Nodes], [Attached to], and "Elements"• [Apply]

– Or issue:ESEL,S,TYPE,,1NSLE

Page 5: 2_ws09.ppt

October 30, 2001

Inventory #001572

W9-5

INTR

OD

UCTIO

N TO

AN

SYS 6.0 - Part 2IN

TRO

DU

CTION

TO A

NSYS 6.0 - Part 2

Workshop Supplement

9. Macro BasicsVerifying Pressures5. (cont'd)

b) Create an element table item containing effective pressure on face 5 of SURF154 elements. This is "SMISC 17" as documented in the Elements Reference manual.

– Main Menu > General Postproc > Element Table > Define Table … • [Add…]

– Lab = peff– Item = By Sequence Num– Comp = SMISC, 17 (type in the number 17 in the selection box)– [OK]

• [Close]– Or issue:

ETABLE,PEFF,SMISC,17

Page 6: 2_ws09.ppt

October 30, 2001

Inventory #001572

W9-6

INTR

OD

UCTIO

N TO

AN

SYS 6.0 - Part 2IN

TRO

DU

CTION

TO A

NSYS 6.0 - Part 2

Workshop Supplement

9. Macro BasicsVerifying Pressures5. (cont'd)

c) Plot the element table item PEFF.– Element Table > Plot Elem Table…

• Itlab = PEFF• Avgkey = No - do not avg

– Or issue:PLETAB,PEFF

d) Select everything.– Utility Menu > Select > Everything– Or issue:

ALLSEL

Page 7: 2_ws09.ppt

October 30, 2001

Inventory #001572

W9-7

INTR

OD

UCTIO

N TO

AN

SYS 6.0 - Part 2IN

TRO

DU

CTION

TO A

NSYS 6.0 - Part 2

Workshop Supplement

6. List the log file to see the commands that were just executed in step 5, then create a macro with those commands. The only change is that the element type number and SMISC item number are replaced by ARG1 and ARG2+12, respectively.

– Utility Menu > List > Files > Log File– Utility Menu > Macro > Create Macro …

• Macro file name = sfeplot.mac• Then type one command per line as shown below. Note: The "Create Macro" dialog is

suitable only for short macros such as this one. It is not an editor and cannot be used to edit an existing macro. Therefore, we recommend using your system's text editor to create macros. If you wish, you may use a system editor now (but please be aware that your favorite editor may not be available at this training facility!).esel,s,type,,arg1nsle,setable,peff,smisc,arg2+12pletab,peff,noavallsel,all

• [OK]

9. Macro BasicsVerifying Pressures

Page 8: 2_ws09.ppt

October 30, 2001

Inventory #001572

W9-8

INTR

OD

UCTIO

N TO

AN

SYS 6.0 - Part 2IN

TRO

DU

CTION

TO A

NSYS 6.0 - Part 2

Workshop Supplement

9. Macro BasicsVerifying Pressures7. Test the macro by typing the following command:

SFEPLOT,1,5

8. If time permits, edit the macro using a text editor and add if-tests for valid values of arg2. (Arg2 can only take values of 1 to 5.) Refer to the "Branching" section of Chapter 10 in your Training Manual for a sample if-test.

9. Exit ANSYS.