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

Last change on this file since 9358 was 9022, checked in by davies, 11 years ago

Removing most significant velocity artefacts from dev_audusse

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