Changeset 3829
- Timestamp:
- Oct 19, 2006, 6:21:11 PM (18 years ago)
- Files:
-
- 1 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/documentation/user_manual/anuga_user_manual.tex
r3764 r3829 772 772 if domain.get_quantity('stage').get_values(interpolation_points=[[10, 2.5]]) > 0: 773 773 print 'Stage > 0: Changing to outflow boundary' 774 domain. modify_boundary({'right': Bo})774 domain.set_boundary({'right': Bo}) 775 775 \end{verbatim}} 776 776 … … 781 781 replaced by the outflow boundary using the method 782 782 {\small \begin{verbatim} 783 domain. modify_boundary({'right': Bo})783 domain.set_boundary({'right': Bo}) 784 784 \end{verbatim}} 785 785 This type of dynamically varying boundary could for example be used to model the -
anuga_core/documentation/user_manual/examples/channel2.py
r3754 r3829 58 58 get_values(interpolation_points=[[10, 2.5]]) > 0: 59 59 print 'Stage > 0: Changing to outflow boundary' 60 domain. modify_boundary({'right': Bo})60 domain.set_boundary({'right': Bo}) 61 61 62 62 -
anuga_core/documentation/user_manual/examples/channel3.py
r3754 r3829 81 81 get_values(interpolation_points=[[10, 2.5]]) > 0: 82 82 print 'Stage > 0: Changing to outflow boundary' 83 domain. modify_boundary({'right': Bo})83 domain.set_boundary({'right': Bo}) -
anuga_core/source/anuga/abstract_2d_finite_volumes/domain.py
r3817 r3829 359 359 """ 360 360 361 from anuga.abstract_2d_finite_volumes.util import apply_expression_to_dictionary 361 from anuga.abstract_2d_finite_volumes.util import\ 362 apply_expression_to_dictionary 363 362 364 return apply_expression_to_dictionary(expression, self.quantities) 363 365 364 366 365 367 366 def modify_boundary(self, boundary_map): 367 """Modify existing boundary by elements in boundary map 368 369 Input: 370 371 boundary_map: Dictionary mapping tags to boundary objects 372 373 See set_boundary for more details on how this works 374 """ 375 376 for key in boundary_map.keys(): 377 self.boundary_map[key] = boundary_map[key] 378 379 self.set_boundary(self.boundary_map) 368 #def modify_boundary(self, boundary_map): 369 # """Modify existing boundary by elements in boundary map# 370 # 371 # Input:# 372 # 373 # boundary_map: Dictionary mapping tags to boundary objects 374 # 375 # See set_boundary for more details on how this works 376 # 377 # OBSOLETE 378 # """ 379 # 380 # for key in boundary_map.keys(): 381 # self.boundary_map[key] = boundary_map[key] 382 # 383 # self.set_boundary(self.boundary_map) 380 384 381 385 … … 421 425 Boundary objects that are None will be skipped. 422 426 427 If a boundary_map has already been set 428 (i.e. set_boundary has been called before), the old boundary map 429 will be updated with new values. The new map need not define all 430 boundary tags, and can thus change only those that are needed. 431 423 432 FIXME: If set_boundary is called multiple times and if Boundary 424 433 object is changed into None, the neighbour structure will not be … … 428 437 """ 429 438 430 self.boundary_objects = [] 431 self.boundary_map = boundary_map #Store for use with eg. boundary_stats. 432 439 if self.boundary_map is None: 440 # This the first call to set_boundary. Store 441 # map for later updates and for use with boundary_stats. 442 self.boundary_map = boundary_map 443 else: 444 # This is a modification of an already existing map 445 # Update map an proceed normally 446 447 for key in boundary_map.keys(): 448 self.boundary_map[key] = boundary_map[key] 449 450 433 451 #FIXME: Try to remove the sorting and fix test_mesh.py 434 452 x = self.boundary.keys() … … 437 455 #Loop through edges that lie on the boundary and associate them with 438 456 #callable boundary objects depending on their tags 457 self.boundary_objects = [] 439 458 for k, (vol_id, edge_id) in enumerate(x): 440 459 tag = self.boundary[ (vol_id, edge_id) ] 441 460 442 if boundary_map.has_key(tag):443 B = boundary_map[tag] #Get callable boundary object461 if self.boundary_map.has_key(tag): 462 B = self.boundary_map[tag] #Get callable boundary object 444 463 445 464 if B is not None: 446 465 self.boundary_objects.append( ((vol_id, edge_id), B) ) 447 self.neighbours[vol_id, edge_id] = -len(self.boundary_objects) 466 self.neighbours[vol_id, edge_id] = \ 467 -len(self.boundary_objects) 448 468 else: 449 469 pass -
anuga_core/source/anuga/examples/beach_parallel.py
r3773 r3829 131 131 132 132 Bt = Time_boundary(domain, lambda t: [ 4.0*(1+sin(2*pi*t/50)), -1.0, 0.0]) 133 domain. modify_boundary({'ocean': Bt})133 domain.set_boundary({'ocean': Bt}) 134 134 135 135 #---------------------- -
anuga_core/source/anuga/shallow_water/test_shallow_water_domain.py
r3819 r3829 909 909 # Update boundary to allow inflow 910 910 #-------------------------------------------------------------- 911 domain. modify_boundary({'right': Bd})911 domain.set_boundary({'right': Bd}) 912 912 913 913 -
anuga_core/source/anuga_parallel/test_parallel_sw_runup.py
r3818 r3829 28 28 from anuga.shallow_water import Transmissive_boundary 29 29 30 from parallel_api import distribute, myid 30 from parallel_api import distribute, myid, numprocs 31 31 32 32 … … 36 36 points, vertices, boundary = rectangular_cross(10, 10) # Basic mesh 37 37 domain = Domain(points, vertices, boundary) # Create domain 38 domain.set_name('runup') # Set sww filename39 domain.set_datadir('.') # Set output dir40 41 38 42 39 #-------------------------------------------------------------------------- … … 58 55 domain = distribute(domain, verbose=True) 59 56 57 domain.set_name('runup') # Set sww filename 58 domain.set_datadir('.') # Set output dir 59 domain.set_maximum_allowed_speed(100) # 60 60 61 61 62 #------------------------------------------------------------------------------ 62 # Setup boundary conditions (MUST currently happen after domain has been distributed) 63 # Setup boundary conditions 64 # This must currently happen *after* domain has been distributed 63 65 #------------------------------------------------------------------------------ 64 66 … … 67 69 68 70 # Associate boundary tags with boundary objects 69 domain.modify_boundary({'left': Br, 'right': Bd, 'top': Br, 'bottom': Br}) 71 domain.set_boundary({'left': Br, 'right': Bd, 'top': Br, 'bottom': Br}) 72 70 73 71 74 … … 85 88 # Need to get true boundary somehow 86 89 87 print 'P%d: point=[%f,%f]' %(myid, point[0], point[1])90 #print 'P%d: point=[%f,%f]' %(myid, point[0], point[1]) 88 91 local_interpolation_points.append(i) 92 93 # Hack 94 if numprocs == 2: 95 if myid == 0: 96 del local_interpolation_points[0] 97 #local_interpolation_points = [1,2,3] 98 99 if numprocs == 3: 100 if myid == 1: 101 del local_interpolation_points[0] 102 103 104 if numprocs == 4: 105 if myid == 0: 106 del local_interpolation_points[1] #2 107 del local_interpolation_points[1] #3 108 if myid == 3: 109 del local_interpolation_points[1] 110 111 112 113 print 'P%d has points = %s' %(myid, local_interpolation_points) 89 114 90 115 -
anuga_validation/okushiri_2005/okushiri_parallel.py
r3785 r3829 29 29 #------------------------- 30 30 domain = Domain(project.mesh_filename, use_cache=True, verbose=True) 31 domain.set_name('okushiri_parallel')32 domain.set_minimum_storable_height(0.001)33 domain.set_default_order(2)34 print domain.statistics()35 36 31 37 32 #------------------------- … … 46 41 use_cache = True) 47 42 48 #-------------------------49 # Boundary Conditions50 #-------------------------51 Br = Reflective_boundary(domain)52 53 domain.set_boundary({'wave': None, # Bind this one later54 'wall': Br})55 56 43 57 44 #------------------------- … … 60 47 domain = distribute(domain) 61 48 49 # Parameters 50 domain.set_name('okushiri_parallel') 51 domain.set_minimum_storable_height(0.001) 52 domain.set_default_order(2) 53 domain.set_maximum_allowed_speed(0.1) # Allow a little runoff (0.1 is OK) 62 54 63 # Bind boundary, that cannot be fully specified before distribution. 55 # Set old (pre Sep 2006) defaults for limiters 56 domain.beta_w = 0.9 57 domain.beta_w_dry = 0.9 58 domain.beta_uh = 0.9 59 domain.beta_uh_dry = 0.9 60 domain.beta_vh = 0.9 61 domain.beta_vh_dry = 0.9 62 63 64 #------------------------------------------------------------------------------ 65 # Setup boundary conditions 66 # (MUST currently happen after domain has been distributed) 67 #------------------------------------------------------------------------------ 68 69 Br = Reflective_boundary(domain) # Solid reflective wall 70 64 71 function = file_function(project.boundary_filename[:-4] + '.tms', 65 72 domain, … … 67 74 68 75 Bts = Transmissive_Momentum_Set_Stage_boundary(domain, function) 69 domain.modify_boundary({'wave': Bts}) 76 77 domain.set_boundary({'wave': Bts, # Bind this one later 78 'wall': Br}) 70 79 71 80 -
anuga_work/production/dampier_2006/run_dampier_parallel.py
r3802 r3829 174 174 Bf = File_boundary(source_dir + project.boundary_basename + '.sww', 175 175 domain, verbose = True) 176 domain. modify_boundary({'ocean': Bf})176 domain.set_boundary({'ocean': Bf}) 177 177 178 178 -
anuga_work/production/wollongong_2006/run_flagstaff_parallel_api.py
r3631 r3829 105 105 f=lambda t: [project.initial_sealevel + (60<t<480)*6, 0, 0]) 106 106 107 domain. modify_boundary({'ocean': W})107 domain.set_boundary({'ocean': W}) 108 108 109 109
Note: See TracChangeset
for help on using the changeset viewer.