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

Last change on this file since 8607 was 8547, checked in by davies, 13 years ago

Major experimental changes to balanced_dev

File size: 2.7 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
[8353]10from 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
[8353]14#from 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)
[8308]25# Time stepping
26#domain.set_timestepping_method('euler') # Default
27#domain.set_timestepping_method('rk2') #
28#domain.beta_w= 1. #0.2
29#domain.beta_uh= 1. #0.2
30#domain.beta_vh= 1. #0.2
31#domain.beta_w_dry= 0.2 #0.
32#domain.beta_uh_dry= 0.2 #0.
33#domain.beta_vh_dry= 0.2 #0.
34#domain.alpha=100.
35
36#------------------
37# Define topography
38#------------------
39
40# Parameters for analytical solution
41D0=4.0
42L=10.0
43A = 2.0
44
45def topography(x,y):
46        return  (D0/(L**2.))*(x-20.0)**2.
47
48def stage_init(x,y):
49    wat= ( D0 + (2.0*A*D0/L**2.)*((x-20.0)-A/2.0) ) # Water elevation inside the parabola
50    top=topography(x,y) # Bed elevation
51    # Return the maximum of the water elevation and the bed elvation
52    return wat*(wat>top) + top*(wat<=top)
53
54
55domain.set_quantity('elevation',topography)     # Use function for elevation
56
57domain.set_quantity('friction',0.00)            # No friction
58
59domain.set_quantity('stage', stage_init)        # Constant negative initial stage
60
61
62
63#--------------------------
64# Setup boundary conditions
65#--------------------------
66Br=anuga.Reflective_boundary(domain)            # Solid reflective wall
67#Bt=anuga.Transmissive_boundary(domain)          # Continue all values of boundary -- not used in this example
68#Bd=anuga.Dirichlet_boundary([-0.2,0.,0.])       # Constant boundary values -- not used in this example
69#Bw=anuga.Time_boundary(domain=domain,
70#       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.
71
72#----------------------------------------------
73# Associate boundary tags with boundary objects
74#----------------------------------------------
75domain.set_boundary({'left': Br, 'right': Br, 'top': Br, 'bottom':Br})
76
77#------------------------------
78#Evolve the system through time
79#------------------------------
80for t in domain.evolve(yieldstep=0.1,finaltime=90.0):
81    print domain.timestepping_statistics()
82
83print 'Finished'
Note: See TracBrowser for help on using the repository browser.