Lab Work 5: Heat Equation
Lab Work 5: Heat Equation
Lab Work 5: Heat Equation
LW 5 2015-2016
Master Maths K M University
1 Heat equation
Suppose we have a solid body occupying a region Ω ⊂ R2 . The temperature distribution
in the body can be given by a function u : Ω × [0, T ] → R where [0, T ] is an interval of
time and u(x, t) is the temperature at a point x = (x1 , x2 ) and at time t.
Let us denote the heat entering from external sources by f (x, t) and λ to the conductivity
constant of the material. If the material is homogeneous (the same everywhere) and not
changing with time. The the heat equation reads :
c ∂u f
= ∆u + (1)
λ ∂t λ
where c is positive constant depends on the density of the material. Since c and λ are
constants and the equation simplifies to
∂u
− ∆u = f. (2)
∂t
To determine the steady state temperature distribution in a body we need to know not
only the sources and sinks within the body (given by f ), but also what is happening at
the boundary and at the initial time, say, t0 = 0. For example a common situation is that
the boundary is held at a given temperature u0 , then the boundary value problem takes
the form :
∂u(x, t)
∂t − ∆u(x, t) = f (x, t), (x, t) ∈ Ω×]0, T [.
u(x, t) = 0 x ∈ ∂Ω×]0, T [ (3)
u(x, 0) = u0 , x ∈ Ω
2 Variational formulation
Find u ∈ L2 (0, T, H01 (Ω)) ∩ C 0 (0, T, L2 (Ω)) such that
Z Z
d
uvdx + ∇u · ∇vdx = hf, vi , ∀v ∈ Ω. (4)
dt Ω Ω
u(x, 0) = u0 .
page: 1/ ??
3 SOME SCHEMES
3 Some schemes
3.1 Explicite Euler’s scheme
∂u un+1
j − unj
(xj , tn ) ≈ (6)
∂t ∆t
∂u unj − ujn−1
(xj , tn ) ≈ (7)
∂t ∆t
So the iteration will be as follows :
ä Give un−1
ä We compute un by the following formula :
Z n
u − un−1
Z Z
n
vdx + ∇u · ∇vdx = f vdx (8)
Ω ∆t Ω Ω
which is equivalent to
Z Z Z Z
u vdx + ∆t ∇u · ∇vdx = ∆t f vdx + un−1 vdx
n n
(9)
ω ω Ω Ω
ä We do a loop on time.
mesh Sh ;
f e s p a c e Vh( Sh , P1 ) ;
Vh u , v , f , u0 ;
f u n c s o u r c e =;
f u n c i n i d a t a =;
f= s o u r c e ;
u0=i n i d a t a ;
r e a l dt =;
problem Heat ( u , v ) = i n t 2 d ( Sh ) ( dt ∗mu∗ ( dx ( u ) ∗ dx ( v)+dy ( u ) ∗ dy ( v ) ) + u∗v )
−i n t 2 d ( Sh ) ( dt ∗ f ∗v+u0∗v )
+on ( 1 , u =0);
f o r ( i n t i t e r =1; i t e r < 1 0 ; i t e r ++)
{
Heat ;
u0=u ;
p l o t ( Sh , u , f i l l =1, w a i t =1, v a l u e=t r u e ) ;
}
page: 2/ ??
3.2 Implicite Euler’s scheme 3 SOME SCHEMES
∂u(x, t)
− div (a(x)∇u(x, t)) = 0, (x, t) ∈ Ω×]0, 5[. (11)
∂t
∂u
a(x) + 0.25(u − 25) = 0, x ∈ ΓN ×]0, 5[ (12)
∂n
u(x, 0) = u0 , x ∈ Ω ∪ ΓD (13)
page: 3/ ??