source: trunk/anuga_validation/okushiri_2005/run_okushiri_parallel.py @ 8831

Last change on this file since 8831 was 7623, checked in by ole, 15 years ago

Comment on parallel usage and added reporting of which nodes processes are using

File size: 3.8 KB
Line 
1"""Validation of the AnuGA implementation of the shallow water wave equation.
2
3This script sets up Okushiri Island benchmark as published at the
4
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/
10
11
12The validation data was downloaded and made available in this directory
13for convenience but the original data is available at
14http://www.cee.cornell.edu/longwave/index.cfm?page=benchmark&problem=2
15where a detailed description of the problem is also available.
16
17
18Run create_okushiri.py to process the boundary condition and build a the
19mesh before running this script.
20
21To run on e.g. 8 processors
22mpirun -machinefile ~/.machines_tornado -np 8 python run_okushiri_parallel.py
23
24where the machine file has the format
25
26compute-0-19 cpu=4
27compute-0-18 cpu=4
28compute-0-17 cpu=4
29compute-0-16 cpu=4
30compute-0-15 cpu=4
31compute-0-14 cpu=4
32compute-0-13 cpu=4
33compute-0-12 cpu=4
34compute-0-11 cpu=4
35compute-0-10 cpu=4
36compute-0-9 cpu=4
37compute-0-8 cpu=4
38compute-0-7 cpu=4
39compute-0-6 cpu=4
40compute-0-5 cpu=4
41compute-0-4 cpu=4
42compute-0-3 cpu=4
43compute-0-2 cpu=4
44compute-0-1 cpu=4
45compute-0-0 cpu=4
46tornado cpu=4
47
48See mpirun manual for more details
49"""
50
51# To know quickly if pypar can be imported
52import imp
53print " imp.find_module('pypar')", imp.find_module('pypar')
54import  pypar
55
56# Module imports
57from anuga.shallow_water import Domain
58from anuga.shallow_water import Reflective_boundary
59from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
60from anuga.abstract_2d_finite_volumes.util import file_function
61
62from anuga_parallel.parallel_api import myid, numprocs, distribute, processor_name   
63
64import project
65
66print 'Pypar running process %d of %d on node "%s"' % (myid, numprocs, processor_name)
67
68use_cache = True
69#-------------------------
70# Create Domain from mesh
71# on processor 0
72#-------------------------
73if myid == 0 :
74    domain = Domain(project.mesh_filename, use_cache=use_cache, verbose=True)
75    print domain.statistics()
76
77    #-------------------------
78    # Initial Conditions
79    # At present need to do the
80    # fitting of the bathymetry
81    # on a global domain, ie before
82    # distributing the domain
83    #-------------------------
84    domain.set_quantity('friction', 0.0)
85    domain.set_quantity('stage', 0.0)
86    domain.set_quantity('elevation',
87                        filename=project.bathymetry_filename,
88                        alpha=0.02,                   
89                        verbose=True,
90                        use_cache=use_cache)
91else:
92    domain = None
93
94#-------------------------
95# Distribute domain if run in parallel
96#-------------------------
97if numprocs > 1:
98    domain = distribute(domain)
99
100
101#-------------------------
102# Set simulation parameters
103#-------------------------
104domain.set_name(project.output_filename)  # Name of output sww file
105domain.set_default_order(2)               # Apply second order scheme
106domain.set_all_limiters(0.9)              # Max second order scheme (old lim)
107domain.set_minimum_storable_height(0.001) # Don't store w < 0.001m
108domain.set_maximum_allowed_speed(0.1)     # Allow a little runoff (0.1 is OK)
109
110
111#-------------------------
112# Boundary Conditions
113#-------------------------
114
115# Create boundary function from timeseries provided in file
116function = file_function(project.boundary_filename,
117                         domain, verbose=True)
118
119# Create and assign boundary objects
120Bts = Transmissive_Momentum_Set_Stage_boundary(domain, function)
121Br = Reflective_boundary(domain)
122domain.set_boundary({'wave': Bts, 'wall': Br})
123
124#-------------------------
125# Evolve through time
126#-------------------------
127import time
128t0 = time.time()
129
130for t in domain.evolve(yieldstep = 0.05, finaltime = 22.5):
131    if myid == 0 :
132        domain.write_time()
133
134
135print 'That took %.2f seconds' %(time.time()-t0)
Note: See TracBrowser for help on using the repository browser.