# porosity calculation for clumps

Dear all,

in simulations using clumps of overlapping spheres, I was wondering if the porosity is calculated correctly.

Using the following example, I obtain the same results with yade-1.20.0 and yade-2016.06a:

import numpy as np

#create a clump of two overlapping spheres:

ra=0.5

clump1=

O.bodies.

#define a total volume for porosity calculation

Vtotal=(3*ra)*ra*2

#thanks to Wolfram alpha, the analytic solution should be

print "analytic solution: ", (Vtotal - (2*4.0/3.0 - 5.0/12.

print "porosity calculated by yade: ", utils.porosity(

# a correct porosity could be calculated like this (?)

def myClumpPorosity

mass=sum([ b.state.mass for b in O.bodies if b.isClump])

return (VolTot -mass/density)

print "my porosity: ", myClumpPorosity

Is there a bug in the porosity calculation or did I understand something wrong?

Thanks for your help.

Regards,

Bettina

## Question information

- Language:
- English Edit question

- Status:
- Solved

- For:
- Yade Edit question

- Assignee:
- No assignee Edit question

- Solved by:
- Bruno Chareyre

- Solved:
- 2016-11-24

- Last query:
- 2016-11-24

- Last reply:
- 2016-11-24

Hi Bettina,

You find out that the volume(or mass) of the clump is calculated correctly (your third value).

The porosity is not and that is expected, because the porosity function just take the volumes all clump members without looking at overlaps between them (you can even have negative porosity as a consequence). De facto, the documentation of this function is mentionning spheres and only that, not clumps.

myClumpPorosity() is correct

There is also voxelPorosity, which should be be correct at the price of extra computation time.

Bruno

Bettina Suhr (bettina-suhr) said : | #2 |

Thanks Bruno Chareyre, that solved my question.