# code for sand drop simulation

Asked by Estefany Carmona Alvarez on 2020-01-25

I am trying to simulate the sand free fall.
The bodies that represent the sand create them as polyhedra, add the interaction code according to the YADE guide.
When the code is executed from the terminal, the creation of all the created bodies can be visualized, but when the simulation is started from the YADE window, the polyhedra disappear and in the end it seems the following warning:

WARN /build/yade-fDuCoe/yade-2018.02b/pkg/common/InsertionSortCollider.cpp:242 action: verletDist is set to 0 because no spheres were found. It will result in suboptimal performances, consider setting a positive verletDist in your script.

This is the complete code ... (the comments of the code are in Spanish)

Algoritmo_3.py

Tipo
Texto
Tamaño
3 KB (3.032 bytes)
3 KB (3.032 bytes)
Ubicación
INV
Propietario
yo
16:35 por mí
Abierto
16:37 por mí
16:35 con GNOME
Los lectores pueden descargar
from yade import pack, plot, utils, polyhedra_utils, export

#Altura de caida del material
hc=0

#EQUIPO

x=0
y=0
z=0

f=0.45
a=0.50
h=1

#estrutura del equipo de pluviacion

#PROBETA

r=0.05

#Altura de la probeta
height=0.1

#Probeta 1
xp1=0.1
yp1=0
zp1=1

#Algoritmo YADE para crear la probeta 1

#Probeta 2
xp2=0.1
yp2=0
zp2=1

#Algoritmo YADE para crear la probeta 1

#MATERIAL

#esquina inferior
xi=0.225
yi=0.225
zi=0.2

#esquina superior
xs=0.225
ys=0.25
zs=0.5

#tamano de las particulas segun el estudio de angularidad
#sizemin particulas de menor tamano segun la angularidad
a=.12 #ancho (m)
l=.12 #largo (m)

#sizemin particulas de mayor tamano segun la angularidad
A=.12 #ancho (m)
L=.12 #largo (m)

polyMat=PolyhedraMat()
polyMat.density=1418 #kg/m3

O.materials.append(polyMat)

#Algoritmo YADE para crear las particulas en forma de poliedros con las dimensiones de ancho, largo y radio del ensayo de angularidad
polyhedra_utils.fillBox(((-xi),(-yi),(zi+hc)),(xs,ys,(zs+hc)),polyMat,sizemin=[a,l,r],sizemax=[A,L,R])

O.engines=[ForceResetter(),#reinicia las fuerzas para cada interaccion
InsertionSortCollider(#Funcion para detectar las colisiones entre los cuerpo presentes en la simulacion
[Bo1_Polyhedra_Aabb(),Bo1_Facet_Aabb()]),
InteractionLoop( #Funcion para controlar las interaciones de los cuerpos presentes en la simulacion
[Ig2_Polyhedra_Polyhedra_ScGeom()], #controla las posibles combinaciones de interaccion entre los cuerpos
[Ip2_PolyhedraMat_PolyhedraMat_PolyhedraPhys()], #controla las posibles combinaciones de interaccion de los mat en la simulaci
[Law2_PolyhedraGeom_PolyhedraPhys_Volumetric()]), #Son las leyes matematicas que se van a estudiar en el comportamiento de la simulacion este codigo no creo ningun cuerpo ni interaccion
GlobalStiffnessTimeStepper(),
NewtonIntegrator(gravity=(0,0,-9.81))] #Corresponde al motor que une todas las leyes fisico matematicas de movimiento y compartamiento del material simulado

I want to know if anyone knows how I can solve this problem ... I already tried the GlobalStiffnessTimeStepper codes that suggested it in a previous post, but it didn't work.

I thank you if you can help me ...

## Question information

Language:
English Edit question
Status:
For:
Assignee:
No assignee Edit question
Last query:
2020-01-28
2020-01-28
 Jan Stránský (honzik) said on 2020-01-25: #1

Hello,

apart from the warnings, you also have one error:
FATAL /build/yade-fDuCoe/yade-2018.02b/pkg/common/InteractionLoop.cpp:143 action: None of given Law2 functors can handle interaction #70+76, types geom:ScGeom=1 and phys:PolyhedraPhys=16 (LawDispatcher::getFunctor2D returned empty functor)

you have created ScGeom from Polyhedra-Polyhedra contact, PolyhedraPhys from PolyhedraMat-PolyhedraMat contact, but you have no law combining ScGeom and PolyhedraPhys...

Apart from that, set a suitable initial time step as
GlobalStiffnessTimeStepper(defaultDt=0.001), # 0.01 is an example
With no hint, GlobalStiffnessTimeStepper has no idea what to choose and set dt to 1, which leads that after the very first time step, the polyhedrons are far below the main scene..

cheers
Jan

 Estefany Carmona Alvarez (jecarmona91) said on 2020-01-25: #2

I appreciate your prompt and correct response.
I already corrected the code Ig2, but as for the simulation, I continue with the same problem. I don't know if I'm using the code well. Since I don't identify what the GlobalStiffnessTimeStepper command function is?

I applied it like this ...

... [Ip2_PolyhedraMat_PolyhedraMat_PolyhedraPhys()], #controla las posibles combinaciones de interaccion de los mat en la simulaci
[Law2_PolyhedraGeom_PolyhedraPhys_Volumetric()]), #Son las leyes matematicas que se van a estudiar en el comportamiento de la simulacion este codigo no creo ningun cuerpo ni interaccion
GlobalStiffnessTimeStepper(),
NewtonIntegrator(gravity=(0,0,-9.81))] #Corresponde al motor que une todas las leyes fisico matematicas de movimiento y compartamiento del material simulado

GlobalStiffnessTimeStepper(defaultDt=4*PWaveTimeStep())

thank you very much for your help

 Jan Stránský (honzik) said on 2020-01-26: #3

> Since I don't identify what the GlobalStiffnessTimeStepper command function is?

GlobalStiffnessTimeStepper is one of your engines. I meant to add defaultDt argument to it:
###
O.engines=[ForceResetter(),
InsertionSortCollider(...),
InteractionLoop(...),
GlobalStiffnessTimeStepper(defaultDt=0.001),
NewtonIntegrator(...)]
###

> GlobalStiffnessTimeStepper(defaultDt=4*PWaveTimeStep())

PWaveTimeStep() does not work here as you have no spheres in the simulation (this was the source of one of the warnings and having too large time step without defaultDt argument)

cheers
Jan

 Estefany Carmona Alvarez (jecarmona91) said on 2020-01-26: #4

Thank you Jan for your collaboration, it effectively already has the linear drop motion.

Now I have two big unknowns, how can I release the fall of the bodies? and to be deposited in the cylinders that are in the YX plane?

The corrected code was as follows:

O.engines=[ForceResetter(),

InsertionSortCollider([Bo1_Polyhedra_Aabb(),Bo1_Facet_Aabb(),Bo1_Box_Aabb(),Bo1_Cylinder_Aabb()]),

InteractionLoop([Ig2_Polyhedra_Polyhedra_PolyhedraGeom(),Ig2_Facet_Polyhedra_PolyhedraGeom()],[Ip2_PolyhedraMat_PolyhedraMat_PolyhedraPhys()],[Law2_PolyhedraGeom_PolyhedraPhys_Volumetric()]),

GlobalStiffnessTimeStepper(defaultDt=0.001),

NewtonIntegrator(gravity=(0,0,-9.81))]

 Estefany Carmona Alvarez (jecarmona91) said on 2020-01-26: #5

Thank you Jan for your collaboration, it effectively already has the linear drop motion.

Now I have two big unknowns, how can I release the fall of the bodies? and to be deposited in the cylinders that are in the YX plane?

The corrected code was as follows:

O.engines=[ForceResetter(),

InsertionSortCollider([Bo1_Polyhedra_Aabb(),Bo1_Facet_Aabb(),Bo1_Box_Aabb(),Bo1_Cylinder_Aabb()]),

InteractionLoop([Ig2_Polyhedra_Polyhedra_PolyhedraGeom(),Ig2_Facet_Polyhedra_PolyhedraGeom()],
[Ip2_PolyhedraMat_PolyhedraMat_PolyhedraPhys()],[Law2_PolyhedraGeom_PolyhedraPhys_Volumetric()]),

GlobalStiffnessTimeStepper(defaultDt=0.001),

NewtonIntegrator(gravity=(0,0,-9.81))]

 Estefany Carmona Alvarez (jecarmona91) said on 2020-01-26: #6

Thank you Jan for your collaboration, it effectively already has the linear drop motion.

Now I have two big unknowns, how can I release the fall of the bodies? and to be deposited in the cylinders that are in the YX plane?

The corrected code was as follows:

O.engines=[ForceResetter(),

InsertionSortCollider([Bo1_Polyhedra_Aabb(),Bo1_Facet_Aabb(),Bo1_Box_Aabb(),Bo1_Cylinder_Aabb()]),

InteractionLoop([Ig2_Polyhedra_Polyhedra_PolyhedraGeom(),Ig2_Facet_Polyhedra_PolyhedraGeom()],
[Ip2_PolyhedraMat_PolyhedraMat_PolyhedraPhys()],[Law2_PolyhedraGeom_PolyhedraPhys_Volumetric()]),

GlobalStiffnessTimeStepper(defaultDt=0.001),

NewtonIntegrator(gravity=(0,0,-9.81))]

 Jan Stránský (honzik) said on 2020-01-27: #7

> how can I release the fall of the bodies?

I don't understand "release the fall", please elaborate

> to be deposited in the cylinders that are in the YX plane?

please, elaborate, too :-) in GUI I see polyhedrons, which are much larger then the cylinders, so I do not understand how they could be deposited in the cylinders..

cheers
Jan

 Estefany Carmona Alvarez (jecarmona91) said on 2020-01-27: #8

how can I do so that the polyhedra have a free fall ?, in the w it is seen
that they fall in block. The idea is to simulate the sand fall naturally.

2. In the code that I sent you the particles are large, but it is a matter
of visualization of the functions. Actually the particle size ranges from
0.000008 to 0.00475. The idea is that these polyhedra are deposited inside
the two cylinders.

Thanks Jan

El lun., 27 de enero de 2020 3:15 a. m., Jan Stránský <

>
> Status: Open => Needs information
>
> > how can I release the fall of the bodies?
>
> I don't understand "release the fall", please elaborate
>
> > to be deposited in the cylinders that are in the YX plane?
>
> please, elaborate, too :-) in GUI I see polyhedrons, which are much
> larger then the cylinders, so I do not understand how they could be
> deposited in the cylinders..
>
> cheers
> Jan
>
> --
>
>

 Jan Stránský (honzik) said on 2020-01-27: #9

I am sorry, I am lost again :-)

> how can I do so that the polyhedra have a free fall ?, in the w it is seen that they fall in block. The idea is to simulate the sand fall naturally.

what is "in the w"?
what is "fall in block"?
The polyhedrons do have a free fall, or? NewtonIntegrator(gravity=(0,0,-9.81)) apply constant downward force, the polyhedrons has no interactions and thus fall freely, "naturally". Do you observe a different situation?

> 2. In the code that I sent you the particles are large, but it is a matter
of visualization of the functions. Actually the particle size ranges from
0.000008 to 0.00475. The idea is that these polyhedra are deposited inside
the two cylinders.

Currently the polyhedrons cannot be deposited inside the cylinders, simply because they are larger than the cylinders. If you want to discuss a different situation, please update the script to discuss the same situation.

thanks
Jan

 Estefany Carmona Alvarez (jecarmona91) said on 2020-01-28: #10

1. In the current simulation it is seen that the set of particles fall together, as if it were a single body. The idea is that each of the particles have their own movement.
The foundation of this project is to simulate the natural deposition of sand. (It is something similar to an hourglass, only in this case there is no time limit for the sand fall)

2. This is the sequence with the actual dimensions of the particles and the cylindrical container where the material should be deposited.

from yade import pack, plot, utils, polyhedra_utils, export

#Altura de caida del material
hc=0

#EQUIPO

x=0
y=0
z=0

f=0.45
a=0.50
h=1

#estrutura del equipo de pluviacion

#PROBETA

#Altura de la probeta
height=0.05

#Probeta 1
xp1=0.1
yp1=0
zp1=1

#Algoritmo YADE para crear la probeta 1

#Probeta 2
xp2=0
yp2=0
zp2=1

#Algoritmo YADE para crear la probeta 2

#MATERIAL

#esquina inferior
xi=0.225
yi=0.225
zi=0.2

#esquina superior
xs=0.225
ys=0.25
zs=0.5

#tamano de las particulas segun el estudio de angularidad
#sizemin particulas de menor tamano segun la angularidad
a=0.0001808 #ancho (m)
l=.0002305 #largo (m)

#sizemin particulas de mayor tamano segun la angularidad
A=.002285 #ancho (m)
L=.002385 #largo (m)

polyMat=PolyhedraMat()
polyMat.density=1418 #kg/m3

O.materials.append(polyMat)

#Algoritmo YADE para crear las particulas en forma de poliedros con las dimensiones de ancho, largo y radio del ensayo de angularidad
polyhedra_utils.fillBox(((-xi),(-yi),(zi+hc)),(xs,ys,(zs+hc)),polyMat,sizemin=[a,l,r],sizemax=[A,L,R])

O.engines=[ForceResetter(),#reinicia las fuerzas para cada interaccion
InsertionSortCollider(#Funcion para detectar las colisiones entre los cuerpo presentes en la simulacion
[Bo1_Polyhedra_Aabb(),Bo1_Facet_Aabb()]),
InteractionLoop( #Funcion para controlar las interaciones de los cuerpos presentes en la simulacion
[Ig2_Polyhedra_Polyhedra_PolyhedraGeom()], #controla las posibles combinaciones de interaccion entre los cuerpos
[Ip2_PolyhedraMat_PolyhedraMat_PolyhedraPhys()], #controla las posibles combinaciones de interaccion de los mat en la simulaci
[Law2_PolyhedraGeom_PolyhedraPhys_Volumetric()]), #Son las leyes matematicas que se van a estudiar en el comportamiento de la simulacion este codigo no creo ningun cuerpo ni interaccion
GlobalStiffnessTimeStepper(defaultDt=0.01),
NewtonIntegrator(gravity=(0,0,-9.81))] #Corresponde al motor que une todas las leyes fisico matematicas de movimiento y compartamiento del material simulado

Thanks Jan

 Jan Stránský (honzik) said on 2020-01-28: #11

> to simulate the sand fall naturally.
> In the current simulation it is seen that the set of particles fall together, as if it were a single body.
> The idea is that each of the particles have their own movement.
> The foundation of this project is to simulate the natural deposition of sand.

yes, exactly.
With NewtonIntegrator(gravity=(0,0,-9.81)) you defined constant acceleration to all particles. There is no interactions and no other force (hence free fall) , so the particles have no other way but "fall together, as if it were a single body.".
And of course, each has their own movement, which would be visible in case of interactions or other forces.
So what you see is perfectly natural and satisfying all your requirements :-)

> 2. This is the sequence with the actual dimensions of the particles and the cylindrical container where the material should be deposited.

I am still lost, sorry.. it still sounds like you want to deposit particles larger-than-the-cylinder in the cylinder, which simply is not possible.. I must have missed something :-)

cheers
Jan