source: anuga_work/development/ted_rigby/test_flow_in_vee_basic.py @ 7402

Last change on this file since 7402 was 7402, checked in by ole, 15 years ago

Ted's flow test in V shaped domain

File size: 4.7 KB
Line 
1"""test_flow_in_vee.py
2Test the ability of ANUGA to
3a) maintain the flow rate input into the channel at the upstream end
4
5The vee channel is 20m wide by 400m long with side slopes of 1:1
6The equations for dn are generalised with side slope as 1 V in Side_Slope H
7The test location is half way down the channel X=200m
8This script explores flow  as given by ANUGA and compares it with
9the ref_flow
10"""
11
12verbose = True
13import numpy as num
14
15#------------------------------------------------------------------------------
16# Import necessary modules
17#------------------------------------------------------------------------------
18from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
19from anuga.shallow_water import Domain
20from anuga.shallow_water.shallow_water_domain import Reflective_boundary
21from anuga.shallow_water.shallow_water_domain import Dirichlet_boundary
22from anuga.shallow_water.shallow_water_domain import Transmissive_Momentum_Set_Stage_boundary
23from anuga.shallow_water.shallow_water_domain import Transmissive_boundary
24from anuga.shallow_water.shallow_water_domain import Inflow
25from anuga.shallow_water.data_manager import get_flow_through_cross_section
26from anuga.abstract_2d_finite_volumes.util import sww2csv_gauges, csv2timeseries_graphs
27
28
29#------------------------------------------------------------------------------
30# Setup computational domain
31#------------------------------------------------------------------------------
32
33finaltime = 1800.0    # 1/2 hour
34
35length     = 400.
36width      = 20.
37side_slope = 1.0
38dx = dy    = 1          # Resolution: of points (elev) grid on both axes
39ref_flow   = 5.0        # Inflow at head of vee
40slope      = 1.0/1000
41mannings_n = 0.150
42
43points, vertices, boundary = rectangular_cross(int(length/dx), int(width/dy),
44                                               len1=length, len2=width)
45
46
47
48domain = Domain(points, vertices, boundary)   
49domain.set_name('test_flow_in_vee')              # Output name
50
51
52#------------------------------------------------------------------------------
53# Setup initial conditions
54#------------------------------------------------------------------------------
55
56def topography(x, y):
57    z=-x * slope + abs((y-10)* side_slope)
58    return z
59
60domain.set_quantity('elevation', topography)  # Use function for elevation
61domain.set_quantity('friction', mannings_n)   # Constant friction of conc surface   
62domain.set_quantity('stage',
63                    expression='elevation')   # Dry initial condition
64
65
66#------------------------------------------------------------------------------
67# Seup Inflow and compute flow characteristics
68#------------------------------------------------------------------------------
69
70# Compute normal depth, and velocity for the vee using Mannings equation
71
72normal_depth  = ( ref_flow*mannings_n* ( (2.0*( (1.0+(1.0/side_slope)**2.0)**0.5) )**0.6667 ) / (side_slope*(slope**0.5))  )**0.375
73area          = (normal_depth**2.0) *side_slope
74wet_perimeter = 2* normal_depth*((1+(side_slope)**2.0)**0.5)
75hyd_radius    = area/wet_perimeter
76flow_velocity = ref_flow/area
77top_width     = 2* side_slope*normal_depth
78
79# Compute xmomentum to input into the ANUGA inflow boundary
80# assuming momentum is applied uniformly to inflow boundary by ANUGA
81
82xmomentum     = ref_flow/top_width  # this is all very unrealistic but should replicate ref_flow in ANUGA
83
84#------------------------------------------------------------------------------
85# Setup boundary conditions
86#------------------------------------------------------------------------------
87
88
89Br = Reflective_boundary(domain)                       # Solid reflective wall on edge of sides
90Bi = Dirichlet_boundary([normal_depth,xmomentum,0.0])  # inflow at top
91Bo = Transmissive_boundary(domain)                     # momentum as above bdry
92domain.set_boundary({'left': Bi, 'right': Bo, 'top': Br, 'bottom': Br})
93
94#------------------------------------------------------------------------------
95# Evolve system through time
96#------------------------------------------------------------------------------
97
98for t in domain.evolve(yieldstep=100.0, finaltime=finaltime):
99    if verbose :
100     print domain.timestepping_statistics()
101
102
103#------------------------------------------------------------------------------
104# Compute flow in vee cf inflow
105#------------------------------------------------------------------------------
106
107
108
109#------------------------------------------------------------------------------
110# Compute flow across flowline -v- ref_flow
111#------------------------------------------------------------------------------
112
113# Check flow across flowline at 200m
114q=domain.get_flow_through_cross_section([[200.0,0.0],[200.0,width]])
115print '90 degree flowline: ANUGA Q = %f, Ref_flow = %f' %(q, ref_flow)
116
Note: See TracBrowser for help on using the repository browser.