← Back to team overview

yade-users team mailing list archive

[Question #660590]: Loading and manipulating a saving file

 

New question #660590 on Yade:
https://answers.launchpad.net/yade/+question/660590

Hello,

I am using YADE to do this project:

First, a layer of fine particles (r2) was deposited over the coarser particles (r1). When the erosion of fine later was stopped, it was saved, named pretest.yade.

In the next step, I need to add a few number of particles inside the coarse layer. So, the file is loaded at the beginning of simulation. Then, I used the following commands:

##### section1 #########################
sp=SpherePack(); sp.fromSimulation()

sp.makeCloud((0,0,0.011),(0.01,0.01,.03),rMean=r2,num=0)

for b in O.bodies:
    if isinstance (b.shape,Sphere): O.bodies.erase(b.id)

O.bodies.clear()
print 'len(O.bodies):', len(O.bodies)

sp.toSimulation()
print 'len(O.bodies):', len(O.bodies)


kw={'material':0}
O.bodies.append(utils.geom.facetBox((0.005,0.005,0.1),(0.005,0.005,0.1),wallMask=31))
O.bodies.append(ymport.gmsh('4.mesh', shift=Vector3(0, 0, .01), scale=.001, orientation=Quaternion((0, 0, 0), 0), **kw))
print 'len(O.bodies) final:',len(O.bodies)
####################################################################

The problem is that when I use the commands in the 'section1'  ersion happens again (fine particles move between coarser particles).  I guess it happens because forces on the particles from previous simulation are not taken into account after erasing and clearing bodies. I have checked the particles positions, they are generated at the exactly same position.  I have also run the script without the part 'section1', no particle movement was observed.  

I appreciate it if someone could help me.

Regards,

Amir  

The script:

from yade import pack, plot,ymport,export,geom,bodiesHandling,qt
O.load('pretest.yade')

r1 = .003/2.0
r2 = .0003/2.0
E2 = 1e7  
poisson2 = 0.3
density1 = 250000
density2 = 250000
densitywater = 100000
g=-9.806
nf=80
ns=15000


##### section1 #########################
sp=SpherePack(); sp.fromSimulation()

sp.makeCloud((0,0,0.011),(0.01,0.01,.03),rMean=r2,num=1)

for b in O.bodies:
    if isinstance (b.shape,Sphere): O.bodies.erase(b.id)

O.bodies.clear()
print 'len(O.bodies):', len(O.bodies)

sp.toSimulation()
print 'len(O.bodies):', len(O.bodies)


kw={'material':0}
O.bodies.append(utils.geom.facetBox((0.005,0.005,0.1),(0.005,0.005,0.1),wallMask=31))
O.bodies.append(ymport.gmsh('4.mesh', shift=Vector3(0, 0, .01), scale=.001, orientation=Quaternion((0, 0, 0), 0), **kw))
print 'len(O.bodies) final:',len(O.bodies)
############################################################################################################################################

qtr = qt.Renderer()
qtr.bgColor=[1,1,1]

O.engines=[
    ForceResetter(),
    InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb(),Bo1_Wall_Aabb()]),
    InteractionLoop(
	[Ig2_Sphere_Sphere_L3Geom(),Ig2_Facet_Sphere_L3Geom(),Ig2_Wall_Sphere_L3Geom()],
	[Ip2_FrictMat_FrictMat_FrictPhys()],
	[Law2_L3Geom_FrictPhys_ElPerfPl()]
    ),
    GravityEngine(gravity=(0,0,-9.806)),
    NewtonIntegrator(damping=.5)
]

O.dt=utils.PWaveTimeStep()
O.trackEnergy=True
O.resetTime()


############## DRAG FORCE calculation #############################################################
vp1=(4.0/3.0)*3.1416*r1**3 #a filter sphere volume 
vp2=(4.0/3.0)*3.1416*r2**3 #a fin sphere volume 
d1=2*r1 #diameter of a coarse sphere
d2=2*r2 #diameter of a fin sphere
bz1=-.52333*(d1**3)*densitywater*g # buoyancy force on filter particles
bz2=-.52333*(d2**3)*densitywater*g # buoyancy force on fin particles

########## apply forces on particles ######################################################################################

## To avoid wall effect
for b in O.bodies:

    if isinstance(b.shape,Sphere) and (0<b.state.pos[0]<.001) and (0<b.state.pos[1]<.01) and (b.state.pos[2]<0.03) and b.shape.radius == r2:
         b.dynamic=False
    elif isinstance(b.shape,Sphere) and (0.009<b.state.pos[0]<.01) and (0<b.state.pos[1]<.01) and (b.state.pos[2]<0.03) and b.shape.radius == r2:
         b.dynamic=False
    elif isinstance(b.shape,Sphere) and (0<b.state.pos[0]<.01) and (0<b.state.pos[1]<.001) and (b.state.pos[2]<0.03) and b.shape.radius == r2:
         b.dynamic=False
    elif isinstance(b.shape,Sphere) and (0<b.state.pos[0]<.01) and (0.009<b.state.pos[1]<.01) and (b.state.pos[2]<0.03) and b.shape.radius == r2:
         b.dynamic=False

#apply bouyancy force
for b in O.bodies:
    if isinstance(b.shape,Sphere) and (b.state.pos[2]<4) and b.shape.radius == r2:
        O.forces.addF(b.id,(0,0,bz2),1)







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