TUT: basic, IO, preProcessing, VV: clean up tutorials

- TUT: mesh: add missing SnakeRiverCanyon files
- TUT: mesh: add missing cp source in a foamyHexMesh tutorial
This commit is contained in:
Kutalmis Bercin
2021-06-02 12:44:21 +01:00
parent 48cdf5523b
commit 3384d37a9a
840 changed files with 14574 additions and 41272 deletions

View File

@ -4,33 +4,123 @@ cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
#------------------------------------------------------------------------------
./Allrun.pre
# settings
# Settings
RASmodel="kEpsilon" # "kOmegaSST"
stability="neutral"
Lmax="41.8"
qPlant="0.0"
# operand setups (only neutral stability)
setups="
kEpsilon
kOmegaSST
"
echo " # Computations for the atmopsheric stability = $stability:"
echo " ## Lmax = $Lmax [m], qPlant = $qPlant [-]"
# flag to enable computations in parallel mode
parallel=true
#------------------------------------------------------------------------------
#######################################
# Collect results and mesh into a given path
# and clean the case for the next run
# Arguments:
# $1 = Path to move results
# Outputs:
# Writes info to stdout
#######################################
collect() {
[ $# -eq 0 ] && { echo "Usage: $0 dir-model"; exit 1; }
collection="$1"
dirResult=results/"$collection"
dirSettings="$dirResult"/settings
if [ ! -d "$dirResult" ]
then
echo " # Collecting results and settings into $dirResult"
mkdir -p "$dirResult"
mkdir -p "$dirSettings"
mv -f $(foamListTimes) "$dirResult"
[ -d postProcessing ] && mv -f postProcessing "$dirResult"
[ -d processor0 ] && mv -f processor* "$dirResult"
mv -f log.* "$dirResult"
cp -f system/{fv*,controlDict} constant/*Properties "$dirSettings"
mv -f 0/ "$dirSettings"
[ -d constant ] && mv -f constant "$dirResult"
[ -d system ] && mv -f system "$dirResult"
echo " # Cleaning up the case"
cleanTimeDirectories
cleanPostProcessing
else
echo " # Directory $dirResult already exists"
echo " # Skipping the computation"
fi
}
#------------------------------------------------------------------------------
sed -e "s|RAS_MODEL|$RASmodel|g" \
constant/turbulenceProperties.template \
> constant/turbulenceProperties
sed -e "s|L_MAX|$Lmax|g" constant/fvOptions.template > constant/fvOptions
sed -e "s|Q_PLANT|$qPlant|g" 0/qPlant.template > 0/qPlant
rm -f 0/qPlant.template
for setup in $setups
do
runApplication renumberMesh -overwrite
echo ""
echo "# Computations for the setup: $setup"
echo ""
runApplication $(getApplication)
dirSetup="setups.orig/$setup"
if [ ! -d "$dirSetup" ]
then
echo "Setup directory: $dirSetup" \
"could not be found - skipping execution" 1>&2
exit 1
fi
cp -rfL "$dirSetup/0.orig" .
cp -rfL "$dirSetup/constant" .
cp -rfL "$dirSetup/system" .
cp -rf 0.orig/ 0/
if [ ! -d constant/polyMesh ]
then
runApplication blockMesh
runApplication renumberMesh -overwrite -constant
runApplication checkMesh -allTopology -allGeometry -constant
fi
if [ "$parallel" = true ]
then
runApplication decomposePar
runParallel $(getApplication)
runApplication reconstructPar
else
runApplication $(getApplication)
fi
# Scale up all the dimensions of the precursor computational domain
# to encapsulate the successor domain, so that mapFields can be used
runApplication transformPoints -scale '(10 10 1)' -translate '(0 0 20)'
collect "$setup"
done
# Scale up all the dimensions of the precursor computational domain
# to encapsulate the successor domain, so that mapFields can be used
runApplication transformPoints -scale '(10 10 1)' -translate '(0 0 20)'
#------------------------------------------------------------------------------