1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
#------------------------------------------------------------------------------
endTime=10
\cp system/controlDict.template system/controlDict
if notTest $@
then
endTime=85
fi
\sed -i "s|END_TIME|$endTime|g" system/controlDict
# Collect data into the 'results' directory,
# and clean the case for the next run
#
# $1 = model
# ----
collectData(){
model=$1
\echo " Moving results into 'results/$model'"
results="results/$model"
\mkdir -p "$results"
timeDir=$(foamListTimes -latestTime)
\mv -f log* *.png postProcessing "$timeDir" "$results" 2>/dev/null
cleanTimeDirectories
\rm -rf processor* > /dev/null 2>&1
}
# Compute the case in 'serial' mode,
# and collect the data
#
# $* = models
# ----
serialRun(){
models=$*
for model in $models
do
\echo " Running with the synthetic turbulence model: $model"
(\cd 0 && \ln -snf "inlet.$model" inlet)
(\cd constant/boundaryData && \ln -snf "inlet.$model" inlet)
runApplication -s "$model" $(getApplication)
./plot
collectData $model
done
}
# Compute the case in 'parallel' mode,
# and collect the data
#
# $* = models
# ----
parallelRun(){
models=$*
for model in $models
do
\echo " Running with the synthetic turbulence model: $model"
(\cd 0 && \ln -snf "inlet.$model" inlet)
(\cd constant/boundaryData && \ln -snf "inlet.$model" inlet)
runApplication -s "$model" decomposePar
runParallel -s "$model" $(getApplication)
./plot
collectData $model
done
}
#------------------------------------------------------------------------------
# Synthetic inflow models
models="
reducedDigitalFilter
digitalFilter
DFSEM
"
# Prepare the numerical setup
runApplication blockMesh
restore0Dir
\rm -rf "results"
# Run with the synthetic turbulence models
serialRun $models
#parallelRun $models
#------------------------------------------------------------------------------
|