0% found this document useful (0 votes)
7 views9 pages

Term Paper

Uploaded by

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

Term Paper

Uploaded by

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

Analytical and Numerical Solution of Heat

Conduction in 2 Dimensional Slab

May 8, 2025

Figure 1: Problem geometry and boundary conditions

Solving I
∂ 2T ∂ 2T
+ =0
∂x2 ∂y 2

1
Using separation of variables, let T = f (x)g(y):

1 d2 f 1 d2 g
= − = −λ2 (due to periodicity in x)
f dx2 g dy 2

f (x) = c1 sin λx + c2 cos λx


g(x) = c3 e−λy + c4 eλy
Boundary conditions:

1. x = 0, y, T = 0
f (0) = 0 =⇒ c2 = 0

2. x = L, y, T = 0

f (L) = 0 =⇒ c1 sin λL = 0 =⇒ λn = , n = 1, 2, . . .
L

3. y = 0, x, T = 0

g(0) = 0 =⇒ c3 + c4 = 0 =⇒ c4 = −c3

g(y) = c3 (e−λy − eλy ) = 2c3 sinh(λy)

nπx nπy
T = c1 sin · 2c3 sinh
L L

X  nπx   nπy 
T = An sin sinh
n=1
L L
Boundary: y = w, θ = h(x):

X  nπw   nπx 
h(x) = An sinh sin
n=1
L L

Now using orthogonality to solve


 for An :
mπx
Multiply both sides by sin L and integrate:
Z L  mπx  ∞
X  nπw  Z L  nπx   mπx 
h(x) sin dx = An sinh sin sin dx
0 L n=1
L 0 L L

2
Let Z L  mπx 
Im = h(x) sin dx
0 L

X  nπw  L
Im = An sinh δmn
n=1
L 2

X  nπw 
2Im /L = An sinh δmn
n=1
L
 mπw 
2Im /L = Am sinh
L
2Im
Am =
L sinh mπw

L
Final solution for I:

2X In  nπx   nπy 
T1 = sin sinh
L n=1 sinh nπw

L
L L

3
Solving II
∂ 2T ∂ 2T
+ = Sc
∂x2 ∂y 2

• all boundaries have homogeneous boundary condition

• only non-homogeneity in governing equation

Taking a guess for T :


XX  nπx   mπy 
T = Anm sin sin
n m
L w

 
X nπ 2  mπ 2  nπx   mπy 
⇒ − + Anm sin sin = Sc
n,m
L w L w

jπx kπy
 
Multiply both sides by sin L
sin w
and integrate:

X  nπ 2  mπ 2  Z L  nπx    Z w  
jπx  mπy  kπy
− + Anm sin sin dx sin sin dy
n,m
L w 0 L L 0 w w
Z L   Z w  
jπx kπy
= Sc sin dx sin dy
0 L 0 w

X  nπ 2  mπ 2  Lw (1 − (−1)j ) (1 − (−1)k )
− + Anm δnj δmk = ScLw
n,m
L w 4 jπ kπ

" 2 2 #
(1 − (−1)j )(1 − (−1)k )

jπ kπ Lw
+ Ajk = −ScLw
L w 4 jkπ 2

4Sc (1 − (−1)j )(1 − (−1)k )


Ajk = − h 2 2 i
π 2 jk jπ
+ kπ L w

4
X 4Sc (1 − (−1)m )(1 − (−1)n )  nπx   mπy 
T2 = − h i sin sin
n,m
π 2 mn nπ 2

+ mπ
2 L w
L w

Final solution:
T = T1 + T2


2X In  nπx   nπy 
T =  sin sinh
L n=1 sinh nπw L
L L
X 4Sc (1 − (−1)m )(1 − (−1)n )  nπx   mπy 
− h i sin sin (1)
n,m
π 2 mn nπ 2

+ mπ 2 L w
L w

5
Numerical Solution Strategy
The code numerically solves the 2D Poisson equation:

∂2T ∂2T
+ = Sc
∂x2 ∂y 2
on a rectangular domain with Dirichlet boundary conditions.

Discretization
The domain is divided into a uniform grid with spacing h in both x and y
directions. The Laplacian is approximated using central differences:
Ti+1,j − 2Ti,j + Ti−1,j Ti,j+1 − 2Ti,j + Ti,j−1
+ = Sc
h2 h2
Rearranged for Ti,j :

1
Ti+1,j + Ti−1,j + Ti,j+1 + Ti,j−1 − h2 Sc

Ti,j =
4

Iterative Jacobi Method


An initial guess for T is made (usually zeros except for boundaries). The update
rule is applied to all interior points:

(k+1) 1  (k) (k) (k) (k)



Ti,j = Ti+1,j + Ti−1,j + Ti,j+1 + Ti,j−1 − h2 Sc
4
Boundary values are held fixed throughout the iterations.

Convergence
Iterations continue until the change between successive iterations is below a set
tolerance ϵ:
∥T (k+1) − T (k) ∥2 < ϵ

1
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

# Domain parameters
L, W = 1.0, 1.0
Sc = 1.0
Nx, Ny = 50, 50
dx, dy = L/(Nx-1), W/(Ny-1)

# Initialize solution grid


T = np.zeros((Nx, Ny))

# Boundary conditions
x = np.linspace(0, L, Nx)
T[:, -1] = np.sin(np.pi * x/L) # Top boundary (y=W)

# Jacobi iteration parameters


max_iter = 10000
tolerance = 1e-5
residuals = []

for k in range(max_iter):
T_new = T.copy()
for i in range(1, Nx-1):
for j in range(1, Ny-1):
T_new[i,j] = (T[i+1,j] + T[i-1,j] + T[i,j+1] + T[i,j-1] +
Sc*dx**2)/4

residual = np.linalg.norm(T_new - T)
residuals.append(residual)
T = T_new

if residual < tolerance:


break

# Plotting
X, Y = np.meshgrid(np.linspace(0, L, Nx), np.linspace(0, W, Ny))

plt.figure(figsize=(12, 5))

# 3D Surface Plot
ax1 = plt.subplot(121, projection='3d')
ax1.plot_surface(X, Y, T.T, cmap='viridis')
ax1.set_title('Temperature Distribution')
ax1.set_xlabel('X')
ax1.set_ylabel('Y')

# 2D Heatmap
plt.subplot(122)
plt.imshow(T.T, extent=[0, L, 0, W], origin='lower', cmap='hot')
plt.colorbar(label='Temperature')
plt.title('2D Heatmap')
plt.xlabel('X')
plt.ylabel('Y')

plt.tight_layout()

# Convergence Plot
plt.figure()
plt.semilogy(residuals)
plt.title('Convergence History')
plt.xlabel('Iteration')
plt.ylabel('Residual')
plt.grid(True)

plt.show()

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy