HS-1540: Set Up a 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. From the Startup dialog, start a new session and verify that HyperMesh is selected.
  2. For Profile, select Ansys.
  3. Click Create Session.
  4. In the User Profiles dialog, set the user profile to Ansys.
  5. From the menu bar, click File > Import > Solver Deck.
  6. Set File type to Ansys.
  7. In the File field, open the plate.cdb file.
  8. In the Solver Import Options dialog, click Import.
    A finite element model appears in the graphics area.
    Figure 2.


Parametrize Shapes in HyperMorph

  1. If necessary, enable the HyperMorph panel.
    1. From the menu bar, verify View > Panels is enabled.
    2. In the panel area, select the Tool subpanel and click HyperMorph.
      Figure 3.


  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. In the panel area, click domains.
    2. Verify the create subpanel.
    3. Click the first arrow and select auto functions.
      Figure 4.


    4. Click generate.
    Figure 5.


  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 modeling window, click the red edge of the hole.
      Figure 6.


    4. In the radius= field, enter 20.0000.
    5. Click the bottom arrow, and select hold center.
    Figure 7. Settings for Alter Dimensions Subpanel


  6. Click morph.
    The first shape is generated.
  7. Save shape, sh1.
    1. From the Morph ribbon, Save group, click the Shapes tool.
      The Edit Shapes dialog opens.
    2. In the Edit Shapes dialog, click .
      A shape is added.
    3. Right-click the created shape, select Rename from the context menu, and enter sh1 as the new name.
    4. Disable the Preview checkbox for shape1.
  8. In the alter dimension subpanel, click undo to prepare for the generation of the next shape.
  9. 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 modeling window, click the lower yellow handle located in the corner of the quarter circle.
      Figure 8.


    6. Click morph.
      The second shape is generated.
  10. Save shape by repeating step 7, but rename the shape as sh2.
  11. In the move handles subpanel, click undo to prepare for the generation of the next shape.
  12. Generate third shape.
    1. Go to the move handles subpanel.
    2. In the modeling window, click the upper yellow handle located in the corner of the quarter circle.
      Figure 9.


    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.
  13. Save shape by repeating step 7, but rename the shape as sh3.
  14. Click undo all to restore the initial mesh.
  15. Save HyperMesh model.
    1. From the menu bar, click File > Save As > HyperMesh Model.
    2. In the Save File As dialog, save the file as plateDV.hm.
  16. Close HyperMesh Desktop.

Register ANSYS as a Solver

  1. Start HyperStudy.
  2. From the menu bar, click Edit > 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 Other Application.
    4. Click OK.
    Figure 10.


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


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


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


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


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.
    3. For Definition from, select Setup 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.