# source:anuga_validation/automated_validation_tests/okushiri_tank_validation/run_okushiri.py@3708

Last change on this file since 3708 was 3708, checked in by ole, 17 years ago

Copied (using 'svn cp') okushiri validation files to automated_validation_tests with the intent of turning them into a unit test.

File size: 3.0 KB
Line
1"""Validation of the AnuGA implementation of the shallow water wave equation.
2
3This script sets up LWRU2 benchmark with initial condition stated
4
6
7http://www.cee.cornell.edu/longwave/index.cfm?page=benchmark&problem=2
8
9Depth at western boundary is d = 13.5 cm
10"""
11
12# Module imports
13from Numeric import array, zeros, Float, allclose
14
15from anuga.shallow_water import Domain
16from anuga.shallow_water import Reflective_boundary
17from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
18from anuga.abstract_2d_finite_volumes.util import file_function
19
20import project
21
22
23#-------------------------
24# Create Domain
25#-------------------------
26
27use_variable_mesh = True #Use large variable mesh generated by create_mesh.py
28#use_variable_mesh = False #Use small structured mesh for speed
29
30if use_variable_mesh is True:
31    print 'Creating domain from', project.mesh_filename
32
33    domain = Domain(project.mesh_filename, use_cache=True, verbose=True)
34else:
35    print 'Creating regular from regular mesh'
36    N = 150
37    points, vertices, boundary = rectangular_cross(N, N/5*3,
38                                                   len1=5.448, len2=3.402)
39    domain = Domain(points, vertices, boundary)
40
41domain.set_name('lwru2')
42domain.set_default_order(2)
43domain.set_minimum_storable_height(0.001)
44domain.check_integrity()
45print domain.statistics()
46
47
48#-------------------------
49# Initial Conditions
50#-------------------------
51domain.set_quantity('friction', 0.0)
52domain.set_quantity('stage', 0.0)
53domain.set_quantity('elevation',
54                    filename=project.bathymetry_filename[:-4] + '.pts',
55                    alpha=0.02,
56                    verbose=True,
57                    use_cache=True)
58
59#-------------------------
60# Boundary Conditions
61#-------------------------
62Br = Reflective_boundary(domain)
63
64function = file_function(project.boundary_filename[:-4] + '.tms',
65                         domain,
66                         verbose=True)
67
68Bts = Transmissive_Momentum_Set_Stage_boundary(domain, function)
69
70if use_variable_mesh is True:
71    domain.set_boundary({'wave': Bts, 'wall': Br})
72else:
73    domain.set_boundary({'left': Bts, 'right': Br, 'bottom': Br, 'top': Br})
74
75
76#-------------------------
77# Evolve through time
78#-------------------------
79import time
80t0 = time.time()
81
82w_max = 0
83for t in domain.evolve(yieldstep = 0.05, finaltime = 22.5):
84    domain.write_time()
85
86    w = domain.get_maximum_inundation_elevation()
87    x, y = domain.get_maximum_inundation_location()
88    print '  Coastline elevation = %.2f at (x,y)=(%.2f, %.2f)' %(w, x, y)
89    print
90
91    if w > w_max:
92        w_max = w
93        x_max = x
94        y_max = y
95
96
97print '**********************************************'
98print 'Max coastline elevation = %.2f at (%.2f, %.2f)' %(w_max, x_max, y_max)
99print '**********************************************'
100
101
102
103print 'That took %.2f seconds' %(time.time()-t0)
Note: See TracBrowser for help on using the repository browser.