Perform operations with load cases in PyMAPDL

perepalacin Member Posts: 5
Name Dropper First Comment
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,




  • Mike Rife
    Mike Rife Member, Employee Posts: 38
    First Answer 5 Likes First Anniversary First Comment

    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.

  • perepalacin
    perepalacin Member Posts: 5
    Name Dropper First Comment

    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!


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

        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.set(3) # Select the newly created load step
            cmap = 'jet',
        )  # Plot the equivalent stresses of the new step
  • Mike.Thompson
    Mike.Thompson Member, Employee Posts: 283
    First Anniversary First Comment 5 Likes Ansys Employee

    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.