4.4. Batch Mode

In batch mode, you submit a file of commands to the Mechanical APDL program. On some operating systems, you can run a batch job in the background while doing other work on the computer. Batch mode is useful when you do not need to interact with the program, such as during the solution phase of an analysis.

4.4.1. Starting a Batch Job from the Command Line

Starting Batch Mode from the Linux Command Line

To start batch mode from the Linux command line:

Foreground execution (ksh or sh shells):

ansys242 -b -p productvar < inputname > outputname 2>&1

Background execution (ksh or sh shells):

nohup ansys242 -b -p productvar < inputname > outputname 2>&1 &

The nohup command tells the system to ignore hang-up signals, enabling the Mechanical APDL program to continue executing if you log off from the system.

Foreground execution (csh shell):

ansys242 -b -p productvar < inputname > &outputname

Background execution (csh shell):

nohup ansys242 -b -p productvar < inputname > &outputname &

Starting Batch Mode from the Windows Command Line

You can also start a batch job in Windows by issuing the program execution command directly from the MS-DOS command prompt window. The format for the command depends on whether you want the program to run in the foreground or the background:

Foreground execution:

"<drive>:\Program Files\ANSYS Inc\V242\ANSYS\bin\<platform>\ansys242" -b -i 
     inputname -o outputname

Background execution:

start /min "<drive>:\Program Files\ANSYS Inc\V242\ANSYS\bin\<platform>\ansys242" -b -i 
     inputname -o outputname

To run multiple consecutive jobs on Windows systems, create and run a batch file containing commands similar to this one:

set ANSYS242_PRODUCT=ANSYS
set ANS_CONSEC=YES
"C:\Program Files\ANSYS Inc\V242\ANSYS\bin\<platform>
     \ansys242" -b -i vm1.dat -o vm1.out
"C:\Program Files\ANSYS Inc\V242\ANSYS\bin\platform
     \ansys242" -b -i vm2.dat -o vm2.out
"C:\Program Files\ANSYS Inc\V242\ANSYS\bin\platform
     \ansys242" -b -i vm3.dat -o vm3.out

where <platform> is winx64 for Windows 64-bit systems.

Setting ANS_CONSEC=YES disables Mechanical APDL dialog boxes so that multiple jobs can run consecutively without waiting for user input.


Note:  The example above assumes that the product that you are running is Ansys Mechanical Enterprise, which has a product variable of ANSYS.


Opting in to APIP for batch mode simulations

If you want to include usage data specific to your simulation needs in the Product Improvement Program, issue the -apip on option on the Mechanical APDL execution command in job-submission scripts:

ansys242 -apip on