[4216] | 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 |
---|
[4252] | 50 | bathymetry_filename='Benchmark_2_Bathymetry_very_thin.pts' |
---|
[4216] | 51 | print 'Starting domain.set_quantity. Loading ', bathymetry_filename |
---|
[4253] | 52 | s = "domain.set_quantity('elevation',filename=bathymetry_filename,alpha=0.02,verbose=True,use_cache=True)" |
---|
[4216] | 53 | |
---|
| 54 | |
---|
[4237] | 55 | import profile, pstats |
---|
| 56 | FN = 'profile.dat' |
---|
[4216] | 57 | |
---|
[4237] | 58 | profile.run(s, FN) |
---|
[4216] | 59 | |
---|
[4237] | 60 | print 'Set_quantity elevation took %.2f seconds' %(time.time()-t0) |
---|
[4216] | 61 | |
---|
[4237] | 62 | S = pstats.Stats(FN) |
---|
| 63 | #S.sort_stats('time').print_stats(20) |
---|
[4253] | 64 | s = S.sort_stats('cumulative').print_stats(60) |
---|
[4216] | 65 | |
---|
[4253] | 66 | #print s |
---|