source: anuga_validation/analytical solutions/oblique_shock.py @ 7626

Last change on this file since 7626 was 7626, checked in by steve, 14 years ago

Cleaning up directory

File size: 2.5 KB
Line 
1"""Example of shallow water wave equation
2consisting of an asymetrical converging channel.
3
4   Copyright 2005
5   Christopher Zoppou, Stephen Roberts
6   ANU
7
8Specific methods pertaining to the 2D shallow water equation
9are imported from shallow_water
10for use with the generic finite volume framework
11
12Conserved quantities are h, uh and vh stored as elements 0, 1 and 2 in the
13numerical vector named conserved_quantities.
14"""
15
16#-------------------------------
17# Set up path and import modules
18# import visualise2_chris as visualise
19# import Image, ImageGrab
20#import sys
21#from os import sep
22#sys.path.append('..'+sep+'pyvolution')
23
24from anuga.shallow_water import Domain #, Constant_height
25from anuga.shallow_water import Transmissive_boundary, Reflective_boundary,\
26     Dirichlet_boundary
27from math import sqrt, cos, sin, pi
28from mesh_factory import oblique
29
30#--------------
31# Define domain
32n = 60
33m = 80
34leny = 30.
35lenx = 40.
36n = 50
37m = 60
38points, elements, boundary = oblique(m, n, lenx, leny)
39domain = Domain(points, elements, boundary)
40
41#----------------
42# Order of scheme
43domain.default_order=1
44
45#---------------------------------
46# Store output format and location
47domain.store = True
48domain.format = "sww" #"sww" for NET.CDF binary format or "dat" for ASCII
49domain.set_name('oblique_first_order')
50
51#------------------------
52# Visualization smoothing
53domain.smooth=True
54domain.visualise = True
55
56#--------------
57# Set bed slope
58def x_slope(x, y):
59    return 0*x
60domain.set_quantity('elevation', x_slope)
61
62#-------------
63# Set friction
64domain.set_quantity('friction', 0.0)
65
66#--------------------
67# Boundary conditions
68R = Reflective_boundary(domain)
69T = Transmissive_boundary(domain)
70D = Dirichlet_boundary([1.0, 8.57, 0.0])
71domain.set_boundary({'left': D, 'right': T, 'top': R, 'bottom': R})
72
73#------------------
74# Initial condition
75h = 0.5
76domain.set_quantity('stage', expression='elevation + %f' %h)
77
78#----------------------------------------------------------
79# Decide which quantities are to be stored at each timestep
80domain.quantities_to_be_stored = ['level', 'xmomentum', 'ymomentum']
81
82
83#----------
84# Evolution
85import time
86t0 = time.time()
87for t in domain.evolve(yieldstep = 1.0, finaltime = 50):
88    domain.write_time()
89
90print 'That took %.2f seconds' %(time.time()-t0)
91
92#-----------------------------------
93#Save the last frame as an EPS file
94#filename = 'ccube.eps'
95#print 'Saving last frame in EPS format in ', filemame
96#im = ImageGrab.grab()
97#im.save(filename)
98
99
100
Note: See TracBrowser for help on using the repository browser.