ANSYS Batch Tutorials
This tutorial will introduce you to submitting ANSYS jobs in batch to the Rescale platform. We will create an input file from the respective ANSYS software, start a Rescale job, submit, and transfer the results back to ANSYS.
Pre-processing activities (e.g. geometry, mesh/model) are already completed and all solver and setup settings are already determined as well. Unlike job submission through RSM, you do not need to launch Rescale Desktops. You can use your own ANSYS software and license or reach out to us and purchase some Elastic License Units (ELUs).
Important: ANSYS Workbench converts all input data into one unit system. To avoid any confusing conversions, specify a consistent unit system throughout your workflow (e.g. Geometry, Engineering data).
ANSYS Fluent in Batch mode
In this section, we will solve an ANSYS Fluent job in batch. To obtain the files needed to follow this tutorial, click on the "Job Setup" link below and clone the job hosting the file. Next, click "Save" on the job to have a copy of the files in your Rescale cloud files.
The input files are:
tjunction_plot.cas.gz - Compressed Case File
run_plot.jou - Journal File
Creating Case and Journal files
The tutorial example is a T-junction of two fluids at different temperatures using ANSYS Fluent version 18. The case file
tjunction_plot.cas.gz is already available to you. The steps involved to create a case file are:
On Fluent, go to the File tab, then select Export > Case..., and this will open a window browser
Name the file with a .cas or .cas.gz extension and select the location where this file will be exported to.
This file contains all pre-processing settings, and solver and physics setup that have been configured in the GUI, as per your standard workflow.
You will also need a journal file which contains all the necessary commands that you would like to execute using Fluent during a batch run. The journal file
run_plot.jou is already available to you. The steps involved to create a journal file are:
On a Windows Explorer window, right mouse click > New > Text Document (or similar for other OS).
Give the file a name, with extension .jou. Accept the change to file extension.
Double-click the file to open it and enter the journal commands, then save the file.
The journal file will look like this:
/file/set-batch-options no yes yes no /file/read-case tjunction_plot.cas /solve/initialize/initialize/ /solve/iterate 500 /file/write-case-data tjunction_plot%i.cas.gz /exit yes
The journal file shown above reads the case file, sets the batch options, initializes, runs the calculation for 500 iterations, and finally writes a case and a data file when the solution has converged to a prescribed limit.
This file is written using the ANSYS FLuent Text User Interface (TUI). For more information about using specific text interface commands, please refer to ANSYS Online Documentation here.
Rescale Job Setup
After obtaining the necessary ANSYS Fluent files, we will now submit a Basic job on Rescale. For more information on launching a basic job, please refer to the tutorial here.
Setup: Input File(s)
Go onto the Rescale plaftorm, click on + New Job on the top left. Name your job and make sure the Job Type is set to Basic.
Next upload the journal and case files as input files.
Setup: Software Settings
Click Next to move onto the Software Settings section of the setup.
You can scroll down or use the search bar to select ANSYS Fluent. The Analysis Options will display and select version 18.0.
In the command window, you will need to specify the journal file name under the angle bracket <journal filnename>. We would also like to see the solution residual. To do this, we command to keep the graphics windows using the -gu option.
Next under Licensing Options, select Use Existing License and enter your ANSYS server connection port numbers under License and ANSYS License Interconnect respectively.
For this tutorial, the software settings page will look as shown below.
Setup: Hardware Settings
The next step is to select the desired hardware for the job. Click on the Hardware Settings icon.
- Select your desired core type and the numbers of cores that you want to use for this job. For this tutorial, select Onyx and 4 cores.
Your Hardware Settings screen screen should look like this:
There are no post-processing settings in this tutorial. Click on the Review icon. Check that the setup is correct by reviewing the Basic Job Summary table. It should look like this:
Job Submission and Monitor
Once you have reviewed your setup, you are ready to submit your job. Click Submit and you will move on from the Setup page to the Status page in the Rescale platform. Here, you will be able to monitor the job progress in a gantt chart like format, see a date and time stamped log and live-tail the status and output of your job using the Live-tail window. A guide on "Monitoring Status" on Rescale is found here.
In this example, we have configured the simulation to output a residual plot at every iteration, which will show up under the Live Tailing window as a
residual.jpeg file. You can open this graph at any time to monitor the progress of the solution's convergence.
Once the job is completed, you can select the file(s) that you wish to download. If you have large output files, it is recommended that you use Rescale Transfer Manager (RTM) to download files faster onto your on-premise workstation. More information about RTM can be found here.
For this simulation, the solution is expected to converge at 245 iterations. To obtain the final data file, do the following:
Go to the results page of the completed job, find and select the
Go to Actions and click on Download selected files, give it a few seconds for it download to your computer.
- You can now go back to Fluent, go to the File tab, then select Import > Data..., to load the solution data file.
At this point, you may now proceed to your post-processing activities as you would normally do after solving an Ansys Fluent simulation interactively.
ANSYS Fluent UDFs in Batch mode
ANSYS Fluent also has the capability of allowing users to modify or extend the behavior of the physics and solver setup. User defined functions (UDF) can be used to perform actions such as impose boundary conditions, physical and chemical processes, heat transfer and phase changes.
In this section we present instructions using Fluent User Defined Functions (UDF) in batch mode on the Rescale platform.
This guide will assume that you already have developed a UDF ready for compilation in a Fluent job. For assistance on creating or debugging UDFs please contact ANSYS Support directly. Here is a guide by ANSYS on using UDFs in Fluent.
Compilation of UDFs in Batch
To utilize a UDF during a batch run, the UDF source code must first be compiled and accessible by Fluent. We will demonstrate a workflow that compiles the UDF at runtime before the main solution solve or iteration process. We will accomplish this by adding commands to an existing example journal file. Depending on your workflow and the size of the compilation libraries, it is possible to have these UDF libraries pre-compiled and included as input files to your batch job. But generally UDFs are straightforward codes, so runtime compilation is a short opertation and avoids any platform inconsistencies.
Example Journal File
The following is an example of a journal file that compiles a user-created
custom_UDF.c file in current directory (with the journal file) and loads the resulting UDF libraries. The UDF is compiled with the default library name
libudf and creates a correspondingly named directory structure with the shared libraries.
Here, the compilation and load commands (shown in bold) are sequential and take place before the solution initilization. But you can perform these operations anywhere they fit into your workflow.
/file/set-batch-options no yes yes no /file/read-case example.cas /define/user-defined/compiled-functions compile libudf yes custom_UDF.c "" /define/user-defined/compiled-functions load libudf /solve/initialize/initialize /solve/iterate 1000 /parallel/timer/usage /file/write-case-data example-%i.cas /exit yes
There are two specific syntax things to note here. The first, is that after the UDF source code file name, there are two double quotes
"" present. The second is the blank line after the
compile command. This ensures that the compile function does not attempt to treat following lines as additional file names to include in the compile. The blank line is necessary after the compilation command but does not need to precede or follow the load command.
Making an Explicit UDF Call
Occassionally you will have to call a UDF function before or after a solution process to set up a boundary condition or perform some sort of post-processing step. You can call that UDF function explicitly in your journal file with an
execute-on-demand call where appropriate:
Running on Multiple Nodes
Another thing to note is that due to the nature of UDF function calls, all nodes need access to the compiled UDF libraries. By default, ANSYS Fluent jobs are set to run in the
~/work directory which is local to the head node. Depending on the behavior of the function, the slave node processes may need to access a common file or library. In this case, the job should be run out of the NFS mounted directory,
~/work/shared. So simply prepend move and change directory commands on the "Software Settings" page before you launch Fluent (not in the journal file):
mv * sharedcd sharedfluent 3ddp -gu -ssh -cnf=$FLUENT_HOSTS -t$RESCALE_CORES_PER_SLOT -i example.jou
So again, if you are running on multiple cores on a single node, this step is unnecessary since the local file system can be accessed by all the cores on that node.
ANSYS Mechanical in Batch mode
The focus in this section is on ANSYS Mechanica1 18.0 systems such as Linear Perturbation Eigenvalue Buckling. To obtain the Workbench project file (.wbpz), click on the "Import Workbench project" link below and clone the job hosting the file. Next, click "save" on the job to have a copy of this file in your Rescale cloud files.
Creating input file from Workbench
Make sure the status of all pre-processing cells are complete (green check marks). The example model is a 15-foot long tapered I-beam made of steel. It's fixed at the larger end and a 200-lb force is applied at the smaller end. The analysis consists of a static structural system (for pre-stress) and an eigenvalue buckling system (for linear buckling).
- First, we need to solve System A. We open the setup cell A5 (ANSYS Mechanical) and once all definitions are completed, highlight the Solution (A6) state in the tree on the left, then go to Tools < Write Input File...
- You will be prompted to a "Save as" window. Choose the appropriate file name and directory. For this example, we name it: input_batch.dat
Rescale job submission
Go onto the Rescale platform, start and name a new job, and upload the input file that you generated from Workbench. For this example, configure the software settings by selecting Ansys Mechanical version 18.0. For more information on launching a basic job, please refer to the tutorial here.
Under the command window, you will need to specify the input file name under the angle bracket <input-file>. In this tutorial, the command will be as shown below.
Specify your license option, and move onto hardware settings. This example will be run on 4 Onyx cores. There is no post-processing options here.
Submit your job, and feel free to monitor the status of your job and get information about your cluster in real-time. A guide on "Monitoring Status" on Rescale is found here.
Download and read results back into Workbench
Once the job is completed, it is highly recommended to use our Rescale Transfer Manager (available on Windows OS only) to download output files. It is much faster than downloading through the browser. To install and learn to use the Rescale Transfer Manager, you can read here.
Go to the job results page, click "Download with Rescale Transfer Manager". If a warning message pops up, click on "Open Rescale.TransferClient.UI"
A "Browse for folder" window will open, select a destination where you want to save the job results and click ok. It will download and wait until the status shows "Complete". The files will be saved into a folder named after the job.
- You can now go back to Workbench, hightlight the Solution (A6) state on the tree on the left, then go to Tools <Read Result Files...
- An "open" window will display. Find the directory you specified earlier. This example is a Rescale Basic job and the output files will be under the "run1" folder. Select the "file.rst" file and click open. Wait for the results to completely load into ANSYS Mechanical. One way to verify this is to look at the tree and the Solution (A6) state should appear "green check marked".
Important: You must preserve the directory where the .rst and all other result files are located. Failure to do so may result in files not loading on Workbench.
- At this point, you may now proceed to your post-processing activities as you would normally do after solving an Ansys Mechanical simulation in the Workbench GUI.
Special case: Multiple analysis in batch mode
In several cases, the analysis may consist of more than one system therefore an input file must be generated for each. In this example, system A is a base analysis. We are interested in finding the critical load of the beam under buckling. To continue, we need a second input file in System B plus the restart files from System A. Refer to ANSYS documentation for more information about multiframe restart and APDL.
Open ANSYS Mechanical on system B (B5 cell), and follow the same worflow again with the difference that we hightlight the Solution (B6) state instead to write a second input file
Start a new job and upload this new input file. For this Linear Perturbation example, we also have to upload the .Rnn, .rdb, and .ldhi restart files from the base analysis.
- The rest of the workflow is the same again. Make sure to hightlight the Solution (B6) state to read the new result file.
The simulation in this example calculated a load multiplier of 4.709. Since we applied 500 lbs of force, this means that the critical buckling load is 2355 lbs of force.
ANSYS Icepak in Batch mode
The focus in this section is on setting up an ANSYS Icepak 18.2 case to run in batch. This example case is also used in our ANSYS RSM Electronics tutorial using RSM job submission. In this tutorial we will show a workflow entirely within the Rescale platform. We demonstrate how to launch a Rescale Desktop, load an Icepak case, how to pack it for batch submission, and finally how to run this ANSYS Icepak case in batch. Once you are comfortable with the Rescale platform, you can tailor the workflow to suit your needs. For the basics on Rescale batch, please refer to our guide.
Prepare a simulation
To begin, we will go over how to create an input file in ANSYS Icepak, followed by the Job Setup in the Rescale platform.
First, please use the link below to clone the "ANSYS Icepak Example" job. Next, click "Save" on the job to have a copy of the files in your Rescale cloud files. Note, although you can run this job directly, to continue with this tutorial do not submit this case directly. We are cloning the job in order to import the simulation file (
ansys-icepak-packed.tzr) into your account.
Simulation setup on Rescale
In this part of tutorial, we will show you how to export a simulation ready for batch submission from ANSYS Icepak using Rescale Desktops. If you have a prepared simulation
.tzr file in your local environment ready for batch submission, feel free to skip the next few sections. You can go ahead and begin the batch submission section. Or if you want to just create the packed
.tzr from the Icepak GUI, you can skip to this section before going on to batch submission. Otherwise, please continue:
Launching a Remote Desktop on Rescale
Start by selecting the "Desktops" option in the Rescale platform Web UI.
Select "New Custom Desktop" button in the upper left hand corner. This should bring you to a new page where you can give the desktop name an instance if you choose to. Here we've named this desktop "ANSYS Icepak Desktop".
Under "1. Choose Configuration", select the basic "Windows" configuration.
Expand the drop-down menu for "2. Add Software." Search for or select from the menu: "ANSYS Icepak Desktop".
A "Select License - ANSYS Icepak Desktop" pop-up menu should now appear. Enter your appropriate ANSYS license information and click "ok" to continue.
You can now also select which version of Icepak you want to use. We will choose "18.2" for this tutorial.
Expand the drop-down menu for "3. Add Jobs". Again, you can search for or select from the menu the job you cloned: "ANSYS Icepak Example". Click "Add" under actions.
After making the selections, your screen should look like the following:
- You can then begin to launch the desktop by clicking on the "Launch" button in the lower right hand corner of the page. This should bring up the following confirmation dialog:
If the settings appear to be correct, click "Launch" in this menu to start the desktop server. This process should take approximately 5-10 minutes to spin up a new Windows server instance. Please refresh the page every few minutes to update the status of the server. In the "4. Logs" menu once the message "Server(s) Started" is reported the desktop should be ready to use.
Click on the "Connect" button to bring up the connection options. You can choose to connect using your own Windows RDP client or an the "In-Browser Desktop" that we will use in this case. Please refer to our guide for more information Windows RDP and/or configuring a Rescale Desktop.
Creating an input file from the Icepak GUI
Once connected to the Windows desktop, launch ANSYS Icepak by double clicking the "Icepak 18.2" shortcut found on the desktop.
A "Welcome to Icepak" dialog box should appear. Select the "Unpack" button.
If you attached the cloned job, in the "File selection" menu navigate to the Desktop and select the "attached_jobs" shortcut. This should bring you to the folder that the attached clone job files were extracted to. Select the "input" folder. Finally select the simulation file
In your normal workflow instead of "Unpacking" a job, you would build or modify your model in this step. Once the desired changes have been made, you can "Pack" the simulation again ready for Icepak batch submission.
So if the case is prepared and ready to be analyzed, you can "Pack" the simulation into a
.tzrfile by selecting the File > Pack project:
The following dialog should appear:
- Enter a filename and path for this file. Here for the purposes of the demonstration, we are using the same filename
ansys-icepak-packed.tzrin a different directory path.
Uploading the Simulation File to the Rescale Cloud
- If you created the packed
.tzrfile from a Rescale Desktop, you can now upload the file to Rescale by running the "Cloud Files" icon on the desktop. Select the option to "Upload from this computer". Navigate to the path of the file and select the newly "packed"
If you save this file in the job folder, you use our "Sync Files" feature to directly import those files into your Rescale account. Please refer to our guide on File Transfer for more information.
- If you created the packed simulation file from your local desktop environment, you can upload the file using similarly from the Web UI Files option.
Terminate the Desktop
Since we have prepared our simulation and uploaded the file back to the Rescale Cloud, we are done using our Icepak GUI for the time being. We can now shutdown this Desktop instance. You can choose to keep the instance running to perform post-processing after the simulation is completed.
In the Rescale Web UI, select "Desktops".
Check the "Select" tickbox under your Desktop instance. This instance should be easily identified if you provided it a name earlier.
Click the red "Terminate" button near the top of the page to shutdown this instance.
For a guide on using the Rescale desktop please refer to our guide here
Submitting Your Job in Batch
Now with the prepared simulation
.tzr file, we can set up a Rescale job to submit in batch.
Go onto the Rescale platform Web UI and select "+ New Job".
Feel free to rename the job by clicking on the pencil icon next to the job name ("Untitled Job") at the top of the page.
Click on "Use files from cloud storage" and select the
.tzrfile you uploaded from the Desktop instance:
Or you can also choose to upload a
.tzrfile from your local machine using the "Upload from this computer" button at this stage as well.
Now we can configure our software package options on the "Software Settings" page. You can search for or directly select the tile for ANSYS Icepak:
This should now bring you to the software configuration page for that package.
Under the command window, you will need to specify the input file name inside the angle brackets
<input-file>. In this case, replace
Below, on this same page, please specify the appropriate license options.
Now we can select the type and number of cores to run on in the "Hardware Settings" page.
Choose 2 or more cores for this Icepak problem. This tutorial will be run on 8 Onyx cores and should complete in approximately 16 minutes.
There is no need to specify any "Post Processing" options for this tutorial.
After reviewing your selections, your case should now be ready for batch submission at this point.
Click the blue "Submit" button in the top right corner on any of the job configuration pages or in the middle of the "Review" page.
Alternatively, instead of submitting the job, you can elect to "Save" the problem setup to be run at some later time.
You can monitor the status of your job and get information about your cluster in real-time. Here you can see the live-tailing of the output "process_output.log" as the case begins to run:
A guide on "Monitoring Status" on Rescale is found here.
Once the job has completed its run, you can "Download" all of the output files from the "Results" page. You can also launch another Desktop and attach this job to perform post-processing.
A guide on "Managing your Job Results" on Rescale is found here.