Note
Go to the end to download the full example code.
Shaft Modal Analysis#
Visualize a shaft modal analysis
# sphinx_gallery_thumbnail_number = 6
from ansys.mapdl.reader import examples
# Download an example shaft modal analysis result file
shaft = examples.download_shaft_modal()
Mesh is stored within the result object
print(shaft.mesh)
ANSYS Mesh
Number of Nodes: 27132
Number of Elements: 25051
Number of Element Types: 6
Number of Node Components: 4
Number of Element Components: 3
…and contains a VTK unstructured grid
print(shaft.mesh._grid)
None
Plot the shaft
cpos = shaft.plot()
# list shaft node components
![load shaft result](../../_images/sphx_glr_load_shaft_result_001.png)
print(shaft.element_components.keys())
dict_keys(['EBC1', 'EBC2', 'SHAFT_MESH'])
Plot a node component
This camera angle was saved interactively from shaft.plot
![load shaft result](../../_images/sphx_glr_load_shaft_result_002.png)
Plot a node component as a wireframe
![load shaft result](../../_images/sphx_glr_load_shaft_result_003.png)
Plot the shaft with edges and with a blue color
shaft.plot(show_edges=True, color="cyan")
![load shaft result](../../_images/sphx_glr_load_shaft_result_004.png)
Plot the shaft without lighting but with edges and with a blue color
shaft.plot(lighting=False, show_edges=True, color="cyan")
![load shaft result](../../_images/sphx_glr_load_shaft_result_005.png)
plot a mode shape without contours using the “bwr” color map
![load shaft result](../../_images/sphx_glr_load_shaft_result_006.png)
/home/runner/work/pymapdl-reader/pymapdl-reader/.venv/lib/python3.10/site-packages/pyvista/plotting/_plotting.py:286: PyVistaDeprecationWarning:
"stitle" is a deprecated keyword argument and will be removed in a future
release.
Use ``scalar_bar_args`` instead. For example:
scalar_bar_args={'title': 'Scalar Bar Title'}
warnings.warn(USE_SCALAR_BAR_ARGS, PyVistaDeprecationWarning)
plot a mode shape with contours and the default colormap
![load shaft result](../../_images/sphx_glr_load_shaft_result_007.png)
/home/runner/work/pymapdl-reader/pymapdl-reader/.venv/lib/python3.10/site-packages/pyvista/plotting/_plotting.py:286: PyVistaDeprecationWarning:
"stitle" is a deprecated keyword argument and will be removed in a future
release.
Use ``scalar_bar_args`` instead. For example:
scalar_bar_args={'title': 'Scalar Bar Title'}
warnings.warn(USE_SCALAR_BAR_ARGS, PyVistaDeprecationWarning)
Animate a mode of a component the shaft
Set loop==True
to plot continuously.
Disable movie_filename
and increase n_frames
for a smoother plot
![load shaft result](../../_images/sphx_glr_load_shaft_result_008.gif)
[(-115.35773008378118, 285.36602704380107, -393.9029392590675),
(126.12852038381345, 0.2179228023931401, 5.236408799851887),
(0.3724622281297882, 0.8468424028124544, 0.37964435122285484)]
Total running time of the script: (0 minutes 12.042 seconds)