Changeset 2654
- Timestamp:
- Apr 4, 2006, 10:15:01 AM (18 years ago)
- Location:
- inundation/parallel
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/parallel/run_parallel_advection.py
r2625 r2654 10 10 import pypar 11 11 12 from config import g, epsilon13 from Numeric import allclose, array, zeros, ones, Float 12 from print_stats import print_test_stats, build_full_flag 13 14 14 from parallel_meshes import parallel_rectangle 15 15 16 from advection import Domain17 16 from parallel_advection import Parallel_Domain 18 from parallel_advection import Transmissive_boundary , Dirichlet_boundary17 from parallel_advection import Transmissive_boundary 19 18 20 numprocs = pypar.size() 21 myid = pypar.rank() 22 processor_name = pypar.Get_processor_name() 23 24 25 #N = 50 26 N = 20 27 M = 20 28 29 points, vertices, boundary, full_send_dict, ghost_recv_dict = \ 30 parallel_rectangle(N, M, len1_g=1.0) 31 32 #Create advection domain with direction (1,-1) 33 domain = Parallel_Domain(points, vertices, boundary, 34 full_send_dict, ghost_recv_dict, velocity=[1.0, 0.0]) 35 36 # Initial condition is zero by default 37 38 #turn on the visualisation 39 rect = [0.0, 0.0, 1.0, 1.0] 40 domain.initialise_visualiser(rect=rect) 41 42 #Boundaries 43 T = Transmissive_boundary(domain) 44 D = Dirichlet_boundary(array([1.0])) 45 46 domain.default_order = 2 47 48 domain.set_boundary( {'left': T, 'right': T, 'bottom': T, 'top': T, 'ghost': None} ) 49 domain.check_integrity() 19 # Define the inititial conditions 50 20 51 21 class Set_Stage: … … 61 31 return self.h*((x>self.x0)&(x<self.x1)) 62 32 33 # Get information about the parallel set-up 34 35 numprocs = pypar.size() 36 myid = pypar.rank() 37 processor_name = pypar.Get_processor_name() 38 39 N = 20 40 M = 20 41 42 # Build 1*1 domain containing M*N nodes split over numprocs * 1 processors 43 44 points, vertices, boundary, full_send_dict, ghost_recv_dict = \ 45 parallel_rectangle(N, M, len1_g=1.0) 46 47 # Create advection domain with direction (1,-1) 48 # Initial condition is zero by default 49 50 domain = Parallel_Domain(points, vertices, boundary, 51 full_send_dict, ghost_recv_dict, velocity=[1.0, 0.0]) 52 53 # Make a notes of which triangles are full and which are ghost 54 55 tri_full_flag = build_full_flag(domain, ghost_recv_dict) 56 57 # Turn on the visualisation 58 59 rect = [0.0, 0.0, 1.0, 1.0] 60 domain.initialise_visualiser(rect=rect) 61 62 # Boundaries 63 64 T = Transmissive_boundary(domain) 65 domain.default_order = 2 66 domain.set_boundary( {'left': T, 'right': T, 'bottom': T, 'top': T, 'ghost': None} ) 67 68 # Ensure that the domain definitions make sense 69 70 domain.check_integrity() 71 72 # Set the inititial conditions 73 63 74 domain.set_quantity('stage', Set_Stage(0.2,0.4,1.0)) 75 76 # Let processor 0 output some timing information 64 77 65 78 if myid == 0: … … 67 80 t0 = time.time() 68 81 69 #Check that the boundary value gets propagated to all elements 82 # Start the parallel computions 83 70 84 for t in domain.evolve(yieldstep = 0.1, finaltime = 3.0): 71 85 if myid == 0: 72 86 domain.write_time() 87 print_test_stats(domain, tri_full_flag) 88 89 # Output some computation statistics 73 90 74 91 if myid == 0: -
inundation/parallel/run_parallel_merimbula.py
r2625 r2654 47 47 #from shallow_water import Domain 48 48 49 from print_stats import print_test_stats, build_full_flag 50 49 51 from pmesh2domain import pmesh_to_domain_instance 50 52 from advection import Domain as Advection_Domain … … 52 54 53 55 from generic_boundary_conditions import Transmissive_boundary 56 54 57 # mesh partition routines 55 58 … … 133 136 velocity = [0.1,0.0]) 134 137 138 # Make a notes of which triangles are full and which are ghost 139 140 tri_full_flag = build_full_flag(domain, ghost_recv_dict) 141 135 142 #domain.initialise_visualiser(rect=rect) 136 143 … … 169 176 if myid == 0: 170 177 domain.write_time() 171 ## Stage = domain.quantities['stage'] 172 ## max_stage = max(max(Stage.edge_values)) 173 ## print max_stage 174 ## if max_stage > 4.0: 175 ## print "######################", max_stage 178 print_test_stats(domain, tri_full_flag) 176 179 177 180 if myid == 0: -
inundation/parallel/run_parallel_sw_merimbula.py
r2152 r2654 42 42 sys.path.append('..'+sep+'pyvolution') 43 43 44 # Print debugging information 45 46 from print_stats import print_test_stats, build_full_flag 47 44 48 # Numeric arrays 45 49 … … 191 195 print 'No visualiser' 192 196 197 # Make a note of which triangles are full and which are ghost 198 199 tri_full_flag = build_full_flag(domain, ghost_recv_dict) 193 200 194 201 domain.default_order = 1 … … 199 206 T = Transmissive_boundary(domain) 200 207 R = Reflective_boundary(domain) 201 domain.set_boundary( {'outflow': R, 'inflow': R, 'inner':R, 'exterior': R, 'open':R } )208 domain.set_boundary( {'outflow': R, 'inflow': R, 'inner':R, 'exterior': R, 'open':R, 'ghost':None} ) 202 209 203 210 … … 222 229 if myid == 0: 223 230 domain.write_time() 224 #print 'Processor %d, Integral of stage %d'%\ 225 # (domain.processor,domain.quantities['stage'].get_integral()) 226 227 228 #print 'P%d: That took %.2f seconds' %(myid, time.time()-t0) 229 #print 'P%d: Communication time %.2f seconds' %(myid, domain.communication_time) 230 #print 'P%d: Reduction Communication time %.2f seconds' %(myid, domain.communication_reduce_time) 231 #print 'P%d: Broadcast time %.2f seconds' %(myid, domain.communication_broadcast_time) 231 print_test_stats(domain, tri_full_flag) 232 232 233 233 234 -
inundation/parallel/run_parallel_sw_merimbula_metis.py
r2198 r2654 49 49 from Numeric import array, zeros, Float 50 50 51 # Print debugging information 52 53 from print_stats import print_test_stats, build_full_flag 54 51 55 # pmesh 52 56 … … 171 175 ghost_recv_dict = ghost_recv_dict) 172 176 177 # Make a note of which triangles are full and which are ghost 178 179 tri_full_flag = build_full_flag(domain, ghost_recv_dict) 173 180 174 181 #try: … … 218 225 #print 'Processor %d, Integral of stage %d'%\ 219 226 # (domain.processor,domain.quantities['stage'].get_integral()) 227 # print_test_stats(domain, tri_full_flag) 228 220 229 221 230 # Profiling … … 230 239 if myid == 0: 231 240 domain.write_time() 241 print_test_stats(domain, tri_full_flag) 242 232 243 ''' 233 244 result = profiler.runctx(s, globals(), locals()) -
inundation/parallel/run_parallel_sw_rectangle.py
r2625 r2654 25 25 # pmesh 26 26 27 #from shallow_water import Domain 27 from print_stats import print_test_stats, build_full_flag 28 28 29 29 from shallow_water import Domain … … 57 57 full_send_dict = full_send_dict, 58 58 ghost_recv_dict = ghost_recv_dict) 59 60 # Make a notes of which triangles are full and which are ghost 61 62 tri_full_flag = build_full_flag(domain, ghost_recv_dict) 59 63 60 64 print 'number of triangles = ', domain.number_of_elements … … 112 116 if myid == 0: 113 117 domain.write_time() 118 print_test_stats(domain, tri_full_flag) 114 119 115 120 if myid == 0:
Note: See TracChangeset
for help on using the changeset viewer.