# How avoid square shape with Laplacian operator in reaction diffusion calculations?

I have used different variants of the Laplacian operator (div grad) using 4, 8, 12, 20 and 24 of the closest points. I get problems due to the chosen coordinate system and the discretization of the Laplacian operator. See images originating from circular symmetric seeds:

It is implemented as https://www.shadertoy.com/view/3sGXWG .

The Laplacian stencils are

where red points are used in upper left in the first image,

red + green in upper middle,

red + green + blue in upper right,

red + green + blue + orange in lower left box.

red + green + blue + orange + black in lower middle

red + green in is used on lower right with whighting according to Steven Roberts answer.

The equations don't show the problem but they are

$$\frac{\partial red}{\partial t} = \nabla^2 red (red + 4 green) \\ \frac{\partial green}{\partial t} = \nabla^2 green (red + 4 green) \\ red := 0.99 red + 0.01 green \\ green := green + 0.05 green(1 - green) - 0.03 red - 0.001 \\ red < 0: red := max(green, 0) \\ green < 0: green:= max(red, 0)$$

How can I keep spherical symmetry?

• Can you add the reaction-diffusion problem you are solving with the parameters? It would potentially bring more attention to your question. – Abdullah Ali Sivas Jul 23 at 17:05
• I want stable dots for physics simulations. Circular symmetry should not be broken. Source code is available on the link for those who wish to read. – David Jonsson Jul 23 at 17:20
• People would be reluctant to read your code. It is better to add a mathematical formulation. – nicoguaro Jul 23 at 20:36
• Have you considered deriving a discretization in polar coordinates? Or using a Schwarz-Christoffel transformation to conformally map the circle to the square? – Juan M. Bello-Rivas Jul 25 at 14:49
• @JuanM.Bello-Rivas No but I hope I can try but I suspect polar coordinates will only fit well if origo is in the centre of the seed. – David Jonsson Jul 26 at 7:02

## 1 Answer

There are finite difference stencils specifically designed to have rotational symmetry. For example, instead of the standard second order stencil $$\frac{1}{h^2} \begin{bmatrix} & 1 & \\ 1 & -4 & 1\\ & 1 & \end{bmatrix}$$ you can use $$\frac{1}{6 h^2} \begin{bmatrix} 1 & 4 & 1 \\ 4 & -20 & 4 \\ 1 & 4 & 1 \end{bmatrix}$$

I first came across this in

Hundsdorfer, Willem, and Jan G. Verwer. Numerical solution of time-dependent advection-diffusion-reaction equations. Vol. 33. Springer Science & Business Media, 2013.

on page 301, but I'm sure it's in other sources as well.

When I tried this out in your shadertoy, it unfortunately didn't resolve your issue, and the pattern looked similar to the ones you provided. I think the real issue is that the circle produced when you click is not a perfect circle, but an approximation on the finite difference grid. This initial condition is axially symmetric but not radially symmetric. Refining the mesh would help, but you cannot exactly represent a circle on a Cartesian grid. My guess is that these slight approximation errors eventually cause the non-symmetric artifacts.