source: anuga_validation/automated_validation_tests/okushiri_tank_validation/run_okushiri.py @ 7795

Last change on this file since 7795 was 7795, checked in by hudson, 12 years ago

Adapted validation tests to use new API.

File size: 2.7 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
21"""
22
23# Module imports
24import anuga
25
26import project
27
28def main(elevation_in_mesh=False):
29    #-------------------------
30    # Create Domain from mesh
31    #-------------------------
32    domain = anuga.Domain(project.mesh_filename, use_cache=False, verbose=True)
33    print domain.statistics()
34
35
36    #-------------------------
37    # Initial Conditions
38    #-------------------------
39    domain.set_quantity('friction', 0.0)
40    domain.set_quantity('stage', 0.0)
41    if elevation_in_mesh is False:
42        domain.set_quantity('elevation',
43                            filename=project.bathymetry_filename,
44                            alpha=0.02,                   
45                            verbose=True,
46                            use_cache=False)
47
48
49    #-------------------------
50    # Set simulation parameters
51    #-------------------------
52    domain.set_name(project.output_filename)  # Name of output sww file
53    domain.set_default_order(2)               # Apply second order scheme
54    domain.set_minimum_storable_height(0.001) # Don't store w < 0.001m
55    domain.set_quantities_to_be_monitored('stage')
56
57    #-------------------------
58    # Boundary Conditions
59    #-------------------------
60
61    # Create boundary function from timeseries provided in file
62    function = anuga.file_function(project.boundary_filename,
63                             domain, verbose=True)
64
65    # Create and assign boundary objects
66    Bts = anuga.Transmissive_momentum_set_stage_boundary(domain, function)
67    Br = anuga.Reflective_boundary(domain)
68    domain.set_boundary({'wave': Bts, 'wall': Br})
69
70
71    #-------------------------
72    # Evolve through time
73    #-------------------------
74    import time
75    t0 = time.time()
76
77    for t in domain.evolve(yieldstep = 0.05, finaltime = 22.5):
78        domain.write_time()
79        print domain.quantity_statistics(precision='%.12f')
80
81    print 'That took %.2f seconds' %(time.time()-t0)
82
83#-------------------------------------------------------------
84if __name__ == "__main__":
85    main()
Note: See TracBrowser for help on using the repository browser.