mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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:
@ -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
|
||||
|
||||
|
||||
@ -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,57 +11,108 @@ cd "${0%/*}" || exit # Run from this directory
|
||||
interCondensatingEvaporatingFoam
|
||||
"
|
||||
|
||||
# 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
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
#######################################
|
||||
# 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 [ "$parallel" = true ]
|
||||
then
|
||||
( cd "$dirResult" && ./Allrun-parallel )
|
||||
else
|
||||
( cd "$dirResult" && ./Allrun )
|
||||
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"
|
||||
|
||||
cleanTimeDirectories
|
||||
cleanAuxiliary
|
||||
cleanPostProcessing
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -70,74 +120,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/
|
||||
cp -rf 0/ 1.36/
|
||||
|
||||
if [ ! -d constant/polyMesh ]
|
||||
if [ "$run" = true ]
|
||||
then
|
||||
|
||||
runApplication blockMesh
|
||||
|
||||
runApplication renumberMesh -overwrite -constant
|
||||
|
||||
runApplication checkMesh -allTopology -allGeometry -constant
|
||||
|
||||
if [ ! -f "system/setAlphaFieldDict" ]
|
||||
then
|
||||
if [ -f "system/setAlphaFieldDict.liquid" ]
|
||||
then
|
||||
runApplication -s liquid \
|
||||
setAlphaField -dict system/setAlphaFieldDict.liquid
|
||||
fi
|
||||
|
||||
if [ -f "system/setAlphaFieldDict.gas" ]
|
||||
then
|
||||
runApplication -s gas \
|
||||
setAlphaField -dict system/setAlphaFieldDict.gas
|
||||
fi
|
||||
else
|
||||
runApplication setAlphaField
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -18,11 +18,11 @@ plot_t_vs_x() {
|
||||
|
||||
setup="$1"
|
||||
|
||||
benchmarkFile="$FOAM_TUTORIALS/resources/dataset/StefanProblem.dat"
|
||||
benchmarkFile="resources/dataset/StefanProblem.dat"
|
||||
|
||||
sampleFile0="results/$setup/postProcessing/interfaceHeight1/1.36"
|
||||
sampleFile="$sampleFile0/positionClean.dat"
|
||||
sed -e 's/[()]//g' "$sampleFile0/position.dat" > "$sampleFile"
|
||||
sampleDir="results/$setup/postProcessing/interfaceHeight1/1.36"
|
||||
sampleFile="$sampleDir/positionClean.dat"
|
||||
sed -e 's/[()]//g' "$sampleDir/position.dat" > "$sampleFile"
|
||||
image="plots/$setup/t_vs_x.png"
|
||||
|
||||
gnuplot<<EOF
|
||||
@ -50,13 +50,13 @@ EOF
|
||||
|
||||
# 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
|
||||
}
|
||||
|
||||
# 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
|
||||
}
|
||||
|
||||
@ -65,16 +65,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_t_vs_x "$setup"
|
||||
|
||||
done
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
cleanCase0
|
||||
|
||||
rm -Rf old-processor-*
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -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)
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -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
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -0,0 +1,36 @@
|
||||
#!/bin/sh
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
restore0Dir
|
||||
|
||||
cp -Rf 0 1.36/
|
||||
|
||||
if [ ! -d constant/polyMesh ]
|
||||
then
|
||||
runApplication blockMesh
|
||||
|
||||
runApplication renumberMesh -overwrite -constant
|
||||
|
||||
runApplication checkMesh -allTopology -allGeometry -constant
|
||||
fi
|
||||
|
||||
if [ ! -f "system/setAlphaFieldDict" ]
|
||||
then
|
||||
if [ -f "system/setAlphaFieldDict.liquid" ]
|
||||
then
|
||||
runApplication -s liquid \
|
||||
setAlphaField -dict system/setAlphaFieldDict.liquid
|
||||
fi
|
||||
|
||||
if [ -f "system/setAlphaFieldDict.gas" ]
|
||||
then
|
||||
runApplication -s gas \
|
||||
setAlphaField -dict system/setAlphaFieldDict.gas
|
||||
fi
|
||||
else
|
||||
runApplication setAlphaField
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -1 +0,0 @@
|
||||
../../common/0.orig/U
|
||||
@ -1 +0,0 @@
|
||||
../../common/0.orig/p_rgh
|
||||
@ -1 +0,0 @@
|
||||
../../common/constant/g
|
||||
@ -1 +0,0 @@
|
||||
../../common/constant/transportProperties
|
||||
@ -1 +0,0 @@
|
||||
../../common/constant/turbulenceProperties
|
||||
@ -1 +0,0 @@
|
||||
../../common/system/blockMeshDict
|
||||
@ -1 +0,0 @@
|
||||
../../common/system/decomposeParDict
|
||||
@ -1 +0,0 @@
|
||||
../../common/0.orig/U
|
||||
@ -1 +0,0 @@
|
||||
../../common/0.orig/p_rgh
|
||||
@ -1 +0,0 @@
|
||||
../../common/constant/g
|
||||
@ -1 +0,0 @@
|
||||
../../common/constant/transportProperties
|
||||
@ -1 +0,0 @@
|
||||
../../common/constant/turbulenceProperties
|
||||
@ -1 +0,0 @@
|
||||
../../common/system/blockMeshDict
|
||||
@ -1 +0,0 @@
|
||||
../../common/system/decomposeParDict
|
||||
Reference in New Issue
Block a user