ansys.dpf.core.animation.animate_mode(fields_container, mode_number=1, type_mode=0, frame_number=None, save_as='', deform_scale_factor=1.0, **kwargs)#

Creates a modal animation based on Fields contained in the FieldsContainer.

This method creates a movie or a gif based on the time ids of a FieldsContainer. For kwargs see pyvista.Plotter.open_movie/add_text/show.

Parameters:
  • field_container – Field container containing the modal results.

  • mode_number (int, optional) – Mode number of the results to animation. The default is 1.

  • type_mode (int, optional) – Whether it is 0 or 1. Default to 0. If 0, the norm of the displacements will be scaled from 1 to -1 to 1. If 1, the norm of the displacements will be scaled between -1 and 1.

  • save_as (Path of file to save the animation to. Defaults to None. Can be of any format) – supported by pyvista.Plotter.write_frame (.gif, .mp4, …).

  • deform_scale_factor (float, optional) – Scale factor to apply when warping the mesh. Defaults to 1.0.

Examples

Import a modal result from a model.

>>> import ansys.dpf.core as dpf
>>> from ansys.dpf.core import examples
>>> model = dpf.Model(examples.download_modal_frame())
>>> disp = model.results.displacement.on_all_time_freqs.eval()

Creates an animation from a modal result.

>>> from ansys.dpf.core import animation
>>> animation.animate_mode(disp, mode_number=1, save_as="tmp.gif")