This example file (Example.m) determines the percolation of fibers in a box (cuboid). The input values are:
Vf: Volume fraction of fibers in the bigger box
Bx: Side length of the box in x-direction
By: Side length of the box in y-direction
Bz: Side length of the box in z-direction
L: Length of fibers
d: Diameter of fibers
The fibers are generated in a bigger box of size (Bx+4*L, By+4*L, Bz+4*L), then cropped into the original (smaller) dimensions (Bx, By, Bz). The reason behind that is to ensure that fibers are uniformly distributed across the domain. The volume fraction of fibers in the smaller box is slightly bigger than Vf. After that, percolation is determined in z-direction from Z=0 to Z=Bz. The criteria for percolation is that the distance between fibers is d, and the distance between fibers and the planes (Z=0, Z=Bz) is d/2. If there is percolation then the value of Percolation variable is 1, otherwise it is zero.
Three figures are plotted: 1-fibers in the bigger box, 2-cropped fibers in the smaller box, and 3-the fibers with percolation in the smaller box.
The value of Vf can be increased or decreased, and the percolation will change accordingly.