"""Script for running a tsunami inundation scenario for Flagstaff pt, Wollongong harbour, NSW, Australia. Source data such as elevation and boundary data is assumed to be available in directories specified by project.py The scenario is defined by a triangular mesh created from project.polygon, the elevation data and a hypothetical boundary condition. THIS IS THE SEQUENTIAL VERSION Ole Nielsen and Duncan Gray, GA - 2005, Nick Bartzis and Jane Sexton, GA - 2006 """ #------------------------------------------------------------------------------ # Import necessary modules #------------------------------------------------------------------------------ # Standard modules import os, sys, time from os import sep from os.path import dirname, basename from Numeric import zeros, Float # Related major packages from anuga.pyvolution.shallow_water import Domain from anuga.pyvolution.shallow_water import Dirichlet_boundary from anuga.pyvolution.shallow_water import Time_boundary from anuga.pyvolution.shallow_water import Reflective_boundary from anuga.pyvolution.data_manager import convert_dem_from_ascii2netcdf, dem2pts from anuga.pmesh.mesh_interface import create_mesh_from_regions from anuga.pmesh.mesh import importUngenerateFile, Segment # Application specific imports import project #------------------------------------------------------------------------------ # Preparation of topographic data # # Convert ASC 2 DEM 2 PTS using source data and store result in source data #------------------------------------------------------------------------------ max_area = project.base_resolution #-------------------------------------------------------------------------- # Create the triangular mesh based on overall clipping polygon with a # tagged boundary and interior regions defined in project.py along with # resolutions (maximal area of per triangle) for each polygon #-------------------------------------------------------------------------- print 'Generate mesh' mesh = create_mesh_from_regions(project.bounding_polygon, boundary_tags=project.boundary_tags, maximum_triangle_area=max_area, interior_regions=project.interior_regions) # Add buildings # This should bind to a Reflective boundary mesh.import_ungenerate_file(project.buildings_filename, tag='wall') # Generate and write mesh to file mesh.generate_mesh(maximum_triangle_area=max_area, verbose=True) mesh.export_mesh_file(project.mesh_filename) #-------------------------------------------------------------------------- # Setup computational domain #-------------------------------------------------------------------------- domain = Domain(project.mesh_filename, use_cache = False, verbose = True) print domain.statistics() domain.set_name(project.basename) domain.set_datadir(project.outputdir) #------------------------------------------------------------------------------ # Setup initial conditions #------------------------------------------------------------------------------ domain.set_quantity('stage', project.initial_sealevel) domain.set_quantity('friction', 0.03) domain.set_quantity('elevation', filename=project.demname + '.pts', use_cache=True, verbose=True) #------------------------------------------------------------------------------ # Setup boundary conditions #------------------------------------------------------------------------------ D = Dirichlet_boundary([project.initial_sealevel, 0, 0]) R = Reflective_boundary(domain) W = Time_boundary(domain = domain, f=lambda t: [project.initial_sealevel + (60