AM5360
ASSIGNMENT 2UNSTEADY HEAT CONDUCTION : BTCS SCHEME Problem DefinitionA bar of length 1 is heated such that on end of bar has temperature of 1 unit and other end 0 units. Initially , at t=0 the entire bar has temperature 0 units.
The Governing PDE is :
Considering alpha =1unit
Unsteady Heat Conduction is an example for parabolic PDE. It is an Initial Boundary Value problem,which needs an initial state as well as boundary conditions for all time.
Initial ConditionAt t=0: T=0 for 0= x = 1 T(x=0)=1 T(x=1)=0
1 AM5360 NA13B040
Boundary Condition :T(x=0,t)=1 T(x=1,t) =0 ?t>0
DiscretisationBTCS (Backward-Time-Centered-Space) scheme in which a first-order approximation is used for the time derivative, but a second order one for the spatial one. Using the a finite-difference notation, the BTCS scheme is then expressed as
The discretization error is 1st order in time and second order in space
A von Neumann stability analysis shows that BTCS Scheme is unconditionally stable
.BTCS is an implicit scheme
2 AM5360 NA13B040
3 AM5360 NA13B040
Where a | = c =- a | * | t/(?x)2 | b | = 2a | * | t/(?x)2 | + 1 |
i | i | i |
where matrix Ais a tridiagonal matrix. Thomas algorithm is the Gaussian elimination algorithm
tailored to solve this type of sparse system.
4 AM5360 NA13B040
Total no of multiplications and divisions in Thomas algorithm is 5n-8 which is significantly smaller than the
n3/3 operations (approximately) necessary for carrying out the Gaussian elimination and backward sweep for a dense matrix.
Thomas algoritm is a direct method for solving system of linear eqns.
5 AM5360 NA13B040
6 AM5360 NA13B040
Results - t =0.1 s ,
time _implicit |
Nx | (in s) | ??t/( x)^2 |
11 | XXXXXXXXXX | 10 |
21 | XXXXXXXXXX | 40 |
31 | XXXXXXXXXX | 90 |
41 | XXXXXXXXXX | 160 |
51 | XXXXXXXXXX | 250 |
101 | XXXXXXXXXX | 1000 |
We can observe that increasring no of nodes produces only very small increase in computationial time . The computational Time is of order of 10 ms, in this case
- t =0.01 s ,
7 AM5360 NA13B040
Nx | time _implicit (in s) | ??t/( x)^2 |
11 | XXXXXXXXXX | 1 |
21 | XXXXXXXXXX | 4 |
31 | XXXXXXXXXX | 9 |
41 | XXXXXXXXXX | 16 |
51 | XXXXXXXXXX | 25 |
101 | XXXXXXXXXX | 100 |
The computational Time is of order of 100 ms , in this case 3 . t =0.01 s ,
time _implicit (BTCS) | time _explicit (FTCS) |
Nx | (in s) | (in s) | ??t/( x)^2 |
8
AM5360 | NA13B040 |
11 | XXXXXXXXXX | 0.7443 | 0.1 |
21 | XXXXXXXXXX | XXXXXXXXXX | 0.4 |
31 | 0.9047 | unstable | 0.9 |
41 | XXXXXXXXXX | unstable | 1.6 |
51 | XXXXXXXXXX | unstable | 2.5 |
101 | XXXXXXXXXX | unstable | 10 |
FTCS Scheme is observed to be unstable for ??t/( x)^2 = 0.9, 1.6,2.5,10 as expected from Von Neumann Stability analysis .whereas BTCS schme yield a stable solution for all values of ??t/( x)^2 , prooving, it is unconditionally stable.
FTCS computational time is almost 10 time grater than that of BTCS scheme for Nx=21,
9 AM5360 NA13B040
4. Computational Time decreases according to a power law with delta t
Computational Time (for BTCS)= XXXXXXXXXX * t^ XXXXXXXXXX 10 AM5360 NA13B040
Appendix : Matlab Code - AM5360 Assignment 2 : Na13b040
- This code can be used to solve the temperature profile upto t=20 s, using both FTCS and BTCS Scheme %The Computational Time upto t=20s is calcuated
dt=input('Enter? dt:');?
Nx=input('Enter? Nx ,the no of gridpoints : ');?
k=input('Enter? 1 for implicit (BTCS),else 0 for explicit(FTCS)scheme : ');?
alpha=1;
L=1;
dx=L/(Nx-1);
gamma=alpha*dt/(dx)^2
11 AM5360 NA13B040
if?k==1
%implicit method (BTCS Scheme) tic
t=0;
T_old=zeros(Nx,1); %Initial? Condition while?t
t=t+dt; T_new=zeros(Nx,1); %Boundary Conditions T_new(1)=1; T_new(Nx)=0;
% setting TDM : a_n *T_n+1+ b_n * T_n+1 + c_n * T_n+1 = d_n a=-1*gamma*ones(1,Nx-3);
c=a;
b=(1+2*gamma)*ones(1,Nx-2); %? dominant diagonal d=T_old(2:Nx-1);
d(1)=d(1)+gamma*T_new(1); d(Nx-2)=d(Nx-2)+gamma*T_new(Nx);
%Solving the TDM using Thomas Algorithm :
% Triangulation : Forward sweep with Normalization c(1)=c(1)/b(1);
d(1)=d(1)/b(1); for?i=2:Nx-3
c(i)=c(i)/(b(i)-a(i-1)*c(i-1));
12 AM5360 NA13B040
end for?i=2:Nx-2
d(i)=(d(i)-a(i-1)*d(i-1))/(b(i)-a(i-1)*c(i-1));
end
% Backward Sweep T_new(Nx-1)=d(Nx-2); for?i=Nx-3:-1:1
T_new(i+1)=d(i)-c(i)*T_new(i+2);
end T_old=T_new;
end
toc
else
%Explicit method FTCS tic
t=0;
T_old=zeros(Nx,1); %Initial? Condition while?t
t=t+dt; T_new=zeros(Nx,1); %Boundary Condition T_new(Nx)= 0; T_new(1) = 1;
% Time Marching for?i= 2:Nx-1
T_new(i)= (1-2*gamma)*T_old(i)+gamma*(T_old(i-1)+T_old(i+1));
13 AM5360 NA13B040
end
T_old=T_new;
end
toc
end
Published with MATLAB® R2014aReferences - http://nptel.ac.in/courses/ XXXXXXXXXX/downloads/sections/module4/section4.pdf
14