HyperWorks Solvers

OS-4095: Size Optimization using External Responses (DRESP3) through HyperMath

OS-4095: Size Optimization using External Responses (DRESP3) through HyperMath

Previous topic Next topic No expanding text in this topic  

OS-4095: Size Optimization using External Responses (DRESP3) through HyperMath

Previous topic Next topic JavaScript is required for expanding text JavaScript is required for the print function  

In this tutorial, the standard responses available in OptiStruct are passed to a HyperMath script and the newly created responses from the script are used as optimization constraints. Since HyperMath is an interpreter, users can build custom responses without having to compile their HyperMath script.

os_4095_model

The structural model shown above is loaded to HyperMesh. The materials, shell properties, loads and boundary conditions are already defined in this model. The thicknesses of the three components are identified as design variables. The von Mises stress of element numbers 58 and 59 (elements located on the circumference of the hole) are defined as responses, and a total volume response is defined as well.

The von Mises stress of elements 58 and 59 are passed as inputs to the HyperMath script which in turn, returns two values: the sum of the two von Mises stresses, and the average value of the two elemental von Mises stresses.

The optimization problem for this tutorial is stated as:

Objective:

Minimize volume

Constraints:

Constraints on the sum of the von Mises stresses and the average von Mises stress

Design variables:

Gauges of the three parts

In this tutorial, you will learn to:

Examine the HyperMath script to calculate external responses
Setup external responses using DRESP3
Run the optimization using OptiStruct

Exercise


Step 1: Launch HyperMath and HyperMesh Desktop, Set User Profile, and Retrieve the File

1.Launch HyperMath.
2.Under the File menu, select open and select the dresp3_simple_h.hml file you saved to your working directory from the optistruct.zip file. Refer to Accessing the Model Files.

Examine the HyperMath script to calculate external responses.

os_4095_script

Notice the HyperMath script identified with the function MYSUM takes two inputs, rparam[1] and rparam[2], and returns two responses, rresp[1] – sum of the two inputs, and rresp[2] – average value of the two inputs. The calculated responses rresp[1] and rresp[2] are sent back to OptiStruct for use in the optimization. The script above will be linked to the DRESP3 related cards in the OptiStruct input file, which will pass the two inputs to this script and then receive two outputs from this script.

Note:In this script, it is possible to assign any name to the function, like MYSUM, myresponses, sumandavg, etc. However, the argument names to the function such as iparam, rresp, rparam, etc. cannot be changed.
 
External responses will now be set up using DRESP3.
3.Launch HyperMesh Desktop.
4.Choose OptiStruct from the User Profiles dialog and click OK. This loads the OptiStruct 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.

User Profiles GUI can also be accessed from the Preferences menu on the toolbar.

5.From the File menu on the toolbar, select Import > Solver Deck.
6.Make sure the File type: is OptiStruct.
7.Load the dresp3_simple.fem file.
8.Click Import.
9.Click Close.

Step 2: Attach the HyperMath Script Library to OptiStruct

OptiStruct will need the location of the HyperMath script for it to pass and receive the necessary inputs and outputs respectively. This is achieved using the LOADLIB card.

1.From the Analysis page, select control cards.
2.Click next.
3.Click LOADLIB and enter the following inputs:

Type:

DRESP3

GROUP:

HLIB

PATH:

<location of the hml file>
Example: c:/temp/dresp3_simple_h.hml

Note:There is a limited amount of space within the HyperMesh Desktop GUI to enter the file path and name. If the full file path with file name does not fit, exit the panel and edit the rest in by hand in Step 5 of this exercise.
4.Click return.
5.Click prev.

Step 3: Create DRESP3 cards

The design variables for the thicknesses of the three components are already defined. The responses for the total volume and the von Mises stress of elements 58 and 59 have also been defined.

The DRESP3 bulk data entry is not supported in the current version of HyperMesh. Therefore, these cards will be defined in the BULK_UNSUPPORTED_CARDS panel.

Note:A ‘$’ symbol indicates a comment and the following data will not be read by the solver.
1.Click BULK_UNSUPPORTED_CARDS and enter in the following DRESP3 information:

os_4095_control_card

This defines two external responses: the sum of the von Mises stresses of elements 58 and 59 (SUMH) and the average von Mises stress for elements 58 and 59 (AVGH).

The DRESP3 responses have different IDs from the DRESP1 responses and point to the library called HLIB defined in Step 2. Also, the function MYSUM is the same function name in the dresp3_simple_h.hml script.

This completes linking of the DRESP3 cards with the HyperMath Script.

Step 4: Create DCONSTR cards

Since the DRESP3 card is not supported in the current version of HyperMesh, the DCONSTR cards cannot be assigned to the DRESP3 responses from the dconstraints panel either. The DCONSTR cards are therefore also added using the BULK_UNSUPPORTED_CARDS panel.

1.With the BULK_UNSUPPORTED_CARDS dialog open, add the following constraint data (DCONSTR and DCONADD) following the DRESP3 information:

os_4095_add_contstraint

2.Click OK.
3.Click return. This defines upper bound constraints of 50 and 25 on the SUMH response and the AVGH response respectively.

Step 5: Run the Optimization Problem

1.From the File menu on the toolbar, select Export > Solver Deck.
2.Select the export directory for the solver file.
3.Click files_panel, select the file dresp3_simple.fem, and click Save.
4.Click Export. The .fem file name is used for OptiStruct input decks.
5.Open dresp3_simple.fem with a text editor.
6.Add the following under the subcase information section, towards the top of the file: DESSUB = 10.
7.Save the file.

The DRESP3s created are subcase dependent responses and therefore are to be referenced from within a subcase. The DESSUB command does this. This line has to be added manually since the current version of HyperMesh does not support the DRESP3 bulk data entry.

8.Launch the OptiStruct solver GUI: start > All Programs > Altair HyperWorks 2017 > OptiStruct.
9.Browse to the dresp3_simple.fem file saved above.
10.Click Run to run the optimization.
11.When the job is complete, post-process the results.
Note:The complete FEM deck, dresp3_simple_complete.fem, is available and can be used as a reference.

See Also:

OptiStruct Tutorials