Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
|
![]() |
#1 |
初级会员
注册日期: 2011-09-15
帖子: 1
声望力: 0 ![]() |
![]()
1. Heat Transfer Simulation
Consider a rectangular metal plate with top and side edges held at some constant temperature, and the bottom edge held constant at some differing temperature. We can represent the temperature variations across the plate as a grid of temperatures by dividing the plate into a discrete array of cells. We store the temperature values in an array T such that T(i,j) is the average temperature of grid cell (i,j). We wish to study the equilibrium temperature distribution of this plate. We model the heat transfer between the cells by iterating over the whole array, each time replacing the temperature of a cell by the average temperature of itself and its four neighbouring cells (above, below, left and right). This averaging process forms a very crude modelling of the flow of heat. We stop iterating when no cell changes by more than some specified amount. Consider the following example: Our plate is represented by a 4 x 4 grid of cells. The top and side cells are held at 100 degrees and the bottom cells are held at 50 degrees. All other cells are set initially to zero (just an arbitrary value) 100 100 100 100 100 0 0 100 100 0 0 100 50 50 50 50 After one iteration this becomes 100 100 100 100 100 40 40 100 100 30 30 100 50 50 50 50 since for cell(2,2) we have (100 + 100 + 0 + 0 + 0)/5 = 40, and for cell(3,2) we have (100 + 50 + 0 + 0 + 0)/5 = 30 The boundary cell temperatures remain fixed. This averaging process is then repeated on these new values. Note that two arrays of cell temperatures must be maintained, one for the old temperatures, and one for the new. Once all the new temperatures have been calculated they can then be copied over and become the 'old' ones for the next iteration. You cannot do the averaging 'in place' using just one array because you would overwrite the previous cell values before you had finished using them. To simulate this system you must write a function T = tempsim(rows, cols, topNsideTemp, bottomTemp, tol) This function takes as arguments the number of rows and columns of cells to divide the plate into, the boundary temperatures, and a tolerance value - if no cell temperature changes by more than this tolerance the iteration process stops. The function then returns an array T giving the final distribution of temperatures. |
![]() |
![]() |