- Timestamp:
- May 14, 2011, 10:17:08 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_work/development/2010-projects/anuga_1d/pipe/pipe_domain.py
r8153 r8177 4 4 This module contains a specialisation of class Generic_domain from module generic_domain.py consisting of methods specific to mixed rectangular Pipe/Channel flow using the Shallow Water Wave Equation. 5 5 6 This particular modification of the Domain class implements the ability to 7 vary the width of the 1D pipe that the water flows in. As a result the 8 conserved variables are different than previous implementations and so are the 9 equations. In particular, the conserved quantites generalise the open channel flow conserved quantities. 6 This particular modification of the Domain class implements the ability to vary the height and width of the 1D pipe that the water flows in. As a result the conserved variables are slightly different than previous implementations and so are the equations. In particular, the conserved quantites generalise the open channel flow conserved quantities. 10 7 11 8 U_t + E_x = S … … 14 11 15 12 U = [A, Q] = [b*h, u*b*h] 16 E = [Q, Q^2/A + g*b*h^2/2]13 E = [Q, Q^2/A + A] 17 14 S represents source terms forcing the system 18 (e.g. gravity, boundary_stre e, friction, wind stress, ...)15 (e.g. gravity, boundary_stress, friction, wind stress, ...) 19 16 gravity = -g*b*h*z_x 20 17 boundary_stress = 1/2*g*b_x*h^2 21 18 22 and _t, _x, _y denote the derivative with respect to t, x and yrespectiely.19 and _t, _x, denote the derivative with respect to t and x respectiely. 23 20 24 21 The quantities are 25 22 26 23 symbol variable name explanation 27 A area equivalent Wetted area = b*h28 Q discharge flux of water = u*b*h 24 A area free surface equivalent wetted area = b*h [m^2] 25 Q discharge flux of water = u*b*h [m^3/s] 29 26 x x horizontal distance from origin [m] 30 27 z elevation elevation of bottom of pipe [m] 31 h height water height above z [m]28 h height free surface equivalent water height above z [m] 32 29 w stage equivalent absolute water level, w = z+h [m] 33 u 30 u xvelocity speed in the x direction [m/s] 34 31 uh xmomentum momentum in the x direction [m^2/s] 35 b width width of pipe 32 b width width of pipe [m] 33 t top height of pipe above z [m] 36 34 eta mannings friction coefficient [to appear] 37 35 … … 60 58 61 59 conserved_quantities = ['area', 'discharge'] 62 evolved_quantities = ['area', 'discharge', 'elevation', 'height', 'velocity','width',' stage']60 evolved_quantities = ['area', 'discharge', 'elevation', 'height', 'velocity','width','top','stage'] 63 61 other_quantities = ['friction'] 64 62 Generic_domain.__init__(self, … … 124 122 msg = 'Sixth evolved quantity must be "width"' 125 123 assert self.evolved_quantities[5] == 'width', msg 126 msg = 'Seventh evolved quantity must be "stage"' 127 assert self.evolved_quantities[6] == 'stage', msg 124 msg = 'Seventh evolved quantity must be "top"' 125 assert self.evolved_quantities[6] == 'top', msg 126 msg = 'Eighth evolved quantity must be "stage"' 127 assert self.evolved_quantities[7] == 'stage', msg 128 128 129 129 Generic_domain.check_integrity(self) … … 155 155 velocity = domain.quantities['velocity'] 156 156 width = domain.quantities['width'] 157 top = domain.quantities['top'] 157 158 158 159 159 160 from anuga_1d.pipe.pipe_domain_ext import compute_fluxes_pipe_ext 160 domain.flux_timestep = compute_fluxes_pipe_ext(timestep,domain,area,discharge,bed,height,velocity,width )161 domain.flux_timestep = compute_fluxes_pipe_ext(timestep,domain,area,discharge,bed,height,velocity,width,top) 161 162 162 163 #----------------------------------------------------------------------- … … 183 184 velocity = domain.quantities['velocity'] 184 185 width = domain.quantities['width'] 186 top = domain.quantities['top'] 185 187 stage = domain.quantities['stage'] 186 188 … … 192 194 u_C = velocity.centroid_values 193 195 b_C = width.centroid_values 196 t_C = top.centroid_values 194 197 w_C = stage.centroid_values 195 198 … … 198 201 domain.setstageflag = False 199 202 203 # Paul: Same for top? 200 204 if domain.discontinousb: 201 205 width.extrapolate_second_order() … … 204 208 h0 = 1.0e-12 205 209 210 # Paul: How does top (i.e. t_C) affect these? 206 211 h_C[:] = numpy.where( (a_C>h0) | (b_C>h0), a_C/(b_C+h0/b_C), 0.0 ) 207 212 u_C[:] = numpy.where( (a_C>h0) | (b_C>h0), d_C/(a_C+h0/a_C), 0.0 ) … … 209 214 a_C[:] = numpy.where( (a_C>h0) | (b_C>h0), a_C, 0.0 ) 210 215 b_C[:] = numpy.where( (a_C>h0) | (b_C>h0), b_C, 0.0 ) 216 t_C[:] = numpy.where( (a_C>h0) | (b_C>h0), t_C, 0.0 ) 211 217 d_C[:] = numpy.where( (a_C>h0) | (b_C>h0), d_C, 0.0 ) 212 218 … … 214 220 215 221 216 222 # Paul: same for top? 217 223 bed.extrapolate_second_order() 218 224 … … 234 240 d_V = discharge.vertex_values 235 241 b_V = width.vertex_values 242 t_V = top.vertex_values 236 243 237 244 … … 274 281 self.velocity = domain.quantities['velocity'].vertex_values 275 282 self.width = domain.quantities['width'].vertex_values 283 self.top = domain.quantities['top'].vertex_values 276 284 self.stage = domain.quantities['stage'].vertex_values 277 285 278 self.evolved_quantities = numpy.zeros( 7, numpy.float)286 self.evolved_quantities = numpy.zeros(8, numpy.float) 279 287 280 288 def __repr__(self): … … 294 302 q[4] = -self.velocity[vol_id, edge_id] 295 303 q[5] = self.width[vol_id,edge_id] 296 q[6] = self.stage[vol_id,edge_id] 304 q[6] = self.top[vol_id,edge_id] 305 q[7] = self.stage[vol_id,edge_id] 297 306 298 307 return q … … 313 322 raise msg 314 323 315 assert len(evolved_quantities) == 7324 assert len(evolved_quantities) == 8 316 325 317 326 self.evolved_quantities=numpy.array(evolved_quantities,numpy.float) … … 341 350 Height = domain.quantities['height'] 342 351 Width = domain.quantities['width'] 352 Top = domain.quantities['top'] 343 353 344 354 discharge_ud = Discharge.explicit_update … … 348 358 h = Height.vertex_values 349 359 b = Width.vertex_values 360 t = Top.vertex_values 350 361 a = Area.vertex_values 351 362 z = Elevation.vertex_values … … 356 367 avg_h = 0.5*(h[k,0] + h[k,1]) 357 368 avg_b = 0.5*(b[k,0] + b[k,1]) 369 avg_t = 0.5*(t[k,0] + t[k,1]) 358 370 359 371 #Compute bed slope … … 376 388 Height = domain.quantities['height'] 377 389 Width = domain.quantities['width'] 390 Top = domain.quantities['top'] 378 391 379 392 discharge_ud = Discharge.explicit_update … … 381 394 h = Height.vertex_values 382 395 b = Width.vertex_values 396 t = Top.vertex_values 383 397 a = Area.vertex_values 384 398 z = Elevation.vertex_values
Note: See TracChangeset
for help on using the changeset viewer.