Examples#

Here is a series of examples using Mechanical with the PyMechanical. Examples are organized by the mode they use:

  • Embedding mode examples use the App class for direct object model access.

  • Remote session mode examples use the launch_mechanical() and run_python_script() methods.

If you are not sure which mode to use, see Choose your mode.

Important

Some examples use Mechanical features that require a specific license level. For example, harmonic acoustics is not available with an Ansys Mechanical Pro license. If an example fails, verify that your Mechanical license supports all analyses and features used by the example. A license-related failure does not necessarily indicate a problem with your PyMechanical setup. For information on inspecting and selecting licenses, see License management.

Basic examples: Embedding mode#

This section demonstrates the basic simulation capabilities of PyMechanical.

Bolt pretension

Bolt pretension

Steady State Thermal Analysis of cooling holes on a representative model

Steady State Thermal Analysis of cooling holes on a representative model

Fracture analysis - contact debonding

Fracture analysis - contact debonding

Harmonic acoustic analysis

Harmonic acoustic analysis

Modal acoustics analysis

Modal acoustics analysis

Steady state thermal analysis

Steady state thermal analysis

Topology optimization of a simple cantilever beam

Topology optimization of a simple cantilever beam

Basic valve implementation

Basic valve implementation

Gallery generated by Sphinx-Gallery

Advanced examples: embedding mode#

This section contains examples that demonstrate advanced capabilities of Mechanical using PyMechanical in embedding mode (App class). For more information, see Advanced examples: embedding mode.

Basic examples: Remote session mode#

Remote session examples demonstrate the simulation capabilities of Mechanical using remote session mode. This consists of using either the launch_mechanical() or run_python_script() methods.

For more information, see Remote sessions examples.