plt.figure() plt.imshow(UC[0,:,:],interpolation='nearest',cmap='binary') plt.imshow(UC[1,:,:],interpolation='nearest',cmap='binary',alpha=.5) plt.imshow(UC[2,:,:],interpolation='nearest',cmap='binary',alpha=.5) plt.imshow(UC[3,:,:],interpolation='nearest',cmap='binary',alpha=.5) Ms,xcoords,ycoords,radii = pss.copypasteUC(UC,UCX,UCY,RAD,MATS) Ms = pss.mat_assignment(mats,xcoords,ycoords,radii) #plt.figure() #plt.imshow(pss.materials[0,:,:],interpolation='nearest',cmap='binary') #plt.imshow(pss.materials[1,:,:],interpolation='nearest',cmap='binary',alpha=.5) #plt.imshow(pss.materials[2,:,:],interpolation='nearest',cmap='binary',alpha=.5) #plt.imshow(pss.materials[3,:,:],interpolation='nearest',cmap='binary',alpha=.5) #plt.show() S = float(np.sum(UC)-4*3)#There are 4 particles and 3 cells overlap per particle print "Approximate Volume Fraction = {:3.1f}".format(S/float(lx*ly)) A,B = pss.part_distance(xcoords,ycoords,radii,Ms,plot=True) xcoords *= GRIDSPC ycoords *= GRIDSPC radii *= GRIDSPC pss.save_spherical_parts(xcoords,ycoords,radii,Ms,A) #pss.view_mesoiSALE('meso_A-0.8000.iSALE') #pss.save_general_mesh(mixed=False)
mytree = scsp.cKDTree(XY,leafsize=100) for item in XY: print mytree.query(item, k=np.size(mats)+1, distance_upper_bound=pss.cppr_max*3) """ xcr *= GRIDSPC ycr *= GRIDSPC zcr *= GRIDSPC radii *= GRIDSPC MAT = pss.mat_assignment(mats,xcr,ycr) DMY = np.zeros_like(xcoords) A,B = pss.part_distance(xcr,ycr,radii,MAT,False) print "The Contacts Measure, A = {}".format(A) print "Avg Contacts Between the Same Materials, B = {}".format(B) print 'Total contacts between same materials = {}, Total particles = {}'.format(B*J,J) ALL = np.column_stack((MAT,xcr,ycr,radii)) pss.populate_materials(I_shape,XINT,YINT,MAT,J,TRACERS=True,ON=J_shape) # Now populate the materials meshes (NB these are different to the 'mesh' and are pss.save_spherical_parts(xcr,ycr,radii,MAT,A) print 'save to meso_A-{:3.4f}.iSALE'.format(A) pss.save_general_mesh(tracers=True) A2, contact_matrix = pss.discrete_contacts_number(I_shape,XINT,YINT,J,J_shape) print '\n' print "A and A2 are:", A, A2 print '\n'
#pss.place_shape(pss.mesh_Shps[0,:,:],0,ly,1,UC,LX=lx,LY=ly) #pss.place_shape(pss.mesh_Shps[0,:,:],lx,ly,1,UC,LX=lx,LY=ly) plt.figure() plt.imshow(UC[0, :, :], interpolation='nearest', cmap='binary') plt.imshow(UC[1, :, :], interpolation='nearest', cmap='binary', alpha=.5) plt.imshow(UC[2, :, :], interpolation='nearest', cmap='binary', alpha=.5) plt.imshow(UC[3, :, :], interpolation='nearest', cmap='binary', alpha=.5) Ms, xcoords, ycoords, radii = pss.copypasteUC(UC, UCX, UCY, RAD, MATS) Ms = pss.mat_assignment(mats, xcoords, ycoords, radii) #plt.figure() #plt.imshow(pss.materials[0,:,:],interpolation='nearest',cmap='binary') #plt.imshow(pss.materials[1,:,:],interpolation='nearest',cmap='binary',alpha=.5) #plt.imshow(pss.materials[2,:,:],interpolation='nearest',cmap='binary',alpha=.5) #plt.imshow(pss.materials[3,:,:],interpolation='nearest',cmap='binary',alpha=.5) #plt.show() S = float(np.sum(UC) - 4 * 3) #There are 4 particles and 3 cells overlap per particle print "Approximate Volume Fraction = {:3.1f}".format(S / float(lx * ly)) A, B = pss.part_distance(xcoords, ycoords, radii, Ms, plot=True) xcoords *= GRIDSPC ycoords *= GRIDSPC radii *= GRIDSPC pss.save_spherical_parts(xcoords, ycoords, radii, Ms, A) #pss.view_mesoiSALE('meso_A-0.8000.iSALE') #pss.save_general_mesh(mixed=False)
w *= sc h *= sc xc *= sc * GRIDSPC yc *= sc * GRIDSPC rc *= sc * GRIDSPC # Calculate number of occurences No = X_cells * Y_cells / (w * h) Nx = int(X_cells / w) Ny = int(Y_cells / h) w *= GRIDSPC h *= GRIDSPC X = [] Y = [] for i in range(Nx): for j in range(Ny): X.append(xc + i * w) Y.append(yc + j * h) X = np.array(X) Y = np.array(Y) N = np.size(X) radii = np.full((N), r) MAT = pss.mat_assignment(mats, X, Y, radii) A, B = pss.part_distance(X, Y, radii, MAT, plot=True) pss.save_spherical_parts(X, Y, radii, MAT, A) pss.view_mesoiSALE(filepath='meso_A-{:3.4f}.iSALE'.format(A))
""" XY = np.column_stack((xcr,ycr)) mytree = scsp.cKDTree(XY,leafsize=100) for item in XY: print mytree.query(item, k=np.size(mats)+1, distance_upper_bound=pss.cppr_max*3) """ xcr *= GRIDSPC ycr *= GRIDSPC zcr *= GRIDSPC radii *= GRIDSPC MAT = pss.mat_assignment(mats, xcr, ycr) DMY = np.zeros_like(xcoords) A, B = pss.part_distance(xcr, ycr, radii, MAT, False) print "The Contacts Measure, A = {}".format(A) print "Avg Contacts Between the Same Materials, B = {}".format(B) print 'Total contacts between same materials = {}, Total particles = {}'.format( B * J, J) ALL = np.column_stack((MAT, xcr, ycr, radii)) pss.populate_materials( I_shape, XINT, YINT, MAT, J, TRACERS=True, ON=J_shape ) # Now populate the materials meshes (NB these are different to the 'mesh' and are #pss.save_spherical_parts(xcr,ycr,radii,MAT,A) print 'save to meso_A-{:3.4f}.iSALE'.format(A) pss.save_general_mesh(tracers=True) A2, contact_matrix = pss.discrete_contacts_number(I_shape, XINT, YINT, J, J_shape) print '\n'
xc*= sc*GRIDSPC yc*= sc*GRIDSPC rc*= sc*GRIDSPC # Calculate number of occurences No = X_cells*Y_cells/(w*h) Nx = int(X_cells/w) Ny = int(Y_cells/h) w *= GRIDSPC h *= GRIDSPC X = [] Y = [] for i in range(Nx): for j in range(Ny): X.append(xc+i*w) Y.append(yc+j*h) X = np.array(X) Y = np.array(Y) N = np.size(X) radii = np.full((N),r) MAT = pss.mat_assignment(mats,X,Y,radii) A,B = pss.part_distance(X,Y,radii,MAT,plot=True) pss.save_spherical_parts(X,Y,radii,MAT,A) pss.view_mesoiSALE(filepath='meso_A-{:3.4f}.iSALE'.format(A))
radii *= GRIDSPC xc *= GRIDSPC yc *= GRIDSPC plt.figure() plt.imshow(pss.materials[0, :, :], interpolation='nearest', cmap='binary') plt.imshow(pss.materials[1, :, :], interpolation='nearest', cmap='binary', alpha=.5) plt.imshow(pss.materials[2, :, :], interpolation='nearest', cmap='binary', alpha=.5) plt.imshow(pss.materials[3, :, :], interpolation='nearest', cmap='binary', alpha=.5) plt.imshow(pss.materials[4, :, :], interpolation='nearest', cmap='binary', alpha=.5) plt.show() A, B = pss.part_distance(xc, yc, radii, mats, True) pss.save_spherical_parts(xc, yc, radii, mats, A) #S = float(np.sum(UC)-4*3)#There are 4 particles and 3 cells overlap per particle #print "Approximate Volume Fraction = {:3.1f}".format(S/float(lx*ly)) pss.save_general_mesh(mixed=False)
ind_i[k] = ind_i[0] - di ind_i = np.roll(ind_i,1) j += dj mats = np.array(mats) radii = np.array(radii) xc = np.array(xc) yc = np.array(yc) radii *= GRIDSPC xc *= GRIDSPC yc *= GRIDSPC plt.figure() plt.imshow(pss.materials[0,:,:],interpolation='nearest',cmap='binary') plt.imshow(pss.materials[1,:,:],interpolation='nearest',cmap='binary',alpha=.5) plt.imshow(pss.materials[2,:,:],interpolation='nearest',cmap='binary',alpha=.5) plt.imshow(pss.materials[3,:,:],interpolation='nearest',cmap='binary',alpha=.5) plt.imshow(pss.materials[4,:,:],interpolation='nearest',cmap='binary',alpha=.5) plt.show() A,B = pss.part_distance(xc,yc,radii,mats,True) pss.save_spherical_parts(xc,yc,radii,mats,A) #S = float(np.sum(UC)-4*3)#There are 4 particles and 3 cells overlap per particle #print "Approximate Volume Fraction = {:3.1f}".format(S/float(lx*ly)) pss.save_general_mesh(mixed=False)