# The staggered finite-difference method (交错网格有限差分方法)

## One-dimensional problem

We consider 1d model problem for acoustic problem:$\frac{\partial u}{\partial t} – \frac{\partial v}{\partial x} =0, \quad \frac{\partial v}{\partial t} – \frac{\partial u}{\partial x} =0. \tag{1}$

### FD scheme

Let $$u_i^n$$ be the approximation of $$u(x_i, t_n)$$ for the uniform mesh with $$x_i=i h, t^n = n \tau$$. The finite difference scheme can be expressed as follows\begin{align} \frac{u_i^{n+\frac{1}{2}}-u_i^{n-\frac{1}{2}}}{\tau} – \frac{v_{i+\frac{1}{2}}^n – v_{i-\frac{1}{2}}^n}{h} =0 , \\ \frac{v_{i+\frac{1}{2}}^{n+1}-v_{i+\frac{1}{2}}^{n}}{\tau} – \frac{u_{i+1}^{n+\frac{1}{2}} – u_{i}^{n+\frac{1}{2}}}{h} =0 . \end{align} \tag{2} For other schemes, see, e.g., .

We can interpret (2) in another viewpoint. Making a integration of $$u_t-v_x=0$$ on the interval $$(x_{i-1/2}, x_{i+1/2})$$, we have$\int_{x_{i-1/2}}^{x_{i+1/2}} \frac{\partial u}{\partial t}(x,t_n) dx = \int_{x_{i-1/2}}^{x_{i+1/2}} \frac{\partial v}{\partial x}(x,t_n) dx =v(x_{i+1/2},t_n)-v(x_{i-1/2},t_n).$By using the mid-point quadrature formula, we have (note $$x_{i+1/2}-x_{i-1/2}=h$$)$h \frac{\partial u}{\partial t}(x_i,t_n) = v(x_{i+1/2},t_n)-v(x_{i-1/2},t_n).$Next, using the center difference formula for $$\frac{\partial u}{\partial t}$$ at $$t_n$$ leads to (note $$t_{n+1/2}-t_{n-1/2}=\tau$$)$h \frac{u(x_i,t_{n+1/2})-u(x_i,t_{n-1/2})}{\tau} = v(x_{i+1/2})-v(x_{i-1/2}), \tag{3}$which is the same as (2).

### Numerical results

Example 1 (Homogenous BC, ). Let $$\Omega=[-L,L]$$. Suppose the acoustics has the pressure$u(x,0)=\begin{cases} 1-\cos (x+\pi), & \text{if } |x|\leq \pi, \\ 0, & \text{if } \pi <|x|\leq L, \\ \end{cases}$The boundary condition is set to be zero, i.e., $$u(-L,t)=u(L,t)=0$$. The velocity satisfies $$v(x,0)=0$$ for all $$x\in \Omega$$. In numerical test, we set $$L=10$$.

Example 2 (Non-homogenous BC). Let $$\Omega=(0,b)$$. Suppose the acoustics has the boundary condition:$\begin{cases} u(0,t)=\sin t, \\ u(b,t)=0, \end{cases}\quad \begin{cases} v(0,t)=0, \\ v(b,t)=0. \end{cases} .$The initial conditions are set to be zero, i.e., $$u(x,0)=v(x,0)=0$$. The velocity satisfies $$v(x,0)=0$$ for all $$x\in \Omega$$.

## Two-dimensional problem

Given a bounded rectangular domain $$\Omega\subset \mathbb{R}^2$$. We consider 2d model problem for acoustic problem: Find $$u\in \mathbb{R},\mathbf{v}=[v,w]^T\in \mathbb{R}^2$$ s.t.$\frac{\partial u}{\partial t} – \nabla\cdot \mathbf{v} =0, \quad \frac{\partial \mathbf{v}}{\partial t} – \nabla u = 0,\quad \text{in }\Omega.$

### Staggered FD scheme 2D

Let $$u_{i,j}^n$$ be the approximation of $$u(x_i, y_i, t_n)$$ for the uniform mesh with $$x_i=i h, y_j=jh, t^n = n \tau$$. The staggered finite difference scheme can be expressed as follows$\frac{u_{i,j}^{n+\frac{1}{2}}-u_{i,j}^{n-\frac{1}{2}}}{\tau} – \frac{v_{i+\frac{1}{2},j}^n – v_{i-\frac{1}{2},j}^n}{h} – \frac{w_{i,j+\frac{1}{2}}^n – w_{i,j-\frac{1}{2}}^n}{h} = 0, \\ \frac{v_{i+\frac{1}{2},j}^{n+1}-v_{i+\frac{1}{2},j}^{n}}{\tau} – \frac{u_{i+1,j}^{n+\frac{1}{2}} – u_{i,j}^{n+\frac{1}{2}}}{h} =0,\\ \frac{w_{i,j+\frac{1}{2}}^{n+1}-w_{i,j+\frac{1}{2}}^{n}}{\tau} – \frac{u_{i,,j+1}^{n+\frac{1}{2}} – u_{i,j}^{n+\frac{1}{2}}}{h} =0.$For the first step $$n=0$$, we change the update procedure for $$u$$ to be$\frac{u_{i,j}^{n+\frac{1}{2}}-u_{i,j}^{n}}{\tau/2} – \frac{v_{i+\frac{1}{2},j}^n – v_{i-\frac{1}{2},j}^n}{h} – \frac{w_{i,j+\frac{1}{2}}^n – w_{i,j-\frac{1}{2}}^n}{h} = 0.$

After allocating memory for $$u_{(N_x+1)\times (N_y+1)}, v_{N_x\times (N_y-1)}, v_{(N_x-1)\times N_y}$$ and updating $$u^{1/2}$$, the main step is to follow the FD scheme. The kernel code is as the following (don’t forget to impose boundary condition after each updating):

for i in range(0,Nx):
for j in range(1,Ny):
v[i,j-1] += (u[i+1,j]-u[i,j])*dt/dx

for i in range(1,Nx):
for j in range(0,Ny):
w[i-1,j] += (u[i,j+1]-u[i,j])*dt/dx

for i in range(1,Nx):
for j in range(1,Ny):
u[i,j] += (v[i,j-1]-v[i-1,j-1])*dt/dx + (w[i-1,j]-w[i-1,j-1])*dt/dy


Example 3 (homogenous BC). Let $$\Omega=[-4,4]\times[-4,4]$$. Suppose the acoustics has the initial pressure$u(x,y,0)=\begin{cases} 1+\cos (x^2+y^2), & \text{if } x^2+y^2\leq \pi, \\ 0, & \text{if } \pi < x^2+y^2 \leq 4. \end{cases}$The boundary condition is set to be zero, i.e., $$u(x,y,t)=0,\ x\in \partial \Omega$$. The initial velocity satisfies $$v(x,0)=0$$ for all $$x\in \Omega$$.

0 0 投票数 0 评论