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

@ -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
@ -20,57 +19,132 @@ cd "${0%/*}" || exit # Run from this directory
85
"
# flag to enable computations
run=true
# flag to enable computations in parallel mode
parallel=true
parallel=false
# flag to enable to use a common mesh
common_mesh=false
# 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"/system
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 "$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"
mv -f logs "$dirResult"
mv -f constant "$dirResult"/
cp -f system/fv* system/controlDict "$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 ]
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
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
}
@ -78,66 +152,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/
runApplication blockMesh
runApplication renumberMesh -overwrite -constant
runApplication checkMesh \
-allTopology -allGeometry -constant \
-writeAllFields -writeAllSurfaceFields
if [ "$parallel" = true ]
if [ "$run" = true ]
then
runApplication decomposePar
runParallel -s parallel renumberMesh -overwrite
runParallel $(getApplication)
runApplication reconstructPar
run_setup "$setup"
else
runApplication $(getApplication)
dry_run_setup "$setup"
fi
# runtime sampling has problems in parallel mode (Apr 2021)
runApplication \
postProcess -func sample -latestTime
runApplication -s "epsilon" \
postProcess -func sampleEpsilon -latestTime
runApplication -s "G"\
postProcess -func sampleG -latestTime
runApplication foamLog log.$(getApplication)
collect "$setup"
done
if notTest "$@" && [ "$run" = true ]
then
./plot
fi
#------------------------------------------------------------------------------

View File

@ -148,7 +148,7 @@ plot_yPlus_vs_uPlus() {
uTau="$4"
# benchmarkFile="$FOAM_TUTORIALS/resources/dataset/planeChannelFlow/ReTau-395/chan395.means"
sampleFile="results/$setup/postProcessing/sample/$endTime/y_U.xy"
sampleFile="results/$setup/postProcessing/sampleU/$endTime/y_U.xy"
image="plots/$setup/yPlus_vs_uPlus.png"
gnuplot<<PLT_Y_VS_U
@ -187,8 +187,8 @@ plot_yPlus_vs_R() {
uTau="$4"
# benchmarkFile="$FOAM_TUTORIALS/resources/dataset/planeChannelFlow/ReTau-395/chan395.reystress"
sampleFile="results/$setup/postProcessing/sample/$endTime/y_turbulenceProperties:R.xy"
sampleFileK="results/$setup/postProcessing/sample/$endTime/y_turbulenceProperties:k.xy"
sampleFile="results/$setup/postProcessing/sampleR/$endTime/y_turbulenceProperties:R.xy"
sampleFileK="results/$setup/postProcessing/sampleK/$endTime/y_turbulenceProperties:k.xy"
imageUU="plots/$setup/yPlus_vs_Ruu.png"
imageVV="plots/$setup/yPlus_vs_Rvv.png"
imageWW="plots/$setup/yPlus_vs_Rww.png"
@ -346,7 +346,7 @@ plot_yPlus_vs_uPlus_all_setups() {
tau=$(foamDictionary results/$setup/$endTime/wallShearStress -entry boundaryField.bottom.value -value | sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' | cut -d' ' -f6)
uTau=$(awk -v tau="$tau" 'BEGIN { printf "%.16f", sqrt(-1*tau) }')
sampleFiles[$n]="results/$setup/postProcessing/sample/$endTime/y_U.xy"
sampleFiles[$n]="results/$setup/postProcessing/sampleU/$endTime/y_U.xy"
nus[$n]="$nu"
uTaus[$n]="$uTau"
n=$(($n+1))
@ -401,8 +401,8 @@ plot_yPlus_vs_R_all_setups() {
tau=$(foamDictionary results/$setup/$endTime/wallShearStress -entry boundaryField.bottom.value -value | sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' | cut -d' ' -f6)
uTau=$(awk -v tau="$tau" 'BEGIN { printf "%.16f", sqrt(-1*tau) }')
sampleFiles[$n]="results/$setup/postProcessing/sample/$endTime/y_turbulenceProperties:R.xy"
sampleFilesK[$n]="results/$setup/postProcessing/sample/$endTime/y_turbulenceProperties:k.xy"
sampleFiles[$n]="results/$setup/postProcessing/sampleR/$endTime/y_turbulenceProperties:R.xy"
sampleFilesK[$n]="results/$setup/postProcessing/sampleK/$endTime/y_turbulenceProperties:k.xy"
nus[$n]="$nu"
uTaus[$n]="$uTau"
n=$(($n+1))
@ -623,11 +623,15 @@ command -v awk >/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"
@ -648,7 +652,6 @@ do
plot_initial_iteration_residuals "$setup"
plot_final_iteration_residuals "$setup"
done
plot_yPlus_vs_uPlus_all_setups $setups

View File

@ -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-*
#------------------------------------------------------------------------------

View File

@ -0,0 +1,18 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
./Allrun.pre
runApplication $(getApplication)
runApplication -s "epsilon" postProcess -func sampleEpsilon -latestTime
runApplication -s "k" postProcess -func sampleK -latestTime
runApplication -s "R" postProcess -func sampleR -latestTime
runApplication -s "G" postProcess -func sampleG -latestTime
runApplication -s "U" postProcess -func sampleU -latestTime
runApplication foamLog log.$(getApplication)
#------------------------------------------------------------------------------

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 decomposePar
runParallel $(getApplication)
runApplication reconstructPar
runApplication -s "epsilon" postProcess -func sampleEpsilon -latestTime
runApplication -s "k" postProcess -func sampleK -latestTime
runApplication -s "R" postProcess -func sampleR -latestTime
runApplication -s "G" postProcess -func sampleG -latestTime
runApplication -s "U" postProcess -func sampleU -latestTime
runApplication foamLog log.$(getApplication)
#------------------------------------------------------------------------------

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
#------------------------------------------------------------------------------

View File

@ -0,0 +1,48 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2206 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object sample;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
type sets;
libs (sampling);
interpolationScheme cellPoint;
setFormat raw;
executeControl writeTime;
writeControl writeTime;
fields
(
turbulenceProperties:R
);
sets
{
ref_point
{
type cloud;
axis y;
points ((0.5 1 0.5));
}
y
{
type midPoint;
axis y;
start (0.5 0 0.5);
end (0.5 1 0.5);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,48 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2206 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object sample;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
type sets;
libs (sampling);
interpolationScheme cellPoint;
setFormat raw;
executeControl writeTime;
writeControl writeTime;
fields
(
U
);
sets
{
ref_point
{
type cloud;
axis y;
points ((0.5 1 0.5));
}
y
{
type midPoint;
axis y;
start (0.5 0 0.5);
end (0.5 1 0.5);
}
}
// ************************************************************************* //

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