reconstructPar background script

#!/bin/bash
#+TITLE: check-reconstructPar
#+File:  check-reconstructPar.sh
#+Date: Sat Nov  9 12:23:24 HST 2019
#+Author: Albert S. Kim, albertsk@hawaii.edu
# Required package: bc
#

. ~/.bashrc 
. /home/albertsk/OpenFOAM/OpenFOAM-v1906/etc/bashrc
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
. $WM_PROJECT_DIR/bin/tools/RunFunctions

testProcessorNum=0

processor=`ls  processor${testProcessorNum}  | grep -v [a-zA-Z] | tail -n 1`
latestPWD=`ls  ./ | grep -v [a-zA-Z] | tail -n 1`

Tprocessor=$(echo $processor + 0 | bc)
TlatestPWD=$(echo $latestPWD + 0 | bc)
#
runMessage=$(grep Time log.interFoam2 | tail -n -1)

echo "The running time is" ${runMessage} 
echo "The lastest time in processor${testProcessorNum} is  ${processor}. "
echo "The lastest time in this directory is  ${latestPWD}."

dateTime=`date +"%Y-%m-%d-%H-%M-%S-%p"`
if [ "$Tprocessor" != "$TlatestPWD" ] 
then
    . /home/albertsk/OpenFOAM/OpenFOAM-v1906/etc/bashrc
    . $WM_PROJECT_DIR/bin/tools/CleanFunctions
    . $WM_PROJECT_DIR/bin/tools/RunFunctions
    echo reconstructPar -time $processor
    mv -f log.reconstructPar log.reconstructPar.$dateTime
    mv -f log.reconstructPar.log .reconstructPar.$dateTime
    reconstructPar -time $processor
    mv -f log.reconstructPar  log.reconstructPar.$dateTime
    
else
    echo "This case is laready reconstructed. reconstructPar not necessary!"
fi

exit 0

About albertsk

Professor at the University of Hawaii
This entry was posted in bash, OpenFOAM. Bookmark the permalink.