CHAPTER 6 ANSYS Implementation Written by Changhyun, SON Chapter 6. ANSYS Implementation - 1 Main Steps Begins with building a parametric model and creating the analysis file. Initial Design Explore the Design Domain Parametric Modeling & Loading Solution Parametric Results Written by Changhyun, SON Analysis File Optimize the Design Chapter 6. ANSYS Implementation - 2 Analysis File To optimize a design, an analysis file must be available. The analysis file contains input for the parametric model: Initial parameter values Model geometry and meshing Boundary Results conditions, loads, and solution review and retrieval Written by Changhyun, SON Chapter 6. ANSYS Implementation - 3 Procedure Four main steps (assuming that the analysis file is available): 1 1. Identify the analysis file 2. Identify optimization variables - DVs, SVs, and objective function 2 3 3. Run the optimization 4. Review results 4 These steps correspond to the menus in Main Menu > Design Opt as shown on the right. Written by Changhyun, SON Chapter 6. ANSYS Implementation - 4 Example - Problem Definitions We will use the rotating disk example to illustrate each step: A high-speed rotating disk made of steel is to be designed for nearly uniform stress distribution at an operating speed of 15,000 rpm. Properties: E = 30E6 psi, r = 7.2E-4 lb-s2/in4, n = 0.3 1.6 qhub ymid qrim 0.5 xmid 4.0R 0.6 0.4 10.0R Written by Changhyun, SON Chapter 6. ANSYS Implementation - 5 Example - Limitations The von Mises stress should not exceed 25,000 psi The disk’s lowest natural frequency should be 1000 Hz or greater. The hub and the rim are of fixed dimensions, but you are allowed to modify the shape in between. Written by Changhyun, SON Chapter 6. ANSYS Implementation - 6 Optimizing the Design - Procedure Identify the Analysis File Identify the analysis file Identify optimization variables Run the optimization Review results Recall that the analysis file contains the input required for one complete loop of the optimization run: Parametric modeling and loading Solution Parametric Written by Changhyun, SON results Chapter 6. ANSYS Implementation - 7 Optimizing the Design - Procedure Identify the Analysis File To identify the analysis file, simply choose the file name from the Assign Analysis File dialog: Design Or Opt > -Analysis File- Assign… use the OPANL command Written by Changhyun, SON Chapter 6. ANSYS Implementation - 8 Optimizing the Design - Procedure Identify Optimization Variables Identify the analysis file Identify optimization variables Run the optimization Review results This step involves choosing the appropriate parameters and designating them as: Design State variables variables Objective Written by Changhyun, SON function Chapter 6. ANSYS Implementation - 9 Optimizing the Design - Procedure Identify Optimization Variables Design Variables (DVs) Design characteristics that are allowed to change in order to minimize the volume (or whatever the objective function is). For the rotating disk example, the DVs are THETAHUB, 30°~ 90° THETARIM, 45°~ 135° XMID, 0.5 ~ 4.5 in YMID, 0.25 ~ 1.5 in qhub ymid qrim xmid Written by Changhyun, SON Chapter 6. ANSYS Implementation - 10 Optimizing the Design - Procedure Identify Optimization Variables To identify DVs, Design Opt > Design Variables… > Add… Or use the OPVAR command: OPVAR,name,DV,min,max,toler Written by Changhyun, SON Chapter 6. ANSYS Implementation - 11 Optimizing the Design - Procedure Identify Optimization Variables Maximum value (MAX) is required and must be > 0.0. Minimum value (MIN), if specified, must be > 0.0. If not specified, MIN defaults to 0.001*MAX. Tolerance (TOLER) is the acceptable change in the DV between loops for convergence. Has same units as the DV and is not a percentage or a fraction. Default = 0.01*current value. For example, if THETAHUB = 54.2° in loop 6 and 55.0° in loop 7, convergence based on DVs has not occurred since |54.2-55.0| = 0.8, which is > 0.55. (But convergence may have occurred based on the objective function… more on this later.) Written by Changhyun, SON Chapter 6. ANSYS Implementation - 12 Optimizing the Design - Procedure Identify Optimization Variables You can define up to 60 DVs, but we recommend using no more than 10~20 DVs. The more DVs, the higher the chance of converging to a local minimum. DVs are restricted to positive values. Since most DVs are geometric parameters such as thickness and radius, this restriction does not generally pose a problem. Written by Changhyun, SON Chapter 6. ANSYS Implementation - 13 Optimizing the Design - Procedure Identify Optimization Variables State Variables (SVs) Constraints placed on the design, such as a maximum stress or deflection. For the rotating disk example, SVs are: Maximum First Written by Changhyun, SON hoop stress 25000 psi natural frequency 1000 Hz Chapter 6. ANSYS Implementation - 14 Optimizing the Design - Procedure Identify Optimization Variables To identify SVs, Design Opt > State Variables… > Add… Or use the OPVAR command: OPVAR,name,SV,min,max,toler Written by Changhyun, SON Chapter 6. ANSYS Implementation - 15 Optimizing the Design - Procedure Identify Optimization Variables SVs can be one-sided or two-sided. One-sided: only MIN or only MAX specified Two-sided: both MIN and MAX specified. TOLER is the feasibility tolerance… how far the design can go beyond MAX and MIN before it is considered infeasible. Has same units as the SV and is not a percentage or a fraction. Default = 0.01*(MAX-MIN). For example, if the disk’s first natural frequency is FREQ1 = 991.3 Hz, the design is still feasible since the actual threshold is 1000(0.01*1000) = 990 Hz. MIN Infeasible toler Written by Changhyun, SON MAX Feasible Region toler Infeasible Chapter 6. ANSYS Implementation - 16 Optimizing the Design - Procedure Identify Optimization Variables State variables are not required for optimization, but they are usually specified since most designs need to be constrained in some fashion. You can define up to 100 SVs. Written by Changhyun, SON Chapter 6. ANSYS Implementation - 17 Optimizing the Design - Procedure Identify Optimization Variables Objective Function (OBJ) The parameter that is minimized by the optimizer. Examples are volume, weight, and the temperature at a location. For the rotating disk example, the objective is to minimize the variation in stress. Hence the OBJ is the standard deviation of the von Mises stress, SDEV. Written by Changhyun, SON Chapter 6. ANSYS Implementation - 18 Optimizing the Design - Procedure Identify Optimization Variables To identify the objective function, Design Opt > Objective… Or use the OPVAR command: OPVAR,name,OBJ,,,toler Written by Changhyun, SON Chapter 6. ANSYS Implementation - 19 Optimizing the Design - Procedure Identify Optimization Variables Tolerance (TOLER) is the acceptable change in the OBJ between loops for convergence. Has same units as the OBJ and is not a percentage or a fraction. Default = 0.01*current value. For example, if the standard deviation SDEV = 3900 in loop 7 and 3850 in loop 6, convergence based on OBJ has not occurred since |3900-3850| = 50, which is > 39.0. (But convergence may have occurred based on DVs… more on this later.) Written by Changhyun, SON Chapter 6. ANSYS Implementation - 20 Optimizing the Design - Procedure Identify Optimization Variables You can specify only one OBJ. ANSYS always minimizes the OBJ. If you want to maximize something, say the parameter y, specify 1/y or A-y as the OBJ (where A >> y). We recommend that the OBJ remain positive. Add a constant value to the parameter if needed to ensure this. Written by Changhyun, SON Chapter 6. ANSYS Implementation - 21 Optimizing the Design - Procedure Run the optimization Identify the analysis file Identify optimization variables Run the optimization Review results This step involves: A. Specifying run-time controls B. Choosing the optimization method C. Saving the optimization database D. Initiating the optimization run Written by Changhyun, SON Chapter 6. ANSYS Implementation - 22 Optimizing the Design - Procedure Run the optimization A. Run-Time Controls These include: Optimization database file name (OPDATA). Default: jobname.opt. Controls on how to read the analysis file (OPLOOP). Default: read from the first line, ignore DV parameter definitions. Printout controls (OPPRNT). Default: suppress printout. Save-best-design Written by Changhyun, SON option (OPKEEP). Default: OFF. Chapter 6. ANSYS Implementation - 23 Optimizing the Design - Procedure Run the optimization Most controls are best left to default values except perhaps the save-best-design option. This option saves the best design to date as it occurs: model results geometry, mesh, loading, etc. on jobname.bdb on jobname.brst. Written by Changhyun, SON Chapter 6. ANSYS Implementation - 24 Optimizing the Design - Procedure Run the optimization Design Opt > Controls... Written by Changhyun, SON Chapter 6. ANSYS Implementation - 25 Optimizing the Design - Procedure Run the optimization Notes on the Save-Best-Design Option The best database is saved by a SAVE operation to the file jobname.bdb. The best results file is saved by simply copying the results file jobname.rst to jobname.brst (or .rth to .brth, .rmg to .brmg, .rfl to .brfl). If multiple analyses are done, such as thermal followed by stress, only the last results file is copied. Consider using the /ASSIGN function ( Utility Menu > File > ANSYS File Options… ) if you want a different results file to be copied. Written by Changhyun, SON Chapter 6. ANSYS Implementation - 26 Optimizing the Design - Procedure Run the optimization B. Optimization Method Two optimization methods are available in ANSYS: Sub-problem First-order approximation method method The sub-problem approximation method is generally recommended for most applications because of its generality of approach and speed of execution. Details of when to choose the first-order method will be presented later. Written by Changhyun, SON Chapter 6. ANSYS Implementation - 27 Optimizing the Design - Procedure Run the optimization Use the OPTYPE and OPSUBP commands. Or Design Opt > Method/Tool… Choosing a method brings up a second dialog box with additional options. These options (discussed later) are best left to default values. Written by Changhyun, SON Chapter 6. ANSYS Implementation - 28 Optimizing the Design - Procedure Run the optimization C. Save the Optimization Database The optimizer works with its own database, which consists of: DV, SV, and OBJ specifications. Analysis file name, optimization method and controls, total number of iterations completed to date, etc. Parameter values for each design generated to date. At the end of each iteration, ANSYS automatically saves this information on the OPT database file specified in the Run-Time Controls dialog (which defaults to jobname.opt). Written by Changhyun, SON Chapter 6. ANSYS Implementation - 29 Optimizing the Design - Procedure Run the optimization You can check the OPT database status at any time using: Design Opt > -Opt Database- Status Or the STATUS command Written by Changhyun, SON Chapter 6. ANSYS Implementation - 30 Optimizing the Design - Procedure Run the optimization Saving the OPT database before initiating the optimization run allows you to resume from this point conveniently if needed. Use the OPSAVE command. Or Design Opt > -Opt Database- Save... Choose a name different from the default (since the default file gets updated each iteration). Example: jobname.opt0. Written by Changhyun, SON Chapter 6. ANSYS Implementation - 31 Optimizing the Design - Procedure Run the optimization D. Initiate the Optimization Run Use the OPEXE command. Or Design Opt > Run… Check the settings, then press OK to start the optimization. Written by Changhyun, SON Chapter 6. ANSYS Implementation - 32 Optimizing the Design - Procedure Run the optimization The optimizer will then loop through the analysis file multiple times with new DV values each time until the design has converged or until the maximum number of iterations is reached. Written by Changhyun, SON Chapter 6. ANSYS Implementation - 33 Optimizing the Design - Procedure Run the optimization What is convergence? A design has converged to a possible optimum if it is feasible and if one of the following four conditions is true: 1. The change in objective function between the current design and the best feasible design is less than the tolerance. |OBJcurrent - OBJbest| < TOLERobj 2. The change in objective function between the current and previous designs is less than the tolerance. |OBJcurrent - OBJcurrent-1| < TOLERobj Written by Changhyun, SON Chapter 6. ANSYS Implementation - 34 Optimizing the Design - Procedure Run the optimization 3. For each DV, the change between the current design and the best feasible design is less than its tolerance. |DVcurrent - DVbest| < TOLERdv for all DVs 4. For each DV, the change between the current and previous designs is less than its tolerance. |DVcurrent - DVcurrent-1| < TOLERdv for all DVs Again, if one of these four conditions is true and if the current design is feasible, we have a converged or optimum design. Written by Changhyun, SON Chapter 6. ANSYS Implementation - 35 Optimizing the Design - Procedure Run the optimization The ANSYS Output window (or output file if batch) shows the basis for convergence. For the rotating disk example, design no. 9 (also called set 9) converged based on OBJ comparison to the best design (set 3). And set 9 is considered the “optimum” design since it has a lower OBJ value than set 3. Written by Changhyun, SON Chapter 6. ANSYS Implementation - 36 Optimizing the Design - Procedure Run the optimization Does convergence indicate an optimum design? Not necessarily. It simply indicates that the current design is feasible and meets one of the four convergence criteria. It is up to you, the engineer, to determine whether the design is indeed optimum. One way to do this is by continuing (restarting) the optimization with different tolerance values or with a different set of designs. More on restarts later. Written by Changhyun, SON Chapter 6. ANSYS Implementation - 37 Optimizing the Design - Procedure Run the optimization The output window also lists a design sensitivity summary table, which can be used as a guide to determine which DV has the most (or least) effect on design parameters. For the rotating disk example, notice that a unit change in YMID has a large effect on the maximum stress. The design is also sensitive to changes in XMID. Written by Changhyun, SON Chapter 6. ANSYS Implementation - 38 Optimizing the Design - Procedure Review the Results Identify the analysis file Identify optimization variables Run the optimization Review results You can review optimization results by: first restoring the OPT database (if needed) listing design sets creating graphs restoring the geometry and results for the best design Written by Changhyun, SON Chapter 6. ANSYS Implementation - 39 Optimizing the Design - Procedure Review the Results Restoring the OPT Database This step is needed only if you exited ANSYS after the optimization run. Use the OPRESU command. Or Design Opt > -Opt Database- Resume… File name defaults to the OPT database file name specified in the Run-Time Controls dialog (which in turn defaults to jobname.OPT). Written by Changhyun, SON Chapter 6. ANSYS Implementation - 40 Optimizing the Design - Procedure Review the Results Listing Design Sets Allows you to review parameter values for a desired design or a range of designs. You can choose to list optimization parameters only or all parameters. Use the OPLIST command. Or Design Opt > -Design Sets- List… Written by Changhyun, SON Chapter 6. ANSYS Implementation - 41 Optimizing the Design - Procedure Review the Results Note that the listing indicates whether a design is feasible or infeasible and also the reason for infeasibility. For the rotating disk example: The initial design is infeasible because SMAX is out of range. The two feasible designs are also the best designs. Written by Changhyun, SON Chapter 6. ANSYS Implementation - 42 Optimizing the Design - Procedure Review the Results Written by Changhyun, SON Chapter 6. ANSYS Implementation - 43 Optimizing the Design - Procedure Review the Results Creating Graphs Use the PLVAROPT command. Or Design Opt > Graphs/Tables… You can graph optimization variables versus set number (default) or versus other optimization variables. Written by Changhyun, SON Chapter 6. ANSYS Implementation - 44 Optimizing the Design - Procedure Review the Results This is a graph of objective function SDEV vs. set number. PLVAROPT,SDEV Written by Changhyun, SON Chapter 6. ANSYS Implementation - 45 Optimizing the Design - Procedure Review the Results State variable FREQ1 vs. set number. PLVAROPT,FREQ1 Written by Changhyun, SON Chapter 6. ANSYS Implementation - 46 Optimizing the Design - Procedure Review the Results SMAX (maximum von Mises stress) vs. set number. PLVAROPT,SMAX Written by Changhyun, SON Chapter 6. ANSYS Implementation - 47 Optimizing the Design - Procedure Review the Results Working with Graphs Many graph controls are available to alter the way the graph shows on the screen: Axis controls: change the axis label, number of divisions, range of values, etc. Curve Grid controls: thickness of curve, filling of area under curve, etc. controls: grid on/off; X-grid only, Y-grid only, or both; etc. Utility Menu : PlotCtrls > Style > Graphs Written by Changhyun, SON Chapter 6. ANSYS Implementation - 48 Optimizing the Design - Procedure Review the Results As an example, we will change the previous graph as follows: Set Y-axis label to SMAX Change number of X-axis divisions to 8 (9 sets, therefore 8 divisions) Increase curve thickness Written by Changhyun, SON Chapter 6. ANSYS Implementation - 49 Optimizing the Design - Procedure Review the Results Utility Menu : PlotCtrls > Style > Graphs > Modify Axes ... Written by Changhyun, SON Utility Menu : PlotCtrls > Style > Graphs > Modify Curve ... Chapter 6. ANSYS Implementation - 50 Optimizing the Design - Procedure Review the Results Written by Changhyun, SON Chapter 6. ANSYS Implementation - 51 Optimizing the Design - Procedure Review the Results Restoring the Best Design Geometry and Results To do this, simply exit the optimizer and resume the file jobname.bdb (best db). Main Menu > Finish Utility Menu > File > Resume from… Utility Menu > Plot > Elements Or issue these commands: FINISH RESUME, jobname,bdb EPLOT Written by Changhyun, SON Chapter 6. ANSYS Implementation - 52 Optimizing the Design - Procedure Review the Results Results are available on the file jobname.brst. Enter POST1 and specify jobname.brst as the results file (using the FILE command or Main Menu : General Postproc > Data & File Opts… ). Then use standard POST1 functions to review results. Note: .bdb and .brst are written only if you activate the savebest-design option in the Optimization Controls dialog. Written by Changhyun, SON Chapter 6. ANSYS Implementation - 53 Optimizing the Design - Procedure Review the Results Written by Changhyun, SON Chapter 6. ANSYS Implementation - 54 Optimizing the Design - Procedure Review the Results Written by Changhyun, SON Chapter 6. ANSYS Implementation - 55 Optimizing the Design Procedure Identify the analysis file Identify optimization variables Run the optimization Review results Next we will briefly discuss how to work with the optimization database and continue (restart) the optimization if needed. Written by Changhyun, SON Chapter 6. ANSYS Implementation - 56 Optimizing the Design C. Restarts A restart is a continuation of a previous optimization run. Its purpose is usually one or both of the following: to further hone in on the optimum by changing tolerances and/or DV limits to force a different optimization “path” by starting from a different set of designs OBJ OBJ Current optimum Current optimum Possible new optimum DV Written by Changhyun, SON Possible new optimum DV Chapter 6. ANSYS Implementation - 57 Optimizing the Design Restarts A typical restart involves four steps: 1. First save the current OPT database to a named file 2. Select a subset of design sets if needed 3. Modify optimization variables (tolerances and limits) 4. Run the optimization Written by Changhyun, SON Chapter 6. ANSYS Implementation - 58 Optimizing the Design Restarts 1. Save the Current OPT Database This allows you to restore it later if needed. Design Be Opt > -Opt Database- Save… (or OPSAVE) sure to specify a non-default file name Written by Changhyun, SON Chapter 6. ANSYS Implementation - 59 Optimizing the Design Restarts 2. Select a Subset of Design Sets Design Opt > -Design Sets- Select/Delete… (or OPSEL and OPDELE) Allows you to keep a desired set of designs (such as all feasibles) and discard the rest. Caution: Selecting a subset actually removes the unselected design sets from the database. (That’s why the first step is to save the OPT database!) Written by Changhyun, SON Chapter 6. ANSYS Implementation - 60 Optimizing the Design Restarts For the rotating disk example, selecting all feasible sets discards seven design sets and keeps two. Use the List function to list all currently selected design sets. Design Opt > -Design Sets- List… > All Sets Notice that the original set numbers are retained. That is, deleted set numbers are not reused. Written by Changhyun, SON Chapter 6. ANSYS Implementation - 61 Optimizing the Design Restarts 3. Modify Optimization Variables You can modify tolerances, change limits, and even delete a DV or SV for the restart. Modifying Tolerances For DVs and OBJ, allows you to change the convergence basis. For example, tightening the OBJ tolerance may “force” convergence based on DV tolerances. For SVs, allows you to increase or decrease the feasibility threshold. Written by Changhyun, SON Chapter 6. ANSYS Implementation - 62 Optimizing the Design Restarts For the rotating disk, we will tighten the OBJ tolerance (SDEV) to 0.5. Design Opt > Objective… > Modify Written by Changhyun, SON Chapter 6. ANSYS Implementation - 63 Optimizing the Design Restarts Changing Limits Allows you to constrain or expand the design domain. Design Opt > Design Variables… > Edit… Design Opt > State Variables… > Edit… For the rotating disk, we will change DV limits as follows: – THETARIM: 45°-90° – XMID: 2.0-3.0 in Written by Changhyun, SON Chapter 6. ANSYS Implementation - 64 Optimizing the Design Restarts Written by Changhyun, SON Chapter 6. ANSYS Implementation - 65 Optimizing the Design Restarts 4. Run the optimization First save the new settings to a named file: Design Written by Changhyun, SON Opt > -Opt Database- Save… Chapter 6. ANSYS Implementation - 66 Optimizing the Design Restarts Then initiate the optimization run. The new run will most likely converge to a different design. Again, it is up to you, the engineer, to verify the validity of the optimum design. Design Opt > Run… Written by Changhyun, SON Chapter 6. ANSYS Implementation - 67 Optimizing the Design Restarts The rotating disk example took 12 iterations to converge based on DV tolerances. The best design is set 21. Written by Changhyun, SON Chapter 6. ANSYS Implementation - 68 Optimizing the Design Restarts Compared to the previous best design (set 9, which is now infeasible because of the new DV limits), the new best design (set 21) has a lower OBJ. Written by Changhyun, SON Chapter 6. ANSYS Implementation - 69 Optimizing the Design Restarts Written by Changhyun, SON Chapter 6. ANSYS Implementation - 70