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

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

Moved files from examples to anuga_work

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