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/bash
#!/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
@ -16,55 +15,131 @@ cd "${0%/*}" || exit # Run from this directory
unstable
"
# 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
}
@ -73,61 +148,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 setFields
runParallel $(getApplication)
runParallel redistributePar -reconstruct -latestTime
run_setup "$setup"
else
runApplication setFields
runApplication $(getApplication)
dry_run_setup "$setup"
fi
runApplication postProcess -funcs \
"(minMaxComponents(U) minMaxMagnitude(U))" -latestTime
collect "$setup"
done
if notTest "$@" && [ "$run" = true ]
then
./plot
fi
#------------------------------------------------------------------------------

View File

@ -70,14 +70,14 @@ plot_u_vs_z() {
shift 2
setups=$@
benchmarkFile="$FOAM_TUTORIALS/resources/dataset/atm-Arnqvist-2015/uNorm-zNorm.dat"
benchmarkFile="resources/dataset/uNorm-zNorm.dat"
i=0
for setup in $setups
do
endTime=$(foamDictionary results/$setup/settings/controlDict -entry endTime -value)
endTime=$(foamDictionary results/$setup/system/controlDict -disableFunctionEntries -entry endTime -value)
sampleFile="results/$setup/postProcessing/samples/$endTime/lineZ1_U.xy"
sampleFile="results/$setup/postProcessing/sampleU/$endTime/lineZ1_U.xy"
# Store the ground-normal height
z=($(awk '{ printf "%.16f\n", $1 }' $sampleFile))
@ -166,14 +166,14 @@ plot_k_vs_z() {
shift 2
setups=$@
benchmarkFile="$FOAM_TUTORIALS/resources/dataset/atm-Arnqvist-2015/kNorm-zNorm.dat"
benchmarkFile="resources/dataset/kNorm-zNorm.dat"
i=0
for setup in $setups
do
endTime=$(foamDictionary results/$setup/settings/controlDict -entry endTime -value)
endTime=$(foamDictionary results/$setup/system/controlDict -disableFunctionEntries -entry endTime -value)
sampleFile="results/$setup/postProcessing/samples/$endTime/lineZ1_ObukhovLength_T_Ustar_k_p_rgh.xy"
sampleFile="results/$setup/postProcessing/sampleScalars/$endTime/lineZ1_ObukhovLength_T_Ustar_k_p_rgh.xy"
# Store the ground-normal height profile
z=($(awk '{ printf "%.16f\n", $1 }' $sampleFile))
@ -265,9 +265,9 @@ print_Obukhov_length() {
i=0
for setup in $setups
do
endTime=$(foamDictionary results/$setup/settings/controlDict -entry endTime -value)
endTime=$(foamDictionary results/$setup/system/controlDict -disableFunctionEntries -entry endTime -value)
sampleFile="results/$setup/postProcessing/samples/$endTime/lineZ1_ObukhovLength_T_Ustar_k_p_rgh.xy"
sampleFile="results/$setup/postProcessing/sampleScalars/$endTime/lineZ1_ObukhovLength_T_Ustar_k_p_rgh.xy"
# Store the ground-normal height profile
z=($(awk '{ printf "%.16f\n", $1 }' $sampleFile))
@ -299,14 +299,14 @@ plot_alpha_vs_z() {
shift 2
setups=$@
benchmarkFile="$FOAM_TUTORIALS/resources/dataset/atm-Arnqvist-2015/veer-zNorm.dat"
benchmarkFile="resources/dataset/veer-zNorm.dat"
i=0
for setup in $setups
do
endTime=$(foamDictionary results/$setup/settings/controlDict -entry endTime -value)
endTime=$(foamDictionary results/$setup/system/controlDict -disableFunctionEntries -entry endTime -value)
sampleFile="results/$setup/postProcessing/samples/$endTime/lineZ1_U.xy"
sampleFile="results/$setup/postProcessing/sampleU/$endTime/lineZ1_U.xy"
# Store the ground-normal height
z=($(awk '{ printf "%.16f\n", $1 }' $sampleFile))

View File

@ -0,0 +1,48 @@
# Stratification = Very stable
# k/k@(zRef=40m) z/zRef=20[m]
5.050476682 2.0032
4.708841902 2.94998
4.016252759 4.00501
3.328857722 4.90112
3.317729463 6.00696
3.383228433 6.88859
# Stratification = Stable
# k/k@(zRef=40m) z/zRef=20[m]
4.24970097 2.0032
4.149517291 2.94998
3.859303812 4.00501
3.463663054 4.90112
3.124025564 6.00696
3.103046306 6.88859
# Stratification = Slightly stable
# k/k@(zRef=40m) z/zRef=20[m]
3.897762917 2.0032
3.816771933 2.94998
3.707861851 4.00501
3.54779421 4.90112
3.310490034 6.00696
3.179855803 6.88859
# Stratification = Neutral
# k/k@(zRef=40m) z/zRef=20[m]
3.788680963 2.0032
3.715671223 2.94998
3.59401204 4.00501
3.465226229 4.90112
3.251834724 6.00696
3.130716879 6.88859
# Stratification = Slightly unstable
# k/k@(zRef=40m) z/zRef=20[m]
4.038160328 2.0032
4.012134117 2.94998
3.768972354 4.00501
3.6049338 4.90112
3.364303911 6.00696
3.252063911 6.88859
# Stratification = Unstable
# k/k@(zRef=40m) z/zRef=20[m]
4.198358216 2.0032
4.008932555 2.94998
3.752031 4.00501
3.566299621 4.90112
3.274208456 6.00696
3.154213326 6.88859

View File

@ -0,0 +1,48 @@
# Stratification = Very stable
# U/U@(zRef=40m) z/zRef=20[m]
13.8953 2
20.0349 2.95
25.3372 4
28.3023 4.9
31.7907 6
33.8488 6.88571
# Stratification = Stable
# U/U@(zRef=40m) z/zRef=20[m]
8.13953 2
10.5814 2.95
13.3721 4
15.0465 4.9
17.3488 6.00714
18.7791 6.88571
# Stratification = Slightly stable
# U/U@(zRef=40m) z/zRef=20[m]
6.36047 1.99286
8 2.95
9.60465 4
10.5465 4.89286
11.9419 5.99286
12.814 6.87857
# Stratification = Neutral
# U/U@(zRef=40m) z/zRef=20[m]
5.62791 2
6.95349 2.95
8.13953 4
8.76744 4.9
9.63953 6
10.2674 6.88571
# Stratification = Slightly unstable
# U/U@(zRef=40m) z/zRef=20[m]
5.31395 2
6.43023 2.95
7.26744 4
7.65116 4.9
8.2093 6
8.66279 6.88571
# Stratification = Unstable
# U/U@(zRef=40m) z/zRef=20[m]
5.06977 2
6.04651 2.95
6.74419 4
7.05814 4.9
7.44186 6
7.75581 6.88571

View File

@ -0,0 +1,47 @@
# Stratification = Very stable
# veer z/zRef=20[m]
-8.88e-16 2
5.08854 2.96326
7.19998 4.00448
9.45163 4.89879
13.7953 6.00217
17.954 6.88183
# Stratification = Stable
# veer z/zRef=20[m]
-8.88178e-16 2
3.57695 2.95679
4.31625 4.00548
5.42837 4.9002
8.91164 5.99688
12.3262 6.87681
# Stratification = Slightly stable
# veer z/zRef=20[m]
-8.88e-16 2
2.60026 2.94315
2.75811 4.00603
3.12604 4.901
5.6326 5.99104
8.39595 6.87119
# Stratification = Neutral
# veer z/zRef=20[m]
1.89764 4.00633
1.90249 2.96437
2.05627 4.90138
4.12094 5.99856
6.69821 6.88577
# Stratification = Slightly unstable
# veer z/zRef=20[m]
-8.88e-16 2
1.75811 4.00638
2.06528 2.96431
2.07953 4.90137
4.05117 5.99858
6.2796 6.88592
# Stratification = Unstable
# veer z/zRef=20[m]
-8.88e-16 2
1.3395 4.00652
1.83272 2.96439
1.89348 4.90144
4.16745 5.99854
6.41914 6.88587

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,15 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
./Allrun.pre
runApplication setFields
runApplication $(getApplication)
runApplication postProcess -funcs \
"(minMaxComponents(U) minMaxMagnitude(U))" -latestTime
#------------------------------------------------------------------------------

View File

@ -0,0 +1,19 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
./Allrun.pre
runApplication decomposePar
runParallel setFields
runParallel $(getApplication)
runParallel redistributePar -reconstruct -latestTime
runApplication postProcess -funcs \
"(minMaxComponents(U) minMaxMagnitude(U))" -latestTime
#------------------------------------------------------------------------------

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

@ -99,7 +99,9 @@ functions
}
#includeFunc "turbulenceFields"
#includeFunc "samples"
#includeFunc "sampleU"
#includeFunc "sampleScalars"
#includeFunc "sampleR"
}

View File

@ -0,0 +1,28 @@
// -*- C++ -*-
type sets;
libs (sampling);
interpolationScheme cellPoint;
setFormat raw;
writeControl writeTime;
fields
(
turbulenceProperties:R
);
sets
{
lineZ1
{
type midPoint;
axis z;
start (0 0 0);
end (0 0 6001);
nPoints 200;
}
}
// *********************************************************************** //

View File

@ -0,0 +1,28 @@
// -*- C++ -*-
type sets;
libs (sampling);
interpolationScheme cellPoint;
setFormat raw;
writeControl writeTime;
fields
(
U
);
sets
{
lineZ1
{
type midPoint;
axis z;
start (0 0 0);
end (0 0 6001);
nPoints 200;
}
}
// *********************************************************************** //

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