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

  1. Start HyperMesh Desktop.
  2. In the User Profiles dialog, set the user profile to Ansys.
  3. From the menu bar, click File > Import > Solver Deck.
  4. Set File type to Ansys.
  5. In the File field, open the plate.cdb file.
  6. Click Import.
    A finite element model appears in the graphics area.


    Figure 2.

Parametrize Shapes in HyperMorph

  1. From the Tool page, click HyperMorph.
  2. Generate the domains and handles that you will use to manipulate the shape of the mesh and to generate shape perturbations for shape optimization.
    1. Click domains.
    2. Go to the create subpanel.
    3. Click the first arrow and select auto functions.
    4. Click generate.


    Figure 3.
  3. Click return.
  4. In the panel area, click morph.
  5. Alter dimensions.
    1. Go to the alter dimensions subpanel.
    2. Define the radius as a shape by clicking the first arrow and selecting radius.
    3. In the radius= field, enter 20.0000.
    4. Click the bottom arrow, and select hold center.


    Figure 4. Settings for Alter Dimensions Subpanel
  6. In the graphics area, click the red edge of the hole.


    Figure 5.
  7. Click morph.
    The first shape is generated.
  8. Save shape, sh1.
    1. Go to the save shape subpanel.
    2. In the name= field, enter sh1.
    3. Click save.
  9. Click undo to prepare for the generation of the next shape.
  10. Generate second shape.
    1. Go to the move handles subpanel.
    2. Click the second arrow and select translate.
    3. Click the third arrow and select along xyz.
    4. In the x val= field, enter 10.0000.
    5. In the graphics area, click the lower yellow handle located in the corner of the quarter circle.


      Figure 6.
    6. Click morph.
      The second shape is generated.
  11. Save shape, sh2.
    1. Go to the save shape subpanel.
    2. In the name= field, enter sh2.
    3. Click save.
  12. Click undo to prepare for the generation of the next shape.
  13. Generate third shape.
    1. Go to the move handles subpanel.
    2. In the graphics area, click the upper yellow handle located in the corner of the quarter circle.


      Figure 7.
    3. In the x val= field, enter 0.000.
    4. In the y val= field, enter 10.0000.
    5. Click morph.
      The third shape is generated.
  14. Save shape, sh3.
    1. Go to the save shape subpanel.
    2. In the name= field, enter sh3.
    3. Click save.
  15. Click undo to restore the initial mesh.
  16. Save HyperMesh model.
    1. From the menu bar, click File > Save As > Model.
    2. In the Save Model As dialog, save the file as plateDV.hm.
  17. Close HyperMesh Desktop.

Register ANSYS as a Solver

  1. Start HyperStudy.
  2. From the menu bar, click Edit > Register Solver Script.
    The Register Solver Script dialog opens.
  3. Add solver script.
    1. Click Add Solver Script.
      The Add dialog opens.
    2. In the Label and Varname fields, enter Ansys.
    3. From the list of solver script types, select Generic.
    4. Click OK.


    Figure 8.
  4. In the Path column of the script Ansys, click .
  5. 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.
  6. Click OK.

Perform the Study Setup

  1. Start a new study in the following ways:
    • From the menu bar, click File > New.
    • On the ribbon, click .
  2. In the Add Study dialog, enter a study name, select a location for the study, and click OK.
  3. Go to the Define Models step.
  4. Add a HyperMesh model.
    1. From the Directory, drag-and-drop the HyperMesh (.hm) file plateDV.hm into the work area.


      Figure 9.
    2. In the Solver Input File column, enter plate.cdb.
      This is the name of the solver input file HyperStudy writes during any evaluation.
    3. In the Solver execution script column, select Ansys.
    4. In the Solver Input Arguments column, enter plate.out plate after $file.


    Figure 10.
  5. Import variables.
    1. Click Import Variables.
      The Model Parameters dialog opens.
    2. Expand Shape, and select sh1.S, sh2.S, and sh3.S.
    3. Change the Lower bound to -1.0 and the Upper bound to 1.0.
    4. Click Add.
    5. Click OK.


    Figure 11.
  6. Go to the Define Input Variables step.
  7. Review the input variable's lower, initial, and upper bounds.


    Figure 12.

Perform Nominal Run

  1. Go to the Test Models step.
  2. 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

  1. Go to the Define Output Responses step.
  2. 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.
  3. In the File Assistant dialog, set the Reading technology to Altair® HyperWorks® and click Next.
  4. Select Multiple Items at Multiple Time Steps (readsim), then click Next.
  5. Define the following options and click Next.
    1. Set Subcase to Step 1.
    2. Set Type to Stress (2D).
    3. Set Request to First - Last.
    4. Set Component to vonMises.
  6. Optional: Enter labels for the data source and output response.
  7. Set Expression to Maximum.
  8. Click Finish.
    Output response 1 is added to the work area.
  9. Click Evaluate to extract the response values.

Run Optimization

  1. Add an Optimization.
    1. In the Explorer, right-click and select Add from the context menu.
    2. In the Add dialog, select Optimization and click OK.
  2. Go to the Optimization > Definition > Define Output Responses step.
  3. Click the Objectives/Constraints - Goals tab.
  4. Add an objective to Response 1.
    1. Click Add Goal.
    2. In the Type column, select Minimize.


    Figure 13.
  5. Go to the Optimization > Specifications step.
  6. 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.
  7. Click Apply.
  8. Go to the Optimization > Evaluate step.
  9. Click Evaluate Tasks.
  10. 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