#!/bin/sh
cd “${0%/*}” || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#——————————————————————————# settings
# operand setups
setups=”
Gauss-linear
leastSquares
Gauss-pointLinear
iterativeGauss-linear-1
cellLimited-Gauss-linear-1
cellLimited-leastSquares-1
cellLimited-Gauss-pointLinear-1
cellLimited-iterativeGauss-linear-5-1
faceLimited-Gauss-linear-1
faceLimited-leastSquares-1
faceLimited-Gauss-pointLinear-1
faceLimited-iterativeGauss-linear-5-1
cellMDLimited-Gauss-linear-1
cellMDLimited-leastSquares-1
cellMDLimited-Gauss-pointLinear-1
cellMDLimited-iterativeGauss-linear-5-1
faceMDLimited-Gauss-linear-1
faceMDLimited-leastSquares-1
faceMDLimited-Gauss-pointLinear-1
faceMDLimited-iterativeGauss-linear-5-1
iterativeGauss-linear-2
iterativeGauss-linear-3
iterativeGauss-linear-4
iterativeGauss-linear-5
iterativeGauss-linear-10
iterativeGauss-linear-20
”# flag to enable computations
run=true# flag to enable computations in parallel mode
parallel=false# flag to enable to use a common mesh
common_mesh=true# flag to enable to use a common dynamic code
common_dynamic_code=true#——————————————————————————
#######################################
# Create the given setup
# Arguments:
# $1 = Path to create the setup
# Outputs:
# Writes info to stdout
#######################################
dry_run_setup() {[ $# -eq 0 ] && { echo “Usage error: $0″; exit 1; }
setup=”$1″
dirSetup=”setups/$setup”
dirSetupOrig=”setups.orig/$setup”
dirOrig=”$dirSetupOrig/0.orig”
dirConstant=”$dirSetupOrig/constant”
dirSystem=”$dirSetupOrig/system”printf ”
# Create the setup: %s
” “$setup”if [ ! -d “$dirSetup” ]
then
mkdir -p “$dirSetup”cp -aRfL “setups.orig/common/.” “$dirSetup”
cp -afL “$dirSetupOrig”/All* “$dirSetup” 2>/dev/null || :
[ -d “$dirOrig” ] && cp -aRfL “$dirOrig/.” “$dirSetup/0.orig”
[ -d “$dirConstant” ] && cp -aRfL “$dirConstant/.” “$dirSetup/constant”
[ -d “$dirSystem” ] && cp -aRfL “$dirSystem/.” “$dirSetup/system”
else
printf ”
# Directory %s already exists
” “$dirSetup”
printf ” # Skipping the creation of a new setup
”
fi
}#######################################
# Run the given setup
# Arguments:
# $1 = Path to the setup to run
# Outputs:
# Writes info to stdout
#######################################
run_setup() {[ $# -eq 0 ] && { echo “Usage error: $0″; exit 1; }
setup=”$1″
dirSetup=”setups/$setup”
dirResult=”results/$setup”dry_run_setup “$setup”
[ -d results ] || mkdir -p resultsprintf ”
# Run the setup: %s” “$setup”
if [ ! -d “$dirResult” ]
then
cp -Rf “$dirSetup” “$dirResult”if [ “$common_mesh” = true ]
then
if [ -d results/mesh ]
then
printf “## Copy the common mesh to the setup: %s” “$setup”
cp -Rf results/mesh/polyMesh “$dirResult”/constant/.
fi
fiif [ “$common_dynamic_code” = true ]
then
if [ -d results/dynamicCode ]
then
printf “## Copy the common dynamic code to the setup: %s” “$setup”
cp -Rf results/dynamicCode “$dirResult”/.
fi
fiif [ “$parallel” = true ]
then
( cd “$dirResult” && ./Allrun-parallel )
else
( cd “$dirResult” && ./Allrun )
fiif [ “$common_mesh” = true ]
then
if [ ! -d results/mesh ]
then
printf ”
## Store the mesh of %s as the common mesh” “$setup”
mkdir -p results/mesh
cp -Rf “$dirResult”/constant/polyMesh results/mesh/.
fi
fiif [ “$common_dynamic_code” = true ]
then
if [ ! -d results/dynamicCode ]
then
printf ”
## Store the dynamic code of %s as the common dynamic code” “$setup”
cp -Rf “$dirResult”/dynamicCode results/.
fi
fielse
printf ” # Directory %s already exists
” “$dirResult”
printf ” # Skipping the computation of the given setup
”
fi
}#——————————————————————————
for setup in $setups
do
dirSetupOrig=”setups.orig/$setup”if [ ! -d “$dirSetupOrig” ]
then
echo “Setup directory: $dirSetupOrig” \r
“could not be found – skipping execution” 1>&2
continue
fiif [ “$run” = true ]
then
run_setup “$setup”
else
dry_run_setup “$setup”
fi
doneif notTest “$@” && [ “$run” = true ]
then
./plot
fi#——————————————————————————
実行年月:07/18/2022