# A Case of ANSYS Workbench Design Exploration Working With ANSYS APDL Command

As we all know, starting from version 14.0, ANSYS APDL no longer supports optimization analysis, and all functions are concentrated in ANSYS Workbench. This case is based on the Design Exploration of the Workbench platform and demonstrates how to use APDL for optimization analysis.

Case description:

The figure below shows a three-bar statically determinate steel truss with a modulus of elasticity of 200 GPa. The left and right diagonal bars have the same section, and the truss is subjected to a horizontal force of 20 kN and a vertical force of 30 kN at the lower end, as marked in the figure. If the allowable tensile stress of each bar is [σ]+ = 200 MPa, the allowable compressive stress is [σ]- = -120 MPa, and the combined displacement of the loaded nodes does not exceed 5mm. The range of values for the cross-sectional area of each bar is not less than 0.5 cm2 and not more than 5 cm2. The task is to select reasonable cross-sectional areas for each bar to minimize the total amount of steel used.

This example uses APDL parameterized modeling and imports the APDL command file into Workbench to identify parameters before conducting optimization analysis.

First, let’s analyze the problem. This problem is actually an optimization design problem of the cross-sectional parameters that make the truss structure lightest under the conditions of meeting the tensile, compressive strength, and displacement constraints. This optimization problem can be expressed as follows:

① Design Variables:

A1, A2 (cross-sectional areas of diagonal and vertical bars), satisfying 0.5 cm2 ≤ Ai ≤ 5 cm2;

② Constraint Conditions:

The tensile stress of the bar 0 ≤ σ ≤ 200 MPa

The compressive stress of the bar -120 Mpa ≤ σ < 0

The displacement of the free node u ≤ 5mm

③ Objective Function:

The total volume of the structure V → min

Since there are both tensile bars and compressive bars in the model, to simplify the constraint conditions, the stress of each bar is normalized. For tensile bars, their stress is divided by 200 MPa and saved as a stress ratio variable; for compressive bars, their stress is divided by -120 MPa and saved as a stress ratio variable. This way, the strength constraint condition is transformed into the stress strength ratio of each bar not exceeding 1.

Compile an APDL command flow file (filename: Truss_opt.inp), which defines A1 and A2 as design variables, extracts the stress ratio of each bar and node displacement as constraint variables, and extracts the total volume of the structure as the optimization objective function. Please see the attached document for details.

Next, import the above file into Workbench and conduct an optimization analysis. The specific operation process is as follows:

Step1: Parameter Analysis Initialization

First, add a Mechanical APDL component in the Project Schematic, and select Add Input File from the right-click menu in its Analysis cell, as shown in Figure 2. Select the above file, and then select update in the right-click menu to complete the analysis initialization.

Step2 :Analyze APDL File

Double-click the Analysis cell to enter its Outline view, and select “Process truss_opt.inp” to recognize the parameters defined by APDL commands. In the parameter list below, select A1 and A2 as “Input” (check column C), and select SRMAX, USUM1, and VOLUME as “Output” (check column D), as shown in Figure 3.

Step3: Confirm parameters

Return to the Workbench window, and a Parameter Set bar appears under the Mechanical APDL system. Double-click the Parameter Set bar to enter the parameter management interface. In this interface, you can see the Input and Output parameter lists that have been defined. After confirming the parameter settings, return to Workbench.

In the Workbench toolbox on the left, select the “Direct Optimization” system under Design Exploration and add it under the “Parameter Set” in the project schematic window on the right, as shown in Figure 4.

Step5: Select optimization algorithm

In the project schematic, double-click the “Optimization” cell to enter the Outline interface. Select the Optimization processing node and set the optimization method to ASO in its properties, keeping all other parameters at default settings, as shown in Figure 5.

Step7: Set constraints and optimization objectives

In the Outline interface, select the Objectives and Constraints node and specify the constraints for parameters P3 and P4 in the table on the right. Specify the optimization objective for parameter P5 as “Minimize”, as shown in Figure 6.

Step8: Set optimization domain

In the Outline interface, select the Domain node to set the optimization domain. Set the value range for the design optimization parameters P1 and P2 in the properties below or the table on the right, as shown in Figure 7.

Step8: Solve optimization

After setting up, click the “Update” button on the toolbar to solve the optimization.

Step9: View results

After optimization solving, the program selects three candidate design solutions, Candidate Point 1, Candidate Point 2, and Candidate Point 3, from over 30 optimization sample points. As shown in Figure 8, Candidate Point 1 has the smallest overall structure volume and meets strength and stiffness requirements, making it the best candidate design solution. Candidate Point 2 and Candidate Point 3 use about 25.16% and 59.57% more steel than Candidate Point 1, respectively, while their equivalent stress strengths are only about 0.8 and 0.63, much less than 1, indicating that their material strength has not been fully utilized.

Good Luck!