1 | """Validation of the AnuGA implementation of the shallow water wave equation. |
---|
2 | |
---|
3 | This script sets up Okushiri Island benchmark as published at the |
---|
4 | |
---|
5 | THE THIRD INTERNATIONAL WORKSHOP ON LONG-WAVE RUNUP MODELS |
---|
6 | June 17-18 2004 |
---|
7 | Wrigley Marine Science Center |
---|
8 | Catalina Island, California |
---|
9 | http://www.cee.cornell.edu/longwave/ |
---|
10 | |
---|
11 | |
---|
12 | The validation data was downloaded and made available in this directory |
---|
13 | for convenience but the original data is available at |
---|
14 | http://www.cee.cornell.edu/longwave/index.cfm?page=benchmark&problem=2 |
---|
15 | where a detailed description of the problem is also available. |
---|
16 | |
---|
17 | |
---|
18 | Run create_okushiri.py to process the boundary condition and build a the |
---|
19 | mesh before running this script. |
---|
20 | |
---|
21 | """ |
---|
22 | |
---|
23 | # Module imports |
---|
24 | from anuga.shallow_water import Domain |
---|
25 | from anuga.shallow_water import Reflective_boundary |
---|
26 | from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary |
---|
27 | from anuga.abstract_2d_finite_volumes.util import file_function |
---|
28 | |
---|
29 | from anuga_parallel.parallel_api import myid, numprocs, distribute |
---|
30 | |
---|
31 | import project |
---|
32 | |
---|
33 | |
---|
34 | #------------------------- |
---|
35 | # Create Domain from mesh |
---|
36 | #------------------------- |
---|
37 | domain = Domain(project.mesh_filename, use_cache=True, verbose=True) |
---|
38 | print domain.statistics() |
---|
39 | |
---|
40 | |
---|
41 | #------------------------- |
---|
42 | # Initial Conditions |
---|
43 | #------------------------- |
---|
44 | domain.set_quantity('friction', 0.0) |
---|
45 | domain.set_quantity('stage', 0.0) |
---|
46 | |
---|
47 | import time |
---|
48 | t0 = time.time() |
---|
49 | bathymetry_filename=project.bathymetry_filename |
---|
50 | bathymetry_filename='Benchmark_2_Bathymetry_very_thin.pts' |
---|
51 | print 'Starting domain.set_quantity. Loading ', bathymetry_filename |
---|
52 | s = "domain.set_quantity('elevation',filename=bathymetry_filename,alpha=0.02,verbose=True,use_cache=False)" |
---|
53 | |
---|
54 | |
---|
55 | import profile, pstats |
---|
56 | FN = 'profile.dat' |
---|
57 | |
---|
58 | profile.run(s, FN) |
---|
59 | |
---|
60 | print 'Set_quantity elevation took %.2f seconds' %(time.time()-t0) |
---|
61 | |
---|
62 | S = pstats.Stats(FN) |
---|
63 | #S.sort_stats('time').print_stats(20) |
---|
64 | s = S.sort_stats('cumulative').print_stats(30) |
---|
65 | |
---|
66 | print s |
---|