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.
- 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.
Register SimLab as a Solver
- Start HyperStudy.
-
From the menu bar, click .
The Register Solver Script dialog opens.
- In the Path column of the script SimLab, click .
- In the Open dialog, open the bin/<platform>/SimLab.bat file.
- Click OK.
Perform the Study Setup
- Start HyperStudy.
-
Start a new study in the following ways:
- From the menu bar, click .
- On the ribbon, click .
-
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.
- Go to the Define Models step.
-
Add SimLab model.
- Click Add Model.
- In the Add dialog, select SimLab and click OK.
- In the Resource column, click .
- 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
. - Click Import Variables.
- Go to the Define Input Variables step.
-
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.
-
For the BodyMeshSize input variable, change the Lower Bound to
2.0 and the Upper Bound to
6.0.
Perform Nominal Run
- Go to the Test Models step.
-
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.
-
Add a Basic approach.
- In the Explorer, right-click and select Add from the context menu.
- In the Add dialog, select Basic.
- For Definition from, select an approach and click OK.
-
Define specifications.
- Go to the step.
- In the work area, set the Mode to Sweep.
- In the Settings tab, verify the Number of Runs is 5.
- Click Apply.
-
Evaluate tasks.
- Go to the step.
- Click Evaluate Tasks.
-
Post process results.