# OS-T: 2090 Extrusion Constraints

In this tutorial you will use the extrusion constraints method to perform an optimization problem with extrusion constraints to obtain a constant cross section along a given path, particularly in the case of parts manufactured through an extrusion process.

Before you begin, copy the file(s) used in this tutorial to your working directory.

By using extrusion manufacturing constraints in topology optimization, constant cross-section designs can be obtained for solid models, regardless of the initial mesh, boundary conditions, or loads.

This tutorial show the steps involved in defining topology optimization over a curved beam, simulating a rail, over which a vehicle is moving. Both ends of the beam are supported. A point load is applied over the length of the rail in seven independent load cases, simulating the movement of the vehicle. The rail should be manufactured through extrusion. The steps taken to define the topology design space, the extrusion-manufacturing constraints and the optimization parameters (responses, objective and constraints) using HyperMesh are shown.

The DTPL (Design Variable for Topology Optimization) card is used for this optimization.

In this tutorial, you will perform topology optimization on a curved beam so that the extruded rail will be stiffer and have less material.

The optimization problem is stated as:
Objective
Minimize weighted compliance.
Constraints
Volume fraction < 0.3
Design Variables
The density of each element in the design space.

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

## Import the Model

1. Click File > Import > Solver Deck.
An Import tab is added to your tab menu.
2. For the File type, select OptiStruct.
3. Select the Files icon .
A Select OptiStruct file browser opens.
4. Select the rail_complete.fem file you saved to your working directory.
5. Click Open.
6. Click Import, then click Close to close the Import tab.

## Set Up the Optimization

### Create Topology Design Variables

In this step you will create the topology design space definition, design_solid. All elements organized in this design property collector will be included in the design space.

1. From the Analysis page, click optimization.
2. Click topology.
3. Select the create subpanel.
4. In the desvar= field, enter design_solid.
5. Set type: to PSOLID.
6. Using the props selector, select new_solid.
7. Click create.

### Define Extrusion Problem and Extrusion Path

1. Display the numbers for nodes 71559 and 70001 in the modeling window.
1. From the Display toolbar, click to open the Numbers panel.
2. Click nodes > by id, then enter 71559,70001 in the id= field.
3. Select display.
4. Click on.
5. Click return.
2. Define extrusion path.
1. In the topology subpanel, select the extrusion subpanel.
2. Double-click desvar = and select design_solid.
3. Switch from none to no twist.
Extrusion constraints can be applied to domains characterized by non-twisted cross-sections or twisted cross-sections by using the NOTWIST or TWIST parameters, respectively.
4. Click node list > by path, then select node 71559 first and node 70001 second.
5. Click update.

A line of nodes starting from 71559 and ending with node 70001 should be highlighted, indicating the extrusion path.

It is not required to select as many nodes to define the curve. This is an exercise to show that the nodes by path option can also be used.

It is necessary to define a 'discrete' extrusion path by entering a series of grids.

The curve between these grids is then interpolated using parametric splines. The minimum amount of grids depends on the complexity of the extrusion path. Only two grids are required for a linear path, but it is recommended that at least 5-10 grids be used for more complex curves.
3. Click return to go back to the Optimization panel.

### Create Optimization Responses

1. From the Analysis page, click optimization.
2. Click Responses.
3. Create the volume fraction response.
1. In the responses= field, enter Volfrac.
2. Below response type, select volumefrac.
3. Set regional selection to total and no regionid.
4. Click create.
4. Create the weighted component response.
1. In the responses= field, enter wcomp1.
2. Below response type, select weighted comp.
3. Click loadsteps, then select all loadsteps.
4. Click return.
5. Click create.
5. Click return to go back to the Optimization panel.

### Create Design Constraints

1. Click the dconstraints panel.
2. In the constraint= field, enter constr1.
3. Click response = and select Volfrac.
4. Check the box next to upper bound, then enter 0.3.
5. Click create.
6. 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 wcomp1.
4. Click create.
5. 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 rail_complete_extrusion 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. Toggle memory options to upper limit in Mb and enter 2000.
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 rail_complete_extrusion.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 Results

### Load Results File and Post-Process

1. From the OptiStruct panel, click HyperView.
2. In the Results Browser, select the last iteration listed.
Iteration 0 is selected by default, which shows your results at the beginning of the optimization. The last iteration shows the final analysis results for this optimization.
3. From the Results toolbar, click to open the Iso Value panel.
4. Set the Result type: to Element Densities.
5. Click Apply.
6. In the Current value field, enter 0.3.
7. Click Apply.
The result with manufacturing extrusion constraints permits a constant cross section for the entire length of the model.

### View a Section Cut of the Extrusion Component

In the Section Cut panel you can cut planar sections through a model. This is useful when you want to see details inside of a model.
1. On the Display toolbar, click to open the Section Cut panel.
2. Click Add to create a new section cut.
3. Set Define plane to Y Axis.
4. Using the Base selector, click on any corner at the center of the model.
5. Click Apply.
6. Move the slider under Define plane to scroll though the model.
7. Under Display options, use the slider bar next to Width to change the width of the cross section.
The result with manufacturing extrusion constraints shows constant cross section through the length of the model.