Index: /trunk/anuga_work/development/2010-projects/anuga_1d/pipe/pipe_domain.py
===================================================================
--- /trunk/anuga_work/development/2010-projects/anuga_1d/pipe/pipe_domain.py	(revision 8187)
+++ /trunk/anuga_work/development/2010-projects/anuga_1d/pipe/pipe_domain.py	(revision 8188)
@@ -32,4 +32,5 @@
 b         width            width of pipe [m]
 t         top              height of pipe above z [m]
+st        state            state of the cell (pressurised or free surface
 eta                        mannings friction coefficient [to appear]
 
@@ -58,5 +59,5 @@
 
         conserved_quantities = ['area', 'discharge']
-        evolved_quantities = ['area', 'discharge', 'elevation', 'height', 'velocity','width','top','stage']
+        evolved_quantities = ['area', 'discharge', 'elevation', 'height', 'velocity','width','top','stage','state']
         other_quantities = ['friction']
         Generic_domain.__init__(self,
@@ -126,4 +127,6 @@
         msg = 'Eighth evolved quantity must be "stage"'
         assert self.evolved_quantities[7] == 'stage', msg
+        msg = 'Ninth evolved quantity must be "state"'
+        assert self.evolved_quantities[8] == 'state', msg
 
         Generic_domain.check_integrity(self)
@@ -156,8 +159,9 @@
     width      = domain.quantities['width']
     top        = domain.quantities['top']
+    state      = domain.quantities['state']
 
 
     from anuga_1d.pipe.pipe_domain_ext import compute_fluxes_pipe_ext
-    domain.flux_timestep = compute_fluxes_pipe_ext(timestep,domain,area,discharge,bed,height,velocity,width,top)
+    domain.flux_timestep = compute_fluxes_pipe_ext(timestep,domain,area,discharge,bed,height,velocity,width,top,state)
 
 #-----------------------------------------------------------------------
@@ -186,4 +190,5 @@
     top       = domain.quantities['top']
     stage     = domain.quantities['stage']
+    state     = domain.quantities['state']
 
     #Arrays   
@@ -196,4 +201,5 @@
     t_C   = top.centroid_values
     w_C   = stage.centroid_values
+    s_C   = state.centroid_values
 
     if domain.setstageflag:
@@ -241,4 +247,5 @@
     b_V  = width.vertex_values
     t_V  = top.vertex_values
+    s_V  = state.vertex_values
 
 
@@ -283,6 +290,7 @@
         self.top    = domain.quantities['top'].vertex_values
         self.stage    = domain.quantities['stage'].vertex_values
-
-        self.evolved_quantities = numpy.zeros(8, numpy.float)
+        self.state    = domain.quantities['state'].vertex_values
+
+        self.evolved_quantities = numpy.zeros(9, numpy.float)
 
     def __repr__(self):
@@ -304,5 +312,5 @@
         q[6] =  self.top[vol_id,edge_id]
         q[7] =  self.stage[vol_id,edge_id]
-
+        q[8] =  self.state[vol_id,edge_id]
         return q
 
@@ -322,5 +330,5 @@
             raise msg
 
-        assert len(evolved_quantities) == 8
+        assert len(evolved_quantities) == 9
 
         self.evolved_quantities=numpy.array(evolved_quantities,numpy.float)
Index: /trunk/anuga_work/development/2010-projects/anuga_1d/pipe/pipe_domain_ext.c
===================================================================
--- /trunk/anuga_work/development/2010-projects/anuga_1d/pipe/pipe_domain_ext.c	(revision 8187)
+++ /trunk/anuga_work/development/2010-projects/anuga_1d/pipe/pipe_domain_ext.c	(revision 8188)
@@ -230,4 +230,5 @@
 				double* width_edge_values,
 				double* top_edge_values,
+				double* state_edge_values,
 				double* area_boundary_values,
 				double* discharge_boundary_values,
@@ -237,4 +238,5 @@
 				double* width_boundary_values,
 				double* top_boundary_values,
+				double* state_boundary_values,
 				double* area_explicit_update,
 				double* discharge_explicit_update,
@@ -242,5 +244,5 @@
 				double* max_speed_array) {
 
-  double flux[2], qlm[7], qlp[7], qrm[7], qrp[7], edgeflux[2];
+  double flux[2], qlm[8], qlp[8], qrm[8], qrp[8], edgeflux[2];
   double max_speed;
   int k, ki, n, m, nm=0;
@@ -264,4 +266,5 @@
       qlm[5] = width_boundary_values[m];
       qlm[6] = top_boundary_values[m];
+      qlm[7] = state_boundary_values[m];
 
     } else {
@@ -277,4 +280,5 @@
       qlm[5] = width_edge_values[nm];
       qlm[6] = top_edge_values[nm];
+      qlm[7] = state_edge_values[nm];
     }
 
@@ -286,4 +290,5 @@
     qlp[5] = width_edge_values[ki];
     qlp[6] = top_edge_values[ki];
+    qlp[7] = state_edge_values[ki];
 
     ki = k*2+1;
@@ -299,4 +304,5 @@
       qrp[5] = width_boundary_values[m];
       qrp[6] = top_boundary_values[m];
+      qrp[7] = state_boundary_values[m];
     } else {
       m = neighbour_vertices[ki];
@@ -311,4 +317,5 @@
       qrp[5] = width_edge_values[nm];
       qrp[6] = top_edge_values[nm];
+      qrp[7] = state_edge_values[nm];
     }
 
@@ -320,4 +327,5 @@
     qrm[5] = width_edge_values[ki];
     qrm[6] = top_edge_values[ki];
+    qrm[7] = state_edge_values[ki];
 
     _flux_function_pipe(qlm,qlp,qrm,qrp,g,epsilon,h0,edgeflux,&max_speed);
@@ -367,5 +375,6 @@
     *velocity,
     *width,
-    *top;
+    *top,
+    *state;
 
   PyArrayObject
@@ -381,4 +390,5 @@
     *width_vertex_values,
     *top_vertex_values,
+    *state_vertex_values,
     *area_boundary_values,
     *discharge_boundary_values,
@@ -388,4 +398,5 @@
     *width_boundary_values,
     *top_boundary_values,
+    *state_boundary_values,
     *area_explicit_update,
     *discharge_explicit_update,
@@ -397,5 +408,5 @@
 
   // Convert Python arguments to C
-  if (!PyArg_ParseTuple(args, "dOOOOOOOO",
+  if (!PyArg_ParseTuple(args, "dOOOOOOOOO",
 			&timestep,
 			&domain,
@@ -406,5 +417,6 @@
 			&velocity,
                         &width,
-			&top)) {
+			&top,
+			&state)) {
     PyErr_SetString(PyExc_RuntimeError, "comp_flux_pipe_ext.c: compute_fluxes_pipe_ext could not parse input");
     return NULL;
@@ -431,4 +443,5 @@
   width_vertex_values      = get_consecutive_array(width, "vertex_values");
   top_vertex_values      = get_consecutive_array(top, "vertex_values");
+  state_vertex_values      = get_consecutive_array(state, "vertex_values");
 
   area_boundary_values     = get_consecutive_array(area,     "boundary_values");
@@ -439,4 +452,5 @@
   width_boundary_values       = get_consecutive_array(width,     "boundary_values");
   top_boundary_values       = get_consecutive_array(top,     "boundary_values");
+  state_boundary_values       = get_consecutive_array(state,     "boundary_values");
 
 
@@ -464,4 +478,5 @@
 				      (double*) width_vertex_values -> data,
 				      (double*) top_vertex_values -> data,
+				      (double*) state_vertex_values -> data,
 				      (double*) area_boundary_values -> data,
 				      (double*) discharge_boundary_values -> data,
@@ -471,4 +486,5 @@
 				      (double*) width_boundary_values -> data,
 				      (double*) top_boundary_values -> data,
+				      (double*) state_boundary_values -> data,
 				      (double*) area_explicit_update -> data,
 				      (double*) discharge_explicit_update -> data,
@@ -488,4 +504,5 @@
   Py_DECREF(width_vertex_values);
   Py_DECREF(top_vertex_values);
+  Py_DECREF(state_vertex_values);
   Py_DECREF(area_boundary_values);
   Py_DECREF(discharge_boundary_values);
@@ -495,4 +512,5 @@
   Py_DECREF(width_boundary_values);
   Py_DECREF(top_boundary_values);
+  Py_DECREF(state_boundary_values);
   Py_DECREF(area_explicit_update);
   Py_DECREF(discharge_explicit_update);
Index: /trunk/anuga_work/development/2010-projects/anuga_1d/pipe/test_pipe.py
===================================================================
--- /trunk/anuga_work/development/2010-projects/anuga_1d/pipe/test_pipe.py	(revision 8187)
+++ /trunk/anuga_work/development/2010-projects/anuga_1d/pipe/test_pipe.py	(revision 8188)
@@ -49,4 +49,7 @@
     return 4
  
+def initial_state(x):
+    return 1
+ 
 import time
 
@@ -81,4 +84,5 @@
 domain.set_quantity('width',width)
 domain.set_quantity('top',top)
+domain.set_quantity('state',initial_state)
 
 # Set boundry type, order, timestepping method and limiter
