1 | """Example of shallow water wave equation. |
---|
2 | |
---|
3 | Flat bed with constant wind stress |
---|
4 | """ |
---|
5 | |
---|
6 | ###################### |
---|
7 | # Module imports |
---|
8 | from mesh_factory import rectangular |
---|
9 | from shallow_water import Domain, Reflective_boundary, Constant_height, Wind_stress |
---|
10 | |
---|
11 | #Create basic mesh (100m x 100m) |
---|
12 | N = 100 |
---|
13 | len = 100 |
---|
14 | points, vertices, boundary = rectangular(N, N, len, len) |
---|
15 | |
---|
16 | #Create shallow water domain |
---|
17 | domain = Domain(points, vertices, boundary) |
---|
18 | domain.default_order = 2 |
---|
19 | domain.store = True |
---|
20 | domain.set_name('wind_laminar') |
---|
21 | |
---|
22 | #Set initial conditions |
---|
23 | domain.set_quantity('elevation', 0.0) |
---|
24 | domain.set_quantity('level', 1.0) |
---|
25 | domain.set_quantity('friction', 0.03) |
---|
26 | |
---|
27 | #Constant (quite extreme :-) windfield: 9000 m/s, bearing 120 degrees |
---|
28 | domain.forcing_terms.append( Wind_stress(s=9000, phi=120) ) |
---|
29 | |
---|
30 | ###################### |
---|
31 | # Boundary conditions |
---|
32 | Br = Reflective_boundary(domain) |
---|
33 | domain.set_boundary({'left': Br, 'right': Br, 'top': Br, 'bottom': Br}) |
---|
34 | |
---|
35 | ###################### |
---|
36 | #Evolution |
---|
37 | for t in domain.evolve(yieldstep = 0.5, finaltime = 1000): |
---|
38 | domain.write_time() |
---|
39 | |
---|
40 | print 'Done' |
---|
41 | |
---|