Introduction

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.

Procedure

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:

MAPDL GUI Pressure Vessel

Pressure Vessel ANSYS MAPDL GUI

Command line

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 [RSMInstall]\Config\xml .

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: <inputs> and <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 directory.out.

Save these XML files (Mechanical_ANSYSJob.xml and 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)

RSM Submit Job dialog box

RSM Submit Job

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.

ANSYS RSM log view

ANSYS RSM running a job

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).

[huge_it_gallery id=”2″]

Conclusion

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.

References

Downloads

  1. Zip with the APDL and XML files
  2. Grab the complete set of ANSYS RSM code samples at Github: https://github.com/vstram/ansys-rsm-samples.git
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 1.00 out of 5)
Loading...