Optimizing the Design, II Chapter Five
Training Manual January 30, 2001 Inventory # Module 5 Optimizing the Design, II In this section, we will learn more about optimizing the design. Topics covered: A. The two methods of design optimization and how they work B. Guidelines on choosing design variables, state variables, and the objective function C. Work on one or two workshop exercises
Training Manual January 30, 2001 Inventory # Optimizing the Design, II A. Design Optimization Methods ANSYS provides two methods, or algorithms, to optimize the design: –Subproblem approximation method –First order method A third method, user optimization, allows you incorporate your own optimization algorithm. Refer to your ANSYS Guide to User Programmable Features for details.
Training Manual January 30, 2001 Inventory # Optimizing the Design, II...Design Optimization Methods Sub-problem Approximation Method A zero-order method that requires only the values of the response variables (SVs and OBJ), not their derivatives. Forms an approximation of the response variables. –The objective function approximation is used to locate the minimum. –State variable approximations are used to constrain the design. –After the approximations are used to locate the OBJ minimum in design space, the actual OBJ and SV values are evaluated at that location. The approximations are used only to determine the next set of design variables to be tried.
Training Manual January 30, 2001 Inventory # Optimizing the Design, II - Methods...Subproblem Approximation Method –A least squares fit of all available design sets is used to form the approximations: H = approximation of objective function or state variable X n = design variable n a, b, c = coefficients N = total number of design variables
Training Manual January 30, 2001 Inventory # Optimizing the Design, II - Methods...Subproblem Approximation Method –You can control the form of the approximation using OPEQN (or Design Opt > Method/Tool > Sub-problem ): Quadratic + cross terms (default for OBJs) Quadratic only (default for SVs) Linear fit Linear Quadratic Quadratic + cross terms
Training Manual January 30, 2001 Inventory # Optimizing the Design, II - Methods...Subproblem Approximation Method Initially, N+2 design sets are needed to form the approximations (N=number of DV’s). –ANSYS will either generate random designs or use existing designs in the optimization database. –You can improve the quality of the approximations by supplying known “good” designs. Tip: Start with the Random or Single Loop tool (or any other tool) to generate several designs, then keep only the feasible ones or a certain number of best designs.
Training Manual January 30, 2001 Inventory # Optimizing the Design, II - Methods...Subproblem Approximation Method Subproblem approximation method is recommended for most applications because: –it uses a generalized approach. –it can usually arrive at an optimum quickly.
Training Manual January 30, 2001 Inventory # Optimizing the Design, II - Methods...Subproblem Approximation Method N+2 Design Sets? Generate a random DV set Run the analysis file Form new objective function and SV approximations Apply penalty functions to enforce DV and SV limits Locate the minimum of the penalized objective function Compute a new set of DV’s Run the analysis file No Yes Converged? Or terminate? Sto p Yes No Run...
Training Manual January 30, 2001 Inventory # Optimizing the Design, II - Methods First Order Method First Order Method Uses derivatives of the response variables - OBJ and SV’s - to determine search direction and arrive at an optimum. No approximations are used, so the method is more accurate. Each iteration may involve several analyses (loops through the analysis file) to determine the proper search direction.
Training Manual January 30, 2001 Inventory # Optimizing the Design, II - Methods...First Order Method To choose the first order method, –Design Opt > Method/Tool... –Or use OPTYPE and OPFRST: optype,first opfrst,nitr,size,delta –Default values for SIZE and DELTA are normally sufficient.
Training Manual January 30, 2001 Inventory # Optimizing the Design, II - Methods...First Order Method Convergence is said to be achieved when both these conditions are met: –Change in objective function between the current design and the best feasible design is less than the tolerance. |OBJ current - OBJ best | < TOLER obj AND –Change in objective function between the current and previous designs is less than the tolerance. |OBJ current - OBJ current-1 | < TOLER obj
Training Manual January 30, 2001 Inventory # Optimizing the Design, II - Methods...First Order Method Another requirement for convergence is that the final iteration must use a steepest descent search. Otherwise, additional iterations are performed.
Training Manual January 30, 2001 Inventory # Optimizing the Design, II - Methods...First Order Method When should you use the first order method? –When accuracy is important. –When the subproblem method is imprecise. First order method is not recommended when speed is essential.
Training Manual January 30, 2001 Inventory # Optimizing the Design, II - Methods...First Order Method At least one design set? Apply penalty functions to enforce DV and SV limits Find the minimum of the penalized objective function using the gradient of the Compute a new set of DV’s Run the analysis file No Yes Sto p Yes No Run... Sto p Converged? Or terminate?
Training Manual January 30, 2001 Inventory # Optimizing the Design, II - Methods Penalty Functions Both methods use penalty functions to enforce DV and SV limits while using an unconstrained objective function. MinMax DV constraint Objective Function Penalized Objective Function (unconstrained) Obj DV
Training Manual January 30, 2001 Inventory # Optimizing the Design, II - Methods Example Determine the optimum spring constants, K1 and K2, to minimize displacement under a unit sinusoidal loading. Combined stiffness of springs must be less than 1 lb/in. 1.0sin( t) 1 inch square aluminum bar 20 inches long K1K2
Training Manual January 30, 2001 Inventory # Optimizing the Design, II - Methods...Example ! Parametric model k1=2 k2=2 ustatic=.25/k1+.25/k2 /title, Two Spring Bar Suspension /prep7 et,1,3! 2-D beam element r,1,1,1/12,1! 1-in square c.s. mp,ex,1,1e7 mp,dens,1, n,1 n,5,20! 20 inches long fill e,1,2 *repeat,4,1,1 n,11! Coincident nodes at ends n,12,20 et,2,14,,2! Spring element r,2,k1,.01! k1 and light damping r,3,k2,.01! k2 and light damping type,2 real,2 e,11,1! k1 element real,3 e,12,5! k2 element d,11,uy d,12,uy d,1,ux finish ! Modal analysis /solu antype,modal modopt,lanb,2 solve *get,f1,mode,1,freq *get,f2,mode,2,freq finish ! Harmonic analysis /solu antype,harm harfrq,f1-(f2-f1),f2 f,2,fy,1 nsubst,2 solve finish
Training Manual January 30, 2001 Inventory # Optimizing the Design, II - Methods...Example ! Postprocessing - find peak disp. /post26 nsol,2,2,u,y prvar,2 *get,f1r,vari,2,rset,1 *get,f1i,vari,2,iset,1 *get,f2r,vari,2,rset,2 *get,f2i,vari,2,iset,2 f1a=sqrt(f1r**2+f1i**2) f2a=sqrt(f2r**2+f2i**2) uy2max = f1a > f2a ! Max is greater of two peak amplitudes finish /opt opvar,k1,dv,.1,4! DV's opvar,k2,dv,.1,4 opvar,ustatic,sv,1! SV opvar,uy2max,obj! Obj optype,subp! Subproblem method opexe! solve oplist,all opsel,1 ! select best Subproblem set optype,first! First order method opexe oplist,all finish
Training Manual January 30, 2001 Inventory # Optimizing the Design, II - Methods...Example Results of subproblem method: SET 1 SET 2 SET 3 SET 4 (INFEASIBLE) (INFEASIBLE) (INFEASIBLE) (INFEASIBLE) USTATIC (SV) > > > > K1 (DV) K2 (DV) UY2MAX (OBJ) SET 5 SET 6 SET 7 SET 8 (INFEASIBLE) (INFEASIBLE) (INFEASIBLE) (FEASIBLE) USTATIC (SV) > > > K1 (DV) K2 (DV) UY2MAX (OBJ) SET 9 SET 10 SET 11 SET 12 (INFEASIBLE) (INFEASIBLE) (FEASIBLE) (FEASIBLE) USTATIC (SV) > > K1 (DV) K2 (DV) UY2MAX (OBJ) SET 13 SET 14 *SET 15* (INFEASIBLE) (INFEASIBLE) (FEASIBLE) USTATIC (SV) > > K1 (DV) K2 (DV) UY2MAX (OBJ)
Training Manual January 30, 2001 Inventory # Optimizing the Design, II - Methods...Example Results of first order method (starting from initial design): SET 1 SET 2 SET 3 SET 4 (INFEASIBLE) (FEASIBLE) (FEASIBLE) (FEASIBLE) USTATIC (SV) > K1 (DV) K2 (DV) UY2MAX (OBJ) SET 5 SET 6 SET 7 SET 8 *SET 9* (FEASIBLE) (FEASIBLE) (FEASIBLE) (FEASIBLE) (FEASIBLE) USTATIC (SV) K1 (DV) K2 (DV) UY2MAX (OBJ) Results of first order method (starting from best subproblem set): SET 15 SET 16 SET 17 *SET 18* (FEASIBLE) (FEASIBLE) (FEASIBLE) (FEASIBLE) USTATIC (SV) K1 (DV) K2 (DV) UY2MAX (OBJ)
Training Manual January 30, 2001 Inventory # Optimizing the Design, II B. Guidelines We will present: General guidelines Guidelines for DVs Guidelines for SVs Guidelines for OBJ
Training Manual January 30, 2001 Inventory # Optimizing the Design, II - Guidelines General Guidelines Wherever possible, take advantage of symmetry. Remember that the optimizer performs multiple analyses, so the smaller the model size, the better. Avoid specifying density if it is not needed for the analysis. You will save the time needed to calculate the mass matrix.
Training Manual January 30, 2001 Inventory # Optimizing the Design, II - Guidelines...General Guidelines Make sure that the parametric model is valid for all possible values of the DVs. A sweep run with two sweeps per DV (minimum and maximum) may be a good idea. Save the optimization database to a “safe” file name at the end of each run. Keeping these databases will give you a wide array of potential designs that might come in handy some day.
Training Manual January 30, 2001 Inventory # Optimizing the Design, II - Guidelines...General Guidelines Sometimes an optimization problem may converge to a local minimum. You can check for this and possibly arrive at a global minimum by first using the Sweep tool (or some other tool) and choosing the proper starting design(s). See the sine wave example in your Workshop Supplement. OBJ DV Local minimumGlobal minimum
Training Manual January 30, 2001 Inventory # Optimizing the Design, II - Guidelines Guidelines for DVs Guidelines for Design Variables Keep the number of design variables to a minimum: more than 20 is not recommended; fewer than 10 is preferred. One way is to eliminate some DVs by expressing them in terms of others. For example, eliminate R3 below by expressing it in terms of R1 and T1. Similarly R4. R1 R2 R4 R3 T1 T2
Training Manual January 30, 2001 Inventory # Optimizing the Design, II - Guidelines...Guidelines for DVs Choose DVs that permit several design configurations, but be aware of unrealistic or undesirable designs. Consider, for example, the weight optimization of a cantilever beam. One DV, x 1, will work, but it doesn’t permit a tapered or curved design. x1x1
Training Manual January 30, 2001 Inventory # Optimizing the Design, II - Guidelines...Guidelines for DVs Choosing 4 DVs x 1 -x 4 gives more flexibility… … but also allows local minima (unless otherwise constrained). x1x1 x2x2 x3x3 x4x4 x1x1 x2x2 x3x3 x4x4
Training Manual January 30, 2001 Inventory # Optimizing the Design, II - Guidelines...Guidelines for DVs A better idea might be to choose height increments as DVs: x1x1 dx 2 dx 3 dx 4
Training Manual January 30, 2001 Inventory # Optimizing the Design, II - Guidelines...Guidelines for DVs To specify discrete DVs, such as number of ribs or holes, use the NINT (nearest integer) function when building the model. For example, if NRIBS represents the number of ribs, use NINT(NRIBS) to make copies of one rib, then declare NRIBS as a DV with the appropriate limits.
Training Manual January 30, 2001 Inventory # Optimizing the Design, II - Guidelines...Guidelines for DVs OR, you may need to use an if-then-else construct. For example, if shell thickness thk is a DV and only three possible thicknesses were allowed … et,1,63! Shell element type *if,thk,lt,2.5/16,then thk=1/8! Use 1/8 if thk < 2.5/16 *elseif,thk,gt,3.5/16,then thk=1/4! Use 1/4 if thk > 3.5/16 *else thk=3/16! Otherwise use 3/16 *endif r,1,thk! Define shell thickness
Training Manual January 30, 2001 Inventory # Optimizing the Design, II - Guidelines Guidelines for SVs Guidelines for State Variables Be sure to use the correct data. For example: –If a minimum first natural frequency is a state variable, be sure to retrieve the first non-zero frequency. The first frequency may be a rigid body mode. –If the structure deflects in the -Y direction, and maximum Y deflection is a state variable, retrieve the maximum of absolute values or the minimum of real values.
Training Manual January 30, 2001 Inventory # Optimizing the Design, II - Guidelines...Guidelines for SVs Typical state variables such as maximum stress (or deflection or temperature or...) may occur at a different location in each loop. –In such cases, do not choose just one maximum (or minimum) for the entire structure. Doing so may result in poor quality approximations. –On the other hand, choosing a maximum in every element may result in a local minimum. –A compromise is to select a few key regions in which maximum stresses will be used as state variables.
Training Manual January 30, 2001 Inventory # H2 H1 A1 A2 A3 SMX1SMX2SMX3SMX4 Optimizing the Design, II - Guidelines...Guidelines for SVs For example, the maximum stress in each “bay” of the truss bridge below will give better results than just one maximum stress for the entire structure.
Training Manual January 30, 2001 Inventory # Optimizing the Design, II - Guidelines...Guidelines for SVs If singularities exist, such as a point load or a re-entrant corner, the maximum stress will always be at that location. Consider unselecting such regions before retrieving the maximum stress.
Training Manual January 30, 2001 Inventory # Optimizing the Design, II - Guidelines...Guidelines for SVs Avoid tight bounds on two-sided state variables, especially when using the Subproblem method. For example, a state variable limit of 500 to 1000 is better than 990 to To apply an equality constraint, such as first natural frequency = 256 Hz, use the bracketing technique: –Define freqA as an SV with upper limit of 257 Hz –Define freqB as an SV with lower limit of 255 Hz Both freqA and freqB represent the first natural frequency, but their limits bracket the desired value. You may need to increase the number of successive infeasible designs in this case since a frequency value 257 will make the design infeasible.
Training Manual January 30, 2001 Inventory # Optimizing the Design, II - Guidelines...Guidelines for SVs Example: A cantilever beam to be tuned to 100 Hz natural frequency. ! Tune Cantilever Beam Frequency to 100 Hz. a=1 c=a**2-4*a+10 ! Arbitrary /prep7 et,1,3 r,1,1,a! Moment of Inertia is the DV mp,dens,1,.00025! Aluminum mp,ex,1,1e7 n,1 n,11,200 fill e,1,2 d,1,all finish /solu antyp,modal modop,lanb,1 mxpand,1 solve *get,b,mode,1,freq finish /opt opvar,a,dv,.01,10 opvar,b,sv,99.9,100.0 ! Equality constraint opvar,c,obj, optype,Subp opexe oplist,all finish
Training Manual January 30, 2001 Inventory # SET 1 SET 2 SET 3 SET 4 (INFEASIBLE) (INFEASIBLE) (INFEASIBLE) (INFEASIBLE) B (SV) > > > > A (DV) E-01 C (OBJ) SET 5 SET 6 SET 7 SET 8 (INFEASIBLE) (INFEASIBLE) (INFEASIBLE) (INFEASIBLE) B (SV) > > > > A (DV) E C (OBJ) SET 9 SET 10 (INFEASIBLE) (INFEASIBLE) B (SV) > > A (DV) C (OBJ) Optimizing the Design, II - Guidelines...Guidelines for SVs Results: The subproblem method slowly converges to a feasible solution...
Training Manual January 30, 2001 Inventory # Optimizing the Design, II - Guidelines...Guidelines for SVs … whereas the first-order method finds feasible space almost immediately. SET 1 SET 2 SET 3 (INFEASIBLE) (FEASIBLE) (FEASIBLE) B (SV) > A (DV) C (OBJ)
Training Manual January 30, 2001 Inventory # Optimizing the Design, II - Guidelines...Guidelines for SVs If too many infeasible designs are occurring, it is probably because a state variable approximation does not adequately represent the actual SV function. Adding cross terms to the SV approximation (OPEQN) may overcome this problem. Or you may need to use the first order method.
Training Manual January 30, 2001 Inventory # Optimizing the Design, II - Guidelines Guidelines for OBJ Guidelines for the Objective Function Remember that ANSYS always minimizes the objective function. To maximize an item, such as heat flow rate Q, specify 1/Q or CC-Q as the objective function (where CC is a constant larger than the highest expected value of Q). The OBJ should remain positive. Add a positive constant if needed to ensure this.
Training Manual January 30, 2001 Inventory # Optimizing the Design, II C. Workshop This workshop consists of the following problem: –You are given an analysis file for the weight optimization of a ribbed tray. Specify the opt variables and review results. See your Design Optimization Workshop Supplement for details.