Animate_mode is not working as expected

Hi

I ve been recently trying to use functionality of Animate_mode, but tbh i found weird how it works, its producing animation as expected, but only contour plot is changing during animation and mesh is not deformed by field. This should look like that, or i am doing sth wrong?

i used example provided in HELP with added "deform_scale_factor=10"

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",deform_scale_factor=10)
Tagged:

Answers

  • M
    M Member, Employee Posts: 244
    50 Answers 100 Comments 100 Likes Second Anniversary
    ✭✭✭✭

    Known issue. You can check in on progress by checking the github link for the issue: https://github.com/ansys/pydpf-core/issues/1032

  • kacper.J
    kacper.J Member Posts: 4
    Name Dropper First Comment
    **

    @M said:
    Known issue. You can check in on progress by checking the github link for the issue: https://github.com/ansys/pydpf-core/issues/1032

    thank you M for that response, do you know when possible solution of that issue will be published ?

  • Landon Mitchell Kanner
    Landon Mitchell Kanner Member, Employee, GitHub-issue-creator Posts: 316
    50 Answers 100 Comments Second Anniversary 25 Likes
    ✭✭✭✭

    Is there any workaround for this issue? Such as converting the displacement to the time domain?

    @Ayush Kumar @AKD-Scripting-Team

  • Ayush Kumar
    Ayush Kumar Member, Moderator, Employee Posts: 467
    100 Answers 250 Likes 100 Comments Second Anniversary
    ✭✭✭✭

    A pull request exists for the Fix, not aware of any workaround.

    https://github.com/ansys/pydpf-core/pull/1696

  • M
    M Member, Employee Posts: 244
    50 Answers 100 Comments 100 Likes Second Anniversary
    ✭✭✭✭
    edited August 14

    This could be done with the python work around I created for a pymapdl example.
    Basically, create a lot of images, use imagio to animate.

    import os, webbrowser
    
    import imageio.v2 as imageio
    from IPython.display import display, clear_output
    subfolder = 'figs'
    if subfolder not in os.listdir():
        os.mkdir(subfolder)
    
    picList = []
    for ctr in range(10):
        fileName = os.path.join(jobLocation, subfolder , 'file' + str(ctr) + '.jpg')
        picList.append(fileName)
        result.plot_nodal_displacement(0, cpos='xy',off_screen=True,displacement_factor  = ctr*1000,show_displacement = True, show_edges=True, screenshot=fileName)
        clear_output()
    myfile = 'myAnime.mp4'
    
    aniSave = os.path.join(jobLocation, myfile)
    images = []
    for filename in picList:
        images.append(imageio.imread(filename))
    imageio.mimsave(aniSave, images)
    myfile = 'myAnime.mp4'
    writer = imageio.get_writer(myfile, fps=40)
    
    for im in picList:
        writer.append_data(imageio.imread(im))
    writer.close()
    
    import webbrowser
    webbrowser.open(aniSave)