Index: /trunk/anuga_core/validation_tests/Tests/Analytical/steep_slope/channel_SU_2plot.py
===================================================================
--- /trunk/anuga_core/validation_tests/Tests/Analytical/steep_slope/channel_SU_2plot.py	(revision 8434)
+++ /trunk/anuga_core/validation_tests/Tests/Analytical/steep_slope/channel_SU_2plot.py	(revision 8434)
@@ -0,0 +1,103 @@
+"""View results of channel_SU.py
+"""
+#---------------
+# Import Modules
+#---------------
+import time
+import anuga
+import numpy
+import scipy
+from matplotlib import pyplot as pyplot
+from anuga.utilities import plot_utils as util
+#--------------
+# Get variables
+#--------------
+p=util.get_output('channel_SU_2_v2.sww', 0.001)
+p2=util.get_centroids(p,velocity_extrapolation=True)
+
+#------------------
+# Select line
+#------------------
+#v=(y==2.5)
+v=(p2.y==p2.y[3])
+
+#-------------------------------
+# Define variables of case study
+#-------------------------------
+mann=0.03 # Manning's coef
+bedslope=-0.1
+fluxin=20./100. #The momentum flux at the upstream boundary ( = discharge / width)
+
+#---------------------------------------------
+# Analytical solution for steady, uniform flow
+#---------------------------------------------
+# This comes from solving 
+# 1) Friction_slope=bedslope , and
+# 2) flux = depth*velocity = flux_in
+uana= ( mann**(-2.)*abs(bedslope)*fluxin**(4./3.) )**(3./10.) # Velocity
+dana= fluxin/uana # Depth
+
+#--------------------
+# Make plot animation
+#--------------------
+pyplot.close() #If the plot is open, there will be problems
+pyplot.ion()
+
+line, = pyplot.plot( (p2.x[v].min(),p2.x[v].max()) ,( (p2.stage[:,v]-p2.elev[:,v]).max(),(p2.stage[:,v]-p2.elev[v]).min() ) )
+line.set_label('Numerical')
+pyplot.plot( (0,100),(dana,dana), 'r',label='Analytical' )
+pyplot.legend()
+#pyplot.plot(x[v],elev[v],'green')
+for i in range(p2.xmom.shape[0]):
+    line.set_xdata(p2.x[v])
+    line.set_ydata(p2.stage[i,v]-p2.elev[v])
+    pyplot.draw()
+    pyplot.title('Flow depth: should be converging to steady uniform flow ' )
+    pyplot.xlabel('Distance down-slope (m)')
+    pyplot.ylabel('depth (m)')
+
+pyplot.title('Flow depth at 400s -- there should be a central region with steady uniform flow ' )
+pyplot.savefig('final_depth_v2.png')
+
+#--------------------------------------------
+# Compare x-velocity with analytical solution
+#--------------------------------------------
+#pyplot.clf()
+#pyplot.plot(x[v],xvel[200,v], label='Numerical')
+#pyplot.plot((0,100),(uana,uana),'r',label='Analytical')
+#pyplot.legend()
+#pyplot.xlabel('x')
+#pyplot.ylabel('Velocity m/s')
+#plottitle = "Final velocity in the x-direction -- some wiggles. \n Can this be improved with\
+# a different downstream boundary condition?" #\n Setting depth only at the downstream boundary does not help "
+#pyplot.title(plottitle)
+#pyplot.savefig('SU_x_velocity.png')
+
+
+# Find an x value close to x==50
+tmp=(abs(p2.x-50.)).argmin()
+v=(p2.x==p2.x[tmp])
+
+#--------------------------------------------------
+# Check if y velocity is zero everywhere (it should be)
+#--------------------------------------------------
+pyplot.clf()
+pyplot.plot(p2.y[v],p2.yvel[100,v],'o', label='Numerical')
+pyplot.plot((0,100),(0.0, 0.0),label='Analytical')
+pyplot.xlabel('Distance along the line x==50 (across the slope) (m)')
+pyplot.ylabel('Velocity m/s')
+pyplot.title('Final y-velocity near x=50.')
+pyplot.legend()
+pyplot.savefig('y_velocity_v2.png')
+
+
+pyplot.clf()
+pyplot.plot(p2.y[v],p2.xvel[100,v], 'o', label='Numerical')
+pyplot.plot((0,100),(uana,uana),label='Analytical')
+pyplot.xlabel('Distance along the line x==50 (across the slope) (m)')
+pyplot.ylabel('Velocity m/s')
+pyplot.title('Final velocity in the x-direction (downstream) \n at x=50. (similar for other x) ')
+pyplot.legend()
+pyplot.savefig('x_velocity_v2.png')
+pyplot.clf()
+
Index: /trunk/anuga_core/validation_tests/Tests/Analytical/steep_slope/channel_SU_sparse.py
===================================================================
--- /trunk/anuga_core/validation_tests/Tests/Analytical/steep_slope/channel_SU_sparse.py	(revision 8434)
+++ /trunk/anuga_core/validation_tests/Tests/Analytical/steep_slope/channel_SU_sparse.py	(revision 8434)
@@ -0,0 +1,72 @@
+"""Simple water flow example using ANUGA
+Water flowing down a channel
+"""
+import sys
+
+#---------------
+# I am having trouble with my environmental variables -- this is a 
+# quick fix -- PYTHONPATH should have this value
+#---------------
+#sys.path[0]='/nas/gemd/georisk_models/inundation/sandpits/gdavies/trunk/anuga_core/source'
+
+#--------------
+# Then from here, write the script as usual
+#--------------
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+# Import standard shallow water domain and standard boundaries.
+import anuga
+from anuga import rectangular_cross as rectangular_cross
+from anuga.structures.inlet_operator import Inlet_operator
+from anuga import Domain as Domain
+#from anuga.shallow_water.shallow_water_domain import Domain as Domain
+#from balanced_dev import *
+#from balanced_dev import Domain as Domain
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+points, vertices, boundary = rectangular_cross(10, 10,
+len1=100.0, len2=100.0) # Mesh
+domain = Domain(points, vertices, boundary) # Create domain
+domain.set_name('channel_SU_2_v2') # Output name
+domain.set_store_vertices_uniquely(True)
+domain.CFL=1.0
+#------------------------------------------------------------------------------
+# Setup initial conditions
+#------------------------------------------------------------------------------
+def topography(x, y):
+	return -x/10. #+abs(y-2.5)/10. # linear bed slope
+
+def stagetopo(x,y):
+    stg= -x/10. +0.06309625 # Constant depth
+    #topo=topography(x,y)
+    return stg#*(stg>topo) + topo*(stg<=topo)
+
+line1=[ [0.,0.], [0., 100.] ]
+Qin=20.
+Inlet_operator(domain, line1,Qin)
+
+domain.set_quantity('elevation', topography) # Use function for elevation
+domain.set_quantity('friction', 0.03) # Constant friction
+domain.set_quantity('stage', stagetopo)
+#------------------------------------------------------------------------------
+# Setup boundary conditions
+#------------------------------------------------------------------------------
+#Bi = anuga.Dirichlet_boundary([0.06309625, 0.00, 0.00]) # Inflow for steady uniform flow with a depth integrated velocity of 0.1
+
+Br = anuga.Reflective_boundary(domain) # Solid reflective wall
+#Bo= anuga.Dirichlet_boundary([-9.9369037,0.0,0]) # Outflow for steady uniform flow with a depth integrated velocity of 0.1
+
+def constant_water(t):
+    return -9.936903
+
+#Bo= anuga.shallow_water.boundaries.Transmissive_n_momentum_zero_t_momentum_set_stage_boundary(domain, constant_water) # Outflow for steady uniform flow with a depth integrated velocity of 0.1
+Bo = anuga.Transmissive_boundary(domain)
+domain.set_boundary({'left': Br, 'right': Bo, 'top': Br, 'bottom': Br})
+#------------------------------------------------------------------------------
+# Evolve system through time
+#------------------------------------------------------------------------------
+for t in domain.evolve(yieldstep=4.0, finaltime=400.0):
+	print domain.timestepping_statistics()
Index: /trunk/anuga_core/validation_tests/Tests/Analytical/steep_slope/produce_results.py
===================================================================
--- /trunk/anuga_core/validation_tests/Tests/Analytical/steep_slope/produce_results.py	(revision 8434)
+++ /trunk/anuga_core/validation_tests/Tests/Analytical/steep_slope/produce_results.py	(revision 8434)
@@ -0,0 +1,2 @@
+import channel_SU_sparse
+import channel_SU_2plot
Index: /trunk/anuga_core/validation_tests/Tests/Analytical/steep_slope/results.tex
===================================================================
--- /trunk/anuga_core/validation_tests/Tests/Analytical/steep_slope/results.tex	(revision 8434)
+++ /trunk/anuga_core/validation_tests/Tests/Analytical/steep_slope/results.tex	(revision 8434)
@@ -0,0 +1,34 @@
+\section{Shallow flow down a steep slope}
+This case simulates very shallow flow running down a poorly resolved, steep slope. It represents an idealisation of the rainfall-runoff problem, which will often involve very shallow flows down poorly resolved topography. This case has an analytical solution (the steady-uniform solution, bed slope = friction slope). Some experimental variants of \anuga ~completely fail on this problem -- especially some well balanced versions have had problems when the stage centroid value is less than the peak bed edge value, as in this problem.  
+
+\subsection{Results}
+Figures~\ref{depthdownchan} shows the steady state depth in the downstream direction. There should be a good agreement with the analytical solution, at least away from the boundaries.  
+
+\begin{figure}[h]
+\begin{center}
+\includegraphics[width=0.9\textwidth]{final_depth_v2.png}
+\caption{Depth in the downstream direction}
+\label{depthdownchan}
+\end{center}
+\end{figure}
+
+Figures~\ref{xvelscrosschan} and~\ref{yvelscroschan} show the steady state x and y velocities, along a slice in the cross slope direction (near x=50). The x velocities should agree well with the analytical solution, and the y velocities should be zero.  
+
+\begin{figure}[h]
+\begin{center}
+\includegraphics[width=0.9\textwidth]{x_velocity_v2.png}
+\caption{x-velocity along the cross-section x=50 (i.e. a cross-section with constant bed elevation)}
+\label{xvelscrosschan}
+\end{center}
+\end{figure}
+
+\begin{figure}[h]
+\begin{center}
+\includegraphics[width=0.9\textwidth]{y_velocity_v2.png}
+\caption{y-velocity along the cross-section x=50 (i.e. a cross-section with constant bed elevation)}
+\label{yvelscroschan}
+\end{center}
+\end{figure}
+
+
+\endinput
Index: /trunk/anuga_core/validation_tests/report.tex
===================================================================
--- /trunk/anuga_core/validation_tests/report.tex	(revision 8433)
+++ /trunk/anuga_core/validation_tests/report.tex	(revision 8434)
@@ -40,4 +40,6 @@
 \inputresults{Tests/Analytical/deep_wave}
 
+\inputresults{Tests/Analytical/steep_slope}
+
 %======================
 \chapter{Experimental Tests}
