# Finite difference Laplacian with five-point stencil

**URL:** <https://discourse.julialang.org/t/finite-difference-laplacian-with-five-point-stencil/25014>\
**Category:** Numerics\
**Tags:** diffeq\
**Created:** [June 6, 2019, 4:23pm UTC](https://discourse.julialang.org/t/finite-difference-laplacian-with-five-point-stencil/25014 "2019-06-06T16:23:04Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [June 7, 2019, 2:25pm UTC](https://discourse.julialang.org/t/finite-difference-laplacian-with-five-point-stencil/25014/7 "2019-06-07T14:25:38Z")

</div>

> [@Vortico](#):
>
> For a 2-torus, would you recommend ghost cells in `u` or handling the indices in the explicit loop?

Ghost cells. See also: [Arrays with periodic boundaries - #4 by stevengj](https://discourse.julialang.org/t/arrays-with-periodic-boundaries/4015/4)

(You’ll need an explicit loop anyway to update the ghost cells on each iteration. But the whole approach is so much more flexible because it separates the boundary conditions from the stencil.)

---

_[View the full topic](https://discourse.julialang.org/t/finite-difference-laplacian-with-five-point-stencil/25014)._
