Você está na página 1de 6

Numerical Solution of

the 2D Gray-Scott Model


JAN MACH
Faculty of Nuclear Sciences and Physical Engineering, Czech Technical University in Prague, Czech Republic
Abstract. This work presents the results of J. M. at the High Performance Systems
Department of the CINECA Institute in Bologna, Italy. The main goals of the project - to
learn and apply MPI on parallelizing of our numerical solvers for the Gray-Scott model -
have been achieved. We demonstrate some of our numerical results and parallel scaling
on the CLX Linux cluster in CINECA.
1. Introduction
Reaction-diffusion systems are a class of systems of partial differential equations
of parabolic type. It includes mathematical models describing various phenomena in
the fields of physics, biology and chemistry. Gray-Scott model is one of these models. It
was first introduced in an article by P. Gray and S. K. Scott (see
1
). It is a mathematical
description of an autocatalytic chemical reaction
U 2V 3V
V P;
(1)
where U, V are input reactants and P is product of this reaction.
2. Problem formulation
Assume that V = (0; L) (0; L) is an open square representing the square reactor
where the chemical reaction (1) takes place, @Vis its boundary and is its outer normal.
Then initial-boundary value problem for the Gray-Scott model (see
1,3,4
) we solve is a
1
P. Gray and S. K. Scott, Autocatalytic reactions in the isothermal, continuous stirred tank reactor:
oscillations and instabilities in the system A 2B 3B, B C, Chem. Eng. Sci. 39 (1984), pp. 1087-
1097.
2
V. Thome e, Galerkin Finite Element Methods for Parabolic Problems, Springer-Verlag Berlin Heidelberg
(1997).
3
P. Gray and S. K. Scott, Chemical Oscillations and Instabilities, Oxford University Press, Oxford (1990).
4
J. Wei, Pattern formation in two-dimensional Gray-Scott model: existence of single-spot solutions and
their stability, Physica D 148, pp. 20-48 (2001).
system of two partial differential equations with initial conditions and zero Neumann
boundary conditions
@u
@t
=a\
2
u uv
2
F(1 u);
@v
@t
=b\
2
v uv
2
(F k)v in V(0; T);
u(; 0) =u
ini
; v(; 0) = v
ini
; in V;
@u
@
[
@V
=0;
@v
@
[
@V
= 0 in @V(0; T):
(2)
Here u, v are unknown functions representing concentrations of chemical sub-
stances U, V. Parameter F denotes the rate at which the chemical substance U is
being added during the chemical reaction, F k is the rate of V P transformation
and a, b are constants characterizing the environment where the chemical reaction
takes place.
3. Numerical scheme
We use two numerical schemes to solve initial boundary value problem (2).
Both of them are based on the method of lines. We use structured numerical grids.
In the first case we used finite difference method (FDM) for spatial discretization
Let h be mesh size such that h =
L
N1
for some N N

. We define numerical grid


as a set
v
h
= ih; jh ( ) [ i = 1; . . . ; N 2; j = 1; . . . ; N 2 ;
v
h
= ih; jh ( ) [ i = 0; . . . ; N 1; j = 0; . . . ; N 1 :
For function u : R
2
R we define a projection on v
h
as u
ij
= u ih; jh ( ). We introduce
finite differences
u
x
1
;ij
=
u
i1; j
u
i; j
h
; u
x
1
;ij
=
u
i; j
u
i1;j
h
u
x
2
;ij
=
u
i; j1
u
i; j
h
; u
x
2
;ij
=
u
i; j
u
i; j1
h
;
and define approximation D
h
of the Laplace operator D as follows
D
h
u
ij
= u
x
1
x
1
;ij
u
x
2
x
2
;ij
:
Then semi-discrete scheme has the following form
d
dt
u
ij
(t) =aD
h
u
ij
F(1 u
ij
) u
ij
v
2
ij
;
d
dt
v
ij
(t) =bD
h
v
ij
(F k)v
ij
u
ij
v
2
ij
;
(3)
NUMERICAL SOLUTION OF THE 2D GRAY-SCOTT MODEL 809
plus corresponding initial and boundary conditions. The discretization in time is done
by mean of the method of lines. To solve resulting systems of ordinary differential
equations Runge-Kutta-Merson method (see
6
) was used. This is modified Runge-Kutta
method with adaptive time stepping. For details on the second numerical scheme we
use based on finite elements method (FEM) see
7
.
4. Numerical experiments
4.1. Parallelization
Parallel implementation of our numerical algorithms was done using the MPI
approach. This enabled us to performcomputations on large grids which we needed for
the EOC measurements. The idea of parallelization of our numerical algorithms is to
decompose the numerical grid v
h
into row blocks. Computations on these blocks can
then be performed in parallel by different processors. The exchange of data between
neighboring blocks is done by means of the MPI library to complete each step of the
Runge-Kutta algorithm. In Table 1 we can see results of our parallelized solver scaling
measurements for numerical grid size 600x600.
4.2. EOC measurements
To determine the order of convergence of our numerical algorithm based on the
FDM based semi-discrete scheme (3) we use experimental order of convergence
(EOC). For our measurements we used formula
| v v
h2
|
| v v
h1
|
=
h2
h1

a
;
5
J. Wei and M. Winter, Asymmetric spotty patterns for the Gray-Scott model in R
2
, Stud. Appl. Math. 110
(2003), no. 1, pp. 63-102.
6
M. Holodniok, A. Klc , M. Kubc ek and M. Marek, Methods for analysis of non-linear dynamical models
(Metody analyzy nelinearnch dynamickych modelu), Academia Praha (1986).
7
J. Mach, Computational study of the Gray-Scott model, submitted to the proceedings of the Slovak-
Austrian Mathematical Congress, Podbanske (2007).
TABLE 1. Parallelized FDM based solver speedup measurement on the CLX.
nproc(P) Runtime(s) Speedup
1 904 1.00
2 489 1.84
4 258 3.50
8 146 6.19
16 89 10.16
810 JAN MACH
where v is numerical solution computed on the grid of size 2000 2000 and substitutes
the analytical solution, v
h2
, v
h1
are numerical solutions computed on coarser grids with
mesh sizes h2, h1 and a is the EOC coefficient. See Table 2 for one of measurements
results.
The question about the EOC is still open. Our results vary between the values of 1
and 2. This diversity may be caused be large spatial gradients of solution which are
difficult to approximate. For more of our measurements see [7]. More research into
this problem is needed including EOC measurement for the FEM based numerical
algorithm.
TABLE 2. - Table of EOC coefficients.
N
x
N
y
h EOC L
2
EOC L

100 100 0.0101010


150 150 0.0067114 0.8225371 0.5550153
200 200 0.0050251 0.9222231 0.7584173
250 250 0.0040160 0.9995422 0.9052681
300 300 0.0033444 1.0667171 1.0124643
350 350 0.0028653 1.1237827 1.0727512
400 400 0.0025062 1.1754085 1.1689477
FIGURE 1. Dependence of numerical solution on numerical scheme and grid size.
NUMERICAL SOLUTION OF THE 2D GRAY-SCOTT MODEL 811
4.3. Comparison of numerical schemes
We performed a series of computations to compare our numerical schemes. Initial
spatial distribution of concentrations u,v of chemicals U,V was chose such that
u = 1 v applies in each point of the domain V. Spatial distribution of chemical V
concentration over the domain V is visualized. Lighter color means higher concentra-
tion. This holds true for all figures in this section. According to our results the GS model
is very sensitive on the numerical grid size when using FDM based scheme (3).
Solutions often differ notably. In the Figure 1 we can see results we get using the
same initial conditions and Gray-Scott model parameter values at one concrete time
t = 1000. FEM based scheme (see [7]) provides results less dependent on the
FIGURE 2. Results demonstrating diversity of solutions of the GS model.
812 JAN MACH
numerical grid size. With further numerical grid refining numerical solutions are more
and more similar. According to our experience, both methods provide similar results
for numerical grids of size 400 400 (for L=0.5) and finer in most cases.
4.4. Diversity of solutions
In the Fig. 2 we present some of our numerical results, which demonstrate the
diversity of GS model solutions. We can see that patterns are changing from
geometrically simple ones to those which are much more complex.
5. Conclusion
We implemented parallel forms of our numerical algorithms for the Gray-Scott
model based on FDM and FEM methods. Parallelization of our solvers enabled us to
compute a lot of data in a reasonable amount of time which we used for EOC analysis
and exploration of diversity of solution of this model. Further simulations and parallel
code improving are subject of current work.
Acknowledgements. This work was carried out under the HPC-EUROPA project
(RII3-CT-2003-506079), with the support of the European Community - Research
Infrastructure Action under the FP6 ``Structuring the European Research Area''
Programme.
Partial support of the project of ``Necas Center for Mathematical modeling'', No.
LC06052 and of the project ``Applied Mathematics in Physics and Technical Sciences'',
No. MSN6840770010 of the Ministry of Education, Youth and Sports of the Czech
Republic is acknowledged.
The author would like to thank to the members of HPCEuropa staff at the CINECA
HPCcenter in Bologna, Italy for their help and hospitality during his summer stay. Alot
of work on the topic was done and first experience with MPI programming was gained
here.
Publications:
[1] J. MACH, Computational study of the Gray-Scott model, submitted to the proceedings of the
Slovak-Austrian Mathematical Congress, Podbanske (2007).
NUMERICAL SOLUTION OF THE 2D GRAY-SCOTT MODEL 813

Você também pode gostar