Note
Go to the end to download the full example code.
Extract multi-stage cyclic results#
In this script, a multi-stage modal analysis with cyclic symmetry is processed to show how to expand the mesh and results.
Perform required imports#
This example uses a supplied file that you can
get by importing the DPF examples
package.
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_multi_stage_cyclic_result()
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/multistage/multistage.rst
DPF Model
------------------------------
Modal analysis
Unit system: MKS: m, kg, N, s, V, A, degC
Physics Type: Mechanical
Available results:
- displacement: Nodal Displacement
- stress: ElementalNodal Stress
- elastic_strain: ElementalNodal Strain
- element_euler_angles: ElementalNodal Element Euler Angles
- structural_temperature: ElementalNodal Structural temperature
------------------------------
DPF Meshed Region:
3595 nodes
1557 elements
Unit: m
With solid (3D) elements
------------------------------
DPF Time/Freq Support:
Number of sets: 6
Cumulative Frequency (Hz) LoadStep Substep Harmonic index
1 188.385357 1 1 0.000000
2 325.126418 1 2 0.000000
3 595.320548 1 3 0.000000
4 638.189511 1 4 0.000000
5 775.669703 1 5 0.000000
6 928.278013 1 6 0.000000
Extract expanded displacement norm#
displacement_norm = simulation.displacement(
norm=True,
expand_cyclic=True,
)
print(displacement_norm)
displacement_norm.plot()
results U_N (m)
set_ids 1
node_ids
1376 5.2953e-02
4971 5.2953e-02
7191 5.2953e-02
9411 5.2953e-02
11631 5.2953e-02
13851 5.2953e-02
... ...
Extract equivalent von Mises nodal stress without expansion#
stress_vm_sector_1_both_stages = simulation.stress_eqv_von_mises_nodal(
expand_cyclic=False,
)
print(stress_vm_sector_1_both_stages)
stress_vm_sector_1_both_stages.plot()
results S_VM (Pa)
set_ids 1
base_sector 1
stage 1
node_ids
1460
1622
1644
1660
1490
1596
... ...
Extract equivalent von Mises nodal stress expanded on the first four sectors of the first stage#
stress_vm_sectors_1_2_3_4_first_stage = simulation.stress_eqv_von_mises_nodal(
expand_cyclic=[1, 2, 3, 4],
)
print(stress_vm_sectors_1_2_3_4_first_stage)
stress_vm_sectors_1_2_3_4_first_stage.plot()
results S_VM (Pa)
set_ids 1
node_ids
5071 6.2894e+09
5218 6.9084e+09
1644 8.0643e+09
1660 8.5795e+09
7291 6.2894e+09
7438 6.9084e+09
... ...
Extract equivalent von Mises nodal stress expanded on the first two sectors of both stages#
stress_vm_sectors_1_2_both_stages = simulation.stress_eqv_von_mises_nodal(
expand_cyclic=[[1, 2], [1, 2]],
)
print(stress_vm_sectors_1_2_both_stages)
stress_vm_sectors_1_2_both_stages.plot()
results S_VM (Pa)
set_ids 1
node_ids
5071 6.2894e+09
5218 6.9084e+09
1644 8.0643e+09
1660 8.5795e+09
7291 6.8763e+09
7438 7.0456e+09
... ...
Total running time of the script: (0 minutes 2.869 seconds)