Changeset 6721 for anuga_core/source
- Timestamp:
- Apr 3, 2009, 8:26:53 PM (16 years ago)
- Location:
- anuga_core/source/anuga_parallel
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga_parallel/parallel_api.py
r5847 r6721 117 117 #------------------------------------------------------------------------ 118 118 119 if verbose: print 'myid ',myid, number_of_full_nodes, number_of_full_triangles 120 121 119 122 domain = Parallel_Domain(points, vertices, boundary, 120 123 full_send_dict=full_send_dict, -
anuga_core/source/anuga_parallel/parallel_meshes.py
r5763 r6721 42 42 numproc = pypar.size() 43 43 44 print 'numproc',numproc 45 print 'processor ',processor 46 44 47 m_low, m_high = pypar.balance(m_g, numproc, processor) 45 48 … … 47 50 m_low = m_low-1 48 51 m_high = m_high+1 52 53 print 'm_low, m_high', m_low, m_high 49 54 m = m_high - m_low 50 55 … … 161 166 Idfl.extend(Idfr) 162 167 Idgr.extend(Idgl) 168 169 print Idfl 170 print Idgr 171 163 172 Idfl = array(Idfl,Int) 164 173 Idgr = array(Idgr,Int) 174 175 print Idfl 176 print Idgr 177 165 178 full_send_dict[processor] = [Idfl, Idfl] 166 179 ghost_recv_dict[processor] = [Idgr, Idgr] 180 181 print full_send_dict[processor] 182 print ghost_recv_dict[processor] 167 183 elif numproc == 2: 168 184 Idfl.extend(Idfr) … … 186 202 187 203 188 204 print full_send_dict 205 print ghost_recv_dict 189 206 190 207 return points, elements, boundary, full_send_dict, ghost_recv_dict -
anuga_core/source/anuga_parallel/pmesh_divide.py
r4406 r6721 119 119 n_tri = len(domain.triangles) 120 120 if n_procs != 1: #Because metis chokes on it... 121 n_vert = domain. number_of_nodes121 n_vert = domain.get_number_of_nodes() 122 122 t_list = domain.triangles.copy() 123 123 t_list = reshape(t_list, (-1,)) -
anuga_core/source/anuga_parallel/run_parallel_advection.py
r5763 r6721 50 50 processor_name = pypar.Get_processor_name() 51 51 52 N = 10053 M = 10052 N = 5 53 M = 2 54 54 55 55 ####################### … … 62 62 points, vertices, boundary, full_send_dict, ghost_recv_dict = \ 63 63 parallel_rectangle(N, M, len1_g=1.0) 64 65 #print 'ghost ',ghost_recv_dict 66 #print 'full ',full_send_dict 67 68 64 69 65 70 print "Myid = ", myid, "no points = ", len(points), \ … … 75 80 domain = Parallel_Domain(points, vertices, boundary, 76 81 full_send_dict, ghost_recv_dict, velocity=[1.0, 0.0]) 82 83 #print 'ghost ',ghost_recv_dict 84 #print 'full ',full_send_dict 85 77 86 78 87 # Boundaries … … 116 125 from anuga.visualiser import RealtimeVisualiser 117 126 vis = RealtimeVisualiser(domain) 118 #vis.render_quantity_height("elevation", offset=0.01, dynamic=False) 119 vis.render_quantity_height("stage", dynamic=True) 127 vis.render_quantity_height("stage", zScale = 5.0, dynamic=True) 120 128 vis.colour_height_quantity('stage', (0.2, 0.2, 0.8)) 121 129 vis.start() -
anuga_core/source/anuga_parallel/test_parallel_sw.py
r6049 r6721 170 170 def assert_(condition, msg="Assertion Failed"): 171 171 if condition == False: 172 pypar.finalize()172 #pypar.finalize() 173 173 raise AssertionError, msg 174 174 … … 215 215 assert_(abs(l2norm_par[x][y] - l2norm_par[x-1][y]) < tol) 216 216 assert_(abs(linfnorm_par[x][y] - linfnorm_par[x-1][y]) < tol) 217 218 if myid == 0: 217 219 218 print 'Parallel test OK' 220 219 -
anuga_core/source/anuga_parallel/test_parallel_sw_runup.py
r5859 r6721 42 42 domain = Domain(points, vertices, boundary) # Create domain 43 43 else: 44 #So full domain is only constructed for the 0th processor (will save on memory) 44 45 domain = None 45 46 … … 61 62 # Create the parallel domain 62 63 #-------------------------------------------------------------------------- 64 domain = distribute(domain, verbose=False) 63 65 64 domain = distribute(domain, verbose=True) 65 66 #-------------------------------------------------------------------------- 67 # Setup domain parameters 68 #-------------------------------------------------------------------------- 66 69 domain.set_name('runup') # Set sww filename 67 70 domain.set_datadir('.') # Set output dir 68 domain.set_maximum_allowed_speed(100) # 71 72 domain.set_default_order(1) 69 73 domain.set_quantities_to_be_stored(None) 74 domain.set_maximum_allowed_speed(100) #FIXME (Ole): try to remove this 75 76 # FIXME (Ole): Need tests where this is commented out 70 77 domain.tight_slope_limiters = 0 # Backwards compatibility (14/4/7) 71 78 domain.H0 = 0 # Backwards compatibility (6/2/7) 72 79 domain.use_centroid_velocities = 0 # Backwards compatibility (7/5/8) 73 80 81 74 82 #------------------------------------------------------------------------------ 75 83 # Setup boundary conditions 76 # This must currently happen * after* domain has been distributed84 # This must currently happen *AFTER* domain has been distributed 77 85 #------------------------------------------------------------------------------ 78 86 … … 89 97 #------------------------------------------------------------------------------ 90 98 91 interpolation_points = [[0.4,0.5 ], [0.6,0.5], [0.8,0.5], [0.9,0.5]]99 interpolation_points = [[0.4,0.51], [0.6,0.51], [0.8,0.51], [0.9,0.51]] 92 100 gauge_values = [] 93 local_interpolation_points = []101 tri_ids = [] 94 102 for i, point in enumerate(interpolation_points): 95 103 gauge_values.append([]) # Empty list for timeseries 96 104 97 if is_inside_polygon(point, domain.get_boundary_polygon()): 105 #if is_inside_polygon(point, domain.get_boundary_polygon()): 106 try: 107 k = domain.get_triangle_containing_point(point) 108 #print 'KKK',myid, k, domain.tri_full_flag[k] 109 if domain.tri_full_flag[k] == 1: 110 tri_ids.append(k) 111 else: 112 tri_ids.append(-1) 113 except: 114 tri_ids.append(-2) 98 115 99 # FIXME: One point appears on multiple processes 100 # Need to get true boundary somehow 101 102 #print 'P%d: point=[%f,%f]' %(myid, point[0], point[1]) 103 local_interpolation_points.append(i) 116 #print myid, tri_ids 117 #print myid, domain.tri_full_flag[tri_ids[0]] 104 118 105 # Hack before we excluded ghosts. 106 if numprocs == 2: 107 if myid == 0: 108 del local_interpolation_points[0] 109 #local_interpolation_points = [1,2,3] 110 if numprocs == 3: 111 if myid == 1: 112 del local_interpolation_points[0] 113 if numprocs == 4: 114 if myid == 0: 115 del local_interpolation_points[1] #2 116 del local_interpolation_points[1] #3 117 if myid == 3: 118 del local_interpolation_points[1] 119 120 #print myid, domain.tri_full_flag 119 121 120 122 121 123 122 print 'P%d has points = %s' %(myid, local_interpolation_points)124 print 'P%d has points = %s' %(myid, tri_ids) 123 125 124 126 … … 126 128 127 129 for t in domain.evolve(yieldstep = 0.1, finaltime = 5.0): 128 domain.write_time()130 if myid == 0: domain.write_time() 129 131 130 132 # Record time series at known points … … 132 134 133 135 stage = domain.get_quantity('stage') 134 w = stage.get_values(interpolation_points=interpolation_points)135 136 136 print 'P%d:w(%f) = '%(myid,domain.get_time()),w 137 138 for i, _ in enumerate(interpolation_points): 139 gauge_values[i].append(w[i]) 140 141 ## if myid == 0: 142 ## for i, (x,y) in enumerate(interpolation_points): 143 144 ## try: 145 ## from pylab import * 146 ## except: 147 ## pass 148 ## else: 149 ## ion() 150 ## hold(False) 151 ## plot(time, gauge_values[i], 'r.-') 152 ## #time, predicted_gauge_values[i], 'k-') 153 154 ## title('Gauge %d (%f,%f)' %(i,x,y)) 155 ## xlabel('time(s)') 156 ## ylabel('stage (m)') 157 ## #legend(('Observed', 'Modelled'), shadow=True, loc='upper left') 158 ## #savefig('Gauge_%d.png' %i, dpi = 300) 159 160 ## raw_input('Next') 161 137 for i in range(4): 138 if tri_ids[i] > -1: 139 gauge_values[i].append(stage.centroid_values[tri_ids[i]]) 162 140 163 141 164 # Reference from sequential version (also available as a165 # unit test in test_shallow_water_domain)166 # Added Friday 13 October 2006 by Ole167 142 168 G0 = ensure_numeric([-0.20000000000000001, -0.20000000000000001, -0.19920600846161715, -0.19153647344085376, -0.19127622768281194, -0.1770671909675095, -0.16739412133181927, -0.16196038919122191, -0.15621633053131384, -0.15130021599977705, -0.13930978857215484, -0.19349274358263582, -0.19975307598803765, -0.19999897143103357, -0.1999999995532111, -0.19999999999949952, -0.19999999999949952, -0.19999999999949952, -0.19997270012494556, -0.19925805948554556, -0.19934513778450533, -0.19966484196394893, -0.1997352860102084, -0.19968260481750394, -0.19980280797303882, -0.19998804881822749, -0.19999999778075916, -0.19999999999966167, -0.19999999999966167, -0.19999999999966167, -0.19999999999966167, -0.19999999999966167, -0.19999999999966167, -0.19999999999966167, -0.19999999999966167, -0.19999999999966167, -0.19999999999966167, -0.19999999999966167, -0.19999999999966167, -0.19999999999966167, -0.19999999999966167, -0.19999999999966167, -0.19999999999966167, -0.19999999999966167, -0.19999999999966167, -0.19999999999966167, -0.19999999999966167, -0.19999999999966167, -0.19999999999966167, -0.19999999999966167, -0.19999999999966167])169 143 170 G1 = ensure_numeric([-0.29999999999999993, -0.29999588068034899, -0.29250047332330331, -0.28335081844518584, -0.26142206997410805, -0.22656028856329835, -0.21224087216745585, -0.19934324109114465, -0.1889857939783175, -0.18146311603911383, -0.17401078727434263, -0.15419361061257214, -0.16225060576782063, -0.19010941396999181, -0.20901161407004412, -0.21670683975774699, -0.21771386270738891, -0.21481284465869752, -0.21063120869004387, -0.20669243364582401, -0.20320707386714859, -0.19984087691926442, -0.19725417448019505, -0.19633783049069981, -0.19650494599999785, -0.19708316838336942, -0.19779309449413818, -0.19853070294429562, -0.19917342167307153, -0.19964814677795845, -0.19991627610824922, -0.20013162970144974, -0.20029864969405509, -0.20036259676501131, -0.20030682824965193, -0.20016105135750167, -0.19997664501985918, -0.19980185871568762, -0.19966836175417696, -0.19958856744312226, -0.19955954696194517, -0.19956950051110917, -0.19960377086336181, -0.19964885299433241, -0.19969427478531132, -0.19973301547655564, -0.19976121574277764, -0.19977765285688653, -0.19978315117522441, -0.19977994634841739, -0.19977101394878494]) 171 172 G2 = ensure_numeric([-0.40000000000000002, -0.39077401254732241, -0.33350466136630474, -0.29771023004255281, -0.27605439066140897, -0.25986156218997497, -0.24502185018573647, -0.231792624329521, -0.21981564668803993, -0.20870707082936543, -0.19877739883776599, -0.18980922837977957, -0.17308011674005838, -0.16306400164013773, -0.17798470933304333, -0.1929554075869116, -0.20236705191987037, -0.20695767560655007, -0.20841025876092567, -0.20792102174869989, -0.20655350005579293, -0.20492002526259828, -0.20310627026780645, -0.20105983335287836, -0.19937394565794653, -0.19853917506699659, -0.19836389977624452, -0.19850305023602796, -0.19877764028836831, -0.19910928131034669, -0.19943705712418805, -0.19970344172958865, -0.19991076989870474, -0.20010020127747646, -0.20025937787100062, -0.20035087292905965, -0.20035829921463297, -0.20029606557316171, -0.20019606915365515, -0.20009096093399206, -0.20000371608204368, -0.19994495432920584, -0.19991535665176338, -0.19990981826533513, -0.19992106419898723, -0.19994189853516578, -0.19996624091229293, -0.19998946016985167, -0.20000842303470234, -0.20002144460718174, -0.20002815561337187]) 173 174 G3 = ensure_numeric([-0.45000000000000001, -0.37631169657400332, -0.33000044342859486, -0.30586045469008522, -0.28843572253009941, -0.27215308978603808, -0.25712951540331219, -0.2431608296216613, -0.23032023651386374, -0.2184546873456619, -0.20735123704254332, -0.19740397194806389, -0.1859829564064375, -0.16675980728362105, -0.16951575032846536, -0.1832860872609344, -0.19485758939241243, -0.20231368291811427, -0.20625610376074754, -0.20758116241495619, -0.20721445402086161, -0.20603406830353785, -0.20450262808396991, -0.2026769581185151, -0.2007401212066364, -0.19931160535777592, -0.19863606301128725, -0.19848511940572691, -0.19860091042948352, -0.19885490669377764, -0.19916542732701112, -0.19946678238611959, -0.19971209594104697, -0.19991912886512292, -0.2001058430788881, -0.20024959409472989, -0.20032160254609382, -0.20031583165752354, -0.20025051539293123, -0.2001556115816068, -0.20005952955420872, -0.1999814429561611, -0.19992977821558131, -0.19990457708664208, -0.19990104785490476, -0.19991257153954825, -0.19993258231880562, -0.19995548502882532, -0.19997700760919687, -0.19999429663503748, -0.20000588800248761]) 144 G0 = [-0.19166666666666665, -0.19166666666666665, -0.1908726751282839, -0.18320314010752042, -0.18294289434947858, -0.17186692881708804, -0.16703039399924297, -0.16196038919122194, -0.15621633053131387, -0.15130021599977714, -0.13930978857215476, -0.18515941024930252, -0.19141974265470424, -0.19166563809769938, -0.19166666621987774, -0.19166666666616614, -0.19166666666616614, -0.19166666666616614, -0.19163936679820112, -0.19092472615522754, -0.19101180444286325, -0.19133150862916881, -0.1914019526842341, -0.19134927149082989, -0.19146947464147604, -0.19165471548476315, -0.19166666444742567, -0.19166666666632831, -0.19166666666632831, -0.19166666666632831, -0.19166666666632831, -0.19166666666632831, -0.19166666666632831, -0.19166666666632831, -0.19166666666632831, -0.19166666666632831, -0.19166666666632831, -0.19166666666632831, -0.19166666666632831, -0.19166666666632831, -0.19166666666632831, -0.19166666666632831, -0.19166666666632831, -0.19166666666632831, -0.19166666666632831, -0.19166666666632831, -0.19166666666632831, -0.19166666666632831, -0.19166666666632831, -0.19166666666632831, -0.19166666666632831] 145 146 G1 = [-0.29166666666666669, -0.29160604748111429, -0.28349212083663766, -0.26637122760395054, -0.25078182919408626, -0.22796566989512818, -0.21386588163016981, -0.20291676395026542, -0.19288397535979634, -0.18529863721918491, -0.17833464440180594, -0.16041289672597714, -0.15844675190030885, -0.18498595153509523, -0.20472977209518117, -0.21430915468432699, -0.21656349614594508, -0.2143710033505706, -0.21047592509949745, -0.20690277124897924, -0.20383621964071927, -0.2009312504622697, -0.19832906347760781, -0.19715218778669685, -0.19713511857310209, -0.19760258124272423, -0.19821523236790017, -0.19886735995941604, -0.19945089045017395, -0.19990124934465239, -0.20016164831872438, -0.20035891530554095, -0.20053280091253389, -0.20062879519403856, -0.20061453716771055, -0.20050516254700712, -0.20034457406881809, -0.2001804893235041, -0.20004787348381434, -0.19996313076460828, -0.19992645686226715, -0.19992808844809359, -0.19995462843450704, -0.19999336711919727, -0.20003430609120498, -0.20007059456815027, -0.20009823569348062, -0.20011560727571823, -0.20012297891084577, -0.20012200982886325, -0.2001151929510443] 175 147 176 148 149 G2 = [-0.39166666666666666, -0.38244067921398905, -0.33350466136630463, -0.29771023004255276, -0.27605439066140891, -0.25986156218997503, -0.24502185018573649, -0.23179262432952102, -0.21981564668803996, -0.20870707082936543, -0.19877739883776596, -0.18980922837977954, -0.1730801167400583, -0.16306400164063853, -0.17798470933316624, -0.19295540736943456, -0.20236705173335867, -0.20695767548229582, -0.20841025868691554, -0.20792102171307641, -0.20655350005113712, -0.2049200252815718, -0.20310627030300929, -0.20105983339290284, -0.19937394568595421, -0.1985391750807548, -0.19836389978207072, -0.19850305023816406, -0.19877764028800521, -0.19910928130800573, -0.19943705712074122, -0.19970344172627957, -0.19991076989513878, -0.20010020127344161, -0.20025937786728282, -0.20035087292654716, -0.20035829921368681, -0.20029606557358018, -0.2001960691549278, -0.20009096093557327, -0.20000371608352077, -0.19994495433034862, -0.1999153566524963, -0.19990981826568235, -0.19992106419902292, -0.19994189853498176, -0.19996624091198109, -0.19998946016949451, -0.20000842303436642, -0.20002144460691332, -0.20002815561319481] 150 151 G3 = [-0.44166666666666665, -0.37631169657400343, -0.33000044342859486, -0.30586045469008505, -0.28843572253009925, -0.27215308978603797, -0.25712951540331214, -0.2431608296216613, -0.23032023651386366, -0.21845468734566184, -0.20735123704254327, -0.19740397194806383, -0.18598295640643708, -0.16675980728412546, -0.1695157503295662, -0.18328608714846414, -0.19485758921965809, -0.2023136827680253, -0.20625610365424957, -0.20758116234856749, -0.20721445398906116, -0.20603406830101498, -0.20450262810357958, -0.2026769581530177, -0.20074012124164839, -0.19931160538111795, -0.1986360630235105, -0.19848511941161767, -0.1986009104317408, -0.19885490669335967, -0.19916542732465842, -0.19946678238299068, -0.19971209593781808, -0.19991912886144106, -0.20010584307496243, -0.20024959409137078, -0.20032160254398582, -0.2003158316568579, -0.20025051539345248, -0.20015561158283834, -0.20005952955567172, -0.19998144295750273, -0.19992977821660762, -0.19990457708729134, -0.19990104785520091, -0.19991257153955966, -0.19993258231861782, -0.19995548502852453, -0.19997700760886039, -0.19999429663472679, -0.20000588800224417] 177 152 178 153 … … 180 155 G = [G0, G1, G2, G3] 181 156 182 for i in local_interpolation_points:183 msg = 'P%d, point #%d: Computed time series and reference time series are different: %s'\184 %(myid, i, gauge_values[i]-G[i])185 assert allclose(gauge_values[i], G[i]), msg186 157 187 print 'P%d completed succesfully using points = %s' %(myid, local_interpolation_points) 158 success = True 188 159 160 for i in range(4): 161 if tri_ids[i] > -1: 162 #print 'myid = %g, allclose(gauge_values[%g], G%g) = %g' % (myid, i,i, allclose(gauge_values[i], G[i])) 163 success = success and allclose(gauge_values[i], G[i]) 164 165 166 if success: 167 print 'Successful completion on processor ',myid 168 else: 169 print 'Failure on processor ',myid
Note: See TracChangeset
for help on using the changeset viewer.