Controlling your ANSYS with powerful Python – Introduction and Installation of PyAnsys

Controlling your ANSYS with powerful Python – Introduction and Installation of PyAnsys

Please Share Us

点击此处查看 ✿水哥原创ANSYS视频教程清单 ✿


Python is arguably the best programming language in the current ecosystem, with a plethora of open-source libraries available for developers. Integrating ANSYS solvers with Python can greatly expand the usage scenarios of ANSYS, which gave rise to the PyAnsys Python library for ANSYS. PyAnsys is a series of Python packages that allow direct interaction with ANSYS products (including MAPDL, Fluent, Digital Twin, AEDT, etc.) from within Python. The package provides a modern programmable interface that enables users not only to script using the Ansys simulation stack for various multiphysics simulations but also to script workflow to combine simulation with other automated operations. Currently, the PyAnsys package includes the following modules:

PyAEDT: Interface for electronic simulation module AEDT;
PyDPF-Core: Data Processing Framework (DPF) used for creating and customizing workflows;
PyDPF-Post: DPF post-processing module interface;
PyDPF Composites: Composite material post-processing module interface;
PyFluent: Interface for fluid analysis Fluent;
PyFluent-Parametric: Fluent parameterization workflow interface;
PyFluent-Visualization: Fluent visualization interface;
PyMAPDL: Interface for solid mechanics simulation MAPDL;
PyMAPDL Reader: MAPDL post-processing interface (supports versions after MAPDL 14.5);
PyPIM: Product Instance Management (PIM) API interface;
PyPrimeMesh: Preprocessing mesh division interface;
PySeascape: Communication interface between Python and RedHawkSC and TotemSC;
PyTwin: Interface between Python and Ansys digital twin workflows;
Granta MI BoM Analytics: Granta MI BoM analysis service interface;
Shared Components: Software sharing interface.

Next, we will introduce the installation method of PyAnsys.

1. Online Installation
PyAnsys can be installed online like any other Python module, using the pip command line. First, ensure that pip is up to date:

python -m pip install -U pip

Use the pip command to install PyAnsys:

python -m pip install pyansys

PyMAPDL Reader, PyFluent-Parametric, and PyFluent-Visualization are extension modules that are not installed by default. To install the two Fluent extension modules, use the command:

python -m pip install pyansys[fluent-all]

To install the PyMAPDL Reader extension module, use the command:

python -m pip install pyansys[mapdl-all]

To install all the core and extension modules, use the command:

python -m pip install pyansys[all]

To install a specific version of PyAnsys (e.g., version 2023.1.0), use the command:

python -m pip install pyansys==2023.1.0

2. Offline Installation
First, download the PyAnsys release installation package from GitHub:

After downloading, extract the installation package and then use the pip command in the Python environment to install it:

pip install pyansys -f wheelhouse –no-index –upgrade –ignore-installed

Where wheelhouse is the directory location of the extracted installation files. The installation method for extension modules is similar to online installation. For example, to install all the modules, use the command:

pip install pyansys[all] -f wheelhouse –no-index –upgrade –ignore-installed

After installation, you will receive a notification of the successfully installed modules.

3. Note on Versions
The PyAnsys version format is as follows:


Where XXXX. Y is the version of the corresponding ANSYS software, such as ANSYS2023R1, then the corresponding PyAnsys version is 2023.1. ZZ, where ZZ is the version of PyAnsys.

Good Luck!





有时间麻烦帮忙点击下公众号文末的广告哦, 权当码字的辛苦费,感谢大家!

Please Share Us
© 版权声明
点赞0赞赏 分享
评论 抢沙发