def GetFlux(self, time): bx = self.GetField("bx", time) * self.wpewce by = self.GetField("by", time) * self.wpewce bz = self.GetField("bz", time) * self.wpewce flux = np.zeros((self.ncells[0]+1,self.ncells[1]+1),"float32", order='FORTRAN') flux2 = np.zeros((self.ncells[0]+1,self.ncells[1]+1),"float32", order='FORTRAN') dx = self.dl[0] dz = self.dl[1] nx = self.ncells[0] nz = self.ncells[1] j = 0 # for i in np.arange(1, nx): # flux2[i,0] = flux2[i-1,0] + bz[i-1,0]*dx flux[1:,0] = flux[0,0] + np.cumsum(bz[:-1,0]*dx) # for j in np.arange(1,nz): # flux2[0,j] = flux2[0,j-1] - bx[0,j-1]*dz flux[0,1:] = flux[0,0] - np.cumsum(bx[0,:-1]*dz) # for i in np.arange(1,nx): # for j in np.arange(1,nz): # flux2[i,j] = 0.5*(flux2[i-1,j] + bz[i-1,j]*dx) + 0.5*(flux2[i,j-1] - bx[i,j-1]*dz) return flux2