Line | |
---|
1 | """Example of shallow water wave equation. |
---|
2 | |
---|
3 | Generate slope |
---|
4 | |
---|
5 | """ |
---|
6 | |
---|
7 | ###################### |
---|
8 | # Module imports |
---|
9 | # |
---|
10 | from mesh_factory import rectangular |
---|
11 | from shallow_water import Domain, Reflective_boundary, Dirichlet_boundary,\ |
---|
12 | Constant_height, wind_Stress |
---|
13 | from Numeric import array |
---|
14 | |
---|
15 | #Create basic mesh |
---|
16 | N = 150 |
---|
17 | points, vertices, boundary = rectangular(N, N, 1000, 1000) |
---|
18 | |
---|
19 | #Create shallow water domain |
---|
20 | domain = Domain(points, vertices, boundary) |
---|
21 | domain.smooth = True |
---|
22 | domain.visualise = False |
---|
23 | domain.store = True |
---|
24 | domain.default_order=1 |
---|
25 | |
---|
26 | #Set driving forces |
---|
27 | manning = 0.07 |
---|
28 | manning = 0.0 |
---|
29 | inflow_level = 10.0 |
---|
30 | domain.set_quantity('friction', manning) |
---|
31 | |
---|
32 | |
---|
33 | |
---|
34 | ###################### |
---|
35 | # Boundary conditions |
---|
36 | Br = Reflective_boundary(domain) |
---|
37 | Bd = Dirichlet_boundary([inflow_level,0.,0.]) |
---|
38 | |
---|
39 | domain.set_boundary({'left': Bd, 'right': Br, 'top': Br, 'bottom': Br}) |
---|
40 | domain.check_integrity() |
---|
41 | |
---|
42 | |
---|
43 | ###################### |
---|
44 | #Evolution |
---|
45 | for t in domain.evolve(yieldstep = 10, finaltime = 500): |
---|
46 | domain.write_time() |
---|
47 | |
---|
48 | print 'Done' |
---|
49 | |
---|
Note: See
TracBrowser
for help on using the repository browser.