source: trunk/anuga_work/development/gareth/tests/parabolic/parabolic.py @ 8375

Last change on this file since 8375 was 8353, checked in by davies, 13 years ago

Updates to balanced_dev and associated tests

File size: 2.7 KB
Line 
1"""Parabolic channel oscilation example
2"""
3#---------
4#Import Modules
5#--------
6import anuga
7#from anuga.shallow_water.shallow_water_domain import Domain as Domain
8import numpy
9
10from balanced_dev import *
11#from balanced_basic import *
12#from anuga.shallow_water_balanced2.swb2_domain import Domain as Domain
13#from anuga.shallow_water.shallow_water_domain import Domain as Domain
14#---------
15#Setup computational domain
16#---------
17points, vertices, boundary = anuga.rectangular_cross(200,10, len1=40.0,len2=2.0)
18
19domain=Domain(points,vertices,boundary)    # Create Domain
20domain.set_name('parabola_v2')                         # Output to file runup.sww
21domain.set_datadir('.')                          # Use current folder
22domain.set_quantities_to_be_stored({'stage': 2, 'xmomentum': 2, 'ymomentum': 2, 'elevation': 1})
23domain.set_minimum_allowed_height(0.01)
24# Time stepping
25#domain.set_timestepping_method('euler') # Default
26#domain.set_timestepping_method('rk2') #
27#domain.beta_w= 1. #0.2
28#domain.beta_uh= 1. #0.2
29#domain.beta_vh= 1. #0.2
30#domain.beta_w_dry= 0.2 #0.
31#domain.beta_uh_dry= 0.2 #0.
32#domain.beta_vh_dry= 0.2 #0.
33#domain.alpha=100.
34
35#------------------
36# Define topography
37#------------------
38
39# Parameters for analytical solution
40D0=4.0
41L=10.0
42A = 2.0
43
44def topography(x,y):
45        return  (D0/(L**2.))*(x-20.0)**2.
46
47def stage_init(x,y):
48    wat= ( D0 + (2.0*A*D0/L**2.)*((x-20.0)-A/2.0) ) # Water elevation inside the parabola
49    top=topography(x,y) # Bed elevation
50    # Return the maximum of the water elevation and the bed elvation
51    return wat*(wat>top) + top*(wat<=top)
52
53
54domain.set_quantity('elevation',topography)     # Use function for elevation
55
56domain.set_quantity('friction',0.00)            # No friction
57
58domain.set_quantity('stage', stage_init)        # Constant negative initial stage
59
60
61
62#--------------------------
63# Setup boundary conditions
64#--------------------------
65Br=anuga.Reflective_boundary(domain)            # Solid reflective wall
66#Bt=anuga.Transmissive_boundary(domain)          # Continue all values of boundary -- not used in this example
67#Bd=anuga.Dirichlet_boundary([-0.2,0.,0.])       # Constant boundary values -- not used in this example
68#Bw=anuga.Time_boundary(domain=domain,
69#       f=lambda t: [(0.0*sin(t*2*pi)-0.1)*exp(-t)-0.1,0.0,0.0]) # Time varying boundary -- get rid of the 0.0 to do a runup.
70
71#----------------------------------------------
72# Associate boundary tags with boundary objects
73#----------------------------------------------
74domain.set_boundary({'left': Br, 'right': Br, 'top': Br, 'bottom':Br})
75
76#------------------------------
77#Evolve the system through time
78#------------------------------
79for t in domain.evolve(yieldstep=0.1,finaltime=90.0):
80    print domain.timestepping_statistics()
81
82print 'Finished'
Note: See TracBrowser for help on using the repository browser.