Index: /development/dam_2006/create_mesh.py
===================================================================
--- /development/dam_2006/create_mesh.py	(revision 3125)
+++ /development/dam_2006/create_mesh.py	(revision 3125)
@@ -0,0 +1,69 @@
+"""Create mesh for lwru2 validation of the Oshiri island tsunami
+"""
+
+#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+# Assume that the root AnuGA dir is included in your pythonpath
+#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+from pmesh.mesh import *
+from coordinate_transforms.geo_reference import Geo_reference
+
+import project
+def generate():
+    #Basic geometry
+    
+    xleft   = -5.4
+    xright  = .4
+    ybottom = 0
+    ytop    = 0.4
+    xdam = 0.0 
+
+    #Outline 
+    point_sw = [xleft, ybottom]
+    point_se = [xright, ybottom]
+    point_nw = [xleft, ytop]    
+    point_ne = [xright, ytop]
+
+    # Dam seperation (left)
+    point_dam_top = [xdam, ytop]
+    point_dam_bottom = [xdam, ybottom]
+
+
+    m = Mesh()
+
+    #Boundary
+    # FIXME (DSG-DSG): Update this to use new interface.
+    dict = {}
+    dict['points'] = [point_se,   #se
+                      point_ne,
+                      point_dam_top,
+                      point_nw,
+                      point_sw,
+                      point_dam_bottom]
+
+    dict['segments'] = [[0,1], [1,2], [2,3], [3,4],
+                        [4,5], [5,0],  #The outer border
+                        [2,5]]         #Separator
+    
+    dict['segment_tags'] = ['wall',
+                            'wall',
+                            'wall',
+                            'wave',
+                            'wall',
+                            'wall',
+                            '']           #Interior
+
+        
+    m.addVertsSegs(dict)
+
+    dam = m.add_region(0.2,0.2)
+    dam.setTag("dam")
+    #m.generateMesh('pzq28.0za0.01a')
+    m.generateMesh('pzq28.0za0.0001a')
+
+    m.export_mesh_file(project.mesh_filename)
+    print "mesh created"
+
+#-------------------------------------------------------------
+if __name__ == "__main__":
+    pass
Index: /development/dam_2006/project.py
===================================================================
--- /development/dam_2006/project.py	(revision 3125)
+++ /development/dam_2006/project.py	(revision 3125)
@@ -0,0 +1,67 @@
+"""Common filenames and locations for topographic data, meshes and outputs.
+Also includes origin for slump scenario.
+"""
+
+from os import sep, environ, getenv, getcwd
+import sys
+from time import localtime, strftime
+from os import mkdir, access, F_OK
+                
+#Making assumptions about the location of scenario data
+scenario_dir_name = 'dam_2006'
+
+#swollen/ all data output
+basename = 'source'
+
+if sys.platform == 'win32':
+    home = environ['INUNDATIONHOME']     #Sandpit's parent dir
+else:    
+    home = getenv('INUNDATIONHOME', sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'risk_assessment_methods_project'+sep+'inundation')     
+
+#Derive subdirectories and filenames
+time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir
+scenariodir =  home+sep+scenario_dir_name
+outputdir = scenariodir+sep+'output'+sep
+outputtimedir = outputdir+time+sep
+meshdir = scenariodir+sep+'meshes'+sep
+datadir = scenariodir+sep+'topographies'+sep
+gaugedir = scenariodir+sep+'gauges'+sep
+polygondir = scenariodir+sep+'polygons'+sep
+boundarydir = scenariodir+sep+'boundaries'+sep
+#output dir without time
+outputdir = scenariodir+sep+'output'+sep
+tidedir = scenariodir+sep+'tide_data'+sep
+
+gauge_filename = gaugedir + 'gauge_location_onslow.csv'
+#buildings_filename = gaugedir + 'onslow_res.csv'
+#community_filename = gaugedir + 'CHINS_v2.csv'
+#community_scenario = gaugedir + 'community_onslow.csv'
+#gaugetimeseries = gaugedir + 'onslow'
+
+
+# creates copy of output dir structure, if it doesn't exist
+if not access(scenariodir,F_OK):
+    mkdir (scenariodir)
+
+if not access(meshdir,F_OK):
+    mkdir (meshdir)
+
+if not access(outputdir,F_OK):
+    mkdir (outputdir)
+        
+if not access(outputtimedir,F_OK):
+    mkdir (outputtimedir)
+
+# boundary source data
+#MOST_dir = 'f:'+sep+'3'+sep+'ehn'+sep+'users'+sep+'davidb'+sep+'tsunami'+sep+'WA_project'+sep+'SU-AU_90'+sep+'most_2'+sep+'detailed'+sep
+
+codedir = getcwd()+sep
+                                
+codedirname = codedir + 'project.py'
+
+meshname = meshdir + basename
+
+outputname = outputtimedir + basename  #Used by post processing
+
+mesh_filename = meshname+'.msh'
+
Index: /development/dam_2006/run_dam.py
===================================================================
--- /development/dam_2006/run_dam.py	(revision 3125)
+++ /development/dam_2006/run_dam.py	(revision 3125)
@@ -0,0 +1,117 @@
+"""Script for running a tsunami inundation scenario for Onslow, WA, Australia.
+
+Source data such as elevation and boundary data is assumed to be available in
+directories specified by project.py
+The output sww file is stored in project.outputtimedir 
+
+The scenario is defined by a triangular mesh created from project.polygon,
+the elevation data and a simulated submarine landslide.
+
+Ole Nielsen and Duncan Gray, GA - 2005 and Nick Bartzis, GA - 2006
+"""
+
+
+#-------------------------------------------------------------------------------# Import necessary modules
+#-------------------------------------------------------------------------------
+
+# Standard modules
+import time
+import sys
+from shutil import copy
+from os import mkdir, access, F_OK
+
+# Related major packages
+from pyvolution.shallow_water import Domain, Reflective_boundary, \
+                            Dirichlet_boundary, Time_boundary, File_boundary
+from pyvolution.util import Screen_Catcher
+from pyvolution.region import Set_region 
+
+# Application specific imports
+import project                 # Definition of file names and polygons
+import create_mesh
+
+copy (project.codedirname, project.outputtimedir + 'project.py')
+copy (project.codedir + 'run_dam.py', project.outputtimedir + 'run_dam.py')
+copy (project.codedir + 'create_mesh.py', project.outputtimedir + 'create_mesh.py')
+print'output dir', project.outputtimedir
+
+#normal screen output is stored in 
+screen_output_name = project.outputtimedir + "screen_output.txt"
+screen_error_name = project.outputtimedir + "screen_error.txt"
+
+#used to catch screen output to file
+#sys.stdout = Screen_Catcher(screen_output_name)
+#sys.stderr = Screen_Catcher(screen_error_name)
+
+'''
+copied_files = False
+
+# files to be used
+files_used = [onshore_dem_name, offshore_points,]
+
+if sys.platform != 'win32':    
+    copied_files = True
+    for name in file_list:
+        copy(name, )
+''' 
+#-------------------------------------------------------------------------------                                 
+# Create the triangular mesh
+#-------------------------------------------------------------------------------
+#from pmesh.pmesh import mesh
+
+create_mesh.generate() # this creates the mesh
+
+#-------------------------------------------------------------------------------                                 
+# Setup computational domain
+#-------------------------------------------------------------------------------                                 
+domain = Domain(project.mesh_filename, use_cache = False, verbose = True)
+   
+
+print 'Number of triangles = ', len(domain)
+print 'The extent is ', domain.get_extent()
+print domain.statistics()
+
+domain.set_name(project.basename)
+domain.set_datadir(project.outputtimedir)
+domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+
+#-------------------------------------------------------------------------------                                 
+# Setup initial conditions
+#-------------------------------------------------------------------------------
+
+tide = 0.0
+
+def elevation_tilt(x, y):
+    return -x*0.15
+        
+domain.set_quantity('stage', elevation_tilt)
+domain.set_quantity('friction', 0.03) 
+domain.set_quantity('elevation',elevation_tilt)
+
+print 'Available boundary tags', domain.get_boundary_tags()
+
+domain.set_region(Set_region('dam','stage',0.4,location = 'unique vertices'))
+
+Br = Reflective_boundary(domain)
+Bd = Dirichlet_boundary([tide,0,0])
+
+
+# 7 min square wave starting at 0 min, 6m high
+Bw = Time_boundary(domain = domain,
+                   f=lambda t: [(0<t<480)*1, 0, 0])
+
+#domain.set_boundary( {'wall': Br, 'wave': Bw} )
+domain.set_boundary( {'wall': Br, 'wave': Br} )
+
+#-------------------------------------------------------------------------------                                 
+# Evolve system through time
+#-------------------------------------------------------------------------------
+import time
+t0 = time.time()
+
+for t in domain.evolve(yieldstep = 0.02, finaltime = 10):
+    domain.write_time()
+    
+print 'That took %.2f seconds' %(time.time()-t0)
+
+print 'finished'
