informations about packing

Asked by jacopo

hi i'm new in YADE. I have a question about packing simulations. I m doing a particles deposition in a script and in another one i m doing a crash impact of a falling mass. The parameters of the falling mass are fixed. I have to work on a soil modeling. I m doing a lot of test and i notice that sometimes if i repeat two times the same deposition, and i export it in the script impact, i obtain different value of "force-impact". The results aren't so different but are different. I m near to the value that i have to reach, but now that i m not changing so much the deposition parameters value ( like poisson = 0.2 and then poisson=0.21 and same for young).
the problem is: (if i obtained a force impact of 420 kN with a young 16671305 and i change it in 15690640, that is lower, i obtain a higher value(470), and if i repeat the deposition with the same young i obtain again another value, near the first one but not the same. the %error is not so big but however we are talking about kN, but i m expected that repeating the test with the same value it will return the same result.

is something wrong on my code??
so is it possible that yade give me a range of values??
 and if yes how can i avoid it and be more precision?

( the second script is always fixed, i only change the name of the "particles deposited positions" and upload the choosen material parameters)

script:
from yade import pack, plot
from yade import export, ymport
from yade import export, ymport

O.bodies.append(geom.facetCylinder(center=(0,0,1.25), radius=5.35, height=2.5, orientation=Quaternion((0, 0, 1), 0), segmentsNumber=100, wallMask=6, angleRange=None, closeGap=False, radiusTopInner=-1, radiusBottomInner=-1))

pred=pack.inCylinder(centerBottom=(0,0,0),centerTop=(0,0,2.15),radius=5.34)

idSoil=FrictMat(density=1460,frictionAngle=radians(28),label='soil',young=15690640,poisson=0.2)

O.materials.append(idSoil)

spheres=pack.randomDensePack(pred,radius=0.08,color=(0,0,1),spheresInCell=2000,memoDbg=False,memoizeDb=None,material='soil')

O.bodies.append(spheres)

O.engines=[
   ForceResetter(),
   InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
   InteractionLoop(

      [Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom()],
      [Ip2_FrictMat_FrictMat_FrictPhys()],
      [Law2_ScGeom_FrictPhys_CundallStrack()]
   ),
   NewtonIntegrator(gravity=(0,0,-9.81),damping=0),
   PyRunner(command='checkUnbalanced()',iterPeriod=10),
]

O.trackEnergy=True

############################################################################
######################### DEFINING FUNCTIONS ###############################
############################################################################

def checkUnbalanced():
   if O.time > 2.5 :
      O.pause()
      export.textExt('depoDENSITA1460Y160P20F28.txt',format='x_y_z_r',comment='Final state of the spheres')

O.dt=.8*PWaveTimeStep()
O.run()
#O.stopAtIter=maxIt;
O.saveTmp()

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Jan Stránský
Solved:
Last query:
Last reply:
Revision history for this message
Jan Stránský (honzik) said :
#1

Hello,

> spheres=pack.randomDensePack(...

randomDensePack, as the name of the function suggests, creates a random packing. You have different packing and therefore different results for each run.

A solution is to run the randomDensePack once (in an external script?), save the positions and use the saved values for all next runs. You can also specify memoizeDb parameter to save/load the packing automatically to a file.

Another option is to use SpherePack.makeCloud with seed parameter.

Also running the program on multiple cores leads to non-unique results (too lazy to search corresponding question :-)

cheers
Jan

Revision history for this message
jacopo (varrialeee) said :
#2

I can t save The particles position And use IT for all The runs Becouse when i change The material parameters The particles change their interactions And have To do again the deposition, i m Also lunching with more cores.... What Is the seed parameter? Or do you think that this Is not a problem? Like ones time i reach the right result I will continue to use The same deposition for all the next test, But i know that if i remake The same deposition the results could change a lit.... Is IT acceptable this for yade users? ( please if you can explain me The seed parameter And provide an example) will change In The same way the result?
________________________________
Da: <email address hidden> <email address hidden> per conto di Jan Stránský <email address hidden>
Inviato: mercoledì 13 giugno 2018 10:38:39
A: Jacopo Varriale
Oggetto: Re: [Question #670169]: informations about packing

Your question #670169 on Yade changed:
https://answers.launchpad.net/yade/+question/670169

    Status: Open => Answered

Jan Stránský proposed the following answer:
Hello,

> spheres=pack.randomDensePack(...

randomDensePack, as the name of the function suggests, creates a random
packing. You have different packing and therefore different results for
each run.

A solution is to run the randomDensePack once (in an external script?),
save the positions and use the saved values for all next runs. You can
also specify memoizeDb parameter to save/load the packing automatically
to a file.

Another option is to use SpherePack.makeCloud with seed parameter.

Also running the program on multiple cores leads to non-unique results
(too lazy to search corresponding question :-)

cheers
Jan

--
If this answers your question, please go to the following page to let us
know that it is solved:
https://answers.launchpad.net/yade/+question/670169/+confirm?answer_id=0

If you still need help, you can reply to this email or go to the
following page to enter your feedback:
https://answers.launchpad.net/yade/+question/670169

You received this question notification because you asked the question.

Revision history for this message
Jan Stránský (honzik) said :
#3

> I can t save The particles position And use IT for all The runs Becouse when i change The material parameters The particles change their interactions And have To do again the deposition

> but i m expected that repeating the test with the same value it will return the same result.

sorry, I did not get this point..
If you want to get exactly the same results, you have to run the simulation with the same parameters and also with exactly the same initial packing (i.e. not using your current randomDensePack approach)
If you run different simulations ("Becouse when i change The material parameters"), you get different results, no surprise..

> i m Also lunching with more cores.

see [1]

cheers
Jan

[1] https://answers.launchpad.net/yade/+question/665405

Revision history for this message
jacopo (varrialeee) said :
#4

Every time i want To test a soil i use The script that i posted before. When The deposition ends i take The particles position And i copy them in another script( The impact script, that i didn t post here) The problem Is: if i run Two Times The same particles deposition with The same material parameters, when i put The positions in The script impact i obtain two results a little bit different, And i wanted To know How can i avoid IT
________________________________
Da: <email address hidden> <email address hidden> per conto di Jan Stránský <email address hidden>
Inviato: mercoledì 13 giugno 2018 11:56:54
A: Jacopo Varriale
Oggetto: Re: [Question #670169]: informations about packing

Your question #670169 on Yade changed:
https://answers.launchpad.net/yade/+question/670169

    Status: Open => Answered

Jan Stránský proposed the following answer:
> I can t save The particles position And use IT for all The runs
Becouse when i change The material parameters The particles change their
interactions And have To do again the deposition

> but i m expected that repeating the test with the same value it will
return the same result.

sorry, I did not get this point..
If you want to get exactly the same results, you have to run the simulation with the same parameters and also with exactly the same initial packing (i.e. not using your current randomDensePack approach)
If you run different simulations ("Becouse when i change The material parameters"), you get different results, no surprise..

> i m Also lunching with more cores.

see [1]

cheers
Jan

[1] https://answers.launchpad.net/yade/+question/665405

--
If this answers your question, please go to the following page to let us
know that it is solved:
https://answers.launchpad.net/yade/+question/670169/+confirm?answer_id=2

If you still need help, you can reply to this email or go to the
following page to enter your feedback:
https://answers.launchpad.net/yade/+question/670169

You received this question notification because you asked the question.

Revision history for this message
Jan Stránský (honzik) said :
#5

Hello,

> if i run Two Times The same particles deposition with The same material parameters

as explained above (in #1), with your usage of randomDensePack, you do NOT run the same deposition, since the initial positions are different.
The same material parameters are necessary but not sufficient condition.

> when i put The positions in The script impact i obtain two results a little bit different

see above, the final result of depositions are not the same, therefore their usage in another simulation implies different results.

> And i wanted To know How can i avoid IT

as explained above (in #1), you can:
- avoid randomDensePack, loading the particles from pre-saved file
- use randomDensePack, but with memoizeDb argument
- use makeCloud instead of randomDensePack with constant nonzero seed argument

cheers
Jan

Revision history for this message
jacopo (varrialeee) said :
#6

- use makeCloud instead of randomDensePack with constant nonzero seed argument

can i put all the value that i want? what means this paramenter? however thanks i ll try to do again with makecloud

________________________________
Da: <email address hidden> <email address hidden> per conto di Jan Stránský <email address hidden>
Inviato: mercoledì 13 giugno 2018 12:47:23
A: Jacopo Varriale
Oggetto: Re: [Question #670169]: informations about packing

Your question #670169 on Yade changed:
https://answers.launchpad.net/yade/+question/670169

    Status: Open => Answered

Jan Stránský proposed the following answer:
Hello,

> if i run Two Times The same particles deposition with The same
material parameters

as explained above (in #1), with your usage of randomDensePack, you do NOT run the same deposition, since the initial positions are different.
The same material parameters are necessary but not sufficient condition.

> when i put The positions in The script impact i obtain two results a
little bit different

see above, the final result of depositions are not the same, therefore
their usage in another simulation implies different results.

> And i wanted To know How can i avoid IT

as explained above (in #1), you can:
- avoid randomDensePack, loading the particles from pre-saved file
- use randomDensePack, but with memoizeDb argument
- use makeCloud instead of randomDensePack with constant nonzero seed argument

cheers
Jan

--
If this answers your question, please go to the following page to let us
know that it is solved:
https://answers.launchpad.net/yade/+question/670169/+confirm?answer_id=4

If you still need help, you can reply to this email or go to the
following page to enter your feedback:
https://answers.launchpad.net/yade/+question/670169

You received this question notification because you asked the question.

Revision history for this message
Jan Stránský (honzik) said :
#7

> can i put all the value that i want? what means this paramenter?

randomDensePack uses makeCloud intenrally, so I guess you can.
makeCloud creates a loose packing. But since you do gravity deposition, it should not be a very big problem (if yes, use the other two options)

cheers
Jan

[1] https://yade-dem.org/doc/yade.pack.html#yade._packSpheres.SpherePack.makeCloud
[2] https://yade-dem.org/doc/yade.pack.html#yade.pack.filterSpherePack

Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#8

Hi,
I think you are posing a solutionless problem.
First, if you don't want different results from two impact simulations, initialize them with the same deposited positions.
By repeating two depositions you created the problem you are now trying to solve (as technically explained by Jan).

I understand you would like to measure the effects of small changes of input parameters (e.g. changing Poisson from 0.2 to 0.2001) ant so you don't like to be dominated by random fluctuations, but what you are after is not possible.

You could examine the effect of any parameter which lets you re-use the same deposited positions: timestep, contact friction, impact velocity... It would show you that in all cases a very small change of one input parameter can lead to unbounded change of the response - even if you ran just one deposition throughout the process. The only solution is to do some statistics on a large number of runs with same micro-parameter and different depositions, it cannot be turned into a deterministic problem just by sticking to one deposition.

Cheers
Bruno

Revision history for this message
jacopo (varrialeee) said :
#9

ok i tryied with makecloud as you suggest, and it works! also the "script impact" gives the same identical results, and this is perfect for me.
But now i have another question.
can be possible that makecloud code takes more time to be compiled?
-> i m lounching simulations using a university server.(I m connected from remote and i m lounching with 2 cores each simulation since a maximum of 4 simulations running simultaniusly--8 cores--)
-> the deposition is inside a cylinder of 10.7 [m] diameter, and 2 [m] of height. The particles have 0.03 [m] of diameter-----> 1 million of body more or less.
-> with randomdensepack it takes 5 hours to complete the simulation, with makecloud in one night it not even complete "the constraction" , is still creating particles. (if i rise the particles dimension to 0.06,it runs in less time of course)

-----> so can i modified in same way makecloud to let it take less time?? this is my code:

from yade import pack, plot
from yade import export, ymport
from yade import export, ymport

O.bodies.append(wall((0,0,2), axis=2, sense=-1, color=(0,1,0), mask=1))

O.bodies.append(geom.facetCylinder(center=(0,0,2.2), radius=5.35, height=4.4, orientation=Quaternion((0, 0, 1), 0), segmentsNumber=100, wallMask=6, angleRange=None, closeGap=False))

idSoil=FrictMat(density=1480,frictionAngle=radians(28),label='soil',young=13729310,poisson=0.2)

O.materials.append(idSoil)

sp = pack.SpherePack()
minCorner = (-6,-6,0)
maxCorner = (6,6,4.2)
sp.makeCloud(maxCorner=maxCorner,minCorner=minCorner,rMean=0.03, seed=1)
pred = pack.inCylinder((0,0,0),(0,0,4.2),radius=5.34)
for c,r in sp:
 if pred(c,r): # determines if a sphere with center c and radius r is inside
  #predicate...
   O.bodies.append(sphere(c,r)) # ... if yes, append it to simulation

O.engines=[
   ForceResetter(),
   InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
   InteractionLoop(

      [Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom()],
      [Ip2_FrictMat_FrictMat_FrictPhys()],
      [Law2_ScGeom_FrictPhys_CundallStrack()]
   ),
   NewtonIntegrator(gravity=(0,0,-9.81),damping=0),
   PyRunner(command='checkUnbalanced()',iterPeriod=10),
]

O.trackEnergy=True

############################################################################
######################### DEFINING FUNCTIONS ###############################
############################################################################

def checkUnbalanced():
   if O.time > 2.5 :
      O.pause()
      export.textExt('depoMAKECLOUDD1480Y140P0.2F28.txt',format='x_y_z_r',comment='Final state of the spheres')

O.dt=.8*PWaveTimeStep()
O.run()
#O.stopAtIter=maxIt;
O.saveTmp()

________________________________
Da: <email address hidden> <email address hidden> per conto di Bruno Chareyre <email address hidden>
Inviato: mercoledì 13 giugno 2018 13:57:21
A: Jacopo Varriale
Oggetto: Re: [Question #670169]: informations about packing

Your question #670169 on Yade changed:
https://answers.launchpad.net/yade/+question/670169

Bruno Chareyre proposed the following answer:
Hi,
I think you are posing a solutionless problem.
First, if you don't want different results from two impact simulations, initialize them with the same deposited positions.
By repeating two depositions you created the problem you are now trying to solve (as technically explained by Jan).

I understand you would like to measure the effects of small changes of
input parameters (e.g. changing Poisson from 0.2 to 0.2001) ant so you
don't like to be dominated by random fluctuations, but what you are
after is not possible.

You could examine the effect of any parameter which lets you re-use the
same deposited positions: timestep, contact friction, impact velocity...
It would show you that in all cases a very small change of one input
parameter can lead to unbounded change of the response - even if you ran
just one deposition throughout the process. The only solution is to do
some statistics on a large number of runs with same micro-parameter and
different depositions, it cannot be turned into a deterministic problem
just by sticking to one deposition.

Cheers
Bruno

--
If this answers your question, please go to the following page to let us
know that it is solved:
https://answers.launchpad.net/yade/+question/670169/+confirm?answer_id=7

If you still need help, you can reply to this email or go to the
following page to enter your feedback:
https://answers.launchpad.net/yade/+question/670169

You received this question notification because you asked the question.

Revision history for this message
Jan Stránský (honzik) said :
#10

> can be possible that makecloud code takes more time to be compiled?

yes, while makeCloud position all particles at once, randomDensePack only evaluate positions of spheresInCell particles (2000 in your case) and than copy them wherever needed.

You still may consider to use the other two options I mentioned (run randomDensePack once externally and than use the result or specify memoizeDb argument), both being (from initial packing point of view) identical to makeCloud with fixed seed.

cheers
Jan

Revision history for this message
jacopo (varrialeee) said :
#11

ok i tryied yesterday with memoizDB inside randomdensePack, and i saw that at first launch he creates the particles, and if i lounch again with the same soil parameters i obtain the same results, and it s fine for me.

BUt if i change soil paramenters he creates a new file "Sqlite" and a new deposition, that i can reach faster later and with the same particles number.

->The problem in this case is that both simulations are affected by a random packing at the beggining, and i can 't know if the random error is the same.. i don't know if explain weel the concept.(they are both creating with a random code, so the file that memozDB creates is affacted by a randomic "error", and i can't estimate it, and it gives me a lot of noise when i work with very little differcences in soil parameters)

- another way could be saving the particles position after graviti deposition, then import in another script and give to it the material parameters, then i should see an "explosion" of particles that have to be re-assetted. But i don't know if the soil that i would obtain in this way is feasable, becouse after the "explosion" i don't know with which criterion the particles will assest.

________________________________
Da: <email address hidden> <email address hidden> per conto di Jan Stránský <email address hidden>
Inviato: venerdì 15 giugno 2018 16:03:09
A: Jacopo Varriale
Oggetto: Re: [Question #670169]: informations about packing

Your question #670169 on Yade changed:
https://answers.launchpad.net/yade/+question/670169

    Status: Open => Answered

Jan Stránský proposed the following answer:
> can be possible that makecloud code takes more time to be compiled?

yes, while makeCloud position all particles at once, randomDensePack
only evaluate positions of spheresInCell particles (2000 in your case)
and than copy them wherever needed.

You still may consider to use the other two options I mentioned (run
randomDensePack once externally and than use the result or specify
memoizeDb argument), both being (from initial packing point of view)
identical to makeCloud with fixed seed.

cheers
Jan

--
If this answers your question, please go to the following page to let us
know that it is solved:
https://answers.launchpad.net/yade/+question/670169/+confirm?answer_id=9

If you still need help, you can reply to this email or go to the
following page to enter your feedback:
https://answers.launchpad.net/yade/+question/670169

You received this question notification because you asked the question.

Revision history for this message
Best Jan Stránský (honzik) said :
#12

Hello,

> and it gives me a lot of noise when i work with very little differcences in soil parameters)

see Bruno's answer #8, a statistical analysis is an option

- another way could be saving the particles position after graviti deposition, then import in another script and give to it the material parameters, then i should see an "explosion" of particles that have to be re-assetted.

You can try:
- decrease time step
- use the same or larger stiffness for gravity deposition than for actual simulation

cheers
Jan

Revision history for this message
jacopo (varrialeee) said :
#13

Thanks Jan Stránský, that solved my question.

Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#14

Let me amend the first part of #8 for future reference, else the post sounds self contradictory.
#8 says:
"if you don't want different results from two impact simulations, initialize them with the same deposited positions."

That is, if you don't want to SEE that the results can be different, initialize with same positions. It will only work as long as everything, strictly all parameters, are the same, and if you don't run in parallel. If you change the last digit of something or if you run in parallel it is always random.

Conclusion: it is useless to seek repeatability, since the corresponding result is not superior in any way to a randomized output. It is like claiming that a sensor is better than another because the measurement error of the former, though unknown, is always the same. What we want from a sensor is the error to be small, not to be repeatable (*).

Bruno

(*) An error here is what would remain after calibration. Forget "if it's repeatable it can be calibrated" since it would not help for the above problem - there is no way to calibrate.