Clumps for 2D simulaton

Asked by Fu zuoguang on 2013-05-30

Dear Jan Stránský and Bruno Chareyre:
     Thanks for helping me last time, so I can achieve my 2D-simulation myself now. And my next step work is to learn how to make biaxial compression calculation in different particles shape. In YADE this can be achieved by the class "clumps" in 3D simulation only and the methods of particles generation in my script I provided can only be used for spheres, not for clumps. So, my question is now the same as #198183.
     I have read the question 198183 before I ask and that question can almost give no help for me.
As that question mentioned, if I wanna use clumps in 2D simulation, I should "makeclumps" on each of spheres generated. It is obvious that lack of flexibility should make this method not applicable for large-scale simulation. Are there some other ways for solving my problems? Seeking your help!

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Christian Jakob
Solved:
2013-06-25
Last query:
2013-06-25
Last reply:
2013-06-04
Christian Jakob (jakob-ifgt) said : #1

Hi,

Did you read the users manual on this topic [1] ?

There are several ways of creating/modifiing clumps ...

[1] https://yade-dem.org/doc/user.html#clumping-particles-together

For 2D I can not help, sorry.

Regards,

christian

Fu zuoguang (zgfu1985) said : #2

Dear Jan Stránský and Bruno Chareyre:
     Thanks for helping me last time, so in order to achieve "clumps in 2D simulation", I should try my best to test "particles-generation from PFC to YADE", but at the beginning of this task, I failed to import the "particles information.txt" to YADE and the question can be described as that:
(1). There is a "particles information.txt" recording the basic infomation about the particles with the format "x_y_z_r", there is nothing wrong in it.
(2). I employ these orders "O.bodies.append(ymport.text('qq.txt'))" to make a correct importing.
(3). After importing finished(all the particles can be recogized by YADE),I wanna start my 2D-simulation but fail, because all the particles disaapear at the beginning of simulation, so I can see nothing but the walls in screen.
(4). there may be something wrong in my script, since the importing order can be sucessfully used in examples provided by YADE.
I don know where is wrong and seek your help!(all script and sphere.txt are below)

Filename='2D-simulation-vertex'
from yade import pack,os,utils,ymport

################################# preprocessing for simulation ##########################################
### prescribing variables and functions for simulation controller ###
# material defination
spheremat = O.materials.append(FrictMat(poisson=0.5,density=2500,young=1e10,frictionAngle=0.5))
wallmat = O.materials.append(FrictMat(poisson=0.5,density=0,young=1e10,frictionAngle=0))
# walls defination
mn,mx=Vector3(0,0,0),Vector3(0.06,0.06,0.1)
wallids=O.bodies.append(utils.aabbWalls([mn,mx],thickness=.00001,material=wallmat))
# ThreeDTriaxialEngine defination for initial-state determination(the first calculation step)
triax01=TriaxialStressController(
 wall_bottom_id=wallids[2],wall_top_id=wallids[3],
 wall_left_id=wallids[0],wall_right_id=wallids[1],
 wall_back_id=wallids[4],wall_front_id=wallids[5],
 wall_front_activated = False,wall_back_activated = False,
 internalCompaction=False,
 stressMask=7,
        goal1=30000,
        goal2=30000,
        goal3=30000,
        max_vel=5,
)
# ThreeDTriaxialEngine defination for triaxial compression(the second calculation step)
triax02=TriaxialStressController(
 wall_bottom_id=wallids[2],wall_top_id=wallids[3],
 wall_left_id=wallids[0],wall_right_id=wallids[1],
 wall_back_id=wallids[4],wall_front_id=wallids[5],
 wall_front_activated = False,wall_back_activated = False,
 internalCompaction=False,
 stressMask = 5,
        goal2=-100,
        goal1=30000,
        goal3=30000,
)
################################# control flow for simulation ##########################################
# particles generation
O.periodic=1
O.cell.setBox(0.06,0.06,0.06)
sp=pack.SpherePack()
O.bodies.append(ymport.text('sphere.txt'))
sp.toSimulation(material=spheremat)
# determining colors for particles in different aeras of the cell
for b in O.bodies:
    if isinstance(b.shape,Sphere):
         pos = b.state.pos
         if pos[0] <0.03 and pos[1] < 0.03: b.shape.color = (1,0,0) # area 1
         elif pos[0] >= 0.03 and pos[1] <0.03: b.shape.color = (0,1,0) # area 2
         elif pos[0] >= 0.03 and pos[1] >= 0.03: b.shape.color = (0,0,1) # area 3
         elif pos[0] < 0.03 and pos[1] >= 0.03: b.shape.color = (0,10,1) # area 4
         else: b.shape.pos = (1,1,0)
O.periodic=0
# blockedDOFs
for b in O.bodies:
 if isinstance(b.shape,Sphere):
   b.state.blockedDOFs='zXY'
# Simulation assembly for the first step
O.engines=[
 ForceResetter(),
 InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Box_Aabb(),Bo1_Wall_Aabb()]),
 InteractionLoop(
  [Ig2_Sphere_Sphere_ScGeom(),Ig2_Box_Sphere_ScGeom()],
  [Ip2_FrictMat_FrictMat_FrictPhys()],
  [Law2_ScGeom_FrictPhys_CundallStrack()]
 ),
 GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=100,timestepSafetyCoefficient=0.8),
 triax01,
 NewtonIntegrator(damping=.1),
 PyRunner(command='resultfirst()',iterPeriod=1000)
]
# first step of simulation startting with a correct inheriting for the next step
O.dt=utils.PWaveTimeStep()
def resultfirst():
        f = file("/home/fzg/fu/result-first-01.dat",'w')
        wall_left = O.bodies[0].state.pos[0]
 wall_right = O.bodies[1].state.pos[0]
 wall_bottom = O.bodies[2].state.pos[1]
 wall_top = O.bodies[3].state.pos[1]
 wall_back = O.bodies[4].state.pos[2]
 wall_front = O.bodies[5].state.pos[2]
 x_dimension = wall_right - wall_left
 y_dimension = wall_top - wall_bottom
 #z_dimension = wall_front - wall_back
 area = x_dimension * y_dimension
 porosity = (area-sum(pi*b.shape.radius**2 for b in O.bodies if isinstance(b.shape,Sphere)))/area
        print porosity
# f.write('%-16g %-16g %-16g %-16g \n'%(area,porosity,x_dimension,y_dimension)),
# f.close()
O.run(30000,True)
O.wait()

sphere.txt:
0.019 0.001 0.05 0.0008
0.021 0.001 0.05 0.0008
0.023 0.001 0.05 0.0008
0.025 0.001 0.05 0.0008
0.027 0.001 0.05 0.0008
0.029 0.001 0.05 0.0008
0.031 0.001 0.05 0.0008
0.033 0.001 0.05 0.0008
0.035 0.001 0.05 0.0008
0.037 0.001 0.05 0.0008
0.039 0.001 0.05 0.0008
0.041 0.001 0.05 0.0008
0.043 0.001 0.05 0.0008
0.045 0.001 0.05 0.0008
0.047 0.001 0.05 0.0008
0.049 0.001 0.05 0.0008
0.051 0.001 0.05 0.0008
0.053 0.001 0.05 0.0008
0.055 0.001 0.05 0.0008
0.057 0.001 0.05 0.0008
0.059 0.001 0.05 0.0008
0.001 0.003 0.05 0.0008
0.003 0.003 0.05 0.0008
0.005 0.003 0.05 0.0008

Christian Jakob (jakob-ifgt) said : #3

Hi,

1.) You do not need SpherePack() command in your simulation, because you already have your packing in sphere.txt file.

sp=pack.SpherePack()
O.bodies.append(ymport.text('sphere.txt'))
sp.toSimulation(material=spheremat)

2.) You did not set material for your spheres. Try

for b in O.bodies:
 if isinstance(b.shape,Sphere):
   b.material = spheremat

Hope it helps.

Wet regards from rainy Freiberg,

Christian

Jan Stránský (honzik) said : #4

Hello,

if you comment O.run(), you may see the particles and all walls before
simulation starts. After running one step, all particles AND 4 walls (out
of 6) disappears.. If you print

for b in O.bodies: print b.state.pos

you will see that most of the positions are full of NaN. I would guess,
that it is caused somehow by TriaxialStressController (perhaps by wrong
parameters??), but just now I can't say anything more. maybe somebody else
could? :-)

Jan

2013/6/3 Fu zuoguang <email address hidden>

> Question #229898 on Yade changed:
> https://answers.launchpad.net/yade/+question/229898
>
> Fu zuoguang gave more information on the question:
> Dear Jan Stránský and Bruno Chareyre:
> Thanks for helping me last time, so in order to achieve "clumps in 2D
> simulation", I should try my best to test "particles-generation from PFC to
> YADE", but at the beginning of this task, I failed to import the "particles
> information.txt" to YADE and the question can be described as that:
> (1). There is a "particles information.txt" recording the basic infomation
> about the particles with the format "x_y_z_r", there is nothing wrong in it.
> (2). I employ these orders "O.bodies.append(ymport.text('qq.txt'))" to
> make a correct importing.
> (3). After importing finished(all the particles can be recogized by
> YADE),I wanna start my 2D-simulation but fail, because all the particles
> disaapear at the beginning of simulation, so I can see nothing but the
> walls in screen.
> (4). there may be something wrong in my script, since the importing order
> can be sucessfully used in examples provided by YADE.
> I don know where is wrong and seek your help!(all script and sphere.txt
> are below)
>
> Filename='2D-simulation-vertex'
> from yade import pack,os,utils,ymport
>
> ################################# preprocessing for simulation
> ##########################################
> ### prescribing variables and functions for simulation controller ###
> # material defination
> spheremat =
> O.materials.append(FrictMat(poisson=0.5,density=2500,young=1e10,frictionAngle=0.5))
> wallmat =
> O.materials.append(FrictMat(poisson=0.5,density=0,young=1e10,frictionAngle=0))
> # walls defination
> mn,mx=Vector3(0,0,0),Vector3(0.06,0.06,0.1)
>
> wallids=O.bodies.append(utils.aabbWalls([mn,mx],thickness=.00001,material=wallmat))
> # ThreeDTriaxialEngine defination for initial-state determination(the
> first calculation step)
> triax01=TriaxialStressController(
> wall_bottom_id=wallids[2],wall_top_id=wallids[3],
> wall_left_id=wallids[0],wall_right_id=wallids[1],
> wall_back_id=wallids[4],wall_front_id=wallids[5],
> wall_front_activated = False,wall_back_activated = False,
> internalCompaction=False,
> stressMask=7,
> goal1=30000,
> goal2=30000,
> goal3=30000,
> max_vel=5,
> )
> # ThreeDTriaxialEngine defination for triaxial compression(the second
> calculation step)
> triax02=TriaxialStressController(
> wall_bottom_id=wallids[2],wall_top_id=wallids[3],
> wall_left_id=wallids[0],wall_right_id=wallids[1],
> wall_back_id=wallids[4],wall_front_id=wallids[5],
> wall_front_activated = False,wall_back_activated = False,
> internalCompaction=False,
> stressMask = 5,
> goal2=-100,
> goal1=30000,
> goal3=30000,
> )
> ################################# control flow for simulation
> ##########################################
> # particles generation
> O.periodic=1
> O.cell.setBox(0.06,0.06,0.06)
> sp=pack.SpherePack()
> O.bodies.append(ymport.text('sphere.txt'))
> sp.toSimulation(material=spheremat)
> # determining colors for particles in different aeras of the cell
> for b in O.bodies:
> if isinstance(b.shape,Sphere):
> pos = b.state.pos
> if pos[0] <0.03 and pos[1] < 0.03: b.shape.color = (1,0,0)
> # area 1
> elif pos[0] >= 0.03 and pos[1] <0.03: b.shape.color = (0,1,0)
> # area 2
> elif pos[0] >= 0.03 and pos[1] >= 0.03: b.shape.color = (0,0,1)
> # area 3
> elif pos[0] < 0.03 and pos[1] >= 0.03: b.shape.color = (0,10,1)
> # area 4
> else: b.shape.pos = (1,1,0)
> O.periodic=0
> # blockedDOFs
> for b in O.bodies:
> if isinstance(b.shape,Sphere):
> b.state.blockedDOFs='zXY'
> # Simulation assembly for the first step
> O.engines=[
> ForceResetter(),
>
> InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Box_Aabb(),Bo1_Wall_Aabb()]),
> InteractionLoop(
> [Ig2_Sphere_Sphere_ScGeom(),Ig2_Box_Sphere_ScGeom()],
> [Ip2_FrictMat_FrictMat_FrictPhys()],
> [Law2_ScGeom_FrictPhys_CundallStrack()]
> ),
>
> GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=100,timestepSafetyCoefficient=0.8),
> triax01,
> NewtonIntegrator(damping=.1),
> PyRunner(command='resultfirst()',iterPeriod=1000)
> ]
> # first step of simulation startting with a correct inheriting for the
> next step
> O.dt=utils.PWaveTimeStep()
> def resultfirst():
> f = file("/home/fzg/fu/result-first-01.dat",'w')
> wall_left = O.bodies[0].state.pos[0]
> wall_right = O.bodies[1].state.pos[0]
> wall_bottom = O.bodies[2].state.pos[1]
> wall_top = O.bodies[3].state.pos[1]
> wall_back = O.bodies[4].state.pos[2]
> wall_front = O.bodies[5].state.pos[2]
> x_dimension = wall_right - wall_left
> y_dimension = wall_top - wall_bottom
> #z_dimension = wall_front - wall_back
> area = x_dimension * y_dimension
> porosity = (area-sum(pi*b.shape.radius**2 for b in O.bodies if
> isinstance(b.shape,Sphere)))/area
> print porosity
> # f.write('%-16g %-16g %-16g %-16g
> \n'%(area,porosity,x_dimension,y_dimension)),
> # f.close()
> O.run(30000,True)
> O.wait()
>
> sphere.txt:
> 0.019 0.001 0.05 0.0008
> 0.021 0.001 0.05 0.0008
> 0.023 0.001 0.05 0.0008
> 0.025 0.001 0.05 0.0008
> 0.027 0.001 0.05 0.0008
> 0.029 0.001 0.05 0.0008
> 0.031 0.001 0.05 0.0008
> 0.033 0.001 0.05 0.0008
> 0.035 0.001 0.05 0.0008
> 0.037 0.001 0.05 0.0008
> 0.039 0.001 0.05 0.0008
> 0.041 0.001 0.05 0.0008
> 0.043 0.001 0.05 0.0008
> 0.045 0.001 0.05 0.0008
> 0.047 0.001 0.05 0.0008
> 0.049 0.001 0.05 0.0008
> 0.051 0.001 0.05 0.0008
> 0.053 0.001 0.05 0.0008
> 0.055 0.001 0.05 0.0008
> 0.057 0.001 0.05 0.0008
> 0.059 0.001 0.05 0.0008
> 0.001 0.003 0.05 0.0008
> 0.003 0.003 0.05 0.0008
> 0.005 0.003 0.05 0.0008
>
> --
> You received this question notification because you are a member of
> yade-users, which 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
>

Fu zuoguang (zgfu1985) said : #5

Dear Christian Jakob and Jan Stránský:
          I have tested your suggestions many times but failed. Jan Stránský's guess is perfectly right. All the parameters are "NaN".
And I use only "O.bodies.append(ymport.text('sphere.txt'))" to replace the "sp=pack.SpherePack()", there is no effect at all. I do not know why and how to do for checking my question. Seeking your help.

Best Christian Jakob (jakob-ifgt) said : #6

Hi,

I had a closer look at your script. The problem is not related with TriaxialStressController, but with your box material.

The solution is to set a density > 0 in your definition of the materials for boxes (wallmat)!

wallmat = O.materials.append(FrictMat(poisson=0.5,density=1,young=1e10,frictionAngle=0))

Then everything works fine.

BTW, even if there are no boxes in the sim, it crashes, when density = 0, a bug?!

Regards,

Christian

Fu zuoguang (zgfu1985) said : #7

Thanks Christian Jakob, that solved my question.