## 5 New Solid Fraction Calculation Algorithm  
Solid fraction can be seen as the intersection area of particle geometry and LBM grid. There are three intersection states between particle and lattice, and the relationship between lattice position and particle center introduces more states for solid fraction calculation, which must be considered separately. Thus, it is difficult to calculate solid fraction cell by cell with different scheme. In the conventional method, intersection area is estimated by approximation of integral because it is difficult to calculate cell by cell.  
In the new solid fraction calculation algorithm, the intersection is not calculated by the local cell intersection area, and the calculation progress is taken as a whole, wherein the intersection area depends on the other pre-calculating cells. Before calculation, the possible intersect lattice cell is marked based on the particle center and radius (see Figure 6a), and the marked cell is divided into four parts (A, B, C, D). Corresponding cell index (\(i\), \(j\)) is given in each part, and the index origin of each part begins from the farthest cell from the particle center. \(i\) and \(j\) indicate the row and column (see Figure 6b), and the corresponding intersection area of (\(i\), \(j\)) cell is \(S_{i,j}\).  
\(S_{i,j}\) is calculated individually for each of the lattice groups A, B, C, D in an ascending order of \(i\) and \(j\) (see Figure 7a), in which \(S_{i,j}\) depends on all the pre-calculated \(S_{m,n}\), where \(m=1\cdots i\), \(n=1\cdots j\). Since \(S_{i,j}\) is difficult to calculate directly, a trick is used in which a new variable \(S_{i,j}^{pre}\) is defined, as shown in Equation (25). Equation (25) calculates the sum of all the pre-calculated \(S_{m,n}\), and then all the known \(S_{m,n}\)(not include \(S_{i,j}\)) are subtracted from \(S_{i,j}^{pre}\) to get \(S_{i,j}\).  
\[S_{i,j}^{pre}=\sum_{m=1}^{i}\sum_{n=1}^{j}S_{m,n} \tag{25}\]  
An example is shown in Figure 7b. To calculate \(S_{i,j}\), it is assumed that all the pre-calculated \(S_{m,n}\) are already known, and only \(S_{i-1,j}\) and \(S_{i,j-1}\) are non-zero. \(S_{i,j}^{pre}\) can easily be calculated by simple geometry description, \(S_{i,j}^{pre}=\frac{\frac{\partial\widetilde{\mathcal{C}}\times\partial A}{ \partial\widetilde{\mathcal{C}}\times\partial B}}{2}R^{2}-\overset{\rightarrow} {\mathcal{O}}\times\overset{\rightarrow}{\mathcal{O}}\overset{\rightarrow}{ B}-\overset{\rightarrow}{\mathcal{O}}\times\overset{\rightarrow}{\mathcal{O}}A\), and \(S_{i,j}=S_{i,j}^{pre}-S_{i-1,j}-S_{i,j-1}\).  
The whole progress for coding is listed as follows:  
Figure 6: Cell sets for solid fraction calculation.  
1. At every time step, the particle's new position is located, and the intersection lattice group is updated depending on the particle location. Choices of lattices for solid fraction calculation depend on the particle's center lattice location, and the lattices' type and index are updated every time step.
2. Loop A, B, C, D into four parts.
3. Loop all cells in ascending order of \(i\) and \(j\).
4. Calculate \(S_{i,j}^{pre}\), then subtract all the known \(S_{m,n}\) to obtain \(S_{i,j}\).