Create animation(.gif) by using the PyDPF.

Options
Gopi Raju Velpula
Gopi Raju Velpula Member Posts: 12
Name Dropper First Comment Photogenic

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: 12
    Name Dropper First Comment Photogenic
    edited May 21
    Options

    @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: 77
    First Anniversary Solution Developer Community of Practice Member Ansys Employee 5 Likes
    Options

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

  • Gopi Raju Velpula
    Gopi Raju Velpula Member Posts: 12
    Name Dropper First Comment Photogenic
    Options

    @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
    )