source: anuga_work/development/analytical_solutions/oblique_shock.py @ 5162

Last change on this file since 5162 was 5162, checked in by steve, 17 years ago

Updated some methods for quantity. Looks like we can use old
limiting system with larger values of beta.

File size: 2.6 KB
Line 
1"""
2Example of shallow water wave equation
3consisting of an asymetrical converging channel.
4
5Copyright 2004
6Christopher Zoppou, Stephen Roberts, Ole Nielsen, Duncan Gray
7Geoscience Australia, ANU
8
9Specific methods pertaining to the 2D shallow water equation
10are imported from shallow_water
11for use with the generic finite volume framework
12
13Conserved quantities are h, uh and vh stored as elements 0, 1 and 2 in the
14numerical vector named conserved_quantities.
15
16"""
17
18######################
19# Module imports
20#
21
22#Were these used?
23#import visualise2_chris as visualise
24#import Image, ImageGrab
25
26import sys
27from os import sep
28sys.path.append('..'+sep+'pyvolution')
29
30
31from anuga.shallow_water import Domain
32from anuga.shallow_water import Transmissive_boundary, Reflective_boundary,\
33     Dirichlet_boundary
34from anuga.visualiser import RealtimeVisualiser
35from math import sqrt, cos, sin, pi
36from mesh_factory import oblique_cross
37
38
39######################
40# Domain
41#
42n = 60
43m = 80
44leny = 30.
45lenx = 40.
46n = 100
47m = 120
48
49points, elements, boundary = oblique_cross(m, n, lenx, leny)
50domain = Domain(points, elements, boundary)
51
52# Order of solver
53domain.default_order=2
54
55# Store output
56#domain.store=True
57
58# Output format
59#domain.format="sww" #NET.CDF binary format
60                    # "dat" for ASCII
61
62# Provide file name for storing output
63domain.filename="oblique"
64
65# Visualization smoothing
66domain.smooth=True
67domain.visualise=True
68
69#######################
70#Bed-slope and friction
71def x_slope(x, y):
72    return 0*x
73
74domain.set_quantity('elevation', x_slope)
75domain.set_quantity('friction', 0.0)
76
77######################
78# Boundary conditions
79#
80R = Reflective_boundary(domain)
81T = Transmissive_boundary(domain)
82D = Dirichlet_boundary([1.0, 8.57, 0.0])
83
84domain.set_boundary({'left': D, 'right': T, 'top': R, 'bottom': R})
85
86######################
87#Initial condition
88h = 0.5
89domain.set_quantity('stage', expression = 'elevation + %d'%h )
90
91#---------------------------------
92# Setup visualization
93#---------------------------------
94vis = RealtimeVisualiser(domain)
95vis.render_quantity_height("elevation", dynamic=False)
96vis.render_quantity_height("stage", zScale=10, dynamic=True)
97vis.colour_height_quantity('stage', (0.75, 0.5, 0.5))
98vis.start()
99
100######################
101#Evolution
102import time
103t0 = time.time()
104for t in domain.evolve(yieldstep = 0.5, finaltime = 50):
105    domain.write_time()
106    vis.update()
107
108print 'That took %.2f seconds' %(time.time()-t0)
109
110
111vis.evolveFinished()
112vis.join()
113
114#FIXME: Compute average water depth on either side of shock and compare
115#to expected values. And also Froude numbers.
116
117
118#print "saving file?"
119#im = ImageGrab.grab()
120#im.save("ccube.eps")
121
122
Note: See TracBrowser for help on using the repository browser.