source: anuga_core/source/anuga/pyvolution/flatbed.py @ 3514

Last change on this file since 3514 was 3514, checked in by duncan, 18 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.7 KB
Line 
1"""Example of shallow water wave equation.
2
3Generate slope
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
16
17
18#Create basic mesh
19N = 50
20points, vertices, boundary = rectangular(N, N, 100, 100)
21
22#Create shallow water domain
23domain = Domain(points, vertices, boundary)
24domain.store = True
25domain.set_name('polygons')
26print "Output being written to " + domain.get_datadir() + sep + \
27              domain.filename + "_size%d." %len(domain) + domain.format
28       
29
30domain.default_order=2
31
32#Set driving forces
33manning = 0.07
34manning = 0.0
35inflow_stage = 10.0
36domain.set_quantity('friction', manning)
37
38def wiggle(x, y):
39    from Numeric import sin
40    from math import pi
41    return 10 + sin(2*pi*x/10)
42
43def slope(x, y):
44    return 20*(x/100+y/100)   
45
46#Define polynomials
47p0 = [[20,27], [30,25], [40,40], [20,40]]         
48p1 = [[80,19], [90,20], [85,50], [80,55], [75,58], [70,60], [60,24]]         
49p2 = read_polygon('testpoly.txt')
50
51
52#Set elevation 
53domain.set_quantity('elevation', 
54        Polygon_function([(p0,slope), (p1,wiggle), (p2,15)]))
55#domain.set_quantity('stage',
56#       Polygon_function([(p0,slope), (p1,wiggle), (p2,15)]))   
57
58
59         
60
61
62
63######################
64# Boundary conditions
65Br = Reflective_boundary(domain)
66Bd = Dirichlet_boundary([inflow_stage,0.,0.])
67
68domain.set_boundary({'left': Bd, 'right': Br, 'top': Br, 'bottom': Br})
69domain.check_integrity()
70
71
72######################
73#Evolution
74for t in domain.evolve(yieldstep = 1, finaltime = 1):
75    domain.write_time()
76
77print 'Done'   
78
Note: See TracBrowser for help on using the repository browser.