File: Allrun

package info (click to toggle)
openfoam 1912.200626-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 238,940 kB
  • sloc: cpp: 1,159,638; sh: 15,902; ansic: 5,195; lex: 660; xml: 387; python: 282; awk: 212; makefile: 103; sed: 88; csh: 3
file content (85 lines) | stat: -rwxr-xr-x 2,139 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/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
#------------------------------------------------------------------------------

runApplication blockMesh

# Turbulence closure models
models="
kOmegaSST
SpalartAllmaras
kEpsilonPhitF
"

# Extract a value (Eg, from boundaryField/bump/value)
#
# $1 = dictEntry
# $2 = inputFile
# $3 = outputFile
#
# only retain 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
}


# Possibly disable for test: if notTest $@

if :
then
    for model in $models
    do
        echo "Processing model: $model"

        sed -e "s/RAS_MODEL/$model/g" \
            constant/turbulenceProperties.template \
          > constant/turbulenceProperties

        runApplication $(getApplication)

        timeDir=$(foamListTimes -latestTime)

        # Create datasets for benchmark comparisons
        extractVal boundaryField.bump.value "$timeDir/Cx" "Cx.$$"
        extractVal boundaryField.bump.value "$timeDir/wallShearStress" "tau.$$"
        extractVal boundaryField.bump.value "$timeDir/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.$$

        # Store results in directory of the same name as the model
        modelDir="$model"
        rm -rf "$modelDir"
        mkdir "$modelDir"
        mv -f log* profiles.dat "$timeDir" postProcessing "$modelDir"

        cleanTimeDirectories
    done
fi

#------------------------------------------------------------------------------