Index: trunk/anuga_core/anuga/parallel/parallel_api.py
===================================================================
--- trunk/anuga_core/anuga/parallel/parallel_api.py	(revision 9732)
+++ trunk/anuga_core/anuga/parallel/parallel_api.py	(revision 9737)
@@ -43,4 +43,21 @@
 
 
+def collect_value(value):
+    
+    value = value
+
+    if myid == 0:
+        for i in range(numprocs):
+            if i == 0: continue
+            val = receive(i)
+            value = value + val
+    else:
+        send(value, 0)
+
+    return value   
+    
+
+
+
 def distribute(domain, verbose=False, debug=False, parameters = None):
     """ Distribute the domain to all processes
@@ -61,5 +78,7 @@
                 domain_name, domain_dir, domain_store, domain_store_centroids, \
                 domain_minimum_storable_height, domain_minimum_allowed_height, \
-                domain_flow_algorithm, georef = partition.extract_submesh(0)
+                domain_flow_algorithm, domain_georef, \
+                domain_quantities_to_be_stored, domain_smooth \
+                 = partition.extract_submesh(0)
         
         for p in range(1, numprocs):
@@ -72,7 +91,9 @@
 
         kwargs, points, vertices, boundary, quantities, boundary_map, \
-                       domain_name, domain_dir, domain_store, domain_store_centroids, \
-                       domain_minimum_storable_height, domain_minimum_allowed_height, \
-                       domain_flow_algorithm, georef = receive(0)
+            domain_name, domain_dir, domain_store, domain_store_centroids, \
+            domain_minimum_storable_height, domain_minimum_allowed_height, \
+            domain_flow_algorithm, domain_georef, \
+            domain_quantities_to_be_stored, domain_smooth \
+             = receive(0)
 
     #---------------------------------------------------------------------------
@@ -111,6 +132,7 @@
     parallel_domain.set_minimum_allowed_height(domain_minimum_allowed_height)
     parallel_domain.set_flow_algorithm(domain_flow_algorithm)
-    parallel_domain.geo_reference = georef
-
+    parallel_domain.geo_reference = domain_georef
+    parallel_domain.set_quantities_to_be_stored(domain_quantities_to_be_stored)
+    parallel_domain.smooth = domain_smooth
 
     return parallel_domain
@@ -465,3 +487,2 @@
 
 ##     return l2g
-
Index: trunk/anuga_core/anuga/parallel/parallel_boyd_box_operator.py
===================================================================
--- trunk/anuga_core/anuga/parallel/parallel_boyd_box_operator.py	(revision 9732)
+++ trunk/anuga_core/anuga/parallel/parallel_boyd_box_operator.py	(revision 9737)
@@ -23,7 +23,8 @@
                  losses,
                  width,
+                 blockage=0.0, #added PM 24/7/2016
                  z1=0.0,
-                 z2=0.0,
-                 height=None,
+                 z2=0.0,                
+                 height=None,                
                  end_points=None,
                  exchange_lines=None,
@@ -55,7 +56,8 @@
                                           width=width,
                                           height=height,
+                                          blockage=0.0, #added PM 24/7/2016
                                           z1=0.0,
                                           z2=0.0,
-                                          diameter= None,
+                                          diameter= None,                                         
                                           apron=apron,
                                           manning=manning,
@@ -92,4 +94,5 @@
         self.culvert_width = self.get_culvert_width()
         self.culvert_height = self.get_culvert_height()
+        self.culvert_blockage = self.get_culvert_blockage()#added PM 24/7/2016
 
         self.max_velocity = 10.0
@@ -283,4 +286,5 @@
                                                 flow_width          =self.culvert_width,
                                                 length              =self.culvert_length,
+                                                blockage            =self.culvert_blockage, #added PM 24/7/2016
                                                 driving_energy      =self.driving_energy,
                                                 delta_total_energy  =self.delta_total_energy,
Index: trunk/anuga_core/anuga/parallel/parallel_generic_communications.py
===================================================================
--- trunk/anuga_core/anuga/parallel/parallel_generic_communications.py	(revision 9732)
+++ trunk/anuga_core/anuga/parallel/parallel_generic_communications.py	(revision 9737)
@@ -134,5 +134,5 @@
 
 
-def communicate_ghosts_asynchronous(domain):
+def communicate_ghosts_asynchronous(domain, quantities=None):
 
     # We must send the information from the full cells and
@@ -145,4 +145,7 @@
     import time
     t0 = time.time()
+    
+    if quantities is None:
+        quantities = domain.conserved_quantities
 
     # update of non-local ghost cells by copying full cell data into the
@@ -156,5 +159,5 @@
         Xout = domain.full_send_dict[send_proc][2]
 
-        for i, q in enumerate(domain.conserved_quantities):
+        for i, q in enumerate(quantities):
             #print 'Store send data',i,q
             Q_cv =  domain.quantities[q].centroid_values
@@ -163,13 +166,5 @@
 
 
-#    from pprint import pprint
-#
-#    if pypar.rank() == 0:
-#        print 'Before commun 0'
-#        pprint(domain.full_send_dict)
-#
-#    if pypar.rank() == 1:
-#        print 'Before commun 1'
-#        pprint(domain.full_send_dict)
+
 
 
@@ -197,5 +192,5 @@
         #print X
 
-        for i, q in enumerate(domain.conserved_quantities):
+        for i, q in enumerate(quantities):
             #print 'Read receive data',i,q
             Q_cv =  domain.quantities[q].centroid_values
Index: trunk/anuga_core/anuga/parallel/parallel_operator_factory.py
===================================================================
--- trunk/anuga_core/anuga/parallel/parallel_operator_factory.py	(revision 9732)
+++ trunk/anuga_core/anuga/parallel/parallel_operator_factory.py	(revision 9737)
@@ -118,6 +118,7 @@
 def Boyd_box_operator(domain,
                        losses,
-                       width,
-                       height=None,
+                       width,                       
+                       height=None,                                           
+                       blockage=0.0, #added by DPM 24/7/2016 
                        z1=0.0,
                        z2=0.0,
@@ -147,4 +148,5 @@
                                                                     width=width,
                                                                     height=height,
+                                                                    blockage=blockage,#added by DPM 24/7/2016
                                                                     z1=0.0,
                                                                     z2=0.0,
@@ -253,4 +255,5 @@
                                          width=width,
                                          height=height,
+                                         blockage=blockage, #added by DPM 24/7/2016
                                          end_points=end_points,
                                          exchange_lines=exchange_lines,
Index: trunk/anuga_core/anuga/parallel/parallel_shallow_water.py
===================================================================
--- trunk/anuga_core/anuga/parallel/parallel_shallow_water.py	(revision 9732)
+++ trunk/anuga_core/anuga/parallel/parallel_shallow_water.py	(revision 9737)
@@ -136,10 +136,10 @@
 
 
-    def update_ghosts(self):
+    def update_ghosts(self, quantities=None):
         """We must send the information from the full cells and
         receive the information for the ghost cells
         """
             
-        generic_comms.communicate_ghosts_asynchronous(self)
+        generic_comms.communicate_ghosts_asynchronous(self, quantities)
         #generic_comms.communicate_ghosts_blocking(self)
 
Index: trunk/anuga_core/anuga/parallel/parallel_structure_operator.py
===================================================================
--- trunk/anuga_core/anuga/parallel/parallel_structure_operator.py	(revision 9732)
+++ trunk/anuga_core/anuga/parallel/parallel_structure_operator.py	(revision 9737)
@@ -46,4 +46,5 @@
                  z1,#added by PM 22/10/2013
                  z2,#added by PM 22/10/2013
+                 blockage,#added by PM 24/7/2016  
                  apron,
                  manning,
@@ -117,4 +118,5 @@
         self.z1 = z1 #added by PM 22/10/2013
         self.z2 = z2 #added by PM 22/10/2013
+        self.blockage = blockage #added by PM 24/7/2016  
         self.apron  = apron
         self.manning = manning
@@ -710,5 +712,8 @@
     def get_culvert_z2(self): #added by PM 22/10/2013       
         return self.z2
-        
+
+    def get_culvert_blockage(self): #added by PM 24/7/2016		
+        return self.blockage #added by PM 24/7/2016 
+                
     def get_culvert_apron(self):
         return self.apron
@@ -746,5 +751,9 @@
 
         self.culvert_z2 = z2  
-        
+
+    def set_culvert_blockage(self, blockage): #added by PM 24/7/2016  
+
+        self.culvert_blockage = blockage  #added by PM 24/7/2016 
+                
     def parallel_safe(self):
         return True
Index: trunk/anuga_core/anuga/parallel/parallel_weir_orifice_trapezoid_operator.py
===================================================================
--- trunk/anuga_core/anuga/parallel/parallel_weir_orifice_trapezoid_operator.py	(revision 9732)
+++ trunk/anuga_core/anuga/parallel/parallel_weir_orifice_trapezoid_operator.py	(revision 9737)
@@ -247,5 +247,5 @@
             
                 Q, barrel_velocity, outlet_culvert_depth, flow_area, case = \
-                              weir_orifice_trapezoid_function(depth               =self.culvert_height,
+                              weir_orifice_trapezoid_function(depth =self.culvert_height,
                                                 width               =self.culvert_width,
                                                 z1                  =self.culvert_z1,
Index: trunk/anuga_core/anuga/parallel/sequential_distribute.py
===================================================================
--- trunk/anuga_core/anuga/parallel/sequential_distribute.py	(revision 9732)
+++ trunk/anuga_core/anuga/parallel/sequential_distribute.py	(revision 9737)
@@ -60,4 +60,6 @@
         self.domain_minimum_allowed_height = domain.get_minimum_allowed_height()
         self.domain_georef = domain.geo_reference
+        self.domain_quantities_to_be_stored = domain.quantities_to_be_stored
+        self.domain_smooth = domain.smooth
         self.number_of_global_triangles = domain.number_of_triangles
         self.number_of_global_nodes = domain.number_of_nodes
@@ -193,4 +195,6 @@
         domain_flow_algorithm = self.domain_flow_algorithm
         domain_georef = self.domain_georef
+        domain_quantities_to_be_stored = self.domain_quantities_to_be_stored
+        domain_smooth = self.domain_smooth
             
         tostore = (kwargs, points, vertices, boundary, quantities, \
@@ -199,5 +203,5 @@
                    domain_minimum_storable_height, \
                    domain_minimum_allowed_height, domain_flow_algorithm, \
-                   domain_georef)
+                   domain_georef, domain_quantities_to_be_stored, domain_smooth)
 
 
@@ -269,5 +273,6 @@
                    domain_name, domain_dir, domain_store, domain_store_centroids, \
                    domain_minimum_storable_height, domain_minimum_allowed_height, \
-                   domain_flow_algorithm, georef = cPickle.load(f)
+                   domain_flow_algorithm, domain_georef, \
+                   domain_quantities_to_be_stored, domain_smooth = cPickle.load(f)
     f.close()
 
@@ -304,6 +309,7 @@
     domain.set_minimum_storable_height(domain_minimum_storable_height)
     domain.set_minimum_allowed_height(domain_minimum_allowed_height)
-    domain.geo_reference = georef
-
+    domain.geo_reference = domain_georef
+    domain.set_quantities_to_be_stored(domain_quantities_to_be_stored)
+    domain.smooth = domain_smooth
 
     return domain
Index: trunk/anuga_core/anuga/parallel/tests/test_distribute_settings.py
===================================================================
--- trunk/anuga_core/anuga/parallel/tests/test_distribute_settings.py	(revision 9737)
+++ trunk/anuga_core/anuga/parallel/tests/test_distribute_settings.py	(revision 9737)
@@ -0,0 +1,166 @@
+"""
+Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+
+This is a very simple test of the parallel algorithm using the simplified parallel API
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+import unittest
+import os
+import sys
+#import pypar
+import numpy as num
+
+
+
+from anuga import Domain
+from anuga import Reflective_boundary
+from anuga import Dirichlet_boundary
+from anuga import Time_boundary
+from anuga import Transmissive_boundary
+
+from anuga import Geo_reference
+
+from anuga import rectangular_cross_domain
+
+
+from anuga import distribute, myid, numprocs, send, receive, barrier, finalize
+
+from anuga.parallel.sequential_distribute import sequential_distribute_dump
+from anuga.parallel.sequential_distribute import sequential_distribute_load
+
+import anuga.utilities.plot_utils as util
+
+
+#--------------------------------------------------------------------------
+# Setup parameters
+#--------------------------------------------------------------------------
+yieldstep = 0.25
+finaltime = 3.0
+nprocs = 4
+N = 29
+M = 29 
+verbose = False
+
+
+new_parameters = {}
+new_parameters['ghost_layer_width'] = 2
+
+#---------------------------------
+# Setup Functions
+#---------------------------------
+def topography(x,y): 
+    return -x/2    
+
+###########################################################################
+# Setup Test
+##########################################################################
+def run_simulation(parallel=False, verbose=False):
+
+    #--------------------------------------------------------------------------
+    # Setup computational domain and quantities
+    #--------------------------------------------------------------------------
+    domain = rectangular_cross_domain(M, N)
+    domain.set_name('odomain')                    # Set sww filename
+    domain.set_datadir('.')   
+    domain.set_quantity('elevation', topography) # Use function for elevation
+    domain.set_quantity('friction', 0.0)         # Constant friction 
+    domain.set_quantity('stage', expression='elevation') # Dry initial stage
+    
+    domain.set_quantities_to_be_stored({'elevation': 2,'stage': 2,'xmomentum': 2,'ymomentum': 2})
+    domain.set_store_vertices_uniquely(False)
+    domain.set_flow_algorithm('DE1')
+    georef = Geo_reference(zone=56,xllcorner=100000.0,yllcorner=200000.0)
+    domain.set_georeference(georef)
+        
+    #--------------------------------------------------------------------------
+    # Create pickled partition
+    #--------------------------------------------------------------------------
+    if myid == 0:
+        if verbose: print 'DUMPING PARTITION DATA'
+        sequential_distribute_dump(domain, numprocs, verbose=verbose, parameters=new_parameters)    
+
+    #--------------------------------------------------------------------------
+    # Create the parallel domains
+    #--------------------------------------------------------------------------
+    if parallel:
+        
+        if myid == 0 and verbose : print 'DISTRIBUTING TO PARALLEL DOMAIN'
+        pdomain = distribute(domain, verbose=verbose, parameters=new_parameters)
+        pdomain.set_name('pdomain')
+        
+        if myid == 0 and verbose : print 'LOADING IN PARALLEL DOMAIN'
+        sdomain = sequential_distribute_load(filename='odomain', verbose = verbose)
+        sdomain.set_name('sdomain')
+        
+
+        assert domain.get_datadir() == pdomain.get_datadir()
+        assert domain.get_store() == pdomain.get_store()
+        assert domain.get_store_centroids() == pdomain.get_store_centroids()
+        assert domain.smooth == pdomain.smooth
+        assert domain.reduction == pdomain.reduction
+        assert domain.minimum_storable_height == pdomain.minimum_storable_height
+        assert domain.get_flow_algorithm() == pdomain.get_flow_algorithm()
+        assert domain.get_minimum_allowed_height() == pdomain.get_minimum_allowed_height()
+        assert domain.geo_reference == pdomain.geo_reference
+        
+        assert domain.get_datadir() == sdomain.get_datadir()
+        assert domain.get_store() == sdomain.get_store()
+        assert domain.get_store_centroids() == sdomain.get_store_centroids()
+        assert domain.smooth == sdomain.smooth
+        assert domain.reduction == sdomain.reduction
+        assert domain.minimum_storable_height == sdomain.minimum_storable_height
+        assert domain.get_flow_algorithm() == sdomain.get_flow_algorithm()
+        assert domain.get_minimum_allowed_height() == sdomain.get_minimum_allowed_height()
+        assert domain.geo_reference == sdomain.geo_reference
+        
+
+
+    
+
+# Test an nprocs-way run of the shallow water equations
+# against the sequential code.
+
+class Test_parallel_sw_flow(unittest.TestCase):
+    def test_parallel_sw_flow(self):
+        if verbose : print "Expect this test to fail if not run from the parallel directory."
+
+        abs_script_name = os.path.abspath(__file__)
+        cmd = "mpirun -np %d python %s" % (nprocs, abs_script_name)
+        result = os.system(cmd)
+        
+        assert_(result == 0)
+
+# Because we are doing assertions outside of the TestCase class
+# the PyUnit defined assert_ function can't be used.
+def assert_(condition, msg="Assertion Failed"):
+    if condition == False:
+        #pypar.finalize()
+        raise AssertionError, msg
+
+if __name__=="__main__":
+    if numprocs == 1: 
+        runner = unittest.TextTestRunner()
+        suite = unittest.makeSuite(Test_parallel_sw_flow, 'test')
+        runner.run(suite)
+    else:
+
+
+        
+        #------------------------------------------
+        # Run the codel and compare sequential
+        # results at 4 gauge stations
+        #------------------------------------------
+        if myid ==0 and verbose: print 'PARALLEL START'
+
+        run_simulation(parallel=True, verbose=verbose)
+        
+        finalize()
+
+
Index: trunk/anuga_core/anuga/parallel/tests/test_sequential_dist_sw_flow.py
===================================================================
--- trunk/anuga_core/anuga/parallel/tests/test_sequential_dist_sw_flow.py	(revision 9732)
+++ trunk/anuga_core/anuga/parallel/tests/test_sequential_dist_sw_flow.py	(revision 9737)
@@ -41,5 +41,5 @@
 #--------------------------------------------------------------------------
 yieldstep = 0.25
-finaltime = 3.0
+finaltime = 1.0
 nprocs = 4
 N = 29
@@ -149,5 +149,5 @@
         if verbose:
             
-            order = 0
+            order = 2
             print 'PDOMAIN CENTROID VALUES'
             print num.linalg.norm(odomain_c.x-pdomain_c.x,ord=order)
