JavaScript for Interactive Web Applications


Fabian Schubert

SoSe 2018

Institute for Theoretical Physics
Goethe University Frankfurt/Main

Numerical Methods for interactive Reaction-Diffusion Systems.

The general form of a two-component reaction-diffusion system reads:

$$\begin{pmatrix} \partial_t u \\ \partial_t v \end{pmatrix} = \begin{pmatrix} D_u & 0 \\ 0 & D_v \end{pmatrix} \begin{pmatrix} \nabla^2 u \\ \nabla^2 v \end{pmatrix} + \begin{pmatrix} F(u,v) \\ G(u,v) \end{pmatrix} $$

Spatial interaction is expressed by means of the diffusive term. For an interactive application, we need a fast method to solve the diffusive part of the system.

The "forward in time, central in space" (FTCS) Method

Consider the diffusion equation:

$$ \partial_t u = D \nabla^2 u $$

The most simple method for solving this equation is a combination of a simple euler integration and a finite difference approximation of the spatial derivatives:

$$ \partial_t u \approx \frac{u(t+\Delta t) - u(t)}{\Delta t} $$ $$ \tiny \nabla^2 u(x,y) \approx \frac{u(x+\Delta x,y) + u(x-\Delta x,y) - 2u(x,y)}{\Delta x^2} + \frac{u(x,y+\Delta y) + u(x,y-\Delta y) - 2u(x,y)}{\Delta y^2} $$ With $\Delta x = \Delta y$, and using index notation this leads to the update rule $$ \small u^{t+1}_{i,j} = u^t_{i,j} + \Delta t D \frac{u^t_{i+1,j} + u^t_{i-1,j} + u^t_{i,j+1} + u^t_{i,j-1} - 4u^t_{i,j}}{\Delta x^2} $$

However, though being very fast, this method can lead to numerical instabilities. It can be shown that it is stable if

$$ \Delta t \leq \frac{\Delta x^2}{4D} $$

Since this method uses euler integration, it is straight forward to include the reaction term into our update rule:

$$ \small u^{t+1}_{i,j} = u^t_{i,j} + \Delta t \left( D_u \frac{u^t_{i+1,j} + u^t_{i-1,j} + u^t_{i,j+1} + u^t_{i,j-1} - 4u^t_{i,j}}{\Delta x^2} + F(u^t_{i,j},v^t_{i,j}) \right) \\ \small v^{t+1}_{i,j} = v^t_{i,j} + \Delta t \left( D_v \frac{v^t_{i+1,j} + v^t_{i-1,j} + v^t_{i,j+1} + v^t_{i,j-1} - 4v^t_{i,j}}{\Delta x^2} + G(u^t_{i,j},v^t_{i,j}) \right) \\ $$

An Interactive Example