## Create a DRESP2 using a function for OptiStruct optimization in HyperWorks

When setting up an OptiStruct optimization, it is often useful to be able to define a custom response.  A DRESP2 can be used to combine existing responses to formulate an optimization constraint or objective.  DRESP2 can be used with standard arguments for DRESP1 cards, such as sum, avg, max, and min. It also can be used with a DEQATN card, which establishes a functional relationship between DRESP1 responses like mass, volume, displacement, or stress.  This document gives instructions for setting up this equation in HyperWorks.

Prerequisite:  Create DRESP1 responses you need to relate with a function.

1. Create an equation which will be used to reference existing DRESP1 responses in the optimization model.  Navigate to the Optimize tab in the ribbons in HyperWorks and click the Equations icon.

The dequations dialog opens up.

In this field, a functional relationship between different DRESP1 responses is established.

1. Specify the number of lines as 1 and set the function relationship in the field below.  For example, the difference between responses can be set as f(x,y) = x - y.  You can review the Design Equations in the Model Browser.

1. Create the DRESP2 linking the responses to the equation.  Click on the Responses icon.

1. In the Create Optiresponses dialog, create a name for the DRESP2.  Make sure dequation for Function is selected and select the function created under the Function Id field.
2. Select global responses referenced by the equation under the Response List.  For subcase-specific DRESP1 responses, select the responses under the DRESP1LV field.
1. Export and review the input deck to see the DRESP2 and DEQATN entries that are created.  An example DRESP2 linking to a DEQATN function summing the DRESP1 displacements at four nodes in the x-direction for subcase 1 looks like this:

DRESP2  3       eq             1

+       DRESP1LV       4       1     ALL       5       1     ALL

+                      6       1     ALL       7       1     ALL

DRESP1  4       node 1x DISP                          TX            3192

DRESP1  5       node 2x DISP                          TX              52

DRESP1  6       node 3x DISP                          TX            2911

DRESP1  7       node 4x DISP                          TX              42

DEQATN  1       f(a,b,c,d) = a + b + c + d

The responses are linked by the order in which they are referenced in the DRESP2 function and the equation.  Next, continue setting up the design optimization by setting any other responses, constraints and an objective.

To learn more about setting up an optimization with OptiStruct and HyperWorks, you can review the product documentation as well as other knowledge located in the Altair Community such as product forums.