#!/bin/bash # rising_bubble Allrun 脚本 # 参考: Hysing, S. et al. (2009), Int. J. Numer. Meth. Fluids, 60(11), 1259-1288. cd "$(dirname "${BASH_SOURCE[0]}")" || exit 1 N_PROCS=${1:-1} echo "=== rising_bubble: blockMesh ===" blockMesh > log.blockMesh 2>&1 if [ $? -ne 0 ]; then echo "ERROR: blockMesh failed, see log.blockMesh" exit 1 fi if [ "$N_PROCS" -gt 1 ]; then echo "=== rising_bubble: decomposePar (np=$N_PROCS) ===" decomposePar -force > log.decomposePar 2>&1 if [ $? -ne 0 ]; then echo "ERROR: decomposePar failed" exit 1 fi echo "=== rising_bubble: interFoam (parallel, np=$N_PROCS) ===" mpirun -np "$N_PROCS" interFoam -parallel > log.interFoam 2>&1 if [ $? -ne 0 ]; then echo "ERROR: interFoam failed" exit 1 fi echo "=== rising_bubble: reconstructPar ===" reconstructPar > log.reconstructPar 2>&1 else echo "=== rising_bubble: interFoam (serial) ===" interFoam > log.interFoam 2>&1 if [ $? -ne 0 ]; then echo "ERROR: interFoam failed" exit 1 fi fi echo "=== rising_bubble 完成 ==="