## 2 Materials and Methods
### Digital Image Analysis  
Digital image analysis of the preprocessed images was performed to calculate the absolute porosity, tortuosity, and average throat size. A segmentation method was applied to separate the pores from the solid matrix in the digital image to calculate the absolute porosity (\(\phi\)) [26; 27]. The image was converted into binary format so that the pixels representing the pores (usually black pixels) and the solid matrix (white pixels) could be separated. This thresholding process can be performed manually or automatically using the Otsu algorithm to determine the optimal threshold value [28]. Once the binary image is obtained, the absolute porosity is calculated as the ratio of the number of pixels representing pores (\(N_{p}\)) to the total pixels in the image (\(N_{t}\)):  
\[\phi=\frac{N_{p}}{N_{t}} \tag{8}\]  
where \(N_{p}\) is the total pores and \(N_{t}\) is the total elements. The absolute porosity is obtained from the ratio between total pores and total elements. The fluid flow in porous media will generally take the shortest path, as shown in Figure 5.  
Figure 4: Segmentation of velocity profile to calculate the effective porosity. The flow lengths of the porous media are \(l_{1}\) and \(l_{2}\), and can be used to calculate the tortuosity (\(\tau\)) using the A* (A-star) algorithm. This algorithm is known as the efficient shortest path-finding method and is used to navigate through the pore structure in a binary image. The process starts by selecting two points in the image, usually from one side of the image to the other, and then evaluating potential paths based on distance costs and heuristics that account for the path complexity. The shortest path describes the route traveled within the pore structure, and the length of this path is compared with the length of a straight path (\(L\)) between those two points [29; 30; 31]. The tortuosity is calculated as the ratio between the actual path length (\(l_{a}\)) and the straight path length:  
\[\tau=\frac{l_{a}}{L} \tag{9}\]  
where \(l_{a}\) is the length of the flow through the fluid and \(L\) is the length of the porous media geometry. The next step involves calculating the average throat size using watershed segmentation, an algorithm designed to separate dominant watersheds and thereby determine the width of the connecting line. The mathematical model for watershed segmentation is based on the concept of height fields in image processing:  
\[D(x,y)=\min_{(x^{\prime},y^{\prime})\in W_{m}}\sqrt{(x-x^{\prime})^{2}+(y-y^{ \prime})^{2}} \tag{10}\]  
where \(W\) is the set of pixels forming the detected object edges, \(m\) is a marker, and the distance transform, \(D(x,y)\), is the Euclidean distance from each pixel \((x,y)\) to the nearest edge pixel. Markers are pixels chosen as the starting points for the flooding process and they can be determined manually or automatically by finding peaks in the distance transform or based on additional information. If \(m\) is the set of marker pixels, the flooding process can be viewed as adding water from the marker, \(m\), and inundating the height field, \(I(x,y)\). This process can be formalized using the level set function, \(L(t)\):  
\[L(t)=\{(x,y)|I(x,y)\leq t\} \tag{11}\]  
where \(I(x,y)\) is the intensity function of a two-dimensional image where \((x,y)\) represents the pixel coordinates, \(I\) is a height field, with the pixel intensity, \(I(x,y)\), representing the height at point \((x,y)\), and \(t\) is the rising water level. During the flooding process, a watershed line is formed when water from two different markers meets (\(m_{1}\),\(m_{2}\)), which can represent the following equation:  
\[\min_{(x^{\prime},y^{\prime})\in W_{m_{1}}}\sqrt{(x-x^{\prime})^{2}+(y-y^{ \prime})^{2}}=\min_{(x^{\prime},y^{\prime})\in W_{m_{2}}}\sqrt{(x-x^{\prime})^ {2}+(y-y^{\prime})^{2}} \tag{12}\]  
Figure 5: Illustrated fluid flow in porous media. The red line (\(l_{1}\)) represent the shortest path, while the blue line (\(l_{2}\)) represent the longest path.