The goal of this post is to demonstrate how to use ANSYS RSM to submit a ANSYS MAPDL task to the ANSYS RSM local queue, but this procedure could be extended to run any kind of task.
First, worth to grab from the ANSYS documentation the definition of RSM:
The Remote Solve Manager (RSM) is a job queuing system that distributes tasks that require computing resources. RSM enables tasks to be run in background mode on the local machine, sent to a remote machine for processing, or tasks can be broken into a series of jobs for parallel processing across a variety of computers.
ANSYS RSM was designed to be executed from within ANSYS Workbench GUI. But it’s possible to tweak some XML files to run virtualy any executable, that is, any kind of task (including non-ANSYS softwares).
The Problem Definition
The APDL macro used to demonstrate this procedure was written to analyse a Pressure Vessel, focusing the region nearby the nozzle:
Let’s run this APDL macro with ANSYS MAPDL, first via command line and then we will extend this idea to run via ANSYS RSM. The command line, considering ANSYS 16.2, is:
"%AWP_ROOT162%\ansys\bin\winx64\ANSYS162.exe" -b -i pressure_vessel.inp -o output.txt
The output is a set of files, including *.db, *.rst and as a plus four PNG files that can be used to generate a report.
01/05/2016 09:55 170 file.log 01/05/2016 09:56 759 file.mntr 01/05/2016 09:56 81.985.536 file.r001 01/05/2016 09:55 25.690.112 file.rdb 01/05/2016 09:56 29.491.200 file.rst 01/05/2016 09:56 154 file.stat 01/05/2016 09:56 45.045 file000.png 01/05/2016 09:56 40.715 file001.png 01/05/2016 09:56 40.257 file002.png 01/05/2016 09:56 16.069 file003.png 01/05/2016 09:56 2.683 Mechanical_ANSYSJob.xml 01/05/2016 00:43 9.231 pressure_vessel.inp 30/04/2016 23:34 85 run.bat 01/05/2016 09:56 74.849 solve.out 423.739.676 bytes in 23 files and 2 dirs 423.776.256 bytes allocated 186.740.047.872 bytes free
The XML files
The command line used before help us to create two XML files that instructs ANSYS RSM to run the ANSYS MAPDL macro. The first XML is called job template, which defines the code template, inputs, and outputs of a job.
Code templates are used by the corresponding job template and determine which scripts will be used to run a specific job. Code templates contain sections for the actual code files (job scripts), referenced assemblies (.dlls), and support files. These code templates are chosen at runtime based upon the job template and cluster type selected to run the job.
Luckily, ANSYS provided some XML sample files for reference. They are located in
In our case, an excerpt of the job template
Mechanical_ANSYSJob.xml used is shown below:
<?xml version="1.0"?> <jobTemplate> <script>GenericJobCode.xml</script> <debug>FALSE</debug> <cleanup>TRUE</cleanup> <inputs> <file type="ascii">commands.xml</file> <file type="ascii">*.inp</file> </inputs> <outputs> <file type="ascii" special="SolutionInformation">solve.out</file> ... <file type="ascii" special="normal">sec.envvarvalidation.executed</file> <file type="ascii" special="normal">sec.failure</file> </outputs> </jobTemplate>
The complete understanding of this XML files usage is beyond the scope of this post. You can get the full details by consulting the Section 6.1 – Understanding RSM Custom Architecture, from ANSYS 16.2 Documentation.
There are two important tags in this file:
<outputs>, which basicaly defines the files that will be submited to or retrieved from the compute server. Please notice the input file
commands.xml. This is the second XML file we need to edit. This XML file defines the command lines that will be called by RSM to run the task. See below the full contents:
<?xml version="1.0" encoding="utf-8"?> <jobCommands version="2" name="Custom Cluster Commands"> <cores>1</cores> <environment> </environment> <!-- delete the previous output files --> <command name="delete the previous output files"> <application> <app platform="win32|winx64">cmd.exe</app> </application> <arguments> <arg platform="win32|winx64"> <value>/c del file*</value> </arg> </arguments> </command> <!-- execute ANSYS162 --> <command name="execute ANSYS162"> <application> <app platform="win32|winx64">"C:\Program Files\ANSYS Inc\v162\ansys\bin\winx64\ANSYS162.exe"</app> </application> <arguments> <arg platform="win32|winx64"> <value>-b -i "pressure_vessel.inp" -o "solve.out"</value> </arg> </arguments> </command> <!-- directory listing redirected to directory.out --> <command name="directory listing redirected to directory.out"> <redirect append="false">directory.out</redirect> <application> <app platform="win32|winx64">cmd.exe</app> </application> <arguments> <arg platform="win32|winx64"> <value>/c dir</value> </arg> </arguments> </command> </jobCommands>
Were defined 3 commands: the first is used delete a previous output file. This is done by using the following command line:
cmd.exe /c del file*
The /c option is required, because without this option RSM will not be notified by the end of command execution (use
cmd.exe /? to get the full list of options)
/C Carries out the command specified by string and then terminates
The second command actually runs the ANSYS MAPDL macro (but the same concept could be used to run a generic application).
Finally, the third command lists the contents of working directory and redirects such information to the file
Save these XML files (
commands.xml)in your working directory.
Running via ANSYS RSM
Once we have defined these two XML files, all we have to do is use the files with ANSYS RSM to submit the task to the local queue.
Use the menu item Tools > Submit a Job… and set the file
Mechanical_ANSYSJob.xml as Template and your working directory (that may be the same where the XML files were saved)
Follow the informations displayed in the RSM log view. This view contains relevant informations regarding the job execution. In case of problems, it’s mandatory carefully inspect the log view, since most of times an error message in the log can help you to identify the cause of the problem.
Once the job execution is finished, the output files will be placed in your working directory, and ready for a post-processing (e.g: generate a PowerPoint presentation).
ANSYS RSM is a powerful tool when used with ANSYS Workbench, but this post shows that ANSYS RSM can also be used as a generic job submission tool, able to run virtually any kind of applications (including non-ANSYS).
All you need to do is write two XML files: one to define the inputs/outputs for your application, and another to teach ANSYS RSM how to execute the application.
- CAEAI – Meeting Your Analysis Deadlines Using ANSYS RSM
- ESSS – How To Submit ANSYS CFX Or ANSYS Fluent Jobs To IBM LSF Job Scheduler Using ANSYS RSM
- PADT – ANSYS Remote Solve Manager (RSM): Answers to Some Frequently Asked Questions
- PADT – Some Tips on configuring RSM as a user
- Zip with the APDL and XML files
- Grab the complete set of ANSYS RSM code samples at Github: https://github.com/vstram/ansys-rsm-samples.git