This tutorial demonstrates how to set up the structural optimization problem of MBD systems with HyperMesh, and how to run the shape optimization job in OptiStruct. The mass of the system is to be minimized by controlling 12 shape design variables while the stress should be less than an allowable value. Left link is a driving link whose angular velocity is 50 rad/sec. Units (kg, N, cm, s).
4 bar linkage.
The optimization problem for this tutorial is stated as:
Objective:
|
Minimize mass
|
Constraints:
|
Upper bound on stress
|
Design variables:
|
Shape design variables of the three flexible bodies
|
In this tutorial, you will learn to:
• | Setup an MBD transient analysis |
• | Post-process MBD results in HyperView |
• | Setup an ESL MBD optimization problem in HyperMesh |
• | Post-process optimization results using HyperView |
Exercise
Step 1: Launch HyperMesh Desktop, Set the User Profile, and Retrieve the File
1. | Launch HyperMesh Desktop. |
2. | Choose OptiStruct in the User Profiles and click OK. This loads the 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. |
3. | From the File menu on the toolbar, select Open > Model. |
4. | Select the 4bar_design.hm file you saved to your working directory from the optistruct.zip file. Refer to Accessing the Model Files. |
The 4bar_design.hm database is loaded into the current HyperMesh session.
Step 2: Define a Driving Motion
In this tutorial, the driving motion at a joint, MOTNJ is defined. However, MOTNJ is not currently supported by HyperMesh, so the card needs to be entered manually.
1. | From the Analysis page, click control cards. |
2. | Click BULK_UNSUPPORTED_CARDS. |
3. | Make sure the following card is there; if not, it needs to be entered. |
Constant velocity (50 Rad/s) applied to the joint 66299.
Step 3: Update Boundary Condition and MOTION in the Predefined MBD Subcase
1. | In the Model browser, select the SUBCASE1 load step. |
2. | Make sure that Analysis type is set to Multi-body dynamics. |
3. | For MBSIM, select MBSIM1 from the pop-out window and click OK. |
4. | Scroll down to the bottom of the load step entry, and click on the box next to SUBCASE_UNSUPPORTED. |
5. | Click and enter MOTION = 1 in pop-out window. |
Step 4: Submit the Transient MBD simulation in OptiStruct
1. | From the Analysis page, click OptiStruct. |
2. | Set the export options: toggle to all. |
3. | Click the run options: switch and select analysis. |
4. | Set the memory options: toggle to memory default. |
5. | Click save as following the input file: field. |
6. | Select the directory where you would like to write the OptiStruct model file and enter the name for the model, 4bar_design_analysis.fem, in the File name: field. For OptiStruct input decks, .fem is the suggested extension. |
7. | Change the options: field so that it is blank. |
8. | Click OptiStruct. This launches an OptiStruct run in a separate shell (DOS or UNIX) which appears. |
If the analysis was successful, no error messages are reported to the shell. The analysis is complete when the message Process complete successfully appears in the shell.
Post-processing the MBD Results in HyperView
Step 5: Post-process the Transient MBD Analysis
1. | When the message Process completed successfully is received in the command window, close the window. |
2. | Click HyperView from within the OptiStruct panel. This will automatically load the results for the current run into HyperView. |
A message window appears to inform about the successful loading of the model and result files.
3. | Click Close to close the Message Log window. |
4. | Click the Contour toolbar icon . |
5. | Select the first drop-down menu below Result type: and select Element Stresses (2D & 3D) (t). |
7. | Click Edit Legend and change the Type: to Dynamic scale. Other properties can be changed here to created the desired legend. |
8. | Click the Page Layout icon and change the page to 2 Vertical windows . |
9. | Click the empty window on the right side to make it current. |
10. | Click the Client Selector drop-down switch and select HyperGraph 2D . |
11. | Click in window 1 to make it current. |
12. | Click Measure . |
13. | In the Measure Groups list, check the box beside Dynamic MinMax Result. |
14. | Click Max at the list below Resolved in. |
15. | Click Create Curve, modify Place curve on: to Existing Plot. This will expose a list of plot windows on this report. |
16. | Check the Live link box, select Window 2 and click Apply. This will plot the Maximum von Mises stress (t). Now this file will be saved as a template to be applied on the optimized result. |
MBD Stress results (Max = 56996 N/cm2)
17. | From the File menu, select Save As > Session and change the Save as type: to Report definition (*.tpl). |
18. | Enter Stress_report.tpl click Save. |
19. | Use the page navigation icons to return to Page 1 and the HyperMesh client. |
Setting Up the ESL Optimization Problem in HyperMesh
Step 6: Define Boundary Conditions for Structural Analysis in ESL Optimization
Structural analysis and optimization of the flexible bodies of this model are performed in ESL optimization. Thus, the boundary condition for the flexible bodies needs to be defined.
1. | In the Model browser, right-click and select Create > Load Collector. |
2. | For Name, enter BCforOpt. |
3. | Click Color and select any color. |
4. | For Card Image, select None. |
5. | From the Preferences menu, select Graphics. |
6. | Make sure coincident picking is checked on. |
7. | Click return to go to main menu. |
8. | From the Analysis page, click constraints. |
9. | All of the dofs (1 through 6) should be fixed to remove the 6 rigid body motion of each flexible body. Make sure that dof1 through dof6 are all checked in the constraints panel. |
Nodes to be constrained to arrest rigid body motions.
10. | From the graphics area, click the center of the lower spider of the component Left. You should see two node numbers at one location; choose node number 288. |
11. | From the graphics area, click the center of the left spider of the component Middle and choose node number 143. |
12. | From the graphics area, click the center of the lower spider of the component Right and choose node number 441. |
13. | Make sure the Load Type= is set to SPC. |
Step 7: Update Boundary Condition and MOTION in the Predefined MBD Subcase
1. | In the Model browser, click on the SUBCASE1 load step. |
2. | Make sure that Analysis type is set to Multi-body dynamics. |
3. | For MBSIM, select MBSIM1 from the pop-out window and click OK. |
4. | For SPC, select BCforOpt from the pop-out window and click OK. |
Step 8: Define Shape Variables
The shape perturbation vectors already have been created in this database. For more details about creating shape perturbation vectors, refer to other tutorials related to HyperMorph. In this section, you will define shape design variables with the predefined shape perturbation vectors.
1. | From the Analysis page, select the optimization panel. |
3. | Select the desvar subpanel using the radio buttons on the left side of the panel. |
4. | Click the switch next to single desvar and change it to multiple desvars. |
5. | Click shapes in the cyan border in the right upper corner, select all from the pop-up menu, and click select. |
6. | Enter -1.0 for the lower bound and 1.2 for the upper bound. |
7. | Click create. 12 shape design variables are created. |
8. | Click return to go to the optimization panel. |
Step 9: Define Responses
Two responses are defined: a mass response for the objective function and stress for the constraint.
1. | You should already be in the optimization panel. Select the responses panel. |
2. | Click response = and enter Mass. |
3. | Click the response type switch and select mass from the pop-up menu. |
4. | Click create. A response, mass, is defined for the total mass of the model. |
5. | Click response = and enter Stress. |
6. | Click the response type switch and select static stress from the pop-up menu. |
7. | Click props in the cyan border and select Middle, Left, and Right. |
9. | Make sure that stress type is von mises and for both surfaces. |
10. | Click create. A stress response is created. |
11. | Click return to go to the optimization panel. |
Step 10: Define an Objective Function
The objective is to minimize the mass response defined in the previous section.
1. | Select the objective panel (accessed from the optimization panel on the Analysis page). |
2. | Click the switch in the upper left corner of the panel, and select min from the pop-up menu. |
3. | Click response = and select Mass from the response list. |
4. | Click create. The objective function is now defined. |
5. | Click return to go to the optimization panel. |
Step 11: Define Constraints on Stress Response
The upper bound constraint is to be defined for the stress response defined in the previous section.
1. | Select the dconstraints panel (accessed from the optimization panel on the Analysis page). |
2. | Click constraint = and enter Constr. |
3. | Check the box next to upper bound =. |
4. | Click upper bound = and enter 30000. |
5. | Click response = and select Stress from the list of responses. A loadsteps button appears in the panel. |
7. | Check the box next to SUBCASE1 and click select. |
8. | Click create. A constraint is defined on the response Stress. The constraint will force the maximum stress on SUBCASE1 to be less than 30000.0 N/cm2. |
9. | Click return twice to go to the main menu. |
Step 12: Save the Database
1. | From the File menu, click Save As > Model. |
2. | Select the directory in which to save the file and, in File name:, enter 4bar_design_opt.hm. |
Step 13: Submit the ESL Optimization Job in OptiStruct
1. | From the Analysis page, click OptiStruct. |
2. | Set the export options: toggle to all. |
3. | Set the run options: toggle to optimization. |
4. | Set the memory options: toggle to memory default. |
5. | Click save as following the input file: field. |
6. | Select the directory where you would like to write the OptiStruct model file and enter the name for the model, 4bar_design_opt.fem, in the File name: field. For OptiStruct input decks .fem is the suggested extension. |
The name and location of the file displays in the input file: field.
8. | Click OptiStruct. This launches an OptiStruct run in a separate shell (DOS or UNIX) which appears. |
If the optimization was successful, no error messages are reported to the shell. The optimization is complete when the message Processing complete appears in the shell.
If the job was successful, the new results file can be seen in the directory where the input file was saved. In addition to ordinary output files, you can see a text file whose name is 4bar_design_user.eslout. This file is a good source to see the process of the ESL optimization.
Post-processing Optimization Results using HyperView
Step 14: View Stress Results for the Last Iteration
1. | When the message Process completed successfully is received in the command window, close the DOS window. |
2. | Click HyperView from within the OptiStruct panel or open HyperView from the Start menu. |
3. | From the File menu, select Open > Report Template. |
4. | Browse for the report Stress_report.tpl and click Open. |
5. | For GRAPHIC_FILE_1 and RESULT_FILE_1, select 4bar_design_opt_mbd_0#.h3d from where the optimization was run (the highest # should be the final iteration). |
A message appears explaining that the Element Stresses (2D & 3D) results do not exist - this is because the stress results on MBD simulations are just named Stress.
6. | Close the Message Log window. |
7. | Click on window 1 to make it current. |
8. | Click the Contour toolbar icon . |
9. | Select the first drop-down menu below Result type: and select Stress (t). |
10. | Click the traffic light icon to start the animation. |
von Mises stress contour (Max < 30000 N/cm2)
Step 15: Contour the Shape Change
1. | Click to add a new page to the session. |
2. | Click the Load Results toolbar icon and open the last iteration (highest) number result file of 4bar_design_opt_des_0#.h3d from where the optimization was run. |
4. | Click the Contour toolbar icon . |
5. | Select the first drop-down menu below Result type: and select Shape Change (v). |
Shape changing contour
Open the file 4bar_design_opt.dsvar to see how OptiStruct changed the DVs during the optimization process.
This will show that all DVs for the right and mid arms went to the limit of 1.2, showing that minimizing the mass of these two arms are key to reducing the Stress.
See Also:
OptiStruct Tutorials