One of the cool features in the ANSYS Workbench is the ability to set up a design study and kick off a bunch of runs that bring back key parameters. This is great for a design exploration but sometimes you actually would like a result plot, or maybe the info in a text file as well. When a design study is done, unless you tell Workbench to save all your run files, it deletes all the files.
To do the posting on ICEM CFD in the workbench project page, I needed to do just that, so I thought I would share my method in case others want to use it.
The way I do it is pretty simple:
- Use a /INQUIRE to get the directory the run is running in
- Use some string functions to get the name of the design point from the directory name
- Temporarily change the jobname
- Save my plots
- Change the jobname back to file
- Copy the files to the User_Files directory.
Here is what it looks like:
5: ii = strpos(aa(1),'dp')
6: ij = strpos(aa(ii+1),'')-1
7: dpn = strsub(aa(1),ii+1,ij)
8: dpn = strcat(dpn,'_')
17: /sys,copy *.png ......user_files
See how it uses /inquire to get the directory, then strpos(), strsub(), and strcat() to get the design point name. Then it simply changes the file name, does a /show,png and plots. The results are copied using a system command.
Two important things to note:
- You have to do the set command before you change the jobname, otherwise your RST files will not work
- This version is written for windows, you need to use forward slashes and cp for Linux.
You can attach this to a MAPDL system or as a code snippet.