Problem 4' Solve the conduction heat transfer problem in a square of length 1 with the following BCs - PowerPoint PPT Presentation

1 / 13
About This Presentation
Title:

Problem 4' Solve the conduction heat transfer problem in a square of length 1 with the following BCs

Description:

Mesh size in both x and y directions. Initiation of matrix of coefficients with zero elements ... kk=kk 1; T(i,j)=tt(kk); end. end. Take the inverse of matrix ... – PowerPoint PPT presentation

Number of Views:127
Avg rating:3.0/5.0
Slides: 14
Provided by: JAL60
Category:

less

Transcript and Presenter's Notes

Title: Problem 4' Solve the conduction heat transfer problem in a square of length 1 with the following BCs


1
Advanced Topics in Heat, Momentum and Mass
Transfer
Lecturer Payman Jalali, Docent Faculty of
Technology Dept. Energy Environmental
Technology Lappeenranta University of Technology
2
Solve the conduction heat transfer problem in a
square of length 1 with the following BCs.
3
  • The heat conductive equation in
  • differential form is
  • The Finite Difference equation of this PDE can
    be written as

Central node. Its coefficient lies on the main
diameter of matrix of coefficients. A
This difference equation is valid only for
interior points and energy balance must be
written for boundaries.
4
  • Left boundary

5
  • Upper boundary

6
  • (1,1) corner

T2,1
7
  • (1,N) corner

8
Write a MATLAB code for the problem
Ninput('Number of nodes ') hinput('Convective
heat coefficient ') Tininput('Ambient
temperature') kcinput('Conductivity
') G0input('Heat generation ')
To start programming we have to write the form of
matrix of coefficients from the above-mentioned
FDEs. However, in 2D geometry, since we are
working with two indices i,j they must be
transformed into one index, k, to form the vector
of unknown values.
9
Initial value for the node counter k
k0 NNNN dx1/(N-1) Azeros(NN,NN)
Dimension of matrix of coefficients A, which is
NNxNN
Mesh size in both x and y directions.
Initiation of matrix of coefficients with zero
elements
  • Azeros(n,n) generates an n by n matrix with
    all zero elements.
  • Because in FD methods, the matrix of coefficients
    is a sparse matrix, so we use this command to
    make our matrix and then fill the nonzero
    elements during next steps.
  • k is the overall index of nodes as follows

10
  • S1 is the statement including 9 conditional
    blocks (if) and checks what is the position of
    each mesh point marked by k on the boundary,
    and then apply the corresponding FD equation.
  • S2 is the main loop of the program consists
    of two loops which sweep over all nodes in the
    domain and k counts the index of a node according
    to the direction shown in the previous page.

11
6 if (i1 j1) A(k,k1)1
A(k,kN)1 A(k,k)-2 B(k)-G0dxdx/(2kc)
5 elseif (j1 igt2 ilt(N-1))
A(k,k)-4 A(k,k1)1 A(k,k-1)1
A(k,kN)2 B(k)-G0dxdx/kc 7 elseif
(iN j1) A(k,k)-2-hdx/kc A(k,k-1)1
A(k,kN)1 B(k)-G0dxdx/(2kc)-hdxTin/kc 2
elseif (i1 jgt2 jlt(N-1))
A(k,k)-4 A(k,k1)2 A(k,k-N)1
A(k,kN)1 B(k)-G0dxdx/kc 3 elseif
(iN jgt2 jlt(N-1))
A(k,k)-(42hdx/kc) A(k,k-1)2
A(k,k-N)1 A(k,kN)1
B(k)-2hdxTin/kc-G0dxdx/kc 8 elseif
(i1 jN) A(k,k)-(2hdx/kc)
A(k,k-N)1 A(k,k1)1
B(k)-hdxTin/kc-G0dxdx/(2kc) 4 elseif
(jN igt2 ilt(N-1))
A(k,k)-(42hdx/kc) A(k,k-1)1
A(k,k1)1 A(k,k-N)2
B(k)-2hdxTin/kc-G0dxdx/kc 9 elseif
(iN jN) A(k,k)-(22hdx/kc)
A(k,k-1)1 A(k,k-N)1
B(k)-2hdxTin/kc-G0dxdx/(2kc) 1
else A(k,k)-4 A(k,k1)1
A(k,k-1)1 A(k,k-N)1 A(k,kN)1
B(k)-G0dxdx/kc end
The numbers correspond to the FDE numbers at
different nodes
12
Ainv(A) ttAB' kk0 for i1N for
j1N kkkk1 T(i,j)tt(kk)
end end
Take the inverse of matrix of coefficients
Computing unknown vector of temperature
Writing temperature vector as a matrix projected
into the square
x and y vectors of nodes in two directions
x0dx1 yx
cscontour(x,y,T,20) clabel(cs,'manual')
Plotting contours
13
Results
Number of nodes 30 Convective heat coefficient
1 Ambient temperature 300 Conductivity
0.5 Heat generation 20
h/k1/0.52
Write a Comment
User Comments (0)
About PowerShow.com