Changeset 3588
- Timestamp:
- Sep 14, 2006, 9:47:59 AM (19 years ago)
- Location:
- anuga_core/source/anuga_parallel
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga_parallel/parallel_api.py
r3586 r3588 50 50 extract_hostmesh(submesh, triangles_per_proc) 51 51 52 # Return st uff52 # Return structures necessary for building the parallel domain 53 53 return points, vertices, boundary, quantities, \ 54 54 ghost_recv_dict, full_send_dict -
anuga_core/source/anuga_parallel/test_parallel_sw_runup.py
r3587 r3588 19 19 from anuga.shallow_water import Transmissive_boundary 20 20 21 from parallel_api import * 22 21 23 22 24 #------------------------------------------------------------------------------ 23 # Setup computational domain25 # Initialise 24 26 #------------------------------------------------------------------------------ 25 27 26 points, vertices, boundary = rectangular_cross(10, 10) # Basic mesh 28 if myid == 0: 29 #-------------------------------------------------------------------------- 30 # Setup computational domain 31 #-------------------------------------------------------------------------- 27 32 28 domain = Domain(points, vertices, boundary) # Create domain 29 domain.set_name('runup') # Output to bedslope.sww 33 points, vertices, boundary = rectangular_cross(20, 20) # Basic mesh 34 35 domain = Domain(points, vertices, boundary) # Create domain 36 domain.set_name('runup') # Set sww filename 37 38 39 #------------ ------------------------------------------------------------- 40 # Setup initial conditions 41 #-------------------------------------------------------------------------- 42 43 def topography(x,y): 44 return -x/2 # linear bed slope 45 46 domain.set_quantity('elevation', topography) # Use function for elevation 47 domain.set_quantity('friction', 0.1) # Constant friction 48 domain.set_quantity('stage', -.4) # Constant initial stage 49 50 51 #-------------------------------------------------------------------------- 52 # Setup boundary conditions 53 #-------------------------------------------------------------------------- 54 55 Br = Reflective_boundary(domain) # Solid reflective wall 56 Bd = Dirichlet_boundary([-0.2,0.,0.]) # Constant boundary values 57 58 # Associate boundary tags with boundary objects 59 domain.set_boundary({'left': Br, 'right': Bd, 'top': Br, 'bottom': Br}) 60 61 62 #------------------------------------------------------------------------------ 63 # Parallel stuff 64 #------------------------------------------------------------------------------ 65 66 if myid == 0: 67 # Distribute the domain 68 points, vertices, boundary, quantities, ghost_recv_dict, full_send_dict,\ 69 = distribute_mesh(domain) 70 print 'Communication done' 71 72 else: 73 # Read in the mesh partition that belongs to this 74 # processor (note that the information is in the 75 # correct form for the GA data structure) 76 77 points, vertices, boundary, quantities, ghost_recv_dict, full_send_dict, \ 78 = rec_submesh(0) 79 80 81 82 #------------------------------------------------------------------------------ 83 # Start the computations on each subpartion 84 #------------------------------------------------------------------------------ 85 86 # Build the domain for this processor 87 domain = Parallel_Domain(points, vertices, boundary, 88 full_send_dict = full_send_dict, 89 ghost_recv_dict = ghost_recv_dict) 90 91 92 # Name and dir, etc currently has to be set here as they are not 93 # transferred from the original domain 94 domain.set_name('runup') # Set sww filename 30 95 31 96 … … 33 98 # Setup initial conditions 34 99 #------------------------------------------------------------------------------ 35 36 def topography(x,y): 37 return -x/2 # linear bed slope 38 #return x*(-(2.0-x)*.5) # curved bed slope 39 40 domain.set_quantity('elevation', topography) # Use function for elevation 41 domain.set_quantity('friction', 0.1) # Constant friction 42 domain.set_quantity('stage', -.4) # Constant negative initial stage 100 for q in quantities: 101 domain.set_quantity(q, quantities[q]) # Distribute all quantities 43 102 44 103 45 104 #------------------------------------------------------------------------------ 46 # Setup boundary conditions105 # Setup parallel boundary conditions 47 106 #------------------------------------------------------------------------------ 48 107 49 from math import sin, pi, exp50 108 Br = Reflective_boundary(domain) # Solid reflective wall 51 Bt = Transmissive_boundary(domain) # Continue all values on boundary52 109 Bd = Dirichlet_boundary([-0.2,0.,0.]) # Constant boundary values 53 Bw = Time_boundary(domain=domain, # Time dependent boundary54 f=lambda t: [(.1*sin(t*2*pi)-0.3) * exp(-2*t), 0.0, 0.0])55 110 56 111 # Associate boundary tags with boundary objects 57 domain.set_boundary({'left': Br, 'right': Bd, 'top': Br, 'bottom': Br}) 112 domain.set_boundary({'left': Br, 'right': Bd, 'top': Br, 'bottom': Br, 113 'ghost': None, 'exterior': Bd}) 114 58 115 59 116
Note: See TracChangeset
for help on using the changeset viewer.