New question #706005 on Yade: https://answers.launchpad.net/yade/+question/706005
import random import math from yade import geom, pack, plot # create cylindrical body with radius 6 cm and height 6.05 cm cylinder = yade.geom.facetCylinder((0,0,0), radius=0.06, height=0.065, segmentsNumber=80, wallMask=6) O.bodies.append(cylinder) # create empty sphere packing sp = pack.SpherePack() # specify the radii and ratios radii_ratios = [(0.000075, 0.04), (0.0006, 0.06), (0.00236, 0.05), (0.00475, 0.35), (0.0095, 0.20), (0.0125, 0.30)] # generate spheres with specified radii and ratios for r, ratio in radii_ratios: num_spheres = int(ratio * 1000) sp.makeCloud((-0.055,-0.055,0.20), (0.055,0.055,0.09), rMean=r, rRelFuzz=0, num=num_spheres) # add the sphere pack to the simulation sp.toSimulation() O.engines = [ForceResetter(), InsertionSortCollider([Bo1_Sphere_Aabb(), Bo1_Facet_Aabb()]), InteractionLoop( # handle sphere+sphere and facet+sphere collisions [Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom()], [Ip2_FrictMat_FrictMat_FrictPhys()], [Law2_ScGeom_FrictPhys_CundallStrack()] ), NewtonIntegrator(gravity=(0,0,-9.81), damping=0.4), ] O.dt = 2 * PWaveTimeStep() # run the simulation for 1000 steps O.run(1000) # calculate the volume of the packing volume_packing = 0 num_spheres = 0 for b in O.bodies: if isinstance(b.shape, yade.wrapper.Sphere): volume_packing += 4/3 * math.pi * b.shape.radius**3 num_spheres += 1 # calculate the volume of the cylinder volume_cylinder = math.pi * 0.06**2 * 0.0605 # calculate the porosity and porosity percentage porosity = (volume_cylinder - volume_packing) / volume_cylinder porosity_percent = porosity * 100 print("Number of spheres:", "{:.2f}".format(num_spheres)) print("V Packing:", "{:.2f}".format(volume_packing)) print("V Cylinder:", "{:.2f}".format(volume_cylinder)) print("Porosity:", "{:.2f}".format(porosity)) print("Porosity:", "{:.2f}%".format(porosity_percent)) I was able to complete the simulation but the simulation doesn't fully packed and V packing and V cylinder are calculated as 0 Is there any guide on how to make the sphere pack better in the container? Why does the calculation is calculated as 0? -- You received this question notification because your team yade-users is an answer contact for Yade. _______________________________________________ Mailing list: https://launchpad.net/~yade-users Post to : yade-users@lists.launchpad.net Unsubscribe : https://launchpad.net/~yade-users More help : https://help.launchpad.net/ListHelp