Frequently asked questions#

This section provides answers to frequently asked questions.

How do you report issues?#

You can report issues with PyMechanical, such as bugs, feature requests, and documentation errors, on the PyMechanical repository’s Issues page.

If you want to ask more open-ended questions or are seeking advice from experts in the community, you can post on this repository’s Discussions page.

What is the relationship with Ansys Workbench?#

Ansys Workbench is a no-code environment to set up analysis systems that can be linked together. It is part of the Ansys family of software tools for process automation and design exploration. This family includes Ansys OptiSLang, which may be a more natural fit for integration with PyMechanical. The most popular app within the Workbench environment is Mechanical, and for many years, Workbench was the only environment you could run Mechanical from.

Because Workbench is a no-code environment, a lot of the complexity around managing data transfer between Ansys apps and running parametric studies is hidden. PyMechanical and PyAnsys libraries more broadly give you much more control over your process automation and design exploration. However, eliminating Workbench means that you miss out on what it handled under the hood.

How do you restart a script?#

If you have trouble terminating a simulation, you do not have to close Python, reopen it, and clear all previous data such as the mesh using this code:

import sys

sys.modules[__name__].__dict__.clear()

Simply exiting Python should clear the solution within Python. This is because stopping the original process means that nothing should be in present in a new process.

The way that you clear all data from Mechanical in PyMechanical depends on if Mechanical is a remote session or embedded.

  • If Mechanical is a remote session, use either the Mechanical.clear() method or exit and restart Mechanical.

  • If Mechanical is embedded, use the app.new() method.