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 | |
---|
10 | """ |
---|
11 | |
---|
12 | ############################### |
---|
13 | # Setup Path and import modules |
---|
14 | import sys |
---|
15 | from os import sep, path |
---|
16 | sys.path.append('..'+sep+'pyvolution') |
---|
17 | |
---|
18 | import Numeric |
---|
19 | from shallow_water import Domain, Reflective_boundary, File_boundary,\ |
---|
20 | Dirichlet_boundary, Transmissive_boundary |
---|
21 | from pmesh2domain import pmesh_to_domain_instance |
---|
22 | from util import Polygon_function, read_polygon |
---|
23 | |
---|
24 | ###################### |
---|
25 | # Domain |
---|
26 | filename = 'Noca_mesh_1000.tsh' |
---|
27 | print 'Creating domain from', filename |
---|
28 | domain = pmesh_to_domain_instance(filename, Domain) |
---|
29 | print "Number of triangles = ", len(domain) |
---|
30 | |
---|
31 | #-------------------- |
---|
32 | # Order of the scheme |
---|
33 | domain.default_order = 2 |
---|
34 | domain.smooth = True |
---|
35 | |
---|
36 | #-------------------------- |
---|
37 | # This is for Visual Python |
---|
38 | domain.visualise = True |
---|
39 | |
---|
40 | #----------------------- |
---|
41 | #Set boundary conditions |
---|
42 | tags = {} |
---|
43 | tags['reflective'] = Reflective_boundary(domain) |
---|
44 | tags['transmissive'] = Transmissive_boundary(domain) |
---|
45 | tags['Dirichlet'] = Dirichlet_boundary([2, 0.0, 0.0]) |
---|
46 | tags['outer contour'] = None |
---|
47 | tags['inner contour'] = Reflective_boundary(domain) |
---|
48 | domain.set_boundary(tags) |
---|
49 | print 'Boundaries set' |
---|
50 | |
---|
51 | #--------------------------------------------------------- |
---|
52 | #Decide which quantities are to be stored at each timestep |
---|
53 | domain.quantities_to_be_stored = ['stage', 'xmomentum', 'ymomentum'] |
---|
54 | |
---|
55 | #----------------- |
---|
56 | #Initial condition |
---|
57 | domain.set_quantity('stage', 0.0) |
---|
58 | |
---|
59 | #------------------------------------- |
---|
60 | # Provide file name for storing output |
---|
61 | domain.store = True |
---|
62 | domain.format = 'sww' |
---|
63 | domain.filename = 'Noca_first_order' |
---|
64 | |
---|
65 | #---------------------------- |
---|
66 | # Friction |
---|
67 | domain.set_quantity('friction', 0.01) |
---|
68 | |
---|
69 | yieldstep = 0.1 |
---|
70 | finaltime = 10 |
---|
71 | |
---|
72 | ###################### |
---|
73 | #Evolution |
---|
74 | import time |
---|
75 | t0 = time.time() |
---|
76 | for t in domain.evolve(yieldstep = yieldstep, finaltime = finaltime): |
---|
77 | domain.write_time() |
---|
78 | domain.visualiser.update_quantity_color('friction',(1.0,0.0,0.0)) |
---|
79 | |
---|
80 | print 'That took %.2f seconds' %(time.time()-t0) |
---|
81 | |
---|