File: plot

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 (73 lines) | stat: -rwxr-xr-x 2,242 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
#!/bin/sh
cd "${0%/*}" || exit                        # Run from this directory
#------------------------------------------------------------------------------

plotStresses() {
    timeDir=$1
    \echo "    Plotting the normal and Reynolds stresses"

    gnuplot<<PLT_STRESSES
    set terminal pngcairo font "helvetica,20" size 1000, 800
    set xrange [0:1]
    set yrange [-1:8]
    set grid
    set key top right
    set xlabel "Channel height from the bottomWall [m]"
    set ylabel "<u_i^' u_i^'>"
    set offset .05, .05

    set style data linespoints
    set linetype 1 lc rgb 'black' lw 2
    set linetype 2 lc rgb 'red' lw 2
    set linetype 3 lc rgb 'blue' lw 2
    set linetype 4 lc rgb 'green' lw 2
    set linetype 5 lc rgb 'black' pi -8 pt 4 ps 1.5
    set linetype 6 lc rgb 'red' pi -8 pt 4 ps 1.5
    set linetype 7 lc rgb 'blue' pi -8 pt 4 ps 1.5
    set linetype 8 lc rgb 'green' pi -8 pt 4 ps 1.5

    set title "Normal and Reynolds stresses on cell"
    input="$timeDir/inletCell_UPrime2Mean.xy"
    set output 'stress-cell.png'
    plot \
        input u 1:2 w lines t "<u^' u^'>" lt 1, \
        input u 1:5 w lines t "<v^' v^'>" lt 2, \
        input u 1:7 w lines t "<w^' w^'>" lt 3, \
        input u 1:3 w lines t "<u^' v^'>" lt 4

    set title "Normal and Reynolds stresses on patch"
    input = "$timeDir/inletPatch_UPrime2Mean.xy"
    set output 'stress-patch.png'
    plot \
        input u 1:2 w lines t "<u^' u^'>" lt 1, \
        input u 1:5 w lines t "<v^' v^'>" lt 2, \
        input u 1:7 w lines t "<w^' w^'>" lt 3, \
        input u 1:3 w lines t "<u^' v^'>" lt 4

PLT_STRESSES
}


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

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


# The latestTime in postProcessing/inletSampling
timeDir=$(foamListTimes -case postProcessing/inletSampling -latestTime 2>/dev/null)

[ -n "$timeDir" ] || {
    \echo "No postProcessing/inletSampling found - skipping graph creation" 1>&2
    \exit 2
}

timeDir="postProcessing/inletSampling/$timeDir"

plotStresses "$timeDir"


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