"""Script for running a tsunami inundation scenario for Cairns, QLD 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 directory named after the scenario, i.e slide or fixed_wave. The scenario is defined by a triangular mesh created from project.polygon, the elevation data and a tsunami wave generated by a submarine mass failure. Geoscience Australia, 2004-present """ #------------------------------------------------------------------------------ # Import necessary modules #------------------------------------------------------------------------------ # Standard modules import os import time import sys import liststore # Related major packages import anuga from anuga_parallel import distribute, myid from anuga.abstract_2d_finite_volumes.util import add_directories from anuga.utilities import system_tools, log home2 = os.getenv('INUNDATIONHOME') scenariodir2 = add_directories(home2, ["data", "mem_time_test", "triangles", "area"]) h = 'CAIRNS.msh' file_pathh = os.path.join(scenariodir2, h) store ='store.txt' file_path_store = os.path.join(scenariodir2, store) storen ='storen.txt' file_path_storen = os.path.join(scenariodir2, storen) storel = 'storel.txt' file_path_storel = os.path.join(scenariodir2, storel) storea = 'storea.txt' file_path_storea = os.path.join(scenariodir2, storea) f = open(file_path_storel,'r+') # SQRT extent this is set length = float(f.readline()) f.close() f = open(file_path_storea,'r+') #maxarea this is set area = float(f.readline()) f.close() system_tools.MemoryUpdate() #------------------------------------------------------------------------------ # Create the triangular mesh and domain based on # overall clipping polygon with a tagged # boundary and interior regions as defined in project.py #------------------------------------------------------------------------------ if myid == 0: domain = anuga.create_domain_from_regions([(0.0,0.0),(length,length),(0.0,length),(length,0.0)], boundary_tags={'top': [0], 'right': [1], 'bottom': [2], 'left': [3]}, maximum_triangle_area=area, mesh_filename=file_pathh #,interior_regions=INTERIORREGIONS#, #use_cache=True, #verbose=True) ) n = len(domain) else: domain = None domain = distribute(domain) #------------------------------------------------------------------------------ # Setup parameters of computational domain #------------------------------------------------------------------------------ domain.set_name('CAIRNS.sww') # Name of sww file domain.set_datadir(scenariodir2) # Store sww output here #------------------------------------------------------------------------------ # Setup initial conditions #------------------------------------------------------------------------------ def topography(x,y): return 0.0 tide = 100.0 friction = 0.0 domain.set_quantity('stage', tide) domain.set_quantity('friction', friction) domain.set_quantity('elevation',topography,alpha=0.1) #------------------------------------------------------------------------------ # Setup boundary conditions #------------------------------------------------------------------------------ Bi = anuga.Dirichlet_boundary([tide, 0, 0]) # inflow Bo = anuga.Dirichlet_boundary([-tide,0, 0]) # inflow Bs = anuga.Transmissive_stage_zero_momentum_boundary(domain) # Neutral boundary Br = anuga.Reflective_boundary(domain) #Bw = anuga.Time_boundary(domain=domain,function=lambda t: [(60