Reduce Cyclic Model Size by using Mesh External Layer for Result and Mesh extraction#

This example displays post-processing on a mesh external layer for a cyclic modal analysis. The external layer is the layer of solid elements with at least one facet facing the outside of the geometry. This feature is available for all types of Mechanical simulation supporting cyclic (or cyclic multistage) and allows you to reduce the size of the mesh and of the extracted data to improve processing performance. Since larger stress and strains are usually located on the skin of a model, computing results on the external layer gives equivalent maximum values in most cases.

Perform required imports#

This example uses a supplied file that you can get using the examples module.

from ansys.dpf import post
from ansys.dpf.post import examples

Get Simulation object#

Get the Simulation object that allows access to the result. The Simulation object must be instantiated with the path for the result file. For example, "C:/Users/user/my_result.rst" on Windows or "/home/user/my_result.rst" on Linux.

example_path = examples.download_modal_cyclic()
simulation = post.ModalMechanicalSimulation(example_path)

# print the simulation to get an overview of what's available
print(simulation)
Modal Mechanical Simulation.


Data Sources
------------------------------
/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/ansys/dpf/core/examples/result_files/cyclic/modal_cyclic.rst

DPF Model
------------------------------
Modal analysis
Unit system: MKS: m, kg, N, s, V, A, degC
Physics Type: Mechanical
Available results:
     -  displacement: Nodal Displacement
     -  reaction_force: Nodal Force
     -  stress: ElementalNodal Stress
     -  elastic_strain: ElementalNodal Strain
     -  element_euler_angles: ElementalNodal Element Euler Angles
------------------------------
DPF  Meshed Region:
  928 nodes
  3836 elements
  Unit: m
  With solid (3D) elements
------------------------------
DPF  Time/Freq Support:
  Number of sets: 48
Cumulative     Frequency (Hz) LoadStep       Substep        Harmonic index
1              51369.575105   1              1              0.000000
2              114291.419744  1              2              0.000000
3              238849.856755  1              3              0.000000
4              254031.324493  1              4              0.000000
5              337729.470910  1              5              0.000000
6              348699.692284  1              6              0.000000
7              51970.152101   2              1              1.000000
8              51970.152101   2              2              -1.000000
9              126647.471593  2              3              -1.000000
10             126647.471593  2              4              1.000000
11             239807.889703  2              5              -1.000000
12             239807.889703  2              6              1.000000
13             54198.644112   3              1              2.000000
14             54198.644112   3              2              -2.000000
15             157264.852222  3              3              -2.000000
16             157264.852222  3              4              2.000000
17             242073.194077  3              5              -2.000000
18             242073.194077  3              6              2.000000
19             59105.565170   4              1              3.000000
20             59105.565170   4              2              -3.000000
21             194873.849513  4              3              -3.000000
22             194873.849513  4              4              3.000000
23             241988.808784  4              5              3.000000
24             241988.808784  4              6              -3.000000
25             67744.544169   5              1              4.000000
26             67744.544169   5              2              -4.000000
27             218600.039108  5              3              -4.000000
28             218600.039108  5              4              4.000000
29             229679.308122  5              5              4.000000
30             229679.308122  5              6              -4.000000
31             80576.477155   6              1              5.000000
32             80576.477155   6              2              -5.000000
33             192985.645574  6              3              -5.000000
34             192985.645574  6              4              5.000000
35             245990.772448  6              5              5.000000
36             245990.772448  6              6              -5.000000
37             97381.706833   7              1              6.000000
38             97381.706833   7              2              -6.000000
39             166306.784163  7              3              -6.000000
40             166306.784163  7              4              6.000000
41             259986.167834  7              5              6.000000
42             259986.167834  7              6              -6.000000
43             117422.022015  8              1              7.000000
44             117422.022015  8              2              -7.000000
45             141309.163007  8              3              -7.000000
46             141309.163007  8              4              7.000000
47             273449.890447  8              5              -7.000000
48             273449.890447  8              6              7.000000

Extract displacement data#

Extract displacement data on the external layer.

displacement_ext = simulation.displacement(external_layer=True)
print(displacement_ext)
displacement_ext.plot()
03 cyclic mesh external layer
            results       U (m)
            set_ids           1
node_ids components
     225          X  4.7760e-02
                  Y  2.2679e+01
                  Z -1.4026e-02
    1153          X  3.7926e-02
                  Y  2.2679e+01
                  Z -3.2239e-02
     ...        ...         ...

Select sectors for expansion#

Extract displacement data on the external layer for a cyclic expansion on a selected number of sectors.

displacement_ext = simulation.displacement(external_layer=True, expand_cyclic=[1, 2, 3])
displacement_ext.plot()
03 cyclic mesh external layer

Extract stress/strain data#

Extract stress or elastic strain data on the external layer. Averaging, and invariants computation can easily be done on the external layer since the connectivity of the kept elements remains unchanged.

elemental_stress_ext = simulation.stress_principal_elemental(
    components=[1], external_layer=True
)
elemental_stress_ext.plot()

elastic_strain_eqv_ext = simulation.elastic_strain_eqv_von_mises_nodal(
    external_layer=True
)
elastic_strain_eqv_ext.plot()
  • 03 cyclic mesh external layer
  • 03 cyclic mesh external layer

Get stress results on the external layer of the first sector with a cyclic phase#

stress_eqv_cyc_phase = simulation.stress_eqv_von_mises_nodal(
    set_ids=[5],
    expand_cyclic=[1],
    phase_angle_cyclic=45.0,
    external_layer=True,
)
stress_eqv_cyc_phase.plot()
03 cyclic mesh external layer

Total running time of the script: (0 minutes 6.849 seconds)

Gallery generated by Sphinx-Gallery