Get the solution MAPDL details
M
Member, Employee Posts: 244
✭✭✭✭
I am trying to get the time and memory results out of a solution details.
Does anyone know if this is possible?
Tagged:
2
Answers
-
@Bruno Gaudin had created an ACT extension to retrieve the different computed times
2 -
@Pernelle Marone-Hitz import time is possible for the time (which should match the mapdl time), I am interested in the rest of the data also.
0 -
The script below can be used in a button to set a timer for your analyses.
# Report Time clr.AddReference("Ans.UI.Toolkit.Base") clr.AddReference("Ans.UI.Toolkit") from Ansys.UI.Toolkit import * import time start = time.time() for a in Model.Analyses: a.Solution.ClearGeneratedData() for a in Model.Analyses: a.Solve() totalTime = 0 totalResultFileSizeInBytes = 0 totalMemoryInBytes = 0 for SYS in Model.Analyses: for SOL in SYS.Children: if SOL.Name == 'Solution': totalTime = totalTime + SOL.MainThreadCPUTime totalResultFileSizeInBytes = totalResultFileSizeInBytes + SOL.ResultFileSize totalMemoryInBytes = totalMemoryInBytes + SOL.MemoryUsed Ptime = str(round((time.time()-start)/60,2)) Mtime = str(round(totalTime/60,2)) FileSizeMB = str(round(totalResultFileSizeInBytes/1e6)) Memory = str(round(totalMemoryInBytes/1e6)) mess_line1 = 'Clock time: ' + Ptime + ' minutes \n' mess_line2 = 'MAPDL time: ' + Mtime + ' minutes \n' mess_line3 = 'File size : ' + FileSizeMB + ' MB \n' mess_line4 = 'Memory used : ' + Memory + ' MB \n' MessageBox.Show(mess_line1+mess_line2+mess_line3+mess_line4)
4 -
in 2021R1 I got no issue :
solution=ExtAPI.DataModel.Project.Model.Analyses[0].Solution solution.ElapsedRunTime solution.MemoryUsed solution.ResultFileSize
4