Perform operations with load cases in PyMAPDL

perepalacin
perepalacin Member Posts: 5
First Comment Name Dropper
**
edited June 6 in Structures

Greetings guys!

I have a simulation that I ran on Mechanical of a solid with a preload step. I would like to be able to substract that step in all steps results after the initial preload.

In Ansys Mechanical this is fairly easy to accomplish using Solution Combinations, but I am wondering if there would be any similar way to do this in PyMAPDL, even if it involves performing operations with post_processing methods and such.

Best regards,

Pere

Tagged:

Answers

  • Mike Rife
    Mike Rife Member, Employee Posts: 50
    First Anniversary 5 Likes First Answer 10 Comments
    ✭✭✭✭

    Hi Pere
    The answer is in the title of your post - Load Cases. See the MAPDL documentation here for more information. Once created load cases can be combined in a variety of ways. For reuse they can be saved (more like saving instructions on what to do). Or the combined result can be written (appended) to the result file if you need to share the combined result with someone.
    Mike

  • perepalacin
    perepalacin Member Posts: 5
    First Comment Name Dropper
    **

    Thanks a lot!
    I found that section of the docs but I didn't quite manage to make it work, so I thought it wasn't what I was looking for. Thanks for pointing me back in the right direction. It works!

    Thanks!

    For anyone having the same question in the future, here is a code sample in PyMAPDL:

        mapdl.post1()
        mapdl.file(rst_file_path)
    
        mapdl.set(2) # Load time step 2 into the memory
        mapdl.lcdef("1", "1") # Define time step 1 as loadstep "1"
        mapdl.lcoper("SUB", "1") # Substract the loadstep "1" from time step 2 (so time step 2 - time step 1)
        mapdl.rappnd("3", "3") # Append this new load step into the rst file 
    
        mapdl.allsel()
        mapdl.set(3) # Select the newly created load step
    
        mapdl.post_processing.plot_nodal_eqv_stress(cpos='xy',
            background='white',
            edge_color='black',
            show_edges=True,
            cmap = 'jet',
            n_colors=9
        )  # Plot the equivalent stresses of the new step
    
  • Mike.Thompson
    Mike.Thompson Member, Employee Posts: 330
    25 Answers First Anniversary 100 Comments 25 Likes
    ✭✭✭✭

    I would also recommend using PyDPF for post processing and you can do many operations like addition, subtraction etc... based on different time points in a results file, or sets across multiple results files.