How does "particleSD_2d" work ...???

Asked by jessica sjah on 2011-10-21

Hi,

I would like to know if anyone had used this function "particleSD_2d" to create the sphere packing?
Could someone give me an example how to use this function?

Because actually I would like to analyse my sample in 2Dimension...

Thank you :)....

Jessica.

Question information

Language:
English Edit question
Status:
Answered
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
2011-10-24
Last reply:
2011-11-02

This question was reopened

ceguo (hhh-guo) said : #1

Hi,

I also need to run 2D simulation with YADE. As proposed by Jan in a previous post #174453, Yade cannot really handle 2d simulation, and he suggested to use blockedDOFs. While my problem now is how to pack the 2d packing? I also tried particleSD_2d but with error: type object 'SpherePack' has no attribute 'particleSD_2d' (I'm using Yade 0.60.3). And I also tried ymport.gengeoFile to read packing generated by LSMGenGeo (using CircMNTableXY2D to obtain periodic packing). But now I don't know how to compress or shear (biaxial) the sample with periodic boundary condition.

I hope someone can help.

Ning

Hi Ning,

There is no difference in periodic BCs be it in 2D or 3D (with the
exception that, if you block direction 3, you will not impose periodic
deformation along axis 3).
You can have a look at documentation and example scripts in 3D, they
will show you how to proceed.

Bruno

jessica sjah (jessica-sjah) said : #3

Hi,

Thank you for all of your information... I've also seen post #174453 :)...

I have another question.

How could I apply different gravity to the spheres in one generated box?

I want to make a sample for modelling hole erosion test, so I want to make a sample made of spheres with a hole in the middle of the sample...
In my mind, I can make it by applying different sign for gravity along direction z (based on their position or id) when I generate the spheres and then stabilize them. Have anyone any idea to realize it in O.engines?

O.engines=[
   ForceResetter(),
   InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
   InteractionLoop(
      # handle sphere+sphere and facet+sphere collisions
      [Ig2_Sphere_Sphere_L3Geom(),Ig2_Facet_Sphere_L3Geom()],
      [Ip2_FrictMat_FrictMat_FrictPhys()],
      [Law2_L3Geom_FrictPhys_ElPerfPl()]
   ),
   GravityEngine(gravity=(0,0,-9.81)),
   NewtonIntegrator(damping=0.4),
]

Thank you very much for your answers :)... have a good day.

Jérôme Duriez (jduriez) said : #4

Hello Jessica,

     One GravityEngine applies the same gravity vector to all concerned bodies. What could help you, is that you can choose the bodies you want, with "mask" : see https://www.yade-dem.org/doc/yade.wrapper.html#yade.wrapper.GravityEngine.mask
Thus, a solution would be to use two GravityEngines, one with mask = 1 for example, applying on spheres being in the hole (once you set their mask to 1), and the other with mask = 2 for the other spheres.

   But, if your final goal is only to realize a sample with a hole , the best would be I think to remove the non desired bodies directly, no ? It is useless I think to have the bodies which were in the hole, flying somewhere far away from the rest of the sample. See https://www.yade-dem.org/doc/yade.wrapper.html#yade.wrapper.BodyContainer.erase

It seems that "some" work has just been made to ensure that things go well if you use this yade feature.

Jérôme Duriez (jduriez) said : #5

PS : for other question, better define an other launchpad question ! ;-)

You could use 2 force engines. One with force f on one side, the other
with force -f on the other side. I'm not sure it is the best way however.
If you want a HET, you can simply remove particles from an initially
dense packing. "But then the ones from the top will fall down", you may
say. Ok, but it is like this in real HETs. What you need is cohesion at
contacts to keep them in positions more than inverted gravity.
Alternatively, use the symmetry of the problem and represent only one
side of it...

Bruno

jessica sjah (jessica-sjah) said : #7

Hi jduriez,

yeah, I just realized that my first thinking is complicated...
I will try to do your second best solution....
Thank you for your answer :D...
have a nice day for u all....

p.s. Ok, if I have another question, I will make an other launchpad question..... :)....

Jessica

ceguo (hhh-guo) said : #8

So the 2d simulation is achieved in a pseudo way: we still use a 3d packing just with 1d DOF blocked. So the simulation is just similar with 3d cases. Am I right?

Ning

jessica sjah (jessica-sjah) said : #9

Hi Ning,

Yeah, I think that you're right, we do the 3D packing simulation but we use 2D analysis by limiting the DOF.
**Please anyone give me a correction if I give a wrong answer**

But actually I'm still curious how does the command 'particleSD_2d' work in yade...??

Jessica.

Yes Ning, thats' it.
For particleSD_2d, what is the questions exactly? I never used it but
based on the documentation it looks very similar to the 3D version. Do
you have problems using it?

Bruno

particleSD_2d(/(Vector2)minCorner/, /(Vector2)maxCorner/,
/(float)rMean/, /(bool)periodic=False/, /(str)name/, /(int)numSph/[,
/(object)radii=[]/[, /(object)passing=[]/[,
/(bool)passingIsNotPercentageButCount=False/[, /(int)seed=0/]]]]) ? int¶
<https://yade-dem.org/doc/yade.pack.html#yade._packSpheres.SpherePack.particleSD_2d>

    Create random packing on XY plane, defined by minCorner and
    maxCorner, containing numSph spheres. Returns number of created
    spheres, which can be < num if the packing is too tight. The
    computation is done according to the given psd.

caroline (draminix-j2) said : #11

Hi Bruno,

I tried to use particleSD_2d as below:

sp=pack.SpherePack()

sp.particleSD_2d((0,0),(1,1),num=500,radii=[.02,0.04,0.045,.05,.06,.08,.12],passing=[0.,0.1,0.3,0.3,.3,.7,1.])

sp.toSimulation()

and the message error:

Traceback (most recent call last):
  File "../../bin/yade-trunk", line 183, in runScript
    execfile(script,globals())
  File "gravity_deposit.py", line 23, in <module>
    sp.particleSD_2d((0,0),(1,1),radii=[.02,0.04,0.045,.05,.06,.08,.12],passing=[0.,0.1,0.3,0.3,.3,.7,1.])
ArgumentError: Python argument types in
    SpherePack.particleSD_2d(SpherePack, tuple, tuple)
did not match C++ signature:
    particleSD_2d(SpherePack {lvalue}, Eigen::Matrix<double, 2, 1, 2, 2, 1> minCorner, Eigen::Matrix<double, 2, 1, 2, 2, 1> maxCorner, double rMean, bool periodic=False, std::string name, int numSph, std::vector<double, std::allocator<double> > radii=[], std::vector<double, std::allocator<double> > passing=[], bool passingIsNotPercentageButCount=False, int seed=0)

Did I miss something...?

Thank you :).....

Jérôme Duriez (jduriez) said : #12

Hello,

I guess you typed a wrong command (for what concerns the list of arguments). I can not point exactly your mistake (sorry), but did you try defining a "rMean" value for example ? Did you try to launch particleSD (not _2d) commands ?

That's only a beginning...

The error message says the parameter list is not correct, you have to
define them carefully.
Use the command line documentation to find out what is missing:

Yade [3]: sp.particleSD_2d?
Docstring:
  particleSD_2d( (SpherePack)arg1, (Vector2)minCorner,
(Vector2)maxCorner, (float)rMean, (bool)periodic=False, (str)name,
(int)numSph [, (object)radii=[] [, (object)passing=[] [,
(bool)passingIsNotPercentageButCount=False [, (int)seed=0]]]]) -> int :

Then after adding the missing parameters it works without error (if they
have default values, you are not obliged to define them explicitely):
sp.particleSD_2d(minCorner=(0,0),maxCorner=(1,1),rMean=0.8,name='no',numSph=10,radii=[.02,0.04,0.045,.05,.06,.08,.12],passing=[0.,10,30,30,30,70,100])

I must say this function is weird. It requires the definition of "name"
that is not used in the code, it keeps generating 0 spheres despite my
attempts with different parameters. Also be careful, it takes passing in
% (from 0 to 100, instead of 0 to1) unlike other functions. I'm affraid
it was some experimental code that has never been really finished.

I just commited a small change in the makeCloud function, so that it now
allows degenerated boxes with null thickness, like in:
sp.makeCloud(minCorner=(0,0,0),maxCorner=(1,1,0),rRelFuzz=.2,num=500,periodic=False)

It results in spheres aligned on a plane. I recommend using this
function (and I think I will remove particleSD_2d from the code to avoid
troubles).
You need to update your code and recompile.

Bruno

jessica sjah (jessica-sjah) said : #14

Hi Bruno,

Yap, I'am not able to use "particleSD_2d" until now :(....

Ok, I will update and recompile the code....

Thank you so much Bruno, the new version of makeCloud function will be very helpful for my model 2D....

Good evening,

Jessica :)....

jessica sjah (jessica-sjah) said : #15

Hi Jduriez,

Yes, I had tried this command "particleSD_2d" by using all the parameters... But I wasn't able to use it :(......

But I think Bruno had solved my problem to make my sample in 2D model.... ^^

Thank you very much for opinions, helps and ideas of all the participants... :D...

Good evening everyone....

Jessica.

To be honest I have never had problems with this function and I have used
it before (which is why I added to the code). Ok, I did not document it
very well but it works (but you can remove it if you wish). Here is a
simple example how I use it (it is with the periodic, you can adapt it to
the non-periodic case likewise):

radii=[
0.1,
0.2,
0.3
]

passing=[
10,
50,
80
]

nballs=390
initialPoro=.65
AvgRadius=0.2
dim=(nballs*pi*AvgRadius**2/(1-initialPoro))**(1/2.)
sp.particleSD_2d(minCorner=(0,0),maxCorner=Vector2(dim,dim),rMean=AvgRadius,periodic=True,name="",numSph=nballs,radii=radii,passing=passing)

HTH,
Chiara

On 31 October 2011 18:15, jessica sjah <<email address hidden>
> wrote:

> Question #175606 on Yade changed:
> https://answers.launchpad.net/yade/+question/175606
>
> jessica sjah posted a new comment:
> Hi Jduriez,
>
> Yes, I had tried this command "particleSD_2d" by using all the
> parameters... But I wasn't able to use it :(......
>
> But I think Bruno had solved my problem to make my sample in 2D
> model.... ^^
>
> Thank you very much for opinions, helps and ideas of all the
> participants... :D...
>
> Good evening everyone....
>
> Jessica.
>
> --
> 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
>

ceguo (hhh-guo) said : #17

Hi,

So the new version can generate a true 2D packing. The method to do biaxial compression is still the same as triaxial one? Do we need to block the third dimensional DOF now? And how the pressure is calculated?

Sorry for so many questions.

Ning

Chiara, I was guessing this function was orphan since nobody was explaining its usage, but there is no reason to remove if it is used by someone (you). It is your decision.

There are still things unclear that could maybe be fixed:
- why mandatory name=""?
- why must we give psd and meanRad at the same time? it is annoying because defining the latest is non-trivial
- why your passing doesn't start at 0 and end at 100?
- running your example script, I get 505 spheres, why not 390?

I again improved makeCloud a bit in r2953. It is now very flexible:
- 2D/3D
- periodic or not
- uniform or psd-based size distributions
- distributions by mass or by number
- target packing by meanRad OR by number, in arbitrary size of box.

On 2 November 2011 12:50, Chareyre <email address hidden>wrote:

> Question #175606 on Yade changed:
> https://answers.launchpad.net/yade/+question/175606
>
> Chareyre posted a new comment:
> Chiara, I was guessing this function was orphan since nobody was
> explaining its usage, but there is no reason to remove if it is used by
> someone (you). It is your decision.
>
> There are still things unclear that could maybe be fixed:
> - why mandatory name=""?
>
It should be removed (sorry).

> - why must we give psd and meanRad at the same time? it is annoying
> because defining the latest is non-trivial
>
Because we need an estimate of the initial volume of solids (the latter
could be the unknown in fact).

> - why your passing doesn't start at 0 and end at 100?
>
It is just an example.

> - running your example script, I get 505 spheres, why not 390?
>
Precisely because we are initially just guessing the volume of solids by
the number of particles and the meanRadius.

>
> I again improved makeCloud a bit in r2953. It is now very flexible:
> - 2D/3D
> - periodic or not
> - uniform or psd-based size distributions
> - distributions by mass or by number
> - target packing by meanRad OR by number, in arbitrary size of box.
>
Oh excellent! Then I will try your function and perhaps we can remove mine
which would be only redundant.
Chiara

>
> --
> 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
>

On 2 November 2011 13:18, Chiara Modenese <email address hidden> wrote:

>
>
> On 2 November 2011 12:50, Chareyre <email address hidden>wrote:
>
>> Question #175606 on Yade changed:
>> https://answers.launchpad.net/yade/+question/175606
>>
>> Chareyre posted a new comment:
>> Chiara, I was guessing this function was orphan since nobody was
>> explaining its usage, but there is no reason to remove if it is used by
>> someone (you). It is your decision.
>>
>> There are still things unclear that could maybe be fixed:
>> - why mandatory name=""?
>>
> It should be removed (sorry).
>
>> - why must we give psd and meanRad at the same time? it is annoying
>> because defining the latest is non-trivial
>>
> Because we need an estimate of the initial volume of solids (the latter
> could be the unknown in fact).
>
>> - why your passing doesn't start at 0 and end at 100?
>>
> It is just an example.
>
>> - running your example script, I get 505 spheres, why not 390?
>>
> Precisely because we are initially just guessing the volume of solids by
> the number of particles and the meanRadius.
>
In other words one has to try different initial numbers of particles to
match the actual number (the number of grains you want).

>
>> I again improved makeCloud a bit in r2953. It is now very flexible:
>> - 2D/3D
>> - periodic or not
>> - uniform or psd-based size distributions
>> - distributions by mass or by number
>> - target packing by meanRad OR by number, in arbitrary size of box.
>>
> Oh excellent! Then I will try your function and perhaps we can remove mine
> which would be only redundant.
> Chiara
>
>>
>> --
>> 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
>>
>
>

Can you help with this problem?

Provide an answer of your own, or ask jessica sjah for more information if necessary.

To post a message you must log in.