source: anuga_work/development/Rudy_vandrie_2007/momentum_jet.py @ 6409

Last change on this file since 6409 was 5436, checked in by ole, 17 years ago

Moved culvert routines into own area

File size: 4.0 KB
Line 
1"""
2Small test of directional flow aka momentum jet
3"""
4
5#------------------------------------------------------------------------------
6# Import necessary modules
7#------------------------------------------------------------------------------
8from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
9from anuga.shallow_water import Domain
10from anuga.shallow_water.shallow_water_domain import Reflective_boundary
11from anuga.shallow_water.shallow_water_domain import Dirichlet_boundary
12from anuga.shallow_water.shallow_water_domain import Inflow, General_forcing
13from anuga.culvert_flows.culvert_polygons import create_culvert_polygons
14from anuga.utilities.polygon import plot_polygons
15
16from math import pi, sqrt, cos, sin
17
18#------------------------------------------------------------------------------
19# Setup computational domain
20#------------------------------------------------------------------------------
21
22
23
24length = 40.
25width = 5.
26
27#dx = dy = 1           # Resolution: Length of subdivisions on both axes
28#dx = dy = .5           # Resolution: Length of subdivisions on both axes
29dx = dy = .25           # Resolution: Length of subdivisions on both axes
30#dx = dy = .1           # Resolution: Length of subdivisions on both axes
31
32# OLE.... How do I refine the resolution... in the area where I have the Culvert Opening ???......
33#  Can I refine in a X & Y Range ???
34points, vertices, boundary = rectangular_cross(int(length/dx), int(width/dy),
35                                               len1=length, len2=width)
36domain = Domain(points, vertices, boundary)   
37domain.set_name('jet_example')                 # Output name
38domain.set_default_order(2)
39domain.H0 = 0.01
40domain.tight_slope_limiters = True
41domain.set_minimum_storable_height(0.02)
42print 'Size', len(domain)
43
44
45#------------------------------------------------------------------------------
46# Setup initial conditions
47#------------------------------------------------------------------------------
48domain.set_quantity('elevation', 0.0)
49domain.set_quantity('friction', 0.01)         # Constant friction
50domain.set_quantity('stage',
51                    expression='elevation')   # Dry initial condition
52
53
54#------------------------------------------------------------------------------
55# Setup boundary conditions
56#------------------------------------------------------------------------------
57Bi = Dirichlet_boundary([0.0, 0.0, 0.0])
58Br = Reflective_boundary(domain)              # Solid reflective wall
59Bo = Dirichlet_boundary([-5, 0, 0])           # Outflow
60
61domain.set_boundary({'left': Br, 'right': Bo, 'top': Br, 'bottom': Br})
62
63#------------------------------------------------------------------------------
64# Setup Application of  specialised forcing terms
65#------------------------------------------------------------------------------
66
67# This tests straight Inflow in m^3/s
68center=(6.0, 2.0)
69r = 1.2
70fixed_flow = Inflow(domain,
71                    rate=6.00,
72                    center=center,
73                    radius=r)
74domain.forcing_terms.append(fixed_flow)
75
76
77# This tests momentum update (6, 3) in m^2/s/s
78xmom_forcing = General_forcing(domain,
79                               'xmomentum',
80                               rate=6.00,
81                               center=center,
82                               radius=r)
83ymom_forcing = General_forcing(domain,
84                               'ymomentum',
85                               rate=3.00,
86                               center=center,
87                               radius=r)
88
89domain.forcing_terms.append(xmom_forcing)
90domain.forcing_terms.append(ymom_forcing)                               
91
92
93
94#------------------------------------------------------------------------------
95# Evolve system through time
96#------------------------------------------------------------------------------
97
98
99
100for t in domain.evolve(yieldstep = 0.1, finaltime = 20):
101
102    if t > 6:
103        # Swing forcing rate around with time
104        xmom_forcing.rate = 5*cos(t/5*2*pi)   
105        ymom_forcing.rate = 5*sin(t/5*2*pi)
106   
107    print domain.timestepping_statistics()
108
109
110
Note: See TracBrowser for help on using the repository browser.