Running and Verification
Procedure
- Use PuTTY to log in to the server as the root user.
- Go to the test directory.
cd /path/to/OpenFOAM/tutorials/incompressible/pisoFoam/LES/motorBike/motorBike
- Set the grid precision as required.
sed -ri "s/\(20 8 8\)/\(2048 512 64\)/" ./system/blockMeshDict
You are advised to increase the grid precision when multiple nodes are running.
- Set the number of running CPU cores.
sed -ri "s/8/256/" system/{decomposeParDict,decomposeParDict.hierarchical,decomposeParDict.ptscotch} sed -ri "s/\(4 2 1\)/\(16 4 4\)/" system/{decomposeParDict,decomposeParDict.hierarchical,decomposeParDict.ptscotch}
In this example, two nodes are configured and the number of CPU cores is 256 (16 x 4 x 4 = 256). You can change it based on your requirements.
- Start the running.
- Single node
./Allrun
The following figure shows the running result when a single node uses 6 CPU cores. The results of other configurations are similar.

If you start the running as the root user, modify the RunFunctions file (refer to the steps for the multiple-node running). Add --allow-run-as-root to the end of the mpirun command.
- Dual nodes
- Create a hostfile file.
vi hostfile
- Press i to enter the insert mode.
Node1 Node2
Node1 and Node2 are the names of the nodes where the code is executed. Change them based on your requirements and ensure that the nodes can ping each other. Enable SSH password-free login between the nodes.
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Modify the RunFunctions file.
vi /path/to/OPENFOAM/bin/tools/RunFunctions
- Press i to enter the insert mode and modify the file as follows:
$mpirun -x PATH=$PATH –x LD_LIBRARY_PATH=$LD_LIBRARY_PATH -x WM_PROJECT_DIR=$WM_PROJECT -n $nProcs $appRun $appArgs "$@" </dev/null >> $logFile 2>&1
So far, the configuration required for multi-node running is complete.
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Start the running.
./Allrun
- Create a hostfile file.
- Single node
- After the computing is complete and the software exits, a computing log file is generated. Run the vi log.simpleFoam command to open the log.simpleFoam file. Check the value of ExecutionTime (unit: second) in the log.simpleFoam file. A smaller value indicates better performance.