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 (100 lines) | stat: -rwxr-xr-x 2,917 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/sh
cd "${0%/*}" || exit                                # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions        # Tutorial run functions
#------------------------------------------------------------------------------

runApplication blockMesh
runApplication simpleFoam

if notTest $@
then
    # Create validation plots

    # Require gnuplot
    command -v gnuplot >/dev/null || {
        echo "gnuplot not found - skipping graph creation" 1>&2
        exit 1
    }

    # Copy results to the validation directory
    timeDir=$(foamListTimes -latestTime)
    sampleDir=postProcessing/sample/$timeDir

    [ -d $sampleDir ] || {
        echo "results directory not found - skipping graph creation" 1>&2
        exit 1
    }

    # Require awk
    command -v awk >/dev/null || {
        echo "awk not found - skipping graph creation" 1>&2
        exit 1
    }

    Uref=$(awk '{print $2}' $sampleDir/Uref_U.xy)

    graphNameU="backwardStep2D_U.png"

    echo "Creating U profiles graph to $graphNameU"
    gnuplot<<EOF1
    set terminal pngcairo font "helvetica,20" size 1000, 1000

    set xrange [-0.4:1.2]
    set yrange [0:3]
    set xlabel "U/U_0"
    set ylabel "y/h"
    set grid
    set output "$graphNameU"

    href = 0.0127
    Uref = $Uref

    set lmargin 7.5
    set rmargin 1.5
    set tmargin 0.1
    set bmargin 3.2
    set key top left

    set format x "%.1f"
    set format y "%.1f"

    plot \
        "$sampleDir/x_by_h_01_U.xy" u (\$2/Uref):(\$1/href) w lines lw 2 lc rgb "red" t "x/h = 1", \
        "$sampleDir/x_by_h_04_U.xy" u (\$2/Uref):(\$1/href) w lines lw 2 lc rgb "green" t "x/h = 4", \
        "$sampleDir/x_by_h_06_U.xy" u (\$2/Uref):(\$1/href) w lines lw 2 lc rgb "blue" t "x/h = 6", \
        "$sampleDir/x_by_h_10_U.xy" u (\$2/Uref):(\$1/href) w lines lw 2 lc rgb "black" t "x/h = 10"
EOF1

    echo "# ccx tau_xx tau_yy tau_zz" > tauw.dat
    foamDictionary -entry boundaryField.lowerWall.value -value $timeDir/Cx | \
        sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' > Cx.$$
    foamDictionary -entry boundaryField.lowerWall.value -value $timeDir/wallShearStress | \
        sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' > tau.$$
    paste -d ' ' Cx.$$ tau.$$ >> tauw.dat
    rm -f Cx.$$ tau.$$

    graphNameTau="backwardStep2D_tau.png"
    echo "Creating wallshear stress graph to $graphNameTau"
    gnuplot<<EOF2
    set terminal pngcairo font "helvetica,20" size 1000, 1000
    set xrange [-5:30]
    set yrange [-0.002:0.004]
    set grid
    set key bottom right
    set xlabel "x/h"
    set ylabel "c_f"
    set output "$graphNameTau"

    Uref = $Uref
    href = 0.0127

    set lmargin 10
    set rmargin 1.5
    set tmargin 0.1
    set bmargin 3.2

    plot "tauw.dat" u (\$1/href):(-\$2/(0.5*Uref*Uref)) t "simpleFoam" w l lw 2 lc rgb "black"
EOF2
fi

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