Newer
Older
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
#!/bin/bash
device="host"
sizes="16"
initFunctions="sin-bumps"
snapshotPeriod=0.001
finalTime=0.15
solverName="mean-curvature-flow"
boundaryCondition="neumann"
boundaryValue=0
minZ=-1
maxZ=1
contourHeight=0.3
spaceStep=$(expr 1/($sizes-2) | bc | sed 's/^\./0./')
setupInitFunction()
{
initFunction=$1
origin=0
proportions=1
amplitude=1.0
waveLength=1.0
waveLengthX=1.0
waveLengthY=1.0
waveLengthZ=1.0
wavesNumber=0.0
wavesNumberX=0.0
wavesNumberY=0.0
wavesNumberZ=0.0
phase=0.0
phaseX=0.0
phaseY=0.0
phaseZ=0.0
sigma=1
}
setupGrid()
{
gridSize=$1
tnl-grid-setup --dimensions 2 \
--origin-x ${origin} \
--origin-y ${origin} \
--origin-z ${origin} \
--proportions-x ${proportions} \
--proportions-y ${proportions} \
--proportions-z ${proportions} \
--size-x ${gridSize} \
--size-y ${gridSize} \
--size-z ${gridSize}
}
setInitialCondition()
{
initFunction=$1
tnl-init --test-function ${initFunction} \
--output-file initial.tnl \
--amplitude ${amplitude} \
--wave-length ${waveLength} \
--wave-length-x ${waveLengthX} \
--wave-length-y ${waveLengthY} \
--wave-length-z ${waveLengthZ} \
--waves-number ${wavesNumber} \
--waves-number-x ${wavesNumberX} \
--waves-number-y ${wavesNumberY} \
--waves-number-z ${wavesNumberZ} \
--phase ${phase} \
--phase-x ${phaseX} \
--phase-y ${phaseY} \
--phase-z ${phaseZ} \
--sigma ${sigma} \
--time-dependence none
}
solve()
{
timeDiscretisation=$1
discreteSolver=$2
${solverName} --device ${device} \
--mesh mesh.tnl \
--initial-condition initial.tnl \
--snapshot-period ${snapshotPeriod} \
--time-discretisation ${timeDiscretisation} \
--time-step 1 \
--time-step-order 2 \
--discrete-solver ${discreteSolver} \
--merson-adaptivity 1.0e-7 \
--sor-omega 1.95 \
--gmres-restarting 20 \
--min-iterations 20 \
--convergence-residue 1.0e-12 \
--boundary-conditions-type ${boundaryCondition} \
--boundary-conditions-constant ${boundaryValue} \
--final-time ${finalTime}
}
view()
{
tnl-view --input-files u-*.tnl
tnl-view --input-files initial.tnl
}
generate3DVid()
{
seznam=`ls u-*.gplt`
step=0
for fname in $seznam ; do
step=$((${step}+1))
time=$(expr $step*$snapshotPeriod | bc | sed 's/^\./0./')
echo "Drawing contour $fname"
gnuplot << EOF
set output '${fname}.png'
set xrange [${1}:${proportions}]
set yrange [${1}:${proportions}]
set zrange [${minZ}:${maxZ}]
unset surface
set terminal png size 1200,600
set view map
set title 'Numerical solution - contour in height ${contourHeight} - T: ${time}'
set pm3d interpolate 100,100
set size square
set contour base
unset colorbox
set cntrparam levels discrete ${contourHeight}
splot '$fname' with pm3d notitle
EOF
done
mencoder "mf://u-*.png" -mf fps=4 -o mean_curvature_contour_${contourHeight}_$size.avi -ovc lavc -lavcopts vcodec=mpeg4
rm *.png
rm *.tnl
rm *.gplt
rm mesh.asy
rm computation-done
}
runTest()
{
for initFunction in ${initFunctions};
do
cd ${initFunction}-videos
setupInitFunction ${initFunction}
for size in $sizes;
do
cd $size
echo ""
echo ""
echo ""
if test ! -f computation-done;
then
touch computation-in-progress
echo "========================================================================="
echo "=== SETTING UP THE GRID ==="
echo "========================================================================="
setupGrid $size
echo "========================================================================="
echo "=== WRITING THE EXACT SOLUTION ==="
echo "========================================================================="
setInitialCondition $initFunction
echo "========================================================================="
echo "=== STARTING THE SOLVER ==="
echo "========================================================================="
solve explicit merson
#solve semi-implicit gmres
mv computation-in-progress computation-done
echo "========================================================================="
echo "=== COMPUTATION DONE ==="
echo "========================================================================="
view
generate3DVid $origin $proportions
cd ..
lastSize=$size
fi
cd ..
done
cd ..
done
}
runTest