source: anuga_work/development/analytical solutions/Sydney.py @ 4631

Last change on this file since 4631 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: 2.0 KB
Line 
1"""Example of the use of the shallow water wave equation
2to simulate a bomb blast in an urban area.
3
4   Copyright 2004
5   Christopher Zoppou, Stephen Roberts, Ole Nielsen, Duncan Gray
6   Geoscience Australia
7   
8"""
9
10###############################
11# Setup Path and import modules
12import sys
13from os import sep, path
14sys.path.append('..'+sep+'pyvolution')
15
16from shallow_water import Domain, Reflective_boundary, File_boundary,\
17     Dirichlet_boundary, Transmissive_boundary
18from pmesh2domain import pmesh_to_domain_instance
19from anuga.pyvolution.util import Polygon_function,read_polygon
20
21
22######################
23# Domain
24filename = 'sydney_ubd.tsh'
25print 'Creating domain from', filename
26domain = pmesh_to_domain_instance(filename, Domain)
27print 'Number of triangles = ', len(domain)
28
29domain.default_order = 2
30domain.smooth = True
31
32
33# Provide file name for storing output
34domain.store = True
35domain.format = 'sww'
36domain.filename = 'sydney_ubd_again'
37
38#Reduction operation for get_vertex_values
39from anuga.pyvolution.util import mean
40domain.reduction = mean
41#domain.reduction = min  #Looks better near steep slopes
42
43
44######################
45#Initial condition
46#
47print 'Initial condition'
48
49#Set bed-elevation and friction(None)
50def x_slope(x,y):
51    n = x.shape[0]
52    z = 0*x
53    return z
54
55domain.set_quantity('elevation', x_slope)
56
57#Set the initial water stage
58def stage(x,y):
59    z = x_slope(x,y)
60    n = x.shape[0]
61    h = 0*x
62    return h   
63
64domain.set_quantity('stage', stage)
65p0 = [[334429.024416, 6251238.11488],[334428.532417, 6251234.42489],
66      [334432.468407, 6251233.93289],[334431.730409, 6251238.36088]]
67domain.set_quantity('stage',Polygon_function([(p0,10000.0)]))
68
69############
70#Boundary
71tags = {}
72tags['external'] = Transmissive_boundary(domain)
73tags[''] = None
74domain.set_boundary(tags)
75   
76
77######################
78#Evolution
79import time
80t0 = time.time()
81for t in domain.evolve(yieldstep = 0.1, finaltime = 5):
82    domain.write_time()
83
84print 'That took %.2f seconds' %(time.time()-t0)
85
86   
Note: See TracBrowser for help on using the repository browser.