## 2 SPH Algorithm for Acoustic Simulation
In this paper, the medium of sound propagation and interference is ideal gas; the process of sound propagation and interference is adiabatic; and the particle velocity \(u\), sound pressure \(\delta p\) and the density change of particle \(\delta p\) satisfy the following equations:  
\[\delta p<<P_{0},\delta p<<\rho_{0}  
_Algorithms_**2015**, \(8\)  
\[\Pi_{ij}= \begin{cases}\dfrac{-\alpha_{n}\overline{c_{ij}}\phi_{ij}+\beta_{n}\phi_{ j}^{2}}{\rho_{ij}^{\mathrm{L}}}&\mathbf{u}_{ij}^{\mathrm{L}}\cdot\mathbf{r}_{ij}<0\\ 0&\mathbf{u}_{ij}^{\mathrm{L}}\cdot\mathbf{r}_{ij}\geq 0\end{cases}  \tag{12}\]  
where \(\alpha\Pi\), \(\beta\Pi\) are adjustable non-dimensional constant. \(\overline{\rho_{ij}^{L}}=\left(\rho_{i}^{L}+\rho_{j}^{L}\right)/2\), \(\overline{c_{ij}}=\left(c_{i}+c_{j}\right)/2\). \(c_{i}\) and \(c_{j}\) separately indicate the sound speed of particle \(i\) and \(j\), and both \(c_{i}\) and \(c_{j}\) are equal to \(c_{0}\). In Equation (12), the expression of \(\phi_{ij}\) can be written as:  
\[\phi_{ij}=\dfrac{h_{ij}\mathbf{u}_{ij}^{\mathrm{L}}\cdot\mathbf{r}_{ij}}{\left|\mathbf{r}_{ ij}\right|^{2}+\varphi^{2}} \tag{13}\]  
where the factor \(\varphi=0.1h_{ij}\), \(h_{ij}=(h_{i}+h_{j})/2\). \(h_{i}\) and \(h_{j}\) indicate the smoothing length of particles \(i\) and \(j\), respectively, and both of them are equal to \(h\). The smoothing length is constant in this work. Algorithm 1 shows the detail steps of acoustic wave simulation. ```
begin Initialization phase  Generate sound source according to function of sound pressure \(p=f(t,x)\) while (time step \(<\) total time step) for all particle \(i\)do  Calculate the spatial derivative of smoothing kernel \(\
abla_{i}W_{ij}\)  Compute the derivative of the density change with respect to time \(\dfrac{D\left(\delta\rho_{i}^{\mathrm{L}}\right)}{Dt}\)  Calculate the pressure change \(\delta p_{i}^{\mathrm{L}}\) using \(\delta\rho_{i}^{\mathrm{L}}\)  Compute the derivative of the velocity with respect to time \(\dfrac{D\mathbf{u}_{i}^{\mathrm{L}}}{Dt}\)  Introduce the **artificial viscosity term**, and recompute \(\dfrac{D\mathbf{u}_{i}^{\mathrm{L}}}{Dt}\)  Compute \(\delta\rho_{i}^{\mathrm{L}}\), \(\mathbf{u}_{i}^{\mathrm{L}}\) using the **second order leap-frog integration endfor  Recompute the sound source according to function of sound pressure \(p=f(t,x)\) endwhile  Return the simulation result, which includes sound pressure, density change, and so on. end
```  
**Algorithm 1**The SPH algorithmic description for acoustic wave simulation. In Algorithm 1, the second order leap-frog integration [28] is used to compute \(\delta\rho_{i}^{\mathrm{L}}\), \(\mathbf{u}_{i}^{\mathrm{L}}\), since there is low memory storage required and high efficiency in the computation. The expressions can be written as:  
\[\delta\rho_{i}^{\mathrm{L}}(t+\Delta t/2)=\delta\rho_{i}^{\mathrm{L}}(t-\Delta t /2)+\Delta t\dfrac{D\left(\delta\rho_{i}^{\mathrm{L}}\right)}{Dt} \tag{14}\]  
\[\mathbf{u}_{i}^{\mathrm{L}}(t+\Delta t/2)=\mathbf{u}_{i}^{\mathrm{L}}(t-\Delta t/2)+ \Delta t\dfrac{D\mathbf{u}_{i}^{\mathrm{L}}}{Dt} \tag{15}\]where \(\Delta t\) is the time step. In practice, time step \(\Delta t\) should be larger than that estimated using the Courant-Friedrichs-Levy (CFL) condition [25]. In this work, this condition is represented by:  
\[\Delta t=\frac{h}{c_{0}} \tag{16}\]