The equation of a sphere, centered at point x0, y0, z0 of radius R is;
(x-x0)^2 + (y-y0)^2 + (z-z0)^2 = R2
So create your cube, cycle through each of the i's and j's of each layer, substituting in the corresponding mid-block x, y and z's into the above equation to solve for R2
If the R2 is less than your radius^2, then set porosity = your desired poro. If R2 is greater than your radius^2, then set porosity = zero





Reply With Quote

Bookmarks