en=.003 es=.003 frictionAngle=radians(35) density=2300 params=utils.getViscoelasticFromSpheresInteraction(tc,en,es) defMat=O.materials.append(ViscElMat(density=density,frictionAngle=frictionAngle,**params)) # **params sets kn, cn, ks, cs O.dt=.1*tc # time step rad=0.2 # particle radius tolerance = 0.0001 SpheresID=[] SpheresID+=O.bodies.append(pack.regularHexa(pack.inSphere((Vector3(0.0,0.0,0.0)),0.5),radius=rad,gap=rad*0.5,material=defMat)) floorId=[] floorId+=O.bodies.append(geom.facetBox((0,0,0),(0.6,0.6,0.6),material=defMat)) #Floor #Calculate the weight of spheres sphMass = utils.getSpheresVolume()*density*9.81 # Create engines O.engines=[ ForceResetter(), InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]), InteractionLoop( [Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom()], [Ip2_ViscElMat_ViscElMat_ViscElPhys()],
""" rad,gap=.15,.02 #Add material O.materials.append(FrictMat(young=10e9,poisson=.25,frictionAngle=0.5,density=1e3)) #Parameters, which will be passed into spheres and facets creators kw={'material':0} kwBoxes={'color':[1,0,0],'wire':False,'dynamic':False,'material':0} kwMeshes={'color':[1,1,0],'wire':True,'dynamic':False,'material':0} O.bodies.append( pack.regularHexa( (pack.inSphere((0,0,4),2)-pack.inSphere((0,-2,5),2)) & pack.notInNotch(centerPoint=(0,0,4),edge=(0,1,0),normal=(-1,1,-1),aperture=.2) ,radius=rad,gap=gap,color=(0,1,0),material=0) # head +[utils.sphere((.8,1.9,5),radius=.2,color=(.6,.6,.6),material=0),utils.sphere((-.8,1.9,5),radius=.2,color=(.6,.6,.6),material=0),utils.sphere((0,2.4,4),radius=.4,color=(1,0,0),material=0)] # eyes and nose +pack.regularHexa(pack.inCylinder((-1,2.2,3.3),(1,2.2,3.3),2*rad),radius=rad,gap=gap/3,color=(0.929,0.412,0.412),material=0) #mouth ) groundId=O.bodies.append(utils.facet([(12,0,-6),(0,12,-6,),(-12,-12,-6)],dynamic=False)) # ground for part in [ pack.regularHexa ( pack.inAlignedBox((-2,-2,-2),(2,2,2))-pack.inCylinder((0,-2,0),(0,2,0),1), radius=1.5*rad,gap=2*gap,color=(1,0,1),**kw), # body, pack.regularOrtho(pack.inEllipsoid((-1,0,-4),(1,1,2)),radius=rad,gap=0,color=(0,1,1),**kw), # left leg pack.regularHexa (pack.inCylinder((+1,1,-2.5),(0,3,-5),1),radius=rad,gap=gap,color=(0,1,1),**kw), # right leg pack.regularHexa (pack.inHyperboloid((+2,0,1),(+6,0,0),1,.5),radius=rad,gap=gap,color=(0,0,1),**kw), # right hand pack.regularOrtho(pack.inCylinder((-2,0,2),(-5,0,4),1),radius=rad,gap=gap,color=(0,0,1),**kw) # left hand ]: O.bodies.appendClumped(part)
""" rad, gap = .15, .02 #Add material O.materials.append( FrictMat(young=10e9, poisson=.25, frictionAngle=0.5, density=1e3)) #Parameters, which will be passed into spheres and facets creators kw = {'material': 0} kwBoxes = {'color': [1, 0, 0], 'wire': False, 'dynamic': False, 'material': 0} kwMeshes = {'color': [1, 1, 0], 'wire': True, 'dynamic': False, 'material': 0} O.bodies.append( pack.regularHexa((pack.inSphere((0, 0, 4), 2) - pack.inSphere( (0, -2, 5), 2)) & pack.notInNotch(centerPoint=(0, 0, 4), edge=(0, 1, 0), normal=(-1, 1, -1), aperture=.2), radius=rad, gap=gap, color=(0, 1, 0), material=0) # head + [ utils.sphere((.8, 1.9, 5), radius=.2, color=(.6, .6, .6), material=0), utils.sphere((-.8, 1.9, 5), radius=.2, color=(.6, .6, .6), material=0), utils.sphere((0, 2.4, 4), radius=.4, color=(1, 0, 0), material=0) ] # eyes and nose + pack.regularHexa(pack.inCylinder((-1, 2.2, 3.3), (1, 2.2, 3.3), 2 * rad), radius=rad,
def heterogenize(specimenSize, spfile, physCoeffs): sp = pack.SpherePack() sp.load(spfile) aggregs = [pack.inSphere(c, r) for c, r in sp] setup(aggregs, physCoeffs)
nbIter=iterN[i] O.reset() tc=0.001 en=.003 es=.003 frictionAngle=radians(35) density=2300 defMat=O.materials.append(ViscElMat(density=density,frictionAngle=frictionAngle,tc=tc,en=en,et=es)) O.dt=.1*tc # time step rad=0.5 # particle radius tolerance = 0.0001 SpheresID=[] SpheresID+=O.bodies.append(pack.regularHexa(pack.inSphere((Vector3(0.0,0.0,0.0)),rad),radius=rad/rR,gap=rad/rR*0.5,material=defMat)) geometryParameters = bodiesHandling.spheresPackDimensions(SpheresID) print(len(SpheresID)) floorId=[] floorId+=O.bodies.append(geom.facetBox(geometryParameters['center'],geometryParameters['extends']/2.0*1.05,material=defMat)) #Floor #Calculate the mass of spheres sphMass = getSpheresVolume()*density # Create engines O.engines=[ ForceResetter(), InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]), InteractionLoop(
""" rad,gap=.15,.02 #Add material O.materials.append(FrictMat(young=10e9,poisson=.25,frictionAngle=0.5,density=1e3)) #Parameters, which will be passed into spheres and facets creators kw={'material':0} kwBoxes={'color':[1,0,0],'wire':False,'dynamic':False,'material':0} kwMeshes={'color':[1,1,0],'wire':True,'dynamic':False,'material':0} O.bodies.append( pack.regularHexa( (pack.inSphere((0,0,4),2)-pack.inSphere((0,-2,5),2)) & pack.notInNotch(centerPoint=(0,0,4),edge=(0,1,0),normal=(-1,1,-1),aperture=.2) ,radius=rad,gap=gap,color=(0,1,0),material=0) # head +[sphere((.8,1.9,5),radius=.2,color=(.6,.6,.6),material=0),sphere((-.8,1.9,5),radius=.2,color=(.6,.6,.6),material=0),sphere((0,2.4,4),radius=.4,color=(1,0,0),material=0)] # eyes and nose +pack.regularHexa(pack.inCylinder((-1,2.2,3.3),(1,2.2,3.3),2*rad),radius=rad,gap=gap/3,color=(0.929,0.412,0.412),material=0) #mouth ) groundId=O.bodies.append(facet([(12,0,-6),(0,12,-6,),(-12,-12,-6)],dynamic=False)) # ground for part in [ pack.regularHexa ( pack.inAlignedBox((-2,-2,-2),(2,2,2))-pack.inCylinder((0,-2,0),(0,2,0),1), radius=1.5*rad,gap=2*gap,color=(1,0,1),**kw), # body, pack.regularOrtho(pack.inEllipsoid((-1,0,-4),(1,1,2)),radius=rad,gap=0,color=(0,1,1),**kw), # left leg pack.regularHexa (pack.inCylinder((+1,1,-2.5),(0,3,-5),1),radius=rad,gap=gap,color=(0,1,1),**kw), # right leg pack.regularHexa (pack.inHyperboloid((+2,0,1),(+6,0,0),1,.5),radius=rad,gap=gap,color=(0,0,1),**kw), # right hand pack.regularOrtho(pack.inCylinder((-2,0,2),(-5,0,4),1),radius=rad,gap=gap,color=(0,0,1),**kw) # left hand ]: O.bodies.appendClumped(part)
identifier = 'testingAlpha' if not os.path.exists('VTK' + timeStr + identifier): os.mkdir('VTK' + timeStr + identifier) else: shutil.rmtree('VTK' + timeStr + identifier) os.mkdir('VTK' + timeStr + identifier) mx = Vector3(0.9639118565206523, 0.9324110610237126, 0.8800533096533549) mn = Vector3(-0.9518976876470108, -0.9685168132064216, -0.9451956043076566) walls = aabbWalls([mn, mx], thickness=0) wallIds = O.bodies.append(walls) pred = pack.inSphere(Vector3(0, 0, 0), 1) sp = pack.randomDensePack(pred, radius=0.1, rRelFuzz=0.1, returnSpherePack=False, seed=1) O.bodies.append(sp) O.engines = O.engines[0:3] + [ FlowEngine(dead=0, label="flow", multithread=False) ] + O.engines[3:5] # visualization of the alpha boundary: filter cells by "alpha" in paraview def pressureField(): flow.saveVtk('VTK' + timeStr + identifier + '/', withBoundaries=False)
density = 2300 defMat = O.materials.append( ViscElMat(density=density, frictionAngle=frictionAngle, tc=tc, en=en, et=es)) O.dt = .1 * tc # time step rad = 0.2 # particle radius tolerance = 0.0001 SpheresID = [] SpheresID += O.bodies.append( pack.regularHexa(pack.inSphere((Vector3(0.0, 0.0, 0.0)), 0.5), radius=rad, gap=rad * 0.5, material=defMat)) floorId = [] floorId += O.bodies.append( geom.facetBox((0, 0, 0), (0.6, 0.6, 0.6), material=defMat)) #Floor #Calculate the weight of spheres sphMass = utils.getSpheresVolume() * density * 9.81 # Create engines O.engines = [ ForceResetter(), InsertionSortCollider([Bo1_Sphere_Aabb(),
density = 2300 params = utils.getViscoelasticFromSpheresInteraction(tc, en, es) defMat = O.materials.append( ViscElMat(density=density, frictionAngle=frictionAngle, **params) ) # **params sets kn, cn, ks, cs O.dt = 0.1 * tc # time step rad = 0.2 # particle radius tolerance = 0.0001 SpheresID = [] SpheresID += O.bodies.append( pack.regularHexa(pack.inSphere((Vector3(0.0, 0.0, 0.0)), 0.5), radius=rad, gap=rad * 0.5, material=defMat) ) floorId = [] floorId += O.bodies.append(geom.facetBox((0, 0, 0), (0.6, 0.6, 0.6), material=defMat)) # Floor # Calculate the weight of spheres sphMass = utils.getSpheresVolume() * density * 9.81 # Create engines O.engines = [ ForceResetter(), InsertionSortCollider([Bo1_Sphere_Aabb(), Bo1_Facet_Aabb()]), InteractionLoop( [Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom()],
tc = 0.001 en = 0.003 es = 0.003 frictionAngle = radians(35) density = 2300 defMat = O.materials.append(ViscElMat(density=density, frictionAngle=frictionAngle, tc=tc, en=en, et=es)) O.dt = 0.1 * tc # time step rad = 0.5 # particle radius tolerance = 0.0001 SpheresID = [] SpheresID += O.bodies.append( pack.regularHexa( pack.inSphere((Vector3(0.0, 0.0, 0.0)), rad), radius=rad / rR, gap=rad / rR * 0.5, material=defMat ) ) geometryParameters = bodiesHandling.spheresPackDimensions(SpheresID) print len(SpheresID) floorId = [] floorId += O.bodies.append( geom.facetBox(geometryParameters["center"], geometryParameters["extends"] / 2.0 * 1.05, material=defMat) ) # Floor # Calculate the mass of spheres sphMass = getSpheresVolume() * density # Create engines