Esempio n. 1
0
)  # This keeps a copy of these before they're converted to physical units

xcr = xcr.astype(float)  # Convert to floats
ycr = ycr.astype(float)
radii = radii.astype(float)

xcr *= GRIDSPC  # Convert to physical units
ycr *= GRIDSPC
MAT = pss.mat_assignment(pss.mats, xcr,
                         ycr)  # Assign materials to the particles
radii *= GRIDSPC

#pss.save_spherical_parts(xcr,ycr,radii,MAT,A,fname='coords.txt')   # Save particle coordinates, radii and material number as a txt file with file name fname
# When fname is not 'meso' A doe snot need to be anything and can just be zero as it is not used
pss.save_particle_mesh(
    I_shape, XINT, YINT, MAT, J
)  # Save full mesh as a meso_m.iSALE file. NB This uses the integer coords we had before

print "total particles placed: {}".format(J)

placed_part_area = np.array(placed_part_area)
vol_frac_calc = np.sum(placed_part_area) / (pss.meshx * pss.meshy)

if abs(vol_frac_calc - pss.vol_frac) <= 0.02:
    print "GREAT SUCCESS! Volume Fraction = {:3.3f}%".format(vol_frac_calc *
                                                             100.)
else:
    print "FAILURE. Volume Fraction = {:3.3f}%".format(vol_frac_calc * 100.)

######################################## loop through the list of eccentricities and plot each one ################################################
Esempio n. 2
0
YINT      = np.copy(ycr)                                            # This keeps a copy of these before they're converted to physical units

xcr       =   xcr.astype(float)                                     # Convert to floats
ycr       =   ycr.astype(float)
radii     = radii.astype(float)



xcr     *= GRIDSPC                                                  # Convert to physical units
ycr     *= GRIDSPC
MAT      = pss.mat_assignment(pss.mats,xcr,ycr)                     # Assign materials to the particles
radii   *= GRIDSPC

#pss.save_spherical_parts(xcr,ycr,radii,MAT,A,fname='coords.txt')   # Save particle coordinates, radii and material number as a txt file with file name fname
                                                                    # When fname is not 'meso' A doe snot need to be anything and can just be zero as it is not used
pss.save_particle_mesh(I_shape,XINT,YINT,MAT,J)                     # Save full mesh as a meso_m.iSALE file. NB This uses the integer coords we had before


print "total particles placed: {}".format(J)

placed_part_area = np.array(placed_part_area)
vol_frac_calc = np.sum(placed_part_area)/(pss.meshx*pss.meshy)

if abs(vol_frac_calc - pss.vol_frac) <= 0.02:
    print "GREAT SUCCESS! Volume Fraction = {:3.3f}%".format(vol_frac_calc*100.)
else:
    print "FAILURE. Volume Fraction = {:3.3f}%".format(vol_frac_calc*100.)


plt.figure()                                                        # Generate a figure of the mesh you have just created, with a different colour for each material
for KK in range(pss.Ms):
Esempio n. 3
0
DMY      = np.zeros_like(xcoords)
xcr     *= GRIDSPC
ycr     *= GRIDSPC
zcr     *= GRIDSPC
#radii   *= GRIDSPC


#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.save_spherical_parts(xcr,ycr,radii,MAT,A)
#print 'save to meso_A-{:3.4f}.iSALE'.format(A)
pss.save_particle_mesh(I_shape,XINT,YINT,MAT,J,mixed=True)


timestr = time.strftime('%d-%m-%Y_%H-%M-%S')
#np.savetxt('{}cppr_{}vfrlim_A{:1.3f}_{}.iSALE'.format(cppr,vfraclimit,A,timestr),ALL)
placed_part_area = np.array(placed_part_area)
print "total particles placed: {}".format(J)
vol_frac_calc = np.sum(placed_part_area)/(pss.meshx*pss.meshy)

if abs(vol_frac_calc - pss.vol_frac) <= 0.02:
    print "GREAT SUCCESS! Volume Fraction = {:3.3f}%".format(vol_frac_calc*100.)
else:
    print "FAILURE. Volume Fraction = {:3.3f}%".format(vol_frac_calc*100.)


plt.figure()
Esempio n. 4
0
)  # This keeps a copy of these before they're converted to physical units

xcr = xcr.astype(float)  # Convert to floats
ycr = ycr.astype(float)
radii = radii.astype(float)

xcr *= GRIDSPC  # Convert to physical units
ycr *= GRIDSPC
MAT = pss.mat_assignment(pss.mats, xcr,
                         ycr)  # Assign materials to the particles
radii *= GRIDSPC

#pss.save_spherical_parts(xcr,ycr,radii,MAT,A,fname='coords.txt')   # Save particle coordinates, radii and material number as a txt file with file name fname
# When fname is not 'meso' A doe snot need to be anything and can just be zero as it is not used
pss.save_particle_mesh(
    I_shape, XINT, YINT, MAT, J
)  # Save full mesh as a meso_m.iSALE file. NB This uses the integer coords we had before

print "total particles placed: {}".format(J)

placed_part_area = np.array(placed_part_area)
vol_frac_calc = np.sum(placed_part_area) / (pss.meshx * pss.meshy)

if abs(vol_frac_calc - pss.vol_frac) <= 0.02:
    print "GREAT SUCCESS! Volume Fraction = {:3.3f}%".format(vol_frac_calc *
                                                             100.)
else:
    print "FAILURE. Volume Fraction = {:3.3f}%".format(vol_frac_calc * 100.)

plt.figure(
)  # Generate a figure of the mesh you have just created, with a different colour for each material