Examples#

Here are a series of examples using MAPDL with the ansys-mapdl-core library.

Full examples using PyMAPDL#

These examples demonstrate full examples using the PyMAPDL module.

Analysis of a 2D magnetostatic solenoid

Analysis of a 2D magnetostatic solenoid

MAPDL 2D Plane Stress Concentration Analysis

MAPDL 2D Plane Stress Concentration Analysis

2D Pressure Vessel

2D Pressure Vessel

3D Stress Concentration Analysis for a Notched Plate

3D Stress Concentration Analysis for a Notched Plate

Basic Thermal Analysis with PyMAPDL

Basic Thermal Analysis with PyMAPDL

3D Acoustic Analysis

3D Acoustic Analysis

Basic DPF-Core Usage with PyMAPDL

Basic DPF-Core Usage with PyMAPDL

Static analysis of a corner bracket

Static analysis of a corner bracket

Static simulation of double cantilever beam test via cohesive elements

Static simulation of double cantilever beam test via cohesive elements

Contact Element Example

Contact Element Example

Cyclic Analysis

Cyclic Analysis

Static Cyclic Analysis

Static Cyclic Analysis

Thermal-structural analysis of exhaust manifold

Thermal-structural analysis of exhaust manifold

Plotting and Mesh Access

Plotting and Mesh Access

Structural Analysis of a Lathe Cutter

Structural Analysis of a Lathe Cutter

MAPDL 3D Beam Example

MAPDL 3D Beam Example

MAPDL 2D Beam Example

MAPDL 2D Beam Example

MAPDL modal beam analysis example

MAPDL modal beam analysis example

Path Operations within PyMAPDL and MAPDL

Path Operations within PyMAPDL and MAPDL

Pressure Vessel

Pressure Vessel

PyVista Mesh Integration

PyVista Mesh Integration

CFX pressure data mapping to structural blade

CFX pressure data mapping to structural blade

Running an input file - spotweld SHELL181 example

Running an input file - spotweld SHELL181 example

Torsional load on a bar using SURF154 elements

Torsional load on a bar using SURF154 elements

Example Thermal Transient Analysis

Example Thermal Transient Analysis

Geometry examples#

These examples demonstrate using PyMAPDL to create basic geometry.

Keypoints

Keypoints

Lines

Lines

Areas

Areas

Volumes

Volumes

Primitives

Primitives

Miscellaneous examples#

These examples demonstrate miscellaneous tips and tricks for using PyMAPDL.

Adding a new gallery example

Adding a new gallery example

MAPDL Element Size Transition Example

MAPDL Element Size Transition Example

Using Inline Functions (Query)

Using Inline Functions (Query)

Generating and Extracting Rotational Displacement

Generating and Extracting Rotational Displacement

Binary MAPDL File Explorer

Binary MAPDL File Explorer

Academic finite element examples#

These examples demonstrate finite element method as applicable to Python and MAPDL while emphasising Python libraries such as matplotlib

Build a Finite Element Model

Build a Finite Element Model

PyMAPDL Developer Portal articles#

In this section, you’ll find informative and insightful blog articles crafted by the expert developers at Ansys and published in the Developer Portal. Whether you’re a seasoned pro or just getting started with PyMAPDL, the blog articles cover a wide range of topics, from best practices and tips to in-depth tutorials and real-world use cases. The aim is to provide you with a valuable resource that can help you harness the full potential of PyMAPDL for your engineering and simulation needs.

Because the Developer Portal is your hub for all things related to Ansys products, if you have questions or suggestions, you can go there to connect to Ansys experts and the growing Ansys developer community.

Biomedical catheter design analysis

Analyzing biomedical catheter flexibility using PyMAPDL scripting to assess its flexural rigidity in various designs.

Postprocessing of simplified bolted connections with the help of PyAnsys

Illustrating PyMAPDL’s GUI possibilities for pre-tensioned bolted connections, adhering to industry standards, and data extraction to Excel for analysis.

PyMAPDL examples repository#

The Verification Manual examples and the Technology Showcase examples are hosted in the PyMAPDL Examples repository.

The documentation to these examples can be found in the PyMAPDL Examples documentation.

Verification manual examples#

The Verification Manual examples demonstrate a range of Mechanical APDL elements and capabilities in straightforward problems which have “classical” or readily obtainable theoretical solutions using PyMAPDL.

These problems may then serve as the basis for additional validation and qualification of Mechanical APDL capabilities for specific applications that may be of interest.

The documentation to these examples can be found in the Verification Manual section.

Technology showcase examples#

The PyMAPDL technology showcase examples are more complex test cases than the ones preceding. They demonstrate how to use PyMAPDL to effectively and accurately solve interdisciplinary problems from a variety of industries and engineering fields.

The examples initially come from the APDL Technology Showcase Manual and are modeled with MAPDL files. Some of them have been reproduced in Python files using PyMAPDL with the ansys-mapdl-core library.

The documentation to these examples can be found in the Technology Showcases section.

Extended examples#

These extended examples explain concepts such as interoperability with other programs, libraries, and features in development.

Name

Description

Cart-Pole Simulation

Demonstrates a reinforcement machine learning example using MAPDL through PyMAPDL.

Gmsh example

Demonstrates the interoperability between PyMAPDL and the Gmsh meshing library.

UPF in PyMAPDL

Demonstrates the interoperability between user-programmable functions in MAPDL and Python.

Harmonic analysis using the frequency-sweep Krylov method

Demonstrates the usage of the Krylov method for solving a customized harmonic analysis.

Use Dash to build a PyMAPDL web app

Demonstrates the use of PyMAPDL with Dash.

Create your own Python command-line app

Demonstrates how to create your own Python app with a command-line interface.

Create a GUI app in Python with PySide6

Demonstrates how to create your own GUI app with Python and PySide6

Download example files#

Each example should contain all the necessary resources to run the example. However in some cases, external files are needed. A link to those files is available at each example page. These links refers to the following GitHub repository where you can find all of them:

GitHub Example Data Repository

If you find a missing or broken link, open an issue in GitHub (PyMAPDL Issues).