## 2 Numerical Method and Model Development
### Spatial Discretization and Adaptive Algorithm
#### 2.3.2 SPH Adaptive Algorithm  
* Dynamic refinement and coarsening algorithm  
Following the initial discretization of the overall computational domain, the refinement of particles within the region of interest is performed at the beginning of the numerical calculations to achieve high calculation accuracy. Inspired by previous studies on the refinement algorithm [42; 43], a parent particle, within the initially and uniformly discretized computational domain, requiring refinement is split into eight child particles by using a pre-defined cubic refinement pattern as shown in Figure 4. The parent particle is located in the center of the cubic comprising the eight child particles. Thus, the distance between two neighboring child particles, \(\Delta d_{\text{c}}\), is determined by  
\[\Delta d_{\text{c}}=\varepsilon\Delta d_{\text{p}} \tag{11}\]  
where the subscripts c and p, respectively, represent the child particle and the parent particle, \(\Delta d_{\text{p}}\) is the initial distance between neighboring parent particles, and \(\varepsilon\) is the separation ratio ranging from 0 to 1. In addition, the smooth length of the child particle \(h_{\text{c}}\) is expressed as  
\[h_{\text{c}}=\varepsilon h_{\text{p}} \tag{12}\]  
where \(h_{\text{p}}\) is the smooth length of the parent particle and \(\varepsilon\) denotes the smooth length ratio ranging from 0 to 1. The two refinement parameters, \(\varepsilon=0.5\) and \(\varepsilon=0.5\), are utilized in this work to warrant the same number of neighboring particles before and after refinement. Figure 4: Schematic of the cubic refinement pattern for a 3D computational domain. The black and the red dots denote the parent and the child particles, respectively. \(\Delta d_{\text{c}}\) and \(\Delta d_{\text{p}}\) are the distance between two neighboring child particles and the distance between two neighboring parent particles, respectively. The physical properties of the child particle, the mass \(m_{\rm c}\) and the velocity \(u_{\rm c}\), are derived from the parent particle as  
\[m_{\rm c}=\lambda_{\rm c}m_{\rm P} \tag{13}\]  
\[u_{\rm c}=u_{\rm P} \tag{14}\]  
where \(\lambda_{\rm c}\) is the refinement coefficient. This is determined based on the refinement pattern and set as 0.125 to achieve a cubic refinement pattern in this work. Consequently, the mass, the energy, the linear momentum, and the angular momentum conservation equations are expressed as  
\[m_{\rm P}=\sum\limits_{c=1}^{8}\lambda_{\rm c}m_{\rm c} \tag{15}\]  
\[\frac{1}{2}m_{\rm P}{u_{\rm P}}^{2}=\sum\limits_{c=1}^{8}m_{\rm c}{u_{\rm c}}^{ 2} \tag{16}\]  
\[m_{\rm P}{u_{\rm P}}=\sum\limits_{c=1}^{8}m_{\rm c}{u_{\rm c}} \tag{17}\]  
\[r_{\rm P}\times m_{\rm P}{u_{\rm P}}=\sum\limits_{c=1}^{8}\mathbf{r_{\rm c}}\times m _{\rm c}{u_{\rm c}} \tag{18}\]  
To further increase the efficiency of the SPH adaptive algorithm, a coarsening algorithm can be reasonably developed to dynamically remove the numerous child particles that move out of the interested region. Inspired by our previous study on the dynamic coarsening algorithm for a 2D computational domain [41], this work further improves the dynamic refining and coarsening algorithm to render it feasible for a 3D computational domain. Once a parent particle enters the region of interest (refinement region), it is split into eight child particles. To conserve all parameters, the parent particle is inactivated and the eight affiliated child particles are simultaneously activated. The inactivated parent particle passively moves with the flow field and all the parameters of the parent particle are not involved in any calculations. Once the parent particle exits the refinement region, it is immediately activated to be involved in the calculations and the eight affiliated child particles are simultaneously removed from the calculation domain. In general, the improved dynamic refinement and coarsening algorithm can simultaneously realize high accuracy, high efficiency, and better conservations during calculations.