How to extract the first 6 major mass participation factor modes and create a .gif using pydpf

Karthick RAJAN
Karthick RAJAN Member Posts: 14
Name Dropper First Comment
**

To extract the first 6 major mass participation factor modes and create a .gif using pydpf with 50x animation scale factor when .rst file is provided

Tagged:

Answers

  • Pernelle Marone-Hitz
    Pernelle Marone-Hitz Member, Moderator, Employee Posts: 913
    100 Answers 500 Comments 250 Likes Second Anniversary
    ✭✭✭✭

    Hi @Karthick RAJAN , the purpose of this forum is not to provide fully developed script, but help users develop their own scripts. Please have a look at the PyDPF documentation, I believe this example is almost exactly what you are trying to do: https://dpf.docs.pyansys.com/version/stable/examples/02-modal_analyses/01-plot_and_animate_modes.html

  • Karthick RAJAN
    Karthick RAJAN Member Posts: 14
    Name Dropper First Comment
    **

    Hello @Pernelle Marone-Hitz, I have gone through these examples indeed before posting it. While going through, I had few queries

    from ansys.dpf.core import operators as ops, animation
    import ansys.dpf.core as dpf

    def ModeShapeExtraction(model):
    model = dpf.Model(model)
    print(model.metadata.result_info)
    # Extract the displacement results which define mode shapes
    disp = model.results.displacement.on_all_time_freqs.eval()
    userinput = int(input("Enter the number of modes you want to animate: "))
    for i in range(userinput):
    animation.animate_mode(disp, mode_number=i+1,save_as=f"Mode_{i+1}.gif", off_screen=True, deform_scale_factor=50.0)
    print(f"Mode_{i+1} extracted_successfully")

    inputpath = input("Enter the path of the result file : ")
    ModeShapeExtraction(inputpath.strip('"'))

    1. Deform scale factor is not working even after assigning some values
    2. Can we able to access Mass Participation factor in .rst from the outputs we get from dpf once it loads? because under available results, we dont have the option directly
  • Pernelle Marone-Hitz
    Pernelle Marone-Hitz Member, Moderator, Employee Posts: 913
    100 Answers 500 Comments 250 Likes Second Anniversary
    ✭✭✭✭

    Hello @Karthick RAJAN , with these specific questions, we can help.

    • If the deform scale factor of animate_mode() is not working, please report this as an issue in Github. You can do this directly from the forum by clicking here:

      (I quickly tested this and saw the same problem)

    • For mass participation factor, please read this post: https://discuss.ansys.com/discussion/762/how-can-i-extract-participation-factors-of-a-modal-analysis . An operator was recently introduced to read modal participation factors from the mode file:
      ansys.dpf.core.operators.result.spectrum_data.spectrum_data

  • Karthick RAJAN
    Karthick RAJAN Member Posts: 14
    Name Dropper First Comment
    **

    Hello @Pernelle Marone-Hitz Thank you for the response.

    I could be able to get Mass participation factor after adding the .mode file along with .rst.
    But I still face the issue of not getting the animation scale factor in the output .gif file.

    The animation file countour changes, but there is no deformation/warping of nodes

    @Rajesh Meena , @Ayush Kumar Could you please help me on this!

  • Pernelle Marone-Hitz
    Pernelle Marone-Hitz Member, Moderator, Employee Posts: 913
    100 Answers 500 Comments 250 Likes Second Anniversary
    ✭✭✭✭

    @Karthick RAJAN As mentioned, I believe the issue with the animation is a bug, please report it on Github.

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

    @Karthick RAJAN @Pernelle Marone-Hitz For issue with animation gif file, This issue have been reported in the past as well ( #1032, #1644 ). I fixed this issue last year myself with this PR but not sure why this is not merged in pydpf yet. I will check that.