source: branches/inundation-numpy-branch/pyvolution/island.py @ 7248

Last change on this file since 7248 was 3514, checked in by duncan, 19 years ago

Hi all,
I'm doing a change in the anuga structure, moving the code to

\anuga_core\source\anuga

After you have done an svn update, the PYTHONPATH has to be changed to;
PYTHONPATH = anuga_core/source/

This is part of changes required to make installation of anuga quicker and reducing the size of our sandpits.

If any imports are broken, try fixing them. With adding anuga. to them for example. If this seems to have really broken things, email/phone me.

Cheers
Duncan

File size: 1.8 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 anuga.pyvolution.util import Polygon_function, read_polygon
16from math import exp
17
18
19#Create basic mesh
20N = 40
21points, vertices, boundary = rectangular(N, N, 100, 100)
22
23#Create shallow water domain
24domain = Domain(points, vertices, boundary)
25domain.store = False
26domain.smooth = False
27domain.visualise = True
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.9
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 = 40):
72    domain.write_time()
73
74print 'Done'
Note: See TracBrowser for help on using the repository browser.