Professional Documents
Culture Documents
Week26 Parametric Studies
Week26 Parametric Studies
1. Introduction It is often desired to solve a Finite Element Model with varying parameters to look at the sensitivity of some results quantity to these parameters. There are many ways to do this in ANSYS. The method illustrated in the attached input file uses an array to store the various values of the parameter in the first column. We then loop through each of the 3 values in the array using a *do command. For each value in the array, the FEM is solved. The largest nd maximum principal stress is stored in the 2 column of the array. A contour plot of maximum principal stress is made with the parameter value echoed as a label on the plot. The plot is stored as a jpeg picture file. This is repeated for each of the 3 values of the parameter. Finally, a summary text file is written and echoed to the screen with the parameter listed with the resulting maximum principal stress. This technique can be extended to multiple parameters by using an array with more columns. This technique can automate an analysis, and yield high productivity gains.
2. Details For this example we have a block with a hole in it. We vary the size of the hole 3 times. Each of the significant parts of the input file will be discussed below; In the below set of commands we set the size of the block, the location of the hole, and we dimension the array holdrad with the *dim command. This is a 3 row by 2-column array. We store in column 1 the hole radius, and later we will store in column 2 the largest maximum principal stress.
!DIMENSIONS OF THE BLOCK *SET,blkw,1 *SET,blkh,.5 *SET,blkt,.1 !LOCATION OF THE CYLINDER (HOLE) *SET,cylx,.5 *SET,cyly,.25 !RADII OF THE CYLINDER .05,.08,.15 *dim,holrad,array,3,2,1 holrad(1,1)=.05 holrad(2,1)=.08 holrad(3,1)=.15
Now we tell ANSYS we will loop through all of the commands between the *do and the *endo, 3 times. The parameter count is used as an index for use in the array as discussed blow. The *if command is used to tell ANSYS that if this is not the first time through the macro, then clear the mesh and delete the volume. The parameter of the hole radius is then stored in cylrad from the value in the array holrad from column 1 and row set to the value of count. The block and cylinder are then created using the parameters, and the cylinder is subtracted from block making the hole.
5962 La Place Court Suite 100 Carlsbad, CA 90008 760.431.4815 FAX 760.431.4824 http://www.csi-ansys.com
After we solve the model, we create a label using the /anum, /tspec, and /tlab command. The label is used to display the cylinder radius used for that particular run. Notice how we can substitute a parameter into the label by enclosing the array parameter inside parentheses as shown.
/post1 /ANUM ,0, 1,-0.59026 ,-0.86359 /TSPEC, 15, 1.200, 1, 0, 0 /TLAB,-0.947,-0.864,Cylinder Radius =%holrad(count,1)%
The maximum principal stress is contoured to the screen, the graphics are then re-directed to a jpeg file stored in the working directory, the stresses are plotted to the file, the file is closed, and the graphics are re-directed to the terminal. Note: each jpeg file is named the jobnamexxx.jpeg where xxx is an integer starting with 000.
plnsol,s,1 /show,jpeg plnsol,s,1 /show,close /show,term
The stress results are sorted by principal stress, and the largest principal stress is stored in the parameter maxs1 using the *get command. That value is then stored in our array holrad in column 2 and row determined by the value of our counter count. The *endo marks the end of the *do loop.
NSORT,S,1 *GET,maxs1,SORT, ,MAX holrad(count,2)=maxs1 *enddo
Lastly, we open a file called holrad.txt using the *cfopen command. When then write to the file using the *vwrite. The first *vwrite is issued w/o any parameters, and just labels on the subsequent line. The labels are similar to fortran. The 4x says to put 4 spaces between the st label Radius and Stress. The second *vwrite writes out the 1 column of holrad which is the nd hole radius and the 2 column of holrad which is the stress. Finally we echo this summary file to the screen using the *uilist command.
*CFOPEN,holrad,txt,
5962 La Place Court Suite 100 Carlsbad, CA 90008 760.431.4815 FAX 760.431.4824 http://www.csi-ansys.com
3. Conclusions/Recommendations By include a couple of commands into an ANSYS batch file, one can easily automate an analysis to analyze multiple configurations and permutations. In the example illustrated above we vary just one geometric variable, the hole radius. There is little limit to the number of parameters that can be included. Additionally, the parameter(s) being varied can be geometric values, material properties, etc.
5962 La Place Court Suite 100 Carlsbad, CA 90008 760.431.4815 FAX 760.431.4824 http://www.csi-ansys.com
5962 La Place Court Suite 100 Carlsbad, CA 90008 760.431.4815 FAX 760.431.4824 http://www.csi-ansys.com
Corrections, comments, and suggestions are welcome and can be sent to [email protected] [they will be distributed to the appropriate person(s)]. While CSI engineers base their TOTW on technical support calls and user questions, ideas on future topics are appreciated. Users who wish to submit their own TOTW are encouraged to do so by emailing the above address for more information.
CSI believes strongly in the value of training and mentoring to help make customers successful using ANSYS. Training classes are usually 2-3 days in duration and provide instruction on various topics, including structural nonlinearities, heat transfer, and dynamics. Mentoring sessions involve working with a CSI engineer one-on-one on specific projects. These sessions help reinforce applicable subject matter covered in training classes or help ensure that the customer is using ANSYS most efficiently and effectively. Training class schedules are posted at: http://www.csi-ansys.com/training.htm Please contact your account manager for more details on training, mentoring, consulting, and other CSI services.
5962 La Place Court Suite 100 Carlsbad, CA 90008 760.431.4815 FAX 760.431.4824 http://www.csi-ansys.com