Partial Differential Equation of Parabolic Type
Partial Differential Equation of Parabolic Type
Partial Differential Equation of Parabolic Type
CONTENTS
Part A .3
Part B..4
Part C..6
Part D..8
Part E...8
Part F.9
Appendix13
References15
Length of rod is L[m]. At x=0[m] we have the left end and at x=L[m] we have the
right end.
Initially (t<0) the temperature of the rod is T=0[C].
At time t=0 we heat the left end of the rod with a pulse of temperature T=T0.
The heat pulse lasts for a duration of t=tp[s].
The heat diffusion process can be described by the following partial differential
equation: *Cp*(T/t)=k*(2/x2), t>0, 0<=x<=L
The Boundary Conditions are: 1A) T(0,t)=T0, if 0<=t<=tp
1B) T(0,t)=0, if t>tp
2) /t(L,t)=0
Part A
Show that with the new values u, and defined by: T=T0*u, x=L* and t=tp*, the problem
can be transformed(scaled) into the following dimensionless form: u/=*(2u/2), >0,
0<<1, with Boundary Conditions:
1a) u(0,)=1, if 0<=<=1
1b) u(0,)=0, if >1
2)u/(1,)=0 and Initial Conditions: 1) u(,0)=1, if =0,
2) u(,0)=0, if 0<<=1.
Solution
Thus, the partial differential equation of the problem can be rewritten by using the
relations (1), (2) and (3) as *Cp*(T/t)=k*(2/x2) =>
*Cp*[(T0*u)/(tp*t)]=k*T0/L2*(2u/2) =>(we transfer all constants to the right hand
For 0<=t<=tp => 0<=tp*<=tp => 0<=<=1 we have T(0,t)=T0 => T0*u(0,)=0 => u(0,)=1
For t>tp => tp*>tp => >1 we have T(0,t)=0 => T0*u(0,)=0 => u(0,)=0
For x=L we have x=L* => L=L* =>=1 and t=tp*, so /x(L,t)=0 => (T0*u)/(L*)(1,)=0 =>
u/(1,)=0
Hence, the Boundary Conditions can be written as: 1A) u(0,)=1, if 0<=<=1 , 1b) u(0,)=0, if
>1, 2) u/(1,)=0
The Initial Conditions are: 1) T(x,0)=T0, if x=0 ,
2) T(x,0)=0, if 0<x<=L
We have that x=L*, so for x=0 => L*=0 => =0 and T(x,0)=T0 => T0*u(,0)=T0 => u(,0)=1
For x=L => L*=L => =1 and T(x,0)=0 => T0*u(,0)=0 => u(,0)=0.
Hence, the Initial Conditions can be written as 1) u(,0)=1, if =0,
2) u(,0)=0, if 0<<=1
Part B
Discretize the variable using constant stepsize h and central differences to obtain an ODE
system du/dt=A*u+b(), u(0)=u0, where u0 is the zero vector. Show the dimensions and
structures of A, b() and u0. Show also the discretized grid of the -axis you have used and
how the gridpoints are numbered.
Solution
Our model problem is u/=*(2u/2) =>(=1) u/=(2u/2) with Boundary
Conditions u(0,)=1, if 0<=<=1, u(0,)=0, if >1 and u/(1,)=0 and with Initial
Condition u(,0)=1, if =0 and u(,0)=0, if 0<<=1.
We make a discretization with the MoL by introducing an extra gridpoint after the
right boundary point.
2 1
1 2
A=(1/h2)* 0
1
1
1
b()= =(1/h2)*
1
0
0
1
1
0
21
1 2
and
1
0
0
u(0)=
0
0
Part C
We discretize the ODE with the Eulers explicit method using constant stepsize t. In order to
make our calculations efficient we write our code so that the vector Au+b is formed directly.
We store the whole approximate solution (including initial and boundary condition) in a
large matrix U, where the first column is the initial condition while the first and the last row is
the boundary condition.
We use surf to draw a 3D plot of the solution. We make a graph showing a stable solution
and one graph with an unstable solution.
Stable solution
h
0.2
0.004
/h
0.1
Unstable solution
h
0.2
0.013
/h
0.325
Part D
In this part of the lab we compare the explicit method in ode23 and the implicit method in
ode23s, suitable for stiff problems, in the Matlab library. The two functions run under the
similar conditions (same problem, same tolerance) and for three values of the stepsize h
corresponding to N=10, N=20, N=40 grid points on the -axis.
The comparison comprises:
i.
ii.
iii.
Time steps
Ode23 | Ode23s
458
|
252
1477
|
298
5424
|
347
Cpu-time (sec)
Ode23 | Ode23s
0.562
| 0.807
0.754
| 1.055
1.440
| 1.610
hmax
Ode23
0.0053
0.0006
0.0004
|
|
|
|
Ode23s
0.0456
0.0456
0.0434
We conclude that the number of time steps is considerably smaller when using a stiff
method.
Part E
With the Malab function odeset , options can be set up by the user in order to make the
computation more efficient. By activating the options Jacobian, Jconstant and Jpattern,
we see that we can smooth out the graph for ode-23s and we have the following table:
N
10
20
40
Time steps
Ode23 | Ode23s
458
|
876
1477
|
2099
5424
|
6892
Cpu-time (sec)
Ode23 | Ode23s
0.562
| 0.710
0.754
| 1.019
1.440
| 2.396
hmax
Ode23
0.0053
0.0006
0.0004
|
|
|
|
Ode23s
0.0046
0.0012
0.0003
Part F
We visualize the result of a successful computation from part D in graphs.
The following graphs show two-dimensional plots of u(t,), 0<,=1 at four timepoints:
=0.5, 1, 1.5, 2.
Ode23:
Ode23s
Ode23:
Ode23s:
Appendix
clear all
close all
clc
%=========
===========
%Solution of u_t=u_xx,
MoL.
u(x,0)=0
, u(0,t)=1, u_x(1,t)=0
using the
end
for j=2:N
%creating the rest of the solution
matrix
u(j)=c*upast(j+1)-(2*c-1)*upast(j)+c*upast(j-1);
U(:,i)=u;
end
u(N+1)=u(N-1);
%setting the lower boundary condition
end
%3-D plot
surf(U)
title('solution of u_t=u_xx, u(x,0)=[1,0,....,0],
u(0,t<1)=[1,1,....,1] u(0,t=1)=0 using the MoL.')
xlabel('space variable x')
ylabel('time variable y')
zlabel('solution variable u(x,t)')
%=========
===========
%non%add
References
Introduction to computation and modeling for differential equations,
Lennart Edsberg