Professional Documents
Culture Documents
ANSYS7SC
ANSYS7SC
Xiaoming He
Department of Mechanical Engineering
University of Minnesota, Twin Cities
xmhe@me.umn.edu
Class material for short course for ANSYS (7.0) in Mechanical Engineering Department
October 2003
Contents
1 General Introduction......................................................................................................................1
2 Starting ANSYS ............................................................................................................................1
3 The ANSYS Windows and File System........................................................................................1
3.1 ANSYS windows system ........................................................................................................1
3.2 ANSYS File System................................................................................................................2
4 Basic ANSYS Analysis .................................................................................................................3
4.1 Build the model .......................................................................................................................3
4.1.1 Modeling ...........................................................................................................................4
4.1.2 Meshing ............................................................................................................................5
4.2 Apply loads and obtain solution..............................................................................................7
4.2.1 Structural Analysis............................................................................................................7
4.2.2 Thermal Analysis ..............................................................................................................7
4.3 Review results .........................................................................................................................9
4.3.1 General Postprocessor.......................................................................................................9
4.3.2 Time-History Postprocessor............................................................................................11
5 ANSYS Batch Mode ...................................................................................................................12
5.1 ANSYS APDL language.......................................................................................................12
5.2 Batch files for the structural problem....................................................................................12
5.3 Batch files of the thermal problem........................................................................................13
5.4 Optimization..........................................................................................................................15
6 More on FEM Analysis using ANSYS .......................................................................................15
6.1 Mapped mesh ........................................................................................................................15
6.2 3D modeling and meshing ....................................................................................................17
6.3 Other random comments .......................................................................................................18
6.3.1 Run ANSYS in background............................................................................................18
6.3.2 Disk space and network traffic .......................................................................................19
6.3.3 Print and export image ....................................................................................................19
6.3.4 Import IGES files............................................................................................................19
7 Closures .......................................................................................................................................19
8 References ...................................................................................................................................19
ANSYS HE
1. General Introduction
ANSYS is a commercially available software package for both computer aided design (CAD) and finite
element analysis (FEA) made by ANSYS Inc., Canonsburg, PA. ANSYS runs under a variety of
operation system including UNIX and Windows. ANSYS is available on all MEnet Sun, SGI and
Window machine. It is available on the Linux machines by remote-login only. Currently, MEnet has the
Research/Faculty version of both ANSYS 6.1 and ANSYS 7.0. ANSYS can be used to analyze transient
and nonlinear problems for a variety of physics including:
Heat transfer
Structural and solid mechanics
Fluid Dynamics (laminar and turbulent)
Electromagnetics (high and low frequency)
Multiphysics (thermal stress,
For this short class, we will focus our attention on the application of ANSYS in both thermal and
structural analysis. This document is meant to be at the entry level. The material covered here is by no
means comprehensive. In fact, we will only scratch the surface of ANSYSs capabilities. However, with
this entry level knowledge, you will be able to improve yourself to advanced level by making use of the
comprehensive ANSYS help system and of course the ANSYS website (www.ansys.com).
2. Starting ANSYS Interactively
As mentioned before, you can run ANSYS on both Windows and UNIX machines. To start ANSYS
interactively on Windows machines, following menu chains:
Starts > Program > ANSYS > Interactive
The ANSYS launcher will show up. Input the jobname and directory and then click on Run button to
start ANSYS. To start ANSYS interactively on UNIX machines, following:
unix% module load ansys
unix% ansys -g -p ANSYSRF
The first step is to load ANSYS into the memory of the machine, while the second step tell the operation
system to start ANSYS product for Research/Faculty (-p ANSYSRF) interactively (-g). You can start
ANSYS in the second step as follows:
unix% ansys
Then, the ANSYS launcher bar will show up. Click on the symbol ANSYS to expand the launcher.
Input the jobname and directory and then click on Run button to start ANSYS. You can just use the
default settings, run ANSYS and change the jobname in ANSYS under the File utility menu.
3. The ANSYS Windows and File System
3.1 ANSYS Windows system
Once you started successfully ANSYS. You should see the ANSYS interface windows as shown in Fig. 1.
From this windows and menu system, you can essentially do any finite element analysis that ANSYS can
do. Details of the function of the windows and menus are explained briefly below:
1. Utility Menu - Contains utility functions that are available throughout the ANSYS session, such as file
controls, selecting, graphics controls, and parameters. You also exit the ANSYS program through this
menu.
2. Standard Toolbar - Contains graphic buttons that execute frequently used ANSYS commands.
3. Input Window - Allows you to type in commands directly. All previously typed in commands appear in
a drop down list for easy reference and access.
4. ANSYS Toolbar - Customizable toolbar that contains push buttons that execute commonly used
ANSYS commands and functions. You may add your own push buttons by defining abbreviations.
5. Main Menu - Contains the primary ANSYS functions, organized by processors (preprocessor, solution,
general postprocessor, design optimizer, etc.).
6. Graphics Window - A window where graphics displays are drawn.
1
ANSYS HE
7. Status and Prompt Area - located at the bottom of the GUI, shows prompts and the status of your
analysis. Typically, you will see prompts for functions that involve graphical picking. Be sure to read
the prompt so you can pick the proper entities in the proper order. This area also contains status
information (PREP7, SOLU, etc.).
8. Output Window - Receives text output from the program. It is usually positioned behind the GUI, but
you can bring it to the front when necessary.
1
2 3
4
7
Fig. 1 ANSYS windows system
3.2 ANSYS Files System
The ANSYS program writes and reads many files for data storage and retrieval. File names follow this
pattern: Name.ExtName defaults to the jobname, which you can specify while or after entering the
ANSYS program. The default jobname is FILE (or file). Ext is a unique, two- to four-character ANSYS
identifier that identifies the contents of the file. Some systems (such as PCs) truncate the extension to
three characters. Also, the extension may be in lowercase, depending on the system. A summary of the
meanings of ANSYS file extension is given in Table 1.
The most important two files are the database file and results file. Your model is stored in the database
files while the results file keeps all your results from an analysis. The log file records in ANSYS
commands all your interactive operations via GUI windows and menu. The error notes down all the error
and warning message raised during this and all previous sessions. The output file has all the messages
appeared in the output window.
2
ANSYS HE
0.004m 0.004m
q=100 W m-2
T=50oC
T=-196 oC
0.02m
0.02m
0.02m 0.02m
3
ANSYS HE
To make our drawing easier, we will use the ANSYS workplane, which is simply a 2D grid for drawing
using the mouse. From the Utility Menu,
WorkPlane > WP Settings > Grid and Triad
Snap Incr 0.0005
Spacing 0.001
Minimum 0.015
Maximum 0.015
Tolerance 0.00003
To display the workplane
WorkPlane > Display Working Plane
You will need to zoom in because it is too small (from the Utility Menu):
PlotCtrls > Pan, Zoom, Rotate ...
Now, lets start the solid modeling by entering the pre-processor from the main menu. Draw the
rectangular area using the following menu system:
Modeling > Create > Areas > Rectangular > By 2 Corners
Click and hold down on the left mouse button. The work plane coordinates will appear in the popup menu.
Position the mouse over X = -0.01 and Y = 0.01 and let go of the left mouse button. Now position the
mouse over (0.01,-0.01) and click again. You should have a rectangular area. Click on OK to complete.
Note that you can return to any of the popup menus spawned by the Main Menu at any time. Therefore,
we return to menu Areas and draw a circular area as follows:
Areas > Circle > Solid Circle
Notice that the middle line of the Input window instructs you to pick two workplane locations: a center
and a radius. Click on (0, 0) and let go of the left mouse button until the radius is shown to be 0.002, then
left click the mouse. You should have a circular area. Click on OK to complete.
Now, wed like to subtract the circular area from the square area,
Modeling > Operate > Booleans > Subtract > Areas
Click on the box. This will spawn an error message to let you know that there are two areas. If the square
is highlighted, click OK, otherwise, choose Next until the square is highlighted then OK. Click OK in the
Subtract popup menu. Select the center circle (again, this will raise a warning; make certain you have
selected the circle). Click on OK in the Subtract popup menu and you have a 2D plate with a hole.
4
ANSYS HE
This would be a good point to save your work. Use the Toolbar menu, SAVE DB. This will save all of the
pertinent information in an ANSYS database file called solid.db. Since we will use this solid model for
both thermal and structural analysis we should save two copies (one for thermal and one for structural
analysis) so that we can resume further analysis from this point. From the Utility Menu:
File > Save As > input the filename in the popup window.
Do this twice to save the files as 2dstr.db and 2dthm.db. Now, we save additional two copies of the
established solid model. The entire solid modeling work is done at this point.
4.1.2 Meshing
Since meshing requires given element types and ANSYS using different element types for thermal and
structural analysis, we need to do meshing for thermal and structural analysis separately.
4.1.2.1 Meshing for structural analysis
To use previously constructed solid model, we need to resume from there using the Utility menu:
File> Resume From
Choose 2dstr.db from the file list and click OK.
Change jobname to 2dstr as follows:
File> Change Jobname > [/FILENAME] Enter new jobname: 2dstr.
Then click OK.
Now, we begin to mesh the model. Click on Preprocessor in the main menu to open the submenu tree.
1. Select element type from the preprocessor:
Element Type > Add/Edit/Delete ... > Add ... > Structural Mass > Solid > Quad 8node 82
The Element Types windows should now show PLANE82 as element type 1. This element can be used
for plane stress, plane strain, and axisymmetric problems. From the Element Types Menu:
Options ... > Element behavior K3: Plane Stress
2. Assign material properties
Material Props > Material Models > Structural > Linear > Elastic > Isotropic >EX 2e11
PRXY 0.3
3. Define element size
There are a number of ways to define the element size. Here, we use two of them:
a. for the inner circle:
Meshing > Size Cntrls > ManualSize > Lines > Picked Lines >
Pick all the lines forming the inner circle, click OK, input the 10 to NDIV No. of element divisions in
the Element Size on Picked Lines window. This specifies the number of element divisions for each
line that forms the model.
5
ANSYS HE
6
ANSYS HE
Be caution to use this tool. Since ANSYS does not know what you are solving for or what the boundary
conditions will be, it cannot know what the best mesh is.
4. Mesh the model using free mesh
Meshing > Mesh > Areas > Free
Select the plate area and click OK. ANSYS will mesh the model and plot the elements in the Graphics
window.
5. If we expect high temperature gradient surrounding the inner circle, we can refine the scheme there as
follows:
Meshing > Modify Mesh > Refine at > Lines
Pick all the lines forming the inner circle, click OK, and select LEVEL Level of refinement as 2 in the
Refine Mesh at Line window. Your mesh ought to look like the following Fig. 4.
5. Now save the meshed model using SAVE_DB in the ANSYS Toolbar for future resuming from this
point.
4.2 Apply loads and obtain solution
4.2.1 Structural analysis
First resume from previously meshed model
File> Resume From
Choose 2dstr.db from the file list and click OK.
Change jobname to 2dstr as follows:
File>Change Jobname > [/FILENAME] Enter new jobname: 2dstr.
Then click OK.
Now enter SOLUTION under main menu to apply loads and obtain solution.
1. Apply the load on the top edge:
Solution > Define Loads > Apply > Structural > Displacement > On Nodes
Select Box in the selection window and draw a box around the line defining the top of the plate. This
should select all of the nodes along that line. The Apply U, ROT on Nodes menu will pop up.
Lab2 DOFs to be constrained All DOF
2. Apply the load on the bottom edge:
Solution > Define Loads > Apply > Structural > Force/Moment > On Nodes
Again, select Box and select all of the nodes on the bottom line of the plate. The number of nodes you
selected ought to be listed in the Apply F/M on Nodes menu under Count. Click OK, spawning another
menu
[F] Apply Force/Moment on Nodes
Lab Direction of force/mom FY
VALUE Force/moment value -1000/41
Click OK. This will apply a total load of 1000N to the bottom edge of the plate (or 1000/41 per node for
41 nodes).
Use default option for all other setting. The model is now complete.
3. Solve the problem
Solution > Solve > Current LS
This will spawn two new windows. Click OK in the Solve Current Load Step window and simply close
the other window. This will begin the solution process. ANSYS will alert the user when the solution is
done.
4 Save the analysis by click on the save symbol on the standard toolbar for resuming from this point to
review results in the future
4.2.2 Thermal analysis
First resume from previously meshed model
File> Resume From
Choose 2dthm.db from the file list and click OK.
Change jobname to 2dthm as follows:
File> Change Jobname > [/FILENAME] Enter new jobname: 2dthm.
7
ANSYS HE
8
ANSYS HE
This will spawn two new windows. Click OK in the Solve Current Load Step window and simply close
the other window. This will begin the solution process. ANSYS will alert the user when the solution is
done.
7. Save the analysis by click on the save symbol on the standard toolbar for resuming from this point to
review results in the future
4.3 Review results
The ANSYS post processor provides a powerful tool for viewing results. You can review your results as
contour plots, table format, and x-y plots in General Postproc. You can plot and list you results vs. time
for a transient problem in TimeHist Postproc.
4.3.1 General postprocessor
1. Review results of 2D structural analysis
Lets resume the 2D plane stress problem we solved before:
File> Resume From
Choose 2dstr.db from the file list and click OK.
Change jobname to 2dstr as follows:
File> Change Jobname > [/FILENAME] Enter new jobname: 2dstr.
Then click OK.
9
ANSYS HE
Pick two nodes: one at the right most point of the circle and one at the middle of right side of the
rectangle, click OK, label it as path1, click OK.
Now, we need to map the von Mises stress on the this path:
Path Operations > Map onto Path > Stress > von Mises SEQV
Label it as vMP1, click OK. Now we can plot it:
Path Operations > Plot Path Item > On Graph > vMP1
The X-Y Plot should look as Fig. 6.
10
ANSYS HE
One of the cool things ANSYS can do for you is to make a movie of your transients analysis:
Stay in general postprocessor and using the following Utility menus:
PlotCtrls > Animate > Over Time > Number of animation frames 10
(click on) Time Range
Range Minimum: 10, Maximum: 600
Leave all other options default, Click OK. You will see in the graphics windows the movie of the thermal
contour vs. time. Thermal contour Movie
11
ANSYS HE
shown in the table. Here, I pick the node at the middle point of the bottom frame line. Repeat above
procedure and pick the node at the middle point of the left frame line. It is shown in the table as TEMP_3.
Now, we will plot the thermal histories of the selected two nodes. Select both variables by holding the
Ctrl or Shift keyboard and clicking the two variables in the table using your mouse. Then click the both
with a curve on a black background. The two thermal histories will be shown on the Graphical windows
as shown in Fig. 8.
5. ANSYS Batch Mode Analysis
There two primary ways to use ANSYS interactively: through the graphical user interface and through the
use of batch files of ANSYS programming language. Up to this point, we have used the GUI exclusively.
It is easiest to learn ANSYS interactively, especially when compared to the daunting task of learning all
of the relevant ANSYS commands. But do not be fooled! Easier does not mean better or faster. The
database file and results file from an analysis may be very big (10-1000 MB) even after compression. It is
very inconvenient to keep them. Batch files are about 10-100KB and can be run under background.
Therefore, it is especially useful for complex models and long jobs such as strong nonlinear analysis. In
short, batch mode saves your time and effort.
5.1 ANSYS APDL programming language
ANSYS has its owner programming language called APDL. APDL stands for ANSYS Parametric Design
Language, a scripting language that you can use to automate common tasks or even build your model in
terms of parameters (variables). APDL also encompasses a wide range of other features such as repeating
a command, macros, if-then-else branching, do-loops, and scalar, vector and matrix operations. It looks
very similar to a FORTRAN computer language although the exact format is a little different and APDL
has more commands for solid model generation.
Parameters are APDL variables (they are more similar to FORTRAN variables than to Fortran
parameters). You don't need to explicitly declare the parameter type. All numeric values (whether integer
or real) are stored as double-precision values. Parameters that are used but not defined are assigned a
near-zero, or "tiny," value of approximately 2-100. For example, if parameter A is defined as A=B, and B
is not defined, then A is assigned the tiny value. ANSYS uses two types of parameters: scalar and array
parameters. A scalar parameter is similar to a FORTRAN variable. Character strings (up to eight
characters long) can be assigned to parameters by simply enclosing the string in single quotes. APDL also
provides several types of array parameters: numeric, character, string and table (a special numeric type
that automatically interpolates values). You can use a parameter (instead of a literal number or character
string) as an argument to any ANSYS command; the parameter is evaluated and its current value is used
for that argument. Note that parameter names are limited to 8 characters. Names beginning with numbers
are not allowed, nor are special characters that could otherwise be construed as operators.
Interactively, parameters can be defined and modified through the Parameters submenu in the Utility
menu. Unlike Pro/E and other CAD packages, changes in parameters are not automatically reflected in
the geometry. Thus, using parameters from the GUI is not as useful as it could be. The real power of
parameters is seen when they are used to define the geometry within a batch file.
The following two subsections give the batch commands that allow solving the above structural and
thermal problem in batch mode.
5.2 Batch files for the static structural problem
This file shows how to a static analysis in batch mode.
!Jobname to use for all subsequent files EXX=2.0E11 ! Young's modulus
/FILNAME, b2dstr PR=0.3 ! Poisson's ratio
/TITLE, Static structural analysis WIDTH=0.02 ! Width of the plate
/UNITS, SI ! The SI system of units is used HEIGHT=0.02 ! Height of the plate
HALFW=WIDTH/2. ! Half width of the plate
/PREP7 !Enter Preprocessor HALFH=HEIGHT/2. ! Half height of the plate
! Define parameters for future use RADIUS=0.002 ! Radius of the inner hole
EPS=1.e-6
12
ANSYS HE
! Build the model (Bottom up) TYPE,1 ! Mesh using PLANE82 elements
!Create keypoints for the rectangular plate MSHAPE,,2D ! Use mixed quad and tri elements
K,1,-1*HALFW,-1*HALFH MSHKEY,0 !Use free mesh
K,2,HALFW,-1*HALFH SAVE ! Save database before meshing
K,3,HALFW,HALFH ASEL,ALL
K,4,-1*HALFW,HALFH AMESH,ALL
!Create key points for the central hole /TITLE,Meshed plate w/ hole
K,5,0,0 EPLOT
K,6,0,-1*RADIUS FINISH !Exit from preprocessor
K,7,RADIUS,0
K,8,0,RADIUS ! Enter solution: apply loads and obtain the solution
K,9,-1*RADIUS,0 /SOLU
ANTYPE, STATIC ! Static analysis (default)
!Create lines as sides of the rectangle /TITLE, Plane stress
L,1,2 !Line #1
L,2,3 !Line #2 ! Fix all nodes on the top side
L,3,4 !Line #3 ALLSEL
L,4,1 !Line #4 LSEL,ALL
LSEL,S,LOC,Y,HALFH-EPS,HALFH+EPS
!Create the inner circular arc NSLL,,1 ! Nodes on this line
LARC,6,7,5,RADIUS !Line #5 D,ALL,ALL ! Displacement constraints
LARC,7,8,5,RADIUS !Line #6
LARC,8,9,5,RADIUS !Line #7 ! Apply force on nodes on the bottom side
LARC,9,6,5,RADIUS !Line #8 LSEL,S,LOC,Y,-1*HALFH-EPS,-1*HALFH+EPS
NSLL,,1 ! Nodes on this line
!Create area from lines F,ALL,FY,-1000./41. ! Force boundary
AL,1,2,3,4 !Area1
AL,5,6,7,8 !Area2 SAVE ! Save database before solution
Note: All lines beginning with ! are comment lines; everything after the ! is ignored for that line. The /eof
command signals the end of input. If you would like to test just a portion of your batch file, you can do so
by placing an /eof anywhere in your batch file. To test a batch file from the GUI, simply type /input,file in
the Input window. Note that ANSYS is very picky about the filenames you choose: filenames must be
less than 9 letters.
One quick way to learn ANSYS batch commands is to check the *.log files. Whenever you start a session,
ANSYS logs all of the commands issued through the GUI or the Input window to that file. Consequently,
if you know how to do something through the GUI, after performing the operation you can check the
*.log file to find the command name and learn more about it in the Commands Manual. But beware of
cutting and pasting directly from the *.log file into your batch file! The ANSYS commands generated by
the GUI generally have special arguments to denote graphical picking with the mouse, arguments that are
not available during batch processing.
5.3 Batch files for the transient thermal problem
This file how to do a transient analysis in batch mode.
!Jobname to use for all subsequent files /UNITS,SI ! the SI system of units is used
/FILNAME, b2dthm
/TITLE,transient 2D thermal analysis ! Define parameters for future use
13
ANSYS HE
EPS=1.e-6 ASEL,ALL
KMAT=0.5 ! Thermal conductivity AMESH,ALL
CpMAT=2100. ! Specific Heat
RouMAT=1000. ! Density ALLSEL
WIDTH=0.02 ! Width of the plate LSEL,ALL
HEIGHT=0.02 ! Height of the plate CSYS,1
HALFW=WIDTH/2. ! Half width of the plate LSEL,S,LOC,X,RADIUS-EPS,RADIUS+EPS
HALFH=HEIGHT/2. ! Half height of the plate CSYS,0
RADIUS=.002 ! Radius of the inner hole !Refine the mesh around the inner circle
! Defines a array parameter LREFINE,ALL,,,2
*DIM,ResTime,ARRAY,11 /TITLE,Meshed plate w/ hole
ResTime(1)=1. EPLOT
*DO,i,2,11 FINISH !Exit from preprocessor
ResTime(i)=60.*(i-1)
*ENDDO ! Use do loop ! Enter solution: Apply loads and obtain the solution
/SOLU
/PREP7 ! Enter Preprocessor ! Set solution and output control
ET,1,Plane77 ! Eight-node quadrilateral element ANTYPE,TRANS,NEW
MP,KXX,1,KMAT ! Thermal conductivity TRNOPT,FULL
MP,C,1,CpMAT ! Specific Heat DELTIM,0.5,0.1,10
MP,DENS,1,RouMAT ! Density AUTOTS,ON
TIME,600
! Build the model (Bottom up) KBC,1
!Create keypoints for the rectangular plate OUTRES,ERASE
K,1,-1*HALFW,-1*HALFH OUTRES,NSOL,%ResTime%
K,2,HALFW,-1*HALFH TINTP,,,,1.0
K,3,HALFW,HALFH
K,4,-1*HALFW,HALFH ALLSEL
!Create keypoints for the central hole NSEL,ALL
K,5,0,0 IC,ALL,TEMP,37. !Specify IC
K,6,0,-1*RADIUS
K,7,RADIUS,0 !Adiabatic BC on the top side
K,8,0,RADIUS !Convective BC on the bottom side
K,9,-1*RADIUS,0 ALLSEL
NSEL,ALL
!Create lines as sides of the rectangle NSEL,S,LOC,Y,-1*HALFH-EPS,-1*HALFH+EPS
L,1,2 !Line #1 SF,ALL,CONV,100.,25.
L,2,3 !Line #2
L,3,4 !Line #3 !Constant heat flux on the left side
L,4,1 !Line #4 NSEL,S,LOC,X,-1*HALFW-EPS,-1*HALFW+EPS
SF,ALL,HFLUX,100.
!Create the inner circular line
LARC,6,7,5,RADIUS !Line #5 !Constant temperature on the right side
LARC,7,8,5,RADIUS !Line #6 NSEL,S,LOC,X,HALFW-EPS,HALFW+EPS
LARC,8,9,5,RADIUS !Line #7 D,ALL,TEMP,50.
LARC,9,6,5,RADIUS !Line #8
!Constant temperature on the circular side
!Create area from lines CSYS,1
AL,1,2,3,4 !Area1 NSEL,S,LOC,X,RADIUS-EPS,RADIUS+EPS
AL,5,6,7,8 !Area2 CSYS,0
D,ALL,TEMP,-196.
!Subtract circular area from the rectangular area SAVE ! Save database before solution
ASBA,1,2,,DELETE,DELETE
ALLSEL !Mesh control ALLSEL
SMRTSIZE,2 SOLVE ! Solve the problem
TYPE,1 ! Mesh using PLANE82 elements FINISH
MSHAPE,0,2D ! Use mixed quad and tri option /EOF
MSHKEY,0 ! Free mesh /EXIT,ALL
SAVE ! Save database before meshing
14
ANSYS HE
5.4 Optimization
ANSYS has strong built-in optimization capabilities. However, to use the optimization function, you must
build your model parametrically using ANSYS APDL language. This is probably one of the most
important reasons why many ANSYS advanced users favor batch mode analysis.
As any optimization procedure, you need define optimization variables (design variable in ANSYS),
constraints (in the form of state variable in ANSYS, state variable is a function of design variables) and
objective function. You can define multiple design variable and state variable, but only one objective
function. Usually, you need to make use of the postprocessor to help you define the state variable and
objective function.
Lets look at an example to learn the basic optimization analysis. For example, we want to find the
optimal radius of the central hole in the above static structural problem to minimize the von Mises
equivalent stress at the hole edge. We will assume the radius varies between 1mm and 1mm. We start the
optimization from 6mm. The batch commands used to define the parameters, build the model and solve
the problem will be very similar to those given in section 5.2 with only one change. This change is that
the element size will be specified as 0.5mm on the circular side instead of 10 divisions on each line.
Below are the additional new batch commands for the optimization analysis:
/OPT !Enter optimization
! Define the element size on the hole edge as 0.5mm !Define design variable varying from 1mm to 9mm
LSEL,S,LINE,,5,8,1 OPVAR,RADIUS,DV,0.001,0.009
LESIZE,ALL,0.0005 !Define objective function to minimize
OPVAR,EQVMAX,OBJ
!Review the results OPTYPE,FIRST
/POST1 OPFRST,100,50,0.1
SET,1 ! Reads load step 1 results OPLOOP,PREP
ALLSEL OPPRNT,FULL
NSEL,ALL
CSYS,1 OPEXE !Execute optimization
NSEL,S,LOC,X,RDIUS-EPS,RADIUS+EPS FINISH
CSYS,0
NSORT,S,EQV /EOF
*GET,EQVMAX,SORT,,MAX ! Get maximum stress /EXIT,ALL
FINISH
In the output file, you can find the value of each of the optimization variables and the objective function
at the end of each iteration. Users can track the change of design variable, state variable and objective
function with respect to the iteration using appropriate commands or menu system (see ANSYS help for
more information). Finally, ANSYS will return the optimal values of the design variables which you can
see under the Parameters menu in the Utility menu. For the plate example,
RADIUS (DV) 0.13943E-02
EQVMAX (OBJ) 0.13799E+06
As with any optimization, the results are not guaranteed to be the global optimum. Furthermore, the
optimum found by the search may be different depending on the starting point (initial values of the
optimization variables) that you choose. Optimization is not an easy job.
6. More on ANSYS Analysis
6.1 Mapped mesh
In general, ANSYS has two methods of meshing: free meshing and mapped meshing. We have been
using free mesh exclusively for the above example problems. Free meshing is easy but for complex
geometries can lead to distorted elements that undermine accuracy. Free meshing is available for 2D
quadrilateral and triangular element shapes. However, free meshing can only produce 3D tetrahedral
elements for solid models. In mapped meshing, users specify the meshing pattern. Therefore, users have
more control on the final mesh. However, mapped meshing requires the 2D and 3D solid model following
several specified patterns:
15
ANSYS HE
2D The area must be bounded by either three or four lines (with or without concatenation). The area must
have equal numbers of element divisions specified on opposite sides, or have divisions matching one
of the transition mesh patterns (see ANSYS Help for more information). If the area is bounded by
three lines, the number of element divisions must be even and equal on all sides.
3D The volume must take the shape of a brick (bounded by six areas), wedge or prism (five areas), or
tetrahedron (four areas). The volume must have equal numbers of element divisions specified on
opposite sides, or have divisions matching one of the transition mesh patterns for hexahedral meshes
(see ANSYS help for examples of element divisions that will produce a mapped mesh for different
volume shapes). The number of element divisions on triangular areas must be even if the volume is a
prism or tetrahedron.
Therefore, for a complex solid model, users need to split areas or volumes in their solid model in certain
ways to make the mapped mesh applicable. Below is a batch file that draws the same plate with a hole.
The plate is split into two areas to make mapped meshing applicable for this model.
Fig. 9 shows the generated mapped mesh. You can see the mesh is well patterned for in entire domain.
16
ANSYS HE
A B
Fig. 10 Generating 3D volume with (A) or without finite element mesh from 2D area
17
ANSYS HE
Now, lets generate a 3D shaft structure using ANSYS APDL language. Before we create the shaft, we
need to do the following from the Utility menu:
File> Clear & Start New, click OK in the popup window
Input from the Input window the following commands:
/FILNAME,shaft L,6,1
/Prep7 LARC,5,6,7,0.001
ET,1,Plane82
ET,2,Solid186 AL,1,2,3,4,5,6
MP,EX,1,2.e11
MP,PRXY,1,0.3 ALLSEL
LSEL,ALL
K,1,-0.015,0.008 LESIZE,ALL,0.0005
K,2,-0.015,0 TYPE,1
K,3,0.015,0 MSHAPE,0,2D
K,4,0.015,0.005 MSHKEY,0
K,5,-0.005,0.005 ASEL,ALL
K,6,-0.006,0.006 AMESH,ALL
K,7,-0.005,0.006 TYPE,2
EXTOPT,ON
L,1,2 EXTOPT,ESIZE,10
L,2,3 VROTAT,1,,,,,,2,3,270
L,3,4 EPLOT
L,4,5 FINISH
This batch files tells ANSYS to generate a 2D first, mesh the 2D area, then generate the 3D shaft with
mesh by rotating the 2D meshed area along one of its sides. The created shaft with mesh should looks like
Fig. 11 depending on the view angle you choose. Please see ANSYS help system for more useful tools for
solid modeling and meshing.
18
ANSYS HE
19