How to run all the Verification Manual examples using PyMAPDL?

Options
Rohith Patchigolla
Rohith Patchigolla Member, Moderator, Employee Posts: 130
First Answer First Anniversary Name Dropper Solution Developer Community of Practice Member

I would like to run all the VM examples one after the another using a single license. Is it possible?

Tagged:

Comments

  • Rohith Patchigolla
    Rohith Patchigolla Member, Moderator, Employee Posts: 130
    First Answer First Anniversary Name Dropper Solution Developer Community of Practice Member
    Options

    One could try using the below script to run through all the verification manual examples in PyMAPDL.

    from ansys.mapdl.core import launch_mapdl
    from ansys.mapdl.core.examples import vmfiles
    import os
    
    #Inputs
    #Path where the outputs for each VM are saved
    savepath = r"D:\Python\vm_output"
    
    #First and last VMs to solve 
    start_vm = 1
    end_vm = 320
    
    mapdl = launch_mapdl()
    
    for vm_num in range(start_vm,end_vm+1):
        mapdl.clear()
        print("vm"+str(vm_num))
        output = mapdl.input(vmfiles["vm" + str(vm_num)])
        filename = "output_vm_" + str(vm_num) + ".txt"
        fullpath = os.path.join(savepath,filename)
        with open(fullpath, "w") as file:
            file.write(output)
        mapdl.finish()
    mapdl.exit()