source: anuga_validation/okushiri_2005/run_okushiri_parallel.py @ 4299

Last change on this file since 4299 was 4299, checked in by duncan, 17 years ago

refinements

File size: 3.0 KB
RevLine 
[3640]1"""Validation of the AnuGA implementation of the shallow water wave equation.
2
[4022]3This script sets up Okushiri Island benchmark as published at the
[3640]4
[4022]5THE THIRD INTERNATIONAL WORKSHOP ON LONG-WAVE RUNUP MODELS
6June 17-18 2004
7Wrigley Marine Science Center
8Catalina Island, California
9http://www.cee.cornell.edu/longwave/
[3640]10
[4022]11
12The validation data was downloaded and made available in this directory
13for convenience but the original data is available at
[3640]14http://www.cee.cornell.edu/longwave/index.cfm?page=benchmark&problem=2
[4022]15where a detailed description of the problem is also available.
[3640]16
17
[4022]18Run create_okushiri.py to process the boundary condition and build a the
19mesh before running this script.
20
[3640]21"""
22
[4299]23# To know quickly if pypar can be imported
24import imp
25print " imp.find_module('pypar')", imp.find_module('pypar')
26import  pypar
27
[3640]28# Module imports
29from anuga.shallow_water import Domain
30from anuga.shallow_water import Reflective_boundary
31from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
32from anuga.abstract_2d_finite_volumes.util import file_function
33
[4299]34from anuga_parallel.parallel_api import myid, numprocs, distribute   
[3640]35
36import project
37
[4299]38use_cache = True
[3640]39#-------------------------
[4022]40# Create Domain from mesh
[3640]41#-------------------------
[4299]42domain = Domain(project.mesh_filename, use_cache=use_cache, verbose=True)
[4022]43print domain.statistics()
[3640]44
[4022]45
[3640]46#-------------------------
47# Initial Conditions
48#-------------------------
49domain.set_quantity('friction', 0.0)
50domain.set_quantity('stage', 0.0)
51domain.set_quantity('elevation',
[4022]52                    filename=project.bathymetry_filename,
53                    alpha=0.02,                   
54                    verbose=True,
[4299]55                    use_cache=use_cache)
[3640]56
57
58#-------------------------
[4022]59# Distribute domain if run in parallel
[3640]60#-------------------------
[4022]61if numprocs > 1:
62    domain = distribute(domain)
[3640]63
[3648]64
[4022]65#-------------------------
66# Set simulation parameters
67#-------------------------
68domain.set_name(project.output_filename)  # Name of output sww file
69domain.set_default_order(2)               # Apply second order scheme
70domain.set_all_limiters(0.9)              # Max second order scheme (old lim)
71domain.set_minimum_storable_height(0.001) # Don't store w < 0.001m
72domain.set_maximum_allowed_speed(0.1)     # Allow a little runoff (0.1 is OK)
[3829]73
74
[4022]75#-------------------------
76# Boundary Conditions
77#-------------------------
[3829]78
[4022]79# Create boundary function from timeseries provided in file
80function = file_function(project.boundary_filename,
81                         domain, verbose=True)
[3829]82
[4022]83# Create and assign boundary objects
[3645]84Bts = Transmissive_Momentum_Set_Stage_boundary(domain, function)
[4022]85Br = Reflective_boundary(domain)
86domain.set_boundary({'wave': Bts, 'wall': Br})
[3645]87
[3648]88
[3640]89#-------------------------
90# Evolve through time
91#-------------------------
92import time
93t0 = time.time()
94
95for t in domain.evolve(yieldstep = 0.05, finaltime = 22.5):
96    domain.write_time()
97
[4022]98print 'That took %.2f seconds' %(time.time()-t0)
Note: See TracBrowser for help on using the repository browser.