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