HS-1540: Shape Optimization Study Using HyperMesh and ANSYS
Learn how to perform a shape Optimization started from inside HyperMesh using the direct link to HyperStudy.
Before you begin, copy the model files used in
            this tutorial from <hst.zip>/HS-1540/ to your working
            directory.
        The finite element solver is ANSYS. HyperMorph is used to do the shape parameterization. The objective is to minimize the maximum stress of a plate with a hole. The solution can be expected to be some kind of ellipse. Hence, the input variables are the half-axes of the hole.

Figure 1. Double Symmetric Plate Model
Set Up Model in HyperMesh
- Start HyperMesh Desktop.
- In the User Profiles dialog, set the user profile to Ansys.
- From the menu bar, click File > Import > Solver Deck.
- Set File type to Ansys.
- In the File field, open the plate.cdb file.
- 
                Click Import.
                A finite element model appears in the graphics area. 
 Figure 2.
Parametrize Shapes in HyperMorph
- From the Tool page, click HyperMorph.
- 
                Generate the domains and handles that you will use to manipulate the shape of
                    the mesh and to generate shape perturbations for shape optimization.
                - Click domains.
- Go to the create subpanel.
- Click the first arrow and select auto functions.
- Click generate.
  
 Figure 3.
- Click return.
- In the panel area, click morph.
- 
                Alter dimensions.
                - Go to the alter dimensions subpanel.
- Define the radius as a shape by clicking the first arrow and selecting radius.
- In the radius= field, enter 20.0000.
- Click the bottom arrow, and select hold center.
  
 Figure 4. Settings for Alter Dimensions Subpanel
- 
                In the graphics area, click the red edge of the hole.
                 
 Figure 5.
- 
                Click morph.
                The first shape is generated.
- 
                Save shape, sh1.
                - Go to the save shape subpanel.
- In the name= field, enter sh1.
- Click save.
 
- Click undo to prepare for the generation of the next shape.
- 
                Generate second shape.
                - Go to the move handles subpanel.
- Click the second arrow and select translate.
- Click the third arrow and select along xyz.
- In the x val= field, enter 10.0000.
- 
                        In the graphics area, click the lower yellow handle located in the
                            corner of the quarter circle.
                         
 Figure 6.
- 
                        Click morph.
                        The second shape is generated.
 
- 
                Save shape, sh2.
                - Go to the save shape subpanel.
- In the name= field, enter sh2.
- Click save.
 
- Click undo to prepare for the generation of the next shape.
- 
                Generate third shape.
                - Go to the move handles subpanel.
- 
                        In the graphics area, click the upper yellow handle located in the
                            corner of the quarter circle.
                         
 Figure 7.
- In the x val= field, enter 0.000.
- In the y val= field, enter 10.0000.
- 
                        Click morph.
                        The third shape is generated.
 
- 
                Save shape, sh3.
                - Go to the save shape subpanel.
- In the name= field, enter sh3.
- Click save.
 
- Click undo to restore the initial mesh.
- 
                Save HyperMesh model.
                - From the menu bar, click File > Save As > Model.
- In the Save Model As dialog, save the file as plateDV.hm.
 
- Close HyperMesh Desktop.
Register ANSYS as a Solver
- Start HyperStudy.
- 
                From the menu bar, click Edit > Register Solver Script.
                The Register Solver Script dialog opens.
- 
                Add solver script.
                - 
                        Click Add Solver Script.
                        The Add dialog opens.
- In the Label and Varname fields, enter Ansys.
- From the list of solver script types, select Generic.
- Click OK.
  
 Figure 8.
- 
                        Click Add Solver Script.
                        
- 
                In the Path column of the script Ansys, click  . .
- 
                In the Open dialog, open the
                        ansys.bat file.
                The script ansys.bat is a sample of an execution script for Ansys on Windows. Copy ansys.bat to your working directory to use it.
- Click OK.
Perform the Study Setup
- 
                Start a new study in the following ways:
                - From the menu bar, click File > New.
- On the ribbon, click  . .
 
- In the Add Study dialog, enter a study name, select a location for the study, and click OK.
- Go to the Define Models step.
- 
                Add a HyperMesh model.
                - 
                        From the Directory, drag-and-drop the HyperMesh (.hm) file
                                plateDV.hm into the work area.
                         
 Figure 9.
- 
                        In the Solver Input File column, enter
                            plate.cdb.
                        This is the name of the solver input file HyperStudy writes during any evaluation.
- In the Solver execution script column, select Ansys.
- In the Solver Input Arguments column, enter plate.out plate after $file.
  
 Figure 10.
- 
                        From the Directory, drag-and-drop the HyperMesh (.hm) file
                                plateDV.hm into the work area.
                        
- 
                Import variables.
                - 
                        Click Import Variables.
                        The Model Parameters dialog opens.
- Expand Shape, and select sh1.S, sh2.S, and sh3.S.
- Change the Lower bound to -1.0 and the Upper bound to 1.0.
- Click Add.
- Click OK.
  
 Figure 11.
- 
                        Click Import Variables.
                        
- Go to the Define Input Variables step.
- 
                Review the input variable's lower, initial, and upper bounds.
                 
 Figure 12.
Perform Nominal Run
- Go to the Test Models step.
- 
                Click Run Definition.
                An approaches/setup_1-def/ directory is created inside the study Directory. The approaches/setup_1-def/run__00001/m_1 directory contains the input file, which is the result of the nominal run.
Create and Evaluate Output Responses
- Go to the Define Output Responses step.
- From the Directory, drag-and-drop the plate.rst file, located in the approaches/setup_1-def/run__00001/m_1 directory, into the work area.
- In the File Assistant dialog, set the Reading technology to Altair® HyperWorks® and click Next.
- Select Multiple Items at Multiple Time Steps (readsim), then click Next.
- 
                Define the following options and click Next.
                - Set Subcase to Step 1.
- Set Type to Stress (2D).
- Set Request to First - Last.
- Set Component to vonMises.
 
- Optional: Enter labels for the data source and output response.
- Set Expression to Maximum.
- 
                Click Finish.
                Output response 1 is added to the work area.
- Click Evaluate to extract the response values.
Run Optimization
- 
                Add an Optimization.
                - In the Explorer, right-click and select Add from the context menu.
- In the Add dialog, select Optimization and click OK.
 
- Go to the Optimization > Definition > Define Output Responses step.
- Click the Objectives/Constraints - Goals tab.
- 
                Add an objective to Response 1.
                - Click Add Goal.
- In the Type column, select Minimize.
  
 Figure 13.
- Go to the Optimization > Specifications step.
- 
                In the work area, set the Mode to Adaptive
                        Response Surface Method (ARSM).
                Note: Only the methods that are valid for the problem formulation are enabled.
- Click Apply.
- Go to the Optimization > Evaluate step.
- Click Evaluate Tasks.
- 
                View the iteration history of the Optimization.
                - Click the Iteration History tab to review the
                            Optimization results.The optimal design is highlighted in green. 
- Click the Iteration Plot tab to plot the Optimization results.
  
 Figure 14. Iteration Plot
- Click the Iteration History tab to review the
                            Optimization results.