source: anuga_work/development/demos/flatbed_compare.py @ 5175

Last change on this file since 5175 was 4539, checked in by ole, 18 years ago

Moved files from examples to anuga_work

File size: 1.3 KB
Line 
1"""Example of shallow water wave equation.
2
3Generate slope
4
5"""
6
7######################
8# Module imports
9#
10from mesh_factory import rectangular
11from shallow_water import Domain, Reflective_boundary, Dirichlet_boundary,\
12     Constant_height
13from Numeric import array
14
15#Create basic mesh
16N = 8
17points, vertices, boundary = rectangular(N, N)
18
19#Create shallow water domain
20domain = Domain(points, vertices, boundary)
21domain.smooth = False
22domain.default_order=2
23
24
25######################
26# Boundary conditions
27Br = Reflective_boundary(domain)
28Bd = Dirichlet_boundary([0.2,0.,0.])
29
30domain.set_boundary({'left': Bd, 'right': Br, 'top': Br, 'bottom': Br})
31
32
33domain.check_integrity()
34
35######################
36#Evolution
37#for t in domain.evolve(yieldstep = 0.05, finaltime = 1.):
38#    domain.write_time()
39
40
41#import sys; sys.exit()
42
43######################
44#Evolution
45for t in domain.evolve(yieldstep = 0.01, finaltime = 0.03):
46    domain.write_time()
47
48print domain.quantities['stage'].centroid_values[:4]
49print domain.quantities['xmomentum'].centroid_values[:4]
50print domain.quantities['ymomentum'].centroid_values[:4]
51domain.distribute_to_vertices_and_edges()
52print
53print domain.quantities['stage'].vertex_values[:4,0]
54print domain.quantities['xmomentum'].vertex_values[:4,0]
55print domain.quantities['ymomentum'].vertex_values[:4,0] 
Note: See TracBrowser for help on using the repository browser.