# OS-T: 4010 Size Optimization of a Welded Bracket

In this tutorial you will perform a size optimization on a welded bracket modeled with shell elements.

A structural model with loads and constraints is used in this tutorial. The objective is to minimize the amount of material used in the model subject to certain stress specifications. The gauge changes of the bracket are linked to each other so that the gauge is identical for both sides at the optimal design.

You will load the structural model into HyperMesh. The constraints, loads, material properties, and subcases (loadsteps) are already defined in the model. Size design variables and optimization parameters are defined and the OptiStruct software determines the optimal gauges. The results are then reviewed in HyperMesh.

The optimization problem is stated as:
Objective
Minimize volume.
Constraints
Maximum von Mises Stress of the brackets < 100 Mpa.
Design Variables
Gauges of the brackets.

## Launch HyperMesh and Set the OptiStruct User Profile

1. Launch HyperMesh.
The User Profile dialog opens.
2. Select OptiStruct and click OK.
This loads the user profile. It includes the appropriate template, macro menu, and import reader, paring down the functionality of HyperMesh to what is relevant for generating models for OptiStruct.

## Open the Model

1. Click File > Open > Model.
2. Select the bracket_size.hm file you saved to your working directory from the optistruct.zip file. Refer to Access the Model Files.
3. Click Open.
The bracket_size.hm database is loaded into the current HyperMesh session, replacing any existing data.

## Set Up the Optimization

### Create Size Design Variables

1. From the Analysis page, click the optimization panel.
2. Click the size panel.
3. Select the desvar subpanel.
4. Create the design variable, part1.
1. In the desvar = field, enter part1.
2. In the initial value = field, enter 2.5.
3. In the lower bound = field, enter 1.0.
4. In the upper bound = field, enter 2.5.
5. Set the move limit toggle to move limit default.
6. Set the discrete design variable (ddval) toggle to no ddval.
7. Click create.
5. Create the design variable, part2.
1. In the desvar = field, enter part2.
2. In the initial value = field, enter 2.5.
3. In the lower bound = field, enter 1.0.
4. In the upper bound = field, enter 2.5.
5. Set the move limit toggle to move limit default.
6. Set the discrete design variable (ddval) toggle to no ddval.
7. Click create.
6. Select the generic relationship subpanel.
7. Create a design variable property relationship, part1_th.
1. In the name = field, enter part1_th.
2. Using the prop selector, select part1.
3. Under the props selector, select Thickness T.
4. Click designvars.
5. Select part1.
Note: The linear factor is automatically set to 1.000.
6. Click return.
7. Click create.
A design variable property relationship, part1_th, has been created relating the design variable part1 to the thickness entry on the PSHELL card for the property part1.
8. Create a design variable property relationship, part2_th.
1. In the name = field, enter part2_th.
2. Using the prop selector, select part2.
3. Under the props selector, select Thickness T.
4. Click designvars.
5. Select part2.
6. Click return.
7. Click create.
A design variable property relationship, part2_th, has been created relating the design variable part2 to the thickness entry on the PSHELL card for the property part2.

### Create Optimization Responses

1. From the Analysis page, click optimization.
2. Click Responses.
3. Create the volume response, which defines the volume fraction of the design space.
1. In the responses= field, enter volume.
2. Below response type, select volume.
3. Set regional selection to total and no regionid.
4. Click create.
4. Create a static stress response.
1. In the response= field, enter stress1.
2. Set the response type to static stress.
3. Using the props selector, select part1.
4. Set the response selector to von mises.
5. Under von mises, select both surfaces.
6. Click create.
5. Create another static stress response named stress2, which is defined for the von Mises stress of the elements in the component part2.

### Create Constraints

A response defined as the objective cannot be constrained. In this case, you cannot constrain the response volume.

Upper bound constraints are to be defined for the responses stress1 and stress2.

1. Click the dconstraints subpanel.
2. Define a constraint on the response stress1.
1. In the constraints= field, enter stress1.
2. Check the box next to upper bound, then enter 100.
3. Click response = and select stress1.
4. Using the loadsteps selector, select STEP.
5. Click create.
The constraint is an upper bound with a value of 100. The constraint applies to the subcase STEP.
3. Define a constraint on the response stress2.
1. In the constraints= field, enter stress2.
2. Check the box next to upper bound, then enter 100.
3. Click response = and select stress2.
4. Using the loadsteps selector, select STEP.
5. Click create.
The constraint is an upper bound with a value of 100. The constraint applies to the subcase STEP.

### Define the Objective Function

1. Click the objective panel.
2. Verify that min is selected.
3. Click response and select volume.
4. Click create.
5. Click return twice to exit the Optimization panel.

## Save the Database

1. From the menu bar, click File > Save As > Model.
2. In the Save As dialog, enter bracket_size.hm for the file name and save it to your working directory.

## Run the Optimization

1. From the Analysis page, click OptiStruct.
2. Click save as.
3. In the Save As dialog, specify location to write the OptiStruct model file and enter bracket_size for filename.
For OptiStruct input decks, .fem is the recommended extension.
4. Click Save.
The input file field displays the filename and location specified in the Save As dialog.
5. Set the export options toggle to all.
6. Set the run options toggle to optimization.
7. Set the memory options toggle to memory default.
8. Click OptiStruct to run the optimization.
The following message appears in the window at the completion of the job:
OPTIMIZATION HAS CONVERGED.
FEASIBLE DESIGN (ALL CONSTRAINTS SATISFIED).
OptiStruct also reports error messages if any exist. The file bracket_size.out can be opened in a text editor to find details regarding any errors. This file is written to the same directory as the .fem file.
9. Click Close.
The default files that get written to your run directory include:
bracket_size.hgdata
HyperGraph file containing data for the objective function, percent constraint violations, and constraint for each iteration.
bracket_size.prop
OptiStruct property output file containing all updated property data from the last iteration for size optimization.
bracket_size.hist_dat
OptiStruct iteration history file, containing the iteration history of the objective function and of the most violated constraint. Can be used for an xy plot of the iteration history.
bracket_size.html
HTML report of the optimization, giving a summary of the problem formulation and the results from the final iteration.
bracket_size.out
OptiStruct output file containing specific information on the file setup, the setup of the optimization problem, estimates for the amount of RAM and disk space required for the run, information for all optimization iterations, and compute time information. Review this file for warnings and errors that are flagged from processing the bracket_size.fem file.
bracket_size.sh
Shape file for the final iteration. It contains the material density, void size parameters and void orientation angle for each element in the analysis. This file may be used to restart a run.
bracket_size.stat
Contains information about the CPU time used for the complete run and also the break-up of the CPU time for reading the input deck, assembly, analysis, convergence, and so on.
bracket_size.h3d
HyperView binary results file.

## View the Results

Size optimization results from OptiStruct are given in two places. The bracket_size.out file contains gauge and volume information for all iterations. The bracket_size.h3d file contains the element thickness for all five iterations and Displacement and Stress results for the linear static analysis for iteration 0 and iteration 3. In this step you will review all results. The results contained in the HyperMesh binary results file will be examined first. The gauge history in the bracket_size.out file will then be reviewed.

### View the Stress Results

After the size optimization, the stress value should be reviewed to make sure the stress constraints are not violated.
1. From the OptiStruct panel, click HyperView.
HyperView launches within the HyperMesh Desktop and loads the result files. All of the .h3d files get loaded into a different page in HyperView. The files bracket_size_des.h3d and bracket_size_s1.h3d get loaded in page 2 and page 3, respectively.
2. In the top, right of the application, click to proceed to the next page.
The third page has the results loaded from the bracket_size_s1.h3d file. The name of the page is displayed as Subcase 1 - STEP to indicate that the results correspond to subcase 1.
3. On the Results toolbar, click to open the Contour panel.
4. Set the Result type to Element Stresses [2D & 3D] (t) and vonMises.
5. Set the Averaging method to None.
6. Click Apply.
A contoured image representing von Mises stresses should be visible. Each element in the model is assigned a legend color, indicating the von Mises stress value for that element resulting from the applied loads and boundary conditions. If you did not change the Iteration step, you should contour the stress of the initial step. To contour the final step, set the last iteration of that loadcase using the Model Browser.
7. In the Results Browser, select the last iteration from the simulation list.
Only two iterations are displayed; the First and Last (FL) is the default setting for optimization runs. To change this setting, add an OUTPUT control card with a frequency setting of ALL.
This will now contour your final iteration of that loadcase. Review the stress to see that it is under the proper constraints.

### View the Thickness Results

1. In the top, right of the application, click to go back to the previous page.
2. Set the Result type to Element Thicknesses (s).
3. In the Results Browser, select Iteration 2 from the Load Case and Simulation Selection.
4. Click Apply.
Alternatively, you can also open the bracket_size.prop file in a text editor to view the final gauge thicknesses of the two parts.

### Review the .out File

The .out file contains a summary of the optimization process. From the information in the .out file, you can see how the objective, constraints, and design variables are changing from one iteration, to the next.

Has the volume been minimized for the given constraints?

Have the stress constraints been met?

What are the resulting gauges for the two parts?

Did the design variable linking work?