# Why the sum of TW.volume is not equal to the volume of pack

Dear all,

I use TesselationWrapper to compute the volume of spheres, but I find that the sum of TW.volume is not equal to the volume of pack. Does the Voronoi cell of each sphere overlap each other?

I run the MWE and I got

volume=

TW_Volume=

Thanks for any suggestion.

####MWE####

import numpy as np

O.periodic=True

O.cell.

num_spheres=1000 # number of spheres

den_ball=2600 # density of particles from the experimental test

young=1e8

iso_pressure=-1e4

compFricDegree = 30 # initial contact friction during the confining phase

O.materials.

sp=pack.

sp.makeCloud(

sp.toSimulation

O.engines=[

ForceResetter(),

InsertionSortC

InteractionLoop(

[Ig2_

[Ip2_

NewtonIntegrat

PeriTriaxContr

]

O.dt=PWaveTimeS

O.run();O.wait()

TW=TesselationW

TW.triangulate()

TW.setState()

TW.computeVolumes()

TW_Volume=0

for i in range(1000):

TW_Volume += TW.volume(i)

print('

## Question information

- Language:
- English Edit question

- Status:
- Solved

- For:
- Yade Edit question

- Assignee:
- No assignee Edit question

- Solved by:
- Chareyre

- Solved:
- 2020-06-11

- Last query:
- 2020-06-11

- Last reply:
- 2020-06-08

Robert Caulk (rcaulk) said : | #1 |

I suppose the periodic cell volume may not be estimated in the same way as the periodic tesselationwrapper. Do you notice the same inconsistency when you use non-periodic boundary conditions?

Chu (arcoubuntu) said : | #2 |

Dear Robert,

Thank you for your suggestion. I used non-periodic boundary and I got TW_Volume=

In addition, I got different result when I set different young, such as

TW_Volume=

TW_Volume=

TW_Volume=

It's interesting, the larger the young, the smaller the error.

####MWE####

from yade import pack

num_spheres=1000# number of spheres

young=1e6

compFricDegree = 3 # initial contact friction during the confining phase

mn,mx=Vector3(

O.materials.

O.materials.

walls=aabbWalls

wallIds=

sp=pack.

sp.makeCloud(

sp.toSimulation

triax=TriaxialS

maxMultiplier=

finalMaxMultip

thickness = 0,

stressMask = 7,

internalCompac

)

newton=

O.engines=[

ForceResetter(),

InsertionSortC

InteractionLoop(

[Ig2_

[Ip2_

[Law2_

),

GlobalStiffnes

triax,

newton

]

triax.goal1=

while 1:

O.run(1000, True)

unb=unbalance

if unb<0.001 and abs(-10000-

break

TW=TesselationW

TW.triangulate()

TW.setState()

TW.computeVolumes()

TW_Volume=0

for b in O.bodies:

if isinstance(

TW_Volume += TW.volume(b.id)

print('

Robert Caulk (rcaulk) said : | #3 |

Thankyou, and then increasing the number of particles decreases or increases the discrepancy?

Robert Caulk (rcaulk) said : | #4 |

Looking at the source code, it looks like the original author (Bruno?) added a FIXME [1] saying we still need to properly define volumes for spheres on the borders. Looking at the function where the volume is computed for each sphere [2], it looks like fictitious vertices are neglected in the calculation of the volumes. It makes sense since these vertices are usually placed extremely far from the packing in order to generate a boundary. Further, if a cell is fictitious (if it is a boundary condition cell) then it is also neglected from the calculation. Finally, I see nothing here to consider periodicity. This all means that any volume that you might expect to be accounted for along the boundary of a packing appears to not be calculated. I guess these edge geometries are computed in the saveVTK(

At the end, you should probably just take a volume as a relative value and stick with one function or the other.

[1]https:/

[2]https:/

Chareyre (bruno-chareyre-9) said : | #5 |

Hi,

They are expected differences.

For the periodic case the problem is just that you apply non-periodic

triangulation to a periodic problem.

Triangulation defines a bounding box, and you get the volume of this box.

It is obviously larger than a period since some bodies are overlapping the

split between periods.

For effect of Young (much smaller) the reason is the same, if the spheres

overlap the walls then the bounding box is also a bit larger.

FlowEngine implements a triangulation with more options, so that we can

impose where the walls are and get exact volume.

Regards

Bruno

Chu (arcoubuntu) said : | #6 |

Thanks Chareyre, that solved my question.

Chu (arcoubuntu) said : | #7 |

Hi Robert,

Thank you for your suggestions. You point out that TesselationWrapper shoudn't be used in non-periodic boundary conditions.

>increasing the number of particles decreases or increases the discrepancy?

When the volume of pack is 1.0

TW_Volume=

TW_Volume=

TW_Volume=

Chu (arcoubuntu) said : | #8 |

Hi Bruno,

Thank you for your suggestions. I got good result with FlowEnigne in periodic boundary conditions.

Robert Caulk (rcaulk) said : | #9 |

> You point out that TesselationWrapper shoudn't be used in non-periodic boundary conditions.

Nope. I said periodic conditions are not considered in TesselationWrapper.

Chu (arcoubuntu) said : | #10 |

My fault, non-periodic -> periodic :-)