[gerris] 12/13: Add autopkgtest.

Anton Gladky gladk at moszumanska.debian.org
Thu Jul 31 22:49:44 UTC 2014


This is an automated email from the git hooks/post-receive script.

gladk pushed a commit to branch master
in repository gerris.

commit a34c986308cf2ca6df6a2561dd8de8569703591b
Author: Anton Gladky <gladk at debian.org>
Date:   Fri Aug 1 00:28:43 2014 +0200

    Add autopkgtest.
---
 debian/control           |  1 +
 debian/tests/control     |  2 ++
 debian/tests/testCons    | 74 ++++++++++++++++++++++++++++++++++++++++++++
 debian/tests/testHydro   | 52 +++++++++++++++++++++++++++++++
 debian/tests/testKinetic | 80 ++++++++++++++++++++++++++++++++++++++++++++++++
 debian/tests/testPlate   | 45 +++++++++++++++++++++++++++
 debian/tests/testQuadr   | 68 ++++++++++++++++++++++++++++++++++++++++
 7 files changed, 322 insertions(+)

diff --git a/debian/control b/debian/control
index 065e665..c34e078 100644
--- a/debian/control
+++ b/debian/control
@@ -21,6 +21,7 @@ Standards-Version: 3.9.5
 Homepage: http://gfs.sourceforge.net/
 Vcs-Git: git://anonscm.debian.org/debian-science/packages/gerris.git
 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=debian-science/packages/gerris.git
+XS-Testsuite: autopkgtest
 
 Package: gerris
 Architecture: any
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..dcc742b
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,2 @@
+Tests: testCons testHydro testKinetic testPlate testQuadr
+Depends: gerris, libgfs-1.3-2, libgfs-dev, build-essential
diff --git a/debian/tests/testCons b/debian/tests/testCons
new file mode 100755
index 0000000..1ef0647
--- /dev/null
+++ b/debian/tests/testCons
@@ -0,0 +1,74 @@
+#!/bin/sh
+# autopkgtest check
+# (C) 2014 Anton Gladky
+
+set -e
+
+export OMPI_MCA_orte_rsh_agent=/bin/false
+
+WORKDIR=$(mktemp -d)
+trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
+cd $WORKDIR
+
+cat <<EOF > demo.tst
+# Title: Conservation of diffusive tracer
+#
+# Description:
+#
+# Tests that the total amount of a diffusive tracer is conserved
+# exactly on adaptive meshes. Also compares solutions obtained using
+# the implicit and explicit schemes.
+#
+# Author: St\'ephane Popinet and Ye Tao
+# Command: gerris3D conservation.gfs
+# Version: 110131
+# Required files:
+#
+1 0 GfsSimulation GfsBox GfsGEdge {} {
+    Time { iend = 100 dtmax = 2e-1 }
+    Refine 3
+    VariableTracer T
+    VariableTracer Te
+    InitFraction T (0.01 - (x*x + y*y + z*z))
+    InitFraction Te (0.01 - (x*x + y*y + z*z))
+    SourceDiffusion T 1e-4 { beta = 0.5 }
+    SourceDiffusionExplicit Te 1e-4
+    AdaptGradient { istep = 1 } { minlevel = 3 maxlevel = 5 cmax = 1e-2 } T
+    OutputScalarSum { istep = 1 } st { v = T }
+    OutputScalarSum { istep = 1 } ste { v = T }
+    OutputScalarStats { istep = 1 } t { v = T }
+    OutputScalarStats { istep = 1 } te { v = T }
+    OutputScalarNorm { istep = 1 } diff { v = (T - Te) }
+    EventScript { start = end } {
+	if awk '{if (\$9 > 8e-3) { 
+                   print "diff: " \$9 > "/dev/stderr"; exit (1); 
+                }}' < diff &&
+	   awk 'BEGIN{ s=-1 } {
+                  if (s < 0.) s = \$5; 
+                  else if (\$5 - s != 0.) {
+                    print "st: " \$5 - s > "/dev/stderr"; exit (1);
+                  }
+                }' < st &&
+	   awk 'BEGIN{ s=-1 } {
+                  if (s < 0.) s = \$5;
+                  else if (\$5 - s != 0.) {
+                    print "ste: " \$5 - s > "/dev/stderr"; exit (1);
+                  }
+                }' < ste ; then :
+        else
+            exit \$GFS_STOP;
+        fi
+    }
+}
+GfsBox{}
+EOF
+
+gerris2D ./demo.tst
+ls -ln
+cat diff; cat st; cat ste; cat t; cat te
+rm diff; rm st; rm ste; rm t; rm te
+gerris3D ./demo.tst
+ls -ln
+cat diff; cat st; cat ste; cat t; cat te
+rm diff; rm st; rm ste; rm t; rm te
+echo "run: OK"
diff --git a/debian/tests/testHydro b/debian/tests/testHydro
new file mode 100755
index 0000000..d322793
--- /dev/null
+++ b/debian/tests/testHydro
@@ -0,0 +1,52 @@
+#!/bin/sh
+# autopkgtest check
+# (C) 2014 Anton Gladky
+
+set -e
+
+export OMPI_MCA_orte_rsh_agent=/bin/false
+
+WORKDIR=$(mktemp -d)
+trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
+cd $WORKDIR
+
+cat <<EOF > demo.tst
+# Title: Hydrostatic balance with solid boundaries and viscosity
+#
+# Description:
+#
+# Checks that hydrostatic balance is accurately computed when coupled
+# with the Crank-Nicholson discretisation of viscous terms.
+#
+# Author: St\'ephane Popinet
+# Command: gerris2D hydrostatic.gfs
+# Version: 1.1.3
+# Required files:
+1 0 GfsSimulation GfsBox GfsGEdge {} {
+    Refine 3
+    Source V -1
+    SourceViscosity 1e-2
+    Solid (ellipse(0.,0.,0.24,0.24))
+    Time { iend = 10 }
+    ApproxProjectionParams { tolerance = 1e-12 }
+    ProjectionParams { tolerance = 1e-12 }
+
+    OutputScalarNorm { istep = 1 } v { v = V }
+    EventScript { start = end } { 
+        if awk '{if (\$9 > 1.5e-12) { print \$9 > "/dev/stderr"; exit (1); }}' < v ; then
+            exit 0;
+        else
+            exit \$GFS_STOP;
+        fi
+    }
+}
+GfsBox {
+    bottom = Boundary
+}
+EOF
+
+gerris2D ./demo.tst
+ls -ln
+cat v
+rm v
+echo "run: OK"
diff --git a/debian/tests/testKinetic b/debian/tests/testKinetic
new file mode 100755
index 0000000..05bc8fd
--- /dev/null
+++ b/debian/tests/testKinetic
@@ -0,0 +1,80 @@
+#!/bin/sh
+# autopkgtest check
+# (C) 2014 Anton Gladky
+
+set -e
+
+export OMPI_MCA_orte_rsh_agent=/bin/false
+
+WORKDIR=$(mktemp -d)
+trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
+cd $WORKDIR
+
+cat <<EOF > demo.tst
+# Title: Momentum conservation for large density ratios
+#
+# Description:
+#
+# A dense droplet moves through a lighter background fluid. The
+# kinetic energy decreases due to viscous dissipation (Figure
+# \ref{k}). For these density and viscosity ratios of 1000, the
+# calculation is stable only if a "mollified" volume fraction is used
+# to compute the average density and viscosity.
+#
+# \begin{figure}[htbp]
+# \caption{\label{k}Evolution of the kinetic energy.}
+# \begin{center}
+# \includegraphics[width=0.8\hsize]{k.eps}
+# \end{center}
+# \end{figure}
+#
+# Author: St\'ephane Popinet
+# Command: gerris2D kinetic.gfs
+# Version: 1.1.0
+# Required files: kinetic.gfs
+# Generated files: k.eps
+1 0 GfsSimulation GfsBox GfsGEdge {} {
+    Time { end = 0.5 }
+
+    Global {
+        #define var(T,min,max) (CLAMP(T,0,1)*(max - min) + min)
+        #define rho(T) var(T, 0.001, 1.)
+        #define mu(T)  var(T, 1e-6, 1e-3)
+        #define level 7
+        #define radius 0.05
+    }
+
+    Refine level
+
+    ProjectionParams { tolerance = 1e-6 }
+    ApproxProjectionParams { tolerance = 1e-6 }
+
+    VariableTracerVOFHeight T
+    VariableFiltered T1 T 1
+    InitFraction T (- ellipse(-0.3,0,radius,radius))
+    Init {} { U = T }
+
+    PhysicalParams { alpha = 1./rho(T1) }
+    SourceViscosity mu(T1)
+
+    AdaptVorticity { istep = 1 } { cmax = 0.3 maxlevel = level }
+    AdaptGradient { istep = 1 } { cmax = 1e-3 maxlevel = level } T
+
+    OutputScalarSum { istep = 1 } k { v = Velocity2*rho(T1) }
+    OutputScalarSum { istep = 1 } t { v = T }
+
+    EventScript { start = end } {
+        if awk '{if (\$5 > 7.2e-3) exit (1);}' < k ; then
+            return 0;
+        else
+            return $GFS_STOP;
+        fi
+    } 
+}
+GfsBox {}
+EOF
+
+gerris2D ./demo.tst
+ls -ln
+cat k; cat t
+echo "run: OK"
diff --git a/debian/tests/testPlate b/debian/tests/testPlate
new file mode 100755
index 0000000..537b2a3
--- /dev/null
+++ b/debian/tests/testPlate
@@ -0,0 +1,45 @@
+#!/bin/sh
+# autopkgtest check
+# (C) 2014 Anton Gladky
+
+set -e
+
+export OMPI_MCA_orte_rsh_agent=/bin/false
+
+WORKDIR=$(mktemp -d)
+trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
+cd $WORKDIR
+
+cat <<EOF > demo.tst
+# Title: Potential flow around a thin plate
+#
+# Description:
+#
+# This test case triggers an instability if the cell-centered pressure
+# gradient used in the approximate projection is not computed using
+# solid-fraction-weighted averages of the face-centered pressure
+# gradients.
+#
+# Author: St\'ephane Popinet
+# Command: sh plate.sh plate.gfs
+# Version: 1.1.2
+# Required files: plate.sh
+#
+1 0 GfsSimulation GfsBox GfsGEdge {} {
+  Time { iend = 30 dtmax = 1e-2 }
+  Refine 5
+  RefineSolid 6
+  Solid (cube(0,0,0,0.5)) { sy = 0.06251 tx = 0.031249 ty = -0.015 }
+  AdvectionParams { scheme = none }
+  Init {} { U = 1 }
+  OutputScalarNorm { start = end } stdout { v = Velocity } 
+}
+GfsBox {
+  left = Boundary { BcDirichlet U 1 }
+  right = BoundaryOutflow 
+}
+EOF
+
+gerris2D ./demo.tst
+ls -ln
+echo "run: OK"
diff --git a/debian/tests/testQuadr b/debian/tests/testQuadr
new file mode 100755
index 0000000..fe64c84
--- /dev/null
+++ b/debian/tests/testQuadr
@@ -0,0 +1,68 @@
+#!/bin/sh
+# autopkgtest check
+# (C) 2014 Anton Gladky
+
+set -e
+
+export OMPI_MCA_orte_rsh_agent=/bin/false
+
+WORKDIR=$(mktemp -d)
+trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
+cd $WORKDIR
+
+cat <<EOF > demo.tst
+# Title: Hydrostatic balance with quadratic pressure profile
+#
+# Description:
+#
+# Same test as before but for a quadratic pressure profile.
+#
+# Author: St\'ephane Popinet
+# Command: gerris2D quadratic.gfs
+# Version: 1.2.0
+# Required files: quadratic.gfs
+1 0 GfsSimulation GfsBox GfsGEdge {} {
+    Refine 3
+
+    # This test case only works for constant refinement
+    #    Refine (x*x + y*y < 0.2*0.2 ? 4 : 3) 
+
+    # Note: it is important to use 'cy' rather than 'y' in the formula
+    # below so that the hydrostatic density distribution is correct
+    # even for 'cut cells'
+    Init {} { rho = (cy + 0.5) }
+
+    Source V -rho
+    SourceViscosity 1e-2
+    Solid (ellipse(0.,0.,0.24,0.24))
+    Time { iend = 10 }
+    ApproxProjectionParams { tolerance = 1e-12 }
+    ProjectionParams { tolerance = 1e-12 }
+
+    OutputScalarNorm { istep = 1 } v { v = V }
+    # Checks that the pressure profile is close to the exact solution
+    OutputErrorNorm { istep = 1 } p { v = P } {
+        s = -(cy*cy/2. + 0.5*cy) 
+        unbiased = 1 
+    }
+    EventScript { start = end } { 
+        if awk '{if (\$9 > 1.5e-12) exit (1);}' < v ; then :
+        else
+            exit \$GFS_STOP;
+        fi        
+        if awk '{if (\$9 > 1e-12) exit (1);}' < p ; then :
+        else
+            exit \$GFS_STOP;
+        fi
+    } 
+}
+GfsBox {
+    bottom = Boundary
+}
+EOF
+
+gerris2D ./demo.tst
+ls -ln
+cat p; cat v
+rm p; rm v
+echo "run: OK"

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/gerris.git



More information about the debian-science-commits mailing list