source: inundation/ga/storm_surge/pyvolution/cornell_room.py @ 317

Last change on this file since 317 was 317, checked in by ole, 20 years ago

Started playing with the Cornell Room

File size: 1.8 KB
Line 
1"""Example of shallow water wave equation.
2
3This is called Netherlands because it shows a dam with a gap in it and
4stylised housed behind it and below the water surface.
5
6"""
7
8######################
9# Module imports
10#
11from shallow_water import Domain, Reflective_boundary, Dirichlet_boundary,\
12     Transmissive_boundary, Time_boundary, Constant_height
13
14from mesh_factory import from_polyfile
15from Numeric import array
16   
17
18print 'Creating domain'
19points, triangles, values = from_polyfile('cornell_room_medres')
20
21#Create shallow water domain
22domain = Domain(points, triangles)
23   
24domain.check_integrity()
25domain.default_order = 2
26domain.smooth = True
27domain.reduction = min  #Looks a lot better on top of steep slopes
28
29print "Number of triangles = ", len(domain)
30
31domain.visualise = False
32domain.checkpoint = False
33domain.store = True    #Store for visualisation purposes
34domain.format = 'sww'   #Native netcdf visualisation format
35import sys, os
36root, ext = os.path.splitext(sys.argv[0])
37if domain.smooth is True:
38    s = 'smooth'
39else:
40    s = 'nonsmooth'       
41domain.filename = root + '_' + s
42
43#Set bed-slope and friction
44manning = 0.0
45
46print 'Field values'
47domain.set_quantity('elevation', values)
48domain.set_quantity('friction', manning)
49
50
51######################
52# Boundary conditions
53#
54print 'Boundaries'
55Br = Reflective_boundary(domain)
56domain.set_boundary({'exterior': Br})
57
58                 
59
60######################
61#Initial condition
62#
63print 'Initial condition'
64E = domain.quantities['elevation'].vertex_values
65print max(E)
66L = E.copy()
67N = len(L)
68L[:N/4] += 100
69domain.set_quantity('level', L)
70
71#Evolve
72for t in domain.evolve(yieldstep = 0.01, finaltime = 1.0):
73    domain.write_time()
74   
75
76   
Note: See TracBrowser for help on using the repository browser.