Class 4th Dec

Download as pdf or txt
Download as pdf or txt
You are on page 1of 26

numerical methods for

differential equations and


applications

Supervisor: Camile Fraga Delfino Kunz

December 4th, 2018


What do we have for today?

Introduction to Partial Differential Equations (PDEs);


Advection equation;
Diffusion equation;
Numerical methods for the diffusion equation.
Partial Differential Equations

Classification for 2nd order PDEs


auxx + buxy + cuyy + dux + euy + fu = g
The classification depends on the sign of the discriminant
∆ = b 2 − 4ac:
∆ < 0: elliptic;
∆ = 0: parabolic;
∆ > 0: hyperbolic.
Partial Differential Equations

Elliptic: Poisson problem


∇2 u = f

Elliptic equations models typically steady-state or


equilibrium phenomena, there is no temporal dependence.
∇2 is the Laplacian operator and f is a given function;
We seek for a function u(x) that satisfies the equation
with some boundary conditions.
Partial Differential Equations

Parabolic: heat/diffusion equation


∂u
= ∇2 u − f
∂t

This equation is known as heat or diffusion equation;


Now u(x, t) varies with time and space;
It requires initial condition u(x, 0) for every x ∈ Ω and
boundary conditions at each time t > 0.
Partial Differential Equations

Hyperbolic: wave equation


∂u ∂u
+a =0
∂t ∂x

The equation models wave motion and the solution is


periodic, that is,

u(x, t) = u(x − at, 0)


Conservation equation
In physics, on an isolated system, there are many properties
which are constant over time, for an example: the total
energy, total momentum, and total mass.
Consider the flux of particles on a tube:

Hypothesis:
1) Motion occurs in 1D;
2) Cross-sectional area A is constant.
Conservation equation

c(x, t): particles concentration (number/volume);


J(x, t): particles flow (number.area/time);
σ(x, t): source/sink’s density rate (number/volume.time).
Conservation equation

The total particles number on the interval [x, x + ∆x] changes


due to:
i) flow of particles going in/out the interval (x, x + ∆x);
ii) introduction or degradation of particles on the interval
(through chemical reaction, for an example).
Conservation equation

Now let us translate it into dimensionally correct equation.


Consider:
A: cross-sectional area of the tube;
∆V : volume length element: ∆V = A∆x
Units:
c: number/volume;
J: number/area.time;
σ: number/volume.time.
Conservation equation


[c(x, t)A∆x] = J(x, t)A − J(x + ∆x, t)A ± σ(x, t)A∆x
∂t
Observing the units:
1 h number i number number number
.volume = .area − .area ± .volume
time volume time.area time.area volume.time
Conservation equation

If A is constant,

A∆x [c(x, t)] = J(x, t)A − J(x + ∆x, t)A ± σ(x, t)A∆x
∂t
∂ J(x, t) − J(x + ∆x, t)
[c(x, t)] = ± σ(x, t)
∂t ∆x
For ∆x → 0, we get:
∂c ∂J
= − ± σ(x, t)
∂t ∂x}
| {z | {z }
source/sink
net motion
Conservation equation

If the fluid is moving with velocity v (x, t), the flux of the
particles is

J = c.v

Substituting on the past equation,


∂c ∂
= − [c(x, t)v (x, t)]
∂t ∂x
This is known as advection equation. On many dimensions:

∂c
= −∇(c.v )
∂t
Random motion and diffusion equation
Diffusion is a metabolically cheap process on the cells
level and occurs due to random motion of particles;
The flux due to random motion is proportional to the
local gradient in the particle concentration:

J = −D∇c

this equation is known as Fick’s law.


The constant D is the diffusion coefficient;
The minus sign means that the particles moves away from
the most concentrated local.
Random motion and diffusion equation

In one dimension, J = −D(∂c/∂x), so that,

∂c ∂  ∂c 
= D
∂t ∂x ∂x
In more dimensions,
∂c
= ∇(D∇c)
∂t
and if D is constant,

∂c
= D∇2 c
∂t
Random motion and diffusion equation

On the preview approach we got the diffusion equation


through the Fick’s law.

...let us now get it using random walk!


Random motion and diffusion equation

A collection of particles moves randomly with an average


step ∆x every time unity τ ;
Assume that the probability of moving to the left or to
the right are both equal, λ)l = λr = 1/2;
Let c(x, t)∆x be the number of particles on the segment
[x, x + x] time t, then:

c(x, t + τ ) = c(x, t) + λr c(x − ∆, t) − λr c(x, t)


= λl c(x + ∆x, t) − λl c(x, t) (∗)
Random motion and diffusion equation

Writing the Taylor-series expansion:

∂c ∂ 2c τ 2
c(x, t + τ ) = c(x, t) + τ+ 2 + ...
∂t ∂t 2

∂c ∂ 2 c ∆x 2
c(x ± ∆x, t) = c(x, t) ± ∆x + 2 ± ...
∂x ∂x 2
Random motion and diffusion equation

Substituting on (∗), using the fact λ)l = λr = 1/2, and after


some simplifications,

∂c ∂ 2 c τ ∂ 2 c ∆x 2
+ 2 + ... = 2 + ...
∂t ∂t 2 ∂x 2τ
If we write D = ∆x 2 /2τ and take the limit τ → 0 and
∆x → 0, we get:

∂c ∂ 2c
=D 2
∂t ∂x
Random motion and diffusion equation

Diffusion coefficient:
distance2
D=
time

Average distance that diffusion acts: ≈ Dt
d2
Average time taken to diffuse a distance d: ≈
D
The diffusion coefficient of oxygen on water is
approximately 10−5 cm2 /sec. So for it diffuse through a
distance of 1m would take 27 years! It means that
diffusion is a local process.
Numerical methods for diffusion equation

Consider the problem:

∂c ∂ 2c


 =D 2, x ∈ (a, b)
 ∂t
 ∂x

 c(a, t) = α , c(b, t) = β , t>0

c(x, 0) = g (x) , x ∈ [a, b]

And the following space discretization for the interval [a, b]:
Numerical methods for diffusion equation

(n)
Notation: C (xi , t n ) = Ci .
If we consider h = xi − xi−1 , i = 0, . . . , m, and k = t n − t n−1 ,
n = 0, . . . , N, we can take the approximations:
(n+1) (n)
∂Ci C − Ci
≈ i
∂t k

∂ 2 Ci Ci−1 − 2Ci + Ci+1


2

∂x h2
Numerical methods for diffusion equation
Forward Euler
o(h2 , t);
k
Conditionally stable: h2
≤ 12 .

Cin+1 − Cin h C n − 2C n + C n i
= D i−1 i i
k h2
Numerical methods for diffusion equation
Backward Euler
o(h2 , t);
Unconditionally stable;

Cin+1 − Cin h C n+1 − 2C n+1 + C n+1 i


= D i−1 i
2
i
k h
Exercise

Show that the method using Forward Euler on the diffusion


equation is o(h2 , t) by calculating the local truncation error:

u(x, t + k) − u(x, t)
τ (x, t) =
k
1
− 2 [u(x − h, t) − 2u(x, t) + u(x + h, t)]
h
References

1. Edelstein-Keshet, L. Mathematical models in biology.


SIAM, 2005.

2. Leveque, R. J. Finite Difference Methods for Ordinary


and Partial Differential Equations. SIAM, 2007.

You might also like