Spring 1996
Heat Transfer MEEG 302 - Computer Projects |
|
Computer Project #1
Due March 8th, 1996 The aim of this assignment is : Given a two-dimensional heat transfer problem, and it's solution; to draw the isothermal contour plot using Gnuplot . Problem Statement A rectangular plate of dimensions a and b is insulated on two sides. One side is in contact with a mixture of ice and water and hence is at a temperature of 0deg.C. The side BC is subjected to a sinusoidal temperature condition. (refer figure). The value of a is 2m and that of b is 1m. (com11.gif) The governing differential equation is Laplace's equation, (Computer Assignment 12.gif) This can be derived from the heat diffusion equation in 2 dimensions
for the conditions of steady-state conduction and with no
The analytical solution for this problem is given by : (Computer Assignment 13.gif) For a rectangular plate of length a=2m and breadth b=1m the temperature distribution is given by: (Computer Assignment 14.gif) Assignment 1. Divide the rectangular domain (the plate) into a grid. Divide the length into 10 equal parts and the breadth into 5 equal parts. Calculate the temperatures at each point ,or node, of the grid. 2. Using the data generated above, plot the isotherms, i.e., the lines of constant temperature. You should use Gnuplot for generating the contour plot. 3. What is the slope of the isotherms at the insulated boundaries? Account for the slope. Hint : There is no heat conducted across the insulated boundary. Using Gnuplot to Draw Contour plots MEEG 302 This menu is offered on the basis that you have an account on and are somewhat familiar with the UNIX system on Spencer or Strauss. 1. Drawing environment : You should have access to a UNIX system such as Spencer (me.udel.edu) or Strauss (strauss.udel.edu) or Brahms (brahms.udel.edu). 2. Preparing the data file : You should prepare the data file in the block form as shown : x y T 0.2 0.2
Notice that the y values are constant in each block of data while the x values change till the length is covered. The temperatures are calculated for each (x,y) pair using the expression for temperature distribution which has been given. You can write a FORTRAN program to calculate the temperature distribution and store it in the data file in the desired block form. Your code can be of the form as follows : c Output data for gnuplot
write (30,50, x(i),y(j),z(i,j))
3. Using Gnuplot to draw the contour plot. Here is the plotting code you can use : set term vttek # sets terminal type
Notes: 1. You can write the commands in a file name with subscript '.gnu' and then type load '<the command file name>' to input this command file. To use Gnuplot type 'gnuplot' at the prompt. Otherwise type 'gnuplot <command file name > ' at the prompt. 2. The above program assumes that your data file is named as num3.f. You can change it to any other name such as 'temp.dat' or 'num.dat' or 'data.txt' that you might give to your data file. You must use the same name in the command program. 3. About terminal types : 'vttek' is the terminal type if you are using your account from a Macintosh. If you are using X Terminals then the command should be 'set term X11'. 4. There are two methods to output your plots, both of which are used
in the above program : one is output to a screen which is why you need
to set the terminal type; the other is output to a Postscript (.ps) file
which can then be printed to a printer later.
|
|
Computer Project #2
Due Date April 5, 1996 Numerical Solution of Two-Dimensional, Steady-State Temperature Distribution in a Rectangular Domain Purpose The purpose of this assignment is to apply the finite difference numerical technique to solve the steady-state heat conduction equation, given by (comp.proj.21.gif) (1) where T is the temperature, x and y are the physical coordinates of the domain, g is the volumetric rate of internal heat generation (in W/m3 or BTU/ft3*hr), and k is the thermal conductivity. Note that such a heat generation would, for example, be caused by passing electric current through the material. Also note that a common mistake is not to include the heat generation rate in the proper units (recall that it represents energy per unit volume ). Upon completion of the general programming, The goal will be to perform three types of analyses: * Choose progressively smaller values of [[Delta]]x and [[Delta]]y and observe the behavior of the solution. If the problem has been correctly formulated and solved, the nodal temperatures should converge as [[Delta]]x and [[Delta]]y become smaller. This is one way to check the accuracy of the solution. Analytical solutions are of limited utility in checking the accuracy of a numerical model because most problems which will need to be solved by numerical methods usually do not have an analytical solution. * Remember, a converged numerical solution does not ensure an accurate solution to the physical problem. In many cases, the final solution is in serious error simply because the problem was not formulated correctly at the start. (For example, the boundary conditions may be incorrectly imposed). No computer or convergence criterion can correct this type of error. One way to check for formulation errors is to perform some sort of energy balance using the final solution. Hence, an energy balance should be performed as a check on problem formulation. * After you are satisfied that the numerical model adequately represents the physical situation, conduct numerical experiments by varying the heat generation rate and thermal conductivity in order to study how they effect the resulting temperature field. Graphical representation of the isotherms (lines of constant temperature) may be produced using an already available program called Gnuplot. This program is available on the departmental Unix computer, and was described in the first computer project. Problem Definition A two-dimensional solid (the third dimension is insulated or is so long that the temperature does not vary in that direction) generates heat internally. One surfaces of the solid is insulated, one is contact with a body at constant temperature, one has constant heat flux input and one surface is cooled with a coolant. We are interested in the steady state temperature distribution. As you know, the solution of Equation (1) gives the distribution of temperature in a cartesian domain. This expression is a second-order, linear partial differential equation. As in analytical solutions, we need to specify boundary conditions in order to solve the problem. In this assignment, we will use the mixed type of boundary conditions. Let us consider the domain shown below in Figure 1. The block is assumed to have a height H and a width W. A two-dimensional analysis assumes that the domain is either infinitely deep (such as a long bar, with temperature independent of the z direction), or that it is a finite block where the two surfaces parallel to the x-y plane are perfectly insulated. (comp.proj.22.gif)
The boundary conditions are: T=T1 at x=W
Numerical Solution Parameters Divide the domain into m-1 parts in the x-direction and n-1 parts in the y-direction. Discretization of the domain requires m nodes by n nodes for the mesh size, requiring a dimension statement for the temperature of real T(m,n). The individual nodes are numbered (i,j), where i=1,2,3,.....m and j=1,2,3,....n, related as shown below in Figure 2. (comp.proj.23.gif)
Note that the steady-state temperature distribution is independent of the thermal conductivity in the absence of internal volumetric heat generation. However, we typically need to assign a value for k to avoid a division by zero error. Such details are important in numerical analyses. For the present assignment, consider the following cases: case 1: m=10, n=10, k=10 f(W,m C), g=90 KW/m3
In addition, we will use the following for the width, height, and boundary temperatures W = 30 cm
The high thermal conductivity corresponds to materials such as Brass, while the low value corresponds to materials such as Nickel. SUBMIT (1a) Equations used for boundaries, interial nodes and corners
(1b) Program Listing
(2) Program Output
(3) Discussions
(4) Formulation Error
(comp.proj.24.gif) By definition of steady-state, this should be zero for an exact solution. Note that this is only a relative error since neither the heat input to the block nor the heat out from the block can be calculated with certainty! Calculate this error for all four cases. Notes and Hints When constructing the program, you may assume that [[Delta]]x=[[Delta]]y. By substituting for the derivatives in Equation (1) with central finite difference expressions and rearranging, we can explicitly solve for the temperature at any node (i,j) as (comp.proj.25.gif) (6) Note that the temperature at each node is expressed in terms of the temperatures of the neighboring points. To find the temperatures, we need to calculate them at each node several times by sweeping the calculation domain during each iteration. Thus, the solutions improve with each iteration. To start the computations, each node is assigned a temperature (if you don't do this, the computer will set everything to zero, which requires more iterations than a more educated method). One suggestion is to use an average of the boundary temperatures. This is not an initial condition! It is only an initial guess. The difference between an initial guess and an initial condition will become more clear in a later assignment. Also note that each iteration sweep corresponds to an effort to improve the values; it does not represent a step on a time scale. The iteration process is stopped when all nodes pass a convergence test. To do this, one must compare values from the current iteration with values from the previous iteration. When the change in value between iterations for each and every point is less than some prescribed value or percentage, the iteration loop is exited and the current values represent the numerical solution. In solving for the temperature distribution, one does not need to know the actual physical locations of the nodal points, only the distances between them. Gnuplot requires this information in the form of a specially formatted file (see Gnuplot handout). Fortunately, this information is easily computed with a pair of nested DO loops as follows: deltax = W / real(m-1)
These coordinates can then be written to the mesh file as required by Gnuplot. One final note: as a word of advice, it should be pointed out that in constructing the computer program, one should take care to make it as general and flexible as possible. Therefore, values such as the boundary temperatures are best implemented as variables read through input statements. A small part of the project grades will be based on quality and flexibility of the programs. HELP! In addition to office-hours, special consulting will be provided by
Roopesh Mathur in SPL 227
(March 30-April 4) Sunday-Thursday (7 to 10 pm) in addition to the office
hours. You may also use the e.mail facility to send your questions to me
or the TA
|
![]() ![]() ![]() |