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
print(shaft.element_components.keys())
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,
    color="k",
)
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,
    scalar_bar_args={"title": ""},
    overlay_wireframe=True,
    cpos=cpos,
)
load shaft result

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,
    overlay_wireframe=True,
    cpos=cpos,
)
load shaft result

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,
    n_colors=12,
    show_edges=True,
    cpos=cpos,
    loop=False,
    movie_filename="demo.gif",
    n_frames=30,
    show_axes=False,
    add_text=False,
)
load shaft result
[(-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 7.186 seconds)

Gallery generated by Sphinx-Gallery