← Back to team overview

yade-users team mailing list archive

Re: [Question #696604]: Spheres interactions in a clump

 

Question #696604 on Yade changed:
https://answers.launchpad.net/yade/+question/696604

    Status: Needs information => Open

Clémence gave more information on the question:
Hi Bruno, thanks for your fast reply. You can find below a version of
the code in which I have created a single clump of 3 spheres. As the
simulation start running, interactions (not cohesives) are created
between spheres.

###
import sys
import os
sys.path.append(os.getcwd())
import yade
import numpy as np


#create material
material = yade.CohFrictMat(young=1.e8,
                            poisson=0.3,
                            density=917,
                            frictionAngle=0.2,
                            normalCohesion=1.0e6,
                            shearCohesion=1.0e6,
                            momentRotationLaw=True,
                            etaRoll=-1,
                            alphaKr=2,
                            alphaKtw=2,
                            label='cohesive')

yade.O.materials.append(material)


#define engines
Igeom_s = [yade.Ig2_Sphere_Sphere_ScGeom6D(), yade.Ig2_Facet_Sphere_ScGeom6D()]
Iphys_s = [yade.Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(setCohesionNow=False)]
Law2_s = [yade.Law2_ScGeom6D_CohFrictPhys_CohesionMoment(useIncrementalForm=True, always_use_moment_law=False)]

yade.O.engines = [yade.ForceResetter(),
                  yade.InsertionSortCollider([yade.Bo1_Sphere_Aabb(), yade.Bo1_Facet_Aabb()]),
                  yade.InteractionLoop(Igeom_s, Iphys_s, Law2_s),
                  yade.NewtonIntegrator(damping=0.1, gravity=yade.Vector3(0, 0, -9.81), label='Newton')  # always last
                  ]


#create spheres and clump
mass_tot = 0

clump_id,sphere_ids=yade.O.bodies.appendClumped([\
sphere([2.5e-3,2.5e-3,2.5e-3],material=material, radius=5e-4),\
sphere([2.0e-3,2.0e-3,2.0e-3],material=material, radius=5e-4),\
sphere([3.0e-3,3.0e-3,3.0e-3],material=material, radius=5e-4)
])

clump=yade.O.bodies[clump_id]
for i in clump.shape.members:
    yade.O.bodies[i].shape.color=(255,0,0)
    radii = yade.O.bodies[i].shape.radius
    mass = yade.O.bodies[i].state.mass
    mass_tot += mass

nb_clump = len(np.unique(clump_id))
nb_sphere = len(np.unique(sphere_ids))
print('Number of clump: ', nb_clump, 'Number of spheres: ', nb_sphere)
print('Total of initial sphere-sphere interaction: ',len(yade.O.interactions))
print('')

    
#print data
clump_export = yade.PyRunner(command='clump_data(clump_id)', iterPeriod=1)

def clump_data(clump_id):
    
    couple_sphere = 0
    n_sphere_sphere_total = []
    n_sphere_sphere_cohesive = []
    
    clump=yade.O.bodies[clump_id]               
    for i in clump.shape.members:
        for inter in yade.O.interactions:
                if inter.isReal and inter.isActive:
                    couple_sphere = min(inter.id1, inter.id2) * (len(clump.shape.members) + 1) + max(inter.id1, inter.id2)
                    if couple_sphere not in n_sphere_sphere_total:
                        n_sphere_sphere_total.append(couple_sphere)
                        if inter.phys.cohesionBroken == False:
                            n_sphere_sphere_cohesive.append(couple_sphere)
                        
    print('iteration: ', yade.O.iter, 'sphere-sphere interaction: ', len(n_sphere_sphere_total),'sphere-sphere cohesive interaction: ', len(n_sphere_sphere_cohesive))   


#run simulation
yade.O.dt=1.0e-5
yade.O.engines = [clump_export] + yade.O.engines
yade.O.run(10)
###

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.