source: inundation/ga/storm_surge/pyvolution/island.py @ 1266

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

Played more with 'lapping' issue.
I think it was largely due to missing
distribute_to_vertices_and_edges in shallow_water evolve

File size: 1.7 KB
Line 
1"""Example of shallow water wave equation.
2
3Island surrounded by water
4
5"""
6
7######################
8# Module imports
9#
10from os import sep, path
11from mesh_factory import rectangular
12from shallow_water import Domain, Reflective_boundary, Dirichlet_boundary,\
13     Constant_height
14from Numeric import array
15from util import Polygon_function, read_polygon
16from math import exp
17
18
19#Create basic mesh
20N = 20
21points, vertices, boundary = rectangular(N, N, 100, 100)
22
23#Create shallow water domain
24domain = Domain(points, vertices, boundary)
25domain.store = True
26domain.smooth = False
27domain.visualise = False
28domain.set_name('island')
29print 'Output being written to ' + domain.get_datadir() + sep + \
30              domain.get_name() + '.' + domain.format
31       
32
33domain.default_order=2
34
35
36#I tried to introduce this parameter top control the h-limiter,
37#but it doesn't remove the 'lapping water'
38#NEW (ON): I think it has been fixed (or at least reduced significantly) now
39#
40# beta_h == 1.0 means that the largest gradients (on h) are allowed
41# beta_h == 0.0 means that constant (1st order) gradients are introduced
42# on h. This is equivalent to the constant depth used previously.
43domain.beta_h = 0.2
44
45
46#Initial conditions
47
48def island(x, y):
49    z = 0*x
50    for i in range(len(x)):
51        z[i] = 8*exp( -((x[i]-50)**2 + (y[i]-50)**2)/100 )   
52    return z   
53
54domain.set_quantity('friction', 0.0)
55domain.set_quantity('elevation', island)
56domain.set_quantity('stage', 1)
57       
58
59
60######################
61# Boundary conditions
62Br = Reflective_boundary(domain)
63
64domain.set_boundary({'left': Br, 'right': Br, 'top': Br, 'bottom': Br})
65domain.check_integrity()
66
67
68######################
69#Evolution
70import time
71for t in domain.evolve(yieldstep = 1, finaltime = 20):
72    domain.write_time()
73
74print 'Done'   
75
Note: See TracBrowser for help on using the repository browser.