Using Ansys

37
8/8/2019 Using Ansys http://slidepdf.com/reader/full/using-ansys 1/37 Using ANSYS

Transcript of Using Ansys

Page 1: Using Ansys

8/8/2019 Using Ansys

http://slidepdf.com/reader/full/using-ansys 1/37

Using ANSYS

Page 2: Using Ansys

8/8/2019 Using Ansys

http://slidepdf.com/reader/full/using-ansys 2/37

First load up ANSYS• Follow instructions given in the word document

Iceberg_MPY308.doc • Lets run in a directory called TEST1• So first issue the commands:

mkdir TEST1cd TEST1

• If you now list your directory contents it shouldbe empty:

ls –l(this should give: total 0 )

Page 3: Using Ansys

8/8/2019 Using Ansys

http://slidepdf.com/reader/full/using-ansys 3/37

First load up ANSYS• Run ANSYS using:

ansys –g &• You should get the graphical display• If you go back to your command window and list

the directory contents, you should get(something similar to):

total 8-rw-r--r-- 1 mpp97ajn mp 0 Oct 26 17:40 file.err-rw-r--r-- 1 mpp97ajn mp 0 Oct 26 17:40 file.lock-rw-r--r-- 1 mpp97ajn mp 233 Oct 26 17:40 file.log-rw-r--r-- 1 mpp97ajn mp 0 Oct 26 17:40 file.page-rw-r--r-- 1 mpp97ajn mp 72 Oct 26 17:40 menust.tmp

• These new files are created by ANSYS• The file.log file can be useful as it contains any

commands you enter into ANSYS

Page 4: Using Ansys

8/8/2019 Using Ansys

http://slidepdf.com/reader/full/using-ansys 4/37

Ways to use ANSYSYou can do thingsgraphically usingthe menus

at the top

and the sideof the screen

This will often bringup a dialog box

or ask you to pickthings with thecursor

NOTE: You can change font size using the MenuCtrls > Font Selection menu

Page 5: Using Ansys

8/8/2019 Using Ansys

http://slidepdf.com/reader/full/using-ansys 5/37

Graphical input• Try it! From the side menu select:Preprocessor > Modeling > Create > Areas > Rectangle > By 2 corners

• This should bring up this dialog box• WP X and WP Y are the coords of

the bottom left corner of therectangle• Type a value for these and the width

and height and click OK• You should get a cyan rectangle

Page 6: Using Ansys

8/8/2019 Using Ansys

http://slidepdf.com/reader/full/using-ansys 6/37

ANSYS commands• Now look at your log file

• Type nedit file.log &• This will open the file.log in a text

editor, scroll down to the bottom andyou will see:

BLC4, val1 , val2 , val3 , val4

• This is the command to create arectangle (val1 – val4 have beenspecified by you)

Page 7: Using Ansys

8/8/2019 Using Ansys

http://slidepdf.com/reader/full/using-ansys 7/37

Using ANSYS commands• If you type a command in the command box,

ANSYS will tell you what it expects as input data

• Typing the command in has the same effect asrunning it graphically and the command will alsobe stored in the log file as before

• To get help, simply type help in the commandbox, or use the help menu to select Help Topics

Page 8: Using Ansys

8/8/2019 Using Ansys

http://slidepdf.com/reader/full/using-ansys 8/37

Input files• You can programme in ANSYS using input files

• These are just text files containing a list of ANSYScommands:

• Purple text is comment (designated by ‘!’) for info only

!plate: ANSYS input file for plate with hole /FILNAM,plate ! Name the file

/PREP7 ! Enter the preprocessorET,1,PLANE42 ! Define the element type - 4 node solid elementUIMP,1,EX, , ,200000, ! Define material propertiesK,1,2.5,0,, ! Define keypointsLARC,1,2,11,2.5, ! Define arcs

LSTR, 1, 4 ! Define straight linesAL,3,6,4,1 ! Define areaslesize,3,,,15 ! Define mesh size

Page 9: Using Ansys

8/8/2019 Using Ansys

http://slidepdf.com/reader/full/using-ansys 9/37

The database• You can save ANSYS models as a database file

This can be done hereor with the SAVE command• Once you have done this if you list the directory

contents it now contains a file: file.db • You can resume from your database each time

you start ANSYSFile > Resume from OR RESUME

Page 10: Using Ansys

8/8/2019 Using Ansys

http://slidepdf.com/reader/full/using-ansys 10/37

Why use input files?• They are small, large models can be built with

only a few commands• They allow you to review what you’ve done easily• They allow you to modify models very quickly

I have built and meshed a square in ANSYS,now I want to change the length of the model

Graphically With an input fileEither: Modify keypoints and then

remesh the areas of the model

Or: Start again from scratchFile > Clear and start new

Change 2 values in input file and runagain:

BLC4, val1 , val2 , val3 , val4

File > Read input from

Page 11: Using Ansys

8/8/2019 Using Ansys

http://slidepdf.com/reader/full/using-ansys 11/37

Why use input files?• Parameterisation can be very useful /PREP7ET,1,42

!Define the parameters of my problemxlength = 10ylength = 20

xmesh = 5ymesh = 15

!Use the parameters to define geometry and mesh the modelBLC4, -xlength/2 , -ylength/2 , xlength , ylengthLSEL,s,loc,x,0LESIZE,all,,,xmeshLSEL,s,loc,y,0LESIZE,all,,,ymesh

AMESH,all

We can define the mesh andgeometry using just these 4 values

Page 12: Using Ansys

8/8/2019 Using Ansys

http://slidepdf.com/reader/full/using-ansys 12/37

Geometry definition• Start by defining keypoints

• Join keypoints together using lines – Mesh lines with 1d elements or……

• Create areas from lines – Mesh areas with 2d elements or…..

• Create volumes from areas – Mesh volumes with 3d elements

• In some cases it is quicker to use pre-definedgeometry (like the rectangle command) whichwill automatically create kypts and lines

Page 13: Using Ansys

8/8/2019 Using Ansys

http://slidepdf.com/reader/full/using-ansys 13/37

Page 14: Using Ansys

8/8/2019 Using Ansys

http://slidepdf.com/reader/full/using-ansys 14/37

A note on units• ANSYS knows nothing about the units you

are using• It is important to be consistent

• For this example we will choose mm asour unit of length and MPa for stress• The consistent units of mass, time and

force are then grams , ms and Nrespectively

Page 15: Using Ansys

8/8/2019 Using Ansys

http://slidepdf.com/reader/full/using-ansys 15/37

Structural (1)• File > Clear and start new

• File > Read input from (select file ANSYS_plate.in)• What does this do? Line by line:

!plate: ANSYS input file for plate with hole /FILNAM,plate ! Sets the filename – all output files will be named plate from now on

/PREP7 ! Enter the preprocessor – all geometry creation is done hereET,1,PLANE42 ! Define the element type - 4 node solid element, type help 42 for more infoUIMP,1,EX, , ,200000, ! Define material properties, this is the Young’s modulus in the x directionUIMP,1,NUXY, , ,0.3, ! Define material properties, this is the value of Poisson’s ratio for the materialK,1,2.5,0,, ! Define keypoints, format is: k, knum,kx,ky knum is the number of the pointK,2,1.768,1.768,, ! knum is the number of the point, kx is the x coordinate, ky is the y coordinateK,3,0,2.5,,K,4,10,0,,K,5,10,10,,K,6,0,10,,K,7,50,0,,K,8,50,10,,K,11,0,0,,

11 1 4 7

6 5 8

23

KEYPOINT LOCATIONS

Page 16: Using Ansys

8/8/2019 Using Ansys

http://slidepdf.com/reader/full/using-ansys 16/37

Structural (2)LARC,1,2,11,2.5, ! Define arcsLARC,2,3,11,2.5, ! format is: larc, pt1,pt2,cntr,radiusLSTR, 1, 4 ! Define straight lines between kyptsLSTR, 2, 5

LSTR, 3, 6LSTR, 4, 5LSTR, 7, 8LSTR, 5, 6LSTR, 4, 7LSTR, 5, 8

AL,3,6,4,1 ! Define areas using line numbersAL,4,8,5,2AL,9,7,10,6

LINE NUMBERS AND (MESH SIZING)

For ‘mapped meshing’ we need consistent sizing in the direction of thearrows – this can reduce the number of elements and generally

creates a better mesh

lesize,3,,,15 ! Define mesh sizelesize,4,,,15 ! The number of elementslesize,5,,,15 ! is specified per linelesize,1,,,8

lesize,2,,,8lesize,6,,,8lesize,7,,,8lesize,8,,,8lesize,9,,,12lesize,10,,,12

amesh,1,3,1 !Mesh Areas! Then define boundary conditions, loads! Solve the model and post-process

1(8)

2(8)

3(15)

4(15)

5(15) 6(8) 7(8)

8(8)

9(12)

10(12)AREA NUMBERS

and

FINAL MESH GEOMETRY

Page 17: Using Ansys

8/8/2019 Using Ansys

http://slidepdf.com/reader/full/using-ansys 17/37

• If you define areas

and lines using BLC4and other commandslike it, they will notshare boundaries

• You can useNUMMRG,all, tol tomerge commonboundaries (tol is thetolerance, usuallyuse very small value)

Warning!Definition of model geometry

Lines and kypts before NUMMRG

1

23

4

5

67

8

1 2

34

5 6

78

Lines and kypts after NUMMRG

1

23

4

5

67

2

1 2

34

2 6

73

Page 18: Using Ansys

8/8/2019 Using Ansys

http://slidepdf.com/reader/full/using-ansys 18/37

Structural (3)• What are the boundary conditions?

• What are the degrees of freedom?• Help on element 42 tells us it has four nodes,

with 2 DOF at each node, UX and UY• We are exploiting symmetry - so in the structural

case we constrain displacements normal to theaxis of symmetry

• So we need to set UX = 0 on y axis (x=0)• So we need to set UY = 0 on x axis (y=0)

Page 19: Using Ansys

8/8/2019 Using Ansys

http://slidepdf.com/reader/full/using-ansys 19/37

Structural (4)• How do we apply these conditions?

Preprocessor > Loads > Define Loads > Apply > Structural > Displacement > Choose and then pick the nodes (or lines) you want using the cursor

Select nodes by location using NSEL,s,loc, x,min,max where x,y or z is coordinate direction, min is the minimum value in this direction, max is the maximum

value (if only one value is given, just the nodes at this exact location are selected).Apply DOF constraints to selected nodes using D,nnum,DOF,val where nnum is the number of the node to apply the constraint to (use all for all selected nodes), DOF is

the label of the DOF (in this case either UX or UY) and val is the value of the DOF.e.g. NSEL,s,loc,x,0

D,all,ux,0

To display the DOF constraints on your model use the menu:Plotctrls > Symbolsand select the ‘ALL APPLIED BCs’ option

GRAPHICAL METHOD

COMMAND METHOD

Page 20: Using Ansys

8/8/2019 Using Ansys

http://slidepdf.com/reader/full/using-ansys 20/37

Structural (5)• Similar procedure for force BCs

Preprocessor > Loads > Define Loads > Apply > Structural > Force/Moment > Choose and then pick the nodes (or lines) you want using the cursor

Select nodes by location using NSEL,s,loc, x,min,max where x,y or z is coordinate direction, min is the minimum value in this direction, max is the maximum

value (if only one value is given, just the nodes at this exact location are selected).Apply forces to selected nodes using F, nnum,LAB,val where nnum is the number of the node to apply the force to (use all for all selected nodes), LAB is the

label of the force (in this case either FX or FY) and val is the value of the force.e.g. NSEL,s,loc,x,50

F,all,fx,??

BUT, what force value do we want to apply??

GRAPHICAL METHOD

COMMAND METHOD

Page 21: Using Ansys

8/8/2019 Using Ansys

http://slidepdf.com/reader/full/using-ansys 21/37

Structural (6)• For distributed forces we can apply as a pressure

Preprocessor > Loads > Define Loads > Apply > Structural > Pressure > Choose and then pick the nodes (or lines) you want using the cursor

Select nodes by location using NSEL,s,loc, x,min,max where x,y or z is coordinate direction, min is the minimum value in this direction, max is the maximum

value (if only one value is given, just the nodes at this exact location are selected).Apply pressures to selected nodes using SF, nnum, PRES ,val where nnum is the number of the node to apply the pressure to (use all for all selected nodes), PRES

tells ANSYS to apply a pressure and val is the value of the pressure.e.g. NSEL,s,loc,x,50

SF,all,PRES,1*zthick

BUT, what is the thickness of our elements in z??

GRAPHICAL METHOD

COMMAND METHOD

Page 22: Using Ansys

8/8/2019 Using Ansys

http://slidepdf.com/reader/full/using-ansys 22/37

Know your elements• 2d structural element, PLANE 42

The nodal forces, if any, should be input per unit of depth for a planeanalysis (except for KEYOPT(3) = 3)KEYOPT(3) defines element behavior:0 = Plane stress (default) (stress in z direction = 0)1 = Axisymmetric2 = Plane strain (strain in z direction = 0)3 = Plane stress with thickness input

We want to calculate the plane stress solution, forces are per unit of depth in zdirection so the effective zthick = 1. So we should apply a pressure of 1*1 = 1.

We can set a different thickness value by setting KEYOPT, ITYPE ,3,3 (ITYPE isthe element type number = 1) and R, ISET ,THK (ISET is the real constant setnumber = 1 and THK is the thickness value).

Positive pressures act into the element and we want to apply the load actingout, therefore we apply a pressure of -1.

Page 23: Using Ansys

8/8/2019 Using Ansys

http://slidepdf.com/reader/full/using-ansys 23/37

Model with applied BCs• What should the loaded model look like?

• So now we can solve the problem

Select > Everything Solution > Solve > Current LS

allsel /solu

solve

GRAPHICAL METHOD

COMMAND METHOD

Page 24: Using Ansys

8/8/2019 Using Ansys

http://slidepdf.com/reader/full/using-ansys 24/37

Viewing the results• In the steady state we will only use the

General Postproc (/POST1)• We can view results using commands, but it

is often easier to do this graphicallyGeneral Postproc > Read results > Last Set

• A few examples:General Postproc > Plot results > Contour plot > Nodal Solution

DOF solution > X-component of displacement

Stress > X-component of stress Stress > von Mises stress

Page 25: Using Ansys

8/8/2019 Using Ansys

http://slidepdf.com/reader/full/using-ansys 25/37

Listing results• We can do this through:

List > Results > Nodal solutionGeneral Postproc > List results > Nodal solution

• This will list all selected nodes, so we might want toselect fewer nodes graphically or with NSEL

• We can then save the data using the File > Save as option on the listing window

Page 26: Using Ansys

8/8/2019 Using Ansys

http://slidepdf.com/reader/full/using-ansys 26/37

What might we examine with this model?

• Variation with mesh parameters – Do the results change with mesh variation

• Variation with loading

– Load magnitude – Load position

• Variation with geometry – Plate dimensions – Hole dimensions

• Variation with material properties

Page 27: Using Ansys

8/8/2019 Using Ansys

http://slidepdf.com/reader/full/using-ansys 27/37

Advanced solution options• Here we solved the response of the model using a linear solution,

applying all the load at once• If we wish to apply the load in stages we can solve the model over a

number of substeps using the commandNSUBST, NSBSTP,NSBMX,NSBMN (you should set these equale.g. NSUBST,10,10,10 )

• If we want to write results at every step we can use the commandOUTRES,ALL,ALL

• When we view the results in /POST1 we may want to look at not justthe last results

General Postproc > Read results > By Pick

• If our structure undergoes large deformations we may need toinclude non-linear geometric effects. For more information see thehelp for NLGEOM and Chapter 8 of the ANSYS help Structural

Analysis Guide > Nonlinear structural analysis

Page 28: Using Ansys

8/8/2019 Using Ansys

http://slidepdf.com/reader/full/using-ansys 28/37

Advanced post-processing• If we have multiple results they will be listed as follows:

• The Time/Freq value relates the load at that results set to the totalload• So, if we apply a load of 1N, the applied load at results set 3 would

be 1N*0.3 = 0.3N

• If we apply a displacement of 0.5mm, the applied displacement atresults set 7 would be 0.5mm*0.7 = 3.5mm• We can plot the results as a function of ‘Time’ using the TimeHist

Postproc (/POST26)

Page 29: Using Ansys

8/8/2019 Using Ansys

http://slidepdf.com/reader/full/using-ansys 29/37

Advanced post-processing• TimeHist Postproc has a graphical

interface which lets us add variables and

plot them• If we want to look at the variation ofdisplacement of a node with the appliedload we can add it as a variable

• Type eplo to plot the elements of your

model, make sure you can see the regionyou’re interested in clearly• First click on + to add a new variable• Then select the results type to add and

click OK

• Then select a node from the model andclick OK• You should see a new variable has

appeared

PLOT variable LIST variable

Page 30: Using Ansys

8/8/2019 Using Ansys

http://slidepdf.com/reader/full/using-ansys 30/37

Page 31: Using Ansys

8/8/2019 Using Ansys

http://slidepdf.com/reader/full/using-ansys 31/37

Page 32: Using Ansys

8/8/2019 Using Ansys

http://slidepdf.com/reader/full/using-ansys 32/37

The input fileET,1,141 ! Define the element type - 4 node Fluid elementkeyopt,1,3,2 ! Analysis is axisymmetric about x(Then define geometry and mesh as for the structural example, but using parameters)

allsel ! Select all of the model

/SOLU ! Change into the solver

nsel,s,loc,y,0 ! Select all nodes at location y = 0

d,all,vy,0 ! Constrain these nodes to have y velocity = 0 as this is a symmetry boundary

lsel,s,,,3,5,2lsel,a,,,6,12,3lsel,a,,,14,15lsel,a,,,17 ! Select all lines on the outer wall of the vesselnsll,s,1 ! Select all the nodes that lie on these linesd,all,vy,0 ! Constrain these nodes to have y velocity = 0 (wall condition)d,all,vx,0 ! Constrain these nodes to have x velocity = 0 (wall condition)

Page 33: Using Ansys

8/8/2019 Using Ansys

http://slidepdf.com/reader/full/using-ansys 33/37

The input filensel,s,loc,x,VLEN-SPOS !Select all nodes at the outlet of the modeld,all,pres,0 ! Set the pressure here = 0

!plug velocity at inlet !Select all nodes at the outlet of the modelnsel,s,loc,x,-SPOS !Select all nodes at the inlet of the modeld,all,vx,INV !Set the x velocity of these nodes = INV

FLDATA2,ITER,EXEC,200 !Set the maximum number of iterations = 200FLDATA7,PROT,DENS,CONSTANT !Set the density to be a constant valueFLDATA8,NOMI,DENS,1050 !Set the density = 1050FLDATA7,PROT,VISC,CONSTANT !Set the viscosity to be a constant valueFLDATA8,NOMI,VISC,0.004 !Set the viscosity = 0.004

allsel

solve

Page 34: Using Ansys

8/8/2019 Using Ansys

http://slidepdf.com/reader/full/using-ansys 34/37

Page 35: Using Ansys

8/8/2019 Using Ansys

http://slidepdf.com/reader/full/using-ansys 35/37

Solution

Solution iteration number

Measure ofchange ofsolutionvariable

with eachiteration

Variabletype

Page 36: Using Ansys

8/8/2019 Using Ansys

http://slidepdf.com/reader/full/using-ansys 36/37

Pressure results

General postproc > Plot results > Contour plot > Nodal solution > DOF solution > Pressure

Page 37: Using Ansys

8/8/2019 Using Ansys

http://slidepdf.com/reader/full/using-ansys 37/37

Velocity results

General postproc > Plot results > Vector plot > Predefined > DOF solution > Velocity