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

Last change on this file since 8880 was 8880, checked in by davies, 12 years ago

Removing redundant code from 'tsunami' flow algorithm

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