Section 8.5: Partial Differential Equations - ualberta.cathillen/book/Section8_5.pdf · Section...

4
Section 8.5: Partial Differential Equations Created by Tomas de-Camino-Beck Diffusion This is the simple diffusion equation: deqn = D@u@x, tD,tD ã dD@u@x, tD,x,xD; TraditionalForm@deqnD u H0,1L Hx, tL du H2,0L Hx, tL Let generate a simple pulse function using picewise equations, g@x_, ε_D := Ø ± 0 x <-1 10 10 - ε § x § ε 0 x > 1 Now, lets run some numerical simulations using the folowing initial and boundary conditions: 1. Initial condition: uH x,0L = gH xL (our picewise function) 2. Boundary conditions (absorbing): uH0, t L = 0 and uH10, tL = 0 note that our spatial domain L = 8-10, 10< 3. lets choose a value for the diffusion coefficient d d = 0.08; sol = NDSolve@8deqn, u@x, 0D ã g@x, 1D,u@-10, tD ã 0, u@10, tD ã 0<, u, 8x, - 10, 10<, 8t, 0, 100<D NDSolve::mxsst : Using maximum number of grid points 10000 allowed by the MaxPoints or MinStepSize options for independent variable x. More… 88u Ø InterpolatingFunction@88-10., 10.<, 80., 100.<<, <>D<< Section8_5.nb 1 Printed by Mathematica for Students

Transcript of Section 8.5: Partial Differential Equations - ualberta.cathillen/book/Section8_5.pdf · Section...

Page 1: Section 8.5: Partial Differential Equations - ualberta.cathillen/book/Section8_5.pdf · Section 8.5: Partial Differential Equations ... Printed by Mathematica for Students. ... Fisher's

Section 8.5: Partial Differential EquationsCreated by Tomas de-Camino-Beck

Diffusion

This is the simple diffusion equation:

deqn = D@u@x, tD, tD ã d D@u@x, tD, x, xD;

TraditionalForm@deqnDuH0,1L Hx, tL d uH2,0L Hx, tL

Let generate a simple pulse function using picewise equations,

g@x_, ε_D :=Ø

±

0 x < -1

1010 -ε § x § ε

0 x > 1

Now, lets run some numerical simulations using the folowing initial and boundary conditions:1. Initial condition: uHx, 0L = gHxL (our picewise function)2. Boundary conditions (absorbing): uH0, tL = 0 and uH10, tL = 0 note that our spatial domain L = 8-10, 10<3. lets choose a value for the diffusion coefficient d

d = 0.08;sol =NDSolve@8deqn, u@x, 0D ã g@x, 1D, u@-10, tD ã 0, u@10, tD ã 0<, u, 8x, -10, 10<, 8t, 0, 100<D

NDSolve::mxsst : Using maximum number of grid points 10000

allowed by the MaxPoints or MinStepSize options for independent variable x. More…

88u Ø InterpolatingFunction@88-10., 10.<, 80., 100.<<, <>D<<

Section8_5.nb 1

Printed by Mathematica for Students

Page 2: Section 8.5: Partial Differential Equations - ualberta.cathillen/book/Section8_5.pdf · Section 8.5: Partial Differential Equations ... Printed by Mathematica for Students. ... Fisher's

Plot3D@Evaluate@u@x, tD ê. sol@@1DDD, 8x, -10, 10<,8t, 0, 100<, PlotPoints Ø 40, Mesh Ø False, PlotRange Ø AllD

-10

-5

0

5

10 0

20

40

60

80

100

0

2.5µ 1095µ 109

7.5µ 109

1µ 1010

-10

-5

0

5

10

Ü SurfaceGraphics Ü

Lets loos at a plot of different times:

Plot@Evaluate@8u@x, 10D ê. sol@@1DD, u@x, 50D ê. sol@@1DD, u@x, 100D ê. sol@@1DD<D,8x, -10, 10<, PlotRange Ø All, Frame Ø TrueD

-10 -5 0 5 100

1µ 109

2µ 109

3µ 109

4µ 109

5µ 109

Ü Graphics Ü

It can be seen form here that the numerical solution is a gaussian, just as the analytical solution. In the stochastic modelchapter, a stochastic process, simulating random walk, produces the same numerical result. However, deterministic walks canalso generate diffusion (Wolfram 2002)

Section8_5.nb 2

Printed by Mathematica for Students

Page 3: Section 8.5: Partial Differential Equations - ualberta.cathillen/book/Section8_5.pdf · Section 8.5: Partial Differential Equations ... Printed by Mathematica for Students. ... Fisher's

Fisher's Equation

Fisher's equations models a population with density dependent growth and diffusion in a one dimensional space. nota the theequation is the same as diffusion, but now we add a term m uH1 - 1L which is logistic growth (non-dimensional), with growthrate m. See Murray (1993)

deqn = D@u@x, tD, tD ã d D@u@x, tD, x, xD + m u@x, tD H1 - u@x, tDL;

TraditionalForm@deqnDuH0,1L Hx, tL m H1 - uHx, tLL uHx, tL + d uH2,0L Hx, tL

Lets use a similar pulse function:

Clear@gD;

g@x_, ε_D :=ر

0 x < -10.001 -ε § x § ε

0 x > 1

The initial and boundary conditions are the same:

d = 0.08; m = 2;sol =NDSolve@8deqn, u@x, 0D ã g@x, 1D, u@-10, tD ã 0, u@10, tD ã 0<, u, 8x, -10, 10<, 8t, 0, 100<D

NDSolve::mxsst : Using maximum number of grid points 10000

allowed by the MaxPoints or MinStepSize options for independent variable x. More…

88u Ø InterpolatingFunction@88-10., 10.<, 80., 100.<<, <>D<<

Plot3D@Evaluate@u@x, tD ê. sol@@1DDD, 8x, -10, 10<,8t, 0, 10<, PlotPoints Ø 40, Mesh Ø False, PlotRange Ø AutomaticD

-10

-5

0

5

10 0

2

4

6

8

10

00.250.5

0.75

1

-10

-5

0

5

10

Ü SurfaceGraphics Ü

Let look at different plot for different times, so we can see the front of the travelling wave:

Section8_5.nb 3

Printed by Mathematica for Students

Page 4: Section 8.5: Partial Differential Equations - ualberta.cathillen/book/Section8_5.pdf · Section 8.5: Partial Differential Equations ... Printed by Mathematica for Students. ... Fisher's

Plot@Evaluate@8u@x, 8D ê. sol@@1DD, u@x, 9D ê. sol@@1DD, u@x, 10D ê. sol@@1DD, u@x, 11D ê. sol@@1DD<D,

8x, -10, 10<, PlotRange Ø All, Frame Ø TrueD

-10 -5 0 5 100

0.2

0.4

0.6

0.8

1

Ü Graphics Ü

References

Murray J.D. 1993. Mathematical biology, 2nd, corr. ed edn. Springer-Verlag, Berlin, New York .

Wolfram, S. 2002. A new kind of science. : Wolfram Media, Champaign, IL.

Section8_5.nb 4

Printed by Mathematica for Students