- Timestamp:
- May 15, 2009, 2:33:56 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/shallow_water/test_shallow_water_domain.py
r6763 r7043 3031 3031 3032 3032 This test will fail as the problem was only fixed for culverts. 3033 FIXME(Ole): It'd be nice to turn it into a volume conservation test 3033 3034 """ 3034 3035 … … 6885 6886 6886 6887 6887 6888 6889 6888 6890 6889 6891 def test_inflow_using_flowline(self): … … 6956 6958 6957 6959 #-------------------------------------------------------------- 6958 # Se up Inflow6960 # Setup Inflow 6959 6961 #-------------------------------------------------------------- 6960 6962 … … 7035 7037 7036 7038 7037 7039 7040 7041 7042 7043 def Xtest_inflow_boundary_using_flowline(self): 7044 """test_inflow_boundary_using_flowline 7045 Test the ability of a flowline to match inflow above the flowline by 7046 creating constant inflow into the boundary at the head of a 20m 7047 wide by 300m long plane dipping at various slopes with a 7048 perpendicular flowline and gauge downstream of the inflow and 7049 a 45 degree flowlines at 200m downstream 7050 7051 7052 """ 7053 7054 # FIXME (Ole): Work in progress 7055 7056 verbose = False 7057 7058 7059 #---------------------------------------------------------------------- 7060 # Import necessary modules 7061 #---------------------------------------------------------------------- 7062 from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross 7063 from anuga.shallow_water import Domain 7064 from anuga.shallow_water.shallow_water_domain import Reflective_boundary 7065 from anuga.shallow_water.shallow_water_domain import Dirichlet_boundary 7066 from anuga.shallow_water.shallow_water_domain import Inflow_boundary 7067 from anuga.shallow_water.data_manager import get_flow_through_cross_section 7068 from anuga.abstract_2d_finite_volumes.util import sww2csv_gauges, csv2timeseries_graphs 7069 7070 7071 #---------------------------------------------------------------------- 7072 # Setup computational domain 7073 #---------------------------------------------------------------------- 7074 7075 finaltime = 500 #700.0 # If this is too short, steady state will not be achieved 7076 7077 length = 250. 7078 width = 20. 7079 dx = dy = 5 # Resolution: of grid on both axes 7080 7081 points, vertices, boundary = rectangular_cross(int(length/dx), int(width/dy), 7082 len1=length, len2=width) 7083 7084 for mannings_n in [0.1, 0.01]: 7085 # Loop over a range of roughnesses 7086 7087 for slope in [1.0/300, 1.0/100]: 7088 # Loop over a range of bedslopes representing sub to super critical flows 7089 7090 7091 domain = Domain(points, vertices, boundary) 7092 domain.set_name('inflow_boundary_flowline_test') 7093 7094 7095 #------------------------------------------------------------- 7096 # Setup initial conditions 7097 #------------------------------------------------------------- 7098 7099 def topography(x, y): 7100 z=-x * slope 7101 return z 7102 7103 domain.set_quantity('elevation', topography) 7104 domain.set_quantity('friction', mannings_n) 7105 domain.set_quantity('stage', 7106 expression='elevation') 7107 7108 7109 7110 #-------------------------------------------------------------- 7111 # Setup boundary conditions 7112 #-------------------------------------------------------------- 7113 7114 7115 7116 ref_flow = 10.00 7117 7118 # Compute normal depth on plane using Mannings equation 7119 # v=1/n*(r^2/3)*(s^0.5) or r=(Q*n/(s^0.5*W))^0.6 7120 normal_depth=(ref_flow*mannings_n/(slope**0.5*width))**0.6 7121 if verbose: 7122 print 7123 print 'Slope:', slope, 'Mannings n:', mannings_n 7124 7125 7126 7127 Bi = Inflow_boundary(domain, rate=ref_flow) 7128 7129 Br = Reflective_boundary(domain) 7130 7131 # Define downstream boundary based on predicted depth 7132 def normal_depth_stage_downstream(t): 7133 return (-slope*length) + normal_depth 7134 7135 Bt = Transmissive_momentum_set_stage_boundary(domain=domain, 7136 function=normal_depth_stage_downstream) 7137 7138 7139 7140 7141 domain.set_boundary({'left': Bi, 7142 'right': Bt, 7143 'top': Br, 7144 'bottom': Br}) 7145 7146 7147 7148 #-------------------------------------------------------------- 7149 # Evolve system through time 7150 #-------------------------------------------------------------- 7151 7152 7153 for t in domain.evolve(yieldstep=100.0, finaltime=finaltime): 7154 pass 7155 #if verbose : 7156 # print domain.timestepping_statistics() 7157 # print domain.volumetric_balance_statistics() 7158 7159 7160 #-------------------------------------------------------------- 7161 # Compute flow thru flowlines ds of inflow 7162 #-------------------------------------------------------------- 7163 7164 # Square on flowline at 200m 7165 q=domain.get_flow_through_cross_section([[200.0,0.0],[200.0,20.0]]) 7166 msg = 'Predicted flow was %f, should have been %f' % (q, ref_flow) 7167 if verbose: 7168 print '90 degree flowline: ANUGA = %f, Ref = %f' % (q, ref_flow) 7169 assert num.allclose(q, ref_flow, rtol=1.0e-2), msg 7170 7171 7172 # 45 degree flowline at 200m 7173 q=domain.get_flow_through_cross_section([[200.0,0.0],[220.0,20.0]]) 7174 msg = 'Predicted flow was %f, should have been %f' % (q, ref_flow) 7175 if verbose: 7176 print '45 degree flowline: ANUGA = %f, Ref = %f' % (q, ref_flow) 7177 7178 assert num.allclose(q, ref_flow, rtol=1.0e-2), msg 7179 7180 7181 7182 7183 7184 7185 7038 7186 def Xtest_friction_dependent_flow_using_flowline(self): 7039 7187 """test_friction_dependent_flow_using_flowline
Note: See TracChangeset
for help on using the changeset viewer.