# OS-T: 3000 Topography Optimization of a Plate Under Torsion

In this tutorial you will perform a topography optimization of a plate under torsion.

You will use a finite element model of the design space with loads and constraints in this tutorial. It is assumed that the part is to be formed using a stamping process. The objective is to minimize the displacement of the node where the force is applied in the positive z-direction. Only the shape of the plate can be changed to achieve the objective, not the thickness.

A finite element model is loaded into HyperMesh. The constraints, load, material properties, and subcase (loadstep) of the model are already defined. Topography design variables and optimization parameters are defined and the OptiStruct software determines the optimal reinforcement patterns. The results are viewed as animations of the contours of shape changes of the design space. Finally, the use of the grouping patterns is shown; based on the shape changes suggested by OptiStruct, a possible pattern is chosen for ease of manufacturing.

The optimization problem for this tutorial is stated as:
Objective
Minimize nodal displacement at grid point where loading is applied.
Design Variables
Shape variables generated automatically on the designable space aligned with the elements normal.

## 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 torsion_plate.hm file you saved to your working directory from the optistruct.zip file. Refer to Access the Model Files.
3. Click Open.
The torsion_plate.hm database is loaded into the current HyperMesh session, replacing any existing data.

## Verify the Thickness of the Component

1. In the Model Browser, Properties folder, click design.
The design property opens in the Entity Editor, which displays information regarding shell thicknesses on the PSHELL card.
2. Verify that the thickness, T, is set to 1.0.

## Set Up the Optimization

### Define Topography Design Variables

For a topography optimization, a design space and a bead definition need to be defined.

1. From the Analysis page, click the optimization panel.
2. Click the topography panel.
3. Create a topography design space definition.
1. Select the create subpanel.
2. In the desvar= field, enter topo.
3. Using the props selector, select design.
4. Click create.
A topography design space definition, topo, has been created. All elements organized into the design component collector(s) are now included in the design space.
4. Create a bead definition for the design space topo.
1. Select the bead params subpanel.
2. Verify the desvar = field is set to topo, which is the name of the newly created design space.
3. In the minimum width= field, enter 5.0.
This parameter controls the width of the beads in the model. The recommended value is between 1.5 and 2.5 times the average element width.
4. In the draw angle= field, enter 60.0 (this is the default).
This parameter controls the angle of the sides of the beads. The recommended value is between 60 and 75 degrees.
5. In the draw height=, enter 4.0.
This parameter sets the maximum height of the beads to be drawn.
6. Select buffer zone.
This parameter establishes a buffer zone between elements in the design domain and elements outside the design domain.
7. Toggle draw direction to normal to elements.
This parameter defines the direction in which the shape variables are created.
This tells OptiStruct to leave nodes at which loads or constraints are applied out of the design space.
9. Click update.

A bead definition has been created for the design space topo. Based on this information, OptiStruct will automatically generate bead variable definitions throughout the design variable domain.

5. Update the bounds of the design variable.
1. Select the bounds subpanel.
2. Verify the desvar = field is set to topo, which is the name of the design space.
3. In the Upper Bound= field, enter 1.0.
Upper bound on variables controlling grid movement (Real > LB, default = 1.0). This sets the upper bound on grid movement equal to UB*HGT.
4. In the Lower Bound= field, enter 0.0.
5. Click update.
The upper bound sets the upper bound on grid movement equal to UB*HGT and the lower bound sets the lower bound on grid movement equal to LB*HGT.
6. Click return to go to the Optimization panel.

### Create Optimization Responses

1. From the Analysis page, click optimization.
2. Click Responses.
3. Create the displacement response.
1. In the response= field, enter displace.
2. Below response type, select static displacement.
3. Click nodes > by id, then enter 2500 in the id= field.
4. Set the displacement type to dof3.
dof1, dof2, dof3
Translation in the X, Y, and Z directions.
dof4, dof5, dof6
Rotation about the X, Y, and Z axes.
total disp
Resultant of the translational displacements in x, y, and z directions.
total rotation
Resultant of the rotational displacements in x, y, and z directions.
5. Click create.
4. Click return to go back to the Optimization panel.

### Define the Objective Function

1. Click the objective panel.
2. Verify that min is selected.
3. Click response and select displace.
4. Using the loadsteps selector, select torsion.
5. Click create.
6. Click return twice to exit the Optimization panel.

## 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 torsion_plate 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 torsion_plate.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:
torsion_plate.hgdata
HyperGraph file containing data for the objective function, percent constraint violations, and constraint for each iteration.
torsion_plate.hist
The OptiStruct iteration history file containing the iteration history of the objective function and of the most violated constraint. Can be used for a xy plot of the iteration history.
torsion_plate.html
HTML report of the optimization, giving a summary of the problem formulation and the results from the final iteration.
torsion_plate.oss
OSSmooth file with a default density threshold of 0.3. You may edit the parameters in the file to obtain the desired results.
torsion_plate.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 torsion_plate.fem file.
torsion_plate.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.
torsion_plate.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.
torsion_plate_des.h3d
HyperView binary results file that contain optimization results.
torsion_plate_s#.h3d
HyperView binary results file that contains from linear static analysis, and so on.
torsion_plate.grid
An OptiStruct file where the perturbed grid data is written.

## View the Results

Shape contour information is output from OptiStruct for all iterations. In addition, Displacement and Stress results are output for the first and last iteration by default. This section describes how to view those results using HyperView.

### View a Static Plot of Shape Contours

1. From the OptiStruct panel, click HyperView.
HyperView launches within the HyperMesh Desktop and loads the torsion_plate_des.h3d and torsion_plate_s1.h3d files reading the model and optimization results.
2. On the Results toolbar, click to open the Contour panel.
3. Set Result type to Shape Change (v) and Mag.
4. On the Animation toolbar, click to choose the last iteration from the Simulation list.
A deformed plate appears.
5. Click Apply.

Is the max= field showing 4.0e + 00?

In this case, it is. If it is not, your optimization has not progressed far enough. Decrease the OBJTOL parameter (set in the opti control panel on the optimization panel). This value, 4.0e+00, comes from the draw height defined earlier.

### View a Transient Animation of the Shape Contour Changes

A transient animation of contour shapes will give a good idea of the shape changes happening through different iteration.
1. From the Animation toolbar, set the animation mode to (Transient).
2. Click to start the animation.
3. Click to open the Animation Controls panel.
4. With the animation running, use the slider bar, below Max Frame Rate, to adjust the speed of the animation.
5. Click to pause the animation.

### View the Deformed Structure

The displacement and stress results from the first and last iterations (default) are given in the torsion_plate_s1.h3d file.

1. In the top, right of the application, click to go to the next page.
This page has the subcase information from the torsion_plate_s1.h3d file.
2. On the Animation toolbar, set the animation mode to Linear Static.
Tip: For a better visual of what it happening with this model, turn on mesh lines and contour the results.
3. On the Results toolbar, click to open the Deformed panel.
4. Set the Result type to Displacement(v).
5. In the Results Browser, select the first iteration (Iteration 0).
6. On the Animation toolbar, set the animation mode to (Linear Static).
7. Click to start the animation.
8. Click to go to the Animation Controls panel.
9. With the animation running, use the slider bar, below Max Frame Rate, to adjust the speed of the animation.

A deformation animation of the original model is shown.

Does the deformed shape look correct for the boundary conditions you applied to the mesh?

10. Click to stop the animation.
11. On the Page Controls toolbar, click to delete the HyperView page.

## Add Pattern Grouping Constraints

Pattern grouping will be added as a constraint for manufacturability.

The configuration obtained in the previous example (see the contour plot showing the reinforcement pattern at the 17th iteration) might be difficult to manufacture. It does give an idea of what kinds of patterns are likely to optimize the structure (in this case -- to minimize the displacement at the selected node).

A possible pattern, suggested by the static contour plot obtained in the previous exercise, is to use channels parallel to a diagonal. In this example, you choose the diagonal emerging from the node where the load is applied.

1. In HyperMesh, click return to exit the OptiStruct panel.
2. From the Analysis page, click the optimization panel.
3. Click the topography panel.
4. Select the pattern grouping subpanel.
5. Click desvar = and select topo.
6. Set the pattern type to linear.
7. Set the sub-type to basic.
8. Select nodes.
1. Using the anchor node selector, select the node at the corner where the load is applied.
HyperMesh automatically moves the blue halo around the first node.
2. Using the first node selector, select the node in the opposite corner.
9. Click update.
10. Click return twice to go to the main menu.

## 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 torsion_pattern 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 torsion_pattern.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.

View the new results as before. Also check the objective value for the zero-th and last iteration in the .out file. How does the final value for the objective compare to the final value obtained using 'none' option for pattern grouping?

## View a Static Plot of Shape Contours

Repeat the steps in the previous steps to view the contour plot of the shape change.