Changeset 9225
- Timestamp:
- Jun 30, 2014, 2:19:32 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga/shallow_water/swDE1_domain_ext.c
r9165 r9225 607 607 if (already_computed_flux[ki] == call) { 608 608 // We've already computed the flux across this edge 609 // Check if it is a riverwall 610 if(edge_flux_type[ki]==1){ 611 // Update counter of riverwall edges == index of 612 // riverwall_elevation + riverwall_rowIndex 613 RiverWall_count+=1; 614 } 609 615 continue; 610 616 } -
trunk/anuga_core/source/anuga/structures/riverwall.py
r9167 r9225 1 import os 2 from anuga_parallel import barrier, numprocs, myid 1 3 import numpy 2 4 … … 13 15 so long as the riverwall is not too deeply submerged. 14 16 15 As of 22/04/2014, they are only implemented for DE 0 and DE1[the shallow water17 As of 22/04/2014, they are only implemented for DE algorithms [the shallow water 16 18 component would be more difficult to implement with other algorithms] 17 19 … … 146 148 def create_riverwalls(self, riverwalls, riverwallPar={ }, 147 149 default_riverwallPar={ }, 148 tol=1.0e-04, verbose=True): 150 tol=1.0e-4, verbose=True, 151 output_dir=None): 149 152 """Add riverwalls at chosen locations along the mesh 150 153 151 As of 22/04/2014, these only work with DE 0 and DE1[for which the concept is natural]154 As of 22/04/2014, these only work with DE algorithms [for which the concept is natural] 152 155 153 156 The walls MUST EXACTLY COINCIDE with edges along the mesh … … 205 208 verbose: TRUE/FALSE Print lots of information 206 209 210 output_dir: Text representation of riverwalls is written to output_dir, unless output_dir=None 211 207 212 Outputs: 208 213 None, but it sets domain.edge_flux_type = 1 for every edge on a riverwall … … 213 218 """ 214 219 215 if(verbose ):220 if(verbose and myid==0): 216 221 print ' ' 217 222 print 'WARNING: Riverwall is an experimental feature' 218 223 print ' At each riverwall edge, we place a thin "wall" between' 219 print ' 220 print ' 224 print ' the 2 edges -- so each sees its neighbour edge as having' 225 print ' bed elevation = max(levee height, neighbour bed elevation)' 221 226 print ' We also force the discharge with a weir relation, blended with' 222 print ' 223 print ' 227 print ' the shallow water flux solution as the ratio (min_head)/(weir_height) becomes ' 228 print ' large, or the ratio (downstream_head)/(upstream_head) becomes large' 224 229 print ' ' 225 230 print ' It works in parallel, but you must use domain.riverwallData.create_riverwall AFTER distributing the mesh' 226 231 print ' ' 227 232 228 # NOTE: domain.riverwallData is initialised in shallow_water_domain.py for DE0 and DE1 229 233 # NOTE: domain.riverwallData is initialised in shallow_water_domain.py for DE algorithms 230 234 domain=self.domain 231 235 … … 233 237 # Check flow algorithm 234 238 if(not domain.get_using_discontinuous_elevation()): 235 raise Exception, 'Riverwalls are currently only supported when domain.flow_algorithm="DE0" and "DE1"'239 raise Exception, 'Riverwalls are currently only supported for discontinuous elevation flow algorithms' 236 240 237 241 if(len(self.names)>0): … … 248 252 self.input_riverwallPar=riverwallPar 249 253 250 # Update self.default_riverwallPar 254 # Update self.default_riverwallPar (defined in __init__) 251 255 for i in self.default_riverwallPar.keys(): 252 256 if(default_riverwallPar.has_key(i)): … … 278 282 279 283 if(verbose): 280 print 'Setting riverwall elevations ...'284 print 'Setting riverwall elevations (P'+str(myid)+')...' 281 285 282 286 # Set up geometry … … 295 299 nw=range(len(riverwalls)) 296 300 nw_names=riverwalls.keys() # Not guarenteed to be in deterministic order 301 302 if(verbose): 303 # Use variable to record messages, allows cleaner parallel printing 304 printInfo='' 305 297 306 for i in nw: 298 307 # Name of riverwall … … 303 312 ns=len(riverwalli)-1 304 313 305 if(verbose): 306 print 'Wall ' + str(i) +' ....'314 if(verbose): 315 printInfo=printInfo + ' Wall ' + str(i) +' ....\n' 307 316 308 317 for j in range(ns): 309 318 if(verbose): 310 print ' Segment ' + str(j) +' ....'319 printInfo=printInfo + ' Segment ' + str(j) +' ....\n' 311 320 # Start and end xyz coordinates 312 321 start=riverwalli[j] … … 320 329 segLen=( (start[0]-end[0])**2+(start[1]-end[1])**2)**0.5 321 330 if(segLen<tol): 322 print 'Segment with length < tolerance ' + str(tol) +' ignored' 331 if(verbose): 332 printInfo=printInfo+' Segment with length < tolerance ' + str(tol) +' ignored\n' 323 333 continue 324 334 … … 353 363 354 364 if(verbose): 355 print ' Finding ' + str(len(onLevee)) + ' edges on this segment'365 printInfo=printInfo+' Finding ' + str(len(onLevee)) + ' edges on this segment\n' 356 366 357 367 # Levee has Edge_flux_type=1 … … 369 379 # Now, condense riverwall_elevation to array with length = number of riverwall edges 370 380 # 371 # FIXME:We do this to avoid storing a riverwall_elevation for every edge in the mesh372 # 381 # We do this to avoid storing a riverwall_elevation for every edge in the mesh 382 # However, the data structure ends up being quite complex -- maybe there is a better way? 373 383 # 374 384 # The zeroth index in domain.edge_flux_type which = 1 will correspond to riverwall_elevation[0] … … 383 393 self.hydraulic_properties_rowIndex=\ 384 394 riverwall_rowIndex[riverwallInds].astype(int) 385 # index of edges which are riverwalls [FIXME: Not really needed, can easily back-calculate from edge_flux_type]395 # index of edges which are riverwalls 386 396 self.riverwall_edges=riverwallInds 387 397 … … 389 399 self.names=nw_names 390 400 391 401 392 402 # Now create the hydraulic properties table 393 403 … … 412 422 if((riverwalli_Par is not None) and (riverwalli_Par.has_key(hydraulicVar))): 413 423 if(verbose): 414 print 'Using provided ', hydraulicVar,\415 riverwalli_Par[hydraulicVar], ' for riverwall ', name_riverwalli424 printInfo=printInfo+ ' Using provided '+ str(hydraulicVar)+' '+\ 425 str(riverwalli_Par[hydraulicVar])+ ' for riverwall '+ str(name_riverwalli)+'\n' 416 426 hydraulicTmp[i,j]=riverwalli_Par[hydraulicVar] 417 427 else: 418 428 if(verbose): 419 print 'Using default ', hydraulicVar,\420 default_riverwallPar[hydraulicVar], ' for riverwall ', name_riverwalli429 printInfo=printInfo+ ' Using default '+ str(hydraulicVar)+' '+\ 430 str(default_riverwallPar[hydraulicVar])+' for riverwall '+ str(name_riverwalli)+'\n' 421 431 hydraulicTmp[i,j]=default_riverwallPar[hydraulicVar] 422 432 … … 442 452 # Define the hydraulic properties 443 453 self.hydraulic_properties=hydraulicTmp 444 454 445 455 # Check for riverwall 'connectedness' errors (e.g. theoretically possible 446 456 # to miss an edge due to round-off) 447 self.check_riverwall_connectedness(domain, verbose,tol=tol) 448 449 return() 457 connectedness=self.check_riverwall_connectedness(verbose=verbose) 458 459 self.export_riverwalls_to_text(output_dir=output_dir) 460 461 # Pretty printing of riverwall information in parallel 462 if(verbose): 463 barrier() 464 for i in range(numprocs): 465 if(myid==i): 466 print 'Processor '+str(myid) 467 print printInfo 468 print connectedness[0] 469 msg='Riverwall discontinuity -- possible round-off error in'+\ 470 'finding edges on wall -- try increasing value of tol' 471 if(not connectedness[1]): 472 raise Exception, msg 473 barrier() 474 return 450 475 451 476 ##################################################################################### … … 462 487 ##################################################################################### 463 488 464 def get_vertices_corresponding_to_edgeInds(self, riverwalledgeInds, tol=1.0e-04):489 def get_vertices_corresponding_to_edgeInds(self, riverwalledgeInds, checkCoords=True): 465 490 """ 466 491 Get indices of vertices corresponding to edges at index riverwalledgeInds … … 471 496 """ 472 497 473 domain=self.domain 474 475 riverwallCentInds=self.get_centroids_corresponding_to_edgeInds(riverwalledgeInds) 498 499 #riverwallCentInds=self.get_centroids_corresponding_to_edgeInds(riverwalledgeInds) 476 500 477 501 rwEI_mod3=riverwalledgeInds%3 … … 484 508 riverwallV2Inds=riverwalledgeInds+rwV2_adjustment 485 509 510 if(checkCoords): 511 #################################################### 512 # Check that vertices and edges really do correspond 513 domain=self.domain 514 # X coordinates 515 assert( numpy.allclose( 516 domain.edge_coordinates[riverwalledgeInds,0], 517 0.5*(domain.vertex_coordinates[riverwallV1Inds,0]+domain.vertex_coordinates[riverwallV2Inds,0])) 518 ) 519 # Y coordinates 520 assert( numpy.allclose( 521 domain.edge_coordinates[riverwalledgeInds,1], 522 0.5*(domain.vertex_coordinates[riverwallV1Inds,1]+domain.vertex_coordinates[riverwallV2Inds,1])) 523 ) 524 #################################################### 525 486 526 return riverwallV1Inds, riverwallV2Inds 487 527 488 528 ##################################################################################### 489 490 def check_riverwall_connectedness(self, warn_only=False, verbose=True, tol=1.0e-04): 491 """ 492 We expect riverwalls to be connected [unless they pass over a hole] 493 However, round-off could potentially cause riverwalls to be dis-connected 529 def is_vertex_on_boundary(self, vertexIndices): 530 """ 531 Determine whether a vertex is on the boundary of the domain 532 (i.e. it's connected with an edge that is a boundary edge) 533 534 INPUTS: self -- riverwallData 535 vertexIndices -- indices of vertices on the domain which are on the riverwall 536 537 OUTPUT: 538 TRUE if the vertex is on a domain boundary, FALSE otherwise 539 540 """ 541 domain=self.domain 542 543 # Get edge/vertex indices for boundaries 544 boundary_index_info=domain.boundary.keys() 545 boundary_edges=[ boundary_index_info[i][0]*3+boundary_index_info[i][1] for i in range(len(boundary_index_info))] 546 boundary_edges=numpy.array(boundary_edges) 547 tmp=self.get_vertices_corresponding_to_edgeInds(boundary_edges, checkCoords=False) 548 boundary_vertices=numpy.hstack([tmp[0], tmp[1]]).tolist() 549 550 # Get 'unique' vertex coordinates on boundary 551 node_complex=domain.vertex_coordinates[boundary_vertices,0]+1j*domain.vertex_coordinates[boundary_vertices,1] 552 553 # Get riverwall vertex coordinates as complex numbers (for equality testing) 554 complex_vertex_coords=domain.vertex_coordinates[vertexIndices.tolist(),0]+\ 555 1j*domain.vertex_coordinates[vertexIndices.tolist(),1] 556 557 # Flag telling us if the vertex is on the boundary (1=True, 0=False) 558 isOnBoundary=[ 1 if complex_vertex_coords[i] in node_complex else 0 for i in range(len(complex_vertex_coords))] 559 isOnBoundary=numpy.array(isOnBoundary) 560 561 return isOnBoundary 562 563 ##################################################################################### 564 def check_riverwall_connectedness(self, verbose=True): 565 """ 566 We expect riverwalls to be connected 567 (although they can pass through the bounding polygon several times, especially in parallel) 568 Round-off can potentially cause riverwalls to be dis-connected 494 569 Use this routine to check for that 495 570 496 571 Basically, we search for edges which are connected to vertices which 497 themselves are not connected to other edges 572 themselves are not connected to other edges. We ignore vertices on the domain's bounding-polygon 498 573 499 For a continuous riverwall, this should only occur twice (at the end points) 500 501 Otherwise, the riverwall appears discontinous 574 For a continuous riverwall, there can be at most 2 endpoints inside the domain 575 576 Otherwise, the riverwall is discontinuous, which is an error 577 502 578 """ 503 579 504 580 domain=self.domain 505 581 582 # Preliminary definitions 583 isConnected=True 584 printInfo='' 585 506 586 if(len(self.names)==0): 507 print 'There are no riverwalls' 508 return 587 if(verbose): 588 printInfo=printInfo+' There are no riverwalls (P'+str(myid)+')\n' 589 return [printInfo, isConnected] 509 590 510 591 # Shorthand notation 511 592 rwd=self 512 593 513 594 for i, name in enumerate(rwd.names): 514 595 # Get indices of edges on this riverwall 515 596 riverwalledgeInds=rwd.riverwall_edges[(rwd.hydraulic_properties_rowIndex==i).nonzero()[0]] 516 # Get their corresponding centroids 517 riverwallCentInds=rwd.get_centroids_corresponding_to_edgeInds(riverwalledgeInds) 597 598 if(len(riverwalledgeInds)==0): 599 printInfo=printInfo+'Riverwall '+name+' was not found on this mesh (if this is wrong, adjust tol in create_riverwalls)\n' 600 continue 518 601 # Get their corresponding vertices 519 riverwallV1Inds, riverwallV2Inds = rwd.get_vertices_corresponding_to_edgeInds(riverwalledgeInds, tol=tol) 602 riverwallV1Inds, riverwallV2Inds = rwd.get_vertices_corresponding_to_edgeInds(riverwalledgeInds) 603 604 # Flag telling us if vertex points are on the boundary of the model 605 # Used to help detect disconnected riverwalls (due to round-off) 606 v1_on_boundary=rwd.is_vertex_on_boundary(riverwallV1Inds) 607 v2_on_boundary=rwd.is_vertex_on_boundary(riverwallV2Inds) 520 608 521 609 # With discontinuous triangles, we expect edges to occur twice … … 539 627 # Finally, get 'unqiue' edges in the riverwall 540 628 uEdges=riverwalledgeInds[unique_riverwall_edge_indices] 541 #uCentroids=riverwallCentInds[unique_riverwall_edge_indices]542 629 uV1=riverwallV1Inds[unique_riverwall_edge_indices] 543 630 uV2=riverwallV2Inds[unique_riverwall_edge_indices] 631 uV1_boundary=v1_on_boundary[unique_riverwall_edge_indices] 632 uV2_boundary=v2_on_boundary[unique_riverwall_edge_indices] 544 633 545 634 # Next, count how many times each vertex value occurs. 546 # For a 'connected' riverwall, we only want 2 edges where a vertex occurs only once. 635 # For a 'connected' riverwall, we only want 2 edges where a vertex occurs only once, 636 # unless the vertex is on the boundary of the domain 547 637 lure=len(uEdges) 548 638 complex_v1_coordinates=domain.vertex_coordinates[uV1,0]+\ … … 558 648 (complex_v2_coordinates==complex_v2_coordinates[j]).sum() 559 649 560 num_disconnected_edges=(v1Counter==1).sum()+(v2Counter==1).sum() 561 650 num_disconnected_edges=((v1Counter==1)*(1-uV1_boundary)).sum()+\ 651 ((v2Counter==1)*(1-uV2_boundary)).sum() 652 562 653 if(verbose): 563 print 'There are ', num_disconnected_edges, ' vertices with only 1 connection on riverwall ', name 564 565 if(num_disconnected_edges==0): 566 print 'Riverwall '+name+' is not on this mesh [typical for a sub-mesh in parallel]' 567 elif(num_disconnected_edges==2): 654 printInfo=printInfo+ ' On riverwall '+ str(name) +' there are '+ str(num_disconnected_edges)+\ 655 ' endpoints inside the domain [ignoring points on the boundary polygon] (P'+str(myid)+')\n' 656 657 if(num_disconnected_edges<=2): 568 658 if(verbose): 569 p rint " That's Good, it means the wall is continuous"570 print ' '659 pass 660 #printInfo=printInfo+ " This is consistent with a continuous wall \n" 571 661 else: 572 msg='Riverwall ' + name +', appears to be discontinuous, possibly due to round-off issues,'+\ 573 ' be careful [try adjusting tol, or use warn_only=True to avoid error] ' 574 if(warn_only): 575 print msg 576 else: 577 raise Exception, msg 662 isConnected=False 663 printInfo=printInfo+' Riverwall ' + name +' appears to be discontinuous. (P'+str(myid)+')\n'+\ 664 ' This suggests there is a gap in the wall, which should not occur\n' 665 666 return [printInfo, isConnected] 667 668 ################################################################### 669 670 def export_riverwalls_to_text(self, output_dir=None): 671 """ 672 Function for dumping riverwall outputs to text file (useful for QC) 673 674 This will overwrite any existing files with the same location/name 675 676 INPUT: output_dir = Directory where the outputs will be written 677 678 OUTPUT: 679 None, but writes files as a side effect 680 681 """ 682 if(output_dir is None): 683 return 684 685 if(myid==0): 686 # Make output directory 687 try: 688 os.mkdir(output_dir) 689 except: 690 pass 691 # Make output files with empty contents 692 for i, riverWallFile in enumerate(self.names): 693 newFile=open(output_dir+'/'+riverWallFile+'.txt','w') 694 # Write hydraulic variable information 695 hydraulicVars=self.hydraulic_properties[i,:] 696 newFile.write('## Hydraulic Variable values below ## \n') 697 newFile.write(str(self.hydraulic_variable_names)+'\n') 698 newFile.write(str(hydraulicVars)+'\n') 699 newFile.write('\n') 700 newFile.write('## xyElevation at edges below. Order may be erratic for parallel runs ##\n') 701 newFile.close() 702 else: 703 pass 704 705 # Files must be created before writing out 706 barrier() 707 708 domain=self.domain 709 # Now dump the required info to the files 710 for i in range(numprocs): 711 # Write 1 processor at a time 712 if(myid==i): 713 for j, riverWallname in enumerate(self.names): 714 # Get xyz data for riverwall j 715 riverWallInds=(self.hydraulic_properties_rowIndex==j).nonzero()[0].tolist() 716 riverWallDomainInds=self.riverwall_edges[riverWallInds].tolist() 717 myXCoords=domain.edge_coordinates[riverWallDomainInds,0]+domain.geo_reference.xllcorner 718 myYCoords=domain.edge_coordinates[riverWallDomainInds,1]+domain.geo_reference.yllcorner 719 myElev=self.riverwall_elevation[riverWallInds] 720 721 # Open file for appending data 722 theFile=open(output_dir+'/'+riverWallname+'.txt','a') 723 for k in range(len(myElev)): 724 theFile.write(str(myXCoords[k])+','+str(myYCoords[k])+','+str(myElev[k])+'\n') 725 theFile.close() 726 727 else: 728 pass 729 730 barrier() 578 731 579 732 return 580 -
trunk/anuga_core/source/anuga/structures/test_riverwall_structure.py
r9125 r9225 37 37 pass 38 38 39 def create_domain_DE0(self, wallHeight, InitialOceanStage, InitialLandStage ):39 def create_domain_DE0(self, wallHeight, InitialOceanStage, InitialLandStage, riverWall=None, riverWall_Par=None): 40 40 # Riverwall = list of lists, each with a set of x,y,z (and optional QFactor) values 41 riverWall={ 'centralWall': 42 [ [wallLoc, 0.0, wallHeight], 43 [wallLoc, 100.0, wallHeight]] 44 } 45 riverWall_Par={'centralWall':{'Qfactor':1.0}} 41 42 if(riverWall is None): 43 riverWall={ 'centralWall': 44 [ [wallLoc, 0.0, wallHeight], 45 [wallLoc, 100.0, wallHeight]] 46 } 47 if(riverWall_Par is None): 48 riverWall_Par={'centralWall':{'Qfactor':1.0}} 46 49 # Make the domain 47 50 anuga.create_mesh_from_regions(boundaryPolygon, … … 491 494 assert numpy.allclose(landVol,theoretical_flux_vol, rtol=1.0e-03) 492 495 493 494 496 def test_riverwall_includes_specified_points_in_domain(self): 497 """ 498 Check that all domain points that should be on the riverwall 499 actually are, and that there are no 'non-riverwall' points on the riverwall 500 """ 501 wallHeight=-0.2 502 InitialOceanStage=-0.3 503 InitialLandStage=-999999. 504 505 domain=self.create_domain_DE1(wallHeight,InitialOceanStage, InitialLandStage) 506 507 edgeInds_on_wall=domain.riverwallData.riverwall_edges.tolist() 508 509 riverWall_x_coord=domain.edge_coordinates[edgeInds_on_wall,0]-wallLoc 510 511 assert(numpy.allclose(riverWall_x_coord,0.)) 512 513 # Now check that all the other domain edge coordinates are not on the wall 514 # Note the threshold requires a sufficiently coarse mesh 515 notriverWall_x_coord=numpy.delete(domain.edge_coordinates[:,0], edgeInds_on_wall) 516 assert(min(abs(notriverWall_x_coord-wallLoc))>1.0e-01) 517 518 def test_is_vertex_on_boundary(self): 519 """ 520 Check that is_vertex_on_boundary is working as expected 521 """ 522 wallHeight=-0.2 523 InitialOceanStage=-0.3 524 InitialLandStage=-999999. 525 526 domain=self.create_domain_DE1(wallHeight,InitialOceanStage, InitialLandStage) 527 528 allVertices=numpy.array(range(len(domain.vertex_coordinates))) 529 boundaryFlag=domain.riverwallData.is_vertex_on_boundary(allVertices) 530 boundaryVerts=boundaryFlag.nonzero()[0].tolist() 531 532 # Check that all boundary vertices are on the boundary 533 check2=(domain.vertex_coordinates[boundaryVerts,0]==0.)+\ 534 (domain.vertex_coordinates[boundaryVerts,0]==100.)+\ 535 (domain.vertex_coordinates[boundaryVerts,1]==100.)+\ 536 (domain.vertex_coordinates[boundaryVerts,1]==0.) 537 538 assert(all(check2>0.)) 539 540 # Check that all non-boundary vertices are not 541 nonboundaryVerts=(boundaryFlag==0).nonzero()[0].tolist() 542 check2=(domain.vertex_coordinates[nonboundaryVerts,0]==0.)+\ 543 (domain.vertex_coordinates[nonboundaryVerts,0]==100.)+\ 544 (domain.vertex_coordinates[nonboundaryVerts,1]==100.)+\ 545 (domain.vertex_coordinates[nonboundaryVerts,1]==0.) 546 547 assert(all(check2==0)) 548 549 def test_multiple_riverwalls(self): 550 """ 551 Testcase with multiple riverwalls -- check all is working as required 552 553 Idea -- add other riverwalls with different Qfactor / height. 554 Set them up to have no hydraulic effect, but 555 so that we are likely to catch bugs if the code is not right 556 """ 557 wallHeight=2. 558 InitialOceanStage=2.50 559 InitialLandStage=-999999. 560 561 562 riverWall={ 'awall1': 563 [ [wallLoc+20., 0.0, -9999.], 564 [wallLoc+20., 100.0, -9999.]], 565 'centralWall': 566 [ [wallLoc, 0.0, wallHeight], 567 [wallLoc, 100.0, wallHeight]] , 568 'awall2': 569 [ [wallLoc-20., 0.0, 30.], 570 [wallLoc-20., 100.0, 30.]], 571 } 572 573 newQfac=2.0 574 riverWall_Par={'centralWall':{'Qfactor':newQfac}, 'awall1':{'Qfactor':100.}, 'awall2':{'Qfactor':0.}} 575 576 domain=self.create_domain_DE0(wallHeight,InitialOceanStage, InitialLandStage, riverWall=riverWall,riverWall_Par=riverWall_Par) 577 578 579 domain.riverwallData.create_riverwalls(riverWall,riverWall_Par,verbose=verbose) 580 581 # Run the model for a few fractions of a second 582 # Any longer, and the evolution of stage starts causing 583 # significant changes to the flow 584 yst=1.0e-04 585 ft=1.0e-03 586 for t in domain.evolve(yieldstep=yst,finaltime=ft): 587 if(verbose): 588 print domain.timestepping_statistics() 589 590 # Compare with theoretical result 591 L= 100. # Length of riverwall 592 H=InitialOceanStage-wallHeight # Upstream head 593 dt=ft 594 theoretical_flux_vol=newQfac*dt*L*2./3.*H*(2./3.*g*H)**0.5 595 596 # Indices landward of the riverwall 597 landInds=(domain.centroid_coordinates[:,0]<50.).nonzero()[0] 598 # Compute volume of water landward of riverwall 599 landVol=domain.quantities['height'].centroid_values[landInds]*domain.areas[landInds] 600 landVol=landVol.sum() 601 602 if(verbose): 603 print 'Land Vol: ', landVol, 'theoretical vol: ', theoretical_flux_vol 604 605 assert numpy.allclose(landVol,theoretical_flux_vol, rtol=1.0e-03) 606 495 607 # ========================================================================= 496 608 if __name__ == "__main__": -
trunk/anuga_core/validation_tests/behaviour_only/weir_1/runup.py
r9224 r9225 7 7 8 8 import numpy 9 from anuga import myid, finalize, distribute 9 from anuga import myid, finalize, distribute, barrier 10 10 11 11 from math import exp … … 98 98 domain = distribute(domain) 99 99 100 101 100 domain.riverwallData.create_riverwalls(riverWall, riverWall_Par) 102 101 -
trunk/anuga_work/development/gareth/tests/levee/channel_levee.py
r9105 r9225 154 154 # 155 155 print 'Setting riverwall elevations & hydraulic parameters' 156 domain.riverwallData.create_riverwalls(riverWalls,riverWallPar )156 domain.riverwallData.create_riverwalls(riverWalls,riverWallPar, output_dir='riverwall_text') 157 157 158 158 # Define inlet operator
Note: See TracChangeset
for help on using the changeset viewer.