pyAnsys – Phyton code within Mechanical, Fluent, Electronic, SpaceClaim.

PyAnsys started as a single package, but is now a collection of Python packages for using Ansys through Python. This gives a lot of possibilities. With pyAnsys you can build models and start Ansys from other programs. You can also use Python code within Mechanical, Fluent, Electronic Desktop and SpaceClaim to automate processes, create user defined results and use other capabilities within Python. In addition you get access to the Data Processing Framework which is an independent tool to handle complex post processing.

All of this lets you use the power of Python and the Python community. Through Python you will have access to a lot of free tools, and it is a programming language that many people master. An engineer fresh out of university today will typically have some knowledge about it.

Who should use pyAnsys? If you need to customize any Ansys program, then pyAnsys is probably the solution. That can typically be a type of loading or results that you miss, or maybe you want to automate the setup of models. Another case is if you want to run Ansys from other programs. For example, you could use Excel to create variations of a design or run “what-if” analyzes. This way, a designer can run Ansys analyses without actually learning the program.

PyAnsys is evolving, and we can expect more packages to be released with each version. The packages released so far include pyDPF and packages to interact with Fluent, Electronics Desktop, Mechanical APDL.

If you want to learn more about pyAnsys, the first place to check out is docs.pyansys.org. Here you will find examples, getting started guides and other resources you need. Ansys also has some very instructional videos on YouTube, including an introductory course in Python. The name of the channel is Ansys Learning. To install python, you should go to python.org

If you are familiar with APDL, it is relatively easy to get started with running analyses from Excel. You need a plugin in Excel called xlwings (see xlwings.org).

With all these resources, it should be possible for any interested person to get started. It certainly brings possibilities for utilizing Ansys in new ways.

 

Questions&Answer

Question 1: If MyMAPDL is just a way to give APDL commands, what is the big advantage then over just calling “mapdl commandfile” from Python?
Answer 1: Would probably be just as easy to call mapdl input file from Python.

Question 2: Will Ansys in future drop use of APDL in Mechanical (like comman snippets) and go fully for Python?
Answer 2: Probably not, as APDL is the “language” of the solver.

Question 3: Does PyAnsys have the same capabilities as APDL? For someone who have no experience with either of Python or APDL, which one would you recommend looking into?
Answer 3: PyMAPDL is basically a way to run APDL. You will need to be able use APDL to use pyMAPDL.

Question 4: Is there a planned release date for py mechanical?
Answer 4: We do not have an official date. We expect it to be released in 2023 or 2024.

Question 5: Is it possible to integrate a custom equation in the iterative solver into the mechanical solver using pyAnsys? lets say the lambda value depends on the temperature differences?
Answer 5: That sounds like something which would require compilation of the Ansys.exe file. That is outside the scope of pyAnsys. It is possible to compile in user defined material models, but not changes to the solver behavior.

Question 6: Do you have some code examples for getting started with pyansys more easily?
Answer 6: There are several examples in docs.pyansys.com. It starts quite basic.

Contact an pyAnsys expert!

ajax-loader-image