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)

Out:

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)

Out:

None

Plot the shaft

cpos = shaft.plot()

# list shaft node components
load shaft result
print(shaft.element_components.keys())

Out:

dict_keys(['EBC1', 'EBC2', 'SHAFT_MESH'])

Plot a node component

This camera angle was saved interactively from shaft.plot

cpos = [(-115.35773008378118, 285.36602704380107, -393.9029392590675),
        (126.12852038381345, 0.2179228023931401, 5.236408799851887),
        (0.37246222812978824, 0.8468424028124546, 0.37964435122285495)]
shaft.plot(element_components=['SHAFT_MESH'], cpos=cpos)
# get cpos from cpos = shaft.plot()
load shaft result

Plot a node component as a wireframe

shaft.plot(element_components=['SHAFT_MESH'], cpos=cpos, style='wireframe',
           lighting=False)
load shaft result

Plot the shaft with edges and with a blue color

shaft.plot(show_edges=True, color='cyan')
load shaft result

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

plot a mode shape without contours using the “bwr” color map

shaft.plot_nodal_solution(9, element_components=['SHAFT_MESH'],
                          show_displacement=True, cmap='bwr',
                          displacement_factor=0.3, stitle=None,
                          overlay_wireframe=True, cpos=cpos)
load shaft result

Out:

/opt/hostedtoolcache/Python/3.9.6/x64/lib/python3.9/site-packages/pyvista/plotting/plotting.py:1795: PyvistaDeprecationWarning:
"stitle" is a depreciated keyword 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

shaft.plot_nodal_solution(1, element_components=['SHAFT_MESH'],
                          n_colors=10, show_displacement=True,
                          displacement_factor=1, stitle=None,
                          overlay_wireframe=True, cpos=cpos)
load shaft result

Out:

/opt/hostedtoolcache/Python/3.9.6/x64/lib/python3.9/site-packages/pyvista/plotting/plotting.py:1795: PyvistaDeprecationWarning:
"stitle" is a depreciated keyword 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

shaft.animate_nodal_solution(5, element_components='SHAFT_MESH',
                             comp='norm', displacement_factor=1,
                             show_edges=True, cpos=cpos,
                             loop=False, movie_filename='demo.gif',
                             n_frames=30)
load shaft result

Out:

Rendering animation:   0%|          | 0/30 [00:00<?, ?it/s]
Rendering animation:   3%|3         | 1/30 [00:00<00:09,  3.12it/s]
Rendering animation:   7%|6         | 2/30 [00:00<00:07,  3.95it/s]
Rendering animation:  10%|#         | 3/30 [00:00<00:06,  4.34it/s]
Rendering animation:  13%|#3        | 4/30 [00:00<00:05,  4.46it/s]
Rendering animation:  17%|#6        | 5/30 [00:01<00:05,  4.51it/s]
Rendering animation:  20%|##        | 6/30 [00:01<00:05,  4.55it/s]
Rendering animation:  23%|##3       | 7/30 [00:01<00:04,  4.66it/s]
Rendering animation:  27%|##6       | 8/30 [00:01<00:04,  4.70it/s]
Rendering animation:  30%|###       | 9/30 [00:02<00:04,  4.62it/s]
Rendering animation:  33%|###3      | 10/30 [00:02<00:04,  4.59it/s]
Rendering animation:  37%|###6      | 11/30 [00:02<00:04,  4.67it/s]
Rendering animation:  40%|####      | 12/30 [00:02<00:03,  4.78it/s]
Rendering animation:  43%|####3     | 13/30 [00:02<00:03,  4.78it/s]
Rendering animation:  47%|####6     | 14/30 [00:03<00:03,  4.77it/s]
Rendering animation:  50%|#####     | 15/30 [00:03<00:03,  4.74it/s]
Rendering animation:  53%|#####3    | 16/30 [00:03<00:02,  4.77it/s]
Rendering animation:  57%|#####6    | 17/30 [00:03<00:02,  4.81it/s]
Rendering animation:  60%|######    | 18/30 [00:03<00:02,  4.87it/s]
Rendering animation:  63%|######3   | 19/30 [00:04<00:02,  4.95it/s]
Rendering animation:  67%|######6   | 20/30 [00:04<00:02,  4.92it/s]
Rendering animation:  70%|#######   | 21/30 [00:04<00:01,  4.86it/s]
Rendering animation:  73%|#######3  | 22/30 [00:04<00:01,  4.86it/s]
Rendering animation:  77%|#######6  | 23/30 [00:04<00:01,  4.90it/s]
Rendering animation:  80%|########  | 24/30 [00:05<00:01,  4.93it/s]
Rendering animation:  83%|########3 | 25/30 [00:05<00:01,  4.96it/s]
Rendering animation:  87%|########6 | 26/30 [00:05<00:00,  4.99it/s]
Rendering animation:  90%|######### | 27/30 [00:05<00:00,  4.99it/s]
Rendering animation:  93%|#########3| 28/30 [00:05<00:00,  4.97it/s]
Rendering animation:  97%|#########6| 29/30 [00:06<00:00,  4.95it/s]
Rendering animation: 100%|##########| 30/30 [00:06<00:00,  5.00it/s]
Rendering animation: 100%|##########| 30/30 [00:06<00:00,  4.65it/s]

[(-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 9.799 seconds)

Gallery generated by Sphinx-Gallery