FINAL PROJECT Numerical Analysis for Engineering

advertisement
FINAL PROJECT
Numerical Analysis for Engineering
STEADY STATE HEAT CONDUCTION IN A SQUARE
FLAT PLATE WITH THREE EDGES AT A FIXED
TEMPERATURE
AND FOURTH EDGE LOOSING HEAT OVER
NATURAL CONVECTION INTO THE AIR.
Lasic Ismar
mailto:lasicis@ifc.utc.com
March, 31st 2001
TABLE OF CONTENTS
List of Symbols………………………………………………………………………….. Page 1
Abstract……………………………………………………………...……….…………… Page 2
Background……………………………………………………………..………….…….. Page 3
Introduction and Problem Description………………………………………………. Page 4
Theory and Numerical Approach
Exact Solution by Separation of Variables ………………………………………...…….... Page 6
Numerical Solution of the Convection Problem………………………………...…….…… Page 7
Results and Discussion
Exact Solution by Separation of Variables vs. Numerical Interpretation………...…….… Page 11
Numerical Solution of the Convection Problem…………………………….……………. Page 13
Summary………………………………………………………………….……….…….. Page 16
References…………………………………………………………..………….……….. Page 17
Appendix
A. FORTRAN Code using Gauss-Seidel for Exact Solution 5 x 5 mesh …....….……… Page 18
B. FORTRAN Code using Gauss-Seidel for Exact Solution 9 x 9 mesh …...…..……… Page 19
B – 1. Output of the FORTRAN Code using 9 x 9 mesh ...…………………...………… Page 20
C. FORTRAN Code using Gauss-Seidel for Exact Solution 17 x 17 mesh …….……… Page 21
C – 1. Output for the FORTRAN Code using 17 x 17 mesh ……..….…….…………… Page 22
D. FORTRAN Code for Convection Problem with 5 x 5 mesh …………….………...… Page 23
E. FORTRAN Code for Convection Problem with 9 x 9 mesh …………….………...… Page 24
E – 1. Output of the FORTRAN Code for Convection with 9 x 9 mesh ……………....… Page 25
F. FORTRAN Code for Convection Problem with 17 x 17 mesh ……………….…...… Page 26
F - 1. Output of the FORTRAN Code for Convection with 17 x 17 mesh ……….…...… Page 27
G. Obtained Exact Solution utilizing Series in Figure 6. and its Convergence .….…...… Page 28
- Page 1 -
LIST OF SYMBOLS
1. k [W/m*K] ............................................................................... Thermal conductivity
2. h [W/(m2*K)] ......................................................................... Convection coefficient
3.  X [m]........................................................................................... Length of the node
4.  Y [m]............................................................................................ Width of the node
5. L .............................................................................. Length of the plate (x dimension)
6. W .............................................................................. Width of the plate (y dimension)
7. x ................................................................. Distance from the origin in the x direction
8. y ................................................................. Distance from the origin in the y direction
9. 2 ....................................................................................... Separation constant
10. T[K]................................................................... Temperature of the Environment
11. Ts[K]............................................................ Constant Temperature along the Edge
12. Tm, n [K]............................................................ Temperature of the designated node
13. qi (i = 1,2,3...)[W/m]....................................... Heat transferred into node of interest
14. qconv (i = 1,2,3...)[W/m].............. Convection Heat transferred into node of interest
- Page 2 -
ABSTRACT
The purpose of this project is to solve numerically the two dimensional temperature distributions
over the flat plate with the constant temperatures on three edges while having the fourth edge
exposed to free convection. Exact solution for a simpler case is found analytically establishing
the base line. FORTRAN Code implementing Gauss-Seidel iterative algorithm called
“GAUSS_EXACT” serves as a model of the simpler problem.
“GAUSS_EXACT” is compared to the exact solution using different mesh sizes.
Upon the validation of the FORTRAN Code harder problem involving convection was
approached utilizing finite-difference form of the Heat Diffusion Equation in order to determine
temperature distribution numerically. Nodal equations are derived using energy balance in form
of finite difference equations. Gauss-Seidel iterative algorithm incorporated in FORTRAN Code
is utilized in order to solve for the temperature distribution at all nodes of interest.
The results will then be compared to published results from: "Fundamentals of Heat Transfer"
by Incropera & DeWitt P.156 -- Cole Library QC 320.145
- Page 3 -
BACKGROUND
The fact that the heat equation is an evolution equation simplifies how the solution to the heat
conduction problem can be obtained numerically. To solve the heat conduction problem
completely requires the determination of the temperature at all points of the plate in both
dimensions x and y. That would be an infinity of points and unknowns, something a computer
cannot deal with. To make the number of unknowns finite, the points at which to find the
temperature can be artificially restricted to a finite set by only including a mesh, or grid, of
discrete points as shown in Figure 1 below. Using a mesh, solving the heat conduction problem
reduces finding the temperature values at a finite number of points.
When a finer mesh, with more mesh points, is used, the accuracy will be higher, but so will the
computational effort. Dependent on its triviality, the temperature distribution in a flat plate can
also be solved analytically.
FIGURE 1. Nodal Network for 2-Dimensional problem involving a flat plate
Once the nodal network has been established like in Figure 1. above and an appropriate finite
difference equation has been written for each of the nodes based on the boundary conditions and
energy balance at each node, the temperature distribution may be determined.
- Page 4 -
INTRODUCTION AND PROBLEM DESCRIPTION
A large industrial furnace is supported on a long column of fire clay brick (k = 1 W/m*K), which
is 1m x 1m on a side. During steady-state operation, installation is such that three surfaces of the
column are maintained at 500 K while the remaining surface is exposed to an air stream for
which: T = 300 K and h = 10 W/(m2*K).
Using the Gauss-Seidel iterative method and given the grid of X = Y = 0.25 m, determine the
two-dimensional temperature distribution in the column. We are not to forget that this is a steady
state event (no energy stored), two-dimensional conduction with constant properties of the media
and with no internal heat generation. Figure two below shows the grid that has 12 nodal points at
which the temperature is unknown. Since the left and right edge in the respect to symmetry axis
are at the same temperature as we can see in Figure 2. below, it is safe to assume that there will
only be 8 unknown temperatures. Temperatures of the nodal points to the right of the symmetry
axis will be equal to the temperatures to the left of the axis.
FIGURE 2. Presentation of the Convection Problem
Before we examine this type of problem let us establish a base line for the concept of
2-Dimensional heat transfer by finding the exact solution for much simpler case analytically.
Then we can implement FORTRAN code to interpret the exact solution and make comparison.
This will also validate our FORTRAN code if it were implemented to solve the problem
presented in this project.
- Page 5 If we refer to the Heat diffusion equation below:
Than to simplify we introduce the transformation Figure 3. below:
Let us now examine the case shown in the Figure 4. below:
FIGURE 4. Boundary conditions for the flat plate
Presenting the problem as above with following boundary conditions:
(0,y) = 0 and (x, 0) = 0
(L, y) = 1 and (x, W) = 0
- Page 6 -
THEORY AND NUMERICAL APPROACH
Exact Solution by Separation of Variables
Substituting the transform in Figure 3. into the Heat diffusion equation we get the transformed
differential equation below:
Assuming that the solution of this differential equation can be presented as product of two
functions, we can apply the separation of variable technique to solve it. Assuming the solution of
the form: (x, y) = X (x) * Y (y) exists we can than substitute it into the transformed differential
equation and obtain two separate ordinary differential equations below:
Solutions to equations above are respectively:
X = C1 * COS (x) + C2 * SIN (x)
and
Y = C3 * e -(x) + C4 * e+(x)
Combining the constants and involving infinite series expansion in terms of orthogonal functions
leading to the Fourier series expansion we obtain the
Exact solution in Figure 6. below:
The equation above is convergent series where the temperature T corresponding to a value of 
may be obtained for the transform in Figure 4. The nature of the convergence as a sinusoidal
decay can be seen in Appendix G. on Page 24.
Now when we know how to obtain the exact solution for simple case of boundary condition for a
2-Dimensional heat transfer in a flat plate, we should go further now and discuss the theory
behind the finite difference approach. Finite difference equations will be used in our numerical
evaluation of the problem described in “Problem description”.
- Page 7 -
Numerical Solution of the Convection Problem
By applying the conservation of energy to the control volume about one nodal area, we can
easily obtain the finite difference equations for the node of interest.
We have to however assume that all the heat flows to the node and only perpendicular to node as
shown in Figure 7. below.
FIGURE 7. Finite difference method about the node of interest in the flat plate
Figure 8. below describes the fact that sum of all the magnitudes of energies entering the node is
equal to zero and that in this particular problem there is no internal heat generation.
FIGURE 8. Energy balance for this particular problem
Simplified form of the Fourier's Law lets us proceed to remaining conduction rates that describe
the heat transfer into node (m, n) from other neighboring nodes (Figures 9 - 12):
- Page 8 The quantity (Y *1) is the heat transfer area and the expression in fraction represents the finite
difference approximation of the temperature gradient at the boundary between the two nodes.
Substituting equations in Figures 9 - 12 into energy balance equation in Figure 7. and keeping
in mind that X = Y it follows that the finite difference equation for the interior node without
energy generation is represented in Figure 13. below:
Figure 13. Finite difference formula for the internal node
Besides the internal node situation, for this particular problem we will have to derive one more
case where the node is exposed to the external free convection and we will do that by setting up
the energy balance based on the Figure 14. below:
FIGURE 14. Nodes exposed to free Convection
Here we want to come up with the finite difference equation for node (m, n). We know that
sum of all energies entering the node have to equal zero, that nodes (m, n+1) and (m, n-1) only
transfer energy through the half of the area to node (m, n) as opposed to node (m-1, n) and the
free convection which use (X * 1). Thus, equations for the nodes exposed to free convection
are:
Q1 = k * (T (m-1, n) - T (m, n))
Q2 = k/2 * (T (m, n-1) - T (m, n))
Q3 = k/2 * (T (m, n+1) - T (m, n))
Q conv = h * X * (T - T (m, n))
- Page 9 Energy balance equation implies that: Q1 + Q2 + Q3 + Qconv = 0 hence obtaining the expression
for the finite difference equation for the node exposed to free convection heat transfer in
Figure 15. below:
FIGURE 15. Finite difference formula for the nodes on the convecting edge
Knowing those finite difference equations we can proceed to formulation of those equations for
the nodes of interest for this particular problem, in order to determine the temperature
distribution. Hence Equations for particular nodes are:
NODE1 --> T2 + T3 + 500 + 500 - 4 * T1 = 0
NODE2 --> 2 * T1 + T4 + 500 - 4 * T2 = 0
NODE3 --> T1 + T4 + T5 + 500 - 4 * T3 = 0
NODE4 --> T2 + 2 * T3 + T6 - 4 * T4 = 0
NODE5 --> T3 + T6 + T7 + 500 - 4 * T5 = 0
NODE6 --> T4 + 2 * T5 + T8 - 4 * T6 = 0
Knowing that h = 10 [W/m2*K], X = 0.25 [m] and k = 1 [W/m*K] and plugging the values in
equation Figure11. we get following finite difference equations for nodes exposed to free
convection:
NODE7 --> 2*T5 + T8 + 2000 - 9 * T7 = 0
NODE8 --> 2*T6 + 2*T7 + 1500 - 9 * T8 = 0
Now when we have the finite difference equations laid out for every single node of interest, we
ended up with linear systems of 8 equations and 8 unknowns. Utilizing Gauss-Seidel iteration
method coded in Fortran we will determine those temperatures to within desired error tolerance.
Finite difference equations obtained from the energy balance in the nodal network will be
rearranged such that they are diagonally dominant.
Iterative process will follow the sequence formula in Figure 16.
FIGURE 16. Gauss-Seidel iterative formula
and it will stop when the convergence criteria in Figure 17. is satisfied.
FIGURE 17. Convergence criteria for Gauss-Seidel algorithm
- Page 10 In Gauss-Seidel the equations are examined one at a time in sequence, and that previously
computed results are used as soon as they are available. Two important facts about the GaussSeidel method should be noted. First, the computations appear to be serial. Since each
component of the new iterates depends upon all previously computed components, the updates
cannot be done simultaneously. Second, the new iterate depends upon the order in which the
equations are examined.
The Gauss-Seidel method is sometimes called the "method of successive displacements" to
indicate the dependence of iterates on the ordering. If this ordering is changed, the components
of the new iterate (and not just their order) will also change. To apply the method, the set of
equations must be written in a form so that each of the variables is given by one of the equations
in the set. For example, the set might be written in the form as shown in Figures 18 - 22. below:
And for the nodes exposed to free convection we have the following equations:
FORTRAN code that is implementing the Gauss-Seidel iteration does not require that we place
equations in particular form as seen in Figures 18 - 22. FORTRAN however does require us to
provide the formula through which the old values became the new values (one iteration step).
The code basically takes 2 dimensional array and performs the calculations obtained by finite
difference energy balance and as soon as the solutions are obtained they are reassigned to the
new value. New value is subtracted from old value and if the tolerance is not met the iterations
will take place. Each new iteration is set to a count, so that we can easily obtain the number of
iterations it took to converge to the solutions designated by the tolerance.
- Page 11 -
RESULTS AND DISCUSSION
Exact Solution by Separation of Variables vs. Numerical Interpretation
First of all we shall impose the convention of how to reference the nodes of interest to avoid
confusion. Below in Table 1. presented are the nodes as they are distributed along the "x" and
"y" directions and their displacement from the origin:
NODES OF INTEREST
y=0. 00
y=0. 25
y=0. 50
y=0. 75
y=1. 00
x=0. 00
T(1,1)
T(1,2)
T(1,3)
T(1,4)
T(1,5)
TABLE 1.
x=0. 25
T(2,1)
T(2,2)
T(2,3)
T(2,4)
T(2,5)
x=0. 50
T(3,1)
T(3,2)
T(3,3)
T(3,4)
T(3,5)
x=0. 75
T(4,1)
T(4,2)
T(4,3)
T(4,4)
T(4,5)
x=1. 00
T(5,1)
T(5,2)
T(5,3)
T(5,4)
T(5,5)
5 x 5 node location diagram over the flat plate
After the implementation of the exact solution series formula in Figure 6. in the excel
spreadsheet that can be found in Appendix G. for a specific case where T1 = 0 K is a fixed
temperature on three edges of the flat plate and T2 = 1 K is the fixed temperature along the fourth
edge, exact solutions for the reduced factor  are obtained in the Table 2. below:
TEMPERATURES
y=0. 00
y=0. 25
y=0. 50
y=0. 75
y=1. 00
x=0. 00
0.0000000
0.0000000
0.0000000
0.0000000
0.0000000
x=0. 25
0.0000000
0.0679720
0.0954140
0.0679720
0.0000000
x=0. 50
0.0000000
0.1820280
0.2500000
0.1820280
0.0000000
x=0. 75
0.0000000
0.4320280
0.5405290
0.4320280
0.0000000
x=1. 00
0.0000000
1.0000000
1.0000000
1.0000000
0.0000000
TABLE 2. Temperature values for distribution in the flat plate obtained by calculating exact solution
Since T = (*(T2-T1)) + T1 and since T1= 0 K and T2 = 1 K, from Figure 3. it follows that = T.
We can see that the temperature distribution in the plate follows a hyperbolic pattern of
distribution from the 0 K edge to 1 K edges assuring exactness of the solution. Results of the
FORTRAN code "GAUSS_EXACT" for this particular problem were obtained at 0.001 %
tolerance for 5 x 5 mesh size and after 19 iterations in Table 3.:
TEMPERATURES
y=0.00
y=0.25
y=0.50
y=0.75
y=1.00
x=0.00
0.0000000
0.0000000
0.0000000
0.0000000
0.0000000
x=0.25
0.0000000
0.0714291
0.0982148
0.0714291
0.0000000
x=0.50
0.0000000
0.1875006
0.2500004
0.1875006
0.0000000
x=0.75
0.0000000
0.4285717
0.5267860
0.4285717
0.0000000
x=1.00
0.0000000
1.0000000
1.0000000
1.0000000
0.0000000
TABLE 3. Temperature values in the flat plate obtained by FORTRAN approximation of exact solution
FORTRAN Code “GAUSS_EXACT” for 5 x 5 mesh size can be seen in Appendix A.
- Page 12 If we compare the results obtained by exact solution method presented in the Table 2. above to
the approximated solutions obtained by FORTRAN code "GAUSS_EXACT" in Table 3. we can
see that the major discrepancy is located along the colder temperature edge.
That is due to the rigidity of the code, if you refer to the "GAUSS_EXACT" code you will find
that side was forced to be at that temperature. Once the boundary conditions for the flat plate are
established of "hardwired" the output will not be affected nor forced to follow specific
temperature distribution pattern, which may be regulated by the exact solution formula.
Besides the lower temperature boundary condition temperatures inside the plate at the internal
nodes of interest are within 0 (at node T3, 3) to 2.54 % (at node T4, 3) accurate.
We should now get the differences between baseline (exact) solution and numerical
approximation on all points, in order to determine the error norm as a final step in error analysis.
Hence, below in Table 4. presented are the differences for each node of interest:
DIFFERENCES
y=0. 00
y=0. 25
y=0. 50
y=0. 75
y=1. 00
x=0. 00
0.0000000
0.0000000
0.0000000
0.0000000
0.0000000
x=0. 25
0.0000000
0.003457
0.002801
0.003457
0.0000000
x=0. 50
0.0000000
0.005473
0.000000
0.005473
0.0000000
x=0. 75
0.0000000
0.003456
0.013743
0.003456
0.0000000
x=1. 00
0.0000000
0.0000000
0.0000000
0.0000000
0.0000000
TABLE 4. Differences between the exact solution and FORTRAN Code (5 x 5 resolution)
All the differences are squared and summed and from the final sum the square root was taken
giving us the Norm below in Figure 24:
25
 ( DIFFERENCE )
i 1
2
i
 0.017447
Now if we increase the size of mesh for “GAUSS_EXACT" code from 5 x 5 to 9 x 9
(making X = Y = 0.125 m), we should see the improvement in error. FORTRAN Code
“GAUSS_EXACT” for 9 x 9 mesh size can be seen in Appendix B.
Table 5. Below shows the results obtained after 1001 iterations, for increased mesh size:
TEMPERATURES
y=0. 00
y=0. 25
y=0. 50
y=0. 75
y=1. 00
x=0. 00
0.0000000
0.0000000
0.0000000
0.0000000
0.0000000
x=0. 25
0.0000000
0.068947
0.096273
0.068947
0.0000000
x=0. 50
0.0000000
0.1838240
0.2500000
0.1838240
0.0000000
x=0. 75
0.0000000
0.4310530
0.5360800
0.4310530
0.0000000
x=1. 00
0.0000000
1.0000000
1.0000000
1.0000000
0.0000000
TABLE 5. Temperature values obtained by FORTRAN (9 x 9 mesh size) approximation of exact solution
Error percentage decreased to within 0 (at node T3, 3) to 0.82 % (at node T4, 3). Again, all the
differences are squared and summed and from the final sum the square root was taken giving us
the norm below between the 9 x 9 mesh size FORTRAN approximation and Exact solution in
Figure 25:
25
 ( DIFFERENCE )
i 1
2
i
 0.005548
- Page 13 We can take this further into finer mesh now when we witnessed the error improvement.
Let’s see in Table 6. Below, by how much will error percentage decrease on the 17 x 17 mesh
size (making X = Y = 0.0625 m):
TEMPERATURES
y=0. 00
y=0. 25
y=0. 50
y=0. 75
y=1. 00
x=0. 00
0.0000000
0.0000000
0.0000000
0.0000000
0.0000000
x=0. 25
0.0000000
0.0682310
0.0956590
0.0682330
0.0000000
x=0. 50
0.0000000
0.1825300
0.2500210
0.1825320
0.0000000
x=0. 75
0.0000000
0.4317880
0.5393390
0.4317900
0.0000000
x=1. 00
0.0000000
1.0000000
1.0000000
1.0000000
0.0000000
TABLE 6. Temperature values obtained by FORTRAN (17 x 17 mesh size) approximation of exact solution
FORTRAN Code “GAUSS_EXACT” for 17 x 17 mesh size can be seen in Appendix C.
Finally error percentage came down to 0.0084 (at node T3, 3) to 0.22 % (at node T4, 3) and the
norm as shown in Figure 26. below:
25
 ( DIFFERENCE )
i 1
2
i
 0.001494
This mesh size showed accuracy in norm to within 10-3 in reference to the last mesh size 9 x 9,
validating and accrediting the “GAUSS_EXACT” code that is to be used on described Problem.
Obtained data moves in a specific pattern over the flat plate with prescribed boundary conditions,
indicating that the isotherms take shape of the bottleneck on the sides and hyperbolic on the cold
temperature edge as we can see in the Figure 27. below:
- Page 14 -
Numerical Solution of the Convection Problem
Having validated the FORTRAN code for specific base line problem we can now proceed and
consider resolving the convection problem. Table 5. below shows results after only 8 iterations
as they appear in the Published Text (underlined) for the described Problem, hence not giving us
solid reference as an exact solution. However, it can serve as a relative reference or baseline for
our numerical approximation:
T(4,2)489.1000
T(3,2)471.9000
T(2,2)436.8000
T(1,2)356.9000
T(4,3)485.0000
T(3,3)461.8000
T(2,3)418.6000
T(1,3)339.0000
TABLE 7. Published results for convection problem (not exact solution)
In Table 6. below we can see the output of the FORTRAN code for convection problem after 16
iterations. Clearly the following approximations should be closer to the exact solution than
Published solutions:
T(5,1)500.0000
T(4,1)500.0000
T(3,1)500.0000
T(2,1)500.0000
T(1,1)500.0000
T(5,2)500.0000
T(4,2)489.2907
T(3,2)472.0359
T(2,2)436.9151
T(1,2)356.9848
T(5,3)500.0000
T(4,3)485.1392
T(3,3)461.9755
T(2,3)418.7033
T(1,3)339.0418
T(5,4)500.0000
T(4,4)489.2971
T(3,4)472.0493
T(2,4)436.9310
T(1,4)356.9893
T(5,5)500.0000
T(4,5)500.0000
T(3,5)500.0000
T(2,5)500.0000
T(1,5)500.0000
TABLE 8. Results obtained by a FORTRAN Code for Convection Problem with 5 x 5 mesh in Figure 2.
After the comparison of the approximated results obtained by a source code to the published
results, we can see that the difference percentage falls between 0.01 and 0.04 %.
Norm in Figure 26. below is obtained after the differences between the Table 7. and Table 8.
were obtained below in Table 9.:
T(4,2)0.0907
T(3,2)0.1359
T(2,2)0.1151
T(1,2)0.0848
T(4,3)0.1392
T(3,3)0.1755
T(2,3)0.1033
T(1,3)0.0418
FIGURE 28. Norm between two approximate solutions only after 8 additional iterations
The average percentage error is 0.028 % which can only be due to higher magnitude of iterations
the FORTRAN Code for Convection Problem with 5 x 5 mesh in Figure 2. has gone through.
FORTRAN Code for Convection Problem with 5 x 5 mesh in Figure 2. is in Appendix D.
Now that our FORTRAN Code works and it has been validated on a exact solution problem as
well as on described Problem, we can increase the mesh size over the plate, by reducing our
 X from 0.25 m (5 x 5 mesh) to 0.125 m (9 x 9 mesh) and 0.0625 m (17 x 17 mesh).
This will give us more accurate results for the nodes at same spatial locations.
- Page 15 So below in Table 10. we have the results for the 9 x 9 mesh of the plate in described Problem,
where now the  X=0.125 m.
T(5,1)500.0000
T(4,1)500.0000
T(3,1)500.0000
T(2,1)500.0000
T(1,1)500.0000
T(5,2)500.0000
T(4,2)489.5586
T(3,2)472.2873
T(2,2)435.7520
T(1,2)349.8863
T(5,3)500.0000
T(4,3)485.3590
T(3,3)461.8207
T(2,3)416.8531
T(1,3)337.4382
T(5,4)500.0000
T(4,4)489.5616
T(3,4)472.2925
T(2,4)435.7572
T(1,4)349.8880
T(5,5)500.0000
T(4,5)500.0000
T(3,5)500.0000
T(2,5)500.0000
T(1,5)500.0000
TABLE 10. Results obtained by a FORTRAN Code for Convection Problem with 9 x 9 mesh in Figure 2.
FORTRAN Code for Convection Problem with 9 x 9 mesh in Figure 2. is in Appendix E.
Observe node T (2,3) = 418.6000 K at a 5 x 5 mesh in Table 8. and node T (2,3) = 416.8531 in
Table 10. 9 x 9 mesh size. It is evident that by increasing the mesh size we approach the solution
that is closer to exact solution.
Now let's look at the results obtained from the FORTRAN Code for Convection Problem with
17 x 17 mesh size  X=0.0625 m. below in Table 11.:
T(5,1)500.0000
T(4,1)500.0000
T(3,1)500.0000
T(2,1)500.0000
T(1,1)500.0000
T(5,2)500.0000
T(4,2)489.6495
T(3,2)472.4099
T(2,2)435.4932
T(1,2)348.5947
T(5,3)500.0000
T(4,3)485.4474
T(3,3)461.8154
T(2,3)416.3406
T(1,3)337.3164
T(5,4)500.0000
T(4,4)489.6495
T(3,4)472.4099
T(2,4)435.4932
T(1,4)348.5947
T(5,5)500.0000
T(4,5)500.0000
T(3,5)500.0000
T(2,5)500.0000
T(1,5)500.0000
TABLE 11. Results obtained by a FORTRAN Code for Convection Problem with 17 x 17 mesh in Figure 2.
FORTRAN Code for Convection Problem with 17 x 17 mesh in Figure 2. is in Appendix F.
Observe node T (2,3) = 418.6000 K at a 5 x 5 mesh in Table 8. and node T (2,3) = 416.3406 in
Table 11. 17 x 17 mesh size.
In closing to the error analysis for Convection Problem, let us just take node in the middle of the
plate T (3,3) and observe how the norm between each increasing mesh dimension reduces.
T (3, 3)
TABLE 6 (5 x 5)
TABLE 8 (9 x 9)
TABLE 9 (17 x 17)
461.9755
461.8207
461.8154
Norm decreases from SQRT ((461.9755 – 461.8207) 2) = 0.1548 on the 9 x 9 mesh, to
SQRT ((461.8207 – 461.8154) 2) = 0.0053 on the 17 x 17 mesh.
The error percentage reduced from 0.033 % on the 9 x 9 to 0.0011 % on the 17 x 17 mesh.
This is a confirmation of the validity of the FORTRAN incorporated Gauss-Seidel
approximation Code, yet for the second time. Values obtained in Table 9. are very close to the
exact solution according to the decreasing trend the convergence is undergoing when mesh
dimensions are increased.
- Page 16 -
Summary
The objective of this project was to determine the two-dimensional steady-state temperature
distribution in square flat plate that had three edges at a fixed temperature and fourth edge
exposed to free convection into the air utilizing FORTRAN code obtained approximated
solutions. Code included inputs like Conductivity, Convectivity, Tolerance, Convection
temperature and desired column number in order to give one specific column of temperatures
approximated with Gauss-Seidel iterative algorithm and the number of iterations it took to
converge to the desired tolerance. Code also gives opportunity to continue or terminate the
execution of the program.
FORTRAN code was validated using the exact solution of a much simpler problem that involves
the flat plate that in stead of convection on one edge has fixed temperature that differs from the
temperatures of the remaining edges. Exact solutions were found for simpler problem and
compared to the results obtained by FORTRAN code approximation. FORTRAN code
approximation for the exact solution was done two times for finer meshes. Each time the mesh
dimensions were doubled to find that error percentage and the norm were rapidly decaying
toward convergence.
Published results for the convection problem were used as baseline since those are the
approximations as well and they were only the results after 8 iterations. Validated code fixed for
a Convection Problem converged after 16 iterations giving very close results to published results.
To assure convergence of the FORTRAN Code for Convection Problem yet again the finer
meshes had to be done. The results obtained after implementing the mesh of double the size were
compared to the results obtained on smaller mesh sizes. As a result of this comparison we have
seen that the norm and the error percentage have decreased by 3 orders of magnitude on each
doubling in the mesh size.
In closing, for this particular project we might say that the use of numerical approximation was
successfully demonstrated and that it produced very minor and consistent error bandwidth.
- Page 17 -
Reference

Smith, G. D., "Numerical Solution of Partial Differential Equations: Finite Difference
Methods", Clarendon Press, London, 1985, p. 239-311.

Bickford, William, "Finite Element Method", Irwing, Boston, 1990

DeWitt, David P., and Incropera, Frank P., "Fundamentals of Heat and Mass Transfer"
4th Edition, John Wiley & Sons, Inc., New York, NY, 1996.

Burden, R. L. & Faires, J. D., "Numerical Analysis" 7th edition, Brooks/Cole Publishing
Company, Pacific Grove, CA, 2000
Appendix
A
FORTRAN Code using Gauss-Seidel 5 x 5 mesh size for Exact Solution in Figure 4.
C
5
10
20
C
30
C
40
C
50
C
55
C
60
70
C
C
90
100
C
110
120
C
140
150
160
170
180
INTEGER X,Y,ITS,TEST
REAL T(5,5), T2(5,5), ACT, TACT, K, H, ACQ, Ts
SET ALL TEMPS
DO 20 X=1,5
DO 10 Y=1,5
T(X,Y)=0.
T2(X,Y)=0.
CONTINUE
CONTINUE
LEFT EDGE TEMPS
DO 30 Y=1,5
T(1,Y)=0
CONTINUE
RIGHT EDGE TEMPS
DO 40 Y=1,5
T(5,Y)=1
CONTINUE
BOTTOM EDGE TEMPS
DO 50 X=1,5
T(X,1)=0
CONTINUE
TOP EDGE TEMPS
DO 55 X=2,4
T(X,5)=0
CONTINUE
FIRST GUESS 0.5 EVERYWHERE
DO 70 Y=2,4
DO 60 X=2,4
T(X,Y)=0.5
CONTINUE
CONTINUE
GET USER VALUES
WRITE (*,*) 'INPUT ACCEPTABLE ERROR AS A PERCENT'
READ (*,*) ACT
RUN ITERATIONS
DO 160 ITS = 1, 10000
DO 100 X=1,5
DO 90 Y=1,5
T2(X,Y)=T(X,Y)
CONTINUE
CONTINUE
TEST=0
INTERNAL NODES
DO 120 X=2,4
DO 110 Y=2,4
T2(X,Y)=T(X,Y)
T(X,Y)=(T(X+1,Y)+T(X-1,Y)+T(X,Y+1)+T(X,Y-1))/4
CONTINUE
CONTINUE
TEST ACCURACY
DO 150 X=1,5
DO 140 Y=1,5
TACT=100*ABS((T(X,Y)-T2(X,Y))/T(X,Y))
IF (TACT.GT.ACT) THEN
TEST=1
ENDIF
CONTINUE
CONTINUE
IF (TEST.EQ.0) THEN
GOTO 170
ENDIF
CONTINUE
WRITE (*,*) 'ENTER COLUMN FOR TEMPS'
READ (*,*) X
DO 180 Y=5,1,-1
WRITE (*,*) 'T(',X,Y,')',T(X,Y)
CONTINUE
WRITE (*,*) 'ITS',ITS
WRITE (*,*) 'TO RUN AGAIN, PRESS 1, ELSE ANY OTHER NUMBER'
READ (*,*) X
IF (X.EQ.1) THEN
GOTO 5
ENDIF
END
- Page 18 -
B
C
5
10
20
C
30
C
40
C
50
C
55
C
60
70
C
C
90
100
C
110
120
C
140
150
160
170
180
FORTRAN Code using Gauss-Seidel 9 x 9 mesh size for Exact Solution in Figure 4.
INTEGER X,Y,ITS,TEST
REAL T(9,9), T2(9,9), ACT, TACT, K, H, ACQ, Ts
SET ALL TEMPS
DO 20 X=1,9
DO 10 Y=1,9
T(X,Y)=0.
T2(X,Y)=0.
CONTINUE
CONTINUE
LEFT EDGE TEMPS
DO 30 Y=1,9
T(1,Y)=0
CONTINUE
RIGHT EDGE TEMPS
DO 40 Y=1,9
T(9,Y)=1
CONTINUE
BOTTOM EDGE TEMPS
DO 50 X=1,9
T(X,1)=0
CONTINUE
TOP EDGE TEMPS
DO 55 X=2,8
T(X,9)=0
CONTINUE
FIRST GUESS 0.5 EVERYWHERE
DO 70 Y=2,8
DO 60 X=2,8
T(X,Y)=0.5
CONTINUE
CONTINUE
GET USER VALUES
WRITE (*,*) 'INPUT ACCEPTABLE ERROR AS A PERCENT'
READ (*,*) ACT
RUN ITERATIONS
DO 160 ITS = 1, 10000
DO 100 X=1,9
DO 90 Y=1,9
T2(X,Y)=T(X,Y)
CONTINUE
CONTINUE
TEST=0
INTERNAL NODES
DO 120 X=2,8
DO 110 Y=2,8
T2(X,Y)=T(X,Y)
T(X,Y)=(T(X+1,Y)+T(X-1,Y)+T(X,Y+1)+T(X,Y-1))/4
CONTINUE
CONTINUE
TEST ACCURACY
DO 150 X=1,9
DO 140 Y=1,9
TACT=100*ABS((T(X,Y)-T2(X,Y))/T(X,Y))
IF (TACT.GT.ACT) THEN
TEST=1
ENDIF
CONTINUE
CONTINUE
IF (TEST.EQ.0) THEN
GOTO 170
ENDIF
CONTINUE
WRITE (*,*) 'ENTER COLUMN FOR TEMPS'
READ (*,*) X
DO 180 Y=9,1,-1
WRITE (*,*) 'T(',X,Y,')',T(X,Y)
CONTINUE
WRITE (*,*) 'ITS',ITS
WRITE (*,*) 'TO RUN AGAIN, PRESS 1, ELSE ANY OTHER NUMBER'
READ (*,*) X
IF (X.EQ.1) THEN
GOTO 5
ENDIF
END
- Page 19 -
-Page 20-
B-1
Here is the output of the FORTRAN Code using Gauss-Seidel 9 x 9 mesh size for Exact
Solution:
9x9
y = 0.000
y = 0.125
y = 0.250
y = 0.375
y = 0.500
y = 0.625
y = 0.750
y = 0.875
y = 1.000
x = 0.000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
x = 0.125
0.000000
0.017413
0.031969
0.041515
0.044826
0.041515
0.031969
0.017413
0.000000
x = 0.250
0.000000
0.037683
0.068947
0.089267
0.096273
0.089267
0.068947
0.037683
0.000000
x = 0.375
0.000000
0.064373
0.116869
0.150331
0.161734
0.150331
0.116869
0.064373
0.000000
x = 0.500
0.000000
0.102941
0.183824
0.233456
0.250000
0.233456
0.183824
0.102941
0.000000
x = 0.625
0.000000
0.163568
0.282028
0.349669
0.371354
0.349669
0.282028
0.163568
0.000000
x = 0.750
0.000000
0.269302
0.431053
0.511836
0.536080
0.511836
0.431053
0.269302
0.000000
x = 0.875
0.000000
0.482587
0.661046
0.730543
0.749292
0.730543
0.661046
0.482587
0.000000
x = 1.000
0.000000
1.000000
1.000000
1.000000
1.000000
1.000000
1.000000
1.000000
0.000000
C
C
5
10
20
C
30
C
40
C
50
C
55
C
60
70
C
C
90
100
C
110
120
C
140
150
160
170
180
FORTRAN Code using Gauss-Seidel 17 x 17 mesh size for Exact Solution in Figure 4.
INTEGER X,Y,ITS,TEST
REAL T(17,17), T2(17,17), ACT, TACT, K, H, ACQ, Ts
SET ALL TEMPS
DO 20 X=1,17
DO 10 Y=1,17
T(X,Y)=0.
T2(X,Y)=0.
CONTINUE
CONTINUE
LEFT EDGE TEMPS
DO 30 Y=1,17
T(1,Y)=0
CONTINUE
RIGHT EDGE TEMPS
DO 40 Y=1,17
T(17,Y)=1
CONTINUE
BOTTOM EDGE TEMPS
DO 50 X=1,17
T(X,1)=0
CONTINUE
TOP EDGE TEMPS
DO 55 X=2,17
T(X,17)=0
CONTINUE
FIRST GUESS 0.5 EVERYWHERE
DO 70 Y=2,16
DO 60 X=2,16
T(X,Y)=0.5
CONTINUE
CONTINUE
GET USER VALUES
WRITE (*,*) 'INPUT ACCEPTABLE ERROR AS A PERCENT'
READ (*,*) ACT
RUN ITERATIONS
DO 160 ITS = 1, 10000
DO 100 X=1,17
DO 90 Y=1,17
T2(X,Y)=T(X,Y)
CONTINUE
CONTINUE
TEST=0
INTERNAL NODES
DO 120 X=2,16
DO 110 Y=2,16
T2(X,Y)=T(X,Y)
T(X,Y)=(T(X+1,Y)+T(X-1,Y)+T(X,Y+1)+T(X,Y-1))/4
CONTINUE
CONTINUE
TEST ACCURACY
DO 150 X=1,17
DO 140 Y=1,17
TACT=100*ABS((T(X,Y)-T2(X,Y))/T(X,Y))
IF (TACT.GT.ACT) THEN
TEST=1
ENDIF
CONTINUE
CONTINUE
IF (TEST.EQ.0) THEN
GOTO 170
ENDIF
CONTINUE
WRITE (*,*) 'ENTER COLUMN FOR TEMPS'
READ (*,*) X
DO 180 Y=17,1,-1
WRITE (*,*) 'T(',X,Y,')',T(X,Y)
CONTINUE
WRITE (*,*) 'ITS',ITS
WRITE (*,*) 'TO RUN AGAIN, PRESS 1, ELSE ANY OTHER NUMBER'
READ (*,*) X
IF (X.EQ.1) THEN
GOTO 5
ENDIF
END
-Page 21-
- Page 22 -
C-1
Here is the output of the FORTRAN Code using Gauss-Seidel 17 x 17 mesh size for Exact
Solution:
17 x 17
x = 0.000
0.0625
0.1250
0.1875
0.2500
0.3125
0.3750
0.4375
0.5000
0.0000 0.00000
0.00000
0.00000
0.00000
0.00000
0.00000
0.00000
0.00000
0.00000
0.0625 0.00000
0.00430
0.00877
0.01359
0.01898
0.02517
0.03246
0.04125
0.05206
0.1250 0.00000
0.00842
0.01717
0.02662
0.03716
0.04925
0.06344
0.08046
0.10128
0.1875 0.00000
0.01220
0.02489
0.03856
0.05379
0.07121
0.09159
0.11588
0.14532
0.2500 0.00000
0.01550
0.03161
0.04896
0.06823
0.09022
0.11582
0.14614
0.18253
0.3125 0.00000
0.01819
0.03709
0.05742
0.07996
0.10560
0.13533
0.17032
0.21194
0.3750 0.00000
0.02019
0.04114
0.06366
0.08860
0.11689
0.14959
0.18787
0.23308
0.4375 0.00000
0.02141
0.04362
0.06748
0.09388
0.12378
0.15826
0.19849
0.24579
0.5000 0.00000
0.02182
0.04446
0.06877
0.09566
0.12610
0.16116
0.20204
0.25002
0.5625 0.00000
0.02141
0.04362
0.06749
0.09388
0.12378
0.15826
0.19849
0.24579
0.6250 0.00000
0.02019
0.04114
0.06366
0.08860
0.11689
0.14959
0.18787
0.23308
0.6875 0.00000
0.01819
0.03709
0.05742
0.07996
0.10560
0.13533
0.17032
0.21194
0.7500 0.00000
0.01550
0.03161
0.04896
0.06823
0.09022
0.11582
0.14614
0.18253
0.8125 0.00000
0.01220
0.02489
0.03857
0.05379
0.07121
0.09159
0.11588
0.14532
0.8750 0.00000
0.00842
0.01717
0.02662
0.03716
0.04925
0.06344
0.08046
0.10128
0.9375 0.00000
0.00430
0.00877
0.01359
0.01898
0.02517
0.03247
0.04125
0.05206
1.0000 0.00000
0.00000
0.00000
0.00000
0.00000
0.00000
0.00000
0.00000
0.00000
y [m]
0.5625
0.6250
0.6875
0.7500
0.8125
0.8750
0.9375
1.0000
0.0000 0.00000
0.00000
0.00000
0.00000
0.00000
0.00000
0.00000
0.00000
0.0625 0.06570
0.08346
0.10757
0.14232
0.19692
0.29386
0.49571
1.00000
0.1250 0.12729
0.16058
0.20451
0.26477
0.35149
0.48283
0.68896
1.00000
0.1875 0.18160
0.22705
0.28510
0.36078
0.46145
0.59701
0.77730
1.00000
0.2500 0.22672
0.28094
0.34806
0.43179
0.53651
0.66648
0.82321
1.00000
0.3125 0.26182
0.32191
0.39443
0.48181
0.58631
0.70918
0.84907
1.00000
0.3750 0.28673
0.35045
0.42593
0.51470
0.61774
0.73487
0.86390
1.00000
0.4375 0.30155
0.36722
0.44414
0.53332
0.63509
0.74866
0.87166
1.00000
0.5000 0.30647
0.37275
0.45009
0.53934
0.64063
0.75301
0.87408
1.00000
0.5625 0.30155
0.36722
0.44414
0.53332
0.63509
0.74866
0.87166
1.00000
0.6250 0.28673
0.35045
0.42593
0.51470
0.61774
0.73487
0.86390
1.00000
0.6875 0.26183
0.32191
0.39443
0.48181
0.58631
0.70918
0.84907
1.00000
0.7500 0.22672
0.28094
0.34806
0.43179
0.53651
0.66648
0.82321
1.00000
0.8125 0.18160
0.22706
0.28510
0.36078
0.46145
0.59701
0.77730
1.00000
0.8750 0.12729
0.16058
0.20451
0.26477
0.35149
0.48283
0.68896
1.00000
0.9375 0.06570
0.08346
0.10757
0.14232
0.19692
0.29386
0.49571
1.00000
1.0000 0.00000
0.00000
0.00000
0.00000
0.00000
0.00000
0.00000
0.00000
x [m]
D
C
5
10
20
C
30
C
40
C
50
C
60
70
C
C
90
100
C
110
120
C
130
C
140
150
160
170
180
FORTRAN Code for Convection Problem with 5 x 5 mesh in Figure 2.
INTEGER X,Y,ITS,TEST
REAL T(5,5), T2(5,5), ACT, TACT, K, H, ACQ, Ts
SET ALL TEMPS
DO 20 X=1,5
DO 10 Y=1,5
T(X,Y)=0.
T2(X,Y)=0.
CONTINUE
CONTINUE
LEFT EDGE TEMPS
DO 30 Y=1,5
T(1,Y)=500
CONTINUE
RIGHT EDGE TEMPS
DO 40 Y=1,5
T(5,Y)=500
CONTINUE
TOP EDGE TEMPS
DO 50 X=1,5
T(X,5)=500
CONTINUE
FIRST GUESS 200 EVERYWHERE
DO 70 Y=2,4
DO 60 X=2,4
T(X,Y)=200
CONTINUE
CONTINUE
GET USER VALUES
WRITE (*,*) 'INPUT VALUE K (Conductivity) IN W/MK'
READ (*,*) K
WRITE (*,*) 'INPUT VALUE H (Convectivity) IN W/(M^2)K'
READ (*,*) H
WRITE (*,*) 'INPUT VALUE Ts (Environment Temperature) IN K'
READ (*,*) Ts
WRITE (*,*) 'INPUT ACCEPTABLE ERROR AS A PERCENT'
READ (*,*) ACT
RUN ITERATIONS
DO 160 ITS = 1, 10000
DO 100 X=1,5
DO 90 Y=1,5
T2(X,Y)=T(X,Y)
CONTINUE
CONTINUE
TEST=0
INTERNAL NODES
DO 120 X=2,4
DO 110 Y=2,4
T2(X,Y)=T(X,Y)
T(X,Y)=(T(X+1,Y)+T(X-1,Y)+T(X,Y+1)+T(X,Y-1))/4
CONTINUE
CONTINUE
CONVECTION NODES
Y=1
DO 130 X=2,4
T(X,Y)=(T(X+1,Y)+T(X-1,Y)+2*T(X,Y+1)+(0.5*Ts*H/K))/(4+0.5*H/K)
CONTINUE
TEST ACCURACY
DO 150 X=1,5
DO 140 Y=1,5
TACT=100*ABS((T(X,Y)-T2(X,Y))/T(X,Y))
IF (TACT.GT.ACT) THEN TEST=1 ENDIF
CONTINUE
CONTINUE
IF (TEST.EQ.0) THEN
GOTO 170
ENDIF
CONTINUE
WRITE (*,*) 'ENTER COLUMN FOR TEMPS'
READ (*,*) X
DO 180 Y=5,1,-1
WRITE (*,*) 'T(',X,Y,')',T(X,Y)
CONTINUE
WRITE (*,*) 'ITS',ITS
WRITE (*,*) 'TO RUN AGAIN, PRESS 1, ELSE ANY OTHER NUMBER'
READ (*,*) X
IF (X.EQ.1) THEN GOTO 5
ENDIF
END
- Page 23 -
E
C
5
10
20
C
30
C
40
C
50
C
60
70
C
C
90
100
C
110
120
C
130
C
140
150
160
170
180
FORTRAN Code for Convection Problem with 9 x 9 mesh in Figure 2.
INTEGER X,Y,ITS,TEST
REAL T(9,9), T2(9,9), ACT, TACT, K, H, ACQ, Ts
SET ALL TEMPS
DO 20 X=1,9
DO 10 Y=1,9
T(X,Y)=0.
T2(X,Y)=0.
CONTINUE
CONTINUE
LEFT EDGE TEMPS
DO 30 Y=1,9
T(1,Y)=500
CONTINUE
RIGHT EDGE TEMPS
DO 40 Y=1,9
T(9,Y)=500
CONTINUE
TOP EDGE TEMPS
DO 50 X=1,9
T(X,9)=500
CONTINUE
FIRST GUESS 200 EVERYWHERE
DO 70 Y=2,8
DO 60 X=2,8
T(X,Y)=200
CONTINUE
CONTINUE
GET USER VALUES
WRITE (*,*) 'INPUT VALUE K (Conductivity) IN W/MK'
READ (*,*) K
WRITE (*,*) 'INPUT VALUE H (Convectivity) IN W/(M^2)K'
READ (*,*) H
WRITE (*,*) 'INPUT VALUE Ts (Environment Temperature) IN K'
READ (*,*) Ts
WRITE (*,*) 'INPUT ACCEPTABLE ERROR AS A PERCENT'
READ (*,*) ACT
RUN ITERATIONS
DO 160 ITS = 1, 10000
DO 100 X=1,9
DO 90 Y=1,9
T2(X,Y)=T(X,Y)
CONTINUE
CONTINUE
TEST=0
INTERNAL NODES
DO 120 X=2,8
DO 110 Y=2,8
T2(X,Y)=T(X,Y)
T(X,Y)=(T(X+1,Y)+T(X-1,Y)+T(X,Y+1)+T(X,Y-1))/4
CONTINUE
CONTINUE
CONVECTION NODES
Y=1
DO 130 X=2,8
T(X,Y)=(T(X+1,Y)+T(X-1,Y)+2*T(X,Y+1)+(0.5*Ts*H/K))/(4+0.5*H/K)
CONTINUE
TEST ACCURACY
DO 150 X=1,9
DO 140 Y=1,9
TACT=100*ABS((T(X,Y)-T2(X,Y))/T(X,Y))
IF (TACT.GT.ACT) THEN TEST=1 ENDIF
CONTINUE
CONTINUE
IF (TEST.EQ.0) THEN GOTO 170
ENDIF
CONTINUE
WRITE (*,*) 'ENTER COLUMN FOR TEMPS'
READ (*,*) X
DO 180 Y=9,1,-1
WRITE (*,*) 'T(',X,Y,')',T(X,Y)
CONTINUE
WRITE (*,*) 'ITS',ITS
WRITE (*,*) 'TO RUN AGAIN, PRESS 1, ELSE ANY OTHER NUMBER'
READ (*,*) X
IF (X.EQ.1) THEN GOTO 5
ENDIF
END
- Page 24 -
- Page 25 -
E-1
Here is the output of the FORTRAN Code using Gauss-Seidel 9 x 9 mesh size for Convection
Problem:
9x9
y = 0.000
y = 0.125
y = 0.250
y = 0.375
y = 0.500
y = 0.625
y = 0.750
y = 0.875
y = 1.000
x = 0.000
500.000000
500.000000
500.000000
500.000000
500.000000
500.000000
500.000000
500.000000
500.000000
x = 0.125
500.000000
497.366700
494.312700
490.327900
484.673000
476.081400
461.973800
436.067000
380.310700
x = 0.250
500.000000
495.154900
489.558600
482.329900
472.287300
457.684100
435.752000
401.988500
349.886300
x = 0.375
500.000000
493.695300
486.440100
477.150700
464.468700
446.623200
421.369000
386.255900
339.974600
x = 0.500
500.000000
493.187400
485.359000
475.369800
461.820700
442.979100
416.853100
381.699400
337.438200
x = 0.625
500.000000
493.696300
486.442000
477.153500
464.472100
446.626800
421.372400
386.258400
339.975700
x = 0.750
500.000000
495.156300
489.561600
482.334200
472.292500
457.689700
435.757200
401.992400
349.888000
x = 0.875
500.000000
497.367900
494.315100
490.331500
484.677200
476.085900
461.978000
436.070200
380.312100
x = 1.000
500.000000
500.000000
500.000000
500.000000
500.000000
500.000000
500.000000
500.000000
500.000000
F
C
5
10
20
C
30
C
40
C
50
C
60
70
C
C
90
100
C
110
120
C
130
C
140
150
160
170
180
FORTRAN Code for Convection Problem with 17 x 17 mesh in Figure 2.
INTEGER X,Y,ITS,TEST
REAL T(17,17), T2(17,17), ACT, TACT, K, H, ACQ, Ts
SET ALL TEMPS
DO 20 X=1,17
DO 10 Y=1,17
T(X,Y)=0.
T2(X,Y)=0.
CONTINUE
CONTINUE
LEFT EDGE TEMPS
DO 30 Y=1,17
T(1,Y)=500
CONTINUE
RIGHT EDGE TEMPS
DO 40 Y=1,17
T(17,Y)=500
CONTINUE
TOP EDGE TEMPS
DO 50 X=1,17
T(X,17)=500
CONTINUE
FIRST GUESS 200 EVERYWHERE
DO 70 Y=2,16
DO 60 X=2,16
T(X,Y)=200
CONTINUE
CONTINUE
GET USER VALUES
WRITE (*,*) 'INPUT VALUE K (Conductivity) IN W/MK'
READ (*,*) K
WRITE (*,*) 'INPUT VALUE H (Convectivity) IN W/(M^2)K'
READ (*,*) H
WRITE (*,*) 'INPUT VALUE Ts (Environment Temperature) IN K'
READ (*,*) Ts
WRITE (*,*) 'INPUT ACCEPTABLE ERROR AS A PERCENT'
READ (*,*) ACT
RUN ITERATIONS
DO 160 ITS = 1, 10000
DO 100 X=1,17
DO 90 Y=1,17
T2(X,Y)=T(X,Y)
CONTINUE
CONTINUE
TEST=0
INTERNAL NODES
DO 120 X=2,16
DO 110 Y=2,16
T2(X,Y)=T(X,Y)
T(X,Y)=(T(X+1,Y)+T(X-1,Y)+T(X,Y+1)+T(X,Y-1))/4
CONTINUE
CONTINUE
CONVECTION NODES
Y=1
DO 130 X=2,16
T(X,Y)=(T(X+1,Y)+T(X-1,Y)+2*T(X,Y+1)+(0.5*Ts*H/K))/(4+0.5*H/K)
CONTINUE
TEST ACCURACY
DO 150 X=1,17
DO 140 Y=1,17
TACT=100*ABS((T(X,Y)-T2(X,Y))/T(X,Y))
IF (TACT.GT.ACT) THEN TEST=1 ENDIF
CONTINUE
CONTINUE
IF (TEST.EQ.0) THEN GOTO 170 ENDIF
CONTINUE
WRITE (*,*) 'ENTER COLUMN FOR TEMPS'
READ (*,*) X
DO 180 Y=17,1,-1
WRITE (*,*) 'T(',X,Y,')',T(X,Y)
CONTINUE
WRITE (*,*) 'ITS',ITS
WRITE (*,*) 'TO RUN AGAIN, PRESS 1, ELSE ANY OTHER NUMBER'
READ (*,*) X
IF (X.EQ.1) THEN
GOTO 5
ENDIF
END
- Page 26 -
-Page 27-
F-1
Here is the output of the FORTRAN Code using Gauss-Seidel 17 x 17 mesh size for Convection
Problem:
17 x 17
x = 0.0
0.0625
0.1250
0.1875
0.2500
0.3125
0.3750
0.4375
0.5000
0.0000
500.0
500.0000
500.0000
500.0000
500.0000
500.0000
500.0000
500.0000
500.0000
0.0625
500.0
499.3489
498.7237
498.1490
497.6471
497.2366
496.9327
496.7460
496.6830
0.1250
500.0
498.6719
497.3969
496.2254
495.2026
494.3668
493.7481
493.3683
493.2402
0.1875
500.0
497.9417
495.9666
494.1531
492.5712
491.2798
490.3247
489.7388
489.5413
0.2500
500.0
497.1285
494.3747
491.8492
489.6495
487.8564
486.5323
485.7208
485.4474
0.3125
500.0
496.1975
492.5545
489.2194
486.3211
483.9642
482.2274
481.1646
480.8069
0.3750
500.0
495.1071
490.4264
486.1527
482.4513
479.4519
477.2484
475.9032
475.4511
0.4375
500.0
493.8046
487.8912
482.5138
477.8796
474.1436
471.4113
469.7488
469.1910
0.5000
500.0
492.2202
484.8202
478.1315
472.4099
467.8314
464.5046
462.4898
461.8154
0.5625
500.0
490.2561
481.0377
472.7822
465.7972
460.2674
456.2859
453.8903
453.0912
0.6250
500.0
487.7664
476.2925
466.1624
457.7293
451.1551
446.4814
443.6942
442.7688
0.6875
500.0
484.5171
470.2035
457.8455
447.8026
440.1423
434.7903
431.6365
430.5956
0.7500
500.0
480.0984
462.1589
447.2135
435.4932
426.8214
420.9012
417.4658
416.3406
0.8125
500.0
473.7176
451.1202
433.3564
420.1354
410.7485
404.5275
400.9850
399.8352
0.8750
500.0
463.6518
435.2480
414.9566
400.9436
391.5099
385.4751
382.1113
381.0305
0.9375
500.0
445.6416
411.2634
390.2784
377.1723
368.8726
363.7518
360.9547
360.0641
1.0000
500.0
407.6512
373.8856
357.7213
348.5947
343.0562
339.7050
337.8916
337.3164
1.0
x =[m]
y [m]
0.5625
0.6250
0.6875
0.7500
0.0000
500.0000
500.0000
500.0000
500.0000
500.0000
0.8125
500.0000
0.8750
500.0000
0.9375
500.0
0.0625
496.7460
496.9327
497.2366
497.6471
498.1490
498.7237
499.3489
500.0
0.1250
493.3683
493.7481
494.3668
495.2026
496.2254
497.3969
498.6719
500.0
0.1875
489.7388
490.3247
491.2798
492.5712
494.1531
495.9666
497.9417
500.0
0.2500
485.7208
486.5323
487.8564
489.6495
491.8492
494.3747
497.1285
500.0
0.3125
481.1646
482.2274
483.9642
486.3211
489.2194
492.5545
496.1975
500.0
0.3750
475.9032
477.2484
479.4519
482.4513
486.1527
490.4264
495.1071
500.0
0.4375
469.7488
471.4113
474.1436
477.8796
482.5138
487.8912
493.8046
500.0
0.5000
462.4898
464.5046
467.8314
472.4099
478.1315
484.8202
492.2202
500.0
0.5625
453.8903
456.2859
460.2674
465.7972
472.7822
481.0377
490.2561
500.0
0.6250
443.6942
446.4814
451.1551
457.7293
466.1624
476.2925
487.7664
500.0
0.6875
431.6365
434.7903
440.1423
447.8026
457.8455
470.2035
484.5171
500.0
0.7500
417.4658
420.9012
426.8214
435.4932
447.2135
462.1589
480.0984
500.0
0.8125
400.9850
404.5275
410.7485
420.1354
433.3564
451.1202
473.7176
500.0
0.8750
382.1113
385.4751
391.5099
400.9436
414.9566
435.2480
463.6518
500.0
0.9375
360.9547
363.7518
368.8726
377.1723
390.2784
411.2634
445.6416
500.0
1.0000
337.8916
339.7050
343.0562
348.5947
357.7213
373.8856
407.6512
500.0
Obtained Exact Solution utilizing Series in Figure 6. and its Convergence - Page 28 –
G
T (X,Y)
0.00
0.25
0.50
0.75
1.00
X [m]
0.00
0.000000
0.000000
0.000000
0.000000
0.000000
0.25
0.000000
0.067972
0.095414
0.067972
0.000000
0.50
0.000000
0.182028
0.250000
0.182028
0.000000
0.75
0.000000
0.432028
0.540529
0.432028
0.000000
Y [m]
1.00
0.000000
1.000000
1.000000
1.000000
0.000000
Exact Solution Series convergence
Iteration
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
SUM
Theta (.5,.5)
0.576380
0.000000
-0.040226
0.000000
0.005017
0.000000
-0.000745
0.000000
0.000120
0.000000
-0.000020
0.000000
0.000004
0.000000
-0.000001
0.000000
0.000000
0.000000
0.000000
0.000000
0.540529
Series1
0.700000
0.600000
0.500000
Series value
0.400000
0.300000
0.200000
0.100000
0.000000
0
2
4
6
-0.100000
Iterations
8
10
Download