"""Validation of the AnuGA implementation of the shallow water wave equation. This script sets up Okushiri Island benchmark as published at the THE THIRD INTERNATIONAL WORKSHOP ON LONG-WAVE RUNUP MODELS June 17-18 2004 Wrigley Marine Science Center Catalina Island, California http://www.cee.cornell.edu/longwave/ The validation data was downloaded and made available in this directory for convenience but the original data is available at http://www.cee.cornell.edu/longwave/index.cfm?page=benchmark&problem=2 where a detailed description of the problem is also available. Run create_okushiri.py to process the boundary condition and build a the mesh before running this script. To run on e.g. 8 processors mpirun -machinefile ~/.machines_tornado -np 8 python run_okushiri_parallel.py where the machine file has the format compute-0-19 cpu=4 compute-0-18 cpu=4 compute-0-17 cpu=4 compute-0-16 cpu=4 compute-0-15 cpu=4 compute-0-14 cpu=4 compute-0-13 cpu=4 compute-0-12 cpu=4 compute-0-11 cpu=4 compute-0-10 cpu=4 compute-0-9 cpu=4 compute-0-8 cpu=4 compute-0-7 cpu=4 compute-0-6 cpu=4 compute-0-5 cpu=4 compute-0-4 cpu=4 compute-0-3 cpu=4 compute-0-2 cpu=4 compute-0-1 cpu=4 compute-0-0 cpu=4 tornado cpu=4 See mpirun manual for more details """ # To know quickly if pypar can be imported import imp print " imp.find_module('pypar')", imp.find_module('pypar') import pypar # Module imports from anuga.shallow_water import Domain from anuga.shallow_water import Reflective_boundary from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary from anuga.abstract_2d_finite_volumes.util import file_function from anuga_parallel.parallel_api import myid, numprocs, distribute, processor_name import project print 'Pypar running process %d of %d on node "%s"' % (myid, numprocs, processor_name) use_cache = True #------------------------- # Create Domain from mesh # on processor 0 #------------------------- if myid == 0 : domain = Domain(project.mesh_filename, use_cache=use_cache, verbose=True) print domain.statistics() #------------------------- # Initial Conditions # At present need to do the # fitting of the bathymetry # on a global domain, ie before # distributing the domain #------------------------- domain.set_quantity('friction', 0.0) domain.set_quantity('stage', 0.0) domain.set_quantity('elevation', filename=project.bathymetry_filename, alpha=0.02, verbose=True, use_cache=use_cache) else: domain = None #------------------------- # Distribute domain if run in parallel #------------------------- if numprocs > 1: domain = distribute(domain) #------------------------- # Set simulation parameters #------------------------- domain.set_name(project.output_filename) # Name of output sww file domain.set_default_order(2) # Apply second order scheme domain.set_all_limiters(0.9) # Max second order scheme (old lim) domain.set_minimum_storable_height(0.001) # Don't store w < 0.001m domain.set_maximum_allowed_speed(0.1) # Allow a little runoff (0.1 is OK) #------------------------- # Boundary Conditions #------------------------- # Create boundary function from timeseries provided in file function = file_function(project.boundary_filename, domain, verbose=True) # Create and assign boundary objects Bts = Transmissive_Momentum_Set_Stage_boundary(domain, function) Br = Reflective_boundary(domain) domain.set_boundary({'wave': Bts, 'wall': Br}) #------------------------- # Evolve through time #------------------------- import time t0 = time.time() for t in domain.evolve(yieldstep = 0.05, finaltime = 22.5): if myid == 0 : domain.write_time() print 'That took %.2f seconds' %(time.time()-t0)