blockedDOFs

Asked by Jinny Kim on 2020-02-19

Hi, there.

 I am trying to create three layers and see any particle movements for the second and top layers. For this, I need to let the bottom layer not be subject to any forces (just fixed). I am trying to use 'blockedDOFS = 'xyzXYZ', but I got an error like this:

AttributeError: 'tuple' object has no attribute 'state'

Is there anyone who can resolve this error? I attach my simple code below!

import math
Density=3000
Young=3.3e7
poisson=0.3
c_r = 0.15
s_fc = 0.5
r_fc = 0.3
frictionAngle=math.atan(s_fc)
sphereColor = (.8,.8,0.)#dirty yellow
## Import particles
grains = FrictMat(young=Young,poisson=poisson,density=Density,frictionAngle=frictionAngle)
Mat=O.materials.append(grains)
#create assembly of spheres
from yade import pack
sp=pack.SpherePack()
sp.makeCloud(minCorner=(-0.25,-0.25,3.0e-3),maxCorner=(0.25,0.25,0.0),rMean=3.0e-3,rRelFuzz=0.,num=10000,periodic=False)
sp.toSimulation(material=Mat,color=sphereColor)
for b in sp:
    b.state.blockedDOFs = 'xyzXYZ'

## Engines
O.engines=[
    ForceResetter(),
    InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
    InteractionLoop(
        [Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom()],
        [Ip2_FrictMat_FrictMat_MindlinCapillaryPhys(krot=r_fc,en=c_r,es=c_r)],
        [Law2_ScGeom_MindlinPhys_Mindlin(includeMoment=True)]
        ),
    NewtonIntegrator(damping=0,gravity=(0,0,-9.81)),
]
## time step
O.dt=1.0e-5
## GUI
from yade import qt
qt.View()

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Chareyre
Solved:
2020-02-20
Last query:
2020-02-20
Last reply:
2020-02-19
Best Chareyre (bruno-chareyre-9) said : #1

Hi,
Try «for b in O.bodies». That's where they are after .toSimulation().
Bruno

Le jeu. 20 févr. 2020 00:43, Jinny Kim <email address hidden>
a écrit :

> New question #688879 on Yade:
> https://answers.launchpad.net/yade/+question/688879
>
> Hi, there.
>
> I am trying to create three layers and see any particle movements for the
> second and top layers. For this, I need to let the bottom layer not be
> subject to any forces (just fixed). I am trying to use 'blockedDOFS =
> 'xyzXYZ', but I got an error like this:
>
> AttributeError: 'tuple' object has no attribute 'state'
>
> Is there anyone who can resolve this error? I attach my simple code below!
>
> import math
> Density=3000
> Young=3.3e7
> poisson=0.3
> c_r = 0.15
> s_fc = 0.5
> r_fc = 0.3
> frictionAngle=math.atan(s_fc)
> sphereColor = (.8,.8,0.)#dirty yellow
> ## Import particles
> grains =
> FrictMat(young=Young,poisson=poisson,density=Density,frictionAngle=frictionAngle)
> Mat=O.materials.append(grains)
> #create assembly of spheres
> from yade import pack
> sp=pack.SpherePack()
>
> sp.makeCloud(minCorner=(-0.25,-0.25,3.0e-3),maxCorner=(0.25,0.25,0.0),rMean=3.0e-3,rRelFuzz=0.,num=10000,periodic=False)
> sp.toSimulation(material=Mat,color=sphereColor)
> for b in sp:
> b.state.blockedDOFs = 'xyzXYZ'
>
> ## Engines
> O.engines=[
> ForceResetter(),
> InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
> InteractionLoop(
> [Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom()],
>
> [Ip2_FrictMat_FrictMat_MindlinCapillaryPhys(krot=r_fc,en=c_r,es=c_r)],
> [Law2_ScGeom_MindlinPhys_Mindlin(includeMoment=True)]
> ),
> NewtonIntegrator(damping=0,gravity=(0,0,-9.81)),
> ]
> ## time step
> O.dt=1.0e-5
> ## GUI
> from yade import qt
> qt.View()
>
> --
> 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 : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>
>
>

Jinny Kim (jinnyk) said : #2

Thanks Chareyre, that solved my question.