Create animation(.gif) by using the PyDPF.

Gopi Raju Velpula
Gopi Raju Velpula Member Posts: 28
10 Comments First Anniversary First Answer Name Dropper
**

please let me know can i able to create the animation for "transient Fluid simulation problems". i have fluent project file(.flprj)
when i try to create an animation for 100 timesteps i just getting first time step frame only.. but i need to create the animation .gif file for the timesteps from 1to 100.
i have been use the time scoping as well but still not getting what i required.
Anyone please provide any solution for this.

Tagged:

Comments

  • Gopi Raju Velpula
    Gopi Raju Velpula Member Posts: 28
    10 Comments First Anniversary First Answer Name Dropper
    **
    edited May 2024

    @Rajesh Meena please let me know by using DPF can i create the animation for all timesteps in transient simulations.

  • Rajesh Meena
    Rajesh Meena Moderator, Employee Posts: 132
    100 Comments 25 Likes Second Anniversary 5 Answers
    ✭✭✭✭

    @Gopi Raju Velpula Since you have solution now. Please post it here.

  • Gopi Raju Velpula
    Gopi Raju Velpula Member Posts: 28
    10 Comments First Anniversary First Answer Name Dropper
    **

    @Rajesh Meena sure ...
    I have made an animation (.gif) file for each time step in a transient simulation using the DPF code below.

    from ansys.dpf import core as dpf
    model = dpf.Model('first.flprj')
    mesh_scoping = dpf.mesh_scoping_factory.face_scoping(model.metadata.meshed_region.faces.scoping)
    time_scoping = dpf.time_freq_scoping_factory.scoping_on_all_time_freqs(model)
    mass_flow = model.results.mass_flow_rate
    mass_flow = mass_flow.on_time_scoping(time_scoping)
    mass_flow = mass_flow.on_mesh_scoping(mesh_scoping)
    mass_flow_fields = mass_flow.eval()
    print(mass_flow_fields)
    cpos1 = [(0.5998,0.57,2.909656),(0.5998,0.57,0),(0,1,0)]
    varying_scale_factor = [i for i in range(len(mass_flow_fields))]
    print(varying_scale_factor)
    mass_flow_fields.animate(show_scalar_bar=False,
    save_as='tmp.gif',
    framerate = 1,
    quality = 8,
    freq_kwargs={"font_size": 0},
    cpos=cpos1,
    off_screen = True,
    show_axes = False
    )

  • Yogesh Bavge
    Yogesh Bavge Member, Employee Posts: 2
    First Anniversary Name Dropper First Comment
    ✭✭✭

    @Gopi Raju Velpula any idea , how can we switch of the mesh from gif ?

  • Gopi Raju Velpula
    Gopi Raju Velpula Member Posts: 28
    10 Comments First Anniversary First Answer Name Dropper
    **

    Hello @Yogesh Bavge use "show_edges=False" it will switch of the mesh.