Index: /trunk/anuga_core/validation_tests/Tests/Analytical/runup_sinusoid/produce_results.py
===================================================================
--- /trunk/anuga_core/validation_tests/Tests/Analytical/runup_sinusoid/produce_results.py	(revision 8412)
+++ /trunk/anuga_core/validation_tests/Tests/Analytical/runup_sinusoid/produce_results.py	(revision 8412)
@@ -0,0 +1,2 @@
+import runup_sinusoid
+import runup_sinusoidplot
Index: /trunk/anuga_core/validation_tests/Tests/Analytical/runup_sinusoid/results.tex
===================================================================
--- /trunk/anuga_core/validation_tests/Tests/Analytical/runup_sinusoid/results.tex	(revision 8412)
+++ /trunk/anuga_core/validation_tests/Tests/Analytical/runup_sinusoid/results.tex	(revision 8412)
@@ -0,0 +1,25 @@
+\section{Wave Runup over sinusoidal ridges}
+This scenario simulates a wave flowing up a beach with transverse sinusoidal ridges. Following the initial wave runup, eventually the water elevation should become constant, and the velocities should approach zero. 
+
+\subsection{Results}
+Figure~\ref{runupsinusoidfig1} shows the centroid velocities during the wave runup. The flow should be concentrating in the channels near the shore, and be free from major spikes.
+
+\begin{figure}[h]
+\begin{center}
+\includegraphics[width=0.9\textwidth]{vel_sinu3s_v2_cent.png}
+\caption{Velocity during the wave runup. Point color corresponds to the bed elevation}
+\label{runupsinusoidfig1}
+\end{center}
+\end{figure}
+
+Figure~\ref{runupsinusoidfig2} shows the velocities profile at time 20s. They should be nearly zero (e.g. O($10^{-3}$) m$/s$). This case has been used to illustrate wet-dry artefacts in some versions of \anuga.
+
+\begin{figure}[h]
+\begin{center}
+\includegraphics[width=0.9\textwidth]{vel_sinu30s_v2_cent.png}
+\caption{Velocity at time 20s after the wave runup. The flow speed should be nearly zero. Point color corresponds to the bed elevation.}
+\label{runupsinusoidfig2}
+\end{center}
+\end{figure}
+
+\endinput
Index: /trunk/anuga_core/validation_tests/Tests/Analytical/runup_sinusoid/runup_sinusoid.py
===================================================================
--- /trunk/anuga_core/validation_tests/Tests/Analytical/runup_sinusoid/runup_sinusoid.py	(revision 8412)
+++ /trunk/anuga_core/validation_tests/Tests/Analytical/runup_sinusoid/runup_sinusoid.py	(revision 8412)
@@ -0,0 +1,89 @@
+"""Runup example from the manual, slightly modified
+"""
+#---------
+#Import Modules
+#--------
+import anuga
+
+import numpy
+
+from math import sin, pi, exp
+from anuga.shallow_water.shallow_water_domain import Domain as Domain
+#from anuga.shallow_water_balanced2.swb2_domain import Domain as Domain
+#path.append('/home/gareth/storage/anuga_clean/anuga_jan12/trunk/anuga_work/development/gareth/balanced_basic')
+#from swb2_domain import *
+#from balanced_basic import *
+#from balanced_dev import *
+#---------
+#Setup computational domain
+#---------
+points, vertices, boundary = anuga.rectangular_cross(40,40, len1=1., len2=1.)
+
+domain=Domain(points,vertices,boundary)    # Create Domain
+domain.set_name('runup_sinusoid_v2')                         # Output to file runup.sww
+domain.set_datadir('.')                          # Use current folder
+domain.set_quantities_to_be_stored({'stage': 2, 'xmomentum': 2, 'ymomentum': 2, 'elevation': 1})
+#domain.set_store_vertices_uniquely(True)
+domain.minimum_allowed_height=0.001
+
+#------------------
+# Define topography
+#------------------
+scale_me=1.0
+
+#domain.minimum_allowed_height=domain.minimum_allowed_height*scale_me # Seems needed to make the algorithms behave
+
+def topography(x,y):
+	return (-x/2.0 +0.05*numpy.sin((x+y)*50.0))*scale_me
+
+def stagefun(x,y):
+    stge=-0.2*scale_me #-0.1*(x>0.5) -0.2*(x<=0.5)
+    #topo=topography(x,y) 
+    return stge#*(stge>topo) + (topo)*(stge<=topo)
+
+domain.set_quantity('elevation',topography)     # Use function for elevation
+domain.get_quantity('elevation').smooth_vertex_values() 
+
+domain.set_quantity('friction',0.00)             # Constant friction
+
+#def frict_change(x,y):
+#	return 0.2*(x>0.5)+0.1*(x<=0.5)
+#
+#domain.set_quantity('friction',frict_change)
+
+domain.set_quantity('stage', stagefun)              # Constant negative initial stage
+domain.get_quantity('stage').smooth_vertex_values()
+
+# Experiment with rain.
+# rainin = anuga.shallow_water.forcing.Rainfall(domain, rate=0.001) #, center=(0.,0.), radius=1000. )
+# domain.forcing_terms.append(rainin)
+
+#--------------------------
+# Setup boundary conditions
+#--------------------------
+Br=anuga.Reflective_boundary(domain)            # Solid reflective wall
+Bt=anuga.Transmissive_boundary(domain)          # Continue all values of boundary -- not used in this example
+Bd=anuga.Dirichlet_boundary([-0.1*scale_me,0.,0.])       # Constant boundary values -- not used in this example
+#Bw=anuga.Time_boundary(domain=domain,
+#	f=lambda t: [(0.0*sin(t*2*pi)-0.1)*exp(-t)-0.1,0.0,0.0]) # Time varying boundary -- get rid of the 0.0 to do a runup.
+
+#----------------------------------------------
+# Associate boundary tags with boundary objects
+#----------------------------------------------
+domain.set_boundary({'left': Br, 'right': Bd, 'top': Br, 'bottom':Br})
+
+#------------------------------
+#Evolve the system through time
+#------------------------------
+
+for t in domain.evolve(yieldstep=0.1,finaltime=20.0):
+    print domain.timestepping_statistics()
+    xx = domain.quantities['xmomentum'].centroid_values
+    yy = domain.quantities['ymomentum'].centroid_values
+    dd = domain.quantities['stage'].centroid_values - domain.quantities['elevation'].centroid_values 
+    dd = (dd)*(dd>1.0e-03)+1.0e-06
+    vv = ( (xx/dd)**2 + (yy/dd)**2 )**0.5
+    vv = vv*(dd>1.0e-03)
+    print 'Peak velocity is: ', vv.max(), vv.argmax()
+
+print 'Finished'
Index: /trunk/anuga_core/validation_tests/Tests/Analytical/runup_sinusoid/runup_sinusoidplot.py
===================================================================
--- /trunk/anuga_core/validation_tests/Tests/Analytical/runup_sinusoid/runup_sinusoidplot.py	(revision 8412)
+++ /trunk/anuga_core/validation_tests/Tests/Analytical/runup_sinusoid/runup_sinusoidplot.py	(revision 8412)
@@ -0,0 +1,75 @@
+"""View results of runup_sinusoid.py
+"""
+#---------------
+# Import Modules
+#---------------
+from anuga.utilities import plot_utils as util
+from matplotlib import pyplot as pyplot
+import numpy
+
+p1=util.get_output('runup_sinusoid_v2.sww', 0.001)
+p2=util.get_centroids(p1, velocity_extrapolation=True)
+
+#------------------
+# Select line
+#------------------
+#v=(p.y==0.5)
+v=(p2.y==p2.y[80])
+
+#--------------------
+# Make plot animation
+#--------------------
+pyplot.close() #If the plot is open, there will be problems
+pyplot.ion()
+
+if True:
+    line, = pyplot.plot( (p2.x[v].min(),p2.x[v].max()) ,(p2.xvel[:,v].min(),p2.xvel[:,v].max() ) )
+    for i in range(p2.xmom.shape[0]):
+        line.set_xdata(p2.x[v])
+        line.set_ydata(p2.xvel[i,v])
+        pyplot.draw()
+        pyplot.plot( (0,1),(0,0), 'r' )
+        pyplot.title(str(i)+'/200') # : velocity does not converge to zero' )
+        pyplot.xlabel('x')
+        pyplot.ylabel('Velocity (m/s)')
+
+    pyplot.savefig('runup_x_velocities.png')
+
+
+pyplot.clf()
+# Plot vertex values
+
+t1=numpy.argmin(abs(p1.time-1.0))
+t2=len(p1.time)-1
+
+pyplot.scatter(p1.x,p1.y,c=p1.elev,edgecolors='none', s=25)
+pyplot.colorbar()
+pyplot.quiver(p1.x,p1.y,p1.xvel[t1,:],p1.yvel[t1,:])
+pyplot.title('The maximum VERTEX speed is '+ str(p1.vel[t1,:].max()) + ' m/s at time '+ str(p1.time[t1])+'s')
+pyplot.savefig('vel_sinu3s_v2.png')
+
+pyplot.clf()
+# Plot vertex values
+pyplot.scatter(p2.x,p2.y,c=p2.elev,edgecolors='none', s=25)
+pyplot.colorbar()
+pyplot.quiver(p2.x,p2.y,p2.xvel[t1,:],p2.yvel[t1,:])
+pyplot.title('The maximum CENTROID speed is '+ str(p2.vel[t1,:].max()) + ' m/s at time ' + str(p1.time[t1]) + ' s')
+pyplot.savefig('vel_sinu3s_v2_cent.png')
+
+pyplot.clf()
+# Plot vertex values
+pyplot.scatter(p1.x,p1.y,c=p1.elev,edgecolors='none', s=25)
+pyplot.colorbar()
+pyplot.quiver(p1.x,p1.y,p1.xvel[t2,:],p1.yvel[t2,:])
+pyplot.title('The maximum VERTEX speed is '+ str(p1.vel[t2,:].max()) + ' m/s at time ' + str(p1.time[t2]) +' s')
+pyplot.savefig('vel_sinu30s_v2.png')
+
+pyplot.clf()
+# Plot vertex values
+pyplot.scatter(p2.x,p2.y,c=p2.elev,edgecolors='none', s=25)
+pyplot.colorbar()
+pyplot.quiver(p2.x,p2.y,p2.xvel[t2,:],p2.yvel[t2,:])
+pyplot.title('The maximum CENTROID speed is '+ str(p2.vel[t2,:].max()) + ' m/s at time' + str(p1.time[t2])+ ' s')
+pyplot.savefig('vel_sinu30s_v2_cent.png')
+
+
Index: /trunk/anuga_core/validation_tests/report.tex
===================================================================
--- /trunk/anuga_core/validation_tests/report.tex	(revision 8411)
+++ /trunk/anuga_core/validation_tests/report.tex	(revision 8412)
@@ -5,4 +5,5 @@
 \usepackage{graphicx}
 \usepackage{epstopdf}
+\usepackage[section]{placeins} % 'one-shot' command to nicely place figures
 
 \input{local-defs}
@@ -36,4 +37,5 @@
 \inputresults{Tests/Analytical/runup1}
 
+\inputresults{Tests/Analytical/runup_sinusoid}
 %======================
 \chapter{Experimental Tests}
