-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcns-scan
executable file
·69 lines (61 loc) · 1.41 KB
/
cns-scan
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
#!/bin/sh
#
# (c) 2018-2025 m4r35n357@gmail.com (Ian Smith), for licencing see the LICENCE file
. ./base.sh
. ./cns-functions.sh
max=$1
threshold=$2
shift 2
original=$*
scan_plot () {
/usr/bin/gnuplot << EOF
set terminal qt
set title noenhanced '$args'
set key left
set ytics nomirror
set y2tics
set xlabel 'Taylor Series Order'
set ylabel 'Clean Simulation Time, model units'
set y2label 'CPU Time, seconds'
set style fill solid border -1
set xrange [2:$max]
set yrange [0:$max_clean]
set y2range [0:$max_cpu]
plot '$user_data' using 1:2 axes x1y1 title 'CNS' with boxes, '' u 1:3 axes x1y2 t 'CPU' w boxes
pause mouse close
EOF
}
case $3 in
"_") ;;
*) echo '"order" argument should be set to "_"'; exit 1;;
esac
timestep=$4
steps=$5
n=2
while [ $n -le $max ]
do
set $original
begin="$1 $2"
shift 3
current="$begin $n $*"
halfstep $current
$current >$fileB &
wait
temp=$(./divergence $fileA $fileB $threshold)
case $temp in
'') echo $n "Still within $threshold - not chaotic, or simulation time too short"
exit 1;;
*) set $temp
echo $n $4 $6;;
esac
n=$((n + 1))
done 2>/dev/null | tee $user_data
max_clean=$(echo "scale=2; $timestep * $steps;" | /usr/bin/bc)
set $(tail -1 $user_data)
if [ $(printf "scale=3; $3 > 0.0;\n" | /usr/bin/bc) -eq 1 ]
then
max_cpu=$(echo "scale=2; 1.5 * $3;" | /usr/bin/bc)
else
max_cpu=1.0
fi
scan_plot &