1 | """Validation study of Merimbula lake using Pyvolution. |
---|
2 | Example of shallow water wave equation applied to |
---|
3 | Malpasset dam break simulation. |
---|
4 | |
---|
5 | Copyright 2004 |
---|
6 | Christopher Zoppou, Stephen Roberts |
---|
7 | Australian National University |
---|
8 | |
---|
9 | Specific methods pertaining to the 2D shallow water equation |
---|
10 | are imported from shallow_water |
---|
11 | for use with the generic finite volume framework |
---|
12 | |
---|
13 | Conserved quantities are h, uh and vh stored as elements 0, 1 and 2 in the |
---|
14 | numerical vector named conserved_quantities. |
---|
15 | |
---|
16 | Existence of file 'Malpasset_26000.tsh' is assumed. |
---|
17 | """ |
---|
18 | |
---|
19 | ############################### |
---|
20 | # Setup Path and import modules |
---|
21 | import sys |
---|
22 | from os import sep, path |
---|
23 | sys.path.append('..'+sep+'pyvolution') |
---|
24 | |
---|
25 | from shallow_water import Domain, Reflective_boundary, File_boundary,\ |
---|
26 | Dirichlet_boundary, Transmissive_boundary |
---|
27 | from pmesh2domain import pmesh_to_domain_instance |
---|
28 | |
---|
29 | ###################### |
---|
30 | # Domain |
---|
31 | filename = 'Malpasset_26000_merged.tsh' |
---|
32 | yieldstep = 1 |
---|
33 | finaltime = 1000 |
---|
34 | |
---|
35 | print 'Creating domain from', filename |
---|
36 | domain = pmesh_to_domain_instance(filename, Domain) |
---|
37 | print "Number of triangles = ", len(domain) |
---|
38 | |
---|
39 | domain.default_order = 1 |
---|
40 | domain.smooth = True |
---|
41 | |
---|
42 | #------------------------------ |
---|
43 | # Boundary Conditions |
---|
44 | tags = {} |
---|
45 | tags['external'] = Reflective_boundary(domain) |
---|
46 | tags['open'] = Dirichlet_boundary([50.0, 0., 0.]) # replacing Transmissive_boundary(domain) |
---|
47 | domain.set_boundary(tags) |
---|
48 | |
---|
49 | #----------------- |
---|
50 | #Initial condition |
---|
51 | domain.set_quantity('stage', 0.) |
---|
52 | |
---|
53 | #------------------------------------- |
---|
54 | # Provide file name for storing output |
---|
55 | domain.store = True |
---|
56 | domain.format = 'sww' |
---|
57 | domain.filename = 'Malpasset_second_order' |
---|
58 | |
---|
59 | #---------------------------- |
---|
60 | # Friction |
---|
61 | domain.set_quantity('friction', 0.033) |
---|
62 | |
---|
63 | ###################### |
---|
64 | #Evolution |
---|
65 | import time |
---|
66 | t0 = time.time() |
---|
67 | for t in domain.evolve(yieldstep = yieldstep, finaltime = finaltime): |
---|
68 | domain.write_time() |
---|
69 | |
---|
70 | print 'That took %.2f seconds' %(time.time()-t0) |
---|
71 | |
---|
72 | |
---|