Home      |     Contact Us      |     Users Site SEARCH:       

FLOW-3D/MP: Running a batch of simulations from the Linux command line

Starting with version 9.3, the new Navigator tool in the FLOW-3D GUI allows users to schedule a sequence of simulations to be run one after the other. This feature is not yet available in FLOW-3D/MP, the MPI version of FLOW-3D for clusters. However, using the commands in the Linux bash shell, it is possible to schedule a batch of simulations at once before taking off for the day or the weekend. Once the technique is used a few times, one may learn to adapt it to automate other chores.

Automated Scripts

The following sequence of commands will switch one by one to all directories in the current directory and then back to current directory without doing anything:

We recommend that users save this script to a readily-accessible text file. Then, when the user wants to run a batch job, he needs only to copy/paste the script from the text file. An example of how to use the script to run a batch job is set forth below. The same script can also be adapted to run the postprocessor.

Adding the text highlighted in red below creates a set of commands that will copy a machines file from the user's home directory and then run the FLOW-3D/MP preprocessor and solver (assuming the code is set up to run on the machine). This should be run from the directory containing the simulation directories.

export base_dir=`pwd`; for dname in `ls -l|grep '^d'|tr -s ' '|cut -d ' ' -f 9`;do echo "changing to ${base_dir}/${dname}";cd ${base_dir}/${dname}; cp ${HOME}/machines .;runpre_par;runhyd_par; cd ${base_dir};echo "back to ${base_dir}";done

Important Tip

If you are typing these commands, pay attention to the back quotes around pwd and the ls commands—they are not single quotes. It is best to copy paste the commands and then modify as needed. The whole sequences of commands go in a single line.

This will skip directories that have spaces in the names. ‘test_dir’ will be processed but ‘test dir’ will be skipped. The script can be modified to handle the space but it gets complex.