[SCM] Gerris Flow Solver branch, upstream, updated. b3aa46814a06c9cb2912790b23916ffb44f1f203

Stephane Popinet s.popinet at niwa.co.nz
Fri May 15 02:52:21 UTC 2009


The following commit has been merged in the upstream branch:
commit c309de5fbd3983fbd29370b6b30debf738d6ed88
Author: Stephane Popinet <s.popinet at niwa.co.nz>
Date:   Thu Jul 21 13:59:36 2005 +1000

    Added new-style Poisson test cases
    
    darcs-hash:20050721035936-fbd8f-aa1f781db57e30c7e9ddbec01d0c337e9dfa097b.gz

diff --git a/test/euler/Makefile.am b/test/euler/Makefile.am
index 538280c..65c8c64 100644
--- a/test/euler/Makefile.am
+++ b/test/euler/Makefile.am
@@ -6,7 +6,9 @@ TESTDIRS = \
 	merging \
 	boundaries \
 	channel \
-	spurious
+	spurious \
+	poisson \
+	circle
 
 EXTRA_DIST = \
 	template.tex \
diff --git a/test/euler/circle/circle.gfs b/test/euler/circle/circle.gfs
new file mode 100644
index 0000000..bcdbb78
--- /dev/null
+++ b/test/euler/circle/circle.gfs
@@ -0,0 +1,78 @@
+# Title: Convergence of the Poisson solver with solid boundaries
+#
+# Description:
+#
+# Another of the test cases presented in Popinet \cite{popinet2003}. A
+# circular solid boundary of radius 0.25 is embedded in the
+# domain. The same right-hand-side is used.
+# 
+# This time the problem does not have an analytical solution and we
+# use Richardson extrapolation to estimate the error for a given
+# resolution.
+#
+# \begin{figure}[htbp]
+# \begin{center}
+# \includegraphics[width=0.6\hsize]{solution.eps}
+# \end{center}
+# \caption{Solution of the Poisson equation.}
+# \label{solution}
+# \end{figure}
+#
+# \begin{figure}[htbp]
+# \begin{center}
+# \includegraphics[width=0.8\hsize]{residual.eps}
+# \end{center}
+# \caption{Evolution of the residual.}
+# \label{residual}
+# \end{figure}
+#
+# \begin{figure}[htbp]
+# \begin{center}
+# \includegraphics[width=0.8\hsize]{rate.eps}
+# \end{center}
+# \caption{Average reduction factor.}
+# \label{rate}
+# \end{figure}
+#
+# \begin{figure}[htbp]
+# \begin{center}
+# \includegraphics[width=0.8\hsize]{error.eps}
+# \end{center}
+# \caption{Evolution of the error as a function of resolution.}
+# \label{error}
+# \end{figure}
+#
+# \begin{figure}[htbp]
+# \begin{center}
+# \includegraphics[width=0.8\hsize]{order.eps}
+# \end{center}
+# \caption{Corresponding convergence order.}
+# \label{order}
+# \end{figure}
+#
+# Author: St\'ephane Popinet
+# Command: shapes -n 500 ellipse > shape.gts && sh circle.sh circle.gfs
+# Version: 0.8.0
+# Required files: circle.sh res-7.ref error.ref order.ref
+# Generated files: residual.eps rate.eps error.eps order.eps solution.eps
+#
+1 0 GfsPoisson GfsBox GfsGEdge {} {
+  Time { iend = 10 }
+  Refine LEVEL
+  GtsSurfaceFile shape.gts
+  ApproxProjectionParams { nrelax = 4 tolerance = 1e-30 }
+  Init {} {
+    Div = {
+      int k = 3, l = 3;
+      return -M_PI*M_PI*(k*k + l*l)*sin (M_PI*k*x)*sin (M_PI*l*y);
+    }
+  }
+  OutputProjectionStats { istep = 1 } { 
+    awk '{
+      if ($1 == "niter:") printf ("%d ", $2);
+      if ($1 == "residual.infty:") print $3 " " $4;
+    }' > res-LEVEL 
+  }
+  OutputSimulation { start = end } sim-LEVEL { variables = P }
+}
+GfsBox {}
diff --git a/test/euler/circle/circle.sh b/test/euler/circle/circle.sh
new file mode 100644
index 0000000..ec4fab2
--- /dev/null
+++ b/test/euler/circle/circle.sh
@@ -0,0 +1,94 @@
+if ! $donotrun; then
+    for level in 3 4 5 6 7 8 9; do
+	if sed "s/LEVEL/$level/g" < $1 | \
+	    gerris2D - | \
+	    awk -v level=$level '{
+                  print level " " $5 " " $7 " " $9
+                }'; then :
+	else
+	    exit 1
+	fi
+    done
+fi
+
+rm -f error
+for level in 3 4 5 6 7 8; do
+    next=`expr $level + 1`
+    echo -n "$level " >> error
+    if gfscompare2D -C -c -v sim-$level sim-$next P 2>&1 | \
+	awk '{if ($1 == "total") print $4 " " $6 " " $8;}' >> error; then :
+    else
+	exit 1
+    fi
+done
+
+if echo "Save solution.eps { format = EPS line_width = 0.25}" | gfsview-batch2D sim-9 solution.gfv; then :
+else
+    exit 1
+fi
+
+if awk '
+BEGIN { n = 0 }
+{
+  l[n] = $1; n1[n] = $2; n2[n] = $3; ni[n++] = $4;
+}
+END {
+  for (i = 1; i < n; i++)
+    print l[i] " " log(n1[i-1]/n1[i])/log(2.) " " log(n2[i-1]/n2[i])/log(2.) " " log(ni[i-1]/ni[i])/log(2.);
+}' < error > order; then :
+else
+    exit 1
+fi
+
+if cat <<EOF | gnuplot ; then :
+    set term postscript eps color lw 3 solid 20
+    set output 'residual.eps'
+    set xlabel 'V-cycle'
+    set ylabel 'Maximum residual'
+    set logscale y
+    plot 'res-7.ref' u 1:2 t 'ref' w lp, 'res-7' u 1:2 t '' w lp
+    set output 'rate.eps'
+    set xlabel 'V-cycle'
+    set ylabel 'Cumulative residual reduction factor'
+    unset logscale
+    plot 'res-7.ref' u 1:3 t 'ref' w lp, 'res-7' u 1:3 t '' w lp
+    set output 'error.eps'
+    set xlabel 'Level'
+    set ylabel 'Error norms'
+    set key
+    set logscale y
+    plot 'error.ref' u 1:2 t '1 (ref)' w lp, \
+         'error.ref' u 1:3 t '2 (ref)' w lp, \
+         'error.ref' u 1:4 t 'max (ref)' w lp, \
+         'error' u 1:2 t '1' w lp, \
+         'error' u 1:3 t '2' w lp, \
+         'error' u 1:4 t 'max' w lp
+    set output 'order.eps'
+    set xlabel 'Level'
+    set ylabel 'Order'
+    set key
+    unset logscale
+    set xtics 0,1
+    set ytics 0,1
+    set grid
+    plot [][0:3] 'order.ref' u 1:2 t '1 (ref)' w lp, \
+                 'order.ref' u 1:3 t '2 (ref)' w lp, \
+                 'order.ref' u 1:4 t 'max (ref)' w lp, \
+                 'order' u 1:2 t '1' w lp, \
+                 'order' u 1:3 t '2' w lp, \
+                 'order' u 1:4 t 'max' w lp
+EOF
+else
+    exit 1
+fi
+
+if cat <<EOF | python ; then :
+from check import *
+from sys import *
+if (Curve('res-7',1,2) - Curve('res-7.ref',1,2)).max() > 1e-8 or\
+   (Curve('error',1,4) - Curve('error.ref',1,4)).max() > 1e-6:
+    exit(1)
+EOF
+else
+   exit 1
+fi
diff --git a/test/euler/circle/error.ref b/test/euler/circle/error.ref
new file mode 100644
index 0000000..3f37587
--- /dev/null
+++ b/test/euler/circle/error.ref
@@ -0,0 +1,6 @@
+3 7.555e-02 9.587e-02 2.228e-01
+4 1.719e-02 2.127e-02 4.332e-02
+5 4.449e-03 5.485e-03 1.185e-02
+6 1.080e-03 1.340e-03 2.773e-03
+7 2.799e-04 3.467e-04 8.251e-04
+8 6.896e-05 8.537e-05 1.839e-04
diff --git a/test/euler/circle/order.ref b/test/euler/circle/order.ref
new file mode 100644
index 0000000..d556ffa
--- /dev/null
+++ b/test/euler/circle/order.ref
@@ -0,0 +1,5 @@
+4 2.13586 2.17226 2.36264
+5 1.95002 1.95526 1.87015
+6 2.04245 2.03326 2.09537
+7 1.94805 1.95047 1.74881
+8 2.02108 2.02189 2.16565
diff --git a/test/euler/circle/res-7.ref b/test/euler/circle/res-7.ref
new file mode 100644
index 0000000..e465cb5
--- /dev/null
+++ b/test/euler/circle/res-7.ref
@@ -0,0 +1,11 @@
+0 1.775e+02 0
+1 2.484e+01 7.1
+2 2.417e+00 8.6
+3 3.439e-01 8
+4 2.953e-02 8.8
+5 2.921e-03 9.1
+6 2.281e-04 9.6
+7 2.225e-05 9.7
+8 1.583e-06 10
+9 1.478e-07 10
+10 1.035e-08 11
diff --git a/test/euler/merging/vorticity.gfv b/test/euler/circle/solution.gfv
similarity index 68%
copy from test/euler/merging/vorticity.gfv
copy to test/euler/circle/solution.gfv
index f438399..78815fc 100644
--- a/test/euler/merging/vorticity.gfv
+++ b/test/euler/circle/solution.gfv
@@ -2,25 +2,30 @@
 View {
   tx = 0 ty = 0
   q0 = 0 q1 = 0 q2 = 0 q3 = 1
-  zoom = -11.6434
+  zoom = -12.5255
   r = 0.3 g = 0.4 b = 0.6
   res = 1
   lc = 0.001
   reactivity = 0.1
 }
+Boundaries {
+  r = 0 g = 0 b = 0
+  shading = Constant
+  maxlevel = -1
+}
+Solid {
+  r = 0 g = 0 b = 0
+  shading = Constant
+  maxlevel = -1
+}
 Isoline {
   r = 0 g = 0 b = 0
   shading = Constant
-  maxlevel = 8
-} Vorticity {
+  maxlevel = -1
+} P {
   amin = 1
   amax = 1
   cmap = Jet
 } {
-  n = 17
-}
-Boundaries {
-  r = 0 g = 0 b = 0
-  shading = Constant
-  maxlevel = 8
+  n = 30
 }
diff --git a/test/euler/circle/star/error.ref b/test/euler/circle/star/error.ref
new file mode 100644
index 0000000..83ff634
--- /dev/null
+++ b/test/euler/circle/star/error.ref
@@ -0,0 +1,6 @@
+3 1.526e-01 1.741e-01 2.966e-01
+4 1.948e-02 2.466e-02 5.349e-02
+5 7.108e-03 8.260e-03 1.645e-02
+6 1.115e-03 1.410e-03 3.202e-03
+7 2.688e-04 3.410e-04 7.733e-04
+8 1.181e-04 1.378e-04 5.154e-04
diff --git a/test/euler/circle/star/order.ref b/test/euler/circle/star/order.ref
new file mode 100644
index 0000000..468803a
--- /dev/null
+++ b/test/euler/circle/star/order.ref
@@ -0,0 +1,5 @@
+4 2.96969 2.81967 2.47118
+5 1.45448 1.57796 1.70118
+6 2.6724 2.55045 2.36104
+7 2.05244 2.04785 2.04987
+8 1.18652 1.3072 0.585336
diff --git a/test/euler/circle/star/res-7.ref b/test/euler/circle/star/res-7.ref
new file mode 100644
index 0000000..70211ad
--- /dev/null
+++ b/test/euler/circle/star/res-7.ref
@@ -0,0 +1,11 @@
+0 1.775e+02 0
+1 3.072e+01 5.8
+2 1.315e+01 3.7
+3 1.604e+00 4.8
+4 2.373e-01 5.2
+5 4.074e-02 5.3
+6 6.330e-03 5.5
+7 2.543e-03 4.9
+8 9.526e-04 4.6
+9 3.483e-04 4.3
+10 1.249e-04 4.1
diff --git a/test/euler/merging/vorticity.gfv b/test/euler/circle/star/solution.gfv
similarity index 68%
copy from test/euler/merging/vorticity.gfv
copy to test/euler/circle/star/solution.gfv
index f438399..78815fc 100644
--- a/test/euler/merging/vorticity.gfv
+++ b/test/euler/circle/star/solution.gfv
@@ -2,25 +2,30 @@
 View {
   tx = 0 ty = 0
   q0 = 0 q1 = 0 q2 = 0 q3 = 1
-  zoom = -11.6434
+  zoom = -12.5255
   r = 0.3 g = 0.4 b = 0.6
   res = 1
   lc = 0.001
   reactivity = 0.1
 }
+Boundaries {
+  r = 0 g = 0 b = 0
+  shading = Constant
+  maxlevel = -1
+}
+Solid {
+  r = 0 g = 0 b = 0
+  shading = Constant
+  maxlevel = -1
+}
 Isoline {
   r = 0 g = 0 b = 0
   shading = Constant
-  maxlevel = 8
-} Vorticity {
+  maxlevel = -1
+} P {
   amin = 1
   amax = 1
   cmap = Jet
 } {
-  n = 17
-}
-Boundaries {
-  r = 0 g = 0 b = 0
-  shading = Constant
-  maxlevel = 8
+  n = 30
 }
diff --git a/test/euler/circle/star/star.gfs b/test/euler/circle/star/star.gfs
new file mode 100644
index 0000000..bf5a0ab
--- /dev/null
+++ b/test/euler/circle/star/star.gfs
@@ -0,0 +1,80 @@
+# Title: Star-shaped solid boundary
+#
+# Description:
+#
+# A similar but more difficult test using a star-shaped solid boundary
+# defined in polar coordinates as
+# $$
+# r(\theta)=0.2765+0.079\cos(6\theta)
+# $$
+#
+# The convergence rate is smaller because the shape of the boundary is
+# not represented properly on the coarsest levels of the multigrid
+# hierarchy.
+#
+# \begin{figure}[htbp]
+# \begin{center}
+# \includegraphics[width=0.6\hsize]{solution.eps}
+# \end{center}
+# \caption{Solution of the Poisson equation.}
+# \label{solution}
+# \end{figure}
+#
+# \begin{figure}[htbp]
+# \begin{center}
+# \includegraphics[width=0.8\hsize]{residual.eps}
+# \end{center}
+# \caption{Evolution of the residual.}
+# \label{residual}
+# \end{figure}
+#
+# \begin{figure}[htbp]
+# \begin{center}
+# \includegraphics[width=0.8\hsize]{rate.eps}
+# \end{center}
+# \caption{Average reduction factor.}
+# \label{rate}
+# \end{figure}
+#
+# \begin{figure}[htbp]
+# \begin{center}
+# \includegraphics[width=0.8\hsize]{error.eps}
+# \end{center}
+# \caption{Evolution of the error as a function of resolution.}
+# \label{error}
+# \end{figure}
+#
+# \begin{figure}[htbp]
+# \begin{center}
+# \includegraphics[width=0.8\hsize]{order.eps}
+# \end{center}
+# \caption{Corresponding convergence order.}
+# \label{order}
+# \end{figure}
+#
+# Author: St\'ephane Popinet
+# Command: shapes -n 2000 --dr 0.1 star | transform -s 0.79 > shape.gts && sh ../circle.sh star.gfs
+# Version: 0.8.0
+# Required files: res-7.ref error.ref order.ref
+# Generated files: residual.eps rate.eps error.eps order.eps solution.eps
+#
+1 0 GfsPoisson GfsBox GfsGEdge {} {
+  Time { iend = 10 }
+  Refine LEVEL
+  GtsSurfaceFile shape.gts
+  ApproxProjectionParams { nrelax = 4 tolerance = 1e-30 }
+  Init {} {
+    Div = {
+      int k = 3, l = 3;
+      return -M_PI*M_PI*(k*k + l*l)*sin (M_PI*k*x)*sin (M_PI*l*y);
+    }
+  }
+  OutputProjectionStats { istep = 1 } { 
+    awk '{
+      if ($1 == "niter:") printf ("%d ", $2);
+      if ($1 == "residual.infty:") print $3 " " $4;
+    }' > res-LEVEL 
+  }
+  OutputSimulation { start = end } sim-LEVEL { variables = P }
+}
+GfsBox {}
diff --git a/test/euler/poisson/circle/circle.gfs b/test/euler/poisson/circle/circle.gfs
new file mode 100644
index 0000000..d805f1e
--- /dev/null
+++ b/test/euler/poisson/circle/circle.gfs
@@ -0,0 +1,71 @@
+# Title: Convergence with a refined circle
+#
+# Description:
+#
+# Same as the previous test but in order to test the accuracy of the
+# gradient operator at coarse/fine boundaries, two levels of
+# refinement are added in a circle centered on the origin and of
+# radius 0.25.
+#
+# The solver still shows second-order accuracy in all norms (Figure \ref{order}).
+#
+# \begin{figure}[htbp]
+# \begin{center}
+# \includegraphics[width=0.8\hsize]{residual.eps}
+# \end{center}
+# \caption{Evolution of the residual.}
+# \label{residual}
+# \end{figure}
+#
+# \begin{figure}[htbp]
+# \begin{center}
+# \includegraphics[width=0.8\hsize]{rate.eps}
+# \end{center}
+# \caption{Average reduction factor.}
+# \label{rate}
+# \end{figure}
+#
+# \begin{figure}[htbp]
+# \begin{center}
+# \includegraphics[width=0.8\hsize]{error.eps}
+# \end{center}
+# \caption{Evolution of the error as a function of resolution.}
+# \label{error}
+# \end{figure}
+#
+# \begin{figure}[htbp]
+# \begin{center}
+# \includegraphics[width=0.8\hsize]{order.eps}
+# \end{center}
+# \caption{Corresponding convergence order.}
+# \label{order}
+# \end{figure}
+#
+# Author: St\'ephane Popinet
+# Command: sh ../poisson.sh circle.gfs
+# Version: 0.8.0
+# Required files: res-7.ref error.ref order.ref
+# Generated files: residual.eps rate.eps error.eps order.eps
+#
+1 0 GfsPoisson GfsBox GfsGEdge {} {
+  Time { iend = 10 }
+  Refine (x*x + y*y <= 0.25*0.25 ? LEVEL + 2 : LEVEL)
+  ApproxProjectionParams { nrelax = 4 tolerance = 1e-30 }
+  Init {} {
+    Div = {
+      int k = 3, l = 3;
+      return -M_PI*M_PI*(k*k + l*l)*sin (M_PI*k*x)*sin (M_PI*l*y);
+    }
+  }
+  OutputProjectionStats { istep = 1 } {
+    awk '{
+      if ($1 == "niter:") printf ("%d ", $2);
+      if ($1 == "residual.infty:") print $3 " " $4;
+    }' > res-LEVEL
+  }
+  OutputErrorNorm { start = end } stdout { v = P } {
+    s = (sin (M_PI*3.*x)*sin (M_PI*3.*y))
+    unbiased = 1
+  }
+}
+GfsBox {}
diff --git a/test/euler/poisson/circle/error.ref b/test/euler/poisson/circle/error.ref
new file mode 100644
index 0000000..8af1b27
--- /dev/null
+++ b/test/euler/poisson/circle/error.ref
@@ -0,0 +1,6 @@
+3 7.106e-02 1.049e-01 2.346e-01
+4 1.080e-02 1.480e-02 3.578e-02
+5 2.232e-03 3.079e-03 7.527e-03
+6 5.742e-04 7.761e-04 1.849e-03
+7 1.485e-04 1.985e-04 5.127e-04
+8 3.770e-05 5.022e-05 1.314e-04
diff --git a/test/euler/poisson/circle/order.ref b/test/euler/poisson/circle/order.ref
new file mode 100644
index 0000000..d5a1ab6
--- /dev/null
+++ b/test/euler/poisson/circle/order.ref
@@ -0,0 +1,5 @@
+4 2.71801 2.82535 2.71298
+5 2.27462 2.26506 2.24901
+6 1.95871 1.98815 2.02533
+7 1.95109 1.9671 1.85056
+8 1.97783 1.98281 1.96415
diff --git a/test/euler/poisson/circle/res-7.ref b/test/euler/poisson/circle/res-7.ref
new file mode 100644
index 0000000..651898e
--- /dev/null
+++ b/test/euler/poisson/circle/res-7.ref
@@ -0,0 +1,11 @@
+0 1.777e+02 0
+1 1.067e+02 1.7
+2 8.034e+00 4.7
+3 2.446e-01 9
+4 2.207e-02 9.5
+5 9.792e-04 11
+6 8.396e-05 11
+7 5.078e-06 12
+8 2.981e-07 12
+9 1.649e-08 13
+10 9.635e-10 13
diff --git a/test/euler/poisson/error.ref b/test/euler/poisson/error.ref
new file mode 100644
index 0000000..84d535e
--- /dev/null
+++ b/test/euler/poisson/error.ref
@@ -0,0 +1,6 @@
+3 5.097e-02 6.208e-02 1.194e-01
+4 1.196e-02 1.471e-02 2.914e-02
+5 2.945e-03 3.630e-03 7.243e-03
+6 7.334e-04 9.046e-04 1.808e-03
+7 1.832e-04 2.260e-04 4.518e-04
+8 4.578e-05 5.648e-05 1.130e-04
diff --git a/test/euler/poisson/order.ref b/test/euler/poisson/order.ref
new file mode 100644
index 0000000..c1b1aea
--- /dev/null
+++ b/test/euler/poisson/order.ref
@@ -0,0 +1,5 @@
+4 2.09143 2.07733 2.03473
+5 2.02188 2.01876 2.00834
+6 2.0056 2.00462 2.00219
+7 2.00118 2.00096 2.00064
+8 2.00063 2.00051 1.99936
diff --git a/test/euler/poisson/poisson.gfs b/test/euler/poisson/poisson.gfs
new file mode 100644
index 0000000..ac2457a
--- /dev/null
+++ b/test/euler/poisson/poisson.gfs
@@ -0,0 +1,82 @@
+# Title: Convergence of the Poisson solver
+#
+# Description:
+#
+# This is one of the test cases presented in Popinet
+# \cite{popinet2003}.  We solve the Poisson equation in a square
+# domain with Neumann boundary conditions on all sides and the
+# right-hand-side:
+# $$
+# \nabla\cdot{\bf U}^{\star\star}(x,y) = -\pi^2(k^2+l^2)\sin(\pi kx)\sin(\pi ly)
+# $$
+# with $k = l = 3$. The exact solution of the Poisson equation with this source term is
+# $$
+# \phi(x,y)=\sin(\pi kx)\sin(\pi ly).
+# $$
+# Figure \ref{residual} illustrates the evolution of the maximum
+# residual as a function of the number of V-cycles. Figure \ref{rate}
+# illustrates the average residual reduction factor (per V-cycle). The
+# evolution of the norms of the error of the final solution as a
+# function of resolution is illustrated on Figure \ref{error}. The
+# corresponding order of convergence is given on Figure \ref{order}.
+#
+# \begin{figure}[htbp]
+# \begin{center}
+# \includegraphics[width=0.8\hsize]{residual.eps}
+# \end{center}
+# \caption{Evolution of the residual.}
+# \label{residual}
+# \end{figure}
+#
+# \begin{figure}[htbp]
+# \begin{center}
+# \includegraphics[width=0.8\hsize]{rate.eps}
+# \end{center}
+# \caption{Average reduction factor.}
+# \label{rate}
+# \end{figure}
+#
+# \begin{figure}[htbp]
+# \begin{center}
+# \includegraphics[width=0.8\hsize]{error.eps}
+# \end{center}
+# \caption{Evolution of the error as a function of resolution.}
+# \label{error}
+# \end{figure}
+#
+# \begin{figure}[htbp]
+# \begin{center}
+# \includegraphics[width=0.8\hsize]{order.eps}
+# \end{center}
+# \caption{Corresponding convergence order.}
+# \label{order}
+# \end{figure}
+#
+# Author: St\'ephane Popinet
+# Command: sh poisson.sh poisson.gfs
+# Version: 0.8.0
+# Required files: poisson.sh res-7.ref error.ref order.ref
+# Generated files: residual.eps rate.eps error.eps order.eps
+#
+1 0 GfsPoisson GfsBox GfsGEdge {} {
+  Time { iend = 10 }
+  Refine LEVEL
+  ApproxProjectionParams { nrelax = 4 tolerance = 1e-30 }
+  Init {} {
+    Div = {
+      int k = 3, l = 3;
+      return -M_PI*M_PI*(k*k + l*l)*sin (M_PI*k*x)*sin (M_PI*l*y);
+    }
+  }
+  OutputProjectionStats { istep = 1 } { 
+    awk '{
+      if ($1 == "niter:") printf ("%d ", $2);
+      if ($1 == "residual.infty:") print $3 " " $4;
+    }' > res-LEVEL 
+  }
+  OutputErrorNorm { start = end } stdout { v = P } {
+    s = (sin (M_PI*3.*x)*sin (M_PI*3.*y))
+    unbiased = 1
+  }
+}
+GfsBox {}
diff --git a/test/euler/poisson/poisson.sh b/test/euler/poisson/poisson.sh
new file mode 100644
index 0000000..5016ee3
--- /dev/null
+++ b/test/euler/poisson/poisson.sh
@@ -0,0 +1,79 @@
+if ! $donotrun; then
+    rm -f error
+    for level in 3 4 5 6 7 8; do
+	if sed "s/LEVEL/$level/g" < $1 | \
+	    gerris2D - | \
+	    awk -v level=$level '{
+                  print level " " $5 " " $7 " " $9
+                }' >> error; then :
+	else
+	    exit 1
+	fi
+    done
+fi
+
+if awk '
+BEGIN { n = 0 }
+{
+  l[n] = $1; n1[n] = $2; n2[n] = $3; ni[n++] = $4;
+}
+END {
+  for (i = 1; i < n; i++)
+    print l[i] " " log(n1[i-1]/n1[i])/log(2.) " " log(n2[i-1]/n2[i])/log(2.) " " log(ni[i-1]/ni[i])/log(2.);
+}' < error > order; then :
+else
+    exit 1
+fi
+
+if cat <<EOF | gnuplot ; then :
+    set term postscript eps color lw 3 solid 20
+    set output 'residual.eps'
+    set xlabel 'V-cycle'
+    set ylabel 'Maximum residual'
+    set logscale y
+    plot 'res-7.ref' u 1:2 t 'ref' w lp, 'res-7' u 1:2 t '' w lp
+    set output 'rate.eps'
+    set xlabel 'V-cycle'
+    set ylabel 'Cumulative residual reduction factor'
+    unset logscale
+    plot 'res-7.ref' u 1:3 t 'ref' w lp, 'res-7' u 1:3 t '' w lp
+    set output 'error.eps'
+    set xlabel 'Level'
+    set ylabel 'Error norms'
+    set key
+    set logscale y
+    plot 'error.ref' u 1:2 t '1 (ref)' w lp, \
+         'error.ref' u 1:3 t '2 (ref)' w lp, \
+         'error.ref' u 1:4 t 'max (ref)' w lp, \
+         'error' u 1:2 t '1' w lp, \
+         'error' u 1:3 t '2' w lp, \
+         'error' u 1:4 t 'max' w lp
+    set output 'order.eps'
+    set xlabel 'Level'
+    set ylabel 'Order'
+    set key
+    unset logscale
+    set xtics 0,1
+    set ytics 0,1
+    set grid
+    plot [][0:3] 'order.ref' u 1:2 t '1 (ref)' w lp, \
+                 'order.ref' u 1:3 t '2 (ref)' w lp, \
+                 'order.ref' u 1:4 t 'max (ref)' w lp, \
+                 'order' u 1:2 t '1' w lp, \
+                 'order' u 1:3 t '2' w lp, \
+                 'order' u 1:4 t 'max' w lp
+EOF
+else
+    exit 1
+fi
+
+if cat <<EOF | python ; then :
+from check import *
+from sys import *
+if (Curve('res-7',1,2) - Curve('res-7.ref',1,2)).max() > 1e-8 or\
+   (Curve('error',1,4) - Curve('error.ref',1,4)).max() > 1e-6:
+    exit(1)
+EOF
+else
+   exit 1
+fi
diff --git a/test/euler/poisson/res-7.ref b/test/euler/poisson/res-7.ref
new file mode 100644
index 0000000..d0d290e
--- /dev/null
+++ b/test/euler/poisson/res-7.ref
@@ -0,0 +1,11 @@
+0 1.776e+02 0
+1 2.282e+01 7.8
+2 9.101e-01 14
+3 2.181e-02 20
+4 5.611e-04 24
+5 1.564e-05 26
+6 4.869e-07 27
+7 2.231e-08 26
+8 8.190e-10 26
+9 2.753e-11 27
+10 2.007e-11 20
diff --git a/test/euler/template.tex b/test/euler/template.tex
index 8206911..d997ae0 100644
--- a/test/euler/template.tex
+++ b/test/euler/template.tex
@@ -26,6 +26,13 @@ This document is automatically generated from the results obtained
 when running the Gerris test suite. The test suite is run daily on the
 current stable branch of the version-controlled source code.
 
+\section{Poisson}
+
+\input{poisson/poisson.tex}
+\input{poisson/circle/circle.tex}
+\input{circle/circle.tex}
+\input{circle/star/star.tex}
+
 \section{Euler}
 
 \input{reynolds/reynolds.tex}

-- 
Gerris Flow Solver



More information about the debian-science-commits mailing list