Introduction
In Part I of this series, we began the journey of calibrating a material model in Ansys Workbench using PyAnsys and Stochos from Probabilistic Intelligence. We explained how to accomplish the first five bullets of the process below. In this article, we detail the optimization routine that will result in optimal material model parameters. The optimization process steps are the boldface items that will be discussed in the current article:
- Parameter definition: bounds and types
- Workbench model setup and verification
- Stochos optimization and constraint functions definition
- Start design of experiments (DOE) generation using Stochos
- Start DOE results generation by passing parameters to Workbench using PyAnsys
- DIMGP Model calibration and optimization loop with next design points suggested by Stochos
- Optimization results and final parameter selection
Part I Recap
Recall the parameter definition from Part I, remembering that all parameters are of continuous type:
Parameter |
Units |
Bounds |
Young's Modulus, E | MPa | [160000, 200000] |
Initial Yield Stress, S0 | MPa | [1100, 1600] |
Linear Hardening Coefficient, R0 | MPa | [1, 1000] |
Exponential Hardening Coefficient, Rinf | MPa | [400, 900] |
Exponential Saturation Parameter, b | None | [160, 400] |
Also, recall that we completed a start DOE run on 30 design points, 13 of which met the min(gradient) >= 0 criterion that the material model requires.
DIMGP Model Calibration and Optimization Loop
The process of DIMGP model calibration and optimization is as follows, looping over the number of requested optimization iterations (OPTIMIZATION_ITERS):
- Read in the current summary file and results file.
- Train the DIMGP model and return the Stochos model object along with X, y data.
- Store the current minimum L2 distance.
- Obtain next samples and perform local optimization using the Stochos opt_obj.next_sample() function.
- Run the next samples in Workbench to obtain new simulation data.
- Check the gradient on the new simulation data and retain next signals that have min(gradient) >= 0.
- If no next signals are retained, keep adding 2n candidates until at least one is retained. Here, n = 2, 3, 4, ...
- Add the next points to the results file and summary file.
- Compare and print the L2 distance change to aid in determining if more optimization iterations are needed.
Since the data are stored after every optimization iteration, it is very easy to continue the optimization process over as many sessions as needed.
The code to perform the optimization iterations is shown in the next two images:
Optimization Results and Final Parameter Selection
After completing the optimization process, we retained 50 design points and obtained decent agreement between Run 59 and the reference signal. The L2 distance of Run 59 = 213.9, which is more than four times lower than Run 5 from the start DOE.
Also, we obtain the final sensitivity analysis from Stochos that shows which parameters are most important. Evidently, R0 is not an important parameter.
Finally, the summary data shows that the current optimal model parameters are highlighted in yellow below:
Conclusion
In conclusion, we completed the process of material model calibration started in Part I of this series. Using Python with PyAnsys and Stochos provides the automation and statistical modeling required for such a task. Note: Stochos has some built-in optimization control functions that make it possible to simplify the code presented here. We chose to do it manually for ease of exposition.
Downloadable Resources
Download the following .zip file to obtain the Workbench project and Python code to reproduce the results in this article: Ansys 2025 R1 model archive and Python code
Tags:
Python, FEA, Structural Analysis, Workbench, ANSYS Mechanical, PyANSYS, Parametric Analysis, Material calibration, Stochos, 2025 R1, Design of Experiments, PyWorkbenchMarch 14, 2025