+ All Categories
Home > Documents > 1D Di usion PDE - marie.ph.surrey.ac.ukmarie.ph.surrey.ac.uk/~phs1rs/teaching/l3_pdes.pdf · The di...

1D Di usion PDE - marie.ph.surrey.ac.ukmarie.ph.surrey.ac.uk/~phs1rs/teaching/l3_pdes.pdf · The di...

Date post: 26-Jun-2018
Category:
Upload: phunghuong
View: 228 times
Download: 0 times
Share this document with a friend
23
The diffusion PDE 1D Diffusion PDE Introduction to Partial Differential Equations part of EM, Scalar and Vector Fields module (PHY2064) Richard Sear November 17, 2017 Richard Sear 1D Diffusion PDE
Transcript
Page 1: 1D Di usion PDE - marie.ph.surrey.ac.ukmarie.ph.surrey.ac.uk/~phs1rs/teaching/l3_pdes.pdf · The di usion PDE 1D Di usion PDE Introduction to Partial Di erential Equations part of

The diffusion PDE

1D Diffusion PDEIntroduction to Partial Differential Equations

part of EM, Scalar and Vector Fields module (PHY2064)

Richard Sear

November 17, 2017

Richard Sear 1D Diffusion PDE

Page 2: 1D Di usion PDE - marie.ph.surrey.ac.ukmarie.ph.surrey.ac.uk/~phs1rs/teaching/l3_pdes.pdf · The di usion PDE 1D Di usion PDE Introduction to Partial Di erential Equations part of

The diffusion PDE

Diffusion equation in one dimension

This lecture

Diffusion PDE in 1D

Method of Separation of Variables to solve diffusion PDE

Particular solution with just one wavevector k

Particular solutions using Fourier series

Particular solution that is a Gaussian function

Richard Sear 1D Diffusion PDE

Page 3: 1D Di usion PDE - marie.ph.surrey.ac.ukmarie.ph.surrey.ac.uk/~phs1rs/teaching/l3_pdes.pdf · The di usion PDE 1D Di usion PDE Introduction to Partial Di erential Equations part of

The diffusion PDE

Diffusion equation in one dimension

The one-dimensional diffusion equation, for a function P(x , t), is

∂2P(x , t)

∂x2=

1

D

∂P(x , t)

∂t

or equivalently∂P(x , t)

∂t= D

∂2P(x , t)

∂x2

where D is the diffusion constant. The larger the value of D thefaster is diffusion. D has units of length squared over time. Notethat it is a linear homogeneous PDE, and that it is very similar tothe wave PDE except that the time derivative is first order notsecond order.P could be, for example, the concentration of say sugar moleculesin water. Thermal energy also diffuses, so P could also betemperature. Other conserved quantities can also diffuse, so itsome circumstances a component of the momentum will also obeythis PDE.

Richard Sear 1D Diffusion PDE

Page 4: 1D Di usion PDE - marie.ph.surrey.ac.ukmarie.ph.surrey.ac.uk/~phs1rs/teaching/l3_pdes.pdf · The di usion PDE 1D Di usion PDE Introduction to Partial Di erential Equations part of

The diffusion PDE

Diffusion equation in one dimension: Standing wavesolutions via method of separation of variables

The main technique we will use for solving the wave, diffusion andLaplace’s PDEs is the method of Separation of Variables. For thediffusion equation in 1D this works as follows.

We know the solution will be a function of two variables: x and t,P(x , t). We assume it has a specific form, namely that it is theproduct of a function only of x , X (x), times a function only of t,T (t).

P(x , t) = X (x)T (t)

Using this we can break the PDE into a pair of ODEs, each ofwhich is much easier to solve than the PDE.Note that this assumption is wrong for most functions of x and t,e.g., P(x , t) = x + t cannot be written in the form of X (x)T (t).

Richard Sear 1D Diffusion PDE

Page 5: 1D Di usion PDE - marie.ph.surrey.ac.ukmarie.ph.surrey.ac.uk/~phs1rs/teaching/l3_pdes.pdf · The di usion PDE 1D Di usion PDE Introduction to Partial Di erential Equations part of

The diffusion PDE

Diffusion equation in one dimension: Standing wavesolutions via method of separation of variables

Because the assumption P(x , t) = X (x)T (t) is not correct in mostcases it will give us a solution but usually not the particularsolution that is consistent with the boundary conditions.

This is where Fourier series come in. We will find that X can be asine and a cosine, and from the mathematics of Fourier series weknow we can write essentially any function as a sum of sines andcosines. Because we can write any function as a Fourier series, wecan use a Fourier series to satisfy any set of BCs.

Richard Sear 1D Diffusion PDE

Page 6: 1D Di usion PDE - marie.ph.surrey.ac.ukmarie.ph.surrey.ac.uk/~phs1rs/teaching/l3_pdes.pdf · The di usion PDE 1D Di usion PDE Introduction to Partial Di erential Equations part of

The diffusion PDE

Diffusion equation in one dimension: Standing wave andtravelling wave solutions

The one-dimensional diffusion equation, for a function P(x , t), is

∂2P(x , t)

∂x2=

1

D

∂P(x , t)

∂t

If we substitute P(x , t) = X (x)T (t) into the one-dimensional waveequation we get

∂2X (x)T (t)

∂x2=

1

D

∂X (x)T (t)

∂t

Richard Sear 1D Diffusion PDE

Page 7: 1D Di usion PDE - marie.ph.surrey.ac.ukmarie.ph.surrey.ac.uk/~phs1rs/teaching/l3_pdes.pdf · The di usion PDE 1D Di usion PDE Introduction to Partial Di erential Equations part of

The diffusion PDE

Diffusion equation in one dimension: Standing wavesolutions

Because we can take T out of the x differentiation as it isindependent of x , and similarly we can take X out of the tdifferentiation, this becomes

T (t)d2X (x)

dx2=

1

DX (x)

dT (t)

dt

If we divide both sides by XT , we get

1

X (x)

d2X (x)

dx2=

1

D

1

T (t)

dT (t)

dt

Now, we notice that the left-hand side is a function of x but not oft while the right-hand side is a function of t but not of x .

Richard Sear 1D Diffusion PDE

Page 8: 1D Di usion PDE - marie.ph.surrey.ac.ukmarie.ph.surrey.ac.uk/~phs1rs/teaching/l3_pdes.pdf · The di usion PDE 1D Di usion PDE Introduction to Partial Di erential Equations part of

The diffusion PDE

Diffusion equation in one dimension: Standing wavesolutions

So the LHS tells us that the equation does not depend on t (theonly function of t is T and that is not present on the LHS), andthe RHS tells us that it does not depend on x . Therefore it cannotdepend on either x or t, and so must be a constant. At themoment we don’t know what this constant is and so could call itC . But as we’ll see we’ll need it to be negative, and it will help ifis squared, so we will call this constant −k2.

So we have

1

X (x)

d2X (x)

dx2=

1

D

1

T (t)

dT (t)

dt= −k2

which gives us the two ODEs

d2X (x)

dx2= −k2X (x) and

dT (t)

dt= −k2DT (t)

Richard Sear 1D Diffusion PDE

Page 9: 1D Di usion PDE - marie.ph.surrey.ac.ukmarie.ph.surrey.ac.uk/~phs1rs/teaching/l3_pdes.pdf · The di usion PDE 1D Di usion PDE Introduction to Partial Di erential Equations part of

The diffusion PDE

Diffusion equation in one dimension: Standing wavesolutions

Revision The ODE for X is just the ODE for SHM

d2X (x)

dx2= −k2X (x)

as for the wave PDE but the ODE for T is the same as ODE thatdescribes radioactive decay

dT (t)

dt= −k2DT (t)

The solutions of these ODEs are

X (x) = A cos(kx) + B sin(kx) and T (t) = C exp(−k2Dt)

Note that these are the general solutions to these ODEs, becausethe solution to the second order ODE has two unknown constants(A and B), while that for the first-order ODE has one unknownconstant (C ).

Richard Sear 1D Diffusion PDE

Page 10: 1D Di usion PDE - marie.ph.surrey.ac.ukmarie.ph.surrey.ac.uk/~phs1rs/teaching/l3_pdes.pdf · The di usion PDE 1D Di usion PDE Introduction to Partial Di erential Equations part of

The diffusion PDE

Why the minus sign?

We choose the − sign as we wanted sine and cosine functions forX (x) and a decaying exponential for T (t).

If we picked a + sign, we would get exponentials for X (x), plus anincreasing exponential for T (t). The increasing exponential forT (t) would give solutions where diffusion, a spontaneous process,makes molecules more localised. This violates the 2nd Law ofThermodynamics becuase it reduces the entropy, so is notphysically allowed.

The fact that k is squared is because if we do this we get that k isjust the standard wavevector a wave, i.e., k = 2π/λ, for λ thewavelength of the wave.

Richard Sear 1D Diffusion PDE

Page 11: 1D Di usion PDE - marie.ph.surrey.ac.ukmarie.ph.surrey.ac.uk/~phs1rs/teaching/l3_pdes.pdf · The di usion PDE 1D Di usion PDE Introduction to Partial Di erential Equations part of

The diffusion PDE

Diffusion equation in one dimension: Standing wavesolution

We can multiply X and T together and get the solution for P

P(x , t) = X (x)T (t) = [A cos(kx) + B sin(kx)]C exp(−k2Dt)

P(x , t) = AC cos(kx) exp(−k2Dt) + BC sin(kx) exp(−k2Dt)

or defining the two new constants F = AC and E = BC

P(x , t) = F cos(kx) exp(−k2Dt) + E sin(kx) exp(−k2Dt)

This solution has two terms: an exponentially decaying cosinewave and an exponentially decaying sine wave.

Richard Sear 1D Diffusion PDE

Page 12: 1D Di usion PDE - marie.ph.surrey.ac.ukmarie.ph.surrey.ac.uk/~phs1rs/teaching/l3_pdes.pdf · The di usion PDE 1D Di usion PDE Introduction to Partial Di erential Equations part of

The diffusion PDE

Boundary conditions and particular solutions

As always, determining the particular solution requires not justsolving the PDE, but imposing the BCs. Three types of particularsolution:

Solution with just one wavevector k , i.e., P(x , t) consists ofterms with only one wavelength.

Fourier series solution: gives general solution of diffusion PDE.

Gaussian solution: Roughly speaking these are used when westart with whatever is diffusing localised at a point. Then theGaussian describes how whatever is diffusing spreads out.

Note that a Fourier series gives a general solution but that if whatever is

diffusing (molecules, electrons, thermal energy, etc) starts off

concentrated at a point (i.e., for that initial BC) the solution can more

easily be written as a Gaussian.

Richard Sear 1D Diffusion PDE

Page 13: 1D Di usion PDE - marie.ph.surrey.ac.ukmarie.ph.surrey.ac.uk/~phs1rs/teaching/l3_pdes.pdf · The di usion PDE 1D Di usion PDE Introduction to Partial Di erential Equations part of

The diffusion PDE

BCs for example with only one wavevector k

A possible solution of the wave function consists of cosine and sinestanding waves of amplitudes F and E

P(x , t) = F cos(kx) exp(−k2Dt) + E sin(kx) exp(−k2Dt)

Because the diffusion equation is first order with respect to thetime derivative, BCs that are initial BCs need to specify only theprofile P(x , t) at t = 0, e.g., via a BC

P(x , t = 0) = 10 cos(0.75x)

this is different from the wave PDE, because the wave PDE issecond order in time.

Richard Sear 1D Diffusion PDE

Page 14: 1D Di usion PDE - marie.ph.surrey.ac.ukmarie.ph.surrey.ac.uk/~phs1rs/teaching/l3_pdes.pdf · The di usion PDE 1D Di usion PDE Introduction to Partial Di erential Equations part of

The diffusion PDE

BCs for example with only one wavevector k

If we impose this BC, we get

P(x , t = 0) = 10 cos(0.75x) = F cos(kx) exp(0) + E sin(kx) exp(0)

or10 cos(0.75x) = F cos(kx) + E sin(kx)

so we must have that k = 0.75, F = 10 and E = 0. The solutionthen becomes

P(x , t) = 10 cos(0.75x) exp(−0.5625Dt)

Richard Sear 1D Diffusion PDE

Page 15: 1D Di usion PDE - marie.ph.surrey.ac.ukmarie.ph.surrey.ac.uk/~phs1rs/teaching/l3_pdes.pdf · The di usion PDE 1D Di usion PDE Introduction to Partial Di erential Equations part of

The diffusion PDE

BCs for example with only one wavevector k

As the particular solution is

P(x , t) = 10 cos(0.75x) exp(−0.5625Dt)

It is just an exponentially decaying single cosine wave, see belowfor plots of P(x , t = 0) (thick green curve), P(x , t = 1) (mediumred) and P(x , t = 3) (thin blue).

0 5 10 15

x

−10

0

10

P(x,t

=co

nst

ant)

Richard Sear 1D Diffusion PDE

Page 16: 1D Di usion PDE - marie.ph.surrey.ac.ukmarie.ph.surrey.ac.uk/~phs1rs/teaching/l3_pdes.pdf · The di usion PDE 1D Di usion PDE Introduction to Partial Di erential Equations part of

The diffusion PDE

Diffusion equation in one dimension: Fourier series solution

We can write any periodic solution with any BCs, of the diffusionPDE as

P(x , t) =1

2a0 +

∞∑n=1

[an cos(knx) + bn sin(knx)] exp(−k2nDt)

the period can be anything. a0 is the constant term. Thewavevector of the nth term, kn, is: kn = 2πn/L, for L the period ofP(x , t). The boundary conditions will determine the values of theconstants a0, an and bn, and of the kn and then once these valuesare determined we have the particular solution.

Richard Sear 1D Diffusion PDE

Page 17: 1D Di usion PDE - marie.ph.surrey.ac.ukmarie.ph.surrey.ac.uk/~phs1rs/teaching/l3_pdes.pdf · The di usion PDE 1D Di usion PDE Introduction to Partial Di erential Equations part of

The diffusion PDE

Diffusion equation in one dimension: Fourier series solution

So to find a particular solution of the diffusion PDE with initialBCs (i.e., function at t = 0), the procedure is as follows

1 Write down both the general expression for the Fourier seriessolution of the diffusion PDE, and the expressions for a0, anand bn.

2 Use the expressions for a0, an and bn in terms of integralsover the function at t = 0, to calculate a0, an and bn.

3 Put the now known values of a0, an and bn in the Fourierseries general solution of the diffusion PDE, to get theparticular solution we want.

Richard Sear 1D Diffusion PDE

Page 18: 1D Di usion PDE - marie.ph.surrey.ac.ukmarie.ph.surrey.ac.uk/~phs1rs/teaching/l3_pdes.pdf · The di usion PDE 1D Di usion PDE Introduction to Partial Di erential Equations part of

The diffusion PDE

Diffusion equation in one dimension: Fourier series solution

We can consider a simple example: the square wave, defined by

P(x , t = 0) =

{−1 −π < x < 0+1 0 < x < π

As we saw in the Fourier series revision part of this course, this canbe written as the sum of sine waves

P(x , t = 0) =∑

n=1,3,5,7,...

4

nπsin (nx)

Note that for this square wave, a0 = an = 0 and only the bn forodd values of n are non-zero (and equal to 4/nπ). Also, herekn = n as the period is 2π.

Richard Sear 1D Diffusion PDE

Page 19: 1D Di usion PDE - marie.ph.surrey.ac.ukmarie.ph.surrey.ac.uk/~phs1rs/teaching/l3_pdes.pdf · The di usion PDE 1D Di usion PDE Introduction to Partial Di erential Equations part of

The diffusion PDE

Diffusion equation in one dimension: Fourier series solution

To convert this to a solution of 1D diffusion we just multiply by= exp(−k2

nDt) = exp(−n2Dt) - because here kn = n

P(x , t) =∑

n=1,3,5,7,...

4

nπsin (nx) exp

(−n2Dt

)

Richard Sear 1D Diffusion PDE

Page 20: 1D Di usion PDE - marie.ph.surrey.ac.ukmarie.ph.surrey.ac.uk/~phs1rs/teaching/l3_pdes.pdf · The di usion PDE 1D Di usion PDE Introduction to Partial Di erential Equations part of

The diffusion PDE

Diffusion equation in one dimension: Fourier series solution

A plot of a sine wave approximation (up to n = 17) square-wavetravelling wave P(x , t = constant) of wavelength L = 2π, at three times,t = 0 (thick green), t = 0.2 (medium red), and t = 1 (thin blue). The

diffusion constant D = 1.

0 5 10 15

x

−1.5

−1.0

−0.5

0.0

0.5

1.0

1.5

P(x,t

=co

nst

ant)

Richard Sear 1D Diffusion PDE

Page 21: 1D Di usion PDE - marie.ph.surrey.ac.ukmarie.ph.surrey.ac.uk/~phs1rs/teaching/l3_pdes.pdf · The di usion PDE 1D Di usion PDE Introduction to Partial Di erential Equations part of

The diffusion PDE

Diffusion equation in one dimension: Gaussian solution

As we saw in question sheet 2, the 1D diffusion equation can besolved by a Gaussian function of x , with a t−1/2 dependence of theprefactor, and the x2 in the exponential divided by 4Dt

P(x , t) =A

t1/2exp

[− x2

4Dt

]for A a constant.

The Gaussian function is appropriate to the BC where at t = 0, Pis a delta function, i.e., is zero everywhere except at the origin. Soif there is localised hot spot at t = 0, then a Gaussian P describeshow the heat spreads out from this initial hot spot.Also, if we know a molecule is at the origin at t = 0, and after thatit diffuses, then a Gaussian P is also the correct solution.

Richard Sear 1D Diffusion PDE

Page 22: 1D Di usion PDE - marie.ph.surrey.ac.ukmarie.ph.surrey.ac.uk/~phs1rs/teaching/l3_pdes.pdf · The di usion PDE 1D Di usion PDE Introduction to Partial Di erential Equations part of

The diffusion PDE

Diffusion equation in one dimension: Gaussian solution

A plot of a profile P(x , t = constant) at three different times, that isspreading via diffusion. The profile started localised at x = 0 at t = 0.

The thick green, medium red and think blue curves are at times t = 0.01,1.0 and 3.0, respectively.

−4 −2 0 2 4

x

0.0

0.5

1.0

1.5

2.0

2.5

3.0

P(x,t

=co

nst

ant)

Richard Sear 1D Diffusion PDE

Page 23: 1D Di usion PDE - marie.ph.surrey.ac.ukmarie.ph.surrey.ac.uk/~phs1rs/teaching/l3_pdes.pdf · The di usion PDE 1D Di usion PDE Introduction to Partial Di erential Equations part of

The diffusion PDE

Diffusion equation in one dimension

This lecture

Diffusion PDE in 1D

Method of Separation of Variables to solve diffusion PDE

Particular solution with just one wavevector k

Particular solutions using Fourier series

Particular solution that is a Gaussian function

Richard Sear 1D Diffusion PDE


Recommended