Changeset 3589
- Timestamp:
- Sep 14, 2006, 10:00:44 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga_parallel/test_parallel_sw_runup.py
r3588 r3589 21 21 from parallel_api import * 22 22 23 #------------------------------------------------------------------------------ 24 # Read in processor information 25 #------------------------------------------------------------------------------ 26 27 numprocs = pypar.size() 28 myid = pypar.rank() 29 processor_name = pypar.Get_processor_name() 30 print 'I am processor %d of %d on node %s' %(myid, numprocs, processor_name) 31 23 32 24 33 #------------------------------------------------------------------------------ … … 31 40 #-------------------------------------------------------------------------- 32 41 33 points, vertices, boundary = rectangular_cross( 20, 20) # Basic mesh42 points, vertices, boundary = rectangular_cross(10, 10) # Basic mesh 34 43 35 44 domain = Domain(points, vertices, boundary) # Create domain … … 49 58 50 59 60 #------------ ------------------------------------------------------------- 61 # Distribute the domain 51 62 #-------------------------------------------------------------------------- 52 # Setup boundary conditions 53 #-------------------------------------------------------------------------- 63 64 # Subdivide the mesh 65 print 'Subdivide mesh' 66 nodes, triangles, boundary, triangles_per_proc, quantities = \ 67 pmesh_divide_metis(domain, numprocs) 54 68 55 Br = Reflective_boundary(domain) # Solid reflective wall 56 Bd = Dirichlet_boundary([-0.2,0.,0.]) # Constant boundary values 69 # Build the mesh that should be assigned to each processor, 70 # this includes ghost nodes and the communicaiton pattern 71 print 'Build submeshes' 72 submesh = build_submesh(nodes, triangles, boundary,\ 73 quantities, triangles_per_proc) 57 74 58 # Associate boundary tags with boundary objects 59 domain.set_boundary({'left': Br, 'right': Bd, 'top': Br, 'bottom': Br}) 75 # Send the mesh partition to the appropriate processor 76 print 'Distribute submeshes' 77 for p in range(1, numprocs): 78 send_submesh(submesh, triangles_per_proc, p) 60 79 80 # Build the local mesh for processor 0 81 points, vertices, boundary, quantities, ghost_recv_dict, full_send_dict = \ 82 extract_hostmesh(submesh, triangles_per_proc) 61 83 62 #------------------------------------------------------------------------------63 # Parallel stuff64 #------------------------------------------------------------------------------65 66 if myid == 0:67 # Distribute the domain68 points, vertices, boundary, quantities, ghost_recv_dict, full_send_dict,\69 = distribute_mesh(domain)70 84 print 'Communication done' 71 85 … … 102 116 103 117 118 104 119 #------------------------------------------------------------------------------ 105 120 # Setup parallel boundary conditions
Note: See TracChangeset
for help on using the changeset viewer.