If you need to perform Rocky tasks without using the Rocky UI, also known as running in batch mode, it is possible to do so from the command line on both Windows- and Linux-based machines.
You can also perform batch Fluent runs by using a journal.
For example, you can process your Rocky simulation project without ever seeing the Rocky
UI (sometimes known as hidden mode or silent mode) by passing
--simulate
and the path and name of the project file you
want processed, along with other parameters such as whether you want the simulation
processed on CPU or GPU resources.
It is important to note that the Rocky executable exists inside different folders on different operating systems. Specifically:
In Windows, the
Rocky.exe
file exists inside thebin
folder, the standard location beingC:/Program Files/ANSYS Inc/v241/Rocky/bin
In Linux, the
Rocky
file exists in no standard location; however, the location might look something like<Path to Rocky Installation>
There are some situations where using Rocky commands in batch mode will not work. See the following sections for more information.
You might get errors in Rocky (or in Ansys Workbench) when a script for the Rocky simulation (or Workbench project) you are running in batch mode includes tasks that require the Rocky UI to be open. These tasks include:
Creating and exporting an animation.
Creating and exporting plots.
Creating and exporting images of 3D View windows.
See also I get a scripting error when I attempt to run the simulation in batch mode.
You might get errors in Rocky (or in Ansys Workbench) when a script for the Rocky simulation (or Workbench project) you are running in batch mode makes use of matplotlib using Qt as a backend. This can happen if the script tries to export an image, for example.
See also I get a "Server returned a fault exception" error when running a script in batch mode.
See the table and procedures listed below to learn more about using commands to perform Rocky tasks.
Table 1: Rocky Command Line Parameters
Command | Definition | Range |
---|---|---|
Processing Commands | ||
--simulate | Processes from the beginning, in hidden mode, the project file name and location that follows in quotes. | <file path to project
|
--ncpus | Sets the number of CPU processors on which the simulation will be run. | Positive whole numbers |
--resume | Resumes an in-process simulation, if possible. | 0 = Off 1 = On |
--use-gpu | Processes the simulation on a CUDA-enabled GPU. | 0 = Off 1 = On |
--gpu-num | The index of the GPU to use for processing. Note: This setting may appear multiple times to run in multiple GPUs. Tip: To determine which GPU maps to which index, open the Rocky UI and look at the Target GPU list in the Solver tab. The index is based upon the order shown, starting with 0. | Positive whole numbers |
Other Commands | ||
--script | Runs a script .py file, the name of which follows in quotes. |
|
--headless | Process from the beginning, in hidden mode, the script .py file name of which follows in quotes. |
|
Important: For CFD Coupling simulations using the 2-Way Fluent method, items on the 2-Way Fluent | Fluent tab, (i.e., Execution mode, Solver Processes, and so on) will be controlled by Rocky and should therefore be defined inside the Rocky project. These parameters can be used to perform Rocky - Fluent tasks from the command line. (See also About Using the 2-Way Fluent Method.)
What would you like to do?
Open a command prompt.
Using commands, navigate to the directory containing the Rocky executable. For example:
In Windows, the standard location for the
Rocky.exe
file isC:\Program Files\ANSYS Inc\v241\Rocky\bin
In Linux, there is no standard but the location for the
Rocky
file might best be described as<Path to Rocky Installation>
Type the name of the executable (
Rocky
in Linux andRocky.exe
in Windows).followed by--simulate
, followed by the file name and location you want to process in quotes, followed by any other parameters you want to define. (See also Appendix G: Perform Tasks from the Command Line or Journal.) Windows Examples:Command to run with multiple GPUs:
Rocky.exe --simulate
"C:Documents\project_filename.rocky"
--resume=0 --use-gpu=1 --gpu-num=0 --gpu-num=1
Command to resume a simulation with multiple CPUs:
Rocky.exe
--simulate "C:\Documents\project_filename.rocky"
--resume=1 --ncpus=7
Command to select multi gpu slicing direction (X,Y or Z):
Rocky.exe --simulate
"C:\Documents\project_filename.rocky"
--multi-gpu-slicing-direction=X
Type the name of the executable (Rocky in Linux and Rocky.exe in Windows),followed by
--script
, followed by the script file name and the location you want to process in quotes; followed by--headless
, followed by any other parameters you want to define.
For example:
Command to run a script in batch mode:
Rocky.exe --script "C:\Documents\project_filename.py" --headless
Your simulation starts processing in the background.
Tip: Because you are running this simulation in batch mode, you can verify if
Rocky has opened the simulation to start processing it by looking for the
presence of the .lock
file in the project file
directory. If this file is present along with for your
.rocky
project file, then Rocky has likely opened
and started processing it in the background. (See also Rocky says my project file is
"locked".)
Additional Tips:
Because it can be hard to track the progress of your simulation if there is no user interface open, you can choose to have a file be written containing information about the previous commands by using a pipe redirection, i.e
> log.txt
.For example, in Windows, this might be:
Rocky.exe --simulate "C:\Documents\project_filename.rocky" > C:\Documents\log.txt
.If you want to review the information more frequently, you can use the:
tail -f <path to log file>
(on Linux) or thetype -f <path to log file>
(on Windows).which will freeze the terminal and output the last content that was written to the file specified.
If you need to stop Rocky from processing the project, do one of the following:
- On Linux, press
Ctrl
+C
on your keyboard.- On Windows, open the Task Manager, and then end the
RockySolver.exe
process.
Since there is no default folder for installation in Linux, there are two main ways you can run Rocky by using a simple, one-word command:
Define and use an alias: This allows you to use a different (shorter) name for the executable.
Example: Assuming you have installed Rocky at
/home/user/Ansys/Rocky
, enteralias Rocky=/home/user/Ansys/Rocky/Rocky
.Then, you are able to simply use
Rocky --simulate <project>
. -Edit the PATH variable: This allows you to add a folder to the list of places Linux will look for the executable.
Example: Assuming you have installed Rocky at
/home/user/Ansys/Rocky
, enterexport PATH=$PATH:/home/user/Ansys/Rocky
.Then, you are able to simply use
Rocky --simulate <project>
.
Both of these changes are temporary so you should consider storing those lines on .bashrc or equivalent to have them persist during the changing of your terminal or during reboots.
See Also:
Open a command prompt.
Using commands, navigate to the directory containing the Rocky executable. For example:
In Windows, the standard location for the
Rocky.exe
file isC:Program FilesANSYS Incv222Rockybin
In Linux, there is no standard but the location for the
Rocky
file might best be described as<Path to Rocky Installation>
Type the name of the executable (
Rocky
in Linux andRocky.exe
in Windows), followed by the .rocky file name and location of the project you want to open in quotes, followed by-script
followed by the PY file name and location of the script you want to apply, also in quotes. Windows Example:Rocky.exe "C:Documentsproject_filename.rocky" -script "C:DocumentsRockyScriptsscript_filename.py"
The Rocky user interface opens the indicated project and attempts to run the script.
Note: If -script
is used together with -simulate
, the script will attempt to
play but might fail if UI elements, such as Camera Presets, are required for completing the recorded or scripted steps.
See Also:
Use the following information to run Fluent and export the results for a 1-Way transient simulation using a journal, a process that is used for batch Fluent runs. This will enable you to run your CFD case and export the results without opening the Fluent UI.
/file/start-transcript "fluent.log"
(define rocky/library-path "
{lib_directory}")
(ti-menu-load-string "/file/read-macros "{lib_directory}
rocky_fluent_coupling.scm""))
/file/read-case "
{base_cas_filename}
"
/solve/set/time-step 0.0005
(set-f2r-folder "
{f2r_folder}
")
/solve/initialize/initialize-flow
(one-way-transient-export)
(display (rpgetvar 'rocky/additional-output-name-list))
(display (rpgetvar 'rocky/additional-output-phase-id-list))
(display (rpgetvar 'rocky/additional-output-id-list))
(display (rpgetvar 'rocky/additional-output-type-list))
/solve/dual-time-iterate 2 2
(stop-one-way-transient-export)
exit OK
See Also