HS-1610: Set Up a SimLab Model using Python

Learn how to set up a mesh refinement study using a SimLab model to investigate the relationship between the SimLab mesh parameters and max Stress and max displacement.

Before you begin:
  • Copy the model files used in this tutorial from <hst.zip>/HS-1610/ to your working directory.
    Important: The HyperStudy directory (.hstudy) and the SimLab project directory cannot be the same.
  • Before creating the parameters inside SimLab, pause the recording of python. This is a known limitation of SimLab. The parameters are passed separately from the .xml file to the .py file. If the parameter definition already exists in the .py file, then any changes in the values will be overwritten.
  • Verify that SimLab is installed with HyperStudy.

    Setup SimLab to work with HyperStudy. For more information, refer to the registrations steps in SimLab Model.

The model used in this tutorial is a Parasolid CAD file (ConnectingRod.xmt_txt) that contains a connecting rod. The connecting rod is loaded at one end and constrained at the other.
Figure 1. Connecting Rod Mesh Representation with Loads and Boundary Conditions


Register SimLab as a Solver

  1. Start HyperStudy.
  2. From the menu bar, click Edit > Solver Script.
    The Register Solver Script dialog opens.
  3. In the Path column of the script SimLab, click .
  4. In the Open dialog, open the bin/<platform>/SimLab.bat file.
  5. Click OK.

Perform the Study Setup

  1. Start HyperStudy.
  2. Start a new study in the following ways:
    • From the menu bar, click File > New.
    • On the ribbon, click .
  3. In the Add Study dialog, enter a study name, select a location for the study, and click OK.
    Restriction: The HyperStudy directory cannot exist in the same location as the SimLab project directory.
  4. Go to the Define Models step.
  5. Add SimLab model.
    1. Click Add Model.
    2. In the Add dialog, select SimLab and click OK.
    3. In the Resource column, click .
    4. In the HyperStudy – Load model resource dialog, open the Conrod_py_script.py file.
    Notice: The Solver Input Arguments field automatically displays with -nographics -auto ${dirname file}/HST_CONROD/Conrod_py_script.py -param ${dirname file}/HST_CONROD/HST_CONROD_Params.xml -response ${dirname file}/HST_CONROD/HST_CONROD_Responses.xml.
  6. Click Import Variables.
  7. Go to the Define Input Variables step.
  8. In the work area, Active column, clear the checkboxes for the FilletMeshSize and Load input variables.
    In this tutorial you will only focus on the BodyMeshSize input variable.
  9. For the BodyMeshSize input variable, change the Lower Bound to 2.0 and the Upper Bound to 6.0.
    Figure 2.


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.

Perform the Sweep

In this step, you will add a Basic approach and perform a Sweep.

  1. Add a Basic approach.
    1. In the Explorer, right-click and select Add from the context menu.
    2. In the Add dialog, select Basic.
    3. For Definition from, select an approach and click OK.
  2. Define specifications.
    1. Go to the Basic 1 > Specifications step.
    2. In the work area, set the Mode to Sweep.
    3. In the Settings tab, verify the Number of Runs is 5.
    4. Click Apply.
    Figure 3.


  3. Evaluate tasks.
    1. Go to the Basic 1 > Evaluate step.
    2. Click Evaluate Tasks.
  4. Post process results.
    1. Go to the Basic 1 > Post Processing step.
    2. Click the Scatter tab.
    3. From the Channel selector, set the X Axis to BodyMeshSize and the Y Axis to Max_Von_Mises and Max_Disp.
      The results of the scatter plot indicate that as the size of the mesh gets smaller (moving along the x-axis to the left), displacement starts to converge. However, stress does not converge. This behavior is typical in finite element models when displacement converges before derived quantities such as stress. In this tutorial, the Max_Von_Mises output response may not converge at all due to the location of the maximum stress in the model (adjacent to the load application area), which can be seen by opening the resulting file in HyperView.
      Figure 4.