yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #27740
[Question #701782]: O.cell.volume=0 during flipCell
New question #701782 on Yade:
https://answers.launchpad.net/yade/+question/701782
Hello,
I am trying to use flipCell to avoid a RuntimeError "Body larger than half of the cell size encountered" during some periodic simulations (see my previous question about the documentation [1]). I am having a more technical issue now, it appears that in some simulations the new O.cell.hSize computed in flipCell has a determinant equal to 0.
A bit of context:
The periodic DEM simulations I am running are actually RVEs for a larger scale method (the Material Point Method), I have thus no direct control on the velocity gradient imposed to the DEM periodic cells. During a MPMxDEM granular column collapse, some RVEs get deformed a lot in unpredictable directions so I’d like to flip them whenever the cell is too much deformed. I tried to generalise the flipping condition used in [2] so it takes into account all directions, see the MWE below.
A MWE with a problematic RVE’s hSize:
```
O.periodic = True
O.cell.hSize = Matrix3(0.001767398585873738732,-3.402651098340004036e-22,-2.455726386595863492e-23, 2.840638172828420518e-23,0.004990738513508447341,-0.0009967331209356602214, -1.550207193852494163e-22,-0.001442690301487606743,0.00144229021430840711)
cond_x = abs(O.cell.hSize[0,1])>abs(O.cell.hSize[0,0]) or abs(O.cell.hSize[0,2])>abs(O.cell.hSize[0,0])
cond_y = abs(O.cell.hSize[1,0])>abs(O.cell.hSize[1,1]) or abs(O.cell.hSize[1,2])>abs(O.cell.hSize[1,1])
cond_z = abs(O.cell.hSize[2,0])>abs(O.cell.hSize[2,2]) or abs(O.cell.hSize[2,1])>abs(O.cell.hSize[2,2])
print("\nInitial hSize:", O.cell.hSize, "\nFlipping condition: ", cond_x or cond_y or cond_z, “\n”)
try: flipCell()
except RuntimeError as err:
print("\nNew hSize: ", O.cell.hSize, "\n")
raise(err)
```
Which outputs with yadedaily (git revision 406fb7a):
```
Welcome to Yade 20220206-6304~406fb7a~focal1
Using python version: 3.8.10 (default, Mar 15 2022, 12:22:08)
[GCC 9.4.0]
Warning: no X rendering available (see https://bbs.archlinux.org/viewtopic.php?id=13189)
TCP python prompt on localhost:9001, auth cookie `duacks'
XMLRPC info provider on http://localhost:21001
/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py:935: UserWarning: Attempting to work in a virtualenv. If you encounter problems, please install IPython inside the virtualenv.
warn("Attempting to work in a virtualenv. If you encounter problems, please "
Running script mwe.py
Initial hSize: Matrix3(0.001767398585873738732,-3.402651098340004036e-22,-2.455726386595863492e-23, 2.840638172828420518e-23,0.004990738513508447341,-0.0009967331209356602214, -1.550207193852494163e-22,-0.001442690301487606743,0.00144229021430840711)
Flipping condition: True
New hSize: Matrix3(0.001767398585873738732,0.001767398585873738732,0.001767398585873738732, 0.003994005392572786903,0.002000539150701466894,0.003994005392572786903, -4.000871791996330812e-07,0.002884180341437615237,-4.000871791996329224e-07)
Traceback (most recent call last):
File "/usr/bin/yadedaily", line 343, in runScript
execfile(script,globals())
File "/usr/lib/python3/dist-packages/past/builtins/misc.py", line 87, in execfile
exec_(code, myglobals, mylocals)
File "mwe.py", line 13, in <module>
raise(err)
File "mwe.py", line 10, in <module>
try: flipCell()
RuntimeError: Cell is degenerate (zero volume)
```
This error is raised because the determinant of O.cell.hSize is zero [3], which is tested because Cell::integrateAndUpdate is called in cell::postLoad [4], which is called right after changing cell::hSize in flipCell [5].
Should flipCell be able to find a flip matrix for any hSize ? Is there a problem the way I use it ?
Thanks in advance,
Sacha
[1]: https://answers.launchpad.net/yade/+question/701764
[2]: https://gitlab.com/yade-dev/trunk/-/blob/277c4f0c4a94dd1df423e8d499e56a457d356ea0/examples/PeriodicBoundaries/cellFlipping.py
[3]: https://gitlab.com/yade-dev/trunk/-/blob/277c4f0c4a94dd1df423e8d499e56a457d356ea0/core/Cell.cpp#L19
[4]: https://gitlab.com/yade-dev/trunk/-/blob/277c4f0c4a94dd1df423e8d499e56a457d356ea0/core/Cell.hpp#L178
[5]: https://gitlab.com/yade-dev/trunk/-/blob/277c4f0c4a94dd1df423e8d499e56a457d356ea0/preprocessing/dem/Shop_01.cpp#L84
--
You received this question notification because your team yade-users is
an answer contact for Yade.