TUT: simplify setups.orig cases

DOC: Curle: fix typo in header file (fixes #2498)

TUT: airfoil2D: apply standard freestream conditions for nuTilda and nut
This commit is contained in:
Kutalmis Bercin 2022-05-20 17:41:22 +01:00
parent 9cf6ac4145
commit 408e6b55e9
600 changed files with 2359 additions and 1558 deletions

View File

@ -75,17 +75,17 @@ Usage
c0 330;
// Input - either points or surface
// Input - either point or surface
input points;
input point;
observerPositions ((0 0 0)(1 0 0));
//input surface;
//surface "inputSurface.obj"
// Output - either points or surface
output points;
// Output - either point or surface
output point;
//output surface;
//surfaceType ensight;

View File

@ -3,12 +3,9 @@ cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
#------------------------------------------------------------------------------
cleanCase0
rm -rf 0.orig
rm -rf system
rm -rf constant
rm -rf setups
rm -rf results
rm -rf plots
rm -f setups.orig/common/constant/transportProperties
#------------------------------------------------------------------------------

View File

@ -1,10 +1,9 @@
#!/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
#------------------------------------------------------------------------------
# setups
# settings
# operand setups
setups="
@ -12,6 +11,18 @@ cd "${0%/*}" || exit # Run from this directory
LaunderSharmaKE-nutkWallFunction
"
# 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
# operand exponents of kinematic viscosity values
nuExponents="2 3 4 5 6 7 8"
@ -19,107 +30,163 @@ cd "${0%/*}" || exit # Run from this directory
#------------------------------------------------------------------------------
#######################################
# Collect results into a given path
# and clean the case for the next run
# Create the given setup
# Arguments:
# $1 = Path to move results
# $1 = Path to create the setup
# Outputs:
# Writes info to stdout
#######################################
collect() {
dry_run_setup() {
[ $# -eq 0 ] && { echo "Usage: $0 dir-model"; exit 1; }
[ $# -eq 0 ] && { echo "Usage error: $0"; exit 1; }
collection="$1"
setup="$1"
exponent="$2"
dirSetup="setups/$setup/$exponent"
dirSetupOrig="setups.orig/$setup"
dirOrig="$dirSetupOrig/0.orig"
dirConstant="$dirSetupOrig/constant"
dirSystem="$dirSetupOrig/system"
dirResult=results/"$collection"
dirSettings="$dirResult"/settings
printf "\n# Create the setup: %s %s\n" "$setup" nu=1e-"$exponent"
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 "\n # Directory %s already exists\n" "$dirSetup"
printf " # Skipping the creation of a new setup\n"
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"
exponent="$2"
dirSetup="setups/$setup/$exponent"
dirResult="results/$setup/$exponent"
dry_run_setup "$setup" "$exponent"
[ -d results ] || mkdir -p results
[ -d results/"$setup" ] || mkdir -p results/"$setup"
printf "\n# Run the setup: %s %s\n\n" "$setup" nu=1e-"$exponent"
if [ ! -d "$dirResult" ]
then
cp -Rf "$dirSetup" "$dirResult"
echo " # Collecting results and settings into $dirResult"
mkdir -p "$dirResult"
mkdir -p "$dirSettings"
mv -f $(foamListTimes) "$dirResult"
[ -d postProcessing ] && mv -f postProcessing "$dirResult"
mv -f log.* "$dirResult"
mv -f graphs/ "$dirResult"
mv -f logs/ "$dirResult"
cp -f system/{fv*,controlDict} constant/*Properties "$dirSettings"
mv -f 0/ "$dirSettings"
echo " # Cleaning up the case"
cleanTimeDirectories
cleanAuxiliary
cleanPostProcessing
else
echo " # Directory $dirResult already exists"
echo " # Skipping the computation"
if [ "$common_mesh" = true ]
then
if [ -d results/mesh ]
then
printf "## Copy the common mesh to the setup: %s\n\n" "$setup"
cp -Rf results/mesh/polyMesh "$dirResult"/constant/.
fi
fi
if [ "$common_dynamic_code" = true ]
then
if [ -d results/dynamicCode ]
then
printf "## Copy the common dynamic code to the setup: %s\n\n" "$setup"
cp -Rf results/dynamicCode "$dirResult"/.
fi
fi
if [ "$parallel" = true ]
then
( cd "$dirResult" && ./Allrun-parallel )
else
( cd "$dirResult" && ./Allrun )
fi
if [ "$common_mesh" = true ]
then
if [ ! -d results/mesh ]
then
printf "\n## Store the mesh of %s as the common mesh\n\n" "$setup"
mkdir -p results/mesh
cp -Rf "$dirResult"/constant/polyMesh results/mesh/.
fi
fi
if [ "$common_dynamic_code" = true ]
then
if [ ! -d results/dynamicCode ] && [ -d "$dirResult"/dynamicCode ]
then
printf "\n## Store the dynamic code of %s as the common dynamic code\n\n" "$setup"
cp -Rf "$dirResult"/dynamicCode results/.
fi
fi
else
printf " # Directory %s already exists\n" "$dirResult"
printf " # Skipping the computation of the given setup\n"
fi
}
#------------------------------------------------------------------------------
for setup in $setups
do
echo ""
echo "# Computations for the setup: $setup"
echo ""
dirSetup="setups.orig/$setup"
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
echo "# yPlus vs uPlus" > yPlus_vs_uPlus.xy
for exponent in $nuExponents
do
echo " Setting nu to 1e-$exponent"
sed "s|EXPONENT|$exponent|g" constant/transportProperties.template \
> constant/transportProperties
[ -d 0 ] || restore0Dir
runApplication $(getApplication)
runApplication foamLog log.boundaryFoam
if [ -e logs/yPlus_0 ]
then
yPlus=$(awk < logs/yPlus_0 'END{print $2}')
uPlus=$(awk < logs/uPlus_0 'END{print $2}')
echo "$yPlus $uPlus" >> yPlus_vs_uPlus.xy
fi
collect "$setup/$exponent"
done
mv -f yPlus_vs_uPlus.xy results/"$setup"/
done
[ "$parallel" = true ] && {
echo "boundaryFoam has no parallel option - skipping the execution" 1>&2
exit 1
}
#------------------------------------------------------------------------------
for exponent in $nuExponents
do
sed "s|EXPONENT|$exponent|g" \
setups.orig/common/constant/transportProperties.template > \
setups.orig/common/constant/transportProperties
for setup in $setups
do
dirSetupOrig="setups.orig/$setup"
if [ ! -d "$dirSetupOrig" ]
then
echo "Setup directory: $dirSetupOrig" \
"could not be found - skipping execution" 1>&2
continue
fi
if [ "$run" = true ]
then
run_setup "$setup" "$exponent"
else
dry_run_setup "$setup" "$exponent"
fi
done
done
if notTest "$@" && [ "$run" = true ]
then
./plot
fi
#------------------------------------------------------------------------------

View File

@ -10,4 +10,4 @@ Usage:
- run test using Allrun script
- uses foamLog to generate u+ and y+ values
- postscript (.eps) plot generated using gnuplot, OF_vs_ANALYTICAL.eps
- plots are generated using gnuplot, and can be found under plots directory

View File

@ -72,16 +72,19 @@ command -v gnuplot >/dev/null || {
for setup in $setups
do
echo ""
echo "# Plots for the setup: $setup"
echo ""
[ -d "results/$setup" ] || {
echo "No results/$setup directory found - skipping graph creation" 1>&2
continue
}
dirPlots="plots/$setup"
[ -d "$dirPlots" ] || mkdir -p "$dirPlots"
plot_yPlus_vs_uPlus "$setup"
done

View File

@ -0,0 +1,8 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
#------------------------------------------------------------------------------
cleanCase0
#------------------------------------------------------------------------------

View File

@ -0,0 +1,20 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
./Allrun.pre
runApplication $(getApplication)
runApplication foamLog log.boundaryFoam
if [ -e logs/yPlus_0 ]
then
yPlus=$(awk < logs/yPlus_0 'END{print $2}')
uPlus=$(awk < logs/uPlus_0 'END{print $2}')
echo "$yPlus $uPlus" >> ../yPlus_vs_uPlus.xy
fi
#------------------------------------------------------------------------------

View File

@ -0,0 +1,19 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
canCompile || exit 0 # Dynamic code
restore0Dir
if [ ! -d constant/polyMesh ]
then
runApplication blockMesh
runApplication renumberMesh -overwrite -constant
runApplication checkMesh -allTopology -allGeometry -constant
fi
#------------------------------------------------------------------------------

View File

@ -3,14 +3,9 @@ cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
#------------------------------------------------------------------------------
cleanCase0
rm -rf 0.orig
rm -rf system
rm -rf constant
rm -rf setups
rm -rf results
rm -rf plots
rm -f *.dat
( cd validation/WatersKing && wclean WatersKing )

View File

@ -1,10 +1,9 @@
#!/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
#------------------------------------------------------------------------------
# setups
# settings
# operand setups
setups="
@ -12,124 +11,161 @@ cd "${0%/*}" || exit # Run from this directory
Stokes
"
# flag to enable computations
run=true
# flag to enable computations in parallel mode
parallel=true
# flag to enable to use a common mesh
common_mesh=true
# flag to enable to use a common dynamic code
common_dynamic_code=true
#------------------------------------------------------------------------------
#######################################
# Collect results into a given path
# and clean the case for the next run
# Create the given setup
# Arguments:
# $1 = Path to move results
# $1 = Path to create the setup
# Outputs:
# Writes info to stdout
#######################################
collect() {
dry_run_setup() {
[ $# -eq 0 ] && { echo "Usage: $0 dir-model"; exit 1; }
[ $# -eq 0 ] && { echo "Usage error: $0"; exit 1; }
collection="$1"
setup="$1"
dirSetup="setups/$setup"
dirSetupOrig="setups.orig/$setup"
dirOrig="$dirSetupOrig/0.orig"
dirConstant="$dirSetupOrig/constant"
dirSystem="$dirSetupOrig/system"
dirResult=results/"$collection"
dirSettings="$dirResult"/settings
printf "\n# Create the setup: %s\n" "$setup"
if [ ! -d "$dirResult" ]
if [ ! -d "$dirSetup" ]
then
mkdir -p "$dirSetup"
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"
echo " # Cleaning up the case"
cleanTimeDirectories
cleanAuxiliary
cleanPostProcessing
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
echo " # Directory $dirResult already exists"
echo " # Skipping the computation"
printf "\n # Directory %s already exists\n" "$dirSetup"
printf " # Skipping the creation of a new setup\n"
fi
}
#------------------------------------------------------------------------------
#######################################
# Run the given setup
# Arguments:
# $1 = Path to the setup to run
# Outputs:
# Writes info to stdout
#######################################
run_setup() {
if ! canCompile
then
echo "skipping tutorial $PWD"
exit 0
fi
[ $# -eq 0 ] && { echo "Usage error: $0"; exit 1; }
setup="$1"
dirSetup="setups/$setup"
dirResult="results/$setup"
dry_run_setup "$setup"
[ -d results ] || mkdir -p results
printf "\n# Run the setup: %s\n\n" "$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\n\n" "$setup"
cp -Rf results/mesh/polyMesh "$dirResult"/constant/.
fi
fi
if [ "$common_dynamic_code" = true ]
then
if [ -d results/dynamicCode ]
then
printf "## Copy the common dynamic code to the setup: %s\n\n" "$setup"
cp -Rf results/dynamicCode "$dirResult"/.
fi
fi
if [ "$parallel" = true ]
then
( cd "$dirResult" && ./Allrun-parallel )
else
( cd "$dirResult" && ./Allrun )
fi
if [ "$common_mesh" = true ]
then
if [ ! -d results/mesh ]
then
printf "\n## Store the mesh of %s as the common mesh\n\n" "$setup"
mkdir -p results/mesh
cp -Rf "$dirResult"/constant/polyMesh results/mesh/.
fi
fi
if [ "$common_dynamic_code" = true ]
then
if [ ! -d results/dynamicCode ] && [ -d "$dirResult"/dynamicCode ]
then
printf "\n## Store the dynamic code of %s as the common dynamic code\n\n" "$setup"
cp -Rf "$dirResult"/dynamicCode results/.
fi
fi
else
printf " # Directory %s already exists\n" "$dirResult"
printf " # Skipping the computation of the given setup\n"
fi
}
#------------------------------------------------------------------------------
for setup in $setups
do
dirSetupOrig="setups.orig/$setup"
echo ""
echo "# Computations for the setup: $setup"
echo ""
dirSetup="setups.orig/$setup"
cp -rfL "$dirSetup/0.orig" .
cp -rfL "$dirSetup/constant" .
cp -rfL "$dirSetup/system" .
cp -rf 0.orig/ 0/
if [ ! -d constant/polyMesh ]
if [ ! -d "$dirSetupOrig" ]
then
runApplication blockMesh
runApplication renumberMesh -overwrite -constant
runApplication checkMesh -allTopology -allGeometry -constant
echo "Setup directory: $dirSetupOrig" \
"could not be found - skipping execution" 1>&2
continue
fi
if [ "$parallel" = true ]
if [ "$run" = true ]
then
runApplication decomposePar
runParallel $(getApplication)
runApplication reconstructPar
run_setup "$setup"
else
runApplication $(getApplication)
dry_run_setup "$setup"
fi
if notTest "$@"
then
# postprocessing
tail -n +4 postProcessing/probes/0/U | \
tr -s " " | tr -d '(' | cut -d " " -f2-3 > \
postProcessing/probes/0/Unp
fi
collect "$setup"
done
( cd validation/WatersKing && wmake )
runApplication WatersKing
if notTest "$@" && [ "$run" = true ]
then
./plot
fi
#------------------------------------------------------------------------------

View File

@ -12,37 +12,21 @@ cd "${0%/*}" || exit # Run from this directory
"
#------------------------------------------------------------------------------
# Requires gnuplot
command -v gnuplot >/dev/null || {
echo "FOAM FATAL ERROR: gnuplot not found - skipping graph creation" 1>&2
exit 1
}
# Check "results" directory
[ -d "results" ] || {
echo "FOAM FATAL ERROR: No results directory found - skipping graph creation" 1>&2
exit 1
}
#------------------------------------------------------------------------------
plot_t_vs_Ux() {
setups=$@
benchmarkFile="WatersKing.dat"
n=0
for setup in $setups
do
benchmarkFile="results/$setup/WatersKing.dat"
sampleFiles[$n]="results/$setup/postProcessing/probes/0/Unp"
n=$(($n+1))
done
endTime=$(foamDictionary system/controlDict -entry endTime -value)
endTime=$(foamDictionary results/$setup/system/controlDict -entry endTime -value)
image="plots/planarPoiseuille.png"
gnuplot<<PLT
@ -70,6 +54,21 @@ PLT
}
#------------------------------------------------------------------------------
# Requires gnuplot
command -v gnuplot >/dev/null || {
echo "gnuplot not found - skipping graph creation" 1>&2
exit 1
}
# Check "results" directory
[ -d "results" ] || {
echo "No results directory found - skipping graph creation" 1>&2
exit 1
}
#------------------------------------------------------------------------------
echo ""

View File

@ -0,0 +1,8 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
#------------------------------------------------------------------------------
cleanCase0
#------------------------------------------------------------------------------

View File

@ -0,0 +1,22 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
./Allrun.pre
runApplication $(getApplication)
if notTest "$@"
then
# postprocessing
tail -n +4 postProcessing/probes/0/U | \
tr -s " " | tr -d '(' | cut -d " " -f2-3 > \
postProcessing/probes/0/Unp
( cd ../../validation/WatersKing && wmake )
runApplication WatersKing
fi
#------------------------------------------------------------------------------

View File

@ -0,0 +1,26 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
./Allrun.pre
runApplication decomposePar
runParallel $(getApplication)
runApplication reconstructPar
if notTest "$@"
then
# postprocessing
tail -n +4 postProcessing/probes/0/U | \
tr -s " " | tr -d '(' | cut -d " " -f2-3 > \
postProcessing/probes/0/Unp
( cd ../../validation/WatersKing && wmake )
runApplication WatersKing
fi
#------------------------------------------------------------------------------

View File

@ -0,0 +1,19 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
canCompile || exit 0 # Dynamic code
restore0Dir
if [ ! -d constant/polyMesh ]
then
runApplication blockMesh
runApplication renumberMesh -overwrite -constant
runApplication checkMesh -allTopology -allGeometry -constant
fi
#------------------------------------------------------------------------------

View File

@ -16,20 +16,20 @@ FoamFile
dimensions [0 2 -1 0 0 0 0];
internalField uniform 0.14;
internalField uniform 4e-05;
boundaryField
{
inlet
{
type freestream;
freestreamValue uniform 0.14;
freestreamValue $internalField;
}
outlet
{
type freestream;
freestreamValue uniform 0.14;
freestreamValue $internalField;
}
walls

View File

@ -16,20 +16,20 @@ FoamFile
dimensions [0 2 -1 0 0 0 0];
internalField uniform 0.14;
internalField uniform 1e-05;
boundaryField
{
inlet
{
type freestream;
freestreamValue uniform 0.14;
freestreamValue $internalField;
}
outlet
{
type freestream;
freestreamValue uniform 0.14;
freestreamValue $internalField;
}
walls

View File

@ -3,8 +3,8 @@ cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
#------------------------------------------------------------------------------
cleanCase0
rm -rf *.png
rm -rf setups
rm -rf results
rm -rf plots
#------------------------------------------------------------------------------

View File

@ -1,7 +1,6 @@
#!/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
#------------------------------------------------------------------------------
# settings
@ -13,106 +12,132 @@ cd "${0%/*}" || exit # Run from this directory
kEpsilonPhitF
"
# flag to enable computations
run=true
# flag to enable computations in parallel mode
parallel=true
# flag to enable to use a common mesh
common_mesh=true
# flag to enable to use a common dynamic code
common_dynamic_code=true
#------------------------------------------------------------------------------
#######################################
# Extract a value (Eg, from boundaryField/bump/value)
# Create the given setup
# Arguments:
# $1 = dictEntry
# $2 = inputFile
# $3 = outputFile
# $1 = Path to create the setup
# Outputs:
# Writes to 'outputFile'
# Notes:
# Only retains values between, but not including the ( ) delimiters.
# For example,
#----
# value nonuniform List<scalar>
# 110
# (
# 0.0041520092
# 0.012577691
# 0.021250264
# 0.030176962
# )
# ;
# Writes info to stdout
#######################################
extractVal()
{
if [ -f "$2" ]
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 "\n# Create the setup: %s\n" "$setup"
if [ ! -d "$dirSetup" ]
then
foamDictionary -entry "$1" -value "$2" | \
sed -n '/(/,/)/{ s/[()]//g; /^ *$/d; p}' \
> "$3"
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
# Or some other tag?
echo "Not such file: $2" 1>&2
echo "0" > "$3"
printf "\n # Directory %s already exists\n" "$dirSetup"
printf " # Skipping the creation of a new setup\n"
fi
}
#######################################
# Collect results into a given path
# and clean the case for the next run
# Run the given setup
# Arguments:
# $1 = Path to move results
# $1 = Path to the setup to run
# Outputs:
# Writes info to stdout
#######################################
collect() {
run_setup() {
[ $# -eq 0 ] && { echo "Usage: $0 dir-model"; exit 1; }
[ $# -eq 0 ] && { echo "Usage error: $0"; exit 1; }
collection="$1"
setup="$1"
dirSetup="setups/$setup"
dirResult="results/$setup"
dirResult=results/"$collection"
dirSettings="$dirResult"/settings
dry_run_setup "$setup"
[ -d results ] || mkdir -p results
printf "\n# Run the setup: %s\n\n" "$setup"
if [ ! -d "$dirResult" ]
then
cp -Rf "$dirSetup" "$dirResult"
echo " # Collecting results and settings into $dirResult"
mkdir -p "$dirResult"
mkdir -p "$dirSettings"
endTime=$(foamListTimes -latestTime)
# Create datasets for benchmark comparisons
extractVal boundaryField.bump.value "$endTime/Cx" Cx.$$
extractVal boundaryField.bump.value "$endTime/wallShearStress" tau.$$
extractVal boundaryField.bump.value "$endTime/Cp" cp.$$
echo "# ccx tau_xx tau_yy tau_zz cp" > profiles.dat
paste -d ' ' Cx.$$ tau.$$ cp.$$ >> profiles.dat
rm -f Cx.$$ tau.$$ cp.$$
mv -f $(foamListTimes) "$dirResult"
[ -d postProcessing ] && mv -f postProcessing "$dirResult"
[ -d processor0 ] && mv -f processor* "$dirResult"
mv -f log.* "$dirResult"
mv -f profiles.dat "$dirResult"
cp -f system/{fv*,controlDict} constant/*Properties "$dirSettings"
mv -f 0/ "$dirSettings"
echo " # Cleaning up the case"
cleanTimeDirectories
cleanAuxiliary
cleanPostProcessing
else
echo " # Directory $dirResult already exists"
echo " # Skipping the computation"
if [ "$common_mesh" = true ]
then
if [ -d results/mesh ]
then
printf "## Copy the common mesh to the setup: %s\n\n" "$setup"
cp -Rf results/mesh/polyMesh "$dirResult"/constant/.
fi
fi
if [ "$common_dynamic_code" = true ]
then
if [ -d results/dynamicCode ]
then
printf "## Copy the common dynamic code to the setup: %s\n\n" "$setup"
cp -Rf results/dynamicCode "$dirResult"/.
fi
fi
if [ "$parallel" = true ]
then
( cd "$dirResult" && ./Allrun-parallel )
else
( cd "$dirResult" && ./Allrun )
fi
if [ "$common_mesh" = true ]
then
if [ ! -d results/mesh ]
then
printf "\n## Store the mesh of %s as the common mesh\n\n" "$setup"
mkdir -p results/mesh
cp -Rf "$dirResult"/constant/polyMesh results/mesh/.
fi
fi
if [ "$common_dynamic_code" = true ]
then
if [ ! -d results/dynamicCode ] && [ -d "$dirResult"/dynamicCode ]
then
printf "\n## Store the dynamic code of %s as the common dynamic code\n\n" "$setup"
cp -Rf "$dirResult"/dynamicCode results/.
fi
fi
else
printf " # Directory %s already exists\n" "$dirResult"
printf " # Skipping the computation of the given setup\n"
fi
}
@ -120,58 +145,28 @@ collect() {
for setup in $setups
do
dirSetupOrig="setups.orig/$setup"
echo ""
echo "# Computations for the setup: $setup"
echo ""
dirSetup="setups.orig/$setup"
if [ ! -d "$dirSetup" ]
if [ ! -d "$dirSetupOrig" ]
then
echo "Setup directory: $dirSetup" \
echo "Setup directory: $dirSetupOrig" \
"could not be found - skipping execution" 1>&2
exit 1
continue
fi
cp -rfL "$dirSetup/0.orig" .
cp -rfL "$dirSetup/constant" .
cp -rfL "$dirSetup/system" .
cp -rf 0.orig/ 0/
canCompile || exit 0 # Dynamic code
if [ ! -d constant/polyMesh ]
if [ "$run" = true ]
then
runApplication blockMesh
runApplication renumberMesh -overwrite -constant
runApplication checkMesh -allTopology -allGeometry -constant
fi
if [ "$parallel" = true ]
then
runApplication decomposePar
runParallel -s parallel renumberMesh -overwrite
runParallel $(getApplication)
runApplication reconstructPar
run_setup "$setup"
else
runApplication $(getApplication)
dry_run_setup "$setup"
fi
collect "$setup"
done
if notTest "$@" && [ "$run" = true ]
then
./plot
fi
#------------------------------------------------------------------------------

View File

@ -122,44 +122,39 @@ PLT_X_CP
# Requires gnuplot
command -v gnuplot >/dev/null || {
echo "FOAM FATAL ERROR: gnuplot not found - skipping graph creation" 1>&2
echo "gnuplot not found - skipping graph creation" 1>&2
exit 1
}
# Requires awk
command -v awk >/dev/null || {
echo "FOAM FATAL ERROR: awk not found - skipping graph creation" 1>&2
echo "awk not found - skipping graph creation" 1>&2
exit 1
}
# Check "results" directory
[ -d "results" ] || {
echo "FOAM FATAL ERROR: No results directory found - skipping graph creation" 1>&2
echo "No results directory found - skipping graph creation" 1>&2
exit 1
}
#------------------------------------------------------------------------------
if notTest "$@"
then
dirPlots="plots"
[ -d "$dirPlots" ] || mkdir -p "$dirPlots"
dirPlots="plots/$setup"
[ -d "$dirPlots" ] || mkdir -p "$dirPlots"
echo ""
echo "# Plots for the skin friction coefficient"
echo ""
echo ""
echo "# Plots for the skin friction coefficient"
echo ""
plot_x_vs_Cf "$Uref" $setups
plot_x_vs_Cf "$Uref" $setups
echo ""
echo "# Plots for the pressure coefficient"
echo ""
echo ""
echo "# Plots for the pressure coefficient"
echo ""
plot_x_vs_Cp "$Uref" $setups
fi
plot_x_vs_Cp "$Uref" $setups
# ------------------------------------------------------------------------------

View File

@ -1 +0,0 @@
../../common/constant/transportProperties

View File

@ -0,0 +1,8 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
#------------------------------------------------------------------------------
cleanCase0
#------------------------------------------------------------------------------

View File

@ -0,0 +1,61 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
#######################################
# Extract a value (Eg, from boundaryField/bump/value)
# Arguments:
# $1 = dictEntry
# $2 = inputFile
# $3 = outputFile
# Outputs:
# Writes to 'outputFile'
# Notes:
# Only retains values between, but not including the ( ) delimiters.
# For example,
#----
# value nonuniform List<scalar>
# 110
# (
# 0.0041520092
# 0.012577691
# 0.021250264
# 0.030176962
# )
# ;
#######################################
extractVal()
{
if [ -f "$2" ]
then
foamDictionary -entry "$1" -value "$2" | \
sed -n '/(/,/)/{ s/[()]//g; /^ *$/d; p}' \
> "$3"
else
# Or some other tag?
echo "Not such file: $2" 1>&2
echo "0" > "$3"
fi
}
#------------------------------------------------------------------------------
./Allrun.pre
runApplication $(getApplication)
endTime=$(foamListTimes -latestTime)
# Create datasets for benchmark comparisons
extractVal boundaryField.bump.value "$endTime/Cx" Cx.$$
extractVal boundaryField.bump.value "$endTime/wallShearStress" tau.$$
extractVal boundaryField.bump.value "$endTime/Cp" cp.$$
echo "# ccx tau_xx tau_yy tau_zz cp" > profiles.dat
paste -d ' ' Cx.$$ tau.$$ cp.$$ >> profiles.dat
rm -f Cx.$$ tau.$$ cp.$$
#------------------------------------------------------------------------------

View File

@ -0,0 +1,65 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
#######################################
# Extract a value (Eg, from boundaryField/bump/value)
# Arguments:
# $1 = dictEntry
# $2 = inputFile
# $3 = outputFile
# Outputs:
# Writes to 'outputFile'
# Notes:
# Only retains values between, but not including the ( ) delimiters.
# For example,
#----
# value nonuniform List<scalar>
# 110
# (
# 0.0041520092
# 0.012577691
# 0.021250264
# 0.030176962
# )
# ;
#######################################
extractVal()
{
if [ -f "$2" ]
then
foamDictionary -entry "$1" -value "$2" | \
sed -n '/(/,/)/{ s/[()]//g; /^ *$/d; p}' \
> "$3"
else
# Or some other tag?
echo "Not such file: $2" 1>&2
echo "0" > "$3"
fi
}
#------------------------------------------------------------------------------
./Allrun.pre
runApplication decomposePar
runParallel $(getApplication)
runApplication reconstructPar
endTime=$(foamListTimes -latestTime)
# Create datasets for benchmark comparisons
extractVal boundaryField.bump.value "$endTime/Cx" Cx.$$
extractVal boundaryField.bump.value "$endTime/wallShearStress" tau.$$
extractVal boundaryField.bump.value "$endTime/Cp" cp.$$
echo "# ccx tau_xx tau_yy tau_zz cp" > profiles.dat
paste -d ' ' Cx.$$ tau.$$ cp.$$ >> profiles.dat
rm -f Cx.$$ tau.$$ cp.$$
#------------------------------------------------------------------------------

View File

@ -0,0 +1,19 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
canCompile || exit 0 # Dynamic code
restore0Dir
if [ ! -d constant/polyMesh ]
then
runApplication blockMesh
runApplication renumberMesh -overwrite -constant
runApplication checkMesh -allTopology -allGeometry -constant
fi
#------------------------------------------------------------------------------

View File

@ -1 +0,0 @@
../../common/constant/transportProperties

View File

@ -1 +0,0 @@
../../common/0.orig/U

View File

@ -1 +0,0 @@
../../common/0.orig/nut

View File

@ -1 +0,0 @@
../../common/0.orig/p

View File

@ -1 +0,0 @@
../../common/constant/transportProperties

View File

@ -3,11 +3,7 @@ cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
#------------------------------------------------------------------------------
cleanCase0
rm -rf 0.orig
rm -rf system
rm -rf constant
rm -rf setups
rm -rf results
rm -rf plots
rm -f setups.orig/common/system/blockMeshDict

View File

@ -1,7 +1,6 @@
#!/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
#------------------------------------------------------------------------------
# settings
@ -12,9 +11,18 @@ cd "${0%/*}" || exit # Run from this directory
kEpsilon
"
# flag to enable computations
run=true
# flag to enable computations in parallel mode
parallel=true
# flag to enable to use a common mesh
common_mesh=true
# flag to enable to use a common dynamic code
common_dynamic_code=true
# operand setups for the wall-normal height of the first-cell centre
declare -A grading_vs_yp
#level 5 gradings
@ -40,99 +48,119 @@ cd "${0%/*}" || exit # Run from this directory
#------------------------------------------------------------------------------
#######################################
# Extract a value (Eg, from boundaryField/bump/value)
# Create the given setup
# Arguments:
# $1 = dictEntry
# $2 = inputFile
# $3 = outputFile
# $1 = Path to create the setup
# Outputs:
# Writes to 'outputFile'
# Notes:
# Only retains values between, but not including the ( ) delimiters.
# For example,
#----
# value nonuniform List<scalar>
# 110
# (
# 0.0041520092
# 0.012577691
# 0.021250264
# 0.030176962
# )
# ;
# Writes info to stdout
#######################################
extractVal()
{
if [ -f "$2" ]
dry_run_setup() {
[ $# -eq 0 ] && { echo "Usage error: $0"; exit 1; }
setup="$1"
yp="$2"
dirSetup="setups/$setup/$yp"
dirSetupOrig="setups.orig/$setup"
dirOrig="$dirSetupOrig/0.orig"
dirConstant="$dirSetupOrig/constant"
dirSystem="$dirSetupOrig/system"
printf "\n# Create the setup: %s %s\n" "$setup" yPlus-"$yp"
if [ ! -d "$dirSetup" ]
then
foamDictionary -entry "$1" -value "$2" | \
sed -n '/(/,/)/{ s/[()]//g; /^ *$/d; p}' \
> "$3"
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
# Or some other tag?
echo "Not such file: $2" 1>&2
echo "0" > "$3"
printf "\n # Directory %s already exists\n" "$dirSetup"
printf " # Skipping the creation of a new setup\n"
fi
}
#######################################
# Collect results into a given path
# and clean the case for the next run
# Run the given setup
# Arguments:
# $1 = Path to move results
# $1 = Path to the setup to run
# Outputs:
# Writes info to stdout
#######################################
collect() {
run_setup() {
[ $# -eq 0 ] && { echo "Usage: $0 dir-model"; exit 1; }
[ $# -eq 0 ] && { echo "Usage error: $0"; exit 1; }
collection="$1"
setup="$1"
yp="$2"
dirSetup="setups/$setup/$yp"
dirResult="results/$setup/$yp"
dirResult=results/"$collection"
dirSettings="$dirResult"/settings
dry_run_setup "$setup" "$yp"
[ -d results ] || mkdir -p results
[ -d results/"$setup" ] || mkdir -p results/"$setup"
printf "\n# Run the setup: %s %s\n\n" "$setup" yPlus-"$yp"
if [ ! -d "$dirResult" ]
then
cp -Rf "$dirSetup" "$dirResult"
echo " # Collecting results and settings into $dirResult"
mkdir -p "$dirResult"
mkdir -p "$dirSettings"
endTime=$(foamListTimes -latestTime)
# Create datasets for benchmark comparisons
extractVal boundaryField.bottomWall.value "$endTime/Cx" Cx.$$
extractVal boundaryField.bottomWall.value "$endTime/wallShearStress" tau.$$
extractVal boundaryField.bottomWall.value "$endTime/yPlus" yPlus.$$
echo "# ccx tau_xx tau_yy tau_zz y+" > profiles.dat
paste -d ' ' Cx.$$ tau.$$ yPlus.$$ >> profiles.dat
rm -f Cx.$$ tau.$$ yPlus.$$
mv -f $(foamListTimes) "$dirResult"
[ -d postProcessing ] && mv -f postProcessing "$dirResult"
[ -d processor0 ] && mv -f processor* "$dirResult"
mv -f log.* "$dirResult"
mv -f profiles.dat "$dirResult"
cp -f system/{fv*,controlDict} constant/*Properties "$dirSettings"
mv -f 0/ "$dirSettings"
echo " # Cleaning up the case"
cleanTimeDirectories
cleanAuxiliary
cleanPostProcessing
else
echo " # Directory $dirResult already exists"
echo " # Skipping the computation"
if [ "$common_mesh" = true ]
then
if [ -d results/mesh ]
then
printf "## Copy the common mesh to the setup: %s\n\n" "$setup"
cp -Rf results/mesh/polyMesh "$dirResult"/constant/.
fi
fi
if [ "$common_dynamic_code" = true ]
then
if [ -d results/dynamicCode ]
then
printf "## Copy the common dynamic code to the setup: %s\n\n" "$setup"
cp -Rf results/dynamicCode "$dirResult"/.
fi
fi
if [ "$parallel" = true ]
then
( cd "$dirResult" && ./Allrun-parallel )
else
( cd "$dirResult" && ./Allrun )
fi
if [ "$common_mesh" = true ]
then
if [ ! -d results/mesh ]
then
printf "\n## Store the mesh of %s as the common mesh\n\n" "$setup"
mkdir -p results/mesh
cp -Rf "$dirResult"/constant/polyMesh results/mesh/.
fi
fi
if [ "$common_dynamic_code" = true ]
then
if [ ! -d results/dynamicCode ] && [ -d "$dirResult"/dynamicCode ]
then
printf "\n## Store the dynamic code of %s as the common dynamic code\n\n" "$setup"
cp -Rf "$dirResult"/dynamicCode results/.
fi
fi
else
printf " # Directory %s already exists\n" "$dirResult"
printf " # Skipping the computation of the given setup\n"
fi
}
@ -140,7 +168,6 @@ collect() {
for i in "${!grading_vs_yp[@]}"
do
yp=$i
grading=${grading_vs_yp[$yp]}
@ -150,60 +177,31 @@ do
for setup in $setups
do
dirSetupOrig="setups.orig/$setup"
echo ""
echo "# Computations for the setup and y+: $setup - $yp"
echo ""
dirSetup="setups.orig/$setup"
if [ ! -d "$dirSetup" ]
if [ ! -d "$dirSetupOrig" ]
then
echo "Setup directory: $dirSetup" \
echo "Setup directory: $dirSetupOrig" \
"could not be found - skipping execution" 1>&2
exit 1
continue
fi
cp -rfL "$dirSetup/0.orig" .
cp -rfL "$dirSetup/constant" .
cp -rfL "$dirSetup/system" .
cp -rf 0.orig/ 0/
if [ ! -d constant/polyMesh ]
if [ "$run" = true ]
then
runApplication blockMesh
runApplication renumberMesh -overwrite -constant
runApplication checkMesh -allTopology -allGeometry -constant
fi
if [ "$parallel" = true ]
then
runApplication decomposePar
runParallel $(getApplication)
runApplication reconstructPar
run_setup "$setup" "$yp"
else
runApplication $(getApplication)
dry_run_setup "$setup" "$yp"
fi
collect "$setup/$yp"
done
rm -rf 0.orig
rm -rf constant
rm -rf system
rm -Rf results/mesh
done
#-----------------------------------------------------------------------------
if notTest "$@" && [ "$run" = true ]
then
./plot
fi
#------------------------------------------------------------------------------

View File

@ -63,7 +63,7 @@ plot_Rex_vs_Cf() {
plot \
weighardt(x) t "Weighardt" w lines lc "red" lw 2, \
samples u (\$1 - X0)*Uref/nu:(sqrt(\$2*\$2 + \$3*\$3 + \$4*\$4)/(0.5*Uref*Uref)) \
samples u (\$1 - x0)*Uref/nu:(sqrt(\$2*\$2 + \$3*\$3 + \$4*\$4)/(0.5*Uref*Uref)) \
t "$setup y^+ ${yp}" w l lc "black" lw 2
PLT_REX_VS_CF
}
@ -73,19 +73,19 @@ PLT_REX_VS_CF
# Requires gnuplot
command -v gnuplot >/dev/null || {
echo "FOAM FATAL ERROR: gnuplot not found - skipping graph creation" 1>&2
echo "gnuplot not found - skipping graph creation" 1>&2
exit 1
}
# Requires awk
command -v awk >/dev/null || {
echo "FOAM FATAL ERROR: awk not found - skipping graph creation" 1>&2
echo "awk not found - skipping graph creation" 1>&2
exit 1
}
# Check "results" directory
[ -d "results" ] || {
echo "FOAM FATAL ERROR: No results directory found - skipping graph creation" 1>&2
echo "No results directory found - skipping graph creation" 1>&2
exit 1
}
@ -94,26 +94,26 @@ command -v awk >/dev/null || {
for setup in $setups
do
for yp in $yps
do
echo ""
echo "# Plots for the setup and y+: $setup - $yp"
echo ""
dirPlots="plots/$setup/$yp"
resultsDir="results/$setup/$yp"
[ -d "$resultsDir" ] || {
echo "No $resultsDir directory found - skipping graph creation" 1>&2
continue
}
dirPlots="plots/$setup"
[ -d "$dirPlots" ] || mkdir -p "$dirPlots"
# few manipulations
resultsDir="results/$setup/$yp"
Uref=$(foamDictionary $resultsDir/0/U -entry internalField | sed 's/^.*(\s*\([^ ]*\).*/\1/g')
nu=$(foamDictionary $resultsDir/settings/transportProperties -entry nu | sed 's|^.*\s\(.*\);|\1|g')
nu=$(foamDictionary $resultsDir/constant/transportProperties -entry nu | sed 's|^.*\s\(.*\);|\1|g')
plot_Rex_vs_Cf "$setup" "$yp" "$Uref" "$nu"
done
done

View File

@ -0,0 +1,8 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
#------------------------------------------------------------------------------
cleanCase0
#------------------------------------------------------------------------------

View File

@ -0,0 +1,61 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
#######################################
# Extract a value (Eg, from boundaryField/bump/value)
# Arguments:
# $1 = dictEntry
# $2 = inputFile
# $3 = outputFile
# Outputs:
# Writes to 'outputFile'
# Notes:
# Only retains values between, but not including the ( ) delimiters.
# For example,
#----
# value nonuniform List<scalar>
# 110
# (
# 0.0041520092
# 0.012577691
# 0.021250264
# 0.030176962
# )
# ;
#######################################
extractVal()
{
if [ -f "$2" ]
then
foamDictionary -entry "$1" -value "$2" | \
sed -n '/(/,/)/{ s/[()]//g; /^ *$/d; p}' \
> "$3"
else
# Or some other tag?
echo "Not such file: $2" 1>&2
echo "0" > "$3"
fi
}
#------------------------------------------------------------------------------
./Allrun.pre
runApplication $(getApplication)
endTime=$(foamListTimes -latestTime)
# Create datasets for benchmark comparisons
extractVal boundaryField.bottomWall.value "$endTime/Cx" Cx.$$
extractVal boundaryField.bottomWall.value "$endTime/wallShearStress" tau.$$
extractVal boundaryField.bottomWall.value "$endTime/yPlus" yPlus.$$
echo "# ccx tau_xx tau_yy tau_zz y+" > profiles.dat
paste -d ' ' Cx.$$ tau.$$ yPlus.$$ >> profiles.dat
rm -f Cx.$$ tau.$$ yPlus.$$
#------------------------------------------------------------------------------

View File

@ -0,0 +1,65 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
#######################################
# Extract a value (Eg, from boundaryField/bump/value)
# Arguments:
# $1 = dictEntry
# $2 = inputFile
# $3 = outputFile
# Outputs:
# Writes to 'outputFile'
# Notes:
# Only retains values between, but not including the ( ) delimiters.
# For example,
#----
# value nonuniform List<scalar>
# 110
# (
# 0.0041520092
# 0.012577691
# 0.021250264
# 0.030176962
# )
# ;
#######################################
extractVal()
{
if [ -f "$2" ]
then
foamDictionary -entry "$1" -value "$2" | \
sed -n '/(/,/)/{ s/[()]//g; /^ *$/d; p}' \
> "$3"
else
# Or some other tag?
echo "Not such file: $2" 1>&2
echo "0" > "$3"
fi
}
#------------------------------------------------------------------------------
./Allrun.pre
runApplication decomposePar
runParallel $(getApplication)
runApplication reconstructPar
endTime=$(foamListTimes -latestTime)
# Create datasets for benchmark comparisons
extractVal boundaryField.bottomWall.value "$endTime/Cx" Cx.$$
extractVal boundaryField.bottomWall.value "$endTime/wallShearStress" tau.$$
extractVal boundaryField.bottomWall.value "$endTime/yPlus" yPlus.$$
echo "# ccx tau_xx tau_yy tau_zz y+" > profiles.dat
paste -d ' ' Cx.$$ tau.$$ yPlus.$$ >> profiles.dat
rm -f Cx.$$ tau.$$ yPlus.$$
#------------------------------------------------------------------------------

View File

@ -0,0 +1,19 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
canCompile || exit 0 # Dynamic code
restore0Dir
if [ ! -d constant/polyMesh ]
then
runApplication blockMesh
runApplication renumberMesh -overwrite -constant
runApplication checkMesh -allTopology -allGeometry -constant
fi
#------------------------------------------------------------------------------

View File

@ -1 +0,0 @@
../../common/constant/transportProperties

View File

@ -1 +0,0 @@
../../common/constant/transportProperties

View File

@ -3,11 +3,7 @@ cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
#------------------------------------------------------------------------------
cleanCase0
rm -rf 0.orig
rm -rf system
rm -rf constant
rm -rf setups
rm -rf results
rm -rf plots

View File

@ -1,7 +1,6 @@
#!/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
#------------------------------------------------------------------------------
# settings
@ -12,54 +11,131 @@ cd "${0%/*}" || exit # Run from this directory
kOmegaSST
"
# flag to enable computations
run=true
# flag to enable computations in parallel mode
parallel=true
# flag to enable to use a common mesh
common_mesh=true
# flag to enable to use a common dynamic code
common_dynamic_code=false
#------------------------------------------------------------------------------
#######################################
# Collect results into a given path
# and clean the case for the next run
# Create the given setup
# Arguments:
# $1 = Path to move results
# $1 = Path to create the setup
# Outputs:
# Writes info to stdout
#######################################
collect() {
dry_run_setup() {
[ $# -eq 0 ] && { echo "Usage: $0 dir-model"; exit 1; }
[ $# -eq 0 ] && { echo "Usage error: $0"; exit 1; }
collection="$1"
setup="$1"
dirSetup="setups/$setup"
dirSetupOrig="setups.orig/$setup"
dirOrig="$dirSetupOrig/0.orig"
dirConstant="$dirSetupOrig/constant"
dirSystem="$dirSetupOrig/system"
dirResult=results/"$collection"
dirSettings="$dirResult"/settings
printf "\n# Create the setup: %s\n" "$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 "\n # Directory %s already exists\n" "$dirSetup"
printf " # Skipping the creation of a new setup\n"
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 results
printf "\n# Run the setup: %s\n\n" "$setup"
if [ ! -d "$dirResult" ]
then
cp -Rf "$dirSetup" "$dirResult"
echo " # Collecting results and settings into $dirResult"
if [ "$common_mesh" = true ]
then
if [ -d results/mesh ]
then
printf "## Copy the common mesh to the setup: %s\n\n" "$setup"
cp -Rf results/mesh/polyMesh "$dirResult"/constant/.
fi
fi
mkdir -p "$dirResult"
mkdir -p "$dirSettings"
if [ "$common_dynamic_code" = true ]
then
if [ -d results/dynamicCode ]
then
printf "## Copy the common dynamic code to the setup: %s\n\n" "$setup"
cp -Rf results/dynamicCode "$dirResult"/.
fi
fi
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"
echo " # Cleaning up the case"
if [ "$parallel" = true ]
then
( cd "$dirResult" && ./Allrun-parallel )
else
( cd "$dirResult" && ./Allrun )
fi
if [ "$common_mesh" = true ]
then
if [ ! -d results/mesh ]
then
printf "\n## Store the mesh of %s as the common mesh\n\n" "$setup"
mkdir -p results/mesh
cp -Rf "$dirResult"/constant/polyMesh results/mesh/.
fi
fi
if [ "$common_dynamic_code" = true ]
then
if [ ! -d results/dynamicCode ] && [ -d "$dirResult"/dynamicCode ]
then
printf "\n## Store the dynamic code of %s as the common dynamic code\n\n" "$setup"
cp -Rf "$dirResult"/dynamicCode results/.
fi
fi
cleanTimeDirectories
cleanAuxiliary
cleanPostProcessing
else
echo " # Directory $dirResult already exists"
echo " # Skipping the computation"
printf " # Directory %s already exists\n" "$dirResult"
printf " # Skipping the computation of the given setup\n"
fi
}
@ -68,54 +144,28 @@ collect() {
for setup in $setups
do
dirSetupOrig="setups.orig/$setup"
echo ""
echo "# Computations for the setup: $setup"
echo ""
dirSetup="setups.orig/$setup"
if [ ! -d "$dirSetup" ]
if [ ! -d "$dirSetupOrig" ]
then
echo "Setup directory: $dirSetup" \
echo "Setup directory: $dirSetupOrig" \
"could not be found - skipping execution" 1>&2
exit 1
continue
fi
cp -rfL "$dirSetup/0.orig" .
cp -rfL "$dirSetup/constant" .
cp -rfL "$dirSetup/system" .
cp -rf 0.orig/ 0/
if [ ! -d constant/polyMesh ]
if [ "$run" = true ]
then
runApplication blockMesh
runApplication renumberMesh -overwrite -constant
runApplication checkMesh -allTopology -allGeometry -constant
fi
if [ "$parallel" = true ]
then
runApplication decomposePar
runParallel $(getApplication)
runApplication reconstructPar
run_setup "$setup"
else
runApplication $(getApplication)
dry_run_setup "$setup"
fi
collect "$setup"
done
if notTest "$@" && [ "$run" = true ]
then
./plot
fi
#------------------------------------------------------------------------------

View File

@ -31,7 +31,7 @@ plot_ux_vs_znorm_upstream() {
endTime="$1"
zMin="$2"
benchmarkFile="$FOAM_TUTORIALS/resources/dataset/atm-HargreavesWright-2007/Ux-HW-RH-Fig6a"
benchmarkFile="resources/dataset/Ux-HW-RH-Fig6a"
sampleFile="results/$setup/postProcessing/samples_u/$endTime"
image="plots/$setup/ux_vs_znorm_upstream.png"
@ -72,7 +72,7 @@ plot_ux_vs_znorm_middle() {
endTime="$1"
zMin="$2"
benchmarkFile="$FOAM_TUTORIALS/resources/dataset/atm-HargreavesWright-2007/Ux-HW-RH-Fig6a"
benchmarkFile="resources/dataset/Ux-HW-RH-Fig6a"
sampleFile="results/$setup/postProcessing/samples_u/$endTime"
image="plots/$setup/ux_vs_znorm_middle.png"
@ -113,7 +113,7 @@ plot_ux_vs_znorm_downstream() {
endTime="$1"
zMin="$2"
benchmarkFile="$FOAM_TUTORIALS/resources/dataset/atm-HargreavesWright-2007/Ux-HW-RH-Fig6a"
benchmarkFile="resources/dataset/Ux-HW-RH-Fig6a"
sampleFile="results/$setup/postProcessing/samples_u/$endTime"
image="plots/$setup/ux_vs_znorm_downstream.png"
@ -154,7 +154,7 @@ plot_k_vs_znorm() {
endTime="$1"
zMin="$2"
benchmarkFile="$FOAM_TUTORIALS/resources/dataset/atm-HargreavesWright-2007"
benchmarkFile="resources/dataset"
sampleFile="results/$setup/postProcessing/samples_k/$endTime"
image="plots/$setup/k_vs_znorm.png"
@ -205,7 +205,7 @@ plot_epsilon_vs_znorm() {
endTime="$1"
zMin="$2"
benchmarkFile="$FOAM_TUTORIALS/resources/dataset/atm-HargreavesWright-2007/epsilon-HW-RH-Fig6c"
benchmarkFile="resources/dataset/epsilon-HW-RH-Fig6c"
sampleFile="results/$setup/postProcessing/samples_epsilon/$endTime"
image="plots/$setup/epsilon_vs_znorm.png"
@ -299,7 +299,7 @@ plot_nut_vs_znorm() {
endTime="$1"
zMin="$2"
benchmarkFile="$FOAM_TUTORIALS/resources/dataset/atm-HargreavesWright-2007/"
benchmarkFile="resources/dataset"
sampleFile="results/$setup/postProcessing/samples_nut/$endTime"
image="plots/$setup/nut_vs_znorm.png"
@ -361,16 +361,20 @@ command -v gnuplot >/dev/null || {
for setup in $setups
do
echo ""
echo "# Plots for the setup: $setup"
echo ""
[ -d "results/$setup" ] || {
echo "No results/$setup directory found - skipping graph creation" 1>&2
continue
}
dirPlots="plots/$setup"
[ -d "$dirPlots" ] || mkdir -p "$dirPlots"
endTime=$( \
foamDictionary results/$setup/settings/controlDict \
foamDictionary results/$setup/system/controlDict \
-disableFunctionEntries -entry endTime -value \
)
@ -383,32 +387,23 @@ do
if [ -d "results/$setup/postProcessing/samples_k" ]
then
plot_k_vs_znorm "$endTime" "$zMin"
fi
if [ -d "results/$setup/postProcessing/samples_epsilon" ]
then
plot_epsilon_vs_znorm "$endTime" "$zMin"
fi
if [ -d "results/$setup/postProcessing/samples_omega" ]
then
plot_omega_vs_znorm "$endTime" "$zMin"
fi
if [ -d "results/$setup/postProcessing/samples_nut" ]
then
plot_nut_vs_znorm "$endTime" "$zMin"
fi
done

View File

@ -0,0 +1,8 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
#------------------------------------------------------------------------------
cleanCase0
#------------------------------------------------------------------------------

View File

@ -0,0 +1,10 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
./Allrun.pre
runApplication $(getApplication)
#------------------------------------------------------------------------------

View File

@ -0,0 +1,14 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
./Allrun.pre
runApplication decomposePar
runParallel $(getApplication)
runApplication reconstructPar
#------------------------------------------------------------------------------

View File

@ -0,0 +1,17 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
restore0Dir
if [ ! -d constant/polyMesh ]
then
runApplication blockMesh
runApplication renumberMesh -overwrite -constant
runApplication checkMesh -allTopology -allGeometry -constant
fi
#------------------------------------------------------------------------------

Some files were not shown because too many files have changed in this diff Show More