# OS-T: 2095 Frequency Response Optimization of a Rectangular Plate

This tutorial demonstrates the capability of frequency response optimization using OptiStruct.

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

Initially, an existing finite element (FE) model of a flat plate is retrieved and modal frequency response analysis is performed to derive the peak magnitude. A dynamic response optimization is then performed on the same plate to obtain a new design.

The new design gives an optimized material layout with a minimized peak response. Post-processing tools will be used in HyperView to visualize iso-plots, magnitude, and phase of the complex displacement results.
The optimization problem is stated as:
Objective
Minimize volume.
Constraints
Max FRF Disp. < 600 mm
Design Variables
The density for 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.
2. For the File type, select OptiStruct.
3. Select the Files icon .
A Select OptiStruct file browser opens.
4. Select the frf_response_input.fem file you saved to your working directory.
5. Click Open.
6. Click Import, then click Close to close the Import tab.

## Apply Loads and Boundary Conditions

### Create the SPC and Unit Load Collectors

The model is constrained at one edge. A unit vertical load will be applied acting upwards in the positive z-direction at a point on a free edge corner of the plate. In this step you will create the two load collectors, SPC and unit-load.
1. Create the SPC 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 SPC.
3. Click Color and select a color from the color palette.
4. Set Card Image to None.
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.
3. Click Color and select a color from the color palette.
4. Set Card Image to None.

### Create Constraints

1. From the Model Browser, Load Collectors folder, right-click on SPC and select Make Current from the context menu.
2. From the Tool page, click numbers to open the numbers panel.
3. Click nodes > by id from the extended entity selection menu.
4. Enter the following numbers: 1, 2, 3, and 4.
5. Click on.
6. Click return.
7. From the Analysis page, click the constraints panel.
8. Confirm the create subpanel is selected using the radio buttons on the left-hand side of the panel.
9. Apply constraints to the nodes with IDs 1 and 2.
1. Using the nodes selector, select the nodes with IDs 1 and 2.
2. Select dof1 - dof6.
Dofs with a check will be constrained, while dofs without a check will be free. 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.
3. Click create.
10. Apply a constraint to the node with ID 4.
1. Using the nodes selector, select the node with ID 4.
2. Uncheck all dofs, except dof3.
3. Click create.
11. Create a unit load at a point on the flat plate.
1. From the Model Browser, Load Collectors folder, right-click on unit-load and select Make Current from the context menu.
2. In the Constraints panel, use the nodes selector to select the node with ID 3.
3. Uncheck all dofs, except dof3.
4. In the dof3= field, enter 20.
5. Click load types= and select DAREA.
6. Click create.

### Create a Frequency Range Curve

1. In the Model Browser, right-click and select Create > Curves.
The Curve Editor opens.
2. For Name, enter tabled1.
3. In the table, enter:
1. In the x(1) field, enter 0.0.
2. In the y(1) field, enter 1.0.
3. In the x(2) field, enter 1000.0.
4. In the y(2) field, enter 1.0.
5. Click the X in the upper right-hand corner to exit the dialog.

This provides a frequency range of 0.0 to 1000.0 with a constant load over this range.

4. Click Color and select a color from the color palette.
5. Set Card Image to TABLED1.

### Create a Frequency Dependent Dynamic Load

1. In the Model Browser, right-click and select Create > Load Step Inputs.
3. For Config type, select Dynamic Load - Frequency dependent.
5. Define EXCITEID.
6. Define TB.
1. Click Curves.
2. In the Select Curves dialog, select tabled1 and click OK.
This defines the input as a force.

### Create a Set of Frequencies to be used in the Response Solution

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 freq5.
3. Click Color and select a color from the color palette.
4. Set Card Image to FREQi.
5. Select FREQ5.
6. In the NUMBER_OF_FREQ5= field, enter 1.
7. In the FREQ5_MAX_NUMBER_OF_FR= field, enter 3.
8. Next to Data: ID, click .
9. In the NUMBER OF FREQ = dialog, define frequencies values.
1. In the F1 field, enter 1.0.
2. In the F2 field, enter 1000.
3. In the FR(0) field, enter 1.0.
4. In the FR(1) field, enter 0.8.
5. In the FR(2) field, enter 0.2.
6. Click Close to exit the dialog.
A set of frequencies is defined for the modal method of frequency response analysis by specification of a frequency range and fractions of the natural frequencies within that range.

### Create an EIGRL Load Step Input

Create EIGRL Load Step Input to use as the modal method.

1. In the Model Browser, right-click and select Create > Load Step Inputs
2. For Name, enter eigrl.
3. For Config Type, select Real Eigen Value Extraction .
4. For Type, select EIGRL.
5. For ND, enter 17.
This specifies the eigenvalue extraction of the first 17 frequencies using the Lanczos method.

A load step is also referred to as a subcase.
1. From the Analysis page, click loadsteps.
2. For Name, enter subcase1.
3. Click type, and select Freq. resp (modal).
4. Define SPC.
1. Check the box preceding SPC.
2. Click the equal sign (=) and select spc from the load collector list.
5. Define METHOD (STRUCT).
1. Check the box preceding METHOD (STRUCT).
2. Click the equal sign (=) and select eigrl from the load step inputs list.
1. Check the box preceding DLOAD.
2. Click the equal sign (=) and select rload2 from the load step inputs list.
7. Define FREQ.
1. Check the box preceding FREQ.
2. Click the equal sign (=) and select freq5 from the load collector list.
8. Click create.
9. Click edit and define RESVEC.
1. Select RESVEC.
3. Set OPTION to YES.

An OptiStruct subcase has been created which references the constraints in the load collector, spc; the unit load in the load step input, rload2; with a set of frequencies defined in load collector, freq5 and modal method defined in the load step input, eigrl.

It is recommended to do a modal analysis before any FRF simulation. Here, this step is suppressed to focus on Frequency Response Analysis setup.

### Create a Set of Nodes for Output of Results

1. In the Model Browser, right-click and select Create > Set from the context menu.
A default set displays in the Entity Editor.
2. For Name, enter SETA.
3. Set Card Image to SET_GRID.
4. Set Set Type to non-ordered.
5. For Entity IDs, click 0 Nodes > Nodes.
6. Using the nodes selector, select the nodes with the ID of 3.
This is the node where the load was applied.
7. In the panel area, click proceed.
With FRF simulation, the amount of data generated can easily create big results files. It is a good practice to work with sets where you can specify only the points of interest. This reduces the CPU time and the amount of data to be saved.

### Create a Set of Outputs and Include Damping for Frequency Response Analysis

1. From the Analysis page, click the control cards panel.
The Card Image dialog opens.
2. Define GLOBAL_OUTPUT_REQUEST.
1. Click GLOBAL_OUTPUT_REQUEST.
2. Select DISPLACEMENTS.
A new set of options appears in the work area screen.
3. Click FORM(1) and select PHASE.
4. Click OPTION(1) and select SID.
A new field, SID(1) appears in yellow.
5. Double-click SID(1) and select SETA.
A value of 1 now appears below the SID field box. This sets the output for only the nodes in set 1.
3. Define FORMAT.
1. Click FORMAT.
2. In the number_of_formats= field, enter 2.
3. Under FORMAT_V1, click the second instance of FORMAT and select OPTI.
4. Click return.
4. Define PARAM.
1. Click PARAM.
2. Select G.
3. Click G_V1 and enter 0.05.
This specifies that the system will have a constant damping coefficient equal to 2.5% of the Critical Damping Ratio.
4. Click return.
5. Define OUTPUT.
1. Click OUTPUT.
2. Set KEYWORD to HGFREQ.
3. Set FREQ to LAST.
4. Leave number_of_outputs= set to 1.
5. Click return.

## Save the Database

1. From the menu bar, click File > Save As > Model.
2. In the Save As dialog, enter frf_response_input.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 frf_response_analysis 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. Clear the options field.
9. Click OptiStruct to launch the OptiStruct job.
If the job is successful, new results files should be in the directory where the frf_response_analysis.fem was written. The frf_response_analysis.out file is a good place to look for error messages that could help debug the input deck if any errors are present.

## View the Results

In this step you will view displacement results (.mvw file) in HyperGraph, and you will vview the displacement output (.disp file) from this run. The results file (.h3d) contains only the displacement results for the three nodes specified in the node set output.
1. In the OptiStruct panel, click HyperView to load the results from the analysis into the next page.
2. From the menu bar, click File > Open > Session.
3. In the Open Session File dialog, navigate to the directory where the job was run and open the frf_response_analysis_freq.mvw file.
1. Optional: If you launched from the OptiStruct panel, click Yes to discard the current session.
Two graphs are displayed. The graph title shows Subcase 1(subcase1)-Displacements of grid 3. The top graph shows Phase Angle verses Frequency. The bottom graph shows Displacement Response verses Frequency.
4. From the Curves toolbar, click to open the Define Curves panel.
5. Delete the X Trans and Y Trans curves.
The excitation is applied on Z direction then, the main effect will be detected on this direction.
6. On the Results toolbar, click to open the Curve Attributes panel.
7. Change the line attribute to continue .
8. Click the Symbol Attributes tab, and select the square symbol.
9. From the Annotations toolbar, click to open the Axes panel.
10. Change the Axis to Vertical.
11. Click the Scale and Tics (Magnitude) tab, and select Logarithmic.
12. In the Min field, enter 5.
13. In the Max field, enter 200000.
14. Click the Scale and Tics (Phase) tab, and change the Tics per axis to 7.
15. Set the Axis to Horizontal.
16. In the Min field, enter 5.
17. In the Max field, enter 1000.
18. From the Curves toolbar, click to open the Coordinate Info panel.
19. Under Find point, select Magnitude.
20. Click the maximum button to see the maximum Y-magnitude ~ 15055 in the table. The peak displacement of the baseline model.

## Open the Model

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

## Save the Database

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

## 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 plate.
5. Set type: to PSHELL.
6. Using the props selector, select Design.
7. For base thickness, enter 0.15.
8. Click create.

A topology design space definition, shield, has been created. All elements referring to the design property collector (elements organized into the "design" component collector) are now included in the topology design space. The thickness of these shells can vary between 0.15 (base thickness) and the maximum thickness defined by the T (thickness) field on the PSHELL card.

The object of this exercise is to determine where to locate ribs in the designable region. Therefore, a non-zero base thickness is defined, which is the original thickness of the shells. The maximum thickness, which is defined by the T field on the PSHELL card, should be the allowable depth of the rib.

Currently, the T field on the PSHELL card is still set to 0.15 (the original shell thickness). You will change this to a higher value to create a design space where the material can be removed.

9. Update the design variable's parameters.
1. Select the parameters subpanel.
2. Toggle minmemb off to mindim=, then enter 2.0.
3. Toggle maxmemb off to maxdim=, then enter 6.0.
4. Click update.
10. Click return.
11. Edit the thickness of the design property.
1. In the Model Browser, Properties folder, click design.
2. In the Entity Editor, T field, enter 1.000.

### 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 the frequency response displacement (constraint), which defines the maximum magnitude on dof3.
1. In the responses= field, enter frfdisp.
2. Set the response type to frf displacement.
3. Switch the component from real to magnitude.
4. Set the function to all freq.
5. Using the nodes selector, select the node with ID 3.
6. Select dof3.
7. Click create.

### Create Design Constraints

1. Click the dconstraints panel.
2. In the constraint= field, enter constr.
3. Click response = and select frfdisp.
4. Check the box next to upper bound, then enter 600.
5. Using the loadsteps selector, select subcase1.
6. Click create.

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

## 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 frf_response_optimization 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 frf_response_optimization.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:
frf_response_optimization.hgdata
HyperGraph file containing data for the objective function, percent constraint violations, and constraint for each iteration.
frf_response_optimization.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.
frf_response_optimization.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.
frf_response_optimization.html
HTML report of the optimization, giving a summary of the problem formulation and the results from the final iteration.
frf_response_optimization.oss
OSSmooth file with a default density threshold of 0.3. You may edit the parameters in the file to obtain the desired results.
frf_response_optimization.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 frf_response_optimization.fem file.
frf_response_optimization.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.
frf_response_optimization.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.
frf_response_optimization_des.h3d
HyperView binary results file that contain optimization results.
frf_response_optimization_s#.h3d
HyperView binary results file that contains from linear static analysis, and so on.
frf_response_optimization.his_data
The OptiStruct history file containing iteration number, objective function values and percent of constraint violation for each iteration.

## View the Results

Element Density and Element Thickness results are output from OptiStruct for all iterations.

### View a Static Plot of the Density Results

1. From the OptiStruct panel, click HyperView.
2. Open the frf_response_optimization.mvw session file.
1. From the menu bar, click File > Open > Session.
2. In the Open Session File dialog, navigate to your working directory and open the frf_response_optimization.mvw session file.
3. From the Results toolbar, click to open the Contour panel.
4. In the Results Browser, select the last load case simulation.
5. In the Contour panel, set the averaging method to simple.
6. Click apply.
Each element of the model is assigned a legend color, indicating the density of each element for the selected iteration. The last design iteration gives the optimized material layout.

### Compare the Peak Displacement of the Optimization Run

1. Open the FRF_response_analysis_freq.mvw session file.
1. From the menu bar, click File > Open > Session.
2. In the Open Session File dialog, navigate to your working directory and open the FRF_response_analysis_freq.mvw session file.
2. On the Curves toolbar, click to open the Build Plots panel, which you will use to add curves on top of the existing analysis information.
3. In the Data file field, load the frf_response_optimization_s2.h3d optimization file, which contains the final iteration analysis.
4. Set Subcase to the last iteration.
5. Set X Type to Frequency.
6. For Y Type, select Displacement (Grids).
7. For Y Request, select N3.
8. For Y Component, select X, Y, and Z.
9. Click Apply to overlay the new information onto the original plot.