November 1, 2023 at 11:14 am
Subscriber
Hi Erik, thank you for responding.
It think it works in MAPDL itself, but when tested with PyMAPDL, it now only solves the first loadstep. Figure 1 is what the codes returns, while it is supposed to look like figure 2 after the second load step. (Figure 2 is created without going into POST26 and without restarting the solution)
This is the code I run now:
mapdl.slashsolu()
mapdl.keep(1)
#mapdl.d(20, "ALL")
mapdl.d(20, "ROTY")
mapdl.d(20, "ROTZ")
#mapdl.d(20, "ROTX")
timesteps = 2
substeps = 10
substeps_max = 10
substeps_min = 10
mapdl.run("ANTYPE, TRANS")
mapdl.timint("ON")
mapdl.autots("OFF")
mapdl.nsubst(substeps, substeps_max, substeps_min)
mapdl.outres("ALL", "ALL")
mapdl.kbc(1)
#mapdl.d(20, "ALL")
mapdl.d(20, "ROTY")
mapdl.d(20, "ROTZ")
#mapdl.d(20, "ROTX")
mapdl.f(1, "MX", 10)
mapdl.time(1)
mapdl.lswrite(1)
mapdl.solve()
mapdl.post26()
rot_displ = mapdl.nsol(2, 1, "ROT", "X", "ROTX")
#print(rot_displ)
mapdl.allsel("all")
mapdl.finish
mapdl.parsav("all","my_par","txt")
mapdl.slashsolu()
mapdl.antype(4,"REST")
mapdl.timint("ON")
mapdl.autots("OFF")
mapdl.parres("new","my_par","txt")
mapdl.f(1, "MX", -10)
mapdl.slashsolu()
mapdl.time(2)
mapdl.lswrite(2)
mapdl.solve()
mapdl.post26()
rot_displ = mapdl.nsol(2, 1, "ROT", "X", "ROTX")
#print(rot_displ)
# Plot nodal displacement against time
plt.plot( rot_displ, marker='o', linestyle='-')
plt.xlabel('Time (seconds)')
plt.ylabel('Nodal rotation')
plt.title('Nodal rotation vs. Time')
plt.grid(True)
plt.show()
mapdl.exit()