komputasi sistem fisis 5

6
8/19/2019 Komputasi Sistem Fisis 5 http://slidepdf.com/reader/full/komputasi-sistem-fisis-5 1/6 1 Homework 5 Name : Nadya Amalia Student ID : 20213042 Subject : Computation of Physical Systems (FI5005) Lecturer : Dr.rer.nat. Linus Ampang Pasasa SOLVING LAPLACE’S EQUATION USING LIEBMANN’S METHOD Consider a rectangle conductor plate is divided into 5×5 grids with the following boundary conditions. ߣ = 1.2 and ߝ   =  1%. ( = 0.49   / ݏ . . ) Solution The Laplace’s equation for 2D heat distribution: 2  ( ݔ , ݕ ) ݔ 2  + 2  ( ݔ , ݕ ) ݕ 2  = 0  1, 2 , + +1, (ݔ ) 2  +  , 1 2 , +  , +1 (ݕ ) 2  = 0 The Laplace’s molecule distribution: If  ∆ ݔ = ∆ ݕ then 1, + , 1  + , +1  + +1, 4 , = 0 For point (1,1):  0,1  + 1,0  + 1,2  + 2,1 4 1,1  =  0 25 + 0 + 1,2  + 2,1 4 1,1  =  0 4 , + , + 2, = 25 T1,0  T2,0  T3,0 T1,1  T2,1  T3,1 T1,1  T4,1 T1,1  T2,2  T3,2 T1,2  T4,2 T1,3  T2,3  T3,3 T1,3  T4,3 T1,4  T2,4  T3,4 150  o C 0  o C 50  o C 25  o C i-1 i i+1 j-1 j+1 j

Upload: nadya-amalia

Post on 08-Jul-2018

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Komputasi Sistem Fisis 5

8/19/2019 Komputasi Sistem Fisis 5

http://slidepdf.com/reader/full/komputasi-sistem-fisis-5 1/6

1

Homework 5

Name : Nadya Amalia

Student ID : 20213042

Subject : Computation of Physical Systems (FI5005)

Lecturer : Dr.rer.nat. Linus Ampang Pasasa

SOLVING LAPLACE’SEQUATIONUSINGLIEBMANN’S METHOD

Consider a rectangle conductor plate is divided into 5×5 grids with the following boundary

conditions.

ߣ = 1.2 and ߝ௫ =  1%. ( = 0.49  .ݏ/ . ℃)

Solution

The Laplace’s equation for 2D heat distribution:

((ݕ,ݔ

ݔ

2  +

((ݕ,ݔ

ݕ

2  = 0

 

−1, − 2  , +  +1,

(∆ݔ

)2  +

  , −1 − 2  , +   , +1

(∆ݕ

)2  = 0

The Laplace’s molecule distribution:

If  ∆ݔ = ∆ݕ then 

−1, +  , −1 +

  , +1 +  +1, − 4

  , = 0

For point (1,1):

 0,1 +  1,0 +

  1,2 +  2,1 − 4

 1,1 =  0

25 + 0 +  1,2 +  2,1 − 4 1,1 =  0

−4 ଵ,ଵ +

 ଵ,ଶ +  2,ଵ = −25

T1,0   T2,0   T3,0

T1,1   T2,1   T3,1T1,1   T4,1

T1,1   T2,2   T3,2T1,2   T4,2

T1,3   T2,3   T3,3T1,3   T4,3

T1,4   T2,4   T3,4

150  oC

0  oC

50  oC25  oC

i-1 i i+1

j-1

j+1

j

Page 2: Komputasi Sistem Fisis 5

8/19/2019 Komputasi Sistem Fisis 5

http://slidepdf.com/reader/full/komputasi-sistem-fisis-5 2/6

2

For point (1,2):

 0,2 +  1,1 +  1,3 +  2,2 − 4 1,2 =  0

25 +  1,1 +  1,3 +  2,2 − 4 1,2 =  0

 1,1 − 4 1,2 +

  1,3 +  2,2 = −25

For point (1,3):

 0,3 +  1,2 +  1,4 +  2,3 − 4 1,3 =  0

25 +  1,2 + 150 +

  2,3 − 4 1,3 =  0

 1,2 − 4 1,3 +  2,3 = −175

For point (2,1):

 1,1 +  2,0 +

  2,2 +  3,1 − 4

 2,1 =  0

 1,1 + 0 +  2,2 +  3,1 − 4 2,1 =  0

 

1,1−

4 2,1 +  2,2 +  3,1 =  0

For point (2,2):

 1,2 +  2,1 +  2,3 +  3,2 − 4 2,2 =  0

 1,2 +  2,1 − 4 2,2 +  2,3 +  3,2 =  0

For point (2,3):

 1,3 +  2,2 +  2,4 +  3,3 − 4 2,3 =  0

 1,3 +  2,2 + 150 +  3,3 − 4 2,3 =  0

 1,3 +  2,2 − 4

 2,3 +  3,3 = −150

For point (3,1):

 2,1 +  3,0 +  3,2 +  4,1 − 4 3,1 =  0

 2,1 + 0 +  3,2 + 50 − 4

 3,1 =  0

 2,1 − 4 3,1 +  3,2 = −50

For point (3,2):

 2,2 +  3,1 +

  3,3 +  4,2 − 4

 3,2 =  0

 2,2 +  3,1 +  3,3 + 50 − 4 3,2 =  0

 

2,2 +  3,1−

4 3,2 +  3,3 =−

50

For point (3,3):

 2,3 +  3,2 +  3,4 +  4,3 − 4 3,3 =  0

 2,3 +  3,2 − 4 3,3 = −200

Thus, we obtain the following system of the equations:

−4 1 0 1 0 0 0 0 0

1   − 4 1 0 1 0 0 0 00 1   − 4 0 0 1 0 0 0

1 0 0   − 4 1 0 1 0 00 1 0 1   − 4 1 0 1 0

0 0 1 0 1   − 4 0 0 10 0 0 1 0 0   − 4 1 0

0 0 0 1 0 0 1   − 4 1

0 0 0 0 0 1 0 1   − 4

 ଵ,ଵ 1,ଶ ଵ,ଷ ଶ,ଵ ଶ,ଶ ଶ,ଷ 3,ଵ 3,ଶ ଷ,ଷ

=

⎡−25

−25

−175

00

−150

−50

−50

−200

After  , is obtained, the overrelaxation step is applied to improve convergence. ߣ = 1.2 is used

 ,௪ = ߣ ,௪ + (1 − ߣ

) ,ௗ

with maximum tolerance ߝ

௫ =  1%, where

, = ቤ ,௪ߝ −  ,ௗ ,ௗ

  ቤ× 100%

The distributed temperature  , will keep being updated as long as ߝ, is greater than or ߝ௫.

Heat flux:

= ௫ݍ −  ݔ

≈ −  ାଵ, −  ଵ,

ݔ∆2

= ௬ݍ −  ݕ

≈ −  ,ାଵ −  ,ଵ

ݕ∆2

with = 0.49  /ݏ

. . ℃

Page 3: Komputasi Sistem Fisis 5

8/19/2019 Komputasi Sistem Fisis 5

http://slidepdf.com/reader/full/komputasi-sistem-fisis-5 3/6

3

Resultant flux and the direction:

௬ଶݍ + ௫ଶݍ  = ටݍ

ߠ ݐ = ଵ

௬ݍ௫൰ݍ

  ݍ

௫ > 0

ߠ ݐ = ଵ ൬ݍ௬ߨ +௫൰ݍ ௬ > 0ݍ

with ߠ in radians.

MATLAB Source Code

% Solving Laplace's equation using Liebmann's method% 2D Heat Distribution in Metal Sheet

clc, clear   all;% Author: Nadya Amalia (20213042)% Department of Physics% Bandung Institute of Technology, Bandung

bottom = 0.0;   % deg C - bottom edge boundary valueleft = 25.0;   % deg C - left edge boundary valuetop = 150.0;   % deg C - top edge boundary valueright = 50.0;   % deg C - right edge boundary valuelambda = 1.2;   % relaxation value in Liebmann's methodk = 0.49;   % Cal/cm.?)

% Define meshnx = 5.0;   % number of grid points in the x-directionny = 5.0;   % number of grid points in the y-directionnx_int = nx-1;   % number of intervals in the x-direction

ny_int = ny-1;   % number of intervals in the y-direction

% Calculate intervalsxo = 0.0;xf = 1.0;yo = 0.0;yf = 1.0;dx = (xf - xo)/nx_int;   % cm - grid spacing in x-directiondy = (yf - yo)/ny_int;   % cm - grid spacing in x-directionxgrid = [xo:dx:xf];ygrid = [yo:dy:yf];

% Initialize T and ToldT = zeros(nx,ny);

Told = zeros(nx,ny);

% Boundary Conditionsfor   i = 1:nx

% boundary condition for x = x0 (i = 0)Told(1,i) = left;% boundary condition for x = xf (i = 4)Told(nx,i) = right;% boundary condition for x = x0 (i = 0)Told(i,1) = bottom;% boundary condition for y = yf (i = 4)Told(i,ny) = top;

end

% Set initial guess at the interior nodes of Toldfor   i = 2:nx_int

for   j = 2:ny_int

Page 4: Komputasi Sistem Fisis 5

8/19/2019 Komputasi Sistem Fisis 5

http://slidepdf.com/reader/full/komputasi-sistem-fisis-5 4/6

4

% Told(i,j) = 0.0Told(i,j) = (left + right + bottom + top) / 4.0;

endend

fprintf('2D Heat Distribution (Liebmanns method)\n');fprintf('==================================================================\n\

n');fprintf('Boundary and initial conditions');T = Told;Temperatures = rot90(T)

% Tolerance and maximum number of Liebmann's iterationsitermax = 200.0;   % maximum number of iterationstol = 1.0 ;   % the absolute tolerance to check for convergance, 1%fprintf('Maximum iteration = %4.0d\n', itermax);fprintf('Maximum error tolerance in percent = %7.4f\n', tol);% Iteration loopfor   iter = 1:itermax

Told = T;   % store values from previous iterationfor   i = 2:(nx-1)

for   j = 2:(ny-1)% Apply Liebmann's methodT(i,j) = (T(i+1,j) + T(i-1,j) + T(i,j+1) + T(i,j-1)) / 4.0;T(i,j) = lambda*T(i,j) + (1-lambda)*Told(i,j);

endend% Check for convergence using tolerancefor   i = 2:(nx-1)

for   j = 2:(ny-1)err = (max(max(abs(T - Told))))*100;

endendfprintf('\nIteration = %4.0f, \t Error in percent = %4.4f', iter, err)

if   err < tolbreakend

end

% Print out results to screenfprintf('\n\nNumber of iterations = %2.0f\n\n',iter)temp = fliplr(T);disp('Temperatures in sheet in deg C = ')for   j = 1:ny

fprintf('%10.4f',temp(:,j))fprintf('\n')

end

% Calculate temperature gradientsdTdx = zeros(nx,ny);   % deg C/cm - temperature gradient in x-directiondTdy = zeros(nx,ny);   % deg C/cm - temperature gradient in y-direction

for   j = 2:ny-1   % middle rows and columnsfor   i = 2:nx-1

dTdx(i,j) = (T(i+1,j) - T(i-1,j)) / (2*dx);dTdy(i,j) = (T(i,j+1) - T(i,j-1)) / (2*dy);

endend

for   i = 2:nx-1   % bottom and top rowsdTdx(i,1) = ( T(i+1,1) - T(i-1,1)) / (2*dx);dTdx(i,ny) = ( T(i+1,ny) - T(i-1,ny)) / (2*dx);

dTdy(i,1) = (-3*T(i,1) + 4*T(i,2) - T(i,3)) / (2*dy);dTdy(i,ny) = ( 3*T(i,ny) - 4*T(i,ny-1) + T(i,ny-2)) / (2*dy);

Page 5: Komputasi Sistem Fisis 5

8/19/2019 Komputasi Sistem Fisis 5

http://slidepdf.com/reader/full/komputasi-sistem-fisis-5 5/6

5

end

for   j = 2:ny-1   % left and right sidesdTdx(1,j) = (-3*T(1,j) + 4*T(2,j) - T(3,j)) / (2*dx);dTdx(nx,j) = ( 3*T(nx,j) - 4*T(nx-1,j) + T(nx-2,j)) / (2*dx);

dTdy(1,j) = ( T(1,j+1) - T(1,j-1)) / (2*dy);

dTdy(nx,j) = ( T(nx,j+1) - T(nx,j-1)) / (2*dy);end

% Corner nodesdTdx(1,1) = (-3*T(1,1) + 4*T(2,1) - T(3,1)) / (2*dx);dTdy(1,1) = (-3*T(1,1) + 4*T(1,2) - T(1,3)) / (2*dy);

dTdx(1,ny) = (-3*T(1,ny) + 4*T(2,ny) - T(3,ny)) / (2*dx);dTdy(1,ny) = ( 3*T(1,ny) - 4*T(1,ny-1) + T(1,ny-2)) / (2*dy);

dTdx(nx,1) = ( 3*T(nx,1) - 4*T(nx-1,1) + T(nx-2,1)) / (2*dx);dTdy(nx,1) = (-3*T(nx,1) + 4*T(nx,2) - T(nx,3)) / (2*dy);

dTdx(nx,ny) = ( 3*T(nx,ny) - 4*T(nx,ny-1) + T(nx,ny-2)) / (2*dx);dTdy(nx,ny) = ( 3*T(nx,ny) - 4*T(nx-1,ny) + T(nx-2,ny)) /(2*dy);

% Calculate heat fluxesqflux_x = -k*dTdx;   % Cal/cm^2 - heat flux in x-directionqflux_y = -k*dTdy;   % Cal/cm^2 - heat flux in y-directionqflux = sqrt(qflux_x.^2 + qflux_y.^2);   % Cal/cm^2 - heat flux magnitude

% Display results to screenfprintf('\n')disp('Heat flux in sheet in kCal/cm^2 = ')for   j=ny:-1:1

fprintf('%10.4f', qflux(:,j)*1e-3)fprintf('\n')end

% Contour plot showing isotherms in the sheetv = top:(bottom-top)/22:bottom;   % deg C - magnitudes for contourscolormap(jet)   % set color scheme for contour plotcontourf(xgrid, ygrid, T', v);   % contour plot of T versus (x, y)colorbar   % add colorbar to contour plotcaxis([bottom top]);   % set colorbar to range from top tobottomaxis   equal tight   % make axis to scaletitle('Temperature (deg C)')xlabel('x')

ylabel('y')

% Vector plot showning heat flux vectors

hold   onquiver(xgrid, ygrid, qflux_x, qflux_y,2)   % vector plot of heat fluxhold   off

Computation Results

2D Heat Distribution (Liebmanns method)==================================================================

Boundary and initial conditionsTemperatures =

Page 6: Komputasi Sistem Fisis 5

8/19/2019 Komputasi Sistem Fisis 5

http://slidepdf.com/reader/full/komputasi-sistem-fisis-5 6/6

6

25.0000 150.0000 150.0000 150.0000 150.000025.0000 56.2500 56.2500 56.2500 50.000025.0000 56.2500 56.2500 56.2500 50.000025.0000 56.2500 56.2500 56.2500 50.0000

0 0 0 0 0

Maximum iteration = 200

Maximum error tolerance in percent = 1.0000

Iteration = 1, Error in percent = 3072.3000Iteration = 2, Error in percent = 1290.9750Iteration = 3, Error in percent = 657.2160Iteration = 4, Error in percent = 346.6755Iteration = 5, Error in percent = 141.9222Iteration = 6, Error in percent = 11.0987Iteration = 7, Error in percent = 3.2435Iteration = 8, Error in percent = 0.3362

Number of iterations = 8

Temperatures in sheet in deg C =25.0000 150.0000 150.0000 150.0000 150.000025.0000 78.5717 93.0805 87.5000 50.000025.0000 46.2062 56.2504 56.9198 50.000025.0000 25.0015 28.7954 33.9287 50.0000

0.0000 0.0000 0.0000 0.0000 0.0000

Heat flux in sheet in kCal/cm^2 =0.3675 0.2163 0.1312 0.1538 0.29400.1433 0.1216 0.0923 0.1005 0.14350.0525 0.0608 0.0639 0.0529 0.02100.0248 0.0454 0.0558 0.0595 0.06470.0735 0.0527 0.0578 0.0772 0.1470

>>

Figure 1. 2D heat distribution in metal sheet 

x

      y

Temperature (deg C)

0 0.2 0.4 0.6 0.8 10

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

0

50

100

150