source: anuga_core/source/anuga/examples/bedslope.py @ 3547

Last change on this file since 3547 was 3514, checked in by duncan, 19 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: 1.5 KB
Line 
1"""Simple example of shallow water wave equation using Pyvolution
2
3Water driven up a linear slope with a time varying boundary,
4similar to beach environment
5
6"""
7
8######################
9# Module imports
10from anuga.pyvolution.mesh_factory import rectangular
11from anuga.pyvolution.shallow_water import Domain, Reflective_boundary,\
12     Dirichlet_boundary, Time_boundary, Transmissive_boundary
13
14#Create basic triangular mesh
15points, vertices, boundary = rectangular(10, 10)
16
17#Create shallow water domain
18domain = Domain(points, vertices, boundary)
19domain.set_name('bedslope')
20domain.set_datadir('.')                      #Use current directory for output
21domain.set_quantities_to_be_stored('stage')  #See shallow_water.py
22
23print domain.statistics()
24
25#######################
26# Initial conditions
27def f(x,y):
28    return -x/2
29
30domain.set_quantity('elevation', f)
31domain.set_quantity('friction', 0.1)
32
33h = 0.00               # Constant depth over elevation
34domain.set_quantity('stage', -.4)
35
36
37######################
38# Boundary conditions
39from math import sin, pi
40Br = Reflective_boundary(domain)
41Bt = Transmissive_boundary(domain)
42Bd = Dirichlet_boundary([0.2,0.,0.])
43Bw = Time_boundary(domain=domain,
44                   f=lambda t: [(0.1*sin(t*2*pi)-0.3), 0.0, 0.0])
45
46
47print 'Tags are ', domain.get_boundary_tags()
48
49domain.set_boundary({'left': Br, 'right': Bw, 'top': Br, 'bottom': Br})
50
51
52######################
53#Evolution
54domain.check_integrity()
55
56for t in domain.evolve(yieldstep = 0.1, finaltime = 4.0):
57    domain.write_time()
58
Note: See TracBrowser for help on using the repository browser.