# OS-T: 2070 Reduced Model using DMIG

In this tutorial an existing finite element model of a simple cantilever beam is used to demonstrate how to reduce the finite element model using static reduction. You will also perform a topology optimization on the reduced model.

The optimization problem may be stated as:
Objective
Minimize compliance.
Constraints
Upper bound constraint of 40% for the designable volume.
Design Variables
The density for each element in the design space.

The part to be reduced out of the model through the static reduction model reduction technique is referred to as a superelement. In OptiStruct, ASET or ASET1 Bulk Data Entries are required to indicate the boundary degrees of freedom of a superelement, meaning the set of degrees-of-freedom where the component (being replaced by direct matrix input) connects to the modeled structure. Both the accuracy and the cost of static reduction increase as the number of ASET entries is increased. For example, by using static reduction, the size of the matrix to solve will become smaller, but if the reduced matrix (DMIG) is very dense, then the solution time will become larger than the solution time for the full model where the matrix may be sparse. Hence, the selection of ASET entries is very important in performing an efficient analysis using DMIG.

In order to prevent the reduced matrix from being too dense, ASET entries are chosen carefully (see the next figure) instead of creating ASET entries for all of the boundary nodes between the design and non design spaces. Due to the small size of the problem used for this tutorial, the selection of ASET entries may not affect the solution time.

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

## Generate a Superelement

### Create ASETs Load Collector

1. Create a load collector.
1. In the Model Browser, right-click and select Create > Load Collector from the context menu.
A default load collector displays in the Entity Editor.
2. For Name, enter Asets.
3. Set Card Image to None.
2. Create constraints.
1. From the Analysis page, click the constraints panel.
2. Select the create subpanel.
3. Using the nodes selector, select boundary nodes.
4. Select all dofs.
Dofs with a check will be assigned to the ASET. Dofs 1, 2, and 3 are x, y, and z translation degrees of freedom. Dofs 4, 5, and 6 are x, y, and z rotational degrees of freedom.
5. Click Load Type= and select ASET.
6. Click create.
3. Click return to go to the main menu.

### Delete Elements Retained in the Subsequent Optimization

The reduced stiffness matrix and load vector will be generated for only those elements that will be reduced out (superelement). Therefore, a new model needs to be created containing just the superelement part and the loads and boundary conditions applied directly to that part.
1. Press F2 to open the Delete panel.
2. Set the entity selector to elems, then click elems > by window.
3. Draw a window around the elements indicated in Figure 5.
4. Click delete entity.
5. Click return to go to the main menu.

### Define a Parameter to Write out Reduced Matrices to an External File

The PARAM,EXTOUT Bulk Data Entry is required to activate the matrix save process.
Without this parameter, the run will proceed as normal. This parameter has two options: DMIGPCH, which will save the matrices in an ASCII format to a .pch file and DMIGBIN, which will save the matrices in a binary format to a .dmg file. DMIGPCH is used for this tutorial.
1. On the Analysis page, click the control cards panel.
2. In the Card Image dialog, click PARAM.
3. Select EXTOUT.
4. At the top of the card image, under the EXTOUT, select DMIGPCH.
5. Click return to exit PARAM.
6. Click return to get back to the main menu.

## Save the Database

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

## Submit the Job

1. From the Analysis page, click the OptiStruct panel.
2. Click save as.
3. In the Save As dialog, specify location to write the OptiStruct model file and enter cantilever_dmig 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 analysis.
7. Set the memory options toggle to memory default.
8. Click OptiStruct to launch the OptiStruct job.
If the job is successful, new results files should be in the directory where the cantilever_dmig.fem was written. The cantilever_dmig.out file is a good place to look for error messages that could help debug the input deck if any errors are present.
The default files written to the directory are:
cantilever_dmig.out
OptiStruct output file containing specific information on the file setup, the setup of your optimization problem, estimates for the amount of RAM and disk space required for the run, information for each of the optimization iterations, and compute time information. Review this file for warnings and errors.
cantilever_dmig.stat
Summary of analysis process, providing CPU information for each step during analysis process.
cantilever_dmig_AX.pch
Reduced matrices (DMIG) file.

The matrices are written to the .pch file with the same format as the DMIG Bulk Data Entry. They are defined by a single header entry and one or more column entries. By default, the name of the stiffness matrix is KAAX, the mass is MAAX, and the load is PAX. Since mass matrix is not used in this tutorial, it is not written to .pch file.

The I/O Option Entry, DMIGNAME, provides you with control over the name of the matrices.

## Clear the Database

From the menu bar, click File > New.
The existing HyperMesh database is cleared.

## Include the Superelement in the Model

### Open the Model

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

### Delete Superelement Part Reduced out using DMIG

Since the matrices for the superelement part will be replaced by DMIG, the Bulk Data Entries for the nodes and elements, as well as all loads and boundary conditions that are in the superelement, should be deleted.
1. Press F2 to open the Delete panel.
2. Set the entity selector to elems, then click elems > by window.
3. Draw a window around the elements indicated in Figure 7.
4. Click delete entity.
5. Click return to go to the main menu.

### Set up Topology Optimization with DMIG

1. On the Analysis page, click the control cards panel.
2. Define the INCLUDE_BULK control card.
1. In the Card Image dialog, click INCLUDE_BULK.
2. In the Include field, enter the file name cantilever_dmig_AX.pch.
The reduced matrices (DMIG) will be included in OptiStruct input deck. Here you are assuming that the topology optimization will be run in the same folder as the cantilever_dmig_AX.pch file. If you plan to run it in a different folder, then define the full path of this file.
3. Click return to exit the INCLUDE_BULK control card.
3. Define the K2GG control card.
1. Click K2GG.
2. In the K2GG= field, enter KAAX.
This specifies that the reduced stiffness matrix with the name KAAX has to be used (stored in the cantilever_dmig_AX.pch file).
3. Click return to exit the K2GG control card.
4. Define the P2G control card.
1. Click P2G.
2. In the P2G= field, enter PAX.
3. Click return to exit the P2G control card.
5. Click return to go to the main menu.

## Set Up the Optimization

### Create Topology Design Variables

1. From the Analysis page, click optimization.
2. Click topology.
3. Select the create subpanel.
4. In the desvar= field, enter topo.
5. Set type: to PSHELL.
6. Using the props selector, select design.
7. Click create.
8. Update the design variable's parameters.
1. Select the parameters subpanel.
2. Toggle minmemb off to mindim=, then enter 1.2.
3. Click update.
9. Click return.

### 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 compliance response.
1. In the response= field, enter Compl.
2. Below response type, select compliance.
3. Set regional selection to total and no regionid.
4. 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 VFrac.
3. Click response = and select Volfrac.
4. Check the box next to upper bound, then enter 0.4.
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 Compl.
4. Using the loadsteps selector, select step.
5. Click create.
6. 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 cantilever_opti.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 cantilever_opti 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 cantilever_opti.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:
cantilever_opti.hgdata
HyperGraph file containing data for the objective function, percent constraint violations, and constraint for each iteration.
cantilever_opti.HM.comp.tcl
HyperMesh command file used to organize elements into components based on their density result values. This file is only used with OptiStruct topology optimization runs.
cantilever_opti.HM.ent.tcl
HyperMesh command file used to organize elements into entity sets based on their density result values. This file is only used with OptiStruct topology optimization runs.
cantilever_opti.html
HTML report of the optimization, giving a summary of the problem formulation and the results from the final iteration.
cantilever_opti.oss
OSSmooth file with a default density threshold of 0.3. You may edit the parameters in the file to obtain the desired results.
cantilever_opti.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 cantilever_opti.fem file.
cantilever_opti.res
HyperMesh binary results file.
cantilever_opti.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.
cantilever_opti.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.
cantilever_opti_des.h3d
HyperView binary results file that contain optimization results.
cantilever_opti_s#.h3d
HyperView binary results file that contains from linear static analysis, and so on.

## View the Results

Element density results are output to the cantilever_opti_des.h3d file from OptiStruct for all iterations. In addition, Displacement and Stress results are output for each subcase for the first and last iterations by default into cantilever_opti_s#.h3d files, where # specifies the sub case ID.

### Review the Contour Plot of the Density Results

1. From the OptiStruct panel, click HyperView.
2. From the Results toolbar, click to open the Contour panel.
3. Set the Result type to Element Densities[s] and Density.
4. Set the Averaging method to Simple.
5. Click Apply to display the density contour.
6. On the Animation toolbar, click to choose the last iteration from the Simulation list.
The resulting contours represent the element densities field resulting from the applied loads and boundary conditions.

### View an Iso Value Plot of Element Densities

An Iso Value plot provides the information about the element density. Iso Value retains all of the elements at and above a certain density threshold. For models with solid design regions, this feature becomes a vital tool for analyzing density results.
1. From the Results toolbar, click to open the Iso Value panel.
2. Set the Result type to Element Densities.
3. Set Show values to Above.
4. Click Apply.
5. Under Clipped geometry, select Features and Transparent.
6. Change the density threshold.
• In the Current value field, enter 0.3.
• Under Current value, move the slider.
When you update the density threshold, the Iso value displayed in the modeling window updates interactively. Use this tool to get a better look at the material layout and the load paths from OptiStruct.