Changeset 1426
- Timestamp:
- May 18, 2005, 11:18:36 PM (20 years ago)
- Location:
- inundation/ga/storm_surge
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/parallel/parallel_advection.py
r1424 r1426 28 28 self.processor = pypar.rank() 29 29 self.numproc = pypar.size() 30 print 'Processor %d'%self.processor31 velocity = [(self.processor+1),0.0]32 33 print 'velocity',velocity30 #print 'Processor %d'%self.processor 31 #velocity = [(self.processor+1),0.0] 32 33 #print 'velocity',velocity 34 34 35 35 Advection_Domain.__init__(self, coordinates, vertices, boundary, velocity) … … 84 84 85 85 # update of non-local ghost cells 86 # for iproc in range(self.numproc): 87 # 88 # if iproc == self.processor: 89 # #Send data from iproc processor to other processors 90 # for send_proc in full_send_dict: 91 # if send_proc != iproc: 92 # Idf = full_send_dict[iproc][0] 93 # Xout = full_send_dict[iproc][1] 94 # for i _ in enumerate(X): 95 # Xout[i] = stage_cv[Idf[i]] 96 # pypar.send(Xout,send_proc) 97 # else: 98 # #Receive data from the iproc processor 99 # if ghost_recv_dict.has_key(iproc): 100 # Idg = ghost_recv_dict[iproc][0] 101 # X = ghost_recv_dict[iproc][1] 102 # X = pypar.receive(iproc,X) 103 # for i _ in enumerate(X): 104 # stage_cv[Idg[i]] = X[i] 86 for iproc in range(self.numproc): 87 88 if iproc == self.processor: 89 #Send data from iproc processor to other processors 90 for send_proc in self.full_send_dict: 91 if send_proc != iproc: 92 Idf = self.full_send_dict[send_proc][0] 93 Xout = self.full_send_dict[send_proc][1] 94 for i, _ in enumerate(Xout): 95 Xout[i] = stage_cv[Idf[i]] 96 97 pypar.send(Xout,send_proc) 98 print 'Processor %d Sending to Processor %d'%(self.processor,send_proc) 99 else: 100 #Receive data from the iproc processor 101 if self.ghost_recv_dict.has_key(iproc): 102 Idg = self.ghost_recv_dict[iproc][0] 103 X = self.ghost_recv_dict[iproc][1] 104 105 X = pypar.receive(iproc,X) 106 print 'Processor %d receiving from Processor %d'%(self.processor,iproc) 107 for i, _ in enumerate(X): 108 stage_cv[Idg[i]] = X[i] 109 pypar.barrier() 105 110 106 111 #local update of ghost cells … … 220 225 elements = zeros( (Nt,3), Int) 221 226 boundary = {} 222 Idg = [] 223 Xg = [] 224 Idf = [] 225 Xf = [] 227 Idgl = [] 228 Xgl = [] 229 Idfl = [] 230 Xfl = [] 231 Idgr = [] 232 Xgr = [] 233 Idfr = [] 234 Xfr = [] 226 235 227 236 full_send_dict = {} … … 240 249 if i == m-1: 241 250 #print 'nt =',nt 242 Idg .append(nt)243 Idf .append(E(1,j))244 if i == 0: 245 Idg .append(nt)246 Idf .append(E(m-2,j))251 Idgr.append(nt) 252 Idfr.append(E(1,j)) 253 if i == 0: 254 Idgl.append(nt) 255 Idfl.append(E(m-2,j)) 247 256 248 257 if i == m-1: … … 255 264 nt = E(i,j)+1 256 265 if i == m-1: 257 Idg .append(nt)258 Idf .append(E(1,j)+1)259 if i == 0: 260 Idg .append(nt)261 Idf .append(E(m-2,j)+1)266 Idgr.append(nt) 267 Idfr.append(E(1,j)+1) 268 if i == 0: 269 Idgl.append(nt) 270 Idfl.append(E(m-2,j)+1) 262 271 263 272 if i == 0: … … 267 276 elements[nt,:] = [i1,i2,i3] 268 277 269 Idf = array(Idf,Int) 270 Idg = array(Idg,Int) 271 Xf = zeros(Idf.shape,Float) 272 Xg = zeros(Idg.shape,Float) 278 Idfl = array(Idfl,Int) 279 Idgl = array(Idgl,Int) 280 Xfl = zeros(Idfl.shape,Float) 281 Xgl = zeros(Idgl.shape,Float) 282 283 Idfr = array(Idfr,Int) 284 Idgr = array(Idgr,Int) 285 Xfr = zeros(Idfr.shape,Float) 286 Xgr = zeros(Idgr.shape,Float) 273 287 274 288 #print Idf 275 289 #print Idg 276 full_send_dict[processor] = [Idf, Xf] 277 ghost_recv_dict[processor] = [Idg, Xg] 290 full_send_dict[(processor-1)%numproc] = [Idfl, Xfl] 291 ghost_recv_dict[(processor-1)%numproc] = [Idgl, Xgl] 292 full_send_dict[(processor+1)%numproc] = [Idfr, Xfr] 293 ghost_recv_dict[(processor+1)%numproc] = [Idgr, Xgr] 278 294 279 295 return points, elements, boundary, full_send_dict, ghost_recv_dict -
inundation/ga/storm_surge/parallel/run_parallel_advection.py
r1424 r1426 52 52 return self.h*((x>self.x0)&(x<self.x1)) 53 53 54 domain.set_quantity('stage', Set_Stage(0.2,0.4,1.0)) 54 if myid == 0: 55 domain.set_quantity('stage', Set_Stage(0.2,0.4,1.0)) 55 56 56 57 #Check that the boundary value gets propagated to all elements 57 for t in domain.evolve(yieldstep = 0.01, finaltime = 1.0):58 for t in domain.evolve(yieldstep = 0.01, finaltime = 0.02): 58 59 domain.write_time()
Note: See TracChangeset
for help on using the changeset viewer.