Use flipCell in periodic simulations

Asked by Sacha Duverger


I'd like to use the flipCell function to avoid the RuntimeError "Body larger than half of the cell size encountered" during some periodic simulations.

According to the documentation [1], when calling this function one should also reset the Interaction.cellDist of boundary particles and re-initialise the collider. However, in an example in the source code [2], flipCell is called without any additional operation.

Has flipCell been improved since its documentation was redacted so one don't have to mind Interaction.cellDist and the collider ? Is it safe to use it as in [2] ?

Thanks in advance,



Question information

English Edit question
Yade Edit question
No assignee Edit question
Solved by:
Bruno Chareyre
Last query:
Last reply:
Revision history for this message
Best Bruno Chareyre (bruno-chareyre) said :

[1] is outdated, or maybe just misleading (it says "it needs to be done", not "it's not done").
And, yes, [2] is safe, I'm using this mechanism routinely and I never distinguished any sort of discontinuity or weird response associated to flipping.
We could probably implement it as a Cell method since currently everyone has to re-type something like:
O.engines=O.engines+[PyRunner(command='if O.cell.hSize[0,1]>O.cell.hSize[0,0]: flipCell()',iterPeriod=20)]


Revision history for this message
Sacha Duverger (schmxprr) said :

Thank you for these precisions. I am now having a problem when trying to use cellFlip on a randomly deformed cell, I opened a new question about that [3].




Revision history for this message
Sacha Duverger (schmxprr) said :

Thanks Bruno Chareyre, that solved my question.