# How to optimize material properties from ANSYS file?

9 views (last 30 days)
Pedro Pesante Castro on 30 May 2021
Answered: Steve Grikschat on 6 Jul 2021
Hi everyone,
I've the idea to optimize some material properties (e.g: young modulus, poission ratio and shear modulus) in an ANSYS file.txt using MATLAB. The steps are:
1-Read the ANSYS file in MATLAB.
2-Create a function with a loop to admit multi variable iterations changing these material properties (can be 3 to 9 variables). For this, the ANSYS file has to contain the variables to modify. Then, with the function is possible to put the inputs of each iterations and run the ANSYS scrip.
3-Read and extract the results. Then, determine with which parameters is possible to reduce the error between the experimental test (about the material). It is possible with comparing the force-displacement slope. For this step, (with my little knowledge) I think to use fminsearch or fmincon.
I hope my explain was clear.
Do you have some ideas to realize this procedure or have you seen any similar work? Which optimization algorithm is better for this?
I appreciate any help :)

Steve Grikschat on 6 Jul 2021
Hi Pedro,
The overall approach you've described makes sense and I have seen similar approaches work successfully.
For example, this talk covers a case performing optimizaton on a CAD model
(although the FEA is done in MATLAB in this case, I think the idea extends).
Here are some other resources specifically on ANSYS:
Directly run ANSYS in batch mode from MATLAB using the approach outlined in this paper: Integration of MATLAB and ANSYS for Advanced Analysis of Vehicle Structures. This YouTube video also shows a similar method: Using MATLAB to run (ANSYS) APDL macro code
Without knowing a lot about the domain, I can't comment with any certainty about the optimization objective.
My perspective on the optimization solver is that you can try a gradient-based solver (like fmincon) first, but just know that if the gradient estimate is unreliable or noisy due to simulations, then you will need a derivative-free solver like those in Global Optimization Toolbox (like ga, patternsearch, or surrogateopt). The documentation discusses this briefly.

R2020a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!