Starting from:
$35

$29

Finite Element Analysis Using MatLab Solution




Due: Optional hard copy may be turned in during lab.




Overall Assignment




For this assignment, you are to write a MatLab program to perform a two-dimensional Finite Element Analysis ( FEA ) of a computer motherboard, and to write a short memo describing your findings.




Background: Finite Element Analysis




There are many situations in which engineers need to determine properties ( e.g. temperature, pressure, concentrations, etc. ) of the interior of a defined space, given certain boundary conditions describing the properties at the edges of the space and/or certain internal conditions. Finite Element Analysis is a technique in which the interior space is broken up into very small ( yet finite ) elements, and then analyzing how those elements interact with each other. The following images from Fluent Inc show some of the capabilities of commercial finite element analysis software:




The general approach to FEA is to first estimate the internal conditions somehow, and to then successively refine the estimation until the “answer” is obtained, to within some acceptable level of approximation, i.e. until the refinement step does not cause any appreciable change in the estimation.




Application Domain: Computer Motherboards




One of the big problems facing modern circuit board designers is that some components generate a lot of heat and therefore get quite hot, while other components on the circuit boards may be sensitive to high temperatures. In the particular domain of computer motherboards, modern CPUs and GPUs can get so hot that they must be liquid cooled in some cases. Therefore, motherboard designers frequently experiment with different layouts of components, to try to minimize the impact of hot components on sensitive ones:


































For this assignment, you are to write a MatLab program that analyzes and plots the temperature distribution across a rectangular motherboard, given the motherboard and CPU dimensions, the ambient temperature of the edges of the motherboard, and the temperature and location of the CPU on the motherboard. For the base assignment we will further limit our analysis to a single hot component ( CPU ), lined up parallel to the edges of the motherboard. ( I.e. no chips mounted at angles like some of the examples above. )




( In practice the FEA of computer systems is a 3-dimensional and dynamic one, taking into account the locations of fans and vents as well as electrical components, but we will restrict ourselves to the two-dimensional static case for this assignment. )




Program Implementation




Input problem data: Your MatLab program should ask the user for the following information. The values shown in parentheses are typical:




o The width and height of the motherboard, in inches. ( 5.0, 4.0 ) o The width and height of the CPU, in inches. ( 1.5, 1.25 )




o The location of the lower left corner of the CPU, in inches. ( 2.0, 1.0 ) ( The coordinate system should have 0, 0 at the lower left corner of the motherboard, with X increasing to the right and Y increasing to the top. )




o The temperature of the CPU. ( 50 degrees C or 120 degrees F )




o The ambient temperature, which defines the temperature along all edges of the motherboard. ( 25 degrees C or 75 degrees F )




o The number of elements per inch, which will be the same in both X and Y directions. ( 4 initially, then 10 or more when the program is working. )




o The tolerance to be used for a stopping condition. ( 0.001 )




o Maximum limit on iterations. ( 1, then a few, then 100, then larger numbers as needed. )

Initialize ( Create Initial Estimate ): Your program should then create TWO arrays to represent the initial estimate of the motherboard temperatures:




Calculate the number of rows and columns needed by multiplying the height and width respectively in inches times the number of elements per inch, and adding 2 to each product for the ambient edges. ( Save these as nRows and nCols. )



Create an array with the needed number of rows and columns using the ones( ) function, multiplied by the ambient temperature. ( Use nRows +1 and nCols + 1, because pcolor( ) will later ignore the extra row and column. See below. )



Then fill in the center with the average of ambient and CPU temperatures.



Finally fill the rows and columns corresponding to the CPU with the CPU temperature.



Copy the result to a second array, as you will need two copies for calculations.



These arrays then each contain a ( very poor ) estimate of the temperatures at every element on the motherboard.



Estimate Refinement: Your program will then repeatedly refine the estimate of the temperatures, until the maximum number of iterations is reached or until the estimate quits changing to within the desired tolerance.




o For our purposes, a very simple ( and not very efficient ) technique for estimate refinement is to set the new value of each element to be the average of the current values of its immediate neighbors. So in the diagram below, element A would be set to the average of elements B, C, D, and E. ( In the general case FEA is performed in 3 dimensions of arbitrary geometry, but for this assignment we will be restricting ourselves to rectangular spaces in two dimensions. )













B




E A C




D










Anew = ( Bcurrent + Ccurrent + Dcurrent + Ecurrent ) / 4.0




The above bullet point would indicate that each of the cells of the array must be updated individually, one by one. Fortunately, that is not the case in Matlab. A technique will be shown in class for averaging 4 large arrays at once, thereby updating the estimate for the entire motherboard in a single statement, ( or a few statements to make the code easier to understand, but there is no need to loop through all the elements one by one. )



Two arrays are needed because you will read the old ( current ) values from one array while building an updated estimate in the other array. Later you will either copy the data back to start the next iteration, or do the next calculations in the opposite direction. ( The source becomes the target and vice-versa. )
When done right, the averaging step will not modify the boundary rows and columns ( representing ambient conditions ), but it will alter the cells covered by the CPU. It is therefore necessary to restore the CPU cells to their correct value before proceeding to the next step.



Stopping Conditions: The way the algorithm works is to repeat the estimate refinement step over and over again ( in a loop ), until one of two things happens:




The maximum number of allowed iterations is reached, or



The estimate refinement step is no longer making any appreciable change to the estimate. I.e. the change in the estimate from one iteration to the next is less than some user-defined tolerance.



For this problem the measure of change you will use will be the largest ( absolute ) change of any cell in the array. If the old ( previous ) estimate is in an array “est_1” and the new ( latest ) estimate is in an array “est_2”, then Matlab would calculate this as:




change = max( max( abs( est_1 – est_2 ) ) );




The program should stop looping and report its final results if the change between successive estimates ( as shown above ) is less than the user-provided tolerance, or if the maximum number of allowable iterations has been reached.



If the stopping condition has not been met at the end of an iteration, then the arrays must be reset in preparation for the next iteration. There are two approaches to this:



Copy the results from this averaging step back into the original array. With this approach the averaging step always goes from the same input array to the same output array, at the expense of an extra copying step.



Alternate the direction of the estimate refinement from one iteration to the next. So if the two arrays are est_1 and est_2, then on the odd iterations read from est_1 and write to est_2; On even iterations read from est_2 and write to est_1. ( Don’t forget to restore the CPU after each averaging step. )



Incremental Development




For any large programming task, it is best to develop and test the code in small incremental steps, rather than trying to do it all at once. For this assignment, it is recommended that you:




First write a program that reads in input from the user, assuming all input is good.



Then enhance the program to set up the initial board and display it. Use small numbers and count the squares, to make sure everything is in the right place and size.



Then perform one averaging step, as explained in class, and display the results.



Then set up the iteration loop, but only let it iterate once. Then a few times. Then more, until it converges. Then polish and make everything look good.
Checking User Input




During initial development, you should just trust your user to enter “good” values.




Before you hand in your work, you should add input error checking to a few input values, to show that you know how. Specifically:




The CPU width and height must be positive numbers.



The CPU may not be wider or taller than the motherboard.



When the CPU width and height are entered, only good values should be accepted. If bad values are entered, then the program should loop until good data is entered.



Program Output




Your program should first print out your name and ID, and explain to the user what the program does. Then it should report problem results to the screen in the form of a well-labeled two-dimensional color plot, ( including a colorbar – see Matlab help for details. )




What to Hand In:




Your code, including a user documentation file, should be handed in electronically using Blackboard. No hard copy is required for this assignment. For this assignment your documentation file must be in MS Word or PDF format, and must include some sample images from your program.



The purpose of the documentaiton file is for the benefit of a user who would run your program, but who would not get to see the code. ( The code itself should also be well documented as well, for the benefit of the grader. )



If there are problems that you know your program cannot handle, it is best to state them in the documentation file, rather than have the TA wonder what is wrong with your program. In particular, if your program does not complete all of the steps outlined above, then you should document just exactly which portions of the project your program does accomplish.



No hard copy is required for this assignment. However you may hand in hard copy to the TA in lab if you have materials which are difficult or impossible to submit electronically. ( You may not change your solution between the electronic due date and your lab meeting time. )



Make sure that your name and your CS account name appear at the beginning of each of your files. Your program should also print this information when it runs.
Notes Regarding “Pcolor”




One of the tools you want to use on this assignment is “pcolor”, which has some interesting characteristics you should be aware of.




“shading faceted” places black lines between cells. “shading flat” does not. ( Do not use “shading interp”. )




pcolor ignores the last row and column of the data, which means an extra row and column need to be added, so that pcolor can ignore them.




The default axes on pcolor are labelled with row and column numbers.




For example, the following data matrix yielded the following plot as a starting point. ( Note that row 1 of the data appears on the top of the printed table, but at the bottom of the plotted image, and that the “extra” row and column of the data in the table ( shown in gray ) are not represented in the plot. )







data =






25
25
25
25
25
25
25
25
25
25


25




25
0
0
0
0
0
0
0
0
25


25
































25
0
0
0
0
0


50
50
0
25


25




25
0
0
0
0
0


50
50
0
25


25




25
0
0
0
0
0
0
0
0
25


25




25
0
0
0
0
0
0
0
0
25


25




25
0
0
0
0
0
0
0
0
25


25




25
25
25
25
25
25
25
25
25
25


25
































25
25
25
25
25
25
25
25
25
25
25



































Sample Output:




The following images are based on the sample problem described above. ( Motherboard 5” wide x 4” high, CPU 1.5” wide x 1.25” high, located 2” from the left edge and 1” from the bottom of the motherboard, with a CPU temperature of 50 degrees C and an ambient temperature of 25 degrees. ) Note that these samples include some optional enhancements that are not required for the basic assignment.










































































































































































































Final Image uses 20 elements / inch, flat shading, and a convergence tolerance of 1.0E-4

Optional Enhancements:




It is course policy that students may go above and beyond what is called for in the base assignment if they wish. These optional enhancements will not raise any student’s score above 100 for any given assignment, but they may make up for points lost due to other reasons.




Read the doc on pcolor( ), and figure out how to label your axes in inches instead of row and column numbers.




Put multiple plots on a single figure, using subplot( ).




Show the convergence history as a function of iteration. The examples use a semilog plot.




Do full user input checking, as opposed to only checking the CPU width and height. ( This enhancement is not worth a lot of points. )




Make use of Matlab functions, to break the overall problem down into steps that can be written and performed separately.




Experiment with different plotting options, including 3-D plots, subplots, and specialized colormaps. Remember that your goal is not to just make something that looks cool, but rather to convey the important temperature information to the circuit board designer as efficiently and effectively as possible.




Allow the user to place multiple “hot” chips on the motherboard, possibly including one or




more that are actually cooler than the ambient temperature instead of hotter ( e.g. a fan. ) Allow users to place chips at angles, or include non-rectangular geometries.




Use the program to perform comparative analyses, to determine the “best” place to put any given CPU on any given motherboard. How do you choose to define “best”? Can you get Matlab to find the “best” place for you, or do you need to run the program repeatedly and evaluate for yourself which is the “best” location? Include your results as a separate section of your memo. ( A multi-plot figure using subplot may be a good way to compare alternatives. If you determine a “value” function for determining which location is “best”, you can show the “value” of each position, possibly in a plot or chart.)




Other enhancements that you think of – Check with TA for acceptability.

More products