4
$\begingroup$

I have been unable to find the equivalent of the 5-point stencil finite differences for the Laplacian operator.

In 2 dimensions for me it is clear that, using the finite difference method: $$ \nabla_{2D}^2u = \frac{1}{h^2} \left( u_{1,0} + u_{-1,0} + u_{0,1} + u_{0,-1} -4 u_{0,0} \right) $$ (h being the size grid/step)

But I am not sure if it is completely symmetric for the 3-dimensional case. Can I just add the terms referring to the 3rd dimension? $$ \nabla_{3D}^2u = \frac{1}{h^2} \left( u_{1,0,0} + u_{-1,0,0} + u_{0,1,0} + u_{0,-1,0} + u_{0,0,1} + u_{0,0,-1} -6 u_{0,0,0} \right) $$

A source where I could find the different accuracy terms for the 3D Laplacian would be also helpful.

$\endgroup$
2
  • 2
    $\begingroup$ Just a comment: In Finite Differences, it can be much convenient to write it in terms of Kronecker products: if $A$ is the classical $[1,-2,1]$ matrix, you have that the 3D Laplacian is $$A = I \otimes I \otimes A + I \otimes A \otimes I + A \otimes I \otimes I$$ where $I$ is the identity matrix. $\endgroup$
    – VoB
    Commented Sep 14, 2020 at 17:19
  • 1
    $\begingroup$ @VoB, I think that you could expand your comment into an answer. $\endgroup$
    – nicoguaro
    Commented Sep 15, 2020 at 14:05

1 Answer 1

8
$\begingroup$

Yes, that finite difference is correct. You can obtain it using a finite difference in each direction for the Laplace operator in each coordinate.

\begin{align} \nabla^2 u =& \frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2} + \frac{\partial^2 u}{\partial z^2}\\ \approx& \frac{1}{h^2}[u(x + h, y, z) - 2u(x, y, z) + u(x -h, y, z)]\\ &+ \frac{1}{h^2}[u(x, y + h, z) - 2u(x, y, z) + u(x, y - h, z)]\\ &+ \frac{1}{h^2}[u(x, y, z + h) - 2u(x, y, z) + u(x, y, z - h)]\\ =& \frac{1}{h^2}[u(x + h, y, z) + u(x -h, y, z) + u(x, y + h, z) + u(x, y - h, z)\\ &+ u(x, y, z + h) + u(x, y, z - h) - 6u(x, y, z)]\, . \end{align}

Alternatively, you could interpolate a polynomial that passes through the points in your stencil and then compute its Laplacian and evaluate it at $(x, y, z)$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.