-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot.ppl.m4
212 lines (168 loc) · 10 KB
/
plot.ppl.m4
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
load "problem.ppl"
load "analytical.ppl"
ur1(x) = ur(0,x,0)
sigmal1(x) = sigmal(0,x,0)
sigmar1(x) = sigmar(0,x,0)
sigmatheta1(x) = sigmatheta(0,x,0)
delta = 0.05
set preamble "\usepackage{amsmath}"
set width 12*unit(cm)
set axis x arrow nomirrored
set axis y arrow nomirrored
# ------------
# distributions
set grid
set terminal pdf
set xrange [a:b]
set xlabel "$r$ [mm]"
set yrange [*:*]
set key top right
set title "shape"
set output "shape-ur.pdf"
set ylabel "$u_r(r)$ [mm]"
plot ur1(x) w l lw 5 lt 1 color tan ti "Analytical $u_r(r)~\pm$ 1\%",\
0.99*ur1(x) w l lw 2 lt 4 color tan ti "",\
1.01*ur1(x) w l lw 2 lt 4 color tan ti "",\
"pipe-dist-shape-1-3.dat" u 2:4 w l lw 1 lt 2 color cyan ti "",\
"pipe-dist-shape-1-3.dat" u 2:4 w p pt 30 ps 1.5 color cyan every (100)/(1*3) ti "$n=3$ 1st order",\
"pipe-dist-shape-1-6.dat" u 2:4 w l lw 1 lt 4 color magenta ti "",\
"pipe-dist-shape-1-6.dat" u 2:4 w p pt 31 ps 1.5 color magenta every (100)/(1*6) ti "$n=6$ 1st order",\
"pipe-dist-shape-2-2.dat" u 2:4 w l lw 2 lt 3 color black ti "",\
"pipe-dist-shape-2-2.dat" u 2:4 w p pt 32 ps 1.5 color black every (100)/(2*2) ti "$n=2$ 2nd order"
set output "shape-sigmatheta.pdf"
set ylabel "$\sigma_\theta(r)$ [MPa]"
plot sigmatheta1(x) w l lw 5 lt 1 color tan ti "Analytical $\sigma_\theta(r)~\pm$ 1\%",\
0.99*sigmatheta1(x) w l lw 2 lt 4 color tan ti "",\
1.01*sigmatheta1(x) w l lw 2 lt 4 color tan ti "",\
"pipe-dist-shape-1-3.dat" u 2:5 w l lw 1 lt 2 color cyan ti "",\
"pipe-dist-shape-1-3.dat" u 2:5 w p pt 30 ps 1.5 color cyan every (100)/(1*3) ti "$n=3$ 1st order",\
"pipe-dist-shape-1-6.dat" u 2:5 w l lw 1 lt 4 color magenta ti "",\
"pipe-dist-shape-1-6.dat" u 2:5 w p pt 31 ps 1.5 color magenta every (100)/(1*6) ti "$n=6$ 1st order",\
"pipe-dist-shape-2-2.dat" u 2:5 w l lw 2 lt 3 color black ti "",\
"pipe-dist-shape-2-2.dat" u 2:5 w p pt 32 ps 1.5 color black every (100)/(2*2) ti "$n=2$ 2nd order"
set output "shape-sigmal.pdf"
set ylabel "$\sigma_l(r)$ [MPa]"
plot sigmal1(x) w l lw 5 lt 1 color tan ti "Analytical $\sigma_\theta(r)~\pm$ 1\%",\
0.99*sigmal1(x) w l lw 2 lt 4 color tan ti "",\
1.01*sigmal1(x) w l lw 2 lt 4 color tan ti "",\
"pipe-dist-shape-1-3.dat" u 2:6 w l lw 1 lt 2 color cyan ti "",\
"pipe-dist-shape-1-3.dat" u 2:6 w p pt 30 ps 1.5 color cyan every (100)/(1*3) ti "$n=3$ 1st order",\
"pipe-dist-shape-1-6.dat" u 2:6 w l lw 1 lt 4 color magenta ti "",\
"pipe-dist-shape-1-6.dat" u 2:6 w p pt 31 ps 1.5 color magenta every (100)/(1*6) ti "$n=6$ 1st order",\
"pipe-dist-shape-2-2.dat" u 2:6 w l lw 2 lt 3 color black ti "",\
"pipe-dist-shape-2-2.dat" u 2:6 w p pt 32 ps 1.5 color black every (100)/(2*2) ti "$n=2$ 2nd order"
set output "shape-sigmar.pdf"
set key top left
set ylabel "$\sigma_r(r)$ [MPa]"
plot sigmar1(x) w l lw 5 lt 1 color tan ti "Analytical $\sigma_\theta(r)~\pm$ 5\%",\
0.95*sigmar1(x) w l lw 2 lt 4 color tan ti "",\
1.05*sigmar1(x) w l lw 2 lt 4 color tan ti "",\
"pipe-dist-shape-1-3.dat" u 2:7 w l lw 1 lt 2 color cyan ti "",\
"pipe-dist-shape-1-3.dat" u 2:7 w p pt 30 ps 1.5 color cyan every (100)/(1*3) ti "$n=3$ 1st order",\
"pipe-dist-shape-1-6.dat" u 2:7 w l lw 1 lt 4 color magenta ti "",\
"pipe-dist-shape-1-6.dat" u 2:7 w p pt 31 ps 1.5 color magenta every (100)/(1*6) ti "$n=6$ 1st order",\
"pipe-dist-shape-2-2.dat" u 2:7 w l lw 2 lt 3 color black ti "",\
"pipe-dist-shape-2-2.dat" u 2:7 w p pt 32 ps 1.5 color black every (100)/(2*2) ti "$n=2$ 2nd order"
# -----------------------------------------------
# linearized stresses
set key above
set xlabel "Number $n$ of elements through the pipe thickness"
set xrange [*:*]
set xtics 1
set mxtics 0.5
set output "shape-M_v.pdf"
set yrange [(1-delta)*M_vonmises:(1+delta)*M_vonmises]
set ylabel "Membrane von Mises stress $\text{M}_v$ [MPa]"
plot M_vonmises w l lw 5 lt 1 color tan ti "Analytical $\text{M}_v~\pm$ 1\%",\
1.01*M_vonmises w l lw 2 lt 4 color tan ti "",\
0.99*M_vonmises w l lw 2 lt 4 color tan ti "",\
"convergence-shape-1.dat" u 1:3 w lp lw 3 lt 2 pt 4 ps 2 color red ti "1st order",\
"convergence-shape-2.dat" u 1:3 w lp lw 3 lt 3 pt 3 ps 2 color blue ti "2nd order"
set output "shape-M_t.pdf"
set yrange [(1-delta)*M_tresca:(1+delta)*M_tresca]
set ylabel "Membrante Tresca stress $\text{M}_t$ [MPa]"
plot M_tresca w l lw 5 lt 1 color tan ti "Analytical $\text{M}_t~\pm$ 1\%",\
1.01*M_tresca w l lw 2 lt 4 color tan ti "",\
0.99*M_tresca w l lw 2 lt 4 color tan ti "",\
"convergence-shape-1.dat" u 1:4 w lp lw 3 lt 2 pt 4 ps 2 color red ti "1st order",\
"convergence-shape-2.dat" u 1:4 w lp lw 3 lt 3 pt 3 ps 2 color blue ti "2nd order"
set output "shape-MB_v.pdf"
set key top right
set yrange [(1-delta)*MB_vonmises:(1+delta)*MB_vonmises]
set xlabel "Number $n$ of elements through the pipe thickness"
set ylabel "Membrane plus bending von Mises stress $\text{MB}_v$ [MPa]"
plot MB_vonmises w l lw 5 lt 1 color tan ti "Analytical $\text{MB}_v~\pm$ 1\%",\
1.01*MB_vonmises w l lw 2 lt 4 color tan ti "",\
0.99*MB_vonmises w l lw 2 lt 4 color tan ti "",\
"convergence-shape-1.dat" u 1:5 w lp lw 3 lt 2 pt 18 ps 2 color red ti "1st order",\
"convergence-shape-2.dat" u 1:5 w lp lw 3 lt 3 pt 17 ps 2 color blue ti "2nd order"
set output "shape-MB_t.pdf"
set key top right
set yrange [(1-delta)*MB_tresca:(1+delta)*MB_tresca]
set xlabel "Number $n$ of elements through the pipe thickness"
set ylabel "Membrane plus bending Tresca stress $\text{MB}_t$ [MPa]"
plot MB_tresca w l lw 5 lt 1 color tan ti "Analytical $\text{MB}_t~\pm$ 1\%",\
1.01*MB_tresca w l lw 2 lt 4 color tan ti "",\
0.99*MB_tresca w l lw 2 lt 4 color tan ti "",\
"convergence-shape-1.dat" u 1:6 w lp lw 3 lt 2 pt 18 ps 2 color red ti "1st order",\
"convergence-shape-2.dat" u 1:6 w lp lw 3 lt 2 pt 17 ps 2 color blue ti "2nd order"
# -----------------------------------------------
# error vs resources
set key top right
set yrange [1e-6:1]
set logscale y
set logscale x
unset y2label
unset y2tics
set output "shape-error-vs-wall.pdf"
set xrange [1e-2:1e2]
set xlabel "Wall time [sec]"
set ylabel "Relative error"
plot "convergence-shape-1.dat" u 9:(abs($3-M_vonmises)/M_vonmises) w lp lw 2 lt 2 pt 2 ps 2 color red ti "$\text{M}_v$ 1st order",\
"convergence-shape-2.dat" u 9:(abs($3-M_vonmises)/M_vonmises) w lp lw 3 lt 3 pt 3 ps 2 color blue ti "$\text{M}_v$ 2nd order",\
"convergence-shape-1.dat" u 9:(abs($5-MB_vonmises)/MB_vonmises) w lp lw 2 lt 2 pt 16 ps 2 color red ti "$\text{MB}_v$ 1st order",\
"convergence-shape-2.dat" u 9:(abs($5-MB_vonmises)/MB_vonmises) w lp lw 3 lt 3 pt 17 ps 2 color blue ti "$\text{MB}_v$ 2nd order"
set output "shape-error-vs-mem.pdf"
set xrange [1e-2:32]
set xlabel "Memory [Gb]"
set ylabel "Relative error"
plot "convergence-shape-1.dat" u 10:(abs($3-M_vonmises)/M_vonmises) w lp lw 2 lt 2 pt 2 ps 2 color red ti "$\text{M}_v$ 1st order",\
"convergence-shape-2.dat" u 10:(abs($3-M_vonmises)/M_vonmises) w lp lw 3 lt 3 pt 3 ps 2 color blue ti "$\text{M}_v$ 2nd order",\
"convergence-shape-1.dat" u 10:(abs($5-MB_vonmises)/MB_vonmises) w lp lw 2 lt 2 pt 16 ps 2 color red ti "$\text{MB}_v$ 1st order",\
"convergence-shape-2.dat" u 10:(abs($5-MB_vonmises)/MB_vonmises) w lp lw 3 lt 3 pt 17 ps 2 color blue ti "$\text{MB}_v$ 2nd order"
# -----------------------------------------------
set key bottom right
set yrange [*:*]
set xrange [*:*]
set xtics
set mxtics
set logscale y
set logscale x
set output "shape-resources-vs-nodes.pdf"
set xlabel "Number $n$ of elements through the pipe thickness"
set ylabel "Wall time [sec]"
set y2label "Memory [Gb]"
set logscale y2
set key top left
plot "convergence-shape-1.dat" u 7:9 w lp lw 2 lt 3 pt 2 ps 1 color red ti "Wall 1st order",\
"convergence-shape-2.dat" u 7:9 w lp lw 3 lt 4 pt 4 ps 1 color blue ti "Wall 2nd order",\
"convergence-shape-1.dat" u 7:10 w lp lw 2 lt 3 pt 16 ps 1 color red axes x1y2 ti "Memory 1st order",\
"convergence-shape-2.dat" u 7:10 w lp lw 3 lt 4 pt 18 ps 1 color blue axes x1y2 ti "Memory 2nd order"
# -----------------------------------------------
set key bottom right
set yrange [*:*]
unset logscale x
unset logscale y2
set logscale y
set output "shape-elements-vs-n.pdf"
set ylabel "Number of elements"
set y2label "Elements in 2nd order / elements in 1st order"
plot "nodes-elements-shape.dat" u 1:3 w lp lw 2 lt 3 pt 2 ps 1 color red ti "1st order",\
"nodes-elements-shape.dat" u 1:5 w lp lw 3 lt 4 pt 4 ps 1 color blue ti "2nd order",\
"nodes-elements-shape.dat" u 1:($5/$3) w lp lw 3 lt 1 pt 6 color grey axes x1y2 ti "ratio"
set output "shape-nodes-vs-n.pdf"
set ylabel "Number of nodes"
set y2label "Nodes in 2nd order / nodes in 1st order"
plot "nodes-elements-shape.dat" u 1:2 w lp lw 2 lt 3 pt 16 ps 1 color red ti "1st order",\
"nodes-elements-shape.dat" u 1:4 w lp lw 3 lt 4 pt 18 ps 1 color blue ti "2nd order",\
"nodes-elements-shape.dat" u 1:($4/$2) w lp lw 3 lt 1 pt 20 color grey axes x1y2 ti "ratio"