File: periodic.sh

package info (click to toggle)
gerris 20131206%2Bdfsg-21
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 14,252 kB
  • sloc: ansic: 66,595; sh: 15,922; f90: 1,513; makefile: 1,150; fortran: 696; python: 493; awk: 104; lisp: 89; xml: 27
file content (74 lines) | stat: -rw-r--r-- 1,826 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
if test x$donotrun != xtrue; then
    rm -f r0 r1 r2

    for r in 0 1 2; do
	for level in 5 6 7; do
	    if sed "s/LEVEL/$level/g" < $1 | \
		sed "s/BOX/$r/g" | \
		gerris2D - | \
		awk -v level=$level '{
                  print level " " $7 " " $9
                }' >> r$r; then :
	    else
		exit 1
	    fi
	done
    done
fi

if cat <<EOF | python3 > minion1.tex; then :
from check import *
from sys import *
from math import *

print(r"""\begin{tabular}{|c|c|c|c|c|c|}\hline
        & \multicolumn{5}{c|}{\$L_2\$} \\\ \hline
        & \$L=5\$   & \$O_2\$ & \$L=6\$    & \$O_2\$ & \$L=7\$  \\\ \hline""")

def order(r,color='black'):
   for i in range(0,len(r.l)-1):
     y0,y1 = r.l[i][1],r.l[i+1][1]
     print('& {\color{%s}%.2e} & {\color{%s}%4.2f}' % (color, y0, color, log(y0/y1)/log(2.)),)
   print('& {\color{%s}%.2e}' % (color, r.l[i+1][1]), r'\\\')

print('Uniform', end=' ')
order(Curve('r0',1,2))
order(Curve('r0.ref',1,2),'blue')
print('\$r=1\$', end=' ')
order(Curve('r1',1,2))
order(Curve('r1.ref',1,2),'blue')
print('\$r=2\$', end=' ')
order(Curve('r2',1,2))
order(Curve('r2.ref',1,2),'blue')

print(r"""\hline)
        & \multicolumn{5}{c|}{\$L_\infty\$} \\\ \hline
        & \$L=5\$   & \$O_\infty\$  & \$L=6\$   & \$O_\infty\$  & \$L=7\$ \\\ \hline"""

print('Uniform', end=' ')
order(Curve('r0',1,3))
order(Curve('r0.ref',1,3),'blue')
print('\$r=1\$', end=' ')
order(Curve('r1',1,3))
order(Curve('r1.ref',1,3),'blue')
print('\$r=2\$', end=' ')
order(Curve('r2',1,3))
order(Curve('r2.ref',1,3),'blue')

print(r"\hline\end{tabular}")
EOF
else
    exit 1
fi

if cat <<EOF | python3 ; then :
from check import *
from sys import *
for r in ['r0','r1','r2']:
  if (Curve(r,1,2) - Curve(r+'.ref',1,2)).max() > 1e-6 or\
     (Curve(r,1,3) - Curve(r+'.ref',1,3)).max() > 1e-6:
    exit(1)
EOF
else
   exit 1
fi