You are on page 1of 54

THE CHEMICAL BASIS OF MORPHOGENESIS BY

REACTION DIFFUSION SYSTEM


by
W.A.B. Janith( SC/2007/6624 )
Group members
S.H. Madarasinghe( SC/2007/6678 )
D.M.S. Thushani( SC/2007/6705 )
Supervisor: Mr. L. W. Somathilake
Demostrater: Mr. Anjana Prabhath
MMA 3b23 report submitted to the faculty of science
University Of Ruhuna
in partial fulllment of the requirements for the degree of
Bachelor of Science
Department of Mathematics
University Of Ruhuna
October 2010
Copyright c 2010 W.A.B. Janith
All Rights Reserved
ABSTRACT
THE CHEMICAL BASIS OF MORPHOGENESIS BY
REACTION DIFFUSION SYSTEM
W.A.B. Janith
Department of Mathematics
Bachelor of Science
How do animals make their various skin patterns? Although this question may
seem easy, in fact it is very dicult to answer. The problem is that most ani-
mals have no related structures under the skin; therefore, the skin cells must
form the patterns without the support of a pre pattern. Recent progress in
developmental biology has identied various micro mechanisms that function
in setting the positional information needed for the correct formation of body
structure. None of these can explain how skin pattern is formed, however, be-
cause all such molecular mechanisms depend on the existing structure of the
birth. Although little is known about the underlying micro mechanism, many
theoretical studies suggest that the skin patterns of animals form through a
reaction-diusion system-just like wave of chemical reactions that can gen-
erate periodic patterns in the eld. This idea had remained unaccepted for
a long time, but recent ndings on the skin patterns of zebra and tiger have
proved that such waves do exist in the animal body. In this project review,
we explain briey the principles of the reaction-diusion mechanism after that
simulate pattern using java applet and summarize the recent progress made
in this area.
ACKNOWLEDGMENTS
Our heartiest thanks to Mr. L. W. Somathilake who gave us a lot of
advices which gave us a brilliant guidance for us to make our project success-
ful and at the same time we would like to oer our heartiest thanks to Dr.
J.R.Wedagedera who nourished us with Java Programming knowledge and the
well devoted Mr. Anjana and all demonstrators who helped us a lot in this
project. It is the resources of the library gave us additional knowledge and
lots of information to make our attempt more successful and fruitful. We hope
our project will be a very successful attempt, thanks to all personalities who
helped us.
Contents
Table of Contents v
List of Figures vi
1 Introduction 1
1.1 Principle and properties of the reaction-diusion model . . . . . . . . 1
1.2 About Our programming language . . . . . . . . . . . . . . . . . . . 5
2 Mathematical back ground 7
2.1 Reaction-Diusion Equations . . . . . . . . . . . . . . . . . . . . . . 7
2.2 Gray-Scott model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.3 Euler forward method . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.4 Finite dierence method . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.4.1 Dierence methods . . . . . . . . . . . . . . . . . . . . . . . . 15
2.4.2 Parabolic Partial Dierential Equations Two Space Dimensions 17
2.5 Periodic Boundary Conditions . . . . . . . . . . . . . . . . . . . . . 21
3 Method Of Solution 23
3.1 Problem formulation . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.2 Numerical scheme . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
4 Program 27
4.1 Program Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.2 Program OUTPUT . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
5 Conclusion 45
6 Discussion 46
Bibliography 48
v
List of Figures
1.1 Schematic drawing of a reaction-diusion system . . . . . . . . . . . . 3
1.2 Java Logo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.1 Introduction reaction-diusion . . . . . . . . . . . . . . . . . . . . . . 7
2.2 Continuous stirred tank reactor . . . . . . . . . . . . . . . . . . . . . 10
2.3 Calculate area by left rectangular rule . . . . . . . . . . . . . . . . . . 14
2.4 The region R and nodes . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.5 Application of the implicit method on the level n+1 . . . . . . . . . . 19
2.6 Representation of nodal points in Example . . . . . . . . . . . . . . . 21
4.1 Cheetah Skin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
4.2 zebra sh Skin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
vi
Chapter 1
Introduction
1.1 Principle and properties of the reaction-diusion
model
This chapter briey explains, without recourse to mathematics, how
the reaction-diusion system can form a periodic structure. Sir Alan Tur-
ing presented a idea that a combination of reaction and diusion can
generate spatial patterns (Alan Mathison Turing worked from 1952 until
his death in 1954 on mathematical biology, specically morphogenesis.
He published one paper on the subject called The Chemical Basis of Mor-
phogenesis in 1952,). In the paper, he studied the behavior of a complex
system in which two substances interact with each other and diuse at
dierent diusion rates, which is known as the reaction-diusion system.
Turing proved mathematically that such system is able to form some char-
acteristic spatio-temporal patterns in the eld. One of the most signicant
deviations is s formation of a stable periodic pattern. He stated that the
spatial pattern generated by the system might provide positional infor-
1
1.1 Principle and properties of the reaction-diusion model 2
mation for a developing embryo.
In spite of the importance of the idea in the developmental biology, his
model was not accepted by most experimental biologists. But,At nally
most of those who took over and developed the Turings idea were applied
mathematicians and physicists. They proposed various types of model
that developed Turings original equation to t real, naturally occurring
phenomena. Although the equations for each model dier, they all share
the basic requirement of the original model; that is, waves are made
from the interactions of two putative chemical substances which we refer
to here as the activator and the inhibitor. Suppose that the activa-
tor enhances the synthesis of itself and another substance-the inhibitor.
In turn, the inhibitor inhibits the synthesis of the activator. The auto-
catalytic property of the activator and the feedback circuit of the inhibitor
make the system oscillate when the catalytic constants are set properly.
Like normal molecules, both substances are expected to diuse into neigh-
boring cells according to the concentration gradient. The ratio of the dif-
fusion constants of the two substances plays a main role in determining
the behavior of the system.
The most important and interesting phenomenon in this system occurs
when the diusion of the inhibitor is much faster than that of the acti-
vator. For example, imagine a one-dimensional (1D) cell array in which
the above interactions function (Fig. 1b-g). In the central region, as an
initial condition, the concentration of the activator is set relatively higher
than in other regions (Fig. 1a). Due to the self-catalytic nature of the
activator, the concentration of activator increases at the center, as well
as the concentration of the inhibitor (Fig. 1c). The concentration curve
1.1 Principle and properties of the reaction-diusion model 3
Figure 1.1 (a) Schematic drawing of a reaction-diusion system
(activator-inhibitor type). The white and black arrows represent activa-
tion and inhibition, respectively. (bd): Wave formation from almost random
initial conditions (for details, see text). (eg) Doubling of the waves in the
growing eld (for details, see text). (h) Dierent patterns generated by
an identical RD equation. One of the parameter values in the equation is
changed for each pattern.
becomes steeper for the activator and shallower for the inhibitor, accord-
ing to the ratios of their diusion constants. In the side regions, then,
the activator concentration decreases because of the high concentration
of inhibitor diusing from the central region. Eventually, the small initial
concentration dierence between the central and side regions are gradually
amplied (Fig. 1d). When the concentration of activator reaches a peak,
the balance of reaction and diusion stabilizes the slopes of the concentra-
tion. The concentration wave created by this mechanism has an intrinsic
1.1 Principle and properties of the reaction-diusion model 4
wavelength that is determined by the constants of reaction and diusion.
Suppose that the 1D eld enlarges (i.e. grows) gradually. This process
does not immediately change the number of peaks but changes the gradi-
ent of the slope (Fig. 1e,f ). As the eld grows, the concentration of the
inhibitor increases, particularly at the centre, because this region is far-
thest from the low concentration regions. When the eld reaches a critical
length, the feedback eect of the inhibitor exceeds the auto-catalysis of
the activator, and the widened peak divides into two peaks of the original
width (Fig. 1g). The shapes of the waves are determined by the values
of the parameters that represent the constants of reaction and diusion.
The two-dimensional (2D) patterns of the reaction and diusion wave are
more sensitive to the parameter values. Figure 1h shows the stable 2D
pattern of an reaction and diusion system calculated with dierent pa-
rameters. One of the merits of the reaction and diusion model is that
it can explain each of the clearly dierent patterns that are often seen in
animal skin. The most important properties of this system are:
(i) that the pattern forms autonomously without any other positional in-
formation
(ii) that the pattern is stable once formed
(iii) That it regenerates when it is articially disturbed.
Turing and many other theoretical researchers thought that these prop-
erties appropriately explain the marvelous robustness of animal develop-
ment. In Turings, as well as many other models, diusion is used as a
means of propagating a condition that occurs in a cell.
1.2 About Our programming language 5
1.2 About Our programming language
Figure 1.2
For in our project we used java programming language as Java is a high-level lan-
guage , third generation programming language, like C, Fortran, Smalltalk, Perl, and
many others. We can use Java to write computer applications that crunch numbers,
process words, play games, store data or do any of the thousands of other things
computer software can do. Compared to other programming languages, Java is most
similar to C. However although Java shares much of Cs syntax, it is not C. C , will
certainly help Us to learn Java more quickly. Unlike C++ Java is not a superset of
C. A Java compiler wont compile C code, and most large C programs need to be
changed substantially before they can become Java programs.
Java is a platform for application development. A platform is a loosely dened
computer industry buzzword that typically means some combination of hardware and
system software that will mostly run all the same software. For instance PowerMacs
running Mac OS 9.2 would be one platform. DEC Alphas running Windows NT
would be another.
object oriented programming is the catch phrase of computer programming in the
1990s. Although object oriented programming has been around in one form or an-
other since the Simula language was invented in the 1960s, its really begun to take
1.2 About Our programming language 6
hold in modern GUI environments like Windows, Motif and the Mac. In object-
oriented programs data is represented by objects. Objects have two sections, elds
(instance variables) and methods. Fields tell what an object is. Methods tell what
an object does. These elds and methods are closely tied to the objects real world
characteristics and behavior. When a program is run messages are passed back and
forth between objects. When an object receives a message it responds accordingly as
dened by its methods.
Object oriented programming is alleged to have a number of advantages including:
Simpler, easier to read programs More ecient reuse of code Faster time to
market More robust, error-free code
Java is Platform Independent, Java was designed to not only be cross-platform in
source form like C, but also in compiled binary form. Since this is frankly impossible
across processor architectures Java is compiled to an intermediate form called byte-
code. A Java program never really executes natively on the host machine. Rather a
special native program called the Java interpreter reads the byte code and executes
the corresponding native machine instructions. Thus to port Java programs to a new
platform all that is needed is to port the interpreter and some of the library routines.
Even the compiler is written in Java. The byte codes are precisely dened, and remain
the same on all platforms.
Chapter 2
Mathematical back ground
2.1 Reaction-Diusion Equations
Figure 2.1
A system of reaction-diusion equations is a system of equations of
the form
x
t
= D u + f(u, u, x, t)
Over a region D R
n
, where u (x,t) is a vector representing the states
(in our model morphogenesis concentrations) of a group of substances at
time t and position X R
n
A is a matrix of diusion coecients, which
in a two species system is typically of the form D=
_
_
_
_
u 0
0 v
_
_
_
_
, and u
7
2.1 Reaction-Diusion Equations 8
is the Laplacian dierential operator acting on u with respect to x D
It is the second order spatial rate of change of u. In the most general
case, the inputs in the reaction function f are u,u the gradient of u with
respect to x, x and t. These partial dierential equations are subject to
boundary conditions over D and initial conditions. In these equa-
tions the term containing the Laplacian operator is the diusion term.
Without the function f, (see Fig. 2.1) is the heat equation, one of the rst
equations encountered in any partial dierential equation course. The
heat equation models the diusion of heat from regions of higher tem-
perature, or heat concentration, to regions of lower temperature, which
is very similar to chemical diusion. The function f is called the reac-
tion function because it represents the interactions between particles that
act to increase or decrease the quantities of each species,and may depend
on the concentration of particles themselves (u), the gradient of the con-
centrations with respect to space(u),and the location of the reaction in
space and time, (x and t). The use of chemical terms is meant merely as
an analogy, as reaction-diusion equations have found broad application
in areas other than chemistry, such as neurological signal transmission,
Belousov-Zhabotinsky chemical waves, geochemical systems, combustion
theory, and other complex systems.
This study is primarily concerned with functions f that depend only
on the concentrations of the reactants. This idealization is a good approx-
imation for many chemical reactions held at constant temperature, as is
often true for biological reactions. The general system now reduces to
x
t
= D u + f(u)
2.1 Reaction-Diusion Equations 9
This system is augmented by initial conditions, u(x, 0) = h(x) ,and bound-
ary conditions. We will be dealing with two morphogens, that is, the
vector u will be given by:
u(x, t) =
_
_
_
_
u(x, t)
v(x, t)
_
_
_
_
J.D.Murray gives a good overview of several reaction-diusion equations
used to model morphogenesis. The three primary reactions he mentions
are Schnakenbergs reaction, Gierer and Meinhardts activator/inhibitor
model, and Thomas experimental model. Schnakenbergs model has not
found much biological application. It is given in nondimensionalized form
by
u
t
= (b v
2
u) + d u,
v
t
= (a v + uv
2
) +v
following model which is known as an activator/inhibitor system.
u
t
= (a bv +
u
2
v
) +u
v
t
= (u
2
v) + d v
The nondimensionalized parameters are the same as above. For this equa-
tion we will call u the activator, since it acts to increase the population of
both chemicals, and v will be the inhibitor, since it decreases the rate of
change over time for each morphogen. For patterns to occur, Gierer and
Meinhardt showed that d 1, in other words, that the inhibitor must dif-
fuse signicantly faster than the activator. As an illustration, consider a
predator/prey system. Think of the prey as the activators and the preda-
tors as the inhibitors. The predators, cheetahs for instance, diuse faster
2.2 Gray-Scott model 10
than the prey, antelope. Where the antelope gather together they create
an environment where more of their kind can thrive, but the fast moving
cheetahs inhibit their numbers (through digestion) when they stray from
the herd. Also contact between antelope and cheetahs (again through
digestion) activates the production of cheetahs. For the right parame-
ters, activator/inhibitor reaction-diusion systems form dappled patterns
where activators clump together that can be thought of as analogous to
herds of prey species.
2.2 Gray-Scott model
Figure 2.2 Continuous stirred tank reactor
For the study of a chemical reaction we are going to look at a continu-
ous stirred tank reactor. The reactor contains two chemicals: U and V. In
the tank reactor we have a continuous inlet stream which, in our case, only
contains the chemical U and the product P is continuously drained. The
reactor is well mixed so that there is a uniform concentration of the chem-
icals U and V throughout the reactor. We study the following chemical
2.2 Gray-Scott model 11
reaction:
U + 2V 3V
This is an autocatalytic reaction in which V is called the catalyst or the
activator and U the inhibitor of the reaction. Since we want the catalyst
V to have a nite lifetime,we use a second chemical reaction which is of
the form
V P
P is an inert product. It is assumed for simplicity that the reverse reactions
do not occur (this is a useful simplication when a constant supply of
reactants prevents the attainment of equilibrium). Because V appears on
both sides of the rst reaction, it acts as a catalyst for its own production.
The overall behavior of the system is described by the following for-
mula, two equations which describe three sources of increase and decrease
for each of the two chemicals:
U
t
= D
u

2
U UV
2
+ F(1 U)
V
t
= D
v

2
V + UV
2
(F + K)V
These equations were posed by P.Gray and S.K. Scott in 1983, thats why
its called the Gray-Scott model. In this model, the two partial dierential
equations are the mass-balance equations for U and V. In the model D
U
and D
V
are the diusivities, which represent the rate of speed by which U
and V diuse. For the sake of simplicity we can consider D
u
, D
v
, F and
k to be constants. In computer simulations there are also quantization
constants for time and space (t and x) that are used to break t and

2
into discrete intervals.
2.2 Gray-Scott model 12
The rst equation tells how quickly the quantity u increases. There are
three terms. The rst term, D
u

2
u is the diusion term. It species that
u will increase in proportion to the Laplacian (a sort of multidimensional
second derivative giving the amount of local variation in the gradient) of U.
When the quantity of U is higher in neighboring areas, u will increase.
2
u
will be negative when the surrounding regions have lower concentrations
of U, and in such cases the diusion term is negative and u decreases.
If we made an equation for u with only the rst term, we would have
U
t
= D
u

2
U, which is a diusion-only system equivalent to the heat
equation.
The second term is uv
2
. This is the reaction rate. The rst reaction
shown above requires one U and two V, such a reaction takes place at
a rate proportional to the concentration of U times the square of the
concentration of V. Also, it converts U into V: the increase in v is equal
to the decrease in u (as shown by the positive uv
2
in the second equation).
There is no constant on the reaction terms, but the relative strength of
the other terms can be adjusted through the constants D
u
, D
v
, F and k,
and the choice of the arbitrary time unit implicit in t.
The third term, F(1-u), is the replenishment term. Since the reaction
uses up U and generates V, all of the chemical U will eventually get used
up unless there is a way to replenish it. The replenishment term says that
u will be increased at a rate proportional to the dierence between its
current level and 1. As a result, even if the other two terms had no eect,
1 would be the maximum value for u. The constant F is the feed rate and
represents the rate of replenishment. In the systems this equation is mod-
eling, the area where the reaction occurs is physically adjacent to a large
2.2 Gray-Scott model 13
supply of U and separated by something that limits its ow, such as a
semi-permeable membrane; replenishment takes place via diusion across
the membrane, at a rate proportional to the concentration dierence [U]
across the membrane. The value 1 represents the concentration of U in
this supply area, and F corresponds to the permeability of the membrane.
The only signicant dierence in the v equation is in its third term. The
third term in the v equation is the dimishment term. Without the di-
minishment term, the concentration of V could increase without limit.
In practice, V could be allowed to accumulate for a long time without
interfering with further production of more V, but it naturally diuses
out of the system through the same (or a similar) process as that which
introduces the new supply of U. The diminishment term is proportional
to the concentration of V that is currently present, and also to the sum
of two constants F and k. F, as above, represents the permeability of
the membrane to U, and k represents the dierence between this rate
and that for V. Notice that there is nothing in the equations that states
whether the system exists in a two-dimensional space (like a Petri dish)
or in three dimensions, or even some other number of dimensions. In fact,
any number of dimensions is possible, and the resulting behavior is fairly
similar. The only signicant dierence is that in higher dimensions, there
are more directions for diusion to happen in and the rst term of the
equation becomes relatively stronger. It is for this reason that phenomena
depending on diusion for their action (such as gradient-sustained stable
spots) occur at higher k values in the 2-D system as compared to the
1-D system, and at yet higher values for the 3-D system
2.3 Euler forward method 14
2.3 Euler forward method
In mathematics and computational science, the Euler method, named
after Leonhard Euler, is a rst-order numerical procedure for solving or-
dinary dierential equations (ODEs) with a given initial value. It is the
most basic kind of explicit method for numerical integration of ordinary
dierential equations.
A method for solving ordinary dierential equations using the Euler
formula
From Calculus we know that calculating an integral is equivalent to com-
puting the area under the curve given by a(s) = f(s, y(s)) over the interval
[t
k
, t
k
+ h] by the (left) rectangular rule
Figure 2.3 Calculate area by left rectangular rule
_
t
k
+1
t
k
f(s, y(s))ds = hf(t
k
, y(t
k
)),
which after substitution and replacing exact values with approximate ones
2.4 Finite dierence method 15
(y
k
y(t
k
), y
k+1
y(t
k+1
)) results in
y
k+1
= y
k
+ hf(t
k
, y
k
) k = 0, ..., N 1.
Naturally, y
0
is given by the initial condition at t
0
in problem . The
formula y
k+1
= y
k
+hf(t
k
, y
k
) is called Forward Euler Method or Explicit
Euler Method. Note that the method increments a solution through an
interval while using derivative information from only the beginning of the
interval.
2.4 Finite dierence method
2.4.1 Dierence methods
We assume throughout our discussion that our mathematical problem
is well posed, that is ,if its solution exists then it is unique and depends
continuously on the given data.
In the nite dierence method, we superimpose on the region R of
interest a network or a mash by lines, as follows:
(1) one-dimensional case:
x
m
= a + mh, m = 0, 1, 2, .....
where h is the mash size in the x-direction.
(2)two-dimensional case:
x
l
= a + lh
1
, l = 0, 1, 2, ......
y
m
= b + mh
2
, m = 0, 1, 2, ......
2.4 Finite dierence method 16
where h
1
, h
2
are the mash sizes in x and y directions respectively. If we
are considering an initial value problem, then we also have the lines
t
n
= nk, n = 0, 1, 2, .....
where k is the step length in the t-direction. The points of intersection of
the network are called nodes. The network and nodes for boundary value
problem are shown in (see Fig. 2.4) The partial derivatives in the dier-
R
Y
X
0
h
k
Figure 2.4 The region R and nodes
ential equation are replaced by suitable dierence quotients, converting
the dierential equation to a dierence equation at each nodal point. We
may call this procedure as the discretization of the dierential equation.
The given data is used to modify the dierence equation at the nodes near
or on the boundary. The solution of this system of equations gives the
numerical solution of the given initial/boundary value problem.
2.4 Finite dierence method 17
2.4.2 Parabolic Partial Dierential Equations Two Space Di-
mensions
Parabolic partial dierential equations arise in various branches of sci-
ence and engineering,such as uid dynamics,heat ow, diusion, elastic
vibration etc. We assume that a steady state solution does not exist, and
one of the independent variables t has the role of time. We also assume
that unique solution exists, the solution being uniquely determined by the
dierential equations together with the initial and boundary conditions.
Two Space Dimensions
we can readily extend the one dimensional dierence schemes to higher
space dimension especially when the region is rectangular. The tow di-
mensional heat ow equation in the unit square R = [0 x, y 1] [0, T]
is given by
u
t
=

2
u
x
2
+

2
u
y
2
subject to the initial condition
u(x, y, 0) = f(x, y)
and the boundary conditions
u(0, y, t) = g
1
(y, t) u(1, y, t) = g
2
(y, t)
u(x, 0, t) = h
1
(x, t) u(x, 1, t) = h
2
(x, t) t > 0
We place a uniform mesh of spacing h on the square region 0 x, y 1
with Mh=1. Let k be the step size in the time direction such that t-
nk,n=0,1,.....N where Nk=T. The nodal points are dened by
x
l
= lh, l = 0, 1, 2, ..., M
2.4 Finite dierence method 18
y
m
= mh, m = 0, 1, 2, ..M
t
n
= nk, n = 0, 1, 2, ..., N
The solution value u(x, y, t) at the nodal point (l,m,n) is denoted by U
n
l,m
.Then may be written as
u
n+1
l,m
= u
n
l,m
+ (
2
x
+
2
y
)[u
n+1
l,m
+ (1 )u
n
l,m
]
where u
n
l,m
is an approximate value of U
n
l,m
.For example, the value = 0
gives the dierence scheme
u
n+1
l,m
= u
n
l,m
+ (
2
x
+
2
y
)u
n
l,m
which has order o accuracy (k + h
2
).
Using the Von Neumann method of stability analysis, We substitute
u
n
l,m
= A
n
e
i
1
lh
e
i
2
mh
in the explicit dierence scheme u
n+1
l,m
= u
n
l,m
+ (
2
x
+
2
y
)u
n
l,m
.The
propagating factor is given by
= 1 4(sin
2

1
+ sin
2

2
)
where
1
=
1
h/2 and
2
=
2
h/2.
For stability, we require that || 1 and hence
1 1 4(sin
2

1
+ sin
2

2
) 1
since 0 sin
2

1
, sin
2

2
1 the stability condition is obtained as
0 < 1/4
Again for = 1/2,we write the dierence scheme above
u
n+1
l,m
= u
n
l,m
+ (
2
x
+
2
y
)[u
n+1
l,m
+ (1 )u
n
l,m
equation as
u
n+1
l,m
= u
n
l,m
+

2
(
2
x
+
2
y
)(u
n+1
l,m
+ u
n
l,m
)
2.4 Finite dierence method 19
which is of order k
2
+ h
2
.using the Von Neumann method,we obtain
the propagating factor as
=
1 2(sin
2

1
+ sin
2

2
)
1 + 2(sin
2

1
+ sin
2

2
)
where
1
=
1
h/2 and
2
=
2
h/2. Since 0 sin
2

1
, sin
2

2
1 and
> 0,the condition || 1 is always satised. Hence the method above
eq
n
u
n+1
l,m
= u
n
l,m
+

2
(
2
x
+
2
y
)(u
n+1
l,m
+ u
n
l,m
) is unconditionally stable.
M
1 2 m-1
m
m+1
2M-2
M-1
y
h
h
A:(j-1)(M-1)+m
B:(j-1)(M-1)+m+1
C:j(M-1)+m
D:(j-1)(M-1)+m-1
E:(J-2)(m-1)+m
j A B
C
D
E
Figure 2.5 Application of the implicit method on the level n+1
On each time level, a system of linear algebraic equations is to be
solved.The coecient matrix of this system is a band matrix whose total
band with is 2M-1 as shown in 2.5 We number the unknowns in the
interior stating from left to right in the x-direction and from bottom to
top in the y-direction. When we apply above eq
n
u
n+1
l,m
= u
n
l,m
+

2
(
2
x
+

2
y
)(u
n+1
l,m
+u
n
l,m
) at A, the ve point A,B,C,D,E (and hence the unknowns
at these nodes ) enter the scheme. The points E and C are M-1 unite
2.4 Finite dierence method 20
away from A while B and D are one unit away from A. Hence the total
band width of this system of equations is 2M-1. If h is small, then the
band width is very large and the solution of this system of equations takes
a lot of computer time . To avoid this diculty we use the Alternating
Direction implicit methods. we can get idea about this dierential method
by a example. now we try to nd the solution of the two dimension
equation
u
t
=

2
u
x
2
+

2
u
y
2
subject to the initial condition
u(x, y, 0) = sin x sin y, 0 x, y 1
and the boundary conditions
u = 0, ontheboundaries, t 1
using the explicit method
u
n+1
l,m
= u
n
l,m
+ (u
n
l1,m
+ u
n
l+1,m
+ u
n
l,m1
+ u
n
l,m+1
4u
n
l,m
)
with h = 1/3 and = 1/8. Integrate upto two time levels. Compare the
results with the exact solution
u(x, y, t) = e

2
t
sin x sin y
The nodal points are given in Figure 2.6 For = 1/8,we have
u
n+1
l,m
=
1
2
u
n
l,m
+
1
8
(u
n
l1,m
+ u
n
l+1,m
+ u
n
l,m1
+ u
n
l,m+1
)
the initial and boundary conditions become
u
0
l,m
= sin(l/3)sin(m/3), l, m = 0, 1, 2, 3
2.5 Periodic Boundary Conditions 21
u
0
0,0
U
0
3,0
u
2
0,0
u
2
3,0
u
2
3,3
u
2
0,3
u
0
3,3
Zeroth level
First level
Second level
Figure 2.6 Representation of nodal points in Example
u
n
l,0
= u
n
0,m
= u
n
3,m
= u
n
l,3
= 0, l, m = 0, 1, 2, 3, andn = 0, 1, 2, ...
We get for n=0
u
1
l,m
=
1
2
u
0
l,m
+
1
8
(u
0
l1,m
+ u
0
l+1,m
+ u
0
l,m1
+ u
0
l,m+1
)
so now we can calculate every u
n
l,m
for l, m = 0, 1, 2, ...
2.5 Periodic Boundary Conditions
In mathematical models and computer simulations, periodic bound-
ary conditions (PBC) are a set of boundary conditions that are often
used to simulate a large system by modeling a small part that is far from
its edge. Periodic boundary conditions resemble the topologies of some
video games; a unit cell or simulation box of geometry suitable for perfect
three-dimensional tiling is dened, and when an object passes through
2.5 Periodic Boundary Conditions 22
one face of the unit cell, it reappears on the opposite face with the same
velocity. The simulation is of an innite perfect tiling of the system. In
topological terms, the space can be thought of as being mapped onto a
four-dimensional torus. The tiled copies of the unit cell are called im-
ages, of which there are innitely many. During the simulation, only
the properties of the unit cell need be recorded and propagated. The
minimum-image convention is a common form of PBC particle bookkeep-
ing in which each individual particle in the simulation interacts with the
closest image of the remaining particles in the system. An example occurs
in molecular dynamics, where PBC are usually applied to simulate bulk
gasses, liquids, crystals or mixtures. A common application uses PBCs to
simulate solvated macromolecules in a bath of explicit solvent.
Practical implementation:
To implement periodic boundary conditions in practice, at least two steps
are needed. he rst is to make an object which leaves the simulation cell
on one side enter back on the other. This is we used operation,
If (periodicx) then
if (x < 0) x=x+width
if (x >= width) x=x-width
endif
Chapter 3
Method Of Solution
According to Gray-Scott model there two equation as follows
U
t
= D
u

2
U UV
2
+ F(1 U)
V
t
= D
v

2
V + UV
2
(F + K)V
where U,V are input reactants and P is product of this reaction.
U + 2V 3V
V P
3.1 Problem formulation
we will assume that (0, L) (0, L) is an open square representing the
square reactor where the chemical reaction takes place, is its boundary
and is its outer normal. Then initial-boundary value problem for the
Gray-Scott model then we solve is a system of two partial dierential
equations with initial condition and periodic boundary conditions there
23
3.2 Numerical scheme 24
initial condition are
U(x, y, 0) =
_

_
0.5 if
1
3
x <
2
3
,
5
7
x <
6
7
and
1
3
y <
2
3
,
3
5
y <
4
5
1 elsewhere,
V (x, y, 0) =
_

_
0.25 if
1
3
x <
2
3
,
5
7
x <
6
7
and
1
3
y <
2
3
,
3
5
y <
4
5
0 elsewhere,
this model boundary condition is periodic boundary conditions
u(0, y, t) = u(1, y, t) u(x, 0, t) = u(x, 1, t)
v(0, y, t) = v(1, y, t) v(x, 0, t) = v(x, 1, t)
3.2 Numerical scheme
In this two-dimensional numerical experiments the following choices
for the model parameters are made: D
u
= 2e
5
D
v
= 1e
5
and f =
0.02 k = 0.059 but through the program can be changed k and f
value. we can get range on the domain [0, 1] [0, 1] where L =1 in above
dened. We choose the same time step, and tolerances as in 1D on a
spatial mesh of 100 100 mesh points with Dirichlet boundary conditions
and diusion coecients
u = (

x
i +

y
j)u =
u
x
i +
u
y
j

2
u = (u) = (

x
i +

y
j)(
u
x
i +
u
y
j)
=

2
u
x
2
+

2
u
y
2
In practice, we represent the concentration functions as two-dimensional
arrays of discrete samples. To evaluate U and V we approximate the space
3.2 Numerical scheme 25
derivative
2
U by a nite dierence. The second nite dierence in the
x direction is

2
u
x
2

u
i+1,j
+ u
i1,j
2u
i,j
h
2
The second nite dierence in the y direction is

2
v
y
2

u
i,j+1
+ u
i,j1
2u
i,j
h
2
where the i and j are array subscripts, and h is the distance between
adjacent samples.therefore we can get h value as h =
L
N
=
1
100
= 0.01
where L is domain length, N is mash size. Taking the corresponding
second dierence in the y direction, and summing, gives

2
U
i,j

u
i+1,j
+ u
i1,j
+ u
i,j+1
+ u
i,j1
4u
i,j
h
2
where u
i,j
represent an approximation to u(x
i
, y
j
). so above equation can
be used in our Gray-Scott model equation as follows
d
dt
U
i,j
(t) = D
u

2
U
i,j
U
i,j
V
2
i,j
+ F(1 U
i,j
)
d
dt
U
i,j
(t) = D
u
[
1
h
2
(u
i1,j
+u
i+1,j
+u
i,j1
+u
i,j+1
4u
i,j
)]u
i,j
v
2
i,j
+F(1u
i,j
)
as well as consider v concentration
d
dt
V
i,j
(t) = D
v

2
V
i,j
+ U
i,j
V
2
i,j
(F + k)V
i,j
d
dt
V
i,j
(t) = D
v
[
1
h
2
(v
i1,j
+v
i+1,j
+v
i,j1
+v
i,j+1
4v
i,j
)]+u
i,j
v
2
i,j
(F +k)v
i,j
using corresponding initial and boundary conditions.The discretization in
time is done my mean of the method of lines.To solve resulting systems
of ordinary dierential equations Euler method was used. This is Euler
forward method with adaptive time stepping. For details on the second
numerical scheme we use based of nite dierence method.
3.2 Numerical scheme 26
using Euler forward method
D
+
u
n
=
(u
n+1
u
n
u
n
)
t
u
n+1
u
n
t
= f(u
n
)
u
n+1
= u
n
+tf(u
n
)
This Euler methods are only rst order accurate.
u
n+1
i,j
u
n
i,j
t
= D
u
[
1
h
2
(u
n
i1,j
+u
n
i+1,j
+u
n
i,j1
+u
n
i,j+1
4u
n
i,j
)]u
n
i,j
v
n2
i,j
+F(1u
n
i,j
)
u
n+1
i,j
= u
n
i,j
+tD
u
[
1
h
2
(u
n
i1,j
+u
n
i+1,j
+u
n
i,j1
+u
n
i,j+1
4u
n
i,j
)]u
n
i,j
v
n2
i,j
+F(1u
n
i,j
)
v
n+1
i,j
v
n
i,j
t
= D
v
[
1
h
2
(v
n
i1,j
+v
n
i+1,j
+v
n
i,j1
+v
n
i,j+1
4v
n
i,j
)]+u
n
i,j
v
n2
i,j
(F+k)v
n
i,j
)
v
n+1
i,j
= v
n
i,j
+tD
v
[
1
h
2
(v
n
i1,j
+v
n
i+1,j
+v
n
i,j1
+v
n
i,j+1
4v
n
i,j
)]+u
n
i,j
v
n2
i,j
(F+k)v
n
i,j
)
then we can calculate each value of the u
0
0,0
, u
0
0,1
.....similarely we can nd
u
1
0,0
, u
1
0,1
, ....so on. which mean arbitrary U
n
i,j
can be found
In next chapter we will demonstrate founded solution how to represent in
program using Applet
Chapter 4
Program
This Gray Scott.java le is initialized Array of U and V using Gray-Scott method
and nite dierence method and this class is handle(base) Our program in mainly.
4.1 Program Code
package ptternformation;
/**
*
* @author W.A.B. Janith
*/
final class GrayScott {
double[][] u;
double[][] v;
private double[][] tmpU;
private double[][] tmpV;
double uMax;
27
4.1 Program Code 28
static final double DU = 2e-5;
static final double DV = 1e-5;
public double k = 0.059;
public double f = 0.02;
public double h = 0.01;
private double duDivh2;
private double dvDivh2;
int width, height;
public GrayScott(int width, int height, double f, double k, double h) {
this.width = width;
this.height = height;
this.f = f;
this.k = k;
this.h = h;
double v0 = f/(2*(f+k)) + Math.sqrt(f/(2*(f+k))*f/(2*(f+k)) - f*(f+k));
double u0 = f/(v0*v0+f);
duDivh2 = DU/(h*h);
dvDivh2 = DV/(h*h);
u = new double[width][height];
v = new double[width][height];
tmpU = new double[width][height];
tmpV = new double[width][height];
uMax = 0;
initialState();
}
public void initialState() {
uMax = 0.5;
double v0 = f/(2*(f+k)) + Math.sqrt(f/(2*(f+k))*f/(2*(f+k)) - f*(f+k));
double u0 = f/(v0*v0+f);
4.1 Program Code 29
for (int x = 0; x<width; x++) {
for (int y = 0; y<height; y++) {
tmpU[x][y] = 1;
tmpV[x][y] = 0;
}
}
for (int x = 0; x<(width/3); x++) {
for (int y = 0; y<height/3; y++) {
tmpU[1*width/3 + x][1*height/3 + y] = 0.5;
tmpV[1*width/3 + x][1*height/3 + y] = 0.25;
}
}
for (int x = 0; x<(width/7); x++) {
for (int y = 0; y<height/5; y++) {
tmpU[5*width/7 + x][3*height/5 + y] = 0.5;
tmpV[5*width/7 + x][3*height/5 + y] = 0.25;
}
}
}
public void setF(double f) {
this.f = f;
}
public void setK(double k) {
this.k = k;
}
public void timeStep(double dt) {
4.1 Program Code 30
double newMax = 0;
double uv2;
/*centre*/
for (int x = 1; x<width-1; x++) {
for (int y = 1; y<height-1; y++) {
uv2 = tmpU[x][y]*tmpV[x][y]*tmpV[x][y];
u[x][y] = tmpU[x][y] + dt*(duDivh2*(tmpU[x+1][y] + tmpU[x-1][y] +
tmpU[x][y+1] + tmpU[x][y-1] - 4*tmpU[x][y]) - uv2 + f*(1-tmpU[x][y]));
if (u[x][y]<0) u[x][y] = 0;
v[x][y] = tmpV[x][y] + dt*(dvDivh2*(tmpV[x+1][y] + tmpV[x-1][y] +
tmpV[x][y+1] + tmpV[x][y-1] - 4*tmpV[x][y]) + uv2 - k*tmpV[x][y]);
if (v[x][y]<0) v[x][y] = 0;
}
}
/*edges*/
int x, y;
for (x = 0; x<width; x++) {
y = 0;
uv2 = tmpU[x][y]*tmpV[x][y]*tmpV[x][y];
u[x][y] = tmpU[x][y] + dt*(duDivh2*(tmpU[pBC(x+1,width)][y] +
tmpU[pBC(x-1,width)][y] + tmpU[x][pBC(y+1, height)] + tmpU[x][pBC(y-1,
height)] - 4*tmpU[x][y]) - uv2 + f*(1-tmpU[x][y]));
if (u[x][y]<0) u[x][y] = 0;
v[x][y] = tmpV[x][y] + dt*(dvDivh2*(tmpV[pBC(x+1,width)][y] +
tmpV[pBC(x-1,width)][y] + tmpV[x][pBC(y+1, height)] + tmpV[x][pBC(y-1,
height)] - 4*tmpV[x][y]) + uv2 - k*tmpV[x][y]);
if (v[x][y]<0) v[x][y] = 0;
y = height - 1;
uv2 = tmpU[x][y]*tmpV[x][y]*tmpV[x][y];
u[x][y] = tmpU[x][y] + dt*(duDivh2*(tmpU[pBC(x+1,width)][y] +
tmpU[pBC(x-1,width)][y] + tmpU[x][pBC(y+1, height)] +
4.1 Program Code 31
tmpU[x][pBC(y-1, height)] - 4*tmpU[x][y]) - uv2 + f*(1-tmpU[x][y]));
if (u[x][y]<0) u[x][y] = 0;
v[x][y] = tmpV[x][y] + dt*(dvDivh2*(tmpV[pBC(x+1,width)][y] +
tmpV[pBC(x-1,width)][y] + tmpV[x][pBC(y+1, height)] +
tmpV[x][pBC(y-1, height)] - 4*tmpV[x][y]) + uv2 - k*tmpV[x][y]);
if (v[x][y]<0) v[x][y] = 0;
}
for (y = 0; y<height; y++) {
x = 0;
uv2 = tmpU[x][y]*tmpV[x][y]*tmpV[x][y];
u[x][y] = tmpU[x][y] + dt*(duDivh2*(tmpU[pBC(x+1,width)][y] +
tmpU[pBC(x-1,width)][y] + tmpU[x][pBC(y+1, height)] +
tmpU[x][pBC(y-1, height)] - 4*tmpU[x][y]) - uv2 + f*(1-tmpU[x][y]));
if (u[x][y]<0) u[x][y] = 0;
v[x][y] = tmpV[x][y] + dt*(dvDivh2*(tmpV[pBC(x+1,width)][y] +
tmpV[pBC(x-1,width)][y] + tmpV[x][pBC(y+1, height)] +
tmpV[x][pBC(y-1, height)] - 4*tmpV[x][y]) + uv2 - k*tmpV[x][y]);
if (v[x][y]<0) v[x][y] = 0;
x = width - 1;
uv2 = tmpU[x][y]*tmpV[x][y]*tmpV[x][y];
u[x][y] = tmpU[x][y] + dt*(duDivh2*(tmpU[pBC(x+1,width)][y] +
tmpU[pBC(x-1,width)][y] + tmpU[x][pBC(y+1, height)] +
tmpU[x][pBC(y-1, height)] - 4*tmpU[x][y]) - uv2 + f*(1-tmpU[x][y]));
if (u[x][y]<0) u[x][y] = 0;
v[x][y] = tmpV[x][y] + dt*(dvDivh2*(tmpV[pBC(x+1,width)][y] +
tmpV[pBC(x-1,width)][y] + tmpV[x][pBC(y+1, height)] +
tmpV[x][pBC(y-1, height)] - 4*tmpV[x][y]) + uv2 - k*tmpV[x][y]);
if (v[x][y]<0) v[x][y] = 0;
}
for (x = 0; x<width; x++) {
4.1 Program Code 32
for (y = 0; y<height; y++) {
tmpU[x][y] = u[x][y];
tmpV[x][y] = v[x][y];
}
}
}
private int pBC(int x, int max) { /*periodic boundary conditions*/
int xp = x;
while (xp<0) xp += max;
while (xp>=max) xp -= max;
return xp;
}
}
4.1 Program Code 33
This is RDCanvas.java le is just like a canvas so we can paint on canvas just like
change color
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ptternformation;
import java.awt.*;
/**
*
* @author W.A.B. Janith
*/
final class RDCanvas extends Canvas implements Runnable {
public Thread runner = null;
int w, h;
Dimension preferredSize;
Image DB_Image;
Graphics DB_Graphics;
GrayScott grayScott;
int nColors = 85;
Color[] color = new Color[3*nColors];
double[][] u;
ReactionDiffusion controller;
double umax;
public RDCanvas(ReactionDiffusion controller, int w, int h) {
this.w = w;
this.h = h;
this.controller = controller;
preferredSize = new Dimension(w + 3, h + 3);
4.1 Program Code 34
u = new double[w][h];
for (int i = 0; i<nColors; i++) {
color[i] = new Color((int)(255*((double)i/nColors)), 0, 0);
}
for (int i = 0; i<nColors; i++) {
color[i+nColors] = new Color(255, (int)(255*((double)i/nColors)), 0);
}
for (int i = 0; i<nColors; i++) {
color[i+2*nColors] = new Color((int)(255*(1.0-(double)i/nColors)), 255,0);
}
grayScott = new GrayScott(w, h, controller.F0, controller.K0, 0.01);
}
@Override
public Dimension getPreferredSize() {
return preferredSize;
}
@Override
public void paint(Graphics g) {
update(g);
}
@Override
public void update(Graphics g) {
int cn;
double uMax = 0;
if (DB_Graphics == null) {
DB_Image = createImage(w+3, h+3);
4.1 Program Code 35
DB_Graphics = DB_Image.getGraphics();
}
for (int x = 0; x<w; x++) {
for (int y = 0; y<h; y++) {
cn = (int)((3*nColors-1.0)*u[x][y]/0.4);
if (cn>(3*nColors-1)) cn = 3*nColors - 1;
if (cn<0) cn = 0;
DB_Graphics.setColor(color[cn]);
DB_Graphics.drawLine(x+1,y+1,x+1,y+1);
}
}
/*draw border*/
DB_Graphics.setColor(Color.black);
DB_Graphics.drawLine(0,0,preferredSize.width-1,0);
DB_Graphics.drawLine(0,0,0,preferredSize.height-1);
DB_Graphics.drawLine(0,preferredSize.height-2,preferredSize.width-2,preferredSize.height-2);
DB_Graphics.drawLine(preferredSize.width-2,0,preferredSize.width-2,preferredSize.height-2);
DB_Graphics.drawLine(0,preferredSize.height-1,preferredSize.width-1,preferredSize.height-1);
DB_Graphics.drawLine(preferredSize.width-1,0,preferredSize.width-1,preferredSize.height-1);
g.drawImage(DB_Image, 0, 0, this);
}
@Override
public void run() {
Thread myThread = Thread.currentThread();
while (runner == myThread) {
for (int i = 0; i<10; i++) { /* 10 timesteps / frame */
grayScott.timeStep(1);
}
4.1 Program Code 36
umax = 0;
for (int x = 0; x<w; x++) {
for (int y = 0; y<h; y++) {
u[x][y] = grayScott.v[x][y];
if (u[x][y]>umax) umax = u[x][y];
}
}
repaint();
try {
Thread.sleep(50);
}
catch (InterruptedException e) {
}
}
}
}
4.1 Program Code 37
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ptternformation;
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
/**
*
* @author W.A.B. Janith
*/
/*------------------------------->class ReactionDiffusion<-----------------------------------------------
<APPLET CODE="ReactionDiffusion.class" WIDTH=200 HEIGHT=250>
<PARAM NAME=xmax VALUE=100>
<PARAM NAME=ymax VALUE=100>
</APPLET>
*/
public final class ReactionDiffusion extends Applet implements ActionListener, AdjustmentListener {
Thread runner = null;
int w; /*APPLET WIDTH*/
int h; /*APPLET HEIGHT*/
int xmax, ymax; /*canvas size*/
int tpf = 10; /*timesteps per frame*/
double dt;
4.1 Program Code 38
Graphics DB_Graphics;
Image DB_Image;
GrayScott grayScott;
int nColors = 85;
Color[] color = new Color[3 * nColors];
double[][] u;
double umax;
private RDCanvas canvas;
Scrollbar kSlider, fSlider;
Button restartButton;
Label fLabel, kLabel;
final double K0 = 0.079;
final double F0 = 0.02;
@Override
public void init() {
w = getSize().width; /*applet width*/
h = getSize().height; /*applet height*/
u = new double[w][h];
String p;
/*canvas width*/
p = getParameter("xmax");
if (p == null) {
p = "100";
}
xmax = Integer.valueOf(p).intValue();
if (xmax < 10) {
xmax = 10;
}
4.1 Program Code 39
/*canvas height*/
p = getParameter("ymax");
if (p == null) {
p = "100";
}
ymax = Integer.valueOf(p).intValue();
if (ymax < 10) {
ymax = 10;
}
/*create components*/
restartButton = new Button("Restart");
restartButton.addActionListener(this);
canvas = new RDCanvas(this, xmax, ymax);
int pos = (int) (K0 * 100.0 / 0.15);
kSlider = new Scrollbar(Scrollbar.HORIZONTAL, pos, 1, 0, 200);
kSlider.addAdjustmentListener(this);
kLabel = new Label("k = ");
kLabel.setText("k = " + String.valueOf(K0));
pos = (int) (F0 * 100.0 / 0.15);
fSlider = new Scrollbar(Scrollbar.HORIZONTAL, pos, 1, 0, 200);
fSlider.addAdjustmentListener(this);
fLabel = new Label("f = ");
fLabel.setText("f = " + String.valueOf(F0));
GridBagLayout gridbag = new GridBagLayout();
GridBagConstraints c = new GridBagConstraints();
4.1 Program Code 40
setLayout(gridbag);
/*add components*/
gridbag.setConstraints(getCanvas(), c);
add(getCanvas());
c.gridy = 1;
gridbag.setConstraints(fLabel, c);
add(fLabel);
c.gridy = 2;
c.fill = GridBagConstraints.HORIZONTAL;
gridbag.setConstraints(fSlider, c);
add(fSlider);
c.gridy = 3;
c.fill = GridBagConstraints.NONE;
gridbag.setConstraints(kLabel, c);
add(kLabel);
c.gridy = 4;
c.fill = GridBagConstraints.HORIZONTAL;
gridbag.setConstraints(kSlider, c);
add(kSlider);
c.gridy = 5;
c.fill = GridBagConstraints.NONE;
gridbag.setConstraints(restartButton, c);
add(restartButton);
}
4.1 Program Code 41
@Override
public void start() {
if (canvas.runner == null) {
canvas.runner = new Thread(canvas, "CanvasRunner");
canvas.runner.start();
}
}
@Override
public void stop() {
canvas.runner = null;
}
@Override
public void paint(Graphics g) {
/*draw border*/
g.setColor(Color.green);
g.drawLine(0, 0, getWidth() - 1, 0);
g.drawLine(0, 0, 0, getHeight() - 1);
g.drawLine(getWidth() - 1, getHeight() - 1, 0, getHeight() - 1);
g.drawLine(getWidth() - 1, getHeight() - 2, 0, getHeight() - 2);
g.drawLine(getWidth() - 1, getHeight() - 1, getWidth() - 1, 0);
g.drawLine(getWidth() - 2, getHeight() - 1, getWidth() - 2, 0);
}
@Override
public void actionPerformed(ActionEvent e) {
if (getCanvas().runner != null) {
canvas.runner = null;
getCanvas().grayScott.initialState();
canvas.runner = new Thread(getCanvas(), "CanvasRunner");
4.1 Program Code 42
getCanvas().runner.start();
} else {
getCanvas().grayScott.initialState();
}
}
@Override
public void adjustmentValueChanged(AdjustmentEvent e) {
if (e.getAdjustable() == fSlider) {
getCanvas().grayScott.setF(fSlider.getValue() * 0.15 / 100.0);
fLabel.setText("f = " + String.valueOf(getCanvas().grayScott.f));
} else {
getCanvas().grayScott.setK(kSlider.getValue() * 0.15 / 100.0);
kLabel.setText("k = " + String.valueOf(getCanvas().grayScott.k));
}
}
/**
* @return the canvas
*/
public RDCanvas getCanvas() {
return canvas;
}
}
4.1 Program Code 43
This is main class so we must run rst this java le(class)
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ptternformation;
import java.awt.Color;
import javax.swing.JFrame;
/**
*
* @author W.A.B. Janith
*/
public class main {
public static void main(String arg[]){
ReactionDiffusion theApplet = new ReactionDiffusion();
theApplet.init(); // Needed if overridden in applet
theApplet.start(); // Needed if overridden in applet
//... Create a window (JFrame) and make applet the content pane.
JFrame window = new JFrame("Sample Applet and Application");
window.setBackground(Color.ORANGE);
window.setContentPane(theApplet);
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.pack(); // Arrange the components.
//System.out.println(theApplet.getSize());
window.setVisible(true);
}
}
4.2 Program OUTPUT 44
4.2 Program OUTPUT
Figure 4.1
1
For f=0.02,k=0.079
Figure 4.2
2
or f=0.024,k=0.0765
Chapter 5
Conclusion
In this study we considered the large-time behavior of solutions U(x, y , t) and V
(x, y, t) of the Gray-Scott model on a two-dimensional domain (0, L) (0, L). We
focused on the parameters D
u
, D
v
and on the small L of the domain. We did look
at the nal proles of the model for two dierent values of F and K by doing some
numerical simulations. We tried to build the program which we saw in our project
results. It appears dierent patterns that for some values of F and k for small L, we
able to built a nice patterns of our numerical results using the Gray-Scott model.
45
Chapter 6
Discussion
In this dissertation we have investigated pattern formation in reaction-
diusion systems. We used a simple and well known model to explore
dierent pattern behaviors in two dimensions. This pattern generation
model is using in very important role because every biological pattern
was made by in reaction such as reaction diusions .as a example zebras
skin , tigers skin and our nger print also made in pattern by reaction
diusions . we developed a programs generate many varies pattern For a
variety of systems, reaction-diusion equations with more than two com-
ponents have been proposed, e.g. as models for the Belousov-Zhabotinsky
reaction, for blood clotting or planar gas discharge systems. So we can
implement our program in multi dimensional region.
In recent times, reaction-diusion systems have attracted much interest
as a prototype model for pattern formation. The above-mentioned pat-
terns (fronts, spirals, targets, hexagons, stripes and dissipative solutions)
can be found in various types of reaction-diusion systems in spite of large
discrepancies e.g. in the local reaction terms. It has also been argued that
46
47
reaction-diusion processes are an essential basis for processes connected
to morphogenesis in biology and may even be related to animal coats and
skin pigmentation. The chemical basis of morphogenesis Another reason
for the interest in reaction-diusion systems is that although they rep-
resent nonlinear partial dierential equation, there are often possibilities
for an analytical treatment. There are many experiments in the world be
investigated. Well-controllable experiments in chemical reaction-diusion
systems have up to now been realized in three ways. First, gel reactors
or lled capillary tubes may be used. Second, temperature pulses on cat-
alytic surfaces have been investigated. Third, the propagation of running
nerve pulses is modeled using reaction-diusion systems. Aside from these
generic examples, it has turned out that under appropriate circumstances
electric transport systems like plasmas or semiconductors can be described
in a reaction-diusion approach. For these systems various experiments
on pattern formation have been carried out.
Bibliography
[1] M.K.Jain,S.R.K.Iyengar,R.K.Jain, Computational Methods for Partial Dieren-
tial Equations, 3rd ed. (Wiley, new Delhi:India, 1993),
[2] Randall J. LeVeque, Finite Dierence Methods for Dierential Equations,
DRAFT VERSION for use in the course A Math 585-586 University of Wash-
ington Version of September, 2005.
[3] PATTERN FORMATION IN REACTION-DIFFUSION MODELS FAR FROM
THE TURING REGIME by THEODORE KOLOKOLNIKOV August 2004
[4] Pattern formation in the Gray-Scott model Je S. McGough and Kyle Riley
Department of Mathematics and Computer Science, South Dakota School of
Mines and Technology 501 E. St. Joseph St. Rapid City, SD 57701 USA
[5] Numerical Solutio of the 2D Gray-scott model ,Jan Mach,Faculty of Nuclear sci-
ences and PhysicalPhysical Engineering,Czech Teachnical University in Prague.
[6] Sole) PATTERN FORMATION IN NOISY SELF-REPLICATING SPOTS An-
dreea Munteanu1,and Ricard V. Sole, 1ICREA-Complex Systems Lab, Universi-
tat Pompeu Fabra (GRIB), Dr Aiguader 80, 08003 Barcelona, Spain 2Santa Fe
Institute, 1399 Hyde Park Road, Santa Fe NM 87501, USA
[7] http://www.wikipedia.org/
48

You might also like