0% found this document useful (0 votes)
46 views4 pages

CFD

The document describes solving a 1D heat equation problem using finite difference methods. The problem involves heating one end of a rod at 0°C and finding the temperature distribution over time. An explicit method is used to discretize and solve the PDE numerically. Results are presented showing the temperature distribution at various times.

Uploaded by

8297859765
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views4 pages

CFD

The document describes solving a 1D heat equation problem using finite difference methods. The problem involves heating one end of a rod at 0°C and finding the temperature distribution over time. An explicit method is used to discretize and solve the PDE numerically. Results are presented showing the temperature distribution at various times.

Uploaded by

8297859765
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

ASSIGNMENT-1

1. Problem definition

A rod of length 1m is insulated at right end and has 0oC throughout the length. It is heated at
left end resulting in 1oC temperature rise on that end. Find the temperature distribution in rod
at t=0, 0.5, 1, 5, 10 sec.

2. Computational domain with boundary conditions


1. A rod of length 1 is divided into 11 grids of 0.1m length.
2. Initially, temperature of rod is 0oC throughout the rod
3. Rod was heated at one end resulting in 1oC rise in temperature at left end and other
end is insulated.
4. Numerical methodology
4.1.Governing equations

𝜕𝑇 𝜕2 𝑇
1D heat conduction equation = 𝛼 𝜕𝑥 2
𝜕𝑡

4.2.Discretization

Finite difference discretization method with Forward in Time and Central in Space
scheme.

𝑇𝑖𝑛+1 − 𝑇𝑖𝑛 𝑛
𝑇𝑖+1 − 𝑇𝑖𝑛 + 𝑇𝑖−1
𝑛
=𝛼
∆𝑡 (∆𝑥)2

𝑇𝑖𝑛+1 = 𝛾𝑇𝑖+1
𝑛
+ (1 − 2𝛾)𝑇𝑖𝑛 + 𝛾𝑇𝑖−1
𝑛

∆𝑡
Where 𝛾 = 𝛼 (∆𝑥)2
4.3.Flow chart or pseudo code

Input (L, t, α, dt, dx)


)

Initial conditions

Assemble matrix with


boundary condition

Solve system of
equations

T[i] = T1[i]

Print results

5. Results
Fig.1. solution of 1D heat equation at (a)dt = 0.1 sec, (b) dt = 0.01 sec, which is numerically
unstable

Fig.2. solution of 1D heat equation at dt = 0.001 sec, which is stable (a) Temperature
distribution at (a) t=0, 0.5, 1 sec, (b) t = 5, 10 sec

6. Appendix (code)

Oe18d019_oe19s019.m
clear variables
close all
N = 11;
Lx = 1;
dx = Lx/(N-1);
x = 0:dx:Lx;
alpha=1;
tf = 10;
dt = 0.001;
t = 0:dt:tf;
M = round(tf/dt);
gamma = alpha*dt/dx^2; % To insure stability gamma = dt/dx^2 < = 1/2
u = zeros(N,M);
u(:,1) = 0; % initial cond. f(x)
u(1,:) = 1; % boundary conditions
u(N,:) = 0; % boundary conditions
for j= 1:M-1 % Time Loop
for i= 2:N-1 % Space Loop
u(i,j+1) = gamma*(u(i-1,j))+(1-2*gamma)*u(i,j) + gamma*u(i+1,j);
end
end
figure(1)
plot(x,u(1:end,1),'-',x,u(1:end,500),'-',x,u(1:end,1000),'-',
'linewidth',2)
a = ylabel('Temperature');
set(a,'Fontsize',14);
a = xlabel('x');
set(a,'Fontsize',14);
a=title(['Using The Explicit Method - dt =' num2str(dt)]);
legend('Explicit soln')
legend('t=0s','t=0.5s','t=1.0s')
set(a,'Fontsize',16);
xlim([0 1]);
figure(3)
plot(x,u(1:end,5000),'-',x,u(1:end,10000),'-', 'linewidth',2)
a = ylabel('Temperature');
set(a,'Fontsize',14);
a = xlabel('x');
set(a,'Fontsize',14);
a=title(['Using The Explicit Method - dt =' num2str(dt)]);
legend('t=5s','t=10s')
plot(x,u(1:end,10000),'-', 'linewidth',2)
legend('t=10.0s')

You might also like