Index: /development/momentum_sink/create_buildings.py
===================================================================
--- /development/momentum_sink/create_buildings.py	(revision 2340)
+++ /development/momentum_sink/create_buildings.py	(revision 2341)
@@ -21,24 +21,30 @@
     #W = WidtH/8
     #L = W
-    outer_polygon = [[0,0],[WidtH,0],[WidtH,WidtH],[0,WidtH]]
+    outer_polygon = [[0,0],[2*WidtH,0],[2*WidtH,WidtH],[0,WidtH]]
     print outer_polygon
     m.add_region_from_polygon(outer_polygon, tags={'wall':[0,1,2], 'wave':[3]})
 
     # inner polygons => building boundaries
-    depth = 15
-    wh = depth/2 # depth of building side to oncoming wave
-    breadth = 22
-    lh = breadth/2 # breadth of building
+    depth = 15 # depth of building side to oncoming wave
+    wh = depth/2 
+    breadth = 15 # breadth of building
+    lh = breadth/2 
     print "building footprint"
     print depth * breadth , "m^2"
+    block = 625
+    BL = block**0.5
+    print BL
     #[12.5,37.5,62.5,87.5,112.5,137.5,162.5,187.5]
-    
-    for W in [12.5,37.5,62.5,87.5,112.5,137.5,162.5,187.5]:
-        for L in [12.5,37.5,62.5,87.5,112.5,137.5,162.5,187.5]:
-            polygon = [[W-wh,L-lh],[W+wh,L-lh],[W+wh,L+lh],[W-wh,L+lh]]
+    D = WidtH/2 + BL/2
+    B = BL/2
+    for D in [112.5,137.5,162.5,187.5]:
+        for B in [12.5,37.5,62.5,87.5,112.5,137.5,162.5,187.5]:
+            polygon = [[D-wh,B-lh],[D+wh,B-lh],[D+wh,B+lh],[D-wh,B+lh]]
             m.add_hole_from_polygon(polygon, tags={'wall':[0,1,2,3]})# Adds holes with reflective boundaries.        
             #print polygon
+            
+            print B
 
-    m.add_circle([20,70], 5, hole=True, tag='wall')
+        print D
 
     m.generate_mesh(maximum_triangle_area=maximum_triangle_area)
Index: /development/momentum_sink/friction_block.py
===================================================================
--- /development/momentum_sink/friction_block.py	(revision 2341)
+++ /development/momentum_sink/friction_block.py	(revision 2341)
@@ -0,0 +1,65 @@
+
+
+
+# add inundation dir to your pythonpath
+from pmesh.mesh import Mesh
+from coordinate_transforms.geo_reference import Geo_reference
+
+
+def create_mesh(maximum_triangle_area,
+                mesh_file=None,
+                triangles_in_name = False):
+    """
+    triangles_in_name, if True is used to append the number of
+    triangles in the mesh to the mesh file name.
+    """
+    # create a mesh instance of class Mesh
+    m = Mesh()
+
+    # Boundary of problem
+    WidtH = 202 # width of boudary in metres
+    #W = WidtH/8
+    #L = W
+    #outer_polygon = [[0,0],[2*WidtH,0],[2*WidtH,WidtH],[0,WidtH]]
+    #m.add_region_from_polygon(outer_polygon, tags={'wall':[0,1,2], 'wave':[3]})
+
+    #domain.set_region(Set_region('mound', 'elevation', 100, location='unique vertices'))
+
+    #Boundary
+    dict = {}
+    dict['points'] = [[0,0],[0.5*WidtH,0],[1.5*WidtH,0],[2*WidtH,0],[2*WidtH,WidtH] \
+                      ,[1.5*WidtH,WidtH],[0.5*WidtH,WidtH],[0,WidtH]]
+    
+    dict['segments'] = [[0,1], [1,2], [2,3], [3,4],
+                        [4,5], [5,6], [6,7], [7,0],[1,6],[2,5]] # the outer border
+    dict['segment_tags'] = ['wall',
+                            'wall',
+                            'wall',                           
+                            'wall',
+                            'wall',
+                            'wall',
+                            'wall',
+                            'wave',
+                            '',                            
+                            '']
+    m.addVertsSegs(dict)
+
+    medium = m.add_region(0.51*WidtH,0.1)
+    medium.setTag('mound')
+    
+    m.generate_mesh(maximum_triangle_area=maximum_triangle_area)
+    triangle_count = m.get_triangle_count()
+    
+    if mesh_file is None:    
+        return m, triangle_count
+    else:
+        if triangles_in_name is True:
+            mesh_file = mesh_file[:-4] + '_' + str(triangle_count) \
+                        + mesh_file[-4:]
+        m.export_mesh_file(mesh_file)
+        return mesh_file, triangle_count
+
+#-------------------------------------------------------------
+if __name__ == "__main__":
+    _, triangle_count = create_mesh(10,mesh_file="test.tsh")
+    print "triangle_count",triangle_count 
Index: /development/momentum_sink/run_buildings.py
===================================================================
--- /development/momentum_sink/run_buildings.py	(revision 2340)
+++ /development/momentum_sink/run_buildings.py	(revision 2341)
@@ -16,4 +16,5 @@
 
 from create_buildings import create_mesh
+#from building_generator import create_mesh
 
 from pmesh.mesh import importMeshFromFile
@@ -24,5 +25,5 @@
 t0 = time.time()
 
-meshname, triagle_count = cache(create_mesh,(100),
+meshname, triagle_count = cache(create_mesh,(10),
                                 {'mesh_file':meshname,
                                  'triangles_in_name':True}
@@ -69,5 +70,5 @@
 
 domain.set_boundary( {'wall': Br,'wave': Bd, 'back': Bt, 'exterior':Bd} ) 
-
+domain.set_region(Set_region('mound', 'friction', 3, location='unique vertices'))
 #Evolve
 t0 = time.time()
Index: /development/momentum_sink/run_friction.py
===================================================================
--- /development/momentum_sink/run_friction.py	(revision 2341)
+++ /development/momentum_sink/run_friction.py	(revision 2341)
@@ -0,0 +1,80 @@
+
+#Convention for strings representing files
+# #_file has the extention
+#           #name does not have the extension
+
+import time
+
+import project
+
+from pyvolution.pmesh2domain import pmesh_to_domain_instance 
+from caching import cache
+from pyvolution.shallow_water import Domain, Reflective_boundary,\
+     File_boundary, Dirichlet_boundary, Time_boundary, Transmissive_boundary,\
+     Set_region
+from pyvolution.least_squares import fit_to_mesh_file, DEFAULT_ALPHA 
+
+
+from friction_block import create_mesh
+#from building_generator import create_mesh
+
+from pmesh.mesh import importMeshFromFile
+
+meshname = project.meshname
+outputname = project.outputname
+
+t0 = time.time()
+
+meshname, triagle_count = cache(create_mesh,(100),
+                                {'mesh_file':meshname,
+                                 'triangles_in_name':True}
+                                ,dependencies = ['friction_block.py']
+                                #,evaluate = True      
+                                )
+#meshname = 'build.tsh'
+#outputname = outputname[:-4] + '_' + str(triagle_count) + outputname[-4:]
+
+print 'Initialising the mesh took %.2f seconds' %(time.time()-t0)  
+
+
+#meshname = importMeshFromFile('build.tsh')
+
+#Setup domain
+domain = cache(pmesh_to_domain_instance, (meshname, Domain),
+               dependencies = [meshname]                    
+               ,verbose = False
+               )               
+
+
+domain.set_name(project.basename + '_%d' %triagle_count)
+domain.set_datadir(project.outputdir)
+domain.store = True
+domain.quantities_to_be_stored = ['stage']
+
+print 'Number of triangles = ', len(domain)
+print 'The extent is ', domain.get_extent()
+
+#Setup Initial Conditions
+domain.set_quantity('friction', 0)
+domain.set_quantity('stage', 0)
+domain.set_region(Set_region('mound', 'friction', 700, location='unique vertices'))
+#Setup Boundary Conditions
+print domain.get_boundary_tags()
+
+domain.starttime = 0  #Obtained from MOST
+
+Br = Reflective_boundary(domain)
+Bt = Transmissive_boundary(domain)
+Bd = Dirichlet_boundary([6,0,0])
+Bw = Time_boundary(domain=domain,
+                   f=lambda t: [(60<t<660)*4, 0, 0])
+
+domain.set_boundary( {'wall': Br,'wave': Bd, 'back': Bt, 'exterior':Bd} ) 
+
+#Evolve
+t0 = time.time()
+
+for t in domain.evolve(yieldstep = 1, finaltime = 40):
+    domain.write_time()      
+
+print 'That took %.2f seconds' %(time.time()-t0)
