COMSOL Multiphysics Instruction Manual THE CITY COLLEGE OF NEW YORK MECHANICAL ENGINEERING DEPARTMENT ME 433: HEAT TRANSFER PROFESSOR LATIF M. JIJI
I. INTRODUCTION
Table of Contents
i
A Message to the Student
ii
Introduction to COMSOL Multiphysics
iii
File Naming and Saving Conventions
vii
II. CONDUCTION MODELING WITH CONSTANT HEAT TRANSFER COEFFICIENT
Fin tip insulation: effect on Qf
1
Heat loss from a rod
19
Limits of the fin approximation
35
Test chamber insulation (rectangular)
55
Test chamber insulation (circular)
69
Transient cooling of a rod
85
III. CONDUCTION AND CONVECTION MODELING
Laminar forced convection over an isothermal flat plate
101
Laminar forced convection over a heated flat plate
127
Laminar flow in a tube
155
Temperature development in tubes (Uniform Surface Temperature)
169
Temperature development in tubes (Uniform Surface Heat Flux)
185
Free convection of air over a vertical plate (Isothermal)
201
Free convection of air over a vertical plate (Heated)
225
Free convection of air over a horizontal cylinder (Isothermal)
249
Cross – flow heat exchanger
--
IV. RADIATION MODELING
Radiation in a triangular cavity
275
-i-
TABLE OF CONTENTS
TABLE OF CONTENTS
INTRODUCTION TO COMSOL MULTIPHYSICS
A MESSAGE TO THE STUDENT Dear student, Half a century ago, a great American scientist said: “The next great era of awakening of human intellect may well produce a method of understanding the qualitative content of [physical] equations”. Today, we are privileged to live in time to see this prediction begin to come true. Today’s expanding research and developing industry, scientists and engineers, experimentalists and theoreticians, and many other professional analysts who deal with complex mathematical analysis rely more and more on finite element method as a tool to solve insuperably difficult problems. With the ever increasing number – crunching power of modern computing machines, it is possible today to solve and visualize complicated physical phenomena, such as wet water flow and temperature field in steam turbines, body fluid redistribution in human organs subject to unfamiliar gravitational environments, or investigate aerodynamic performance of an entire aircraft without having to setup up an overly expensive experimental lab. Some fifty years ago, an undertaking of the above examples was simply not possible. A theoretician of those days had to have boundless imagination in order to extract information such as vortex shedding in a fluid flow past an object from the well known Navier – Stokes equations. That is what was meant by the qualitative content of the equations. Today, an undergraduate student with enough ingenuity can accurately simulate the complex vortices produced by the fluid flow on his or her notebook computer. Universities around the world have much advanced the development of different finite element techniques to attack a wide variety of technical issues. In recent times, many universities, technical institutes, and colleges have adopted programs that introduce students to this relatively new and powerful tool. Most of the institutions are doing so on the graduate level only. At City College, we would like to offer our modest attempts to introduce mechanical engineering students taking undergraduate level heat transfer course to have a first glimpse of how the finite element method may be useful.
Pavel Danilochkin – COMSOL module developer and technical writer. Latif M. Jiji – Project manager.
- ii -
INTRODUCTION TO COMSOL MULTIPHYSICS
INTRODUCTION TO COMSOL MULTIPHYSICS
The major objective of this undertaking is not to simply show you and explain how to use COMSOL Multiphysics to solve certain heat transfer problems, but that in doing so you may improve your physical intuition regarding the phenomena under study. Our textbook (with its discussions and numerous diagrams) already does a great job in meeting this objective, however, with COMSOL Multiphysics we take it a step higher. With this manual and COMSOL Multiphysics, you will compute heat transfer rates in multilayered walls, analyze solutions of transient cooling in rods and fins, see the external flow of fluids over plates and internal flows inside pipes, calculate temperature distributions and property variations of fluids under various circumstances, solve free/forced convection and radiation problems. And that is not the end of the list! It is our hope that by analyzing these problems with a rather intuitive program, you will gain a better physical insight, which in turn should make you a better scientist and/or engineer! The written manual is organized by problems. There are 15 problems in total. Your Professor will decide which and how many problems you will do during the course. Previously, the number of problems that students solved in the course ranged from 2 to 4. Each problem has a separate written instruction manual and a corresponding video tutorial. Some problems include additional files, such as MATLAB scripts, that may be needed to complete the problem. These files can either be obtained from instruction manual itself or from the Blackboard. The rest of the files (including written manuals and video tutorials) are available from Blackboard or from victordanilochkin.org/comsol. By far, the simplest way to solve the problem is by watching the video tutorial. You should, however, read the manual at least once prior or during the time when you are solving the problem. Written instructions are far more specific and often include discussions that can be beneficial to you. You should also consult your textbook prior to doing these problems to make sure that your understanding of basic concepts is cold. Written instruction manual structure adapts your textbook’s problem solving methodology. However, the form of the structure has several modifications. Written manuals for COMSOL Multiphysics are organized as follows: 1. Problem Statement – in this section, a problem that involves certain physical phenomenon (or phenomena) is described. A general learning objective is often stated in this section. Material properties, geometric dimensions, temperature conditions and other relevant specifics are given here. 2. Observations – typically, this section lists certain noticeable facts or assumptions about the problem statement from a physical standpoint. COMSOL modeling geometry is often determined and justified here. 3. Assignment – this section raises questions to be answered throughout the study of the problem. The number of mandatory questions to be answered is usually 5.
- iii -
INTRODUCTION
1. Manual Objective and Organization
INTRODUCTION TO COMSOL MULTIPHYSICS
4. INTRODUCTION
5.
6.
7.
Most problems also include extra credit questions, which are usually more difficult than the 5 mandatory questions and require more effort from the student. For your own educational good, we encourage you to attempt answering these questions. Modeling with COMSOL Multiphysics – this section gives all the instructions on how to solve and post – process the problem with COMSOL Multiphysics. This section constitutes the main bulk of the manual. Modeling with MATLAB – certain problems that need to be analyzed with MATLAB will include this section. No prior knowledge of MATLAB is assumed nor is it necessary! MATLAB is primarily used to compute theoretical solutions and make comparative plots of the solutions. Note that you are free to use other software to achieve similar results. We do encourage you to get to know MATLAB, nevertheless, as it is another invaluable computational tool in hands of a knowledgeable engineer. Verification of Results – certain problems will include a separate section for verifying COMSOL results against theoretical solutions. All problems, however, require such verification. Most of the manuals list instructions for verifications wherever sought most convenient. MATLAB Script – problems that include MATLAB analysis will also fully reprint MATLAB script at the end of the manual. This is done in case MATLAB scripts cannot be obtained by other means.
When you are done solving a problem you are asked to prepare a small report of your findings. The report should include the answers to the questions assigned and supporting data that you obtained from COMSOL Multiphysics and other software. Based on the assignment questions, please use your own judgment to decide which data to include in your report. Be aware of this idea as you solve the problems with COMSOL Multiphysics, as this will be the only time when you can save the data you want to use for the report. These reports will have a due date and must be turned in in a hardcopy format.
2. What is COMSOL Multiphysics? Simply put, it is a computer program that allows us to model and simulate a wide variety of physical phenomena. The word Multiphysics is not in the name for the kicks ! The program can tackle technical problems in many fields of science and engineering. Here are some of them: acoustics, electromagnetism, fluid dynamics and heat transfer, structural mechanics, chemical engineering, earth science, and MEMs. For a complete list of application modes (or the type of phenomena COMSOL is capable of solving), visit http://www.comsol.com/. Naturally, in the interest of our course, we are only going to use the heat transfer and fluid dynamics modes of COMSOL Multiphysics.
- iv -
INTRODUCTION TO COMSOL MULTIPHYSICS
Traditional finite element method software comes as a bound package of separate computer programs, each of which is responsible for only a part of the modeling procedure. Thus, traditionally, one program is used to create model geometry, another program is used to mesh the geometry, apply material properties and specify boundary conditions. A solver is another program that is responsible for the actual number crunching and saving of the solution. At the end, the results must be plotted in yet another program that deals with post – processing. For our purposes, such disconnected way of analyzing a problem is rather inconvenient. COMSOL Multiphysics solves this issue by being an all – in – one geometry creator and mesher, solver and post – processor. In the course of solving these problems, you will see how easy it is to switch from one traditionally separate step to another. In addition, COMSOL Multiphysics is much simpler to use than traditional finite element method software packages. (Although its geometry creating features still suffer from an underdeveloped environment) Moreover, it was designed to be a user – intuitive software. The fact that COMSOL Multiphysics is capable of analyzing our problems and that it is relatively user – friendly made it our choice.
4. Where in ME Department Can I find and use COMSOL Multiphysics? The software is installed in rooms ST – 226 and ST – 213. We advise you to use computers in room ST – 213 when you solve the problems with COMSOL Multiphysics. Computers in this room are more powerful than computers in room ST – 226. Some problems require MATLAB, which is installed in room ST – 226. MATLAB is also installed on most of the computers throughout Steinman Hall.
5. Can I install and use COMSOL Multiphysics at home? Possibly. You must first obtain a copy of the software of the same version or higher used to create these instructions. The version of the software we used to create instruction manuals is 3.5. Earlier versions of the software will have differences in their appearance and certain menu options, and may thus be somewhat incompatible with these instructions. In the mechanical engineering department, Professor P. Ganatos has a copy of COMSOL Multiphysics. If you are the first one to ask him for the software, announce it to your fellow classmates and organize a way in which you will share the software with the students after you are done installing it on your personal computer. Do not return it to Professor Ganatos before making sure that there are no other students who are willing to install it on their computers.
-v-
INTRODUCTION
3. Why COMSOL Multiphysics?
INTRODUCTION TO COMSOL MULTIPHYSICS
INTRODUCTION
When you install the software on your personal computer, setup will ask you for a license. It is possible (although we have not tested it) to request the license from the server in mechanical engineering department. You need to have an internet connection to do this from your home. Consult Professor Ganatos on how to do this step properly. He will most likely direct you to our IT specialist for further assistance. Again, try to organize yourself and your classmates so that only one or two people ask the same question to Professor Ganatos. Put yourself in his position! If 30 or so students ask the ! same question every semester …
6. There is Always Room for Improvement! In the course of solving the assigned problems, you may come up with certain suggestions to improve things a bit. These can be issues with the program, mistakes in the instructions of the manuals or even general remarks. If you find your cause beneficial to others, let your voice be heard so that proper improvements can be made. Remember that the next generation of students after you will use the same instructions and that you may be the one to have corrected certain errors. We have opened a Google – based forum to handle this aspect of the course. Each semester, one of your fellow classmates must become a moderator of forum to keep things organized. All the details about the forum, its rules of use, and how to join it are located on the following website: http://groups.google.com/group/me433-outpost.
- vi -
INTRODUCTION TO COMSOL MULTIPHYSICS
In an effort to keep things organized when it comes to trouble – shooting, we have created the following file naming conventions. Please follow these conventions when you save and/or backup your COMSOL Multiphysics (.mph) files and use them to share with other students or your Professor. This way, it is easy for us and your fellow classmates to identify your work performed on COMSOL Multiphysics. In this section, we also explain how to obtain and/or create MATLAB (.m) files from a variety of sources.
1. How to properly name and save COMSOL Multiphysics (.mph) files. Please use the following file naming convention when you save COMSOL Multiphysics (.mph) files: MN_FirstNameL_ZZZZ.mph Where,
“MN” stands for “Module Number”. Replace “MN” by the actual module number.
“FirstNameL” is to be replaced by your first name, followed by the last name initial (ex. John Smith = JohnS).
“ZZZZ” is to be replaced by the last 4 digits of your social security number (ex. 123 – 45 – 6789 = 6789).
For instance, if John Smith is working on module #3 and the last 4 digits of his social security number are 6789, he would save the file as: “3_JohnS_6789.mph”.
2. Obtaining MATLAB (.m) files. As you may already know, MATLAB (.m) files are usually text – based scripts that contain certain commands, or code to be executed by MATLAB. Most of the problems in this manual use MATLAB as an auxiliary tool to re – plot and check results from COMSOL Multiphysics. For this reasons, we have created sample scripts for you to use after solving a problem with COMSOL Multiphysics. These scripts are available from multiple sources: outpost 1. The Blackboard 2. The PDF version of this manual 3. The Google based group (http://groups.google.com/group/me433-outpost)
- vii -
INTRODUCTION
FILE NAMING AND SAVING CONVENTIONS
INTRODUCTION TO COMSOL MULTIPHYSICS
4. COMSOL video tutorial website (www.victordanilochkin.org/comsol)
INTRODUCTION
In case you still cannot obtain MATLAB scripts for some reason, there is a fifth (a most cumbersome, but also most reliable) source. Problems which use MATLAB include the sample script with them, fully reprinted in the appendix section. You will find this section at the end of each problem. At this point, we have covered most of the essential introductory remarks. We wish you good luck in simulating heat transfer problems that follow!
- viii -
Fin Tip Insulation – Effect On Qf
ME433 COMSOL INSTRUCTIONS
FIN TIP INSULATION: EFFECT ON Qf Problem Statement In this module, we will examine the extent to which insulating the tip of a fin plays a role on total heat transfer Qf. As shown in diagram 1, one end of a cylindrical fin is maintained at T0. Two cases are considered at the tip: (A) insulated tip and (B) heat transfer by convection at the tip. Heat is removed from the surface of the fin to the surroundings by convection. Assuming constant h, k, and T∞, we will compute total heat transfer, Qf, for both of the cases. We will then compare the results of the two cases with each other to make a judgment and comment on what the effect of insulating a fin tip on heat transfer rate is. Thermal and geometric parameters for the model are listed below. Known quantities:
T0 = 100 ºC T∞ = 20 ºC k = 160 W/m–ºC h = 10 W/m2–ºC
Diagram 1 – Insulated Rod L = 30 cm r0 = 0.5 cm
Observations
Since Bi << 1, we should expect negligible radial temperature variation. This means that at any point x, temperature at the center of the fin is the same (or very nearly the same) as temperature at the surface. Both equations (3.68) and (3.69) are applicable for determination of Qf.
Since r0/L << 1, the tip surface area is small when compared to cylindrical surface area of the fin. In addition, the temperature at the tip is lowest and therefore, convection at the tip is expected to be small. We should therefore expect a small difference in the total heat transfer Qf for both of the cases.
Assignment 1. Using COMSOL, show the radial temperature distribution for both cases. 2. Using COMSOL, compute the heat transfer rate Qf for both cases. 3. Compute theoretical Qf for both cases. Compare the results with those in the above question. Are COMSOL results valid? 4. Compute theoretical Qf using the corrected length parameter Lc and compare the result to Qf (theoretical) calculated for the case of convection at the tip. Do these results agree better than those in question 3? Why or why not?
-1-
Fin Tip Insulation – Effect On Qf
ME433 COMSOL INSTRUCTIONS
5. Using COMSOL and an additional software of your choice (i.e. MATLAB, Excel, …), compare temperature distribution T(x) obtained by COMSOL with the predicted theoretical distributions derived in chapter 3 of your textbook for both of the cases. Do COMSOL results agree well with the theory? A sample answer for this question using MATLAB is provided. Modeling with COMSOL Multiphysics MODEL NAVIGATOR
This is our starting point in the model where you define the very basics of the problem, such as the number of dimensions, type of coordinate system, and most importantly the application mode which agrees with the physical phenomena of the problem. We will model this problem with a 3 – dimensional cylindrical fin. Since we are not intending to look at the field flow outside the fin, we will only need to work with the Heat Transfer Module. We are also modeling the process as steady state. For this setup: 1. Start “COMSOL Multiphysics”. 2. In the “Space dimension” list select 3D (under the “New” Tab). 3. From the list of application modes select “Heat Transfer Module General Heat Transfer Steady – State Analysis” 4. Click “OK”.
-2-
Fin Tip Insulation – Effect On Qf
ME433 COMSOL INSTRUCTIONS
GEOMETRY MODELING
In this step, we will create a 3 – dimensional cylindrical geometry that will be used as a model for our problem. To do this: 1. Select “Draw Cylinder” option from menus at the top. 2. In the newly appearing “Cylinder” window, specify the cylinder “Radius” and “Height” (length) as “0.5e-2” and “30e-2”, respectively. 3. Enter “-0.5e-2” for the “y” and “z” axis base point fields. This will place the fin centered at the origin. 4. Enter “1” and “0” in the “x” and “z” axis direction vector fields, respectively. This will align the fin in the “x” direction and place the base of the fin in the “y – z” plane. 5. Click “OK”.
6. Click on “Zoom Extents” button geometry.
in the main toolbar to zoom into the
You should see your 3D fin now selected in light red color in the main program window. You can try to orbit, pan, and zoom to investigate the geometry you just made. In particular, try to explore what the following buttons do: , , , , , , , .
-3-
Fin Tip Insulation – Effect On Qf
ME433 COMSOL INSTRUCTIONS
Note: If you made errors in this step, you can still correct them. Make sure the geometry you created is shown in a light – red color in the main window, then select “Draw Object Properties” from the menus at the top. This will bring the “Cylinder” definition window back up. PHYSICS SETTINGS – CASE A: INSULATED TIP
Physics settings in COMSOL consist of two parts: (1) Subdomain settings and (2) boundary conditions. The subdomain settings let us specify fin’s material, initial conditions and modes of heat transfer (i.e. conduction and/or convection). The boundary conditions settings are used to specify what is happening at the boundaries of the geometry. Subdomain Settings: 1. From the “Physics” menu select “Subdomain Settings” (equivalently, press F8). 2. Select Subdomain 1 in the “Subdomain selection” field. 3. Enter “160” in the field for thermal conductivity k. 4. Click “OK”
Observe that COMSOL provides the governing equation for conduction on the top left corner of the Subdomain Settings window. Also, the fields for the density and heat capacity do not play a role in steady – state analysis.
-4-
Fin Tip Insulation – Effect On Qf
ME433 COMSOL INSTRUCTIONS
Boundary Conditions: 1. From the “Physics” menu open the “Boundary Settings” (F7) dialog box. 2. Apply the following boundary conditions: BOUNDARY
BOUNDARY CONDITION
COMMENTS
1
Temperature
Enter “100+273.15” in the “T0” field
2, 3, 4, 5
Heat Flux
Enter “10” in the “h” field Enter “20+273.15” in the “Tinf” field
6
Thermal Insulation
3. Click “OK” to apply and close the Boundary Settings dialogue.
Observe that: (1) by selecting the boundary numbers in the “Boundary selection” field, the selected boundaries are highlighted in red on the actual geometry of the fin; alternatively, you could have selected a boundary by clicking on the geometry itself, and (2) the types of boundaries for convection/conduction, such as heat fluxes, temperatures, or thermal insulations and more are all described mathematically in the upper part of the window. The condition for boundary 1 is the base temperature “T0”, as described in the problem definition. The “heat flux” boundary condition for boundaries 2 – 5 allows us to model conductive – convective interface at these boundaries. With “q0” equal to zero we obtain a condition that implies that conductive heat transfer is equal to convective heat transfer at those boundaries with constant h. The thermal insulation condition applied to boundary 4 (the tip) implies that there is no convective heat transfer taking place. -5-
Fin Tip Insulation – Effect On Qf
ME433 COMSOL INSTRUCTIONS
MESH GENERATION
To minimize the computational time without compromising much accuracy of the solution, we must change the default meshing parameters. To do this, 1. Select “Mesh” “Free Mesh Parameters” (F9) from the menus at the top. 2. Switch to the “Edge” tab in the new “Free Mesh Parameters” window. 3. Select edges 1, 2, 4, and 6, at the same time in the “Edge selection” field. 4. Switch to the “Distribution” tab. 5. Enable the “Constrained edge element distribution” checkbox. 6. Enter “4” as the number of edge elements. 7. Click the “Mesh Selected” button.
8. Select edge “7” in the “Edge selection” field. 9. Enable the “Constrained edge element distribution” checkbox. 10. Enter “10” as the number of edge elements. 11. Enable the “Distribution” checkbox. 12. Enter “5” as the element ratio. 13. Change the distribution method to “Exponential”. -6-
Fin Tip Insulation – Effect On Qf
ME433 COMSOL INSTRUCTIONS
14. Click the “Mesh Selected” button. 15. Click the “OK” button.
16. Switch to the boundary mode by selecting the following button:
.
17. In the main window (with the fin geometry), select the base boundary of the fin. 18. Apply the mapped boundary meshing by pressing the following button: 19. Switch to the subdomain mode by selecting the following button:
.
.
20. Apply the mapped subdomain meshing by pressing the following button:
.
Your mesh is now complete. If you did not encounter any errors in the meshing steps, it should resemble the one shown below.
We are now ready to compute and obtain the solution. -7-
Fin Tip Insulation – Effect On Qf
ME433 COMSOL INSTRUCTIONS
COMPUTING AND SAVING THE SOLUTION
In this step we define the type of analysis to be performed. We are interested in stationary analysis here, which we previously selected in the Model Navigator. Therefore, no modifications need to be made. To enable the solver, proceed with the following steps: 1. From the “Solve” menu select “Solve Problem”. (Allow few seconds for solution) 2. Save your work on desktop by choosing “File Save”. Name the file according to the naming convention given in the “Introduction to COMSOL Multiphysics” document. The result that you obtain should resemble the following boundary color map:
By default, your immediate result may be given as a slice distribution diagram instead of the boundary one shown above. The next section (Postprocessing and Visualization) will help you in obtaining the above and other diagrams, extracting temperature distribution data from the solution, and computing the heat transfer rate Qf through COMSOL).
-8-
Fin Tip Insulation – Effect On Qf
ME433 COMSOL INSTRUCTIONS
POSTPROCESSING AND VISUALIZATION
After solving the problem, we would like to be able to look at the solution. COMSOL offers us a number of different ways to look at our temperature field. In this problem we will deal with 3D color maps, heat transfer rate computation, 1D temperature distribution plots, and data extraction. We will then address the questions of COMSOL solution validity and compare the results to theoretical predictions. To do this effectively, we will need a more flexible data – plotting utility. We will use MATLAB as a choice of post – computational and plotting program to address these questions. However, if you do not feel comfortable using MATLAB, you may use the software of your choice. Obtaining the 3D Boundary Temperature Color Map: 1. From the “Postprocessing” menu open “Plot Parameters” dialog box (F12). 2. Under the “General” tab, enable the “Boundary” plot type. 3. Deselect any other plot types, except “Geometry edges” as shown below (left):
4. Change the “Plot in” option to “New Figure” using the drop – down menu. 5. Switch to “Boundary” tab. 6. Change the unit of temperature to degrees Celsius. 7. Click the “Apply” button.
-9-
Fin Tip Insulation – Effect On Qf
ME433 COMSOL INSTRUCTIONS
Clicking the “Apply” button will keep the “Plot Parameters” window open. If you have time, experiment with other plot types for a few minutes. As you look through results, notice which quantities are being plotted. After you click the “Apply” button, a separate window will pop up with the 3D temperature color map. You can still interactively orbit, zoom, and pan around the geometry. Clicking the “Default 3D View” button will show the default trimetric view of the results. Clicking the , , buttons will position the geometry of the fin with the z, x, and y axis pointing normal to the computer monitor, with the axis vector direction pointing towards the user. Clicking twice consecutively on either of these buttons will negate the axis vector direction (pointing normal to the computer monitor in a direction away from the user) Saving Color Maps: After you have selected a view that shows the results clearly, you may want to save it as an image for future discussion. This may be done as follows: 1. Click the save “ ” button in your figure with results. This will bring up an “Export Image” window. For a 4” by 6” image, acceptable image quality settings are given in the figure below. If you need higher image quality, increase the DPI value.
2. Change your “Export Image” value settings to the ones in the above figure. 3. Click the “Export” button. 4. Name and save the image. - 10 -
Fin Tip Insulation – Effect On Qf
ME433 COMSOL INSTRUCTIONS
As an example, the image shown below was processed with the same settings as above. It shows temperature distribution of the fin slice in x – y plane. The triangles represent the heat flux. The size of the triangles represents the amount of heat flux at a point.
Computing Total Heat Transfer Qf: 1. From the “Postprocessing” menu select “Boundary Integration” option. 2. Select boundaries 2 to 6 in the boundary selection field. 3. In the “Subdomain Integration” dialog window, change “Predefined Quantities” setting to “Normal total heat flux”.
4. Click the “OK” button. The value of the integral (solution) is displayed at program’s prompt on the bottom. In this case, Qf = 4.48 W.
1D Plots and Data Extraction: Data, such as T(x,0,0) can be best represented on a 1D plot. While the color maps showing temperature distribution do present numerical data, they are better suited for an overall qualitative representation. When specific quantitative data is needed, such as T(x,0,0), 1D plots should be the choice of representation. In addition, such quantitative - 11 -
Fin Tip Insulation – Effect On Qf
ME433 COMSOL INSTRUCTIONS
data representation makes it easier to compare and verify. Here, we will first plot T(x,0,0). Secondly, we will extract T(x,0,0) to a text file. To do this, 1. Select “Postprocessing Cross – Section Plot Parameters” option. 2. Switch to the “Line/Extrusion” tab. 3. Change the unit of temperature to degrees Celsius. 4. Enter “0” and “0.3” for the x0 and x1 coordinates in cross – section line data field. Enter “-0.5e-2” for y0, y1, z0, and z1 coordinate fields. 5. Click the “OK” button.
You should now get an exponentially decaying graph showing T(x,0,0). This is the temperature variation along the length of the fin at the center line. To export this data to a text file, 6. Click the export current data plot “
” button.
7. Click “Browse” and navigate to your saving folder (say “Desktop”). 8. Name the file “Tx_comsol_insulated.txt”. (Note: do not forget to type the “.txt” extension in the name of the file). Make sure you remember where you save this data file. You will need it later for analysis with MATLAB. - 12 -
Fin Tip Insulation – Effect On Qf
ME433 COMSOL INSTRUCTIONS
CASE B: NON – INSULATED TIP Prior to moving on to this case, make sure you have saved all the color maps you need and extracted the data T(x,0,0) to a text file. If you did not, finish those tasks first before you continue with case B. LOADING PREVIOUS FILE
Since this is the same problem with simple modification on one boundary, first load the model you saved earlier by double clicking on it. If you already have it open, continue by modifying its physics settings. PHYSICS SETTINGS
Boundary Conditions: Simple boundary modification is needed for enabling convection at the tip of the fin. To do this, 1. Press F7 to load the “Boundary Settings” window. 2. Select boundary 6 in the “Boundary selection” field. 3. Change the “Boundary condition” to “Heat flux”. 4. Enter these quantities in their appropriate fields: h = 10, Tinf = 20 + 273.15. 5. Click the “OK” button.
- 13 -
Fin Tip Insulation – Effect On Qf
ME433 COMSOL INSTRUCTIONS
RECOMPUTING
1. From the “Solve” menu select “Solve Problem”. Allow a few seconds for the computation. POSTPROCESSING
As you probably can see from the 3D color map for this case, there is hardly any difference when compared to case A. It is hard to note quantitative differences from these color maps. We will therefore use COMSOL to just compute the total heat transfer qf and extract the COMSOL T(x,0,0) data to a text file. The procedures for doing this are the same as in case A. 1. Follow the same procedure as in case A to find the total heat transfer Qf. Start from page 11, section on “Computing the total heat transfer Qf”. The COMSOL value of Qf for case B (non – insulated tip) is about q = 4.495 W. 2. Extract the COMSOL T(x,0,0) data to a text file for this case. Name the file “Tx_comsol_non_insulated.txt” and save it in the same location that where you saved your data for case A. Make sure you have and know where you save these files as you will need them for further analysis. With the amount of data gathered by this time, you are in a position to answer the questions posed in the “Assignment” section on page 1. A sample for question 5 using MATLAB script is provided in the Appendix. You are advised to use this sample to answer question 5. This completes COMSOL modeling procedures for this problem.
- 14 -
Fin Tip Insulation – Effect On Qf
ME433 COMSOL INSTRUCTIONS
Modeling with MATLAB This part of modeling procedures describes how to create comparative T(x) using MATLAB. Obtain the file named “effect_of_insulating_fin_tip.m” from Blackboard prior to following these procedures. Important: save this file in the same directory where you saved your 2 COMSOL data files. (Note: “effect_of_insulating_fin_tip.m” file is attached to the PDF version of this document as well. To access the file directly from this document, select “View Navigation Panels Attachements” and then save “effect_of_insulating_fin_tip.m” in the same directory where you saved your 2 COMSOL data files). In case you cannot obtain “effect_of_insulating_fin_tip.m” file from the above sources, it is also fully reprinted in this appendix. Comparing COMSOL Solution with the Fin Heat Equation Solution Now we are ready to load and graph our COMSOL data in MATLAB and compare it with the fin heat equation solution. Follow the steps below to complete this problem: 1. Open MATLAB by double clicking its icon
on the Desktop.
2. Load “effect_of_insulating_fin_tip.m” file by selecting “File Open [%Your Selected Saving Directory%] effect_of_insulating_fin_tip.m”. The script program responsible for COMSOL data import and data comparison will appear in a new window. 3. Press F5 to run the script. MATLAB editor will display a warning message. Click “Change Directory” to run the script. If there are no errors in the process, you will be presented with 3 plots showing temperature distribution comparisons. Theoretical heat transfer rates for both of the cases will be displayed in the main Command Window in MATLAB. Save these results for your module report. Results Plotted with MATLAB
- 15 -
Fin Tip Insulation – Effect On Qf
ME433 COMSOL INSTRUCTIONS
- 16 -
Fin Tip Insulation – Effect On Qf
ME433 COMSOL INSTRUCTIONS
APPENDIX
MATLAB script If you could not obtain this script from the Blackboard or the PDF file, you may copy it from here into notepad and save it in the same directory where you saved your 2 COMSOL data files. You will most likely get hard – to – spot syntax errors if you copy the script this way. It is therefore highly advised that you use the other 2 methods on obtaining this script instead of the copying method. % ###################################################### % ME 433 - Heat Transfer % Sample MATLAB Script For COMSOL Module: % (X) INSULATING FIN TIP: EFFECT ON qf % IMPORTANT: Save this file in the same folder with your % "Tx_comsol_insulated.txt" and % "Tx_comsol_non_insulated.txt" files. % ###################################################### % clc; % Clears the UI prompt clear; % Clears variables from memory % %% Constant Quantities k = 160; % Fin's Conductivity, [W/m-K] h = 10; % Heat Tranf. Coeff. at fin's surface, [W/m^2-K] r = 0.005; % Fin's radius, [m] L = 0.3; % Fin's length, [m] C = 2*pi*r; % Fin's circumference, [m] Ac = pi*r^2; % Fin's conduction area, [m^2] m = (h*C/(k*Ac))^(1/2); % Fin parameter, [1/m] To = 100; % Base temperature, [degC] Tinf = 20; % Ambient temperature, [degC] %% Case A: Insulated Tip % Computing Theoretical qf and T(x): qf_a = (k*Ac*C*h)^(1/2)*(To - Tinf)*tanh(m*L); % Fin's Heat Transfer Rate, [W] disp('Theoretical qf (case A), [in Watts] = '); disp(qf_a); % Displaying Theor. qf, [W] x = 0:.01:L; % x - coordinate discritization, [m] Tx_a = cosh(m*(L - x))./(cosh(m*L))*(To - Tinf) + Tinf; % T(x) for the above Fin, [degC] % Loading and extracting COMSOL results for T(x,0,0) load Tx_comsol_insulated.txt; % loads COMSOL text data file into memory comsol_coords_a = Tx_comsol_insulated(:,1); % extracts COMSOL x - axis coordinates, [m] comsol_coords_a = comsol_coords_a(1:200,1); % deletes extraneous data Tx_comsol_a = Tx_comsol_insulated(:,2); % extracts COMSOL T(x,0,0), [degC] Tx_comsol_a = Tx_comsol_a(1:200,1); % deletes extraneous data % Plotting Theoretical T(x) and COMSOL T(x,0,0) figure1 = figure('InvertHardcopy','off',... 'Colormap',[1 1 1 ],... 'Color',[1 1 1]); plot(x,Tx_a,'r+'); hold on plot(comsol_coords_a,Tx_comsol_a,'k') legend('Equation [3.82]','COMSOL Solution') box off xlabel('x, (m)') ylabel('Temperature, (deg C)') set(get(gca,'YLabel'),... 'fontsize', 20,... 'FontName','Times New Roman',... 'FontAngle','italic') set(get(gca,'XLabel'),... 'fontsize', 20,... 'FontName','Times New Roman',... 'FontAngle','italic') %% CASE B: Convection at the Tip of the Fin
- 17 -
%\ % | -> Setting up the figure %/ % Plotting theor. T(x) % Freezing the figure % Plotting COMSOL T(x,0,0) %\ % | % | % | % | % | % | -> Cosmetics % | % | % | % | %/
Fin Tip Insulation – Effect On Qf
ME433 COMSOL INSTRUCTIONS
% Computing Theoretical qf and T(x): term1 = (sinh(m*L) + (h/(m*k))*cosh(m*L))/(cosh(m*L) + (h/(m*k))*sinh(m*L)); qf_b = (k*Ac*C*h)^(1/2)*(To - Tinf)*term1; % Fin's Heat Transfer Rate, [W] disp('Theoretical qf (case B), [in Watts] = '); disp(qf_b); % Displaying Theor. qf, [W] term2 = (cosh(m*(L - x)) + (h/(m*k))*sinh(m*(L - x)))./(cosh(m*L) + (h/(m*k))*sinh(m*L)); Tx_b = term2*(To - Tinf) + Tinf; % T(x) for the above Fin, [degC] % Loading and extracting COMSOL results for T(x,0,0) load Tx_comsol_non_insulated.txt; % loads COMSOL text data file into memory comsol_coords_b = Tx_comsol_non_insulated(:,1); % extracts COMSOL x - axis coordinates, [m] comsol_coords_b = comsol_coords_b(1:200,1); % deletes extraneous data Tx_comsol_b = Tx_comsol_non_insulated(:,2); % extracts COMSOL T(x,0,0), [degC] Tx_comsol_b = Tx_comsol_b(1:200,1); % deletes extraneous data % Plotting Theoretical T(x) and COMSOL T(x,0,0) figure2 = figure('InvertHardcopy','off',... %\ 'Colormap',[1 1 1 ],... % | -> Setting up the figure 'Color',[1 1 1]); %/ plot(x,Tx_b,'r+'); % Plotting theor. T(x) hold on % Freezing the figure plot(comsol_coords_b,Tx_comsol_b,'k') % Plotting COMSOL T(x,0,0) legend('Equation [3.80]','COMSOL Solution') %\ box off % | xlabel('x, (m)') % | ylabel('Temperature, (deg C)') % | set(get(gca,'YLabel'),... % | 'fontsize', 20,... % | 'FontName','Times New Roman',... % | -> Cosmetics 'FontAngle','italic') % | set(get(gca,'XLabel'),... % | 'fontsize', 20,... % | 'FontName','Times New Roman',... % | 'FontAngle','italic') %/ %% Comprehensive Plot figure3 = figure('InvertHardcopy','off',... %\ 'Colormap',[1 1 1 ],... % | -> Setting up the figure 'Color',[1 1 1]); %/ plot(comsol_coords_a,Tx_comsol_a,comsol_coords_b,Tx_comsol_b) hold on plot(x,Tx_a,'+',x,Tx_b,'+') legend('COMSOL Solution (case A)','COMSOL Solution (case B)',... 'Equation [3.82]','Equation [3.80]') %\ box off % | xlabel('x, (m)') % | ylabel('Temperature, (deg C)') % | set(get(gca,'YLabel'),... % | 'fontsize', 20,... % | -> Cosmetics 'FontName','Times New Roman',... % | 'FontAngle','italic') % | set(get(gca,'XLabel'),... % | 'fontsize', 20,... % | 'FontName','Times New Roman',... % | 'FontAngle','italic') %/
This completes MATLAB modeling procedures for this problem.
- 18 -
Heat Loss From A Rod
ME433 COMSOL INSTRUCTIONS
HEAT LOSS FROM A ROD Problem Statement In this module, we will examine the situation in which the heat loss from a steel rod is insufficient. The rod is attached to a steam pipe at one end and is insulated on the other end. The cylindrical surface loses heat to the surroundings by convection. The length of the rod is L. To increase the heat loss, one engineer recommended increasing the length of the rod. We will carry out a COMSOL study to evaluate the effect of increasing the length of the rod on the rate of heat transfer qf. Ultimately, we wish to construct a plot of heat loss rate qf vs. rod length L as the length is increased from L to 2L. Diagram 1 – Cylindrical Rod
Known quantities: L = 25 cm L 50 cm T0 = 80 ºC d = 0.2 cm T∞ = 24 ºC 2 h = 8 W/m –ºC k = steel
h T d To
L
Use the appendices in your textbook for the properties of materials considered.
Observations
Since Bi << 1, we should expect negligible axial temperature variation. This means that at any point x, temperature at the center of the fin is the same (or very nearly the same) as temperature at the surface. Both equations (3.68) and (3.69) are applicable for determination of qf.
Intuitively speaking, increasing the length L of the rod will also increase its surface area in proportion, which should, presumably, increase the rate of heat loss. Nevertheless, the temperature difference T – T∞ is also a factor in determination of qf. Given that h and k are fixed, if T – T∞ is small enough, increasing the length of the rod may not contribute to the increase of qf. However, we do not have knowledge of just how small T – T∞ should be to cause no significant change in the value of qf as L is increased. 0
0
0
- 19 -
Heat Loss From A Rod
ME433 COMSOL INSTRUCTIONS
Assignment 1. Using COMSOL, show the axial temperature distribution color map. 2. Using COMSOL, compute the heat transfer rate qf for at least 5 lengths of the rod. 3. Compute theoretical qf for at least 5 cases (using the same L’s for the cases in question 2). Compare the results with those in the above question. Are COMSOL results valid? 4. Using an additional software of your choice (i.e. MATLAB, Excel, …), construct a plot showing theoretical qf and qf obtained from COMSOL vs. L. Comment on the effect of increasing the length of the rod on the rate of heat transfer qf. A sample answer for this question using MATLAB is provided. 5. Compute fin efficiency, ηf, for L = 25 cm and L = 50 cm. Validate your comment in question 4 in light of this computation. Based on heat transfer considerations, would it be wise to follow the engineer’s suggestion? Besides heat transfer, what other considerations might pose issues? 6. [Extra Credit]: Optimize ηf with respect to L. What L would you recommend for the same values of h, k and d used in this problem? Use practical judgment.
- 20 -
Heat Loss From A Rod
ME433 COMSOL INSTRUCTIONS
Modeling with COMSOL Multiphysics MODEL NAVIGATOR
This is our starting point in the model where you define the very basics of the problem, such as the number of dimensions, type of coordinate system, and most importantly the application mode which agrees with the physical phenomena of the problem. We will model this problem with a 3 – dimensional cylindrical fin. Since we are not intending to look at the field flow outside the fin, we will only need to work with the Heat Transfer Module. We are also assuming the process to be in steady state. For this setup: 1. Start “COMSOL Multiphysics”. 2. In the “Space dimension” list select 3D (under the “New” Tab). 3. From the list of application modes select “Heat Transfer Module General Heat Transfer Steady – State Analysis”. 4. Click “OK”.
- 21 -
Heat Loss From A Rod
ME433 COMSOL INSTRUCTIONS
GEOMETRY MODELING
In this step, we will create a 3 – dimensional cylindrical geometry that will be used as a model for our problem. To do this: 1. Select “Draw Cylinder” option from menus at the top. 2. In the newly appearing “Cylinder” window, specify cylinder’s “Radius” and “Height” (length) as “0.1e-2” and “25e-2”, respectively. 3. Enter “1” and “0” in the “x” and “z” axis direction vector fields, respectively. This will align the fin in the “x” direction and place the base of the fin in the “y – z” plane. 4. Click “OK”.
5. Click on “Zoom Extents” button geometry.
in the main toolbar to zoom into the
You should see your 3D fin now selected in light red color in the main program window. You can try to orbit, pan, and zoom to investigate the geometry you just made. In particular, try to explore what the following buttons do: , , , , , , , .
- 22 -
Heat Loss From A Rod
ME433 COMSOL INSTRUCTIONS
Note: If you made errors in this section, you can still correct them. Make sure the geometry you created is shown in a light – red color in the main window, then select “Draw Object Properties” from the menus at the top. This will bring the “Cylinder” definition window back up. PHYSICS SETTINGS
Physics settings in COMSOL consist of two parts: (1) Subdomain settings and (2) boundary conditions. The subdomain settings let us specify fin’s material, initial conditions and modes of heat transfer (i.e. conduction and/or convection). The boundary conditions settings are used to specify what is happening at the boundaries of the geometry. Subdomain Settings: 1. From the “Physics” menu select “Subdomain Settings” (equivalently, press F8). 2. Select Subdomain 1 in the “Subdomain selection” field. 3. Enter “43” in the field for thermal conductivity k. 4. Click “OK”
Observe that COMSOL provides the governing equation for conduction on the top left corner of the Subdomain Settings window. Also, the fields for the density and heat capacity do not play a role in steady – state analysis.
- 23 -
Heat Loss From A Rod
ME433 COMSOL INSTRUCTIONS
Boundary Conditions: 1. From the “Physics” menu open the “Boundary Settings” (F7) dialog box. 2. Apply the following boundary conditions: BOUNDARY
BOUNDARY CONDITION
COMMENTS
1
Temperature
Enter “80+273.15” in the “T0” field
2, 3, 4, 5
Heat Flux
Enter “8” in the “h” field Enter “24+273.15” in the “Tinf” field
6
Thermal Insulation
3. Click “OK” to apply and close the Boundary Settings dialogue.
Observe that: (1) by selecting the boundary numbers in the “Boundary selection” field, the selected boundaries are highlighted in red on the actual geometry of the fin; alternatively, you could have selected a boundary by clicking on the geometry itself, and (2) the types of boundaries for convection/conduction, such as heat fluxes, temperatures, or thermal insulations and more are all described mathematically in the upper part of the window. The condition for boundary 1 is the base temperature “T0”, as described in the problem statement. The “heat flux” boundary condition for boundaries 2 – 5 allows us to model conductive – convective interface at these boundaries. With “q0” equal to zero we obtain a condition that implies that conductive heat transfer is equal to convective heat transfer at those boundaries with constant h. The thermal insulation condition applied to boundary 4 (the tip) implies that there is no convective heat transfer taking place. - 24 -
Heat Loss From A Rod
ME433 COMSOL INSTRUCTIONS
MESH GENERATION
To minimize the computational time without compromising much accuracy of the solution, we must change the default meshing parameters. To do this, 1. Select “Mesh” “Free Mesh Parameters” (F9) from the menus at the top. 2. Switch to the “Edge” tab in the newly appearing “Free Mesh Parameters” window. 3. Select edges 1, 2, 4, and 6, at the same time in the “Edge selection” field. 4. Switch to the “Distribution” tab. 5. Enable the “Constrained edge element distribution” checkbox. 6. Enter “4” as the number of edge elements. 7. Click the “Mesh Selected” button.
8. Select edge “7” in the “Edge selection” field. 9. Enable the “Constrained edge element distribution” checkbox. 10. Enter “30” as the number of edge elements. 11. Enable the “Distribution” checkbox. 12. Enter “5” as the element ratio. 13. Change the distribution method to “Exponential”. - 25 -
Heat Loss From A Rod
ME433 COMSOL INSTRUCTIONS
14. Click the “Mesh Selected” button. 15. Click the “OK” button.
16. Switch to the boundary mode by selecting the following button:
.
17. In the main window (with the fin geometry), select the base boundary of the fin. 18. Apply the mapped boundary meshing by pressing the following button: 19. Switch to the subdomain mode by selecting the following button:
.
.
20. Apply the mapped subdomain meshing by pressing the following button:
.
Your mesh is now complete. If you did not encounter any errors in the meshing steps, it should resemble the one shown below.
We are now ready to compute and obtain the solution. - 26 -
Heat Loss From A Rod
ME433 COMSOL INSTRUCTIONS
COMPUTING AND SAVING THE SOLUTION
In this step we define the type of analysis to be performed. We are interested in stationary analysis here, which we previously selected in the Model Navigator. Therefore, no modifications need to be made. To enable the solver, proceed with the following steps: 1. From the “Solve” menu select “Solve Problem”. (Allow few seconds for solution) 2. Save your work on desktop by choosing “File Save”. Name the file according to the naming convention given in the “Introduction to COMSOL Multiphysics” document. The result that you obtain should resemble the following boundary color map:
By default, your immediate result may be given as a slice distribution diagram instead of the boundary one shown above. The next section (Postprocessing and Visualization) will help you in obtaining the above diagram and computing the heat transfer rate qf through COMSOL).
- 27 -
Heat Loss From A Rod
ME433 COMSOL INSTRUCTIONS
POSTPROCESSING AND VISUALIZATION
After solving the problem, we would like to be able to look at the solution. COMSOL offers us a number of different ways to look at our temperature (and other) fields. In this problem we will deal with 3D color maps and heat transfer rate computation. We will then address the questions of COMSOL solution validity and compare the results to theoretical predictions. To do this effectively, we will need a more flexible data – plotting utility. We will use MATLAB as a choice of post – computational and plotting program to address these questions. However, if you do not feel comfortable using MATLAB, you may use the software of your choice. Obtaining the 3D Boundary Temperature Color Map: 1. From the “Postprocessing” menu open “Plot Parameters” dialog box (F12). 2. Under the “General” tab, enable the “Boundary” plot type. 3. Deselect any other plot types, except “Geometry edges” as shown below (left):
4. Change the “Plot in” option to “New Figure” using the drop – down menu. 5. Switch to “Boundary” tab. 6. Change the unit of temperature to degrees Celsius. 7. Click the “Apply” button.
- 28 -
Heat Loss From A Rod
ME433 COMSOL INSTRUCTIONS
Clicking the “Apply” button will keep the “Plot Parameters” window open. If you have time, experiment with other plot types for a few minutes. As you look through results, notice which quantities are being plotted. After you click the “Apply” button, a separate window will pop up with the 3D temperature color map. You can still interactively orbit, zoom, and pan around the geometry. Clicking the “Default 3D View” button will show the default trimetric view of the results. Clicking , , buttons will position the geometry of the fin with the z, x, and y axis pointing normal to the computer monitor, respectively, with the axis vector direction pointing towards the user. Clicking twice consecutively on either of these buttons will negate the axis vector direction (pointing normal to the computer monitor in a direction away from the user) Saving Color Maps: After you have selected a view that shows the results clearly, you may want to save it as an image for future discussion. This may be done as follows: 1. Click the save “ ” button in your figure with results. This will bring up an “Export Image” window. For a 4” by 6” image, acceptable image quality settings are given in the figure below. If you need higher image quality, increase the DPI value.
2. Change your “Export Image” value settings to the ones in the above figure. 3. Click the “Export” button. 4. Name and save the image. - 29 -
Heat Loss From A Rod
ME433 COMSOL INSTRUCTIONS
As an example, the image shown below was processed with the same settings as above. It shows temperature distribution of the fin slice in x – y plane.
Computing Total Heat Transfer qf: 1. From the “Postprocessing” menu select “Boundary Integration” option. 2. Select boundaries 2 – 6 in the boundary selection field. 3. In the “Subdomain Integration” dialog window, change “Predefined Quantities” setting to “Normal total heat flux”.
4. Click the “OK” button. The value of the integral (solution) is displayed at program’s prompt on the bottom. In this case, qf = 0.1437 W.
Note the value of the total heat flux qf. This is the value when the length of the rod is L = 25 cm. We will now gradually increase the length of the rod to 2L. To do this, let’s select 5 cm increments. In other words, we will resolve the problem for the following lengths of the rod: 25, 30, 35, 40, 45, and 50 cm. Recall that our goal is to obtain the total heat transfer rate (the procedure is shown above in steps 1 – 4) for each of these cases. Therefore, it is a good idea for you to start tabulating these values along the way. We will
- 30 -
Heat Loss From A Rod
ME433 COMSOL INSTRUCTIONS
then construct a graph of qf versus the length L of the rod to see if there is a significant effect on enhancing qf. Since the procedure for this recalculation is the same for each of the cases, we will only do one case here for demonstrative purposes. Use this procedure to complete the other cases on your own. GEOMETRY REARRANGEMENTS
To change L from 25 cm to 30 cm, we need to go back to geometry settings. Note that this change will not affect boundary conditions. Thus, no changes will need to be made for the boundary settings. Nevertheless, the current mesh settings will be affected. Thus, we will need to apply custom meshing for each of the cases as was done on pages 25 – 26. We start by rearranging the geometry as follows: 1. Go back to the geometry modeling by clicking the “Draw mode” button located in the upper toolbar. 2. Select the “CYL1” geometry by clicking on it in the main drawing area. The geometry should now be highlighted in light red color. 3. Select “Draw Object Properties” from the menus at the top. This will bring the “Cylinder” definition window up. 4. Change the “Height” value to “0.3”. 5. Click the “OK” button.
6. Click on “Zoom Extents” button geometry.
in the main toolbar to re – center the
- 31 -
Heat Loss From A Rod
ME433 COMSOL INSTRUCTIONS
Unfortunately, the custom mesh settings have been altered by the above steps. To obtain the mesh used previously, follow the steps on pages 25 – 26. Once you have created the mesh, 7. Resolve the problem by selecting the “Solve Problem” from “Solve” menu. Repeat the “Computing Total Heat Transfer qf” section on page 30. Note the value you compute of total heat transfer rate qf for this configuration. Then, repeat the steps for geometry rearrangements for all the other increments. Make a table listing the total heat transfer rate qf versus the length of the rod L. With the amount of data gathered by this time, you are in a position to answer the questions posed in the “Assignment” section on page 20. A sample for question 4 using MATLAB script is provided in the Appendix. You are advised to use this sample to answer question 5.
This completes COMSOL modeling procedures for this problem.
- 32 -
Heat Loss From A Rod
ME433 COMSOL INSTRUCTIONS
Modeling with MATLAB This part of modeling procedures describes how to create comparative T(x) using MATLAB. Obtain the file named “heat_loss_from_rod.m” from Blackboard prior to following these procedures. (Note: “heat_loss_from_rod.m” file is attached to the PDF version of this document as well. To access the file directly from this document, select “View Navigation Panels Attachements” and then save “heat_loss_from_rod.m” on your desktop). In case you cannot obtain “heat_loss_from_rod.m” file from the above sources, it is also fully reprinted in this appendix. Comparing COMSOL Solution with the Fin Heat Equation Solution Now we are ready to load and graph our COMSOL data in MATLAB and compare it with the fin heat equation solution. Follow the steps below to complete this problem: 1. Open MATLAB by double clicking its icon
on the Desktop.
2. Load “heat_loss_from_rod.m” file by selecting “File Open [%Your Selected Saving Directory%] heat_loss_from_rod.m”. The script program responsible for manual COMSOL data entry and comparison will appear in a new window. 3. Press F5 to run the script. MATLAB editor will display a warning message. Click “Change Directory” to run the script. 4. Enter the values of qf, separated by comas and in square brackets, from the table you recorded earlier in MATLAB prompt.
5. Hit the enter key on your keyboard. If there are no errors in the process, you will be presented with 1 plot showing qf vs. L as L varies from 25 cm – 50 cm. Theoretical and COMSOL heat transfer rates are both displayed in this plot. Save these results for your module report.
- 33 -
Heat Loss From A Rod
ME433 COMSOL INSTRUCTIONS
APPENDIX
MATLAB script If you could not obtain this script from the Blackboard or the PDF file, you may copy it here, paste into notepad and save it in the same directory where you saved your 2 COMSOL data files. You will most likely get hard – to – spot syntax errors if you copy the script this way. It is therefore highly advised that you use the other 2 methods on obtaining this script instead of the copying method. % ###################################################### % ME 433 - Heat Transfer % Sample MATLAB Script For COMSOL Module: % (X) HEAT LOSS FROM A ROD % ###################################################### % clc; % Clears the UI prompt clear; % Clears variables from memory % %% Constant Quantities k = 43; % Fin's Conductivity, [W/m-K] h = 8; % Heat Tranf. Coeff. at fin's surface, [W/m^2-K] r = 0.001; % Fin's radius, [m] L = 0.25:.01:0.5; % Fin's length vector, [m] C = 2*pi*r; % Fin's circumference, [m] Ac = pi*r^2; % Fin's conduction area, [m^2] m = (h*C/(k*Ac))^(1/2); % Fin parameter, [1/m] To = 80; % Base temperature, [degC] Tinf = 24; % Ambient temperature, [degC] %% Insulated Tip % Computing Theoretical qf and T(x): qf_t = (k*Ac*C*h)^(1/2)*(To - Tinf)*tanh(m.*L); % Fin's Heat Transfer Rate, [W] % User prompt entry code for the COMSOL values of qf: qf_c = input('ENTER COMSOL qf values (Separated by comas) = '); L_c = [.25,.3,.35,.4,.45,.5]; % Evaluated COMSOL length entries, [m] % Plotting Theoretical Qf and COMSOL Qf vs. L: figure1 = figure('InvertHardcopy','off',... %\ 'Colormap',[1 1 1 ],... % | -> Setting up the figure 'Color',[1 1 1]); %/ plot(L,qf_t); % Plotting theor. qf hold on % Freezing the figure plot(L_c,qf_c,'r+') % Plotting COMSOL qf legend('Equation [3.83]','COMSOL Solution') %\ box off % | xlabel('x, (m)') % | ylabel('q_f, (W)') % | set(get(gca,'YLabel'),... % | 'fontsize', 20,... % | 'FontName','Times New Roman',... % | -> Cosmetics 'FontAngle','italic') % | set(get(gca,'XLabel'),... % | 'fontsize', 20,... % | 'FontName','Times New Roman',... % | 'FontAngle','italic') %/
This completes MATLAB modeling procedures for this problem.
- 34 -
Limits of the Fin Approximation
ME433 COMSOL INSTRUCTIONS
LIMITS OF THE FIN APPROXIMATION Problem Statement In this module, our main goal is to demonstrate the validity of the fin approximation and its limitations. In particular, we wish to verify that simplifications in analysis leading to the fin approximation become not valid when Bi > 0.1. The setup, shown in diagram 1, is as follows: one end (the base) of a uniform cylindrical rod is maintained at T0 and the other is insulated (the tip). The cylindrical surface exchanges heat with the surrounding fluid by convection. We will carry out a COMSOL study to visualize the 2D steady state temperature distribution in this fin for 5 distinct cases of h (given below). Using the obtained visual cues and the knowledge of Biot number, we will conclude in which of the 5 cases the fin approximation would fail. Diagram 1 – Insulated Rod
Known quantities: L = 25 cm T0 = 200 ºC r0 = 2.5 cm T = 20 ºC k = pyroceramic glass h = 0.08, 0.8 8, 80, 800 W/m2–ºC
Use the appendices in your textbook for the properties of material considered.
Observations
Since Biot number depends on the heat transfer coefficient h, the 5 fin cases considered above have different Biot numbers associated with them. Therefore, we should expect the fin approximation deviate from the exact analysis in the cases when Bi > 0.1. For the cases where Bi << 0.1, the fin approximation should be accurate.
Since we are only interested in cross – sectional temperature distribution along the fin, building a 2D COMSOL model is sufficient for this case.
One of the model parameters (the heat transfer coefficient h) changes. We will use this observation as an advantage in our model and build a simple parametric – study model.
- 35 -
Limits of the Fin Approximation
ME433 COMSOL INSTRUCTIONS
Assignment 1. What three parameters play a role in the assumption of the fin approximation that temperature variation in the lateral direction is negligible? 2. Calculate the Biot number for each h. 3. Using COMSOL, show the temperature distribution color maps for 5 different heat transfer coefficients specified above. 4. Use COMSOL solution to compare surface to center temperature of the 5 cases for all x along the fin. Produce a single graph that plots COMSOL T(x, 0) and T(x, r0) for all of the cases considered. [Note: In this instruction set, part of this assignment question will be done with MATLAB, but you are free to use any software of your choice] 5. Produce graphs which plot COMSOL center to surface temperature difference ΔT for all of the cases considered. For which Biot numbers is ΔT within 5 degrees of difference? For which Biot numbers is ΔT beyond 5 degrees of difference? [Note: In this instruction set, part of this assignment question will be done with MATLAB, but you are free to use any software of your choice] 6. Compare COMSOL center temperature solution T(x, 0) with analytical solution for fin temperature given by equation 3.82. Produce a single graph that plots COMSOL T(x, 0) and analytic T(x) for all of the cases considered. [Note: In this instruction set, part of this assignment question will be done with MATLAB, but you are free to use any software of your choice] 7. Perform simple error analysis between COMSOL center temperature data T(x, 0) and analytic temperature T(x) for all of the cases considered. Assume that analytic temperature T(x) given by equation 3.82 is correct. Make plots showing the error. [Note: In this instruction set, part of this assignment question will be done with MATLAB, but you are free to use any software of your choice] 8. Based on your answers to questions 4 – 5, which of the 3 cases should not be analyzed using the fin approximation approach and why not? Which if the cases could be analyzed using the fin approximation approach? 9. Based on your answers to questions 6 – 7, which of the 3 cases should not be analyzed using the fin approximation approach and why not? Which if the cases could be analyzed using the fin approximation approach?
- 36 -
Limits of the Fin Approximation
ME433 COMSOL INSTRUCTIONS
Modeling with COMSOL Multiphysics MODEL NAVIGATOR
This is our starting point in the model where you define the very basics of the problem, such as the number of dimensions, type of coordinate system, and most importantly the application mode which agrees with the physical phenomena of the problem. We will model this problem with a 2D rectangular geometry. Since we are not intending to look at the field flow outside the fin, we will only need to work with the Heat Transfer Module. We are also assuming the process to be in steady state. For this setup: 1. Start “COMSOL Multiphysics”. 2. In the “Space dimension” list select 2D (under the “New” Tab). 3. From the list of application modes select “Heat Transfer Module General Heat Transfer Steady – State Analysis” 4. Click “OK”.
- 37 -
Limits of the Fin Approximation
ME433 COMSOL INSTRUCTIONS
OPTIONS AND SETTINGS: DEFINING CONSTANTS
In this part, we will define certain constants that we will use in the steps to follow. In general, this step is optional. However, COMSOL gives us a neat way of tracking all of our constants in one window. In a complex model with many constants and parameters, it is a good idea to keep things as much organized as possible. 1. From the “Options” menu select “Constants”, and in the resulting dialog box define the following names and expressions; when done, click “OK”: NAME
EXPRESSION
VALUE
DESCRIPTION
d
2*2.5e-2[m]
0.05[m]
L
25e-2[m]
0.25[m]
Fin length
T_0
200 + 273.15[K]
473.15[K]
Base Temperature
T_inf
20 + 273.15[K]
293.15[K]
Ambient Temperature
k_0
4[W/(m*K)]
4[W/(m·K)]
h_0
8[W/(m^2*K)]
8[W/(m ·K)]
2
Fin diameter
Glass conductivity Heat Transf. Coeff.
COMSOL automatically determines correct units under the “Value” column. If it does not, you are most likely entering wrong expressions. Carefully check the expression you typed and make corrections, if necessary. The description column is optional and can be left blank. It is presented here to give a short description of the constants. GEOMETRY MODELING
In this step, we will create a 2D rectangle that we will use as a model for our problem. We will use the dimensions (“d” and “L”) of the fin which we defined previously in “Constants”. To do this, 1. Select “Draw Specify Objects Rectangle” from the menus at the top. 2. Enter dimensions “L” and “d” for the width and height, respectively. 3. Enter “-d/2” for the y – base coordinate. 4. Click “OK”.
5. Use the “Zoom Extents” button
in the main toolbar to zoom into the geometry. - 38 -
Limits of the Fin Approximation
ME433 COMSOL INSTRUCTIONS
PHYSICS SETTINGS
Physics settings in COMSOL consist of two parts: (1) Subdomain settings and (2) boundary conditions. The subdomain settings let us specify fin’s material, initial conditions and modes of heat transfer (i.e. conduction and/or convection). The boundary conditions settings are used to specify what is happening at the boundaries of the geometry. Subdomain Settings: 1. From the “Physics” menu select “Subdomain Settings” (equivalently, press F8). 2. Select Subdomain 1 in the “Subdomain selection” field. 3. Enter “k_0” in the field for thermal conductivity k. 4. Click “OK”.
Observe that COMSOL provides the governing equation for conduction on the top left corner of the Subdomain Settings window. Also, the fields for the density and heat capacity do not play a role in steady – state analysis. Boundary Conditions: 1. From the “Physics” menu open the “Boundary Settings” (F7) dialog box.
- 39 -
Limits of the Fin Approximation
ME433 COMSOL INSTRUCTIONS
2. Apply the following boundary conditions: BOUNDARY
BOUNDARY CONDITION
COMMENTS
1
Temperature
Enter “T_0” in the “T0” field
2, 3
Heat Flux
Enter “h_0” in the “h” field Enter “T_inf” in the “Tinf” field
4
Thermal Insulation
3. Click “OK” to apply and close the Boundary Settings dialogue.
Observe that: (1) by selecting the boundary numbers in the “Boundary selection” field, the selected boundaries are highlighted in red on the actual geometry of the fin; alternatively, you could have selected a boundary by clicking on the geometry itself, and (2) the types of boundaries for convection/conduction, such as heat fluxes, temperatures, or thermal insulations and more are all described mathematically in the upper part of the window. The condition for boundary 1 is the base temperature “T0”, as described in the problem statement. The “heat flux” boundary condition for boundaries 2 and 3 allows us to model conductive – convective interface at these boundaries. With “q0” equal to zero we obtain a condition that implies that conductive heat transfer is equal to convective heat transfer at those boundaries with constant h. The thermal insulation condition applied to boundary 4 (the tip) implies that there is no convective heat transfer taking place.
- 40 -
Limits of the Fin Approximation
ME433 COMSOL INSTRUCTIONS
MESH GENERATION
To minimize the computational time without compromising much accuracy of the solution, we must change the default meshing parameters. To do this, 1. Select “Mesh” “Free Mesh Parameters” (F9) from the menus at the top. 2. Switch to the “Boundary” tab in the newly appearing “Free Mesh Parameters” window. 3. Select Boundary 1 from the “Boundary Selection” field. 4. Switch to the “Distribution” tab.
5. Enable the “Constrained edge element distribution” checkbox. 6. Enter “8” for the “Number of edge elements”. 7. Click the “Remesh” button. 8. Click “OK” to close “Free Mesh Parameters” window. You should get a mesh that looks like the one below:
We are now ready to compute our solution. - 41 -
Limits of the Fin Approximation
ME433 COMSOL INSTRUCTIONS
COMPUTING AND SAVING THE SOLUTION
A parametric analysis is specified as follows for this problem: 1. From the “Solve” menu select “Solver Parameters” (F11). 2. Switch to “Parametric” analysis in “Solver” field. 3. Enter “h_0” in the “Name of Parameter” field. 4. Enter “0.08
0.8 8 80 800”
in the “List of parameter values”
5. Click “OK” to close the “Solver Parameters” dialog.
6. From the “Solve” menu select “Solve Problem”. 7. Save your work on desktop by choosing “File Save”. Name the file according to the naming convention given in “Introduction to COMSOL Multiphysics”. One of the results that you obtain should resemble the following surface color map:
- 42 -
Limits of the Fin Approximation
ME433 COMSOL INSTRUCTIONS
POSTPROCESSING AND VISUALIZATION
After solving the problem, we would like to look at the solution. COMSOL offers us a number of different ways to look at our temperature (and other) fields. In this problem we will deal with 2D color maps and temperature data extraction. Assignment questions 6 through 7 (see page 36) address COMSOL solution validity and compare results to analytic solution. Obtaining the 2D Fin Cross – Section Temperature Color Map: 1. From the “Postprocessing” menu open “Plot Parameters” dialog box (F12). 2. Under the “General” tab, enable the “Surface” plot type (if it is not on by default). 3. Deselect any other plot types, except “Geometry edges” as shown below (left):
4. Select “800” as the solution to display using the drop – down menu. (Note: This menu gives you the option to select the solution for a particular h ) 5. Switch to “Surface” tab. 6. Change the unit of temperature to degrees Celsius from the drop – down menu in the “Unit” field. 7. Click the “OK” button.
- 43 -
Limits of the Fin Approximation
ME433 COMSOL INSTRUCTIONS
At this point, save the resulting color map for the purpose of writing your report. (Note: Saving instructions are given below). This color map displays solution for the case h = 800 W/m2–ºC. For the other cases, repeat steps 1 – 7 on page 43, changing the value of h in step 4. Don’t forget to save the color maps you obtain for these cases. Saving Color Maps: To save the results as an image for future discussion: 1. Select “File Export Image”. This will bring up an “Export Image” window. For a 4” by 6” image, acceptable image quality settings are given in the figure below. If you need higher image quality, increase the DPI value.
2. Change your “Export Image” value settings to the ones in the above figure. 3. Click the “Export” button. 4. Name and save the image. Plotting and Extracting COMSOL T(x, 0) and T(x, r0) for h = 0.08 W/m2–ºC To first plot COMSOL temperature at the center of the fin on 0 x L , 1. Select “Cross – Section Plot Parameters …” option from “Postprocessing” menu. 2. Under “General” tab, select “0.08” as the only “Solution to use” option.
- 44 -
Limits of the Fin Approximation
ME433 COMSOL INSTRUCTIONS
3. Switch to the “Line/Extrusion” tab. 4. Change the “Unit” of temperature to degrees Celsius. 5. Enter the following coordinates in the “Cross – section line data”: x0 = 0, x1 = 0.25; y0 = y1 = 0. 6. Click “Apply”.
As a result of these steps, a new plot will be shown that graphs T(x, 0) on 0 x L . Do not close this plot just yet. We are going to extract this data to a text file for comparative analysis with MATLAB. - 45 -
Limits of the Fin Approximation
ME433 COMSOL INSTRUCTIONS
Exporting COMSOL Data to a Data File 1. Click on “Export Current Plot” button
in the Temperature graph.
2. Click “Browse” and navigate to your saving folder (say “Desktop”). 3. Name and save the file as “Tx_comsol_h008.txt”. (Note: do not forget to type the “.txt” extension in the name of the file). 4. Click “OK” to save the file. To plot COMSOL temperature T(x, r0) (surface of the fin) on 0 x L , repeat the steps for the above section with following modification: 5. In step 5 (page 45), change the y – coordinates to y0 = y1 = 0.025. When the graph is displayed, export the data to a text file using steps 1 – 4 above. Name and save the file as “Ts_comsol_h008.txt” in the same directory as the first data file. Important: You have to export temperature data for all other values of h. In total, you should have 10 text – based data files: two data files per each value of h (one for central temperature distribution, one for surface temperature distribution). Simply repeat the steps for the above section with following modifications: 6. In step 2 (page 44), select the next value for h (0.8 in this case) Do not forget to export the data! Use the following table to name the 8 remaining temperature data files for each of the corresponding h. h
CENTRAL T(x) FILE NAME
SURFACE T(x) FILE NAME
0.08
Tx_comsol_h008.txt
Ts_comsol_h008.txt
0.8
Tx_comsol_h08.txt
Ts_comsol_h08.txt
8
Tx_comsol_h8.txt
Ts_comsol_h8.txt
80
Tx_comsol_h80.txt
Ts_comsol_h80.txt
800
Tx_comsol_h800.txt
Ts_comsol_h800.txt
It is important that you name the data files exactly as instructed above, as our sample MATLAB script is coded to use these names to import the data. If you make a mistake in naming a data file, MATLAB will produce an error and leave you without the plots! Therefore, it is advised that you pay extra attention to name these files correctly. This completes COMSOL modeling procedures for this problem.
- 46 -
Limits of the Fin Approximation
ME433 COMSOL INSTRUCTIONS
Modeling with MATLAB This part of modeling procedures describes how to create comparative graphs of COMSOL and analytical temperature distributions at the center and the surface of the fin for all x using MATLAB. Obtain MATLAB script file named “lim_finapprox.m” from Blackboard prior to following these procedures. Save this file in the same directory as the data file(s) (qy.txt) from COMSOL. (Note: “lim_finapprox.m” file is attached to the electronic version of this document as well. To access the file directly from this document, select “View Navigation Panels Attachements” and then save “lim_finapprox.m” in a proper directory) Comparing COMSOL Solution to Correlation Solution MATLAB script (lim_finapprox.m) is programmed to use exported COMSOL data for fin center and surface temperature to compare it with analytical temperature distribution given by equation 3.82. The script is also programmed to calculate COMSOL center – to – surface temperature differences and perform a simple error analysis to verify COMSOL solution. The script will ultimately produce 6 comparative graphs that will plot both solutions. Follow the steps below to complete this problem: 1. Open MATLAB by double clicking its icon on the Desktop. 2. Load “lim_finapprox.m” file by selecting “File Open Desktop lim_finapprox.m”. The script responsible for COMSOL data import and data comparison will appear in a new window. 3. Press F5 key to run the script. MATLAB editor will display a warning message. Click “Change Directory” to run the script. COMSOL center – to – surface temperature comparison for all 5 h cases will be plotted in figure 1. Figures 2 and 3 plot COMSOL center – to – surface temperature differences for all 5 h cases. Figure 6 plots COMSOL center temperature T(x, 0) and analytically determined fin temperature T(x) using equation 3.82. From this plot notice that agreement is poor, even for small Biot numbers. Figures 4 and 5 take the results of figure 6 further and perform a simple error analysis. The equation for computation of error is printed on these plots. These results are shown on the next page.
- 47 -
Limits of the Fin Approximation
ME433 COMSOL INSTRUCTIONS
Results Plotted with MATLAB Figures 1 and 6
Figures 2 and 3
Figures 4 and 5
Armed with these results, you are in a position to answer most of the assigned questions.
- 48 -
Limits of the Fin Approximation
ME433 COMSOL INSTRUCTIONS
APPENDIX
MATLAB script If you could not obtain this script from the Blackboard or the PDF file, you may copy it here, then paste it into notepad and save it in the same directory where you saved COMSOL data file(s). You will most likely get hard – to – spot syntax errors if you copy the script this way. It is therefore highly advised that you use the other 2 methods on obtaining this script instead of the copying method. % ######################################################################### % ME 433 - Heat Transfer % Sample MATLAB Script For COMSOL Module: % (X) Limits of the Fin Approximation % IMPORTANT: Save this file in the same folder with the following files: % % "Ts_comsol_h008.txt", "Tx_comsol_h008.txt", % "Ts_comsol_h08.txt", "Tx_comsol_h08.txt", % "Ts_comsol_h8.txt", "Tx_comsol_h8.txt", % "Ts_comsol_h80.txt", "Tx_comsol_h80.txt", % "Ts_comsol_h800.txt", "Tx_comsol_h800.txt". % % ######################################################################### % clc; % Clears the UI prompt clear; % Clears variables from memory % %% Constant Quantities k = 4; % Fin's Conductivity, [W/m-K] h = [0.08 0.8 8 80 800]; % Heat Tranf. Coeffs., [W/m^2-K] r = 0.025; % Fin's radius, [m] L = 0.25; % Fin's length, [m] C = 2*pi*r; % Fin's circumference, [m] Ac = pi*r^2; % Fin's conduction area, [m^2] m = (h.*C./(k*Ac)).^(1/2); % Fin parameter, [1/m] To = 200; % Base temperature, [degC] Tinf = 20; % Ambient temperature, [degC]
%% COMSOL Multiphysics Data Import % Fin Surface data: load Ts_comsol_h008.txt; load Ts_comsol_h08.txt; load Ts_comsol_h8.txt; load Ts_comsol_h80.txt; load Ts_comsol_h800.txt; % Fin Center data: load Tx_comsol_h008.txt; load Tx_comsol_h08.txt; load Tx_comsol_h8.txt; load Tx_comsol_h80.txt; load Tx_comsol_h800.txt; x = Ts_comsol_h008(:,1); % tsc008 = Ts_comsol_h008(:,2); tsc08 = Ts_comsol_h08(:,2); tsc8 = Ts_comsol_h8(:,2); tsc80 = Ts_comsol_h80(:,2); tsc800 = Ts_comsol_h800(:,2); % txc008 = Tx_comsol_h008(:,2); txc08 = Tx_comsol_h08(:,2); txc8 = Tx_comsol_h8(:,2); txc80 = Tx_comsol_h80(:,2); txc800 = Tx_comsol_h800(:,2);
- 49 -
Limits of the Fin Approximation
ME433 COMSOL INSTRUCTIONS
clear Ts_comsol_h008 Ts_comsol_h08 Ts_comsol_h8... Ts_comsol_h80 Ts_comsol_h800 Tx_comsol_h008 Tx_comsol_h08... Tx_comsol_h8 Tx_comsol_h80 Tx_comsol_h800 % %% Analytic Temp. Distribution according to Eq.: 3.82 % Computing Theoretical T(x): ta008 = Tinf + (To - Tinf)*cosh(m(1)*(L - x))./cosh(m(1)*L); ta08 = Tinf + (To - Tinf)*cosh(m(2)*(L - x))./cosh(m(2)*L); ta8 = Tinf + (To - Tinf)*cosh(m(3)*(L - x))./cosh(m(3)*L); ta80 = Tinf + (To - Tinf)*cosh(m(4)*(L - x))./cosh(m(4)*L); ta800 = Tinf + (To - Tinf)*cosh(m(5)*(L - x))./cosh(m(5)*L); %% COMSOL Center to Surface Temperature Difference diff008 = (txc008 - tsc008); diff08 = (txc08 - tsc08); diff8 = (txc8 - tsc8); diff80 = (txc80 - tsc80); diff800 = (txc800 - tsc800); %% Error Analysis: COMSOL Tc(x) to Analytic T(x) Comparison err008 = abs(txc008 - ta008)./ta008*100; err08 = abs(txc08 - ta08)./ta08*100; err8 = abs(txc8 - ta8)./ta8*100; err80 = abs(txc80 - ta80)./ta80*100; err800 = abs(txc800 - ta800)./ta800*100; %% Plotter 1 figure1 = figure('InvertHardcopy','off',... %\ 'Colormap',[1 1 1 ],... % | -> Setting up the figure 'Color',[1 1 1]); %/ plot(x,tsc008,'k--',x,txc008,'k', x,tsc08,'k--',x,txc08,'k',... x,tsc8,'k--',x,txc8,'k', x,tsc80,'k--',x,txc80,'k',... x,tsc800,'k--',x,txc800,'k'); xlim([0 0.25]); grid on box off title(['\fontname{Times New Roman} \fontsize{12} \bf COMSOL Muliphysics Solution: Center to Surface',... sprintf('\n'),' Temperature Comparison at various Biot numbers']); xlabel('\fontname{Times New Roman} \fontsize{14} \it \bf x, [m]') ylabel('\fontname{Times New Roman} \fontsize{14} \it \bf T_c(x) _(_s_o_l_i_d_) , T_s(x) _(_d_a_s_h_e_d_) , [\circC]') % Create textbox annotation(figure1,'textbox',[0.3302 0.1178 0.1338 0.05987],... 'String',{'10'},... 'HorizontalAlignment','center',... 'FontWeight','bold',... 'FontSize',14,... 'FontName','Times New Roman',... 'FontAngle','italic',... 'FitBoxToText','off',... 'LineStyle','none'); % Create textbox annotation(figure1,'textbox',[0.5171 0.1323 0.1338 0.05987],... 'String',{'1'},... 'HorizontalAlignment','center',... 'FontWeight','bold',... 'FontSize',14,... 'FontName','Times New Roman',... 'FontAngle','italic',... 'FitBoxToText','off',... 'LineStyle','none'); % Create textbox annotation(figure1,'textbox',[0.7578 0.2903 0.1338 0.05987],... 'String',{'0.1'},... 'HorizontalAlignment','center',... 'FontWeight','bold',... 'FontSize',14,...
- 50 -
Limits of the Fin Approximation
ME433 COMSOL INSTRUCTIONS
'FontName','Times New Roman',... 'FontAngle','italic',... 'FitBoxToText','off',... 'LineStyle','none'); % Create textbox annotation(figure1,'textbox',[0.7578 0.7506 0.1338 0.05987],... 'String',{'0.01'},... 'HorizontalAlignment','center',... 'FontWeight','bold',... 'FontSize',14,... 'FontName','Times New Roman',... 'FontAngle','italic',... 'FitBoxToText','off',... 'LineStyle','none'); % Create textbox annotation(figure1,'textbox',[0.7652 0.8723 0.1338 0.05987],... 'String',{'0.001'},... 'HorizontalAlignment','center',... 'FontWeight','bold',... 'FontSize',14,... 'FontName','Times New Roman',... 'FontAngle','italic',... 'FitBoxToText','off',... 'LineStyle','none'); %% Plotter 2 figure2 = figure('InvertHardcopy','off',... %\ 'Colormap',[1 1 1 ],... % | -> Setting up the figure 'Color',[1 1 1]); %/ plot(x,diff008,'k', x,diff08,'k-.', x,diff8,'k--'); xlim([0 0.25]); grid on box off title(['\fontname{Times New Roman} \fontsize{12} \bf COMSOL Muliphysics Solution: Center to Surcace',... sprintf('\n'),' Temperature Difference \DeltaT Comparison at various Biot numbers']); xlabel('\fontname{Times New Roman} \fontsize{14} \it \bf x, [m]') ylabel('\fontname{Times New Roman} \fontsize{14} \it \bf \Delta T = T_c(x) - T_s(x) , [\circC]') legend('Bi = 0.001','Bi = 0.01','Bi = 0.1') %% Plotter 3 figure3 = figure('InvertHardcopy','off',... %\ 'Colormap',[1 1 1 ],... % | -> Setting up the figure 'Color',[1 1 1]); %/ plot(x,diff80,'k', x,diff800,'k--'); xlim([0 0.25]); grid on box off title(['\fontname{Times New Roman} \fontsize{12} \bf COMSOL Muliphysics Solution: Center to Surcace',... sprintf('\n'),' Temperature Difference \DeltaT Comparison at various Biot numbers']); xlabel('\fontname{Times New Roman} \fontsize{14} \it \bf x, [m]') ylabel('\fontname{Times New Roman} \fontsize{14} \it \bf \Delta T = T_c(x) - T_s(x) , [\circC]') legend('Bi = 1','Bi = 10') %% Plotter 4 figure4 = figure('InvertHardcopy','off',... %\ 'Colormap',[1 1 1 ],... % | -> Setting up the figure 'Color',[1 1 1]); %/ plot(x,err008,'k', x,err08,'k-.', x,err8,'k--'); xlim([0 0.25]); grid on box off title(['\fontname{Times New Roman} \fontsize{12} \bf Error Analysis:',... sprintf('\n'),'COMSOL Solution vs. Analytic Eq.: 3.82']); xlabel('\fontname{Times New Roman} \fontsize{14} \it \bf x, [m]') ylabel('\fontname{Times New Roman} \fontsize{14} \it \bf Error, [%]')
- 51 -
Limits of the Fin Approximation
ME433 COMSOL INSTRUCTIONS
legend('Bi = 0.001','Bi = 0.01','Bi = 0.1','location','south') str1(1) = {'$${\%err={T_{x_{comsol}}-T_{x_{eq.3.82}}\over T_{x_{eq.3.82}}}\times 100} $$'}; text('units','normalized', 'position',[.05 .9], ... 'fontsize',12,... 'FontName', 'Times New Roman',... 'FontAngle', 'italic', ... 'BackgroundColor',[1 1 1],... 'interpreter','latex',... 'string', str1); %% Plotter 5 figure4 = figure('InvertHardcopy','off',... %\ 'Colormap',[1 1 1 ],... % | -> Setting up the figure 'Color',[1 1 1]); %/ plot(x,err80,'k', x,err800,'k--'); xlim([0 0.25]); grid on box off title(['\fontname{Times New Roman} \fontsize{12} \bf Error Analysis:',... sprintf('\n'),'COMSOL Solution vs. Analytic Eq.: 3.82']); xlabel('\fontname{Times New Roman} \fontsize{14} \it \bf x, [m]') ylabel('\fontname{Times New Roman} \fontsize{14} \it \bf Error, [%]') legend('Bi = 1','Bi = 10','location','northeast') str1(1) = {'$${\%err={T_{x_{comsol}}-T_{x_{eq.3.82}}\over T_{x_{eq.3.82}}}\times 100} $$'}; text('units','normalized', 'position',[.2 .9], ... 'fontsize',12,... 'FontName', 'Times New Roman',... 'FontAngle', 'italic', ... 'BackgroundColor',[1 1 1],... 'interpreter','latex',... 'string', str1); %% Plotter 6 figure1 = figure('InvertHardcopy','off',... %\ 'Colormap',[1 1 1 ],... % | -> Setting up the figure 'Color',[1 1 1]); %/ plot(x,txc008,'k--',x,ta008,'k', x,txc08,'k--',x,ta08,'k',... x,txc8,'k--',x,ta8,'k', x,txc80,'k--',x,ta80,'k',... x,txc800,'k--',x,ta800,'k'); xlim([0 0.25]); grid on box off title(['\fontname{Times New Roman} \fontsize{12} \bf COMSOL vs. Theory: Center to Center',... sprintf('\n'),'Temperature Comparison at various Biot numbers']); xlabel('\fontname{Times New Roman} \fontsize{14} \it \bf x, [m]') ylabel('\fontname{Times New Roman} \fontsize{14} \it \bf T_e_q_._:_3_._8_2 (x) _(_s_o_l_i_d_) , T_c_o_m_s_o_l (x) _(_d_a_s_h_e_d_) , [\circC]') % Create textbox annotation(figure1,'textbox',[0.1998 0.1273 0.1338 0.05987],... 'String',{'10'},... 'HorizontalAlignment','center',... 'FontWeight','bold',... 'FontSize',14,... 'FontName','Times New Roman',... 'FontAngle','italic',... 'FitBoxToText','off',... 'LineStyle','none'); % Create textbox annotation(figure1,'textbox',[0.5171 0.1323 0.1338 0.05987],... 'String',{'1'},... 'HorizontalAlignment','center',... 'FontWeight','bold',... 'FontSize',14,... 'FontName','Times New Roman',... 'FontAngle','italic',... 'FitBoxToText','off',... 'LineStyle','none');
- 52 -
Limits of the Fin Approximation
ME433 COMSOL INSTRUCTIONS
% Create textbox annotation(figure1,'textbox',[0.7578 0.2903 0.1338 0.05987],... 'String',{'0.1'},... 'HorizontalAlignment','center',... 'FontWeight','bold',... 'FontSize',14,... 'FontName','Times New Roman',... 'FontAngle','italic',... 'FitBoxToText','off',... 'LineStyle','none'); % Create textbox annotation(figure1,'textbox',[0.7578 0.7506 0.1338 0.05987],... 'String',{'0.01'},... 'HorizontalAlignment','center',... 'FontWeight','bold',... 'FontSize',14,... 'FontName','Times New Roman',... 'FontAngle','italic',... 'FitBoxToText','off',... 'LineStyle','none'); % Create textbox annotation(figure1,'textbox',[0.7652 0.8723 0.1338 0.05987],... 'String',{'0.001'},... 'HorizontalAlignment','center',... 'FontWeight','bold',... 'FontSize',14,... 'FontName','Times New Roman',... 'FontAngle','italic',... 'FitBoxToText','off',... 'LineStyle','none');
This completes MATLAB modeling procedures for this problem.
- 53 -
Test Chamber Insulation (Rectangular)
ME433 COMSOL INSTRUCTIONS
TEST CHAMBER INSULATION (Rectangular) Problem Statement As shown in diagram 1, the wall of a rectangular test chamber consists of a stainless steel layer and a brick layer. It is desired to reduce the heat loss from a chamber by adding an insulation layer of 85% magnesia. Of interest is determining where to insert the insulation layer so that the rate of heat loss is lowest. One student recommended adding the 85% magnesia layer on the cold side (brick) while a second student suggested the hot side (steel). A third student recommended inserting the insulation layer between the steel and brick. A fourth student who did not seem to pay much attention to the discussion claimed that it does not matter where to add the insulation. You are asked to carry out a study to determine the option that will result in the lowest rate of heat loss from the chamber. Diagram 1 – Chamber Wall
Known quantities: Stainless steel thickness, L1 0.4 cm Brick thickness, L2 5 cm 85% magnesia thickness, L3 2 cm T∞, steel = 90 ºC h steel = 6.5 W/m2–ºC T∞, brick = 10 ºC h brick = 15.8 W/m2–ºC
1 steel
2 brick
L1
L2
Use COMSOL Material Library and/or appendices in your textbook for the properties of materials considered. Observations
According to the data above, we are only given the thicknesses of the chamber wall. Thus, the vertical height is assumed to be arbitrary. While this is not an issue in analytic study (such as the 1D steady state conduction in chapter 3), COMSOL, like all other computer programs, requires definite object dimensions. We will thus assume a height of 5 cm, without compromising any results.
Although the problem can be solved in 1D, we will purposefully solve it in 2D. The objective of doing so is to notice the uniformity of temperature field in vertical direction.
Upon a close inspection of the thermal circuit equation 3.28, it is clear that by changing the position of the insulation layer in the wall, the denominator remains unchanged as long as the same heat transfer coefficients remain at the internal and external surfaces. This being the case here, we expect the total q to remain the same as we place the insulation layer at different locations. - 55 -
Test Chamber Insulation (Rectangular)
ME433 COMSOL INSTRUCTIONS
Assignment 1. Using COMSOL, show the temperature distribution for the 3 cases. 2. Using COMSOL, compute the heat transfer rate qf for the 3 cases. 3. Compute theoretical qf . Compare the results with those in the above question. Are COMSOL results valid? [Hint: You will need to compute the total area of the chamber wall to do this] 4. Using COMSOL, plot graphs for each of the cases showing T(x) for the three layers. Each graph should show clearly the boundaries of the layers and the corresponding temperature distribution. 5. Pick one of the 3 cases and compute the temperatures of the inner and outer boundaries of the chamber analytically. Compare these results with COMSOL solution and claim whether or not they are valid. 6. [Extra Credit]: Would the rate of heat transfer vary in an analogous multi – layer cylindrical wall as one of the insulation layers is moved to a different position? Explain.
- 56 -
Test Chamber Insulation (Rectangular)
ME433 COMSOL INSTRUCTIONS
Modeling with COMSOL Multiphysics MODEL NAVIGATOR
We will model this problem with 2 – dimensional rectangles. Since we are not intending to look at the field flow outside the chamber walls, we will only need to work with the Heat Transfer Module. We are also assuming the process to be in steady state. For this setup: 1. Start “COMSOL Multiphysics”. 2. In the “Space dimension” list select 2D (under the “New” Tab). 3. From the list of application modes select “Heat Transfer Module General Heat Transfer Steady – State Analysis” 4. Click “OK”.
- 57 -
Test Chamber Insulation (Rectangular)
ME433 COMSOL INSTRUCTIONS
GEOMETRY MODELING
In this step, we will create a 2 – dimensional geometry that will be used as a model in our problem. According to problem statement, we will need to create 3 adjacent rectangles. 1. Create a rectangle by going to the “Draw” menu, selecting “Specify Objects Rectangle”. 2. Start by entering information for “RECTANGLE 1” from the following table. RECTANGLE 1
RECTANGLE 2
RECTANGLE 3 0.02
WIDTH
0.004
0.05
HEIGHT
0.05
0.05
0.05
BASE
CORNER
CORNER
CORNER
X
0
0.004
0.054
Y
0
0
0
NAME
STEEL
BRICK
MAGNESIA
3. When done with step 2, click “OK” and repeat steps 1 to 3 for the other 2 rectangles. 4. Click on “Zoom Extents” button geometry.
in the main toolbar to zoom into the
You should see your 2D chamber wall now selected in light red color in the main program window. Try to investigate the geometry you just made. In particular, try to explore what the “Geometric Properties” button does: as you select the parts of the geometry. See how the function of this button changes as you switch the program mode . with these buttons:
Notice that this places the 85% magnesia layer on the cold side (brick). Let this position be our first configuration. We will later move the insulation layer to the middle (configuration 2), and on the hot side (steel, configuration 3). - 58 -
Test Chamber Insulation (Rectangular)
ME433 COMSOL INSTRUCTIONS
PHYSICS SETTINGS
Physics settings in COMSOL consist of two parts: (1) Subdomain settings and (2) boundary conditions. The subdomain settings let us specify material types, initial conditions and modes of heat transfer (i.e. conduction and/or convection). The boundary conditions settings are used to specify what is happening at the boundaries of the geometry. Subdomain Settings: 1. From the “Physics” menu select “Subdomain Settings” (equivalently, press F8). 2. Select “Subdomain 1” in the “Subdomain selection” window. (For this configuration, this subdomain corresponds to the steel layer) 3. Enter “44.5” in the field for thermal conductivity k. 4. Select “Subdomain 2” in the “Subdomain selection” window. (For this configuration, this subdomain corresponds to the brick layer) 5. Enter “2.2” in the field for thermal conductivity k. 6. Select “Subdomain 3” in the “Subdomain selection” window. (For this configuration, this subdomain corresponds to the 85% magnesia layer) 7. Enter “0.065” in the field for thermal conductivity k. 8. Click “OK” to apply these properties and close the Subdomain Settings window.
- 59 -
Test Chamber Insulation (Rectangular)
ME433 COMSOL INSTRUCTIONS
Boundary Conditions: 1. From the “Physics” menu open the “Boundary Settings” (F7) dialog box. 2. Apply the following boundary conditions. BOUNDARY
BOUNDARY CONDITION
COMMENTS
1
Heat Flux
Enter h = 6.5 W/m –ºC; TINF = 363.15K
2, 3, 5, 6, 8, 9
Thermal Insulation
10
Heat Flux
2
2
Enter h = 15.8 W/m –ºC; TINF = 283.15K
Boundaries 4 and 7 are internal boundaries. COMSOL automatically applies the continuity boundary condition by default. Internal boundaries appear grayed out in the selection window and are inaccessible to the user. Leave them as they are! 3. Click “OK” to close the “Boundary Settings” window. MESH GENERATION
1. From the ‘Mesh” menu select “Initialize Mesh”. You should get a mesh that looks like the one below:
We are now ready to compute our solution.
- 60 -
Test Chamber Insulation (Rectangular)
ME433 COMSOL INSTRUCTIONS
COMPUTING AND SAVING THE SOLUTION
In this step we define the type of analysis to be performed. We are interested in stationary analysis here, which we previously selected in the Model Navigator. Therefore, no modifications need to be made. To enable the solver, proceed with the following steps: 1. From the “Solve” menu select “Solve Problem”. (Allow few seconds for solution) 2. Save your work on desktop by choosing “File Save”. Name the file according to the naming convention given in the “Introduction to COMSOL Multiphysics” document. The result that you obtain should resemble the following surface color map:
By default, your immediate result may be given in Kelvin instead of degrees Celsius as shown above. The next section (Postprocessing and Visualization) will help you in obtaining the above and other diagrams, extracting temperature distribution data from the solution, and computing the heat transfer rate qf through COMSOL).
- 61 -
Test Chamber Insulation (Rectangular)
ME433 COMSOL INSTRUCTIONS
POSTPROCESSING AND VISUALIZATION
After solving the problem, we would like to be able to look at the solution. COMSOL offers us a number of different ways to look at our temperature (and other) fields. In this problem we will deal with 2D color maps, heat transfer rate computation, and 1D temperature distribution plots. We will then address the questions of COMSOL solution validity and compare the results to theoretical predictions. All of these steps can be done effectively in COMSOL alone. Changing Temperature Units: 1. From the “Postprocessing” menu, open “Plot Parameters” dialog box (F12). 2. Under the “Surface” tab, change the unit of temperature to degrees Celsius from the drop – down menu in the “Unit” field.
3. Click “OK”. The 2D temperature distribution will be displayed with degrees Celsius as the units of temperature.
- 62 -
Test Chamber Insulation (Rectangular)
ME433 COMSOL INSTRUCTIONS
Saving Color Maps: After you have selected a view that shows the results clearly, you may want to save it as an image for future discussion. This may be done as follows: 1. Click the save “ ” button in your figure with results. This will bring up an “Export Image” window. For a 4” by 6” image, acceptable image quality settings are given in the figure below. If you need higher image quality, increase the DPI value.
2. Change your “Export Image” value settings to the ones in the above figure. 3. Click the “Export” button. 4. Name and save the image. Generating a 1D Plot of T(x): 1. From “Postprocessing” menu select “Cross – Section Plot Parameters” option. 2. Switch to the “Line/Extrusion” tab. 3. Change the “Unit” of temperature to degrees Celsius. 4. Change the “x – axis data” from “arc – length” to “x”.
- 63 -
Test Chamber Insulation (Rectangular)
ME433 COMSOL INSTRUCTIONS
5. Enter the following coordinates into “Cross – section line data” section: x0 = – 0.02 and x1 = 0.054; y0 = 0.03 and y1 = 0.03. 6. Click “OK”. These steps produce a plot of T(x) at y = 3 cm. You can experiment with the value of y and see that it does not matter which y you select (as long as it is in the geometry range). This shows the uniformity of temperature field in vertical direction. Computing Total Heat Transfer q: 1. From the “Postprocessing” menu select “Subdomain Integration” option. 2. Select all 3 subdomains by first clicking on the “1” in the “Subdomain selection” field on the left followed by “3” while holding the shift key on your keyboard. 3. In the “Subdomain Integration” dialog window, change “Predefined Quantities” setting to “Total heat flux”.
4. Click the “OK” button. The value of the integral (solution) is displayed at program’s prompt on the bottom. In this case, q = 0.54 W.
Note the value of the total heat flux. This is the value for configuration 1, where 85% magnesia is located on the cold side (brick). We now will rearrange the geometry for configurations 2 and 3, where the insulation layer is in the middle and on the hot side (steel), respectively. - 64 -
Test Chamber Insulation (Rectangular)
ME433 COMSOL INSTRUCTIONS
GEOMETRY REARRANGEMENTS
To place the 85% magnesia layer in the middle of the wall, we need to go back to geometry settings. Note that this will affect the rightmost boundary condition as well. Thus we will also need to fix the rightmost boundary condition in accordance with the problem statement. We start by rearranging the geometry as follows. 1. Go back to the geometry modeling by clicking the “Draw mode” button located in the upper toolbar. 2. Double click on the “MAGNESIA” layer in the main drawing area. This will bring up the geometry definition of this layer. 3. Change the x value of the base position from “0.054” to “0.004” and click “Apply”. This will move the magnesia layer to left, placing it adjacent to the steel layer. 4. Click “OK” to close geometry definition of the magnesia layer. 5. Double click on the “BRICK” layer in the main drawing area. 6. Change the x value of the base position from “0.004” to “0.024” and click “OK”. This will move the brick layer to right, placing it adjacent to the magnesia layer. Having changed the geometry according to configuration 2, we now wish to fix the boundary conditions and solve the problem again. Boundary Conditions: 7. From the “Physics” menu open the “Boundary Settings” (F7) dialog box. 8. Change boundary 10 from “Thermal Insulation” to “Heat Flux”. 2
9. Enter h = 15.8 W/m –ºC and TINF = 283.15K in their appropriate fields. 10. Click “OK” to close the “Boundary Settings” window. 11. Resolve the problem by selecting the “Solve Problem” from “Solve” menu. Repeat the “Postprocessing and Visualization” section on pages 62 to 64. Pay special attention to the section on how to compute the total heat transfer rate. Note the value you compute of total heat transfer rate for this configuration. Is there a difference in q for this configuration?
- 65 -
Test Chamber Insulation (Rectangular)
ME433 COMSOL INSTRUCTIONS
Lastly, we need to redo the geometry rearrangements for configuration 3, where the magnesia insulation is on the hot side (steel). Note that the boundary conditions are going to be affected by this change as well. Since the procedures are similar as in the previous configuration, redo steps 1 to 6 on page 65 with the following changes: 1. In step 3, change the x value of the base position from “0.004” to “-0.02”. 2. In step 6, change the x value of the base position from “0.024” to “0.004”. 3. After step 6, click on “Zoom Extents” button the geometry.
in the main toolbar to re – center
Redo steps 7 to 11 on page 65 with the following changes: 4. In step 8, change boundary 1 from “Thermal Insulation” to “Heat Flux”. 2
5. In step 9, enter h = 6.5 W/m –ºC and TINF = 363.15K in their appropriate fields. Again, repeat the “Postprocessing and Visualization” section on pages 62 through 64. Do you see any differences in q this time?
- 66 -
Test Chamber Insulation (Rectangular)
ME433 COMSOL INSTRUCTIONS
ANALYTIC VALIDATION
In this section, we will discuss the validation of COMSOL solution. This includes comparing both COMSOL heat transfer rate and COMSOL temperature distribution. The analytic solution for q to this problem is given by equation 3.28:
qx
T1 T 4 L 1 1 L L 1 2 3 Ah1 Ak1 Ak2 Ak3 Ah4
Note that this equation contains terms involving the area of the geometry. To compare COMSOL q to the q according to equation 3.28, this fact must be taken into account. Since we had to define the height of the chamber wall, and the length was given in the problem statement, the total area A of the wall is readily computable. If you wish to use COMSOL to find the total area of the wall, you may do so as follows: 1. With the COMSOL model file open, click on the “Geometry mode” button 2. Select all of the layers (Magnesia, Brick, Steel) by clicking on each while holding the “Shift” key down on your keyboard. All 3 layers should be highlighted now in a light red color. 3. Click on the ‘Geometric Properties” button . The area of the wall will be computed and shown at the program’s prompt. With the area found, you are in a position to compute the analytic heat transfer rate q. Does it agree with COMSOL’s heat transfer rate that you found earlier? If you were to specify different height of the wall in the beginning, would the total q change? Would COMSOL solution be still valid? Would the heat flux q” change? With the knowledge of q, use equations 3.29 and 3.27 to find the wall temperatures (both inner and outer) of the chamber for any of the configurations. Compare these results with the 1D graph of T(x) you made earlier. Do both results agree well? Is COMSOL solution valid? This completes COMSOL modeling procedures for this problem.
- 67 -
Test Chamber Insulation (Cylindrical)
ME433 COMSOL INSTRUCTIONS
TEST CHAMBER INSULATION (Cylindrical) Problem Statement
The wall of a small cylindrical test chamber is made of stainless steel and glass, as shown in the diagram below. It is desired to reduce the heat loss from a chamber by adding an insulation layer of 85% magnesia. Of interest is determining where to insert the insulation layer so that the rate of heat loss is lowest. One student recommended adding the 85% magnesia layer on the cold side (glass) while a second student suggested the hot side (steel). A third student recommended inserting the insulation layer between the steel and glass. A fourth student who did not seem to pay much attention to the discussion claimed that it does not matter where to add the insulation. You are asked to carry out a study to determine the option that will result in the lowest rate of heat loss from the chamber. Known quantities:
Chamber Wall – Steel inside, glass outside
Chamber’s inside radius, r1 8.5 cm Stainless steel thickness, Ls 1.5 cm Glass thickness, Lg 1 cm
85% magnesia thickness, Lm 4 cm T∞, steel = 100 ºC h steel = 8 W/m2–ºC T∞, glass = 10 ºC h glass = 16 W/m2–ºC Use appendices in your textbook for the properties of materials considered. Observations
Three principal cases will be considered to determine where the rate of heat loss is lowest – (a) 85% magnesia layer on the outside of the chamber, (b) 85% magnesia layer between steel and glass layers, and (c) 85% magnesia layer on the inside of the chamber.
The amount of material in a layer depends on where it is placed. An inner layer of thickness L will have less material than an outer layer of the same thickness.
Upon a close inspection of the thermal circuit equation 3.57, it is clear that by changing the position of the insulation layer in the wall, the denominator value changes [Hint: Examine the arguments of logarithmic terms and other terms involving radii]. We therefore expect the total q to change as we place the insulation layer at different locations.
- 69 -
Test Chamber Insulation (Cylindrical)
ME433 COMSOL INSTRUCTIONS
Assignment
1. Using COMSOL, show the temperature distribution for the 3 cases. 2. Using COMSOL, compute the heat per unit length, q ' , for the 3 cases. 3. Compute theoretical q ' . Compare the results with those in the above question. Are COMSOL results valid? [Hint: COMSOL results for heat per unit length q’ were computed for half the geometry] 4. Using COMSOL, plot graphs for each of the cases showing T(x) for the three layers. Each graph should show clearly the boundaries of the layers and the corresponding temperature distribution. 5. Pick one of the 3 cases and compute the temperatures of the inner and outer boundaries of the chamber analytically. Compare these results with COMSOL solution and claim whether or not they are valid. 6. [Extra Credit]: Would the rate of heat transfer vary in an analogous multi – layer rectangular wall as one of the insulation layers is moved to a different position? Explain. 7. [Extra Credit]: If the design requirement is not to exceed 20 ºC at the outer surface, which of the three cases would you recommend? Can you use less than 3 layers? Take financial considerations into account. 8. [Extra Credit]: Verify the results of example 3.2 using COMSOL. Include COMSOL solution in your report for this module.
- 70 -
Test Chamber Insulation (Cylindrical)
ME433 COMSOL INSTRUCTIONS
Modeling with COMSOL Multiphysics MODEL NAVIGATOR
We will model this problem with 2 – dimensional semicircular disks. Since we are not intending to look at the field flow outside the chamber walls, we will only need to work with the Heat Transfer Module. We are also assuming the process to be in steady state. For this setup: 1. Start “COMSOL Multiphysics”. 2. In the “Space dimension” list select 2D (under the “New” Tab). 3. From the list of application modes select “Heat Transfer Module General Heat Transfer Steady – State Analysis” 4. Click “OK”.
- 71 -
Test Chamber Insulation (Cylindrical)
ME433 COMSOL INSTRUCTIONS
DEFINING CONSTANTS
Continue by creating a database for constants the model uses: 1. From the “Options” menu select “Constants”, and in the resulting dialog box define the following names and expressions. NAME k_s
EXPRESSION
VALUE
DESCRIPTION
43[W/(m*degC)]
43[W/(m·K)]
k_g
0.7[W/(m*degC)]
0.7[W/(m·K)]
Window Glass @ 20C
k_m
0.065[W/(m*degC)]
0.065[W/(m·K)]
85% Magnesia @ 20C
T_inf1
100[degC]
373.15[K]
T Inside Chamber
T_inf4
10[degC]
283.15[K]
T Outside Chamber
h_1
8[W/(m^2*degC)]
8[W/(m ·K)]
h_4
16[W/(m^2*degC)]
1% Carbon Steel @ 20C
2
h Inside Chamber
2
16[W/(m ·K)]
h Outside Chamber
2. Click “OK”. GEOMETRY MODELING
In this section, we will create a 2 – dimensional geometry that will be used as a model in our problem. According to problem statement, we will need to create 3 multi – layered circular disks (1 multi – layered disk per case considered in problem statement). To reduce computational time, we will make 3 semicircular disks instead of full disks. 1. Create a circular disk by going to the “Draw” menu, selecting “Specify Objects Circle”. 2. Start by entering information for first circle, or “C1”, from the following table. C1
C2
C3
C4
C5
C6
RADIUS
0.085
0.1
0.11
0.15
0.085
0.1
BASE
CENTER
CENTER
CENTER
CENTER
CENTER
CENTER
X
0
0
0
0
0.4
0.4
C7
C8
C9
C10
C11
C12
RADIUS
0.14
0.15
0.085
0.125
0.14
0.15
BASE
CENTER
CENTER
CENTER
CENTER
CENTER
CENTER
X
0.4
0.4
0.8
0.8
0.8
0.8
3. When done with step 2, click “OK” and repeat steps 1 to 3 for the other 11 circles. 4. Click on “Zoom Extents” button geometry.
in the main toolbar to zoom into the
You should now have created 12 circular disks for the 3 cases considered. The geometry at this point should look like the one shown below. - 72 -
Test Chamber Insulation (Cylindrical)
ME433 COMSOL INSTRUCTIONS
Proceed by creating the following (temporary) rectangles: 5. Go to the “Draw” menu and select “Specify Objects Rectangle”. 6. Enter information for “RECTANGLE 1” from the following table. RECTANGLE 1 (R1) WIDTH
0.15
HEIGHT
0.3
BASE
CORNER
X
-0.15
Y
-0.15
7. With rectangle “R1” selected (light red color), select “Edit Copy”. 8. Select “Edit Paste”. 9. Enter “0.4” as the displacement value in the x – direction in the “Paste” displacement window. 10. Click “OK”. 11. Select “Edit Paste” for the second time. 12. Enter “0.8” as the displacement value in the x – direction in the “Paste” displacement window. 13. Click “OK”. You should now have created 3 temporary rectangles for the 3 cases considered. They will be used to construct semicircular disks. The geometry at this point should look like the one shown below.
- 73 -
Test Chamber Insulation (Cylindrical)
ME433 COMSOL INSTRUCTIONS
To construct multilayered semicircular disks, 14. Select “Draw Create Composite Object” option. 15. In the “Set formula” field, type “(C1+C2+C3+C4)
– R1”
(without quotation marks).
– R2”
and click “Apply”.
16. Click “Apply”.
17. In the “Set formula” field, type “(C5+C6+C7+C8)
18. In the “Set formula” field, type “(C9+C10+C11+C12)
– R3”
and click “OK”.
19. Choose “Select All” from the “Edit” menu. 20. Select objects “CO2” and “CO4” by left – clicking them in the model space while holding the “Shift” key on your keyboard. 21. Select “Draw Modify Move”. 22. Enter “-0.2” as the displacement value in the x – direction in the “Move” displacement window. 23. Click “OK”. 24. Left – click anywhere in the white model space in COMSOL to deselect the geometry objects “CO2” and “CO4”. 25. Select object “CO4” by left – clicking it in the model space. 26. Select “Draw Modify Move”.
- 74 -
Test Chamber Insulation (Cylindrical)
ME433 COMSOL INSTRUCTIONS
27. Enter “-0.2” as the displacement value in the x – direction in the “Move” displacement window. 28. Click “OK”. 29. Choose “Select All” from the “Edit” menu. 30. Choose “
Split Object” from the “Draw menu”.
31. Left – click anywhere in the white model space in COMSOL to deselect the entire geometry. 32. Select objects “C7”, “C11”, and “C15” by left – clicking them in the model space while holding the “Shift” key on your keyboard. 33. Press the “Delete” key on your keyboard to delete objects “C7”, “C11”, and “C15”. 34. Click on “Zoom Extents” button geometry.
in the main toolbar to zoom into the
You should now see your completed 2D chamber wall. The leftmost semicircular disk represents case A (as described in observations), the middle semicircular disk represents case B, and the rightmost semicircular disk represents case C. Let us further visually distinguish these cases in COMSOL by naming each layer by its material name (as opposed to generic names, such as CO6). To do so, 35. Double click object “CO6” and rename it as “steelA”.
36. Click “OK” 37. Use the table given below to rename the rest of the objects in the same way as instructed in steps 35 and 36. OBJECT
CO5
CO3
CO10
CO9
CO8
CO14
CO13
CO12
NAME
glassA
magnesiaA
steelB
magnesiaB
glassB
steelC
magnesiaC
glassC
- 75 -
Test Chamber Insulation (Cylindrical)
ME433 COMSOL INSTRUCTIONS
When completed, your final geometry should look like the one shown below:
Try to investigate the geometry you just made. In particular, try to explore what the as you select the parts of the geometry. See how “Geometric Properties” button does: . the function of this button changes as you switch the program mode with PHYSICS SETTINGS
Physics settings in COMSOL consist of two parts: (1) Subdomain settings and (2) boundary conditions. The subdomain settings let us specify material types, initial conditions and modes of heat transfer (i.e. conduction and/or convection). The boundary conditions settings are used to specify what is happening at the boundaries of the geometry. Subdomain Settings:
1. From the “Physics” menu select “Subdomain Settings” (equivalently, press F8). 2. Select subdomains 1, 5, and 9 in the “Subdomain selection” window while holding the “Control (ctrl)” key on your keyboard. (These subdomains correspond to the magnesia layer). 3. Enter “k_m” in the field for thermal conductivity k.
- 76 -
Test Chamber Insulation (Cylindrical)
ME433 COMSOL INSTRUCTIONS
4. Select subdomain 2 (do not hold the “ctrl” key in this step) 5. Select subdomains 4 and 7 in the “Subdomain selection” window while holding the “Control (ctrl)” key on your keyboard. (These subdomains correspond to the glass layer). 6. Enter “k_g” in the field for thermal conductivity k. 7. Select subdomain 3 (do not hold the “ctrl” key in this step) 8. Select subdomains 6 and 8 in the “Subdomain selection” window while holding the “Control (ctrl)” key on your keyboard. (These subdomains correspond to the steel layer). 9. Enter “k_s” in the field for thermal conductivity k. 10. Click “OK” to apply these properties and close the Subdomain Settings window. Boundary Conditions:
1. From the “Physics” menu open the “Boundary Settings” (F7) dialog box. 2. Apply the following boundary conditions: BOUNDARY
BOUNDARY CONDITION
COMMENTS
1 through 18
Insulation/Symmetry
Not physical boundaries
22,23,30,31,38,39
Heat Flux
Enter h = h_1; TINF = T_inf1
19,26,27,34,35,42
Heat Flux
Enter h = h_4; TINF = T_inf4
Boundaries 20,21,24,25,28,29,32,33,36,37,40,41 are internal boundaries. COMSOL automatically applies the continuity boundary condition by default. Internal boundaries appear grayed out in the selection window and are inaccessible to the user. Leave them as they are! Boundaries 1 – 18 are not real boundaries in the sense that we use a semicircular model. The correct boundary condition of insulation/symmetry is applied by default to these boundaries. 3. Click “OK” to close the “Boundary Settings” window.
- 77 -
Test Chamber Insulation (Cylindrical)
ME433 COMSOL INSTRUCTIONS
MESH GENERATION
To minimize the computational time without compromising much accuracy of the solution, we must change the default meshing parameters. To do this, 1. Go to the “Physics” menu and select “Selection Mode Subdomain Mode”. 2. From the “Edit” menu, choose “Select All”. 3. Left – click the “Mesh Selected (Mapped) toolbar.
” button on the left hand side
As a result of these steps, you should get the following radial mesh:
We are now ready to compute our solution.
- 78 -
Test Chamber Insulation (Cylindrical)
ME433 COMSOL INSTRUCTIONS
COMPUTING AND SAVING THE SOLUTION
In this step we define the type of analysis to be performed. We are interested in stationary analysis here, which we previously selected in the Model Navigator. Therefore, no modifications need to be made. To enable the solver, proceed with the following steps: 1. From the “Solve” menu select “Solve Problem”. (Allow few seconds for solution) 2. Save your work on desktop by choosing “File Save”. Name the file according to the naming convention given in the “Introduction to COMSOL Multiphysics” document” document. The result that you obtain should resemble the following surface color map:
By default, your immediate result will be given in Kelvin instead of degrees Celsius as shown above. The next section (Postprocessing and Visualization) will help you in obtaining the above and other diagrams, plotting graphs for each of the cases showing radial T(x) for the three layers, and computing heat per unit length, q ' through COMSOL).
- 79 -
Test Chamber Insulation (Cylindrical)
ME433 COMSOL INSTRUCTIONS
POSTPROCESSING AND VISUALIZATION
After solving the problem, we would like to be able to look at the solution. COMSOL offers us a number of different ways to look at our temperature (and other) fields. In this problem we will deal with 2D color maps, heat per unit length, q ' computation, and 1D temperature distribution plots. You will then address the questions of COMSOL solution validity and compare the results to theoretical predictions. All of these steps can be done efficiently in COMSOL alone. Changing Temperature Units:
1. From the “Postprocessing” menu, open “Plot Parameters” dialog box (F12). 2. Under the “Surface” tab, change the unit of temperature to degrees Celsius from the drop – down menu in the “Unit” field.
3. Click “OK”. The 2D temperature distribution will be displayed with degrees Celsius as the units of temperature. - 80 -
Test Chamber Insulation (Cylindrical)
ME433 COMSOL INSTRUCTIONS
Saving Color Maps:
After you have selected a view that shows the results clearly, you may want to save it as an image for future discussion. This may be done as follows: 1. Go to the “File” menu and select “Export Image”. This will bring up an “Export Image” window. For a 4” by 6” image, acceptable image quality settings are given in the figure below. If you need higher image quality, increase the DPI value.
2. Change your “Export Image” value settings to the ones in the above figure. 3. Click the “Export” button. 4. Name and save the image. Generating 1D Plot of Radial T(x):
In this section, we will make 3 separate plots of radial temperature distribution for each of the 3 cases. Let’s choose the most convenient line along which to plot the temperature distribution – the central line running at y = 0 with the slope of 0. 1. From “Postprocessing” menu select “Cross – Section Plot Parameters” option. 2. Switch to the “Line/Extrusion” tab. 3. Change the “Unit” of temperature to degrees Celsius. - 81 -
Test Chamber Insulation (Cylindrical)
ME433 COMSOL INSTRUCTIONS
4. Change the “x – axis data” from “arc – length” to “x”. 5. Enter the following coordinates in the “Cross – section line data”: x0 = 0.085 and x1 = 0.15; y0 = 0 and y1 = 0. 6. Click “Apply”. These steps produce a plot of T(x) at y = 0, from x = 8.5 cm (inside surface of the chamber wall) to x = 15 cm (outside surface of the chamber wall) for case (a). To save this plot, 7. Click the save “ ” button in your figure with results. This will bring up an “Export Image” window. 8. Follow steps 2 – 4 as instructed on page 81 to finish with exporting the image. Repeat steps 5 – 8 on this page using the table of coordinates for “Cross – section line data” field for cases (b) and (c) given below: COORDINATE
CASE B
CASE C
X0
0.285
0.485
X1
0.35
0.55
Y0, Y1
0
0
Computing Heat per Unit Length q’:
To compute the heat per unit length, q ' for case (a), 1. From the “Postprocessing” menu select “Boundary Integration” option. 2. In the “Subdomain selection” field, select boundaries 19 and 26 while holding the “Control” key on your keyboard. 3. In the “Subdomain Integration” dialog window, change “Predefined Quantities” setting to “Normal total heat flux”.
- 82 -
Test Chamber Insulation (Cylindrical)
ME433 COMSOL INSTRUCTIONS
4. Click the “OK” button. The value of the integral (solution) is displayed at program’s prompt on the bottom. For case (a), q ' = 41.53 W/m.
Note the value of the heat per unit length, q ' . This is the value for case (a). Repeat steps 1 – 4 for cases (b) and (c). For step 2, the corresponding boundaries for cases (b) and (c) are tabulated below, BC SELECTION CASE B
27 and 34
CASE C
35 and 42
Note the values of the heat per unit length, q ' for these cases as well. You will use these values to answer assignment question 3. Keep in mind that these values (and the one for case (a) are only valid for half the chamber wall.
- 83 -
Test Chamber Insulation (Cylindrical)
ME433 COMSOL INSTRUCTIONS
ANALYTIC VALIDATION
In this section, we will discuss the validation of COMSOL solution. This includes comparing both COMSOL heat per unit length, q ' and COMSOL temperature distribution. The analytic solution for q ' to this problem is given by equation 3.57: qr
T1 T 4 ln r2 r1 ln r3 r2 ln r4 r3 1 1 2 r1h1 L 2 k1 L 2 k2 L 2 k3 L 2 r4 h4 L
Note that this equation contains terms involving length L. The value of L is not given in this problem (L corresponds to the depth of the object in 3 – rd dimension). To compare COMSOL q ' to the qr according to equation 3.57, this fact must be taken into account. q Simply rearrange equation 3.57 to get r qr . In this form, qr has the same dimensions L as COMSOL’s q ' . Thus q ' and qr are readily comparable. Compute analytic qr and compare with COMSOL’s q ' . Do both results agree well? Is COMSOL solution valid? With the knowledge of q, apply equation 3.27 to find the wall temperatures (both inner and outer) of the chamber for any of the configurations. Compare these results with the 1D radial graphs of T(x) you made earlier. Do both results agree well? This completes COMSOL modeling procedures for this problem.
- 84 -
Cooling of a Rod (Transient Study)
ME433 COMSOL INSTRUCTIONS
TRANSIENT COOLING OF A ROD Problem Statement
A horizontal rod is maintained at a uniform temperature of 150 ºC. It is then brought into an environment where temperature is 20 ºC and set to cool off by free convection. The rod is insulated on both ends and exchanges heat only along its cylindrical surface. The length of the rod, L, is 30 cm. Of interest is to learn how to use COMSOL to determine transient temperature T(t) at the center and the surface of the fin. Horizontal Rod at t = 0 sec.
Known quantities: Material: 1% Carbon Steel Ti = T(0) = 150 ºC T∞ = T(tsteady state) = 20 ºC h = 10 W/m2–ºC L = 30 cm r0 = 1.5 cm
Use appendices in your textbook for the properties of materials considered. Observations
The use of lumped – capacity idealization may be justified if Biot number is less than 0.1, as is the case for this problem. Thus, radial temperature drop is expected to be less than 5 percent.
The time t at which temperature of the rod reaches the ambient temperature T∞ , is called tsteady state, or ts.s. for short. The value of ts.s. is unknown, but can be estimated to any practical accuracy desirable with the use of equation 5.7. For this problem, it can be shown that ts.s. 20000 sec. estimated at 0.5 % of difference between rod’s temperature T and ambient temperature T∞. Notice that the true theoretical value of ts.s. is infinite, as implied by equation 5.7.
Although equation 5.7 implies infinite conductivity k, we will use the real k in COMSOL analysis so that the spatial temperature variation is not neglected. The results from COMSOL may thus be used to justify the conclusion of the 1st observation.
The best geometry to be used as a model for this problem is a circle, which will represent radial cross – section of the rod. This is justified by the fact that the rod is insulated at both tips and that heat is transferred uniformly and equally at the surface. Therefore, temperature distribution at any cross – section of the rod (except the tips) is identical.
- 85 -
Cooling of a Rod (Transient Study)
ME433 COMSOL INSTRUCTIONS
Assignment
1. Use COMSOL to solve the transient temperature distribution that includes spatial temperature variation (2D) in the time range of 0 t 20000 seconds. Use an increment of 100 seconds as a solution time stepping in COMSOL. 2. Use COMSOL to plot 1D transient temperature T(t) at the center of the rod, or T(0,t), and the surface of the rod, or T(r0,t) in the time range of 0 t 20000 seconds. 3. Validate COMSOL results by plotting both T(0,t) and T(r0,t) against the lumped – capacity solution given by equation 5.7. Are COMSOL results valid? [Note: In this instruction set, this assignment question will be done with MATLAB, but you are free to use any software of your choice] 4. Calculate the Biot number. Compute and plot temperature difference T T r0 , t T 0, t for all t. Based on the results of this plot, can you conclude that spatial temperature variation is negligible? Based on the results of this plot, can you justify the implication of infinite k suggested by equation 5.7? [Note: In this instruction set, part of this assignment question will be done with MATLAB, but you are free to use any software of your choice] 5. Using equation 5.7, material properties of 1% Carbon steel, and the other known quantities given in the problem statement, show that ts.s. 5.5 hours. Use an estimation of 0.5 % difference between rod’s temperature T and ambient temperature T∞. 6. [Extra Credit]: Use COMSOL to resolve the problem for various values of k that approach infinity. (Leave the rest of the setup unchanged). Make similar plots as in questions 3 and 4 and document any departures you notice in T(0,t) and T(r0,t) from those obtained for the true k. Explain the results you obtained from a physical point of view. You may base you explanation on analogous conclusions drawn from equation 5.7. Is it safe to assume that k does not play any role on the temperature distribution? [Note: Be very observant and consider all cases before you make a statement]. Which material properties have a strong influence on the solution of transient problems that are justified by the lumped – capacity idealization?
- 86 -
Cooling of a Rod (Transient Study)
ME433 COMSOL INSTRUCTIONS
Modeling with COMSOL Multiphysics MODEL NAVIGATOR
We will model this problem with a circular geometry, which, as stated earlier, will represent radial cross – section of the rod. Since we are not intending to look at the flow field outside the rod, we will only need to work with the Heat Transfer Module. We will use a transient analysis to set up the model. For this setup: 1. Start “COMSOL Multiphysics”. 2. In the “Space dimension” list select 2D (under the “New” Tab). 3. From the list of application modes select “Heat Transfer Module General Heat Transfer Transient analysis” 4. Click “OK”.
- 87 -
Cooling of a Rod (Transient Study)
ME433 COMSOL INSTRUCTIONS
GEOMETRY MODELING
1. Go to the “Draw” menu and select “Specify Objects Circle”. 2. Enter “1.5e-2” as the radius of the circle. 3. Click “OK”. 4. Click on “Zoom Extents” button in the main toolbar to zoom into the geometry. You should now have a highlighted circle in your main window. This geometry is all we need to solve this problem and answer the assignment questions. PHYSICS SETTINGS
Physics settings in COMSOL consist of two parts: (1) Subdomain settings and (2) boundary settings. The subdomain settings let us specify material properties, initial conditions and modes of heat transfer (i.e. conduction and/or convection). The boundary conditions settings are used to specify what is happening at the boundaries of the geometry. Subdomain Settings:
1. From the “Physics” menu, select “Subdomain Settings” (equivalently, press F8). 2. Select subdomain 1 in the “Subdomain selection” window. 3. Enter “43” in the field for thermal conductivity k. Enter “7801” in the field for the density ρ. Enter “473” in the field for the heat capacity Cp. 4. Switch to “Init” tab. We will specify initial temperature condition here.
- 88 -
Cooling of a Rod (Transient Study)
ME433 COMSOL INSTRUCTIONS
5. Enter “273.15+150” in the “Initial value” field 6. Close the “Subdomain Settings” dialog by clicking “OK”.
Boundary Conditions:
1. From the “Physics” menu open the “Boundary Settings” (F7) dialog box. 2. Select boundaries 1 – 4 while holding down the shift key on your keyboard. 3. Apply the following boundary conditions: BOUNDARY
BOUNDARY CONDITION
COMMENTS
1,2,3,4
Heat Flux
Enter h = 10; TINF = 273.15+20
4. Click “OK”. - 89 -
Cooling of a Rod (Transient Study)
ME433 COMSOL INSTRUCTIONS
MESH GENERATION
To minimize the computational time without compromising much accuracy of the solution, we must change the default meshing parameters. To do this, 1. Go to the “Physics” menu and select “Selection Mode Subdomain Mode”. 2. From the “Edit” menu, choose “Select All”. 3. Click the “Mesh Selected (Mapped)
” button on the left hand side toolbar.
As a result of these steps, you should get the following mesh:
- 90 -
Cooling of a Rod (Transient Study)
ME433 COMSOL INSTRUCTIONS
COMPUTING AND SAVING THE SOLUTION
To program the solver with proper time stepping and the final time ts.s., 1. Choose “Solver Parameters” from the “Solve” menu. 2. In the “Time Stepping” section, enter “0:100:20000” in the “Times:” field. 3. Click “OK”.
4. From the “Solve” menu select “Solve Problem”. (Allow few minutes for solution) 5. Save your work on desktop by choosing “File Save”. Name the file according to the naming convention given in the “Introduction to COMSOL Multiphysics” document” document.
- 91 -
Cooling of a Rod (Transient Study)
ME433 COMSOL INSTRUCTIONS
The result that you obtain should resemble the following color map:
The defaults show us spatial temperature distribution at t = 20000 seconds. Notice that although this distribution is clearly mapped with a range of colors, the scale temperature values appear to be the same. In fact, they are not the same, but are very close to each other numerically. You can examine this by clicking random parts of the solution geometry and checking the temperature at those parts. As you click on solution geometry, the temperature is displayed at the program prompt. Notice how close the values are to each other! By default, your immediate result may be given in Kelvin instead of degrees Celsius as shown above. The next section (Postprocessing and Visualization) will help you in obtaining the above plot, displaying the solution at times other than 20000 seconds, and plotting and extracting T(0,t) and T(r0,t) for further analysis.
- 92 -
Cooling of a Rod (Transient Study)
ME433 COMSOL INSTRUCTIONS
POSTPROCESSING AND VISUALIZATION
This section will show you how to get results that will enable you to answer questions 1 and 2 and prepare the data needed for analysis in MATLAB (or other software of your choice). Changing Temperature Units:
1. From the “Postprocessing” menu, open “Plot Parameters” dialog box (F12). 2. Under the “Surface” tab, change the unit of temperature to degrees Celsius using the drop – down menu in the “Unit” field.
3. Click “OK”. The 2D temperature distribution will be displayed with degrees Celsius as the units of temperature.
- 93 -
Cooling of a Rod (Transient Study)
ME433 COMSOL INSTRUCTIONS
Saving Color Maps:
After you have selected a view that shows the results clearly, you may want to save it as an image for future discussion. This may be done as follows: 1. Go to the “File” menu and select “Export Image”. This will bring up an “Export Image” window. For a 4” by 6” image, acceptable image quality settings are given in the figure below. If you need higher image quality, increase the DPI value.
2. Change your “Export Image” value settings to the ones in the above figure. 3. Click the “Export” button. 4. Name and save the image.
- 94 -
Cooling of a Rod (Transient Study)
ME433 COMSOL INSTRUCTIONS
Displaying Spatial Temperature Distribution at Times Other Than t = 20000 Seconds:
Since we chose a stepping time increment of 100 seconds, we can only see solutions at some multiples of 100 in the range of 0 t 20000 seconds. Thus, solution exists for times such as 0, 100, 200, 300, …, and 19800 seconds, but not for times such as 3, 26, or 78.1 seconds. Let’s display spatial temperature distribution at t = 100 s. To do this, 1. Go to the “Postprocessing” menu and select “Cross Section Plot Parameters…”. 2. Use the drop – down menu to select t = 100 s as the solution time to display in the “Solution to use” field. 3. Click “Apply”.
Choose other values of time and display the spatial temperature distribution at those values. When you are done, click “OK” to close the Postprocessing window.
- 95 -
Cooling of a Rod (Transient Study)
ME433 COMSOL INSTRUCTIONS
Displaying Temperature as a Function of Time at the Center of the Rod, T(0,t):
The steps in this section may depend on the particular version of COMSOL you use. In this instruction set, COMSOL version 3.5 was used. If you are using an earlier version of the program, the steps may somewhat differ. 1. Select “Postprocessing” menu and choose “Cross Section Plot Parameters… ”. 2. Switch to “Point” tab and change the units of temperature to ºC.
3. Ensure the “x:” and “y:” coordinates are both 0. These coordinates represent the center point of the rod. 4. Change radio button from “Auto” to “Expression” and click “Expression” button. 5. Type “t” in “Expression” field. Here, non – capitalized “t” stands for time.
[Note: Notice that the field “Unit of integral” lists time unit as m2s . Do not worry! We’ve simply discovered a minor bug in the program. The output will still be in the unit of seconds, even though the program is trying to confuse us.]
- 96 -
Cooling of a Rod (Transient Study)
ME433 COMSOL INSTRUCTIONS
6. Click “OK” to close the x – axis data window. 7. Click “Apply” in the “Cross Section Plot Parameters” window to plot the Temperature versus time graph at the center of the rod. Do not close the graph yet! Exporting COMSOL Data to a Data File:
8. Click on “Export Current Plot” button in the previous step.
in the Temperature – time graph created
9. Click “Browse” and navigate to your saving folder (say “Desktop”). 10. Name the file “center_data.txt” and save it. (Note: do not forget to type the “.txt” extension in the name of the file). 11. Click “OK” to save the file. Displaying Temperature as a Function of Time at a Surface Point of the Rod, T(r0,t):
1. Back in COMSOL’s Cross Section Plot Parameters dialog box, change the “y:” coordinate to “1.5e-2”. 2. Click “OK” to plot the Temperature versus time graph at a surface point of the rod. Do not close the newly created graph window yet! Exporting COMSOL Data to a Data File:
3. Click on “Export Current Plot” button in the previous step.
in the Temperature – time graph created
4. Click “Browse” and navigate to your saving folder (say “Desktop”). 5. Name the file “surface_data.txt” and save it. (Note: do not forget to type the “.txt” extension in the name of the file). 6. Click “OK” to save the file. This completes COMSOL modeling procedures for this problem.
- 97 -
Cooling of a Rod (Transient Study)
ME433 COMSOL INSTRUCTIONS
Modeling with MATLAB
This part of modeling procedures describes how to create comparative temperature vs. time graphs using MATLAB. Obtain MATLAB script file named “transient_cooling.m” from Blackboard prior to following these procedures. Save this file in the same directory as the data files (“center_data.txt” and “surface_data.txt”) from COMSOL. (Note: “transient_cooling.m” file is attached to the electronic version of this document as well. To access the file directly from this document, select “View Navigation Panels Attachements” and then save “transient_cooling.m” in a proper directory) Comparing COMSOL solution with Lumped Capacity solution:
Now we are ready to load and graph our COMSOL T(0,t) and T(r0,t) data in MATLAB and compare it with Lumped Capacity solution given by equation 5.7. IMPORTANT: If you have not done so already, download “transient_cooling.m” MATLAB file from the Blackboard and save it in the same directory as the data files from COMSOL. Follow the steps below to complete this problem: 1. Open MATLAB by double clicking its icon on the Desktop. 2. Load “transient_cooling.m” file by selecting “File Open Desktop transient_cooling.m”. The script program responsible for COMSOL data import and data comparison will appear in a new window. 3. Press F5 key to run the script. MATLAB editor will display a warning message. Click “Change Directory” to run the script. Lumped Capacity method and COMSOL solutions will be plotted on the top graph. The bottom graph shows the difference in center and surface temperatures as a function of time. These results are shown on the next page.
- 98 -
Cooling of a Rod (Transient Study)
ME433 COMSOL INSTRUCTIONS
Results Plotted with MATLAB:
While in MATLAB, you may zoom into the top plot to notice small departures in results based on the solution methods. Armed with these results, you are in a position to answer questions 3 and 4.
- 99 -
Cooling of a Rod (Transient Study)
ME433 COMSOL INSTRUCTIONS
APPENDIX
MATLAB script
If you could not obtain this script from the Blackboard or the PDF file, you may copy it here, then paste it into notepad and save it in the same directory where you saved COMSOL data file(s). You will most likely get hard – to – spot syntax errors if you copy the script this way. It is therefore highly advised that you use the other 2 methods on obtaining this script instead of the copying method. % ######################################################################### % ME 433 - Heat Transfer % Supplementary MATLAB Script For: % (X) Transient Cooling by Free Convection % IMPORTANT: Save this file in the same directory where % "center_data.txt" and "surface_data.txt" % files are saved. % ######################################################################### clear % Clears the UI prompt clc % Clears variables from memory %% Constant Quantities Ti = 150; % Rod initial temperature at t = 0 sec, [degrees C] Tinf = 20; % Ambient temperature, [degrees C] rho = 7850; % 1% Carbon Steel density @20C, [kg/m^3] Cp = 475; % 1% Carbon Steel heat capacity @20C, [J/kg-C] h = 10; % Heat transfer coeff., [W/m^2-C] r0 = 1.5e-2; % Rod radius, [m] %% Time Vector: t_dummy = 20000; t = 0:100:t_dummy;
% Final time, [seconds] % [seconds]
%% Temperature Distribution by Lumped Capacity Method: T = Tinf + (Ti - Tinf)*exp(-(2*h*t)/(rho*Cp*r0)); % Eq. 5.7, [degrees C] %% Temperature Distribution from COMSOL Multiphysics: load center_data.txt; % Loads T(0,t) as a 2 column vector load surface_data.txt; % Loads T(r0,t) as a 2 column vector tcent_comsol = center_data(:,1)'; %\ Tcent_comsol = center_data(:,2)'; % |--> COMSOL data splitting tsurf_comsol = surface_data(:,1)'; % |--> into single row vectors Tsurf_comsol = surface_data(:,2)'; %/ %% Temperature Distribution Plot: figure1 = figure('InvertHardcopy','off',... %\ 'Colormap',[1 1 1 ],... % | -> Setting up the figure 'Color',[1 1 1]); %/ subplot(2,1,1) plot(t,T,'r',tcent_comsol,Tcent_comsol,'b',tsurf_comsol,Tsurf_comsol,'k') grid on title('\fontname{Times New Roman} \fontsize{16} \bf Lumped Capacity vs. COMSOL Temp. Distributions') xlabel('\fontname{Times New Roman} \fontsize{14} \it \bf Time t, [s]') ylabel('\fontname{Times New Roman} \fontsize{14} \it \bf T, [\circC]') legend('Eq. 5.7','COMSOL Solution (center)','COMSOL Solution (surface)') %% Temperature Difference Plot from COMSOL Multiphysics: T_diff = Tcent_comsol - Tsurf_comsol; subplot(2,1,2) plot(t,T_diff); grid on title('\fontname{Times New Roman} \fontsize{16} \bf COMSOL Center - to - Surface \DeltaT') xlabel('\fontname{Times New Roman} \fontsize{14} \it \bf Time t, [s]') ylabel('\fontname{Times New Roman} \fontsize{14} \it \bf \DeltaT = T(0,t) - T(r_0,t), [\circC]')
This completes MATLAB modeling procedures for this problem. - 100 -
Laminar Forced Convection Over an Isothermal Flat Plate
ME433 COMSOL INSTRUCTIONS
LAMINAR FORCED CONVECTION OVER AN ISOTHERMAL FLAT PLATE Problem Statement
Ambient room temperature air at standard atmospheric pressure flows over an isothermal semi – infinite flat plate. Air starts to flow at x = 0 with a uniformly distributed velocity profile V∞. The plate has an insulated section extending from x = 0 to x = x0 and is maintained at a constant temperature Ts from x = x0 to x = L (the considered plate length L is not shown). Of general interest is to learn how to use COMSOL in obtaining the flow and temperature distribution fields and compare them with the Blasius and Pohlhausen solutions (or more general curve fits of them). It is desired to obtain qualitative, as well as quantitative perspectives about boundary layer flow concept from COMSOL solutions. Known quantities: Fluid: Air
Flow over an Isothermal Flat Plate with an Insulated Leading Section
V∞ = 0.1 m/s T∞ = 20 ºC Ts = 200 ºC L = 10 cm x0 = 2 cm Observations
This is an external flow, forced convection problem. Both fluid and temperature fields are essential parts of the problem. COMSOL model must include steady state analyses for both heat transfer and Navier – Stokes application modes. To solve this problem, a coupled Multiphysics model must be created.
Subject to all 16 assumptions given in section 7.2.1, Blasius solution applies. Subject to all 16 assumptions given in section 7.2.1, an approximation of Pohlhausen’s solution given by equation 7.30 applies.
Although one of the assumptions for analytic solution is that of constant properties, COMSOL can easily handle material property variations. Some of the key properties of air strongly depend on temperature variations. We will discuss which properties of air should be varied in “Options and Settings”, along with equations that achieve this. Property variation will be included in our COMSOL model.
Neglecting the thickness of the plate, the flow and heat transfer processes can be modeled with a simple rectangular geometry. However, plate boundary must then be split into two separate but connected boundaries in order to allow the correct boundary condition setup.
- 101 -
Laminar Forced Convection Over an Isothermal Flat Plate
ME433 COMSOL INSTRUCTIONS
Assignment
1. State and calculate the conditions under which the flow field in this problem can be considered laminar and that the concept of boundary layer flow can be applied. 2. Use COMSOL to solve for and save 2D color distributions of velocity and temperature fields. 3. Use COMSOL to solve for and save 2D color distributions of key air properties. Use your textbook’s Appendix C to examine whether or not these properties were accurately determined by COMSOL. 4. Use COMSOL to plot and save T(0.08,y). 5. Use COMSOL to compute the heat transfer rate per unit length, qT along the plate’s surface. Use equations 7.25 and 7.28 to compute theoretical qT . Assume a plate of 1 meter in width. Compare the qT values. Are COMSOL results valid? 6. Use COMSOL to plot and extract numerical data for local qx x, 0 for x0 x L . Use Newton’s law of cooling to determine COMSOL h(x) from
qx x, 0 for x0 x L . Compute and plot analytically determined local h(x)
given by equation 7.30 and COMSOL h(x) on the same graph. [Note: In this instruction set, part of this assignment question will be done with MATLAB, but you are free to use any software of your choice] 7. Calculate and plot the percent error between COMSOL h(x) and theoretical h(x). Base your error analysis on assumption that COMSOL h(x) is the correct solution. Can you conclude that COMSOL results are valid? [Note: In this instruction set, part of this assignment question will be done with MATLAB, but you are free to use any software of your choice] 8. [Extra Credit]: Use COMSOL and MATLAB to graph on the same plot theoretical and COMSOL – determined boundary layers and T . Comment on differences in the solutions you notice. Which results would you trust? The instructions for COMSOL boundary layer data extraction and sample MATLAB scripts that will plot and T are given separately in the appendix.
- 102 -
Laminar Forced Convection Over an Isothermal Flat Plate
ME433 COMSOL INSTRUCTIONS
Modeling with COMSOL Multiphysics MODEL NAVIGATOR
To start working on this problem, we first need to enable two application modes in the model navigator to create a Multiphysics model. The correct application modes are: (1) General Heat Transfer, and (2) Weakly Compressible Navier – Stokes. These modes will be responsible for setting up and calculating temperature and velocity distribution fields, respectively. For this setup: 1. Start “COMSOL Multiphysics”. 2. From the list of application modes, select “Heat Transfer Module General Heat Transfer Steady – state analysis”. 3. Click the “Multiphysics” button. 4. Click the “Add” button. 5. From the list of application modes, select “Heat Transfer Module Weakly Compressible Navier – Stokes Steady – state analysis”. 6. Click the “Add” button. 7. Click “OK”.
- 103 -
Laminar Forced Convection Over an Isothermal Flat Plate
ME433 COMSOL INSTRUCTIONS
OPTIONS AND SETTINGS: DEFINING CONSTANTS
In this section, we will define material properties of air (Applying them to geometry is done in “Subdomain Settings” section). Some of the properties strongly depend on temperature while others do not. Since we are working with a rather large temperature range (20ºC – 200ºC) and would like to include property variation in the model, we first need to determine which of the properties exhibit strong temperature dependence. This is done by examining Appendix C – Properties of dry air at atmospheric pressure. Notice that with increasing temperature, properties of air either increase or decrease in the given temperature range. Notice further that no property reaches a maximum or a minimum in the given temperature range. This enables us to concentrate our attention on the extremes of the given temperature range in evaluating temperature dependence of the properties. The following table lists numerical values for properties of air at the given temperature extremes and shows the percent difference in those properties based on these extremes. Cp EVALUATED AT T∞ EVALUATED AT Ts % DIFFERENCE (based on 20ºC)
1006.1
1.2042
k
Pr
18.17x10
-6
0.02564
0.713
-6
0.03781
0.699
47.5
2
1025.0
0.7461
25.79x10
1.9
38
42
Based on these calculations, it is now clear that for air in the given temperature range, , , and k strongly depend on temperature while C p and Pr are weakly dependent properties with respect to temperature. Therefore, C p and Pr will be set as constants while , , and k will be modeled as varying properties. The following equations will be used to calculate air properties that vary strongly with temperature: PM 0 w , [kg/m3 ] RT k 103.723 0.865log10 T , [W/m K]
6 106 4 108 T , [Pa s] [Ref.: J.M. Coulson and J.F. Richardson, Chemical Engineering, Vol. 1, Pergamon Press, 1990, appendix]
Where,
P0 (atmospheric pressure) 101.3 kPa, M w (molecular weight of air) 0.0288 kg mol, R (universal gas constant) 8.314 J/mol K
- 104 -
Laminar Forced Convection Over an Isothermal Flat Plate
ME433 COMSOL INSTRUCTIONS
Armed with these equations, let us now define temperature dependent air properties in COMSOL. 1. From the “Options” menu select “Expressions Scalar Expressions …” 2. Define the following names and expressions: NAME
EXPRESSION
UNIT
k_air
10^(-3.723+0.865*log10(abs(T[1/K])))[W/(m*K)]
W/(m·K)
rho_air
1.013e5[Pa]*28.8[g/mol]/(8.314[J/(mol*K)]*T)
kg/m
mu_air
6e-6[Pa*s]+4e-8[Pa*s/K]*T
Kg/(m·s)
3
DESCRIPTION Air Conductivity Air Density Air Viscosity
3. Click “OK”. COMSOL automatically determines correct property unit under the “Unit” column. If it does not, you are most likely entering wrong expressions. Carefully check the expression you typed and make corrections, if necessary. The description column is optional and can be left blank. Although Prandtl’s number is essential, it is a composite property that is defined by C p ,
, and k , most of which have now been defined. The only constant property that needs to be defined as well is C p . We will define and apply it to geometry in “Subdomain Settings” section. GEOMETRY MODELING
In this model we will create a 2D rectangular geometry by drawing it. This is particularly useful since we need to create a boundary for the insulated part as a separate entity. 1. Start by clicking on the “Line” button
located on the draw toolbar.
2. Position your cursor at the origin (0,0) in the main drawing area and start making a line by pressing on the left mouse button (LMB) once and moving the mouse to the right. You should be getting a line that looks like this one . 3. Move your cursor to the (0.2,0) coordinate and press the left mouse button (LMB) once to create the first line. As you do this, the line segment from (0,0) to (0.2,0) should turn red, as shown here . 4. Continue to make the line segments outlined in the previous step for the following coordinates; from: (a) (0.2,0) to (1,0); (b) (1,0) to (1,0.4); (c) (1,0.4) to (0,0.4); and (d) (0,0.4) to (0,0). The geometry you are creating should look rectangular. 5. Once back at the origin (0,0), press on the right mouse button (RMB) to finish the rectangle.
- 105 -
Laminar Forced Convection Over an Isothermal Flat Plate
ME433 COMSOL INSTRUCTIONS
We now must scale the geometry down to centimeters. (Recall that COMSOL’s default system of units is the MKS. Therefore, we just made a 1 – meter long rectangle). 6. To scale the geometry, go under “Draw Modify Scale” menu and type “0.1” as a scale factor for both “x” and “y” fields as shown below:
7. Click “OK”. 8. Click on “Zoom Extents” button geometry.
in the main toolbar to zoom into the
Your geometry should now be complete and highlighted in red, as shown below.
PHYSICS SETTINGS
Physics settings in COMSOL consist of two parts: (1) Subdomain settings and (2) boundary conditions. The subdomain settings let us specify material types, initial conditions, modes of heat transfer (i.e. conduction and/or convection). The boundary conditions settings are used to specify what is happening at the boundaries of the geometry. In this model, we will have to specify and couple physics settings for the flow of air and heat transfer. Let us begin with the air flow physics settings.
- 106 -
Laminar Forced Convection Over an Isothermal Flat Plate
ME433 COMSOL INSTRUCTIONS
Non – Isothermal Flow Subdomain Settings:
1. From the “Physics” menu select “Subdomain Settings” (equivalently, press F8). 2. Select subdomain 1 in the “Subdomain selection” window. 3. Enter “rho_air” and “mu_air” in the fields for density ρ and dynamic viscosity η. 4. Click “OK”.
Non – Isothermal Flow Boundary Conditions:
1. From the “Physics” menu open the “Boundary Settings” (F7) dialog box. 2. Apply the following boundary conditions: BOUNDARY
BOUNDARY TYPE
BOUNDARY CONDITION
COMMENTS
1
Inlet
Velocity
Enter “0.1” in “U0” field (Normal Inflow velocity)
2, 4
Wall
No Slip
3, 5
Open boundary
Normal stress
Verify that field “f0” is set to “0”
3. Click “OK” to close the boundary settings window.
- 107 -
Laminar Forced Convection Over an Isothermal Flat Plate
ME433 COMSOL INSTRUCTIONS
General Heat Transfer Subdomain Settings
1. From “Mulptiphysics” menu, select “1 General Heat Transfer (htgh)” mode. 2. From the “Physics” menu, select “Subdomain Settings” (F8). 3. Select “Subdomain 1” in the subdomain selection field. 4. Enter “k_air”, “rho_air” and “1006” in the k, ρ, and Cp fields, respectively.
5. Switch to “Convection” tab and check “Enable convective heat transfer” option. 6. Type “u” and “v” in the u and v fields, respectively. 7. Click “OK” to close the Subdomain Settings window.
- 108 -
Laminar Forced Convection Over an Isothermal Flat Plate
ME433 COMSOL INSTRUCTIONS
General Heat Transfer Boundary Conditions:
1. From the “Physics” menu open the “Boundary Settings” (F7) dialog box. 2. Apply the following boundary conditions: BOUNDARY
BOUNDARY CONDITION
COMMENTS
1
Temperature
Enter “273.15+20” in T0 field
2, 3
Insulation/Symmetry
4
Temperature
5
Convective flux
Enter “273.15+200” in T0 field
3. Click “OK” to close Boundary Settings window. MESH GENERATION
To minimize the computational time without compromising much accuracy of the solution, we must change the default meshing parameters. To do this, 1. Go to the “Mesh” menu and select “Free Mesh Parameters …” option. 2. Change “Predefined mesh sizes” from “Normal” to “Finer”. 3. Switch to “Boundary” tab. 4. Select boundaries 1 and 5 in the “Boundary selection” field while holding the “Control (ctrl)” key on your keyboard. 5. Switch to “Distribution” tab. 6. Enable “Constrained edge element distribution” option. 7. Enter “20” in the “Number of edge elements” field.
8. Select boundary 2. (Do not hold the “Control (ctrl)” key on your keyboard)
- 109 -
Laminar Forced Convection Over an Isothermal Flat Plate
ME433 COMSOL INSTRUCTIONS
9. Switch to “Distribution” tab and enable “Constrained edge element distribution”. 10. Enter “30” in the “Number of edge elements” field. 11. Select boundary 4. (Do not hold the “Control (ctrl)” key on your keyboard) 12. Switch to “Distribution” tab and enable “Constrained edge element distribution”. 13. Enter “80” in the “Number of edge elements” field. 14. Switch to “Point” tab. 15. Select points 1 and 3 in the “Point selection” field while holding the “Control (ctrl)” key on your keyboard. 16. Enter “0.0001” in the “Maximum element size” field. 17. Click the “Remesh” button. 18. Click “OK” to close the “Free Mesh Parameters” window.
As a result of these steps, you should get the following triangular mesh:
We are now ready to compute our solution.
- 110 -
Laminar Forced Convection Over an Isothermal Flat Plate
ME433 COMSOL INSTRUCTIONS
COMPUTING AND SAVING THE SOLUTION
In this step we define the type of analysis to be performed. We are interested in steady – state analysis here, which we previously selected in the Model Navigator. Therefore, no modifications need to be made. To enable the solver, proceed with the following steps: 1. From the “Solve” menu select “Solve Problem”. (Allow few seconds for solution) 2. Save your work on desktop by choosing “File Save”. Name the file according to the naming convention given in the “Introduction to COMSOL Multiphysics” document. The result that you obtain should resemble the following boundary color map:
By default, your immediate result will be given in Kelvin instead of degrees Celsius. (In fact, the first result you will see is the velocity field, not temperature). Furthermore, it will be colored using a “jet” colormap and the velocity field (represented by arrows in the above) will not be shown. We will use distinct colormap options to represent the air velocity and temperature fields. The next section (Postprocessing and Visualization) will help you in obtaining the above and other diagrams, such as 2D color distributions of key air properties, a plot of T(y) at x = 8 cm, a plot of local qx x, 0 for x0 x L . We will also show how to use COMSOL to compute the total heat transfer rate per unit length, qT and use MATLAB to determine h(x) from COMSOL qx x, 0 data and analytically.
- 111 -
Laminar Forced Convection Over an Isothermal Flat Plate
ME433 COMSOL INSTRUCTIONS
POSTPROCESSING AND VISUALIZATION
After solving the problem, we would like to be able to look at the solution. COMSOL offers us a number of different ways to look at our temperature (and other) fields. In this problem we will deal with 2D color maps, velocity (and other) vector fields, computation of local qx x, 0 as well as the heat transfer rate per unit length, qT along the plate’s surface, and 1D temperature distribution plot. You will then address the questions of COMSOL solution validity and compare the results to theoretical predictions mainly by using MATLAB. Displaying T(x, y) and Vector Field V(x, y)
Let us first change the unit of temperature to degrees Celsius: 1. From the “Postprocessing” menu, open “Plot Parameters” dialog box (F12). 2. Under the “Surface” tab, change the unit of temperature to degrees Celsius from the drop – down menu in the “Unit” field. 3. Change the “Colormap” type from “jet” to “hot”. 4. Click “Apply” to refresh main view and keep the “Plot Parameters” window open.
- 112 -
Laminar Forced Convection Over an Isothermal Flat Plate
ME433 COMSOL INSTRUCTIONS
The 2D temperature distribution will be displayed using the “hot” colormap type with degrees Celsius as the unit of temperature. Let’s now add the velocity vector field V(x,y). 5. Switch to the “Arrow” tab and enable the “Arrow plot” check box. 6. Choose “Velocity field” from “Predefined quantities”. 7. Enter “20” in the “Number of points” for both “x” and “y” fields. 8. Press the “Color” button and select a color you want the arrows to be displayed in. (Note: choose a color that produces good contrast. Green and white are good choices here) 9. Click “Apply” to refresh main view and keep the “Plot Parameters” window open.
At this point, you will see a similar plot as shown on page 111. It is a good idea to save this colormap for future use. Before you do save it, however, experiment with the “Number of points” field in “Plot Parameters” window and adjust the velocity vector field to what seems the best view to you. Put “30” for the “y” field and update your view by pressing “Apply” button. Notice the difference in velocity vector field representation. Try other values.
- 113 -
Laminar Forced Convection Over an Isothermal Flat Plate
ME433 COMSOL INSTRUCTIONS
You may also want to see other quantities as vector fields. Available quantities are: (1) Temperature gradient, (2) Conductive heat flux, (3) Convective heat flux, and (4) Total heat flux. To see these quantities represented by a vector field: 10. Change the color of the arrow (see step 8). 11. Choose the quantity you wish to plot from “Predefined quantities”. 12. Click “Apply”. 13. Click “OK” when you are done displaying these quantities to close the “Plot Parameters” window. Saving Color Maps:
After you have selected a view that shows the results clearly, you may want to save it as an image for future discussion. This may be done as follows: 1. Go to the “File” menu and select “Export Image”. This will bring up an “Export Image” window. For a 4” by 6” image, acceptable image quality settings are given in the figure below. If you need higher image quality, increase the DPI value.
2. Change your “Export Image” value settings to the ones in the above figure. 3. Click the “Export” button. 4. Name and save the image.
- 114 -
Laminar Forced Convection Over an Isothermal Flat Plate
ME433 COMSOL INSTRUCTIONS
Displaying V(x, y) as a Colormap:
1. From the “Postprocessing” menu, open “Plot Parameters” dialog box (F12). 2. Under the “Arrow” tab, disable the “Arrow plot” checkbox 3. Switch to “Surface” tab.
4. From “Predefined quantities”, select “Velocity field”. 5. Change the “Colormap” type from “hot” to “jet”. 6. Click “Apply” to refresh main view and keep the “Plot Parameters” window open. The 2D Velocity distribution will be displayed using the “jet” colormap. Displaying Variations of Key Air Properties as Colormaps:
With the “Plot Parameters” window open, ensure that you are under the “Surface” tab, 7. Type “k_air” in “Expression” field (without quotation marks).
8. Click “Apply”. (Note: The unit will change automatically) These steps produce a colormap that displays variations in air’s thermal conductivity k. Note the values on the color scale and compare them with Appendix C of your textbook. - 115 -
Laminar Forced Convection Over an Isothermal Flat Plate
ME433 COMSOL INSTRUCTIONS
To produce colormaps for density and viscosity variations, repeat steps 6 and 7 while typing “rho_air” and “mu_air”, respectively in the “Expression” field in step 6. When done, click “OK” to close the “Plot Parameters” window. Note: You may also view composite properties, such as kinematic viscosity and Prandtl’s number simply by entering their definitions in the “Expression” field. Thus, to view kinematic viscosity variation, enter “mu_air/rho_air”. For Prandtl number, enter “1006*mu_air/k_air”. It is even possible to enter expressions for other desired quantities, such as local Reynold’s number. For Reynold’s number evaluated at every x and y using x as the computational value in its definition, enter “0.1[m/s]*rho_air*x/mu_air”. For Reynold’s number evaluated at every x and y using y as the computational value in its definition, enter “0.1[m/s]*rho_air*y/mu_air”. Plotting T(0.08, y) (or T(y) at x = 8 cm):
1. From “Postprocessing” menu select “Cross – Section Plot Parameters” option. 2. Switch to the “Line/Extrusion” tab. 3. Change the “Unit” of temperature to degrees Celsius. 4. Change the “x – axis data” from “arc – length” to “y”. 5. Enter the following coordinates in the “Cross – section line data”: x0 = x1 = 0.08; y0 = 0 and y1 = 0.04. 6. Click “OK”.
- 116 -
Laminar Forced Convection Over an Isothermal Flat Plate
ME433 COMSOL INSTRUCTIONS
These steps produce a plot of T(y) at x = 8 cm, from y = 0 cm (plate surface) to y = 4 cm (ambient environment conditions). Temperature T is plotted on the y – axis and y – coordinates are plotted on the x – axis. To save this plot, 7. Click the save “ ” button in your figure with results. This will bring up an “Export Image” window. 8. Follow steps 2 – 4 as instructed on page 114 to finish with exporting the image. Computing Heat Transfer Rate per Unit Length, qT along the Plate Surface
To compute heat transfer rate per unit length using COMSOL, 1. Select “Boundary Integration …” option from “Postprocessing” menu. 2. Select boundary 4 in the “Subdomain selection” field. 3. Change “Predefined Quantities” setting to “Normal total heat flux”.
4. Click the “OK” button. The value of the integral (solution) is displayed at program’s prompt on the bottom. For this model, q ' = 64.73 W/m.
- 117 -
Laminar Forced Convection Over an Isothermal Flat Plate
ME433 COMSOL INSTRUCTIONS
Plotting Local qx x , 0 for x0 x L
To plot qx x, 0 for x0 x L using COMSOL, 1. Select “Cross – Section Plot Parameters …” option from “Postprocessing” menu. 2. Switch to the “Line/Extrusion” tab. 3. From “Predefined quantities”, select “Total heat flux”. 4. Change the “x – axis data” from “y” to “x”. 5. Enter the following coordinates in the “Cross – section line data”: x0 = 0.02, x1 = 0.1; y0 = y1 = 0. 6. Click “OK” to close Cross – Section Plot Parameters window.
As a result of these steps, a new plot will be shown that graphs qx x, 0 for x0 x L . Do not close this plot just yet. We are going to extract this data to a text file for comparative analysis with MATLAB.
- 118 -
Laminar Forced Convection Over an Isothermal Flat Plate
ME433 COMSOL INSTRUCTIONS
Exporting COMSOL Data to a Data File:
1. Click on “Export Current Plot” button
in the graph created in the previous step.
2. Click “Browse” and navigate to your saving folder (say “Desktop”). 3. Name the file “qx.txt”. (Note: do not forget to type the “.txt” extension in the name of the file). 4. Click “OK” to save the file.
This completes COMSOL modeling procedures for this problem.
- 119 -
Laminar Forced Convection Over an Isothermal Flat Plate
ME433 COMSOL INSTRUCTIONS
Modeling with MATLAB
This part of modeling procedures describes how to create comparative graphs of local heat transfer coefficient h(x) (along the heated portion of the plate) using MATLAB. Obtain MATLAB script file named “isothermal_plate.m” from Blackboard prior to following these procedures. Save this file in the same directory as the data file(s) (qx.txt) from COMSOL. (Note: “isothermal_plate.m” file is attached to the electronic version of this document as well. To access the file directly from this document, select “View Navigation Panels Attachements” and then save “isothermal_plate.m” in a proper directory) Comparing COMSOL solution with Generalized Pohlhausen Solution:
MATLAB script (isothermal_plate.m) is programmed to use exported COMSOL data for heat flux qx x, 0 and Newton’s Law of cooling to determine the local heat transfer coefficient h(x) along the heated portion of the plate. The script is also programmed to calculate analytical local heat transfer coefficient h(x) according to equation 7.30. This equation represents is a more general approximation to Pohlhausen solution that is suitable for plates with insulated section. The script will ultimately produce comparative graphs that will plot both solutions. Follow the steps below to complete this problem: 1. Open MATLAB by double clicking its icon on the Desktop. 2. Load “isothermal_plate.m” file by selecting “File Open Desktop isothermal_plate.m”. The script responsible for COMSOL data import and data comparison will appear in a new window. 3. Press F5 key to run the script. MATLAB editor will display a warning message. Click “Change Directory” to run the script. Approximated Pohlhausen’s and COMSOL solutions will be plotted in Figure 1. Figure 2 plots the percent error between local heat transfer coefficients according to the equation printed on the figure. These results are shown on the next page.
- 120 -
Laminar Forced Convection Over an Isothermal Flat Plate
ME433 COMSOL INSTRUCTIONS
Results plotted with MATLAB:
While in MATLAB, you may zoom into the top plot to notice departures in results based on the solution methods. Armed with these results, you are in a position to answer most of the assigned questions. (Approaches that show how to answer extra credit questions are given in appendix). This completes MATLAB modeling procedures for this problem.
- 121 -
Laminar Forced Convection Over an Isothermal Flat Plate
ME433 COMSOL INSTRUCTIONS
APPENDIX
MATLAB script
If you could not obtain this script from the Blackboard or the PDF file, you may copy it here, then paste it into notepad and save it in the same directory where you saved COMSOL data file(s). You will most likely get hard – to – spot syntax errors if you copy the script this way. It is therefore highly advised that you use the other 2 methods on obtaining this script instead of the copying method. % ######################################################################### % ME 433 - Heat Transfer % Sample MATLAB Script For: % (X) Laminar Thermal Boundary Layer [Specified Surface Temperature] % IMPORTANT: Save this file in the same directory with "qx.txt" file. % ######################################################################### % clc; % Clears the UI prompt clear; % Clears variables from memory % %% Constant Quantities Ts = 200; % Plate surface temperature, [degC] Tinf = 20; % Ambient temperature, [degC] Vinf = 0.1; % Velocity at the inlet, [m/s] k_air = 0.038982887; % Air conductivity at plate surface, [W/m-K] Pr_air = 0.704; % Air Prandtl number evaluated at Tfilm, [1] eta_air = 3.3609305e-05; % Air viscosity at plate surface, [m^2/s] x0 = 0.02; % A speical plate coordinate!, [m] %% COMSOL Data Import & hx_comsol Computation load qx.txt; % Imports a 2-column data vector from COMSOL xcoord = qx(:,1)'; % Plate coordinate vector, [m] qx = qx(:,2)'; % COMSOL q'' vector, [W/m^2] % hx_comsol = qx./(Ts-Tinf); % Heat transf. coeff. from COMSOL %% Analytical analysis Rex = Vinf.*(xcoord)./eta_air; % Local Reynold's number, [1] num = (0.3387.*(Rex).^(1/2).*Pr_air^(1/3))./... % Local Nux numerator (1 + (0.0468/Pr_air)^(2/3))^(1/4); den = (1 - (x0./xcoord).^(3/4)).^(1/3); % Local Nux denominator Nux = num./den; % Local Nux hx_analyt = k_air./xcoord.*Nux; % Local hx from theory %% Error analysis in h deltah = abs(hx_comsol - hx_analyt); error = deltah./hx_comsol*100;
%| -> Simple % Error %| -> calculation for h
%% Plotter and Plot Cosmetics figure1 = figure('InvertHardcopy','off',... %\ 'Colormap',[1 1 1 ],... % | -> Setting up the figure 'Color',[1 1 1]); %/ plot(xcoord,hx_comsol,xcoord,hx_analyt) % Plots COMSOL vs. Theory h xlim([0.02 0.1]) %| -> Limits x-axis plot view ylim([0 35]) %| -> Limits y-axis plot view % % Plot cosmetics for figure 1 begin here: annotation(figure1,'textbox',... 'String',{'Flow Over an Isothermal Plate','with Insulated Edge'},... 'HorizontalAlignment','center',... 'FontSize',14,... 'FontName','Times New Roman',... 'FitBoxToText','off',... 'LineStyle','none',... 'BackgroundColor',[1 1 1],... 'Position',[0.5904 0.6359 0.3073 0.1669]);
- 122 -
Laminar Forced Convection Over an Isothermal Flat Plate
ME433 COMSOL INSTRUCTIONS
annotation(figure1,'textbox',... 'String',{... 'T_s = 200\circC','T_\infty = 20\circC','V_\infty = 0.1 m/s','L = 10 cm','x_0 = 2 cm'},... 'FontSize',14,... 'FontName','Times New Roman',... 'FontAngle','italic',... 'FitBoxToText','off',... 'EdgeColor',[1 1 1],... 'BackgroundColor',[1 1 1],... 'Position',[0.6335 0.3088 0.2228 0.3127]); legend('COMSOL Solution','Equation [7.30]') box off grid on title('\fontname{Times New Roman} \fontsize{16} \bf Local Heat Transfer Coefficient') xlabel('x, [m]') ylabel('h, [W/m^2-\circC]') set(get(gca,'YLabel'),... 'fontsize', 14,... 'FontName','Times New Roman',... 'FontAngle','italic') set(get(gca,'XLabel'),... 'fontsize', 14,... 'FontName','Times New Roman',... 'FontAngle','italic') figure2 = figure('InvertHardcopy','off',... 'Colormap',[1 1 1 ],... 'Color',[1 1 1]);
%\ % | -> Setting up the figure %/
plot(xcoord,error) % Plots % Error in h xlim([0.02 0.1]) %| -> Limits x-axis plot view ylim([0 40]) %| -> Limits y-axis plot view % % Plot cosmetics for figure 2 begin here: box off grid on title('\fontname{Times New Roman} \fontsize{16} \bf Error Analysis') xlabel('x, [m]') ylabel('Error in h, [%]') set(get(gca,'YLabel'),... 'fontsize', 14,... 'FontName','Times New Roman',... 'FontAngle','italic') set(get(gca,'XLabel'),... 'fontsize', 14,... 'FontName','Times New Roman',... 'FontAngle','italic') str1(1) = {'$${\%err={h_{x_{eq.7.30}}-h_{x_{comsol}}\over h_{x_{comsol}}}\times 100} $$'}; text('units','normalized', 'position',[.35 .9], ... 'fontsize',14,... 'FontName', 'Times New Roman',... 'FontAngle', 'italic', ... 'BackgroundColor',[1 1 1],... 'interpreter','latex',... 'string', str1);
- 123 -
Laminar Forced Convection Over an Isothermal Flat Plate
ME433 COMSOL INSTRUCTIONS
COMSOL Hints and Sample MATLAB Scripts for Extra – Credit Question
The goal of this question is to obtain boundary layers and T from COMSOL and compare them directly with analytical boundary layer solutions obtained by Blasius and Pohlhausen. This is particularly tricky, since there is no clear definition as to where the viscous boundary layer thickness occurs. Notice that in our textbook, the definition is given based on the condition that u / V be 0.994, from which, with the use of table 7.1, equation 7.11 is derived. We could have taken u / V as close to unity as we wish and equation 7.11 would therefore change. Physically, the closer u / V is to unity, the better the distinction in the viscous boundary layer, since it implies that u V . The number 0.994, however, is special because it corresponds to a Prandtl’s number of 1.0 on Pohlhausen’s solution given in figure 7.2. From figure 7.2 and equation 7.19, it follows that for air (Pr = 0.7), t / 1 , since t 6.5 . We therefore need to program MATLAB with the following analytical equations for and T : 5.2 x 6.5 and t 5.2 Re x To compute Re x , properties at Tfilm must be found. This is easily done since both temperature extremes are given. Variable x ranges between 0 x 0.1 meters. In COMSOL, we have to use “Contour” plot type to single out velocity and temperature iso – curves that correspond to u / V 0.994 and T * 1 conditions, respectively. To extract boundary layer from COMSOL, 1. From the “Postprocessing” menu, open “Plot Parameters” dialog box (F12). 2. Under the “Arrow” tab, disable the “Arrow plot” checkbox 3. Switch to “Contour” tab. 4. Enable “Contour plot” checkbox on the top left portion of the window. 5. Type “u” in the “Expression field. (without quotation marks) 6. Enable “Vector with isolevels” radio button option. (The entry field right below it enables us to enter the single out the velocity for which we want the iso – curve to be mapped out). 7. Enter “0.0944” in the entry field below “Vector with isolevels”. (This is the x – component velocity that satisfies u / V 0.994 condition).
- 124 -
Laminar Forced Convection Over an Isothermal Flat Plate
ME433 COMSOL INSTRUCTIONS
8. Switch to “General” tab. 9. Disable all other plot types except “Contour” and “Geometry edges”. 10. Use the “Plot in” drop down menu (located on the bottom left of the window) to switch from “Main axes” to “New figure”. 11. Click “OK”. Viscous COMSOL boundary layer satisfying u / V 0.994 will be shown in a new plot figure. 12. Click on “Export Current Plot” button
.
13. Name the file “fluid_blayer.txt”. (Note: do not forget to type the “.txt” extension in the name of the file). 14. Click “OK” to save the file. The file is saved in the same directory where you first saved COMSOL model file with extension “.mph”. To extract boundary layer T from COMSOL, simply repeat the above steps with following modifications:
In step 5, type “T” in the “Expression field and change the unit to degrees Celsius.
In step 7, enter a temperature in degrees Celsius that satisfies T * 1 condition. (Note: do not enter the value for temperature of the ideal condition, namely T * 1 , because no clear temperature iso – level exists for it in COMSOL solution. Experiment with the values and enter a temperature for which T * 1 condition is nearly satisfied).
In step 13, name the file “thermal_blayer.txt”.
- 125 -
Laminar Forced Convection Over an Isothermal Flat Plate
ME433 COMSOL INSTRUCTIONS
The following MATLAB script sample shows how the above analytical equations can be programmed. It also imports COMSOL boundary layer data saved in “fluid_blayer.txt” and “thermal_blayer.txt” text files and uses it to plot comparative graphs. %% Preliminaries clc; clear; %% Constant Quantities Vinf = 0.1; k_air = 0.03194; rho_air = 0.9213; Pr_air = 0.704; mu_air = 22.2e-6; eta_air = mu_air/rho_air;
% Clears the UI prompt % Clears variables from memory
% % % % % %
Velocity at the inlet, [m/s] Conductivity at Tf, [W/m-K] Density at Tf, [kg/m^3] Prandtl number at Tfilm, [1] Viscosity at Tf, [m^2/s] Specific viscosity at Tf, [m^2/s]
%% COMSOL Data Import load fluid_blayer.txt; xcomsol = fluid_blayer(:,1); ycomsol = fluid_blayer(:,2); % <-- COMSOL Viscous Bound. Layer Thincknes load thermal_blayer.txt; xcomsol2 = thermal_blayer(:,1); ycomsol2 = thermal_blayer(:,2);% <-- COMSOL Thermal Bound. Layer Thincknes %% Analytic Boundary Layer Thincknes Rex = Vinf*xcomsol/eta_air; yblasius = 5.2*xcomsol./sqrt(Rex);% <-- Viscous B.L.T. % xcomsol3 = xcomsol2 - min(xcomsol2); ypohlhausen = 6.3./sqrt(Vinf./(eta_air*xcomsol3));% <-- Thermal B.L.T. %% Percent Difference Analysis erryblasius = abs((ycomsol - yblasius)./yblasius)*100; errypohlhausen = abs((ycomsol2 - ypohlhausen)./ypohlhausen)*100; %% Plotter figure(1) plot(xcomsol,ycomsol,'r.',xcomsol,yblasius,'b.',... xcomsol2,ycomsol2,'r.',xcomsol2,ypohlhausen,'b.') grid on legend('COMSOL \delta','Blasius \delta',... 'COMSOL \delta_t','Pohlhausen \delta_t','location','northwest') figure(2) plot(xcomsol,erryblasius,'b.',xcomsol2,errypohlhausen,'r.')
This completes MATLAB modeling procedures for this problem.
- 126 -
Laminar Forced Convection Over a Heated Flat Plate
ME433 COMSOL INSTRUCTIONS
LAMINAR FORCED CONVECTION OVER A HEATED FLAT PLATE Problem Statement
Ambient room temperature air at standard atmospheric pressure flows over semi – infinite flat plate that is being heated by surface heat flux qs . Air starts to flow at x = 0 with a uniformly distributed velocity profile V∞. The plate has an insulated section extending from x = 0 to x = x0 and experiences applied heat flux qs x, 0 from x = x0 to x = L (the considered plate length L is not shown). Of general interest is to learn how to use COMSOL in obtaining the flow and temperature distribution fields and compare them with the Blasius and Pohlhausen solutions (or more general curve fits of them). It is desired to obtain qualitative, as well as quantitative perspectives about boundary layer flow concept from COMSOL solutions. Flow over an Isothermal Flat Plate with an Insulated Leading Section
Known quantities: Fluid: Air V∞ = 0.1 m/s T∞ = 20 ºC qs = 1000 W/m2
L = 10 cm x0 = 2 cm
Observations
This is an external flow, forced convection problem. Both fluid and temperature fields are essential parts of the problem. COMSOL model must include steady state analyses for both heat transfer and Navier – Stokes application modes.
Subject to all 16 assumptions given in section 7.2.1, Blasius solution applies. Although Pohlhausen’s solution does not apply directly due to a lack of plate temperature knowledge, it still can be used to develop equations for local Nusselt number and plate surface temperature distribution. Reference equations for these quantities will be presented in “Postprocessing and Visualization” section.
Although one of the assumptions for analytic solution is that of constant properties, COMSOL can easily handle material property variations. Some of the key properties of air strongly depend on temperature variations. We will discuss which properties of air should be varied in “Options and Settings”, along with equations that achieve this. Property variation will be included in our COMSOL model.
Neglecting the thickness of the plate, the flow and heat transfer processes can be modeled with a simple rectangular geometry. However, plate boundary must then be split into two separate but connected boundaries in order to allow the correct boundary condition setup.
- 127 -
Laminar Forced Convection Over a Heated Flat Plate
ME433 COMSOL INSTRUCTIONS
Assignment
1. State and calculate the conditions under which the flow field in this problem can be considered laminar and that the concept of boundary layer flow can be applied. 2. Use COMSOL to solve for and save 2D color distributions of velocity and temperature fields. 3. Use COMSOL to solve for and save 2D color distributions of key air properties. Use your textbook’s Appendix C to examine whether or not these properties were accurately determined by COMSOL. 4. Use COMSOL to plot and save T(0.08,y). 5. Use COMSOL to plot and extract surface temperature data T x, 0 . Use this data to compare it with surface temperature reference equations given in “Postprocessing and Visualization section”. Are COMSOL results valid? [Note: In this instruction set, part of this assignment question will be done with MATLAB, but you are free to use any software of your choice] 6. Use COMSOL data for T x, 0 on x0 x L and Newton’s law of cooling to determine COMSOL h(x) for x0 x L . Compute and plot analytically determined local h(x) given by a reference equation and COMSOL h(x) on the same graph. [Note: In this instruction set, part of this assignment question will be done with MATLAB, but you are free to use any software of your choice] 7. Calculate and plot the percent error between COMSOL h(x) and theoretical h(x). Base your error analysis on assumption that COMSOL h(x) is the correct solution. Can you conclude that COMSOL results are valid? [Note: In this instruction set, part of this assignment question will be done with MATLAB, but you are free to use any software of your choice] 8. [Extra Credit]: Use COMSOL and MATLAB to graph on the same plot theoretical and COMSOL – determined boundary layer . Comment on differences in the solutions you notice. Which results would you trust? The instructions for COMSOL boundary layer data extraction and sample MATLAB scripts that will plot are given separately in the appendix. 9. [Extra Credit]: Determine wall shear o induced by the flow on the plate and friction coefficient Cf.
- 128 -
Laminar Forced Convection Over a Heated Flat Plate
ME433 COMSOL INSTRUCTIONS
Modeling with COMSOL Multiphysics MODEL NAVIGATOR
To start working on this problem, we first need to enable two application modes in the model navigator to create a Multiphysics model. The correct application modes are located under COMSOL Multiphysics Fluid Dynamics and Heat Transfer sections. These modes will be responsible for setting up and calculating temperature and velocity distribution fields, respectively. For this setup: 1. Start “COMSOL Multiphysics”. 2. From the list of application modes, select “COMSOL Multyphysics Fluid Dynamics Incompressible Navier – Stokes Steady – state analysis”. 3. Click the “Multiphysics” button. 4. Click the “Add” button. 5. From the list of application modes, select “COMSOL Multyphysics Heat Transfer Convection and Conduction Steady – state analysis”. 6. Click the “Add” button. 7. Click “OK”.
- 129 -
Laminar Forced Convection Over a Heated Flat Plate
ME433 COMSOL INSTRUCTIONS
OPTIONS AND SETTINGS: DEFINING CONSTANTS
In this section, we will define material properties of air (Applying them to geometry is done in “Subdomain Settings” section). Some of the properties strongly depend on temperature while others do not. Since we are working with a rather large heat flux and would like to include property variation in the model, we first need to determine which of the properties exhibit strong temperature dependence. This is done by examining Appendix C – Properties of dry air at atmospheric pressure. Since we do not know the high temperature extreme in this problem, we will take the largest temperature available in Appendix C. Notice that with increasing temperature, properties of air either increase or decrease in the temperature range of 20ºC to 350ºC. Notice further that no property reaches a maximum or a minimum in this temperature range. This enables us to concentrate our attention on the extremes of the temperature range in evaluating temperature dependence of the properties. The following table lists numerical values for properties of air at these temperature extremes and shows the percent difference in those properties based on these extremes. Cp k Pr -6 1006.1 1.2042 18.17x10 0.02564 0.713 EVALUATED AT T∞ -6 0.04692 ~ 0.7 1056.8 0.5665 31.07x10 EVALUATED AT 350ºC % DIFFERENCE (based on 20ºC)
5.04
53
71
83
1.86
Based on these calculations, it is now clear that for air in this temperature range, , , and k strongly depend on temperature while C p and Pr are weakly dependent properties with respect to temperature. Therefore, C p and Pr will be set as constants while , , and k will be modeled as varying properties.
The following equations will be used to calculate air properties that vary strongly with temperature: PM 0 w , [kg/m3 ] RT k 103.723 0.865log10 T , [W/m K]
6 106 4 108 T , [Pa s] [Ref.: J.M. Coulson and J.F. Richardson, Chemical Engineering, Vol. 1, Pergamon Press, 1990, appendix]
Where,
P0 (atmospheric pressure) 101.3 kPa, M w (molecular weight of air) 0.0288 kg mol, R (universal gas constant) 8.314 J/mol K
- 130 -
Laminar Forced Convection Over a Heated Flat Plate
ME433 COMSOL INSTRUCTIONS
Armed with these equations, let us now define temperature dependent air properties in COMSOL. 1. From the “Options” menu select “Expressions Scalar Expressions …” 2. Define the following names and expressions: NAME
EXPRESSION
UNIT
k_air
10^(-3.723+0.865*log10(abs(T[1/K])))[W/(m*K)]
W/(m·K)
rho_air
1.013e5[Pa]*28.8[g/mol]/(8.314[J/(mol*K)]*T)
kg/m
mu_air
6e-6[Pa*s]+4e-8[Pa*s/K]*T
Kg/(m·s)
3
DESCRIPTION Air Conductivity Air Density Air Viscosity
3. Click “OK”. COMSOL automatically determines correct property unit under the “Unit” column. If it does not, you are most likely entering wrong expressions. Carefully check the expression you typed and make corrections, if necessary. The description column is optional and can be left blank. Although Prandtl’s number is essential, it is a composite property that is defined by C p ,
, and k , most of which have now been defined. The only constant property that needs to be defined as well is C p . We will define and apply it to geometry in “Subdomain Settings” section. GEOMETRY MODELING
In this model we will create a 2D rectangular geometry by drawing it. This is particularly useful since we need to create a boundary for the insulated part as a separate entity. 1. Start by clicking on the “Line” button
located on the draw toolbar.
2. Position your cursor at the origin (0,0) in the main drawing area and start making a line by pressing on the left mouse button (LMB) once and moving the mouse to the right. You should be getting a line that looks like this one . 3. Move your cursor to the (0.2,0) coordinate and press the left mouse button (LMB) once to create the first line. As you do this, the line segment from (0,0) to (0.2,0) should turn red, as shown here . 4. Continue to make the line segments outlined in the previous step for the following coordinates; from: (a) (0.2,0) to (1,0); (b) (1,0) to (1,0.4); (c) (1,0.4) to (0,0.4); and (d) (0,0.4) to (0,0). The geometry you are creating should look rectangular. 5. Once back at the origin (0,0), press on the right mouse button (RMB) to finish the rectangle.
- 131 -
Laminar Forced Convection Over a Heated Flat Plate
ME433 COMSOL INSTRUCTIONS
We now must scale the geometry down to centimeters. (Recall that COMSOL’s default system of units is the MKS. Therefore, we just made a 1 – meter long rectangle). 6. To scale the geometry, go under “Draw Modify Scale” menu and type “0.1” as a scale factor for both “x” and “y” fields as shown below:
7. Click “OK”. 8. Click on “Zoom Extents” button geometry.
in the main toolbar to zoom into the
Your geometry should now be complete and highlighted in red, as shown below.
PHYSICS SETTINGS
Physics settings in COMSOL consist of two parts: (1) Subdomain settings and (2) boundary conditions. The subdomain settings let us specify material types, initial conditions, modes of heat transfer (i.e. conduction and/or convection). The boundary conditions settings are used to specify what is happening at the boundaries of the geometry. In this model, we will have to specify and couple physics settings for the flow of air and heat transfer. Let us begin with the air flow physics settings.
- 132 -
Laminar Forced Convection Over a Heated Flat Plate
ME433 COMSOL INSTRUCTIONS
Incompressible Navier – Stokes (ns) Subdomain Settings:
1. From “Mulptiphysics” menu, select “1 Incompressible Navier – Stokes (ns)”. 2. From the “Physics” menu select “Subdomain Settings” (equivalently, press F8). 3. Select subdomain 1 in the “Subdomain selection” window. 4. Enter “rho_air” and “mu_air” in the fields for density ρ and dynamic viscosity η. 5. Click “OK”.
Incompressible Navier – Stokes (ns) Boundary Conditions:
1. From the “Physics” menu open the “Boundary Settings” (F7) dialog box. 2. Apply the following boundary conditions: BOUNDARY
BOUNDARY TYPE
BOUNDARY CONDITION
COMMENTS
1
Inlet
Velocity
Enter “0.1” in “U0” field (Normal Inflow velocity)
2, 4
Wall
No Slip
3, 5
Open boundary
Normal stress
Verify that field “f0” is set to “0”
3. Click “OK” to close the boundary settings window.
- 133 -
Laminar Forced Convection Over a Heated Flat Plate
ME433 COMSOL INSTRUCTIONS
Convection and Conduction (cc) Subdomain Settings:
1. From “Mulptiphysics” menu, select “2 Convection and Conduction (cc)” mode. 2. From the “Physics” menu, select “Subdomain Settings” (F8). 3. Select “Subdomain 1” in the subdomain selection field. 4. Enter “k_air”, “rho_air” and “1006” in the k(isotropic), ρ, and Cp fields, respectively. 5. Enter “u” and “v” in the u and v fields, respectively. 6. Click “OK” to close the Subdomain Settings window.
Convection and Conduction (cc) Boundary Conditions:
1. From the “Physics” menu open the “Boundary Settings” (F7) dialog box. 2. Apply the following boundary conditions: BOUNDARY
BOUNDARY CONDITION
COMMENTS
1
Temperature
Enter “273.15+20” in T0 field
2, 3
Thermal Insulation
4
Heat Flux
5
Convective flux
Enter “1000” in q0 field
3. Click “OK” to close Boundary Settings window.
- 134 -
Laminar Forced Convection Over a Heated Flat Plate
ME433 COMSOL INSTRUCTIONS
MESH GENERATION
To minimize the computational time without compromising much accuracy of the solution, we must change the default meshing parameters. To do this, 1. Go to the “Mesh” menu and select “Free Mesh Parameters …” option. 2. Change “Predefined mesh sizes” from “Normal” to “Finer”. 3. Switch to “Boundary” tab. 4. Select boundaries 1 and 5 in the “Boundary selection” field while holding the “Control (ctrl)” key on your keyboard. 5. Switch to “Distribution” tab. 6. Enable “Constrained edge element distribution” option. 7. Enter “20” in the “Number of edge elements” field.
8. Select boundary 2. (Do not hold the “Control (ctrl)” key on your keyboard) 9. Switch to “Distribution” tab and enable “Constrained edge element distribution”. 10. Enter “30” in the “Number of edge elements” field. 11. Select boundary 4. (Do not hold the “Control (ctrl)” key on your keyboard) 12. Switch to “Distribution” tab and enable “Constrained edge element distribution”. 13. Enter “80” in the “Number of edge elements” field. 14. Switch to “Point” tab. 15. Select points 1 and 3 in the “Point selection” field while holding the “Control (ctrl)” key on your keyboard. 16. Enter “0.0001” in the “Maximum element size” field. - 135 -
Laminar Forced Convection Over a Heated Flat Plate
ME433 COMSOL INSTRUCTIONS
17. Click the “Remesh” button. 18. Click “OK” to close the “Free Mesh Parameters” window.
As a result of these steps, you should get the following triangular mesh:
We are now ready to compute our solution.
- 136 -
Laminar Forced Convection Over a Heated Flat Plate
ME433 COMSOL INSTRUCTIONS
COMPUTING AND SAVING THE SOLUTION
In this step we define the type of analysis to be performed. We are interested in steady – state analysis here, which we previously selected in the Model Navigator. Therefore, no modifications need to be made. To enable the solver, proceed with the following steps: 1. From the “Solve” menu select “Solve Problem”. (Allow few seconds for solution) 2. Save your work on desktop by choosing “File Save”. Name the file according to the naming convention given in the “Introduction to COMSOL Multiphysics” document. The result that you obtain should resemble the following boundary color map:
By default, your immediate result will be given in Kelvin instead of degrees Celsius. (In fact, the first result you will see is the velocity field, not temperature). Furthermore, it will be colored using a “jet” colormap and the velocity field (represented by arrows in the above) will not be shown. We will use distinct colormap options to represent the air velocity and temperature fields. The next section (Postprocessing and Visualization) will help you in obtaining the above and other diagrams, such as 2D color distributions of key air properties, a plot of T(y) at x = 8 cm, a plot of local qx x, 0 for x0 x L . We will also show how to use COMSOL to compute the total heat transfer rate per unit length, qT and use MATLAB to determine h(x) from COMSOL qx x, 0 data and analytically.
- 137 -
Laminar Forced Convection Over a Heated Flat Plate
ME433 COMSOL INSTRUCTIONS
POSTPROCESSING AND VISUALIZATION
After solving the problem, we would like to be able to look at the solution. COMSOL offers us a number of different ways to look at our temperature (and other) fields. In this problem we will deal with 2D color maps, velocity (and other) vector fields, extraction of plate surface temperature T x, 0 , as well as computation of local heat transfer coefficient and 1D temperature distribution plot. You will then address the questions of COMSOL solution validity and compare the results to theoretical predictions mainly by using MATLAB. Displaying T(x, y) and Vector Field V(x, y)
Let us first change the unit of temperature to degrees Celsius: 1. From the “Postprocessing” menu, open “Plot Parameters” dialog box (F12). 2. Under the “Surface” tab, change the unit of temperature to degrees Celsius from the drop – down menu in the “Unit” field. 3. Change the “Colormap” type from “jet” to “hot”. 4. Click “Apply” to refresh main view and keep the “Plot Parameters” window open.
- 138 -
Laminar Forced Convection Over a Heated Flat Plate
ME433 COMSOL INSTRUCTIONS
The 2D temperature distribution will be displayed using the “hot” colormap type with degrees Celsius as the unit of temperature. Let’s now add the velocity vector field V(x,y). 5. Switch to the “Arrow” tab and enable the “Arrow plot” check box. 6. Choose “Velocity field” from “Predefined quantities”. 7. Enter “20” in the “Number of points” for both “x” and “y” fields. 8. Press the “Color” button and select a color you want the arrows to be displayed in. (Note: choose a color that produces good contrast. Green and white are good choices here). 9. Click “Apply” to refresh main view and keep the “Plot Parameters” window open.
At this point, you will see a similar plot as shown on page 137. It is a good idea to save this colormap for future use. Before you do save it, however, experiment with the “Number of points” field in “Plot Parameters” window and adjust the velocity vector field to what seems the best view to you. Put “30” for the “y” field and update your view by pressing “Apply” button. Notice the difference in velocity vector field representation. Try other values.
- 139 -
Laminar Forced Convection Over a Heated Flat Plate
ME433 COMSOL INSTRUCTIONS
You may also want to see other quantities as vector fields. Available quantities are: (1) Temperature gradient, (2) Conductive heat flux, (3) Convective heat flux, and (4) Total heat flux. To see these quantities represented by a vector field: 10. Change the color of the arrow (see step 8). 11. Choose the quantity you wish to plot from “Predefined quantities”. 12. Click “Apply”. 13. Click “OK” when you are done displaying these quantities to close the “Plot Parameters” window. Saving Color Maps:
After you have selected a view that shows the results clearly, you may want to save it as an image for future discussion. This may be done as follows: 1. Go to the “File” menu and select “Export Image”. This will bring up an “Export Image” window. For a 4” by 6” image, acceptable image quality settings are given in the figure below. If you need higher image quality, increase the DPI value.
2. Change your “Export Image” value settings to the ones in the above figure. 3. Click the “Export” button. 4. Name and save the image.
- 140 -
Laminar Forced Convection Over a Heated Flat Plate
ME433 COMSOL INSTRUCTIONS
Displaying V(x, y) as a Colormap:
1. From the “Postprocessing” menu, open “Plot Parameters” dialog box (F12). 2. Under the “Arrow” tab, disable the “Arrow plot” checkbox 3. Switch to “Surface” tab.
4. From “Predefined quantities”, select “Velocity field”. 5. Change the “Colormap” type from “hot” to “jet”. 6. Click “Apply” to refresh main view and keep the “Plot Parameters” window open. The 2D Velocity distribution will be displayed using the “jet” colormap. Displaying Variations of Key Air Properties as Colormaps:
With the “Plot Parameters” window open, ensure that you are under the “Surface” tab, 7. Type “k_air” in “Expression” field (without quotation marks).
8. Click “Apply”. (Note: The unit will change automatically) These steps produce a colormap that displays variations in air’s thermal conductivity k. Note the values on the color scale and compare them with Appendix C of your textbook. - 141 -
Laminar Forced Convection Over a Heated Flat Plate
ME433 COMSOL INSTRUCTIONS
To produce colormaps for density and viscosity variations, repeat steps 6 and 7 while typing “rho_air” and “mu_air”, respectively in the “Expression” field in step 6. When done, click “OK” to close the “Plot Parameters” window. Note: You may also view composite properties, such as kinematic viscosity and Prandtl’s number simply by entering their definitions in the “Expression” field. Thus, to view kinematic viscosity variation, enter “mu_air/rho_air”. For Prandtl number, enter “1006*mu_air/k_air”. It is even possible to enter expressions for other desired quantities, such as local Reynold’s number. For Reynold’s number evaluated at every x and y using x as the computational value in its definition, enter “0.1[m/s]*rho_air*x/mu_air”. For Reynold’s number evaluated at every x and y using y as the computational value in its definition, enter “0.1[m/s]*rho_air*y/mu_air”. Plotting T(0.08, y) (or T(y) at x = 8 cm):
1. From “Postprocessing” menu select “Cross – Section Plot Parameters” option. 2. Switch to the “Line/Extrusion” tab. 3. Change the “Unit” of temperature to degrees Celsius. 4. Change the “x – axis data” from “arc – length” to “y”. 5. Enter the following coordinates in the “Cross – section line data”: x0 = x1 = 0.08; y0 = 0 and y1 = 0.04. 6. Click “OK”.
- 142 -
Laminar Forced Convection Over a Heated Flat Plate
ME433 COMSOL INSTRUCTIONS
These steps produce a plot of T(y) at x = 8 cm, from y = 0 cm (plate surface) to y = 4 cm (ambient environment conditions). Temperature T is plotted on the y – axis and y – coordinates are plotted on the x – axis. To save this plot, 7. Click the save “ ” button in your figure with results. This will bring up an “Export Image” window. 8. Follow steps 2 – 4 as instructed on page 140 to finish with exporting the image. Plotting Plate Surface Temperature T x , 0 For x0 x L
To plot T x, 0 for x0 x L using COMSOL, 1. Select “Cross – Section Plot Parameters …” option from “Postprocessing” menu. 2. Switch to the “Line/Extrusion” tab. 3. From “Predefined quantities”, select “Temperature”. 4. Change the “Unit” of temperature to degrees Celsius. 5. Change the “x – axis data” from “y” to “x”. 6. Enter the following coordinates in the “Cross – section line data”: x0 = 0.02, x1 = 0.1; y0 = y1 = 0. 7. Click “OK” to close Cross – Section Plot Parameters window.
As a result of these steps, a new plot will be shown that graphs T x, 0 for x0 x L . Do not close this plot just yet. We are going to extract this data to a text file for comparative analysis with MATLAB.
- 143 -
Laminar Forced Convection Over a Heated Flat Plate
ME433 COMSOL INSTRUCTIONS
Exporting COMSOL Data to a Data File:
1. Click on “Export Current Plot” button
in the graph created in the previous step.
2. Click “Browse” and navigate to your saving folder (say “Desktop”). 3. Name the file “comsol_temperature.txt”. (Note: do not forget to type the “.txt” extension in the name of the file). 4. Click “OK” to save the file.
This completes COMSOL modeling procedures for this problem.
- 144 -
Laminar Forced Convection Over a Heated Flat Plate
ME433 COMSOL INSTRUCTIONS
Modeling with MATLAB
This part of modeling procedures describes how to create comparative graphs of local heat transfer coefficient h(x) (along the heated portion of the plate) using MATLAB. Obtain MATLAB script file named “heated_plate.m” from Blackboard prior to following these procedures. Save this file in the same directory as the data file(s) (comsol_temperature.txt) from COMSOL. (Note: “heated_plate.m” file is attached to the electronic version of this document as well. To access the file directly from this document, select “View Navigation Panels Attachements” and then save “heated_plate.m” in a proper directory) Comparing COMSOL solution with Approximated Pohlhausen Solution:
The reference analytic equations for heated plates with an insulation section are: hx x Nu x x 0.417 1 0 k x
13
1
Pr 3 Re
1
2
1
q x 3 x Ts x T 2.396 s 1 0 1 1 3 k x Pr Re 2 MATLAB script (heated_plate.m) is programmed to use exported COMSOL data for surface temperature T x, 0 and Newton’s Law of cooling to determine the local heat transfer coefficient h(x) along the heated portion of the plate. The script is also programmed to calculate analytical local heat transfer coefficient h(x) and surface temperature according to analytic reference equations given above. These equations represent a more general approximation to Pohlhausen solution that is suitable for plates with insulated section and applied heat flux. The script will ultimately produce comparative graphs that will plot both solutions. Follow the steps below to complete this problem: 1. Open MATLAB by double clicking its icon on the Desktop. 2. Load “heated_plate.m” file by selecting “File Open Desktop heated_plate.m”. The script responsible for COMSOL data import and data comparison will appear in a new window. 3. Press F5 key to run the script. MATLAB editor will display a warning message. Click “Change Directory” to run the script. Approximated Pohlhausen’s and COMSOL solutions for h(x) and Ts x will be plotted in Figures 1 and 3. Figures 2 and 4 plot the percent error between quantities considered according to the equations printed on the figures. These results are shown on the next page.
- 145 -
Laminar Forced Convection Over a Heated Flat Plate
ME433 COMSOL INSTRUCTIONS
Results plotted with MATLAB:
The results shown above were based on varying properties of air determined by the equations given in “Options and Settings: Defining Constants” section. By default, the script is programmed to use constant air properties determined at film temperature. This, however, introduces greater error. If you wish to use varying properties, you must export them to the same folder where the MATLAB script is. You must export varying Prandtl’s number, conductivity k, and kinematic viscosity along heated portion of the surface of the plate. Refer to steps 1 – 7 on page 143 and 1 – 4 on page 144 to properly extract these quantities. Type the following expressions in the “Expressions” field of “Cross – Section Plot Parameters” window to extract these properties and give them the following file names: PROPERTY
EXPRESSION
FILE NAME
Pr
1018*mu_air/k_air
Pr_comsol.txt
k
k_air
k_comsol.txt
mu_air/rho_air
eta_comsol.txt
- 146 -
Laminar Forced Convection Over a Heated Flat Plate
ME433 COMSOL INSTRUCTIONS
Further, you will need to un – suppress a section in MATLAB script. This is explained in the script itself under “Varying Quantities Import From COMSOL” section. While in MATLAB, you may zoom into plots to notice departures in results based on the solution methods. Armed with these results, you are in a position to answer most of the assigned questions. (Approaches that show how to answer extra credit questions are given in appendix). This completes MATLAB modeling procedures for this problem.
- 147 -
Laminar Forced Convection Over a Heated Flat Plate
ME433 COMSOL INSTRUCTIONS
APPENDIX
MATLAB script
If you could not obtain this script from the Blackboard or the PDF file, you may copy it here, then paste it into notepad and save it in the same directory where you saved COMSOL data file(s). You will most likely get hard – to – spot syntax errors if you copy the script this way. It is therefore highly advised that you use the other 2 methods on obtaining this script instead of the copying method. % ######################################################################### % ME 433 - Heat Transfer % Sample MATLAB Script For: % (X) Laminar Thermal Boundary Layer [Specified Surface Heat Flux] % IMPORTANT: Save this file in the same directory with % "comsol_temperature.txt" file. % ######################################################################### % clc; % Clears the UI prompt clear; % Clears variables from memory %% Constant Quantities Tinf = 20; Vinf = 0.1; k_air = 0.03525; Pr_air = 0.701; eta_air = 29.75e-6; x0 = 0.02; qs = 1000;
% % % % % % %
Ambient temperature, [degC] Velocity at the inlet, [m/s] Air conductivity at Tfilm, [W/m-K] Air Prandtl number at Tfilm, [1] Air viscosity at Tfilm, [m^2/s] A speical plate coordinate!, [m] Applied Surface Heat Flux, [W/m^2]
%% Varying Quantities Import From COMSOL % ######################################################################### % Un-suppress the quantities below to perform verification of results % using varying air properties determined by COMSOL. Make sure to export % the following data files from COMSOL and save them in the same % directory as this script: Pr_comsol.txt, k_comsol.txt, eta_comsol.txt. % Otherwise, leave this section suppressed. When suppressed, the results % you get are determined at T film and introduce larges errors. % ######################################################################### % load Pr_comsol.txt % Pr_air = Pr_comsol(:,2)'; % load k_comsol.txt % k_air = k_comsol(:,2)'; % load eta_comsol.txt % eta_air = eta_comsol(:,2)'; % clear Pr_comsol k_comsol eta_comsol; %% COMSOL Data Import and h(x) Computation load comsol_temperature.txt x = comsol_temperature(:,1)'; Ts_comsol = comsol_temperature(:,2)'; hx_comsol = qs./(Ts_comsol - Tinf); clear comsol_temperature; %% Finding Ts(x) and h(x) Analytically (Correlation Equation) Rex = Vinf*x./eta_air; qs = 1000; % Applied Uniform Surface Heat Flux, [W/m^2] Ts_analyt = Tinf + 2.396*qs./k_air.*(1-x0./x).^(1/3).*x./... (Pr_air.^(1/3).*Rex.^(1/2)); % Correlation Eq. for T(x) Nux = 0.417*(1-x0./x).^(-1/3).*... Pr_air.^(1/3).*Rex.^(1/2); % Local Nusselt number, [1] hx_analyt = Nux.*k_air./x; % Local Heat transfer coefficient, [W/(m^2-C)] %% Error analysis in h(x) and Ts(x) deltah = abs(hx_comsol - hx_analyt); errorh = deltah./hx_comsol*100;
%| -> Simple % Error %| -> calculation for h
- 148 -
Laminar Forced Convection Over a Heated Flat Plate
ME433 COMSOL INSTRUCTIONS
deltaT = abs(Ts_comsol - Ts_analyt); errorT = deltaT./Ts_comsol*100;
%| -> Simple % Error %| -> calculation for T
%% h(x) Plot Begins Here: figure1 = figure('InvertHardcopy','off',... 'Colormap',[1 1 1 ],... 'Color',[1 1 1]); plot(x,hx_comsol,'b',x,hx_analyt,'r--')
%\ % | -> Setting up the figure %/ % Plots COMSOL vs. Theory h
%% Plot cosmetics for figure 1 begin here: annotation(figure1,'textbox',... 'String',{'Flow Over a Heated Plate','with Insulated Edge'},... 'HorizontalAlignment','center',... 'FontSize',14,... 'FontName','Times New Roman',... 'FitBoxToText','off',... 'LineStyle','none',... 'BackgroundColor',[1 1 1],... 'Position',[0.5324 0.6079 0.3669 0.1669]); annotation(figure1,'textbox',... 'String',{'q_s" = 1000W/m^2','T_\infty = 20\circC','V_\infty = 0.1 m/s','L = 10 cm','x_0 = 2 cm'},... 'FontSize',14,... 'FontName','Times New Roman',... 'FontAngle','italic',... 'FitBoxToText','off',... 'EdgeColor',[1 1 1],... 'BackgroundColor',[1 1 1],... 'Position',[0.599 0.3462 0.2552 0.3127]); legend('COMSOL Solution','Analytic Equation') box off grid on title('\fontname{Times New Roman} \fontsize{16} \bf Local Heat Transfer Coefficient') xlabel('x, [m]') ylabel('h(x), [W/m^2-\circC]') set(get(gca,'YLabel'),... 'fontsize', 14,... 'FontName','Times New Roman',... 'FontAngle','italic') set(get(gca,'XLabel'),... 'fontsize', 14,... 'FontName','Times New Roman',... 'FontAngle','italic') %% Error Plot in h(x) begins here: figure2 = figure('InvertHardcopy','off',... 'Colormap',[1 1 1 ],... 'Color',[1 1 1]); plot(x,errorh)
%\ % | -> Setting up the figure %/ % Plots % Error in h
%% Plot cosmetics for figure 2 begin here: box off grid on title('\fontname{Times New Roman} \fontsize{16} \bf Error Analysis in h(x)') xlabel('x, [m]') ylabel('Error in h(x), [%]') set(get(gca,'YLabel'),... 'fontsize', 14,... 'FontName','Times New Roman',... 'FontAngle','italic') set(get(gca,'XLabel'),... 'fontsize', 14,... 'FontName','Times New Roman',... 'FontAngle','italic') str1(1) = {... '$${\%err={h_{x_{analyt}}-h_{x_{comsol}}\over h_{x_{comsol}}}\times 100} $$'}; text('units','normalized', 'position',[.35 .2], ... 'fontsize',14,...
- 149 -
Laminar Forced Convection Over a Heated Flat Plate
ME433 COMSOL INSTRUCTIONS
'FontName', 'Times New Roman',... 'FontAngle', 'italic', ... 'BackgroundColor',[1 1 1],... 'interpreter','latex',... 'string', str1); %% Ts(x) Plot Begins Here: figure3 = figure('InvertHardcopy','off',... %\ 'Colormap',[1 1 1 ],... % | -> Setting up the figure 'Color',[1 1 1]); %/ plot(x,Ts_comsol,'b',x,Ts_analyt,'r--') % Plots COMSOL vs. Theory h %% Plot cosmetics for figure 3 begin here: annotation(figure3,'textbox',... 'String',{'Flow Over a Heated Plate with Insulated Edge'},... 'FontSize',14,... 'FontName','Times New Roman',... 'FitBoxToText','off',... 'LineStyle','none',... 'BackgroundColor',[1 1 1],... 'Position',[0.1493 0.8014 0.6401 0.08788]); annotation(figure3,'textbox',... 'String',{'q_s" = 1000W/m^2','T_\infty = 20\circC','V_\infty = 0.1 m/s','L = 10 cm','x_0 = 2 cm'},... 'FontSize',14,... 'FontName','Times New Roman',... 'FontAngle','italic',... 'FitBoxToText','off',... 'EdgeColor',[1 1 1],... 'BackgroundColor',[1 1 1],... 'Position',[0.6266 0.1593 0.2552 0.3127]); legend('COMSOL Solution','Analytic Equation','location', 'southwest') box off grid on title('\fontname{Times New Roman} \fontsize{16} \bf Plate Surface Temperature') xlabel('x, [m]') ylabel('T_s(x), [\circC]') set(get(gca,'YLabel'),... 'fontsize', 14,... 'FontName','Times New Roman',... 'FontAngle','italic') set(get(gca,'XLabel'),... 'fontsize', 14,... 'FontName','Times New Roman',... 'FontAngle','italic') %% Error Plot in Ts(x) begins here: figure4 = figure('InvertHardcopy','off',... 'Colormap',[1 1 1 ],... 'Color',[1 1 1]); plot(x,errorT)
%\ % | -> Setting up the figure %/ % Plots % Error in h
%% Plot cosmetics for figure 4 begin here: box off grid on title('\fontname{Times New Roman} \fontsize{16} \bf Error Analysis in T_s(x)') xlabel('x, [m]') ylabel('Error in T_s(x), [%]') set(get(gca,'YLabel'),... 'fontsize', 14,... 'FontName','Times New Roman',... 'FontAngle','italic') set(get(gca,'XLabel'),... 'fontsize', 14,... 'FontName','Times New Roman',... 'FontAngle','italic') str1(1) = {... '$${\%err={T_{s_{analyt}}-T_{s_{comsol}}\over T_{s_{comsol}}}\times 100} $$'};
- 150 -
Laminar Forced Convection Over a Heated Flat Plate
ME433 COMSOL INSTRUCTIONS
text('units','normalized', 'position',[.35 .2], ... 'fontsize',14,... 'FontName', 'Times New Roman',... 'FontAngle', 'italic', ... 'BackgroundColor',[1 1 1],... 'interpreter','latex',... 'string', str1);
COMSOL Hints and Sample MATLAB Scripts For Extra – Credit Question
The goal of this question is to obtain boundary layer from COMSOL and compare it directly with analytical boundary layer solution obtained by Blasius. This is particularly tricky, since there is no clear definition as to where the viscous boundary layer thickness occurs. Notice that in our textbook, the definition is given based on the condition that u / V be 0.994, from which, with the use of table 7.1, equation 7.11 is derived. We could have taken u / V as close to unity as we wish and equation 7.11 would therefore change. Physically, the closer u / V is to unity, the better the distinction in the viscous boundary layer, since it implies that u V . The number 0.994, however, is special because it corresponds to a Prandtl’s number of 1.0 on Pohlhausen’s solution given in figure 7.2. From figure 7.2 and equation 7.19, it follows that for air (Pr = 0.7), t / 1 , since t 6.5 . We therefore need to program MATLAB with the following analytical equation for :
5.2 x Re x
To compute Re x , properties at Tfilm must be found. This is easily done since both temperature extremes are now known. Variable x ranges between 0 x 0.1 meters. In COMSOL, we have to use “Contour” plot type to single out velocity iso – curve that correspond to u / V 0.994 condition. To extract boundary layer from COMSOL, 1. From the “Postprocessing” menu, open “Plot Parameters” dialog box (F12). 2. Under the “Arrow” tab, disable the “Arrow plot” checkbox 3. Switch to “Contour” tab. 4. Enable “Contour plot” checkbox on the top left portion of the window. 5. Type “u” in the “Expression field. (without quotation marks)
- 151 -
Laminar Forced Convection Over a Heated Flat Plate
ME433 COMSOL INSTRUCTIONS
6. Enable “Vector with isolevels” radio button option. (The entry field right below it enables us to enter the single out the velocity for which we want the iso – curve to be mapped out). 7. Enter “0.0944” in the entry field below “Vector with isolevels”. (This is the x – component velocity that satisfies u / V 0.994 condition). 8. Switch to “General” tab. 9. Disable all other plot types except “Contour” and “Geometry edges”. 10. Use the “Plot in” drop down menu (located on the bottom left of the window) to switch from “Main axes” to “New figure”. 11. Click “OK”. Viscous COMSOL boundary layer satisfying u / V 0.994 will be shown in a new plot figure. 12. Click on “Export Current Plot” button
.
13. Name the file “fluid_blayer.txt”. (Note: do not forget to type the “.txt” extension in the name of the file). 14. Click “OK” to save the file. The file is saved in the same directory where you first saved COMSOL model file with extension “.mph”.
- 152 -
Laminar Forced Convection Over a Heated Flat Plate
ME433 COMSOL INSTRUCTIONS
The following MATLAB script sample shows how the above analytical equations can be programmed. It also imports COMSOL boundary layer data saved in “fluid_blayer.txt” text file and uses it to plot comparative graphs. %% Preliminaries clc; clear; %% Constant Quantities Vinf = 0.1; k_air = 0.03525; rho_air = 0.8150; Pr_air = 0.701; mu_air = 24.24e-6; eta_air = mu_air/rho_air;
% Clears the UI prompt % Clears variables from memory % % % % % %
Velocity at the inlet, [m/s] Conductivity at Tf, [W/m-K] Density at Tf, [kg/m^3] Prandtl number at Tfilm, [1] Viscosity at Tf, [m^2/s] Specific viscosity at Tf, [m^2/s]
%% COMSOL Data Import load fluid_blayer.txt; xcomsol = fluid_blayer(:,1); ycomsol = fluid_blayer(:,2); % <-- COMSOL Viscous Bound. Layer Thincknes %% Analytic Boundary Layer Thincknes Rex = Vinf*xcomsol/eta_air; yblasius = 5.2*xcomsol./sqrt(Rex);%<-- Viscous B.L.T. %% Percent Difference Analysis erryblasius = abs((ycomsol - yblasius))./yblasius*100; %% Plotter figure(1) plot(xcomsol,ycomsol,'r.',xcomsol,yblasius,'b.') grid on legend('COMSOL \delta','Blasius \delta','location','northwest') figure(2) plot(xcomsol,erryblasius,'b.') title('Error')
This completes MATLAB modeling procedures for this problem.
- 153 -
Laminar Flow in a Tube
ME433 COMSOL INSTRUCTIONS
LAMINAR FLOW IN A TUBE Problem Statement
Room temperature air enters a circular tube with diameter D and length L at a uniform inlet velocity Vi. Formation of viscous boundary layers establishes a hydrodynamic portion in the inlet region of the tube. Air velocity in this region is developing. At and after a certain hydrodynamic length Lh, the velocity distribution is developed and resembles a parabolic profile. This portion of the tube is referred to as fully – developed velocity region (FDVR). Of general interest is to learn how to use COMSOL in obtaining the flow field in a tube. It is desired to obtain qualitative, as well as quantitative perspectives about the entrance and fully – developed flow field regions from COMSOL solution.
Velocity Development in a Tube
Known quantities: Fluid: Air Vi = 0.04 m/s Tair = 20 ºC
L = 100 cm D = 6 cm
Observations
This is a forced internal channel flow problem. The channel considered is a circular tube. Only hydrodynamic considerations are of interest. Thermal considerations are omitted.
Inlet velocity has a uniform distribution. Mean velocity u is not given. Therefore, Reynolds number is not readily calculable. Entrance flow region is expected to form in the tube. If Lh L , fully – developed flow region will form in the tube as well. If Lh L , the entire tube is in entrance flow field region.
Assuming that radial velocity distribution is symmetric at each radial cross – section, the problem can be modeled in 2 dimensions. Rectangular geometry is a suitable model for lateral cross – section of the tube.
The problem can be modeled with constant air properties determined at incoming air temperature Tair.
COMSOL can introduce marginal errors near the exit of the tube. To avoid these small errors, we should always make the tube larger in length by 10 cm. Thus, the modeling length of the tube will be 110 cm.
- 155 -
Laminar Flow in a Tube
ME433 COMSOL INSTRUCTIONS
Assignment
1. State the experimental criterion which permits analyzing flow in a tube as laminar. Determine De for a circular tube of diameter d. Use table 7.2 to find a correct Ch for a circular tube. Rearrange equation 7.43a to solve for Re in terms of Lh, Ch, and hydraulic diameter for a circular tube. 2. Use COMSOL to solve for velocity distribution in the given tube. [Note: Please save this COMSOL model in .mph file for future thermal modeling. Thermal considerations will be done as a separate problem and it will require you to have COMSOL velocity solution]. 3. Use COMSOL to graph a vector field showing the development of velocity profile. Show a 2D colormap of velocity distribution. 4. Use COMSOL to plot axial velocity u(r, xo) at xo = 5, 10, 25, 75, and 100. 5. Use COMSOL to plot centerline velocity uc as a function of x on 0 x L . Does the velocity profile become invariant with distance? What observations do you make regarding uc? 6. Use the plot of centerline velocity uc to find the hydrodynamic entrance length Lh. 7. Use the results of questions 1 and 6 to calculate the Reynold’s number based on hydrodynamic entrance length Lh. State whether the flow is laminar or turbulent. 8. [Extra Credit]: Compute velocity profile in FDVR according to equation 7.48. Compare this result with axial velocity u(r, xo) at xo that is in FDVR from COMSOL solution. Comment on COMSOL solution validity. 9. [Extra Credit]: Compute mean velocity u in FDVR. [Hint: Recall from fluid mechanics that velocity distribution in fully developed velocity region is given by 2 u uc 1 r ro . Compare this equation with equation 7.48 and use COMSOL solution to axial velocity u(r, xo) at xo that is in FDVR to compute u ]. 10. [Extra Credit]: Perform parametric study in COMSOL that solves the problem for multiple input velocities. Solve the problem in the rage of 0.01 m/s to 1.0 m/s. Use an increment of 0.01 m/s.
- 156 -
Laminar Flow in a Tube
ME433 COMSOL INSTRUCTIONS
Modeling with COMSOL Multiphysics MODEL NAVIGATOR
The problem asks us to solve for velocity profile within the tube. Since no other field of interest is asked for (ex. Temperature, Pressure, etc), this is not a multi – coupled PDE system, and thus requires only Non – Isothermal Flow application mode. For this setup: 1. Start “COMSOL Multiphysics”. 2. From the list of application modes select “Heat Transfer Module Weakly Compressible Navier – Stokes Steady – state analysis”. 3. Click “OK”.
- 157 -
Laminar Flow in a Tube
ME433 COMSOL INSTRUCTIONS
GEOMETRY MODELING
We will model tube’s lateral cross – section only, as it saves computation time and is physically symmetric to any other lateral cross – section. A rectangular geometry is adequate to model this problem. Let us therefore begin by creating a rectangle. 1. From the “Draw” menu, select “Specify Objects Rectangle”. 2. Enter “1.1” and “0.06” as the “Width” and “Height” of the rectangle, respectively. (Without quotation marks). 3. Enter “-0.03” as the base position “y” coordinate. 4. Click “OK”.
5. Click on “Zoom Extents” button geometry.
in the main toolbar to zoom into the
Your geometry should now be complete and highlighted in red, as shown below.
PHYSICS SETTINGS
Physics settings in COMSOL consist of two parts: (1) Subdomain settings and (2) boundary conditions. The subdomain settings let us specify material types, initial conditions, modes of heat transfer (i.e. conduction and/or convection). The boundary conditions settings are used to specify what is happening at the boundaries of the geometry. In this model, we will have to specify and couple physics settings for the flow of air and heat transfer. Let us begin with the air flow physics settings.
- 158 -
Laminar Flow in a Tube
ME433 COMSOL INSTRUCTIONS
Subdomain Settings:
1. From the “Physics” menu select “Subdomain Settings” (F8). 2. Select “Subdomain 1” in the subdomain selection field. 3. Enter “1.2042” and “18.17e-6” in the “ρ”, and “η” fields, respectively.
4. Click “OK” to apply and close the Subdomain Settings window. Boundary Conditions:
1. From the “Physics” menu open the “Boundary Settings” (F7) dialog box. 2. Apply the following boundary conditions: BOUNDARY
BOUNDARY TYPE
BOUNDARY CONDITION
COMMENTS
1
Inlet
Velocity
Enter “0.04” in “U0” field (Normal Inflow velocity)
2, 3
Wall
No Slip
4
Open boundary
Normal stress
Verify that field “f0” is set to “0”
3. Click “OK” to close the “Boundary Settings” window.
- 159 -
Laminar Flow in a Tube
ME433 COMSOL INSTRUCTIONS
MESH GENERATION
To minimize the computational time without compromising much accuracy of the solution, we must change the default meshing parameters. To do this, 1. Go to the “Mesh” menu and select “Mapped Mesh Parameters …” option. 2. Switch to “Boundary” tab. 3. Select boundaries 1 and 4 in the “Boundary selection” field while holding the “Control (ctrl)” key on your keyboard. 4. Enable “Constrained edge element distribution” option. 5. Enter “25” in the “Number of edge elements” field. 6. Enter “5” in the “Element ratio:” field and switch the “Distribution method” from “Linear” to “Exponential”. 7. Enable the “Symmetric” check box option.
8. Select boundaries 2 and 3 in the “Boundary selection” field while holding the “Control (ctrl)” key on your keyboard. 9. Enable “Constrained edge element distribution” option. 10. Enter “150” in the “Number of edge elements” field. 11. Enter “20” in the “Element ratio:” field and switch the “Distribution method” from “Linear” to “Exponential”.
- 160 -
Laminar Flow in a Tube
ME433 COMSOL INSTRUCTIONS
12. Click “Remesh” button. 13. Click “OK” button to close “Mapped Mesh Parameters” window. As a result of these steps, you should get the following quadrilateral mesh:
We are now ready to compute our solution. COMPUTING AND SAVING THE SOLUTION
In this step we define the type of analysis to be performed. We are interested in steady – state analysis here, which we previously selected in the Model Navigator. Therefore, no modifications need to be made. To enable the solver, proceed with the following steps: 1. From the “Solve” menu select “Solve Problem”. (Allow few minutes for solution) 2. Save your work on desktop by choosing “File Save”. Name the file according to the naming convention given in the “Introduction to COMSOL Multiphysics” document. The result that you obtain should resemble the following surface color map:
By default, your immediate result will be given as shown in velocity colormap above. In addition to this qualitative solution representation, the next section (Postprocessing and Visualization) will help you in obtaining other diagrams, such as 2D velocity vector field, plots of axial velocities at various xo, and a plot of centerline velocity uc. With these results available, you should be able to determine the hydrodynamic entrance length Lh and a corresponding Reynolds number. Furthermore, you will be able to determine whether the flow is laminar or turbulent. With hydrodynamic entrance length Lh known, you can determine and see whether both entrance and FDV regions or only the entrance region exist in the tube. Answer the extra – credit questions to verify COMSOL results.
- 161 -
Laminar Flow in a Tube
ME433 COMSOL INSTRUCTIONS
POSTPROCESSING AND VISUALIZATION
Displaying Velocity Vector Field with an Arrow Plot:
One of the simplest ways to show the evolution of velocity profile is with arrow plot. This can be done as follows. 1. From the “Postprocessing” menu, open “Plot Parameters” dialog box (F12). 2. Switch to the “Arrow” tab and enable the “Arrow plot” check box. 3. Enter “20” in the “Number of points” for both “x” and “y” fields. 4. Press the “Color” button and select a color you want the arrows to be displayed in. (Note: choose a color that produces good contrast. Black and white are good choices here) 5. Click “Apply” to refresh main view and keep the “Plot Parameters” window open.
At this point, you will see a similar plot as shown on page 161 with an additional velocity vector field represented by arrows. It is a good idea to save this colormap for future use. Before you do save it, however, experiment with the “Number of points” field in “Plot Parameters” window and adjust the velocity vector field to what seems the best view to you. Put “30” for the “x” field and update your view by pressing “Apply” button. Notice - 162 -
Laminar Flow in a Tube
ME433 COMSOL INSTRUCTIONS
the difference in velocity vector field representation. Try other values. Click “OK” when you are done displaying these quantities to close the “Plot Parameters” window. Saving Color Maps:
After you have selected a view that shows the results clearly, you may want to save it as an image for future discussion. This may be done as follows: 1. Go to the “File” menu and select “Export Image”. This will bring up an “Export Image” window. For a 4” by 6” image, acceptable image quality settings are given in the figure below. If you need higher image quality, increase the DPI value.
2. Change your “Export Image” value settings to the ones in the above figure. 3. Click the “Export” button. 4. Name and save the image.
- 163 -
Laminar Flow in a Tube
ME433 COMSOL INSTRUCTIONS
Plotting Axial Velocity as a Function of Radius at Specified xo Values
To make axial velocity u(r, xo) plots at specified xo, we simply need to know the end coordinates of axial lines along which u(r, xo) is to be plotted. Vertical axial lines are described by the radius of the tube in y – coordinate (or r coordinate). Let us begin by plotting axial velocity u(r, xo) at xo = 100 cm. 1. Under “Postprocessing” menu, select “Cross – Section Plot Parameters”. 2. Switch to “Line/Extrusion” tab. 3. Type “y” in the “Expression” field under “y – axis data” section of the tab.
4. Under “x – axis data”, use radio button to enable the “Expression” option.
5. Click on “Expression” button. 6. In new “x – axis data” window, type “u” in “Expression” field. 7. Click “OK” to apply and close “x – axis data” window.
8. In “Cross – Section Plot Parameters” window, enter the following coordinates in the “Cross – section line data”: x0 = x1 = 1; y0 = -3e-2 and y1 = 3e-2. 9. Click “Apply”. These steps produce a plot of axial velocity as a function of radius at x = 100 cm. Velocity u is plotted on the x – axis and y – coordinates are plotted on the y – axis. To - 164 -
Laminar Flow in a Tube
ME433 COMSOL INSTRUCTIONS
save this plot, 1. Click the save “ ” button in your figure with results. This will bring up an “Export Image” window. 2. Follow steps 2 – 4 as instructed on page 163 to finish with exporting the image. To display axial velocity at other x0 values, repeat steps 8 and 9 on page 164. In step 8, change the x0 and x1 coordinates to those given in assignment question 4. You should produce 5 such plots altogether. When you are done with making these plots, click “OK” to close “Cross – Section Plot Parameters” window. [Note: Alternatively, you can save numerical data for velocity and y – coordinates instead of a plot. You can use this data later to recreate the plot in MATLAB (or other software). To save this numerical data, use the “Export current data” button in the plot window. Give the file a descriptive name (do not forget to add .txt extension at the end of file name), use the “Browse” button to navigate to your saving folder, and save the file]. Plotting Centerline Velocity uc as a Function of x
Similar to axial velocity plots, we simply need to specify the proper coordinates of a line along which we wish to plot velocity. Tube center line begins at x0 = 0 meters and terminates at x1 = 1. The y – coordinate (or the r coordinate) at the center of the tube stays at zero level. 1. Under “Postprocessing” menu, select “Cross – Section Plot Parameters”. 2. Switch to “Line/Extrusion” tab. 3. Type “u” in the “Expression” field under “y – axis data” section. 4. In “x – axis data” section, switch to upper radio button and select “x” using the drop – down menu. 5. Enter the following coordinates in the “Cross – section line data” section: x0 = 0, x1 = 1; y0 = y1 = 0.
6. Click “OK”.
- 165 -
Laminar Flow in a Tube
ME433 COMSOL INSTRUCTIONS
Centerline velocity uc will be displayed as a function of x on 0 x L . This graph is shown below. It has been re – plotted with MATLAB. MATLAB Re – Plot of Centerline Velocity uc
This completes COMSOL modeling procedures for this problem.
- 166 -
Laminar Flow in a Tube
ME433 COMSOL INSTRUCTIONS
APPENDIX
MATLAB script
The following MATLAB script re – produces the centerline velocity plot. Make sure to use COMSOL first to export the centerline velocity data to an external text file. Name the file as “uc.txt” and place it in the same directory with MATLAB’s .m script file. %% Preliminaries clear % Clears the UI prompt clc % Clears variables from memory %% Velocity Data load uc.txt; x = uc(:,1)*100; u = uc(:,2);
Import from COMSOL Multiphysics: % Loads u(0,x) as a 2 column vector % x - coordinate, [cm] % velocity, [m/s]
%% Plotter figure1 = figure('InvertHardcopy','off',... %\ 'Colormap',[1 1 1 ],... % | -> Setting up the figure 'Color',[1 1 1]); %/ plot(x,u,'k'); % Plotting grid on box off title(... '\fontname{Times New Roman} \fontsize{16} \bf Centerline Velocity u_c') xlabel('\fontname{Times New Roman} \fontsize{14} \it \bf x, [cm]') ylabel('\fontname{Times New Roman} \fontsize{14} \it \bf u_c , [m/s]')
This completes MATLAB modeling procedures for this problem.
- 167 -
Temperature Development In Tubes: Uniform Surface Temperature ME433 COMSOL INSTRUCTIONS
TEMPERATURE DEVELOPMENT IN TUBES – Uniform Surface Temperature Problem Statement
Room temperature air enters a circular tube with diameter D and length L at a uniform inlet velocity Vi and temperature Ti. The surface walls of the tube are maintained at a higher constant temperature Ts. Formation of viscous boundary layers establishes a hydrodynamic entrance region of the tube. Air velocity in this region is developing. At and after a certain hydrodynamic length Lh, the velocity distribution is developed and resembles a parabolic profile. This portion of the tube is referred to as fully – developed velocity region (FDVR). Formation of thermal boundary layers establishes a thermal entrance region of the tube. Air temperature in this region is developing. At and after a certain thermal length Lt, temperature develops to a uniform profile. This portion of the tube is referred to as fully – developed temperature region (FDTR). Of general interest is to learn how to use COMSOL in obtaining temperature field in a tube. It is desired to obtain qualitative, as well as quantitative perspectives about the entrance and fully – developed thermal regions from COMSOL solution. Known quantities:
Temperature Development in an Isothermal Tube
Fluid: Air
Vi = 0.04 m/s Ti = 20 ºC Ts = 150 ºC
L = 100 cm D = 6 cm
Observations
This is a forced convection, internal channel flow problem. The channel considered is a circular tube. Both hydrodynamic and thermal considerations are of interest. Hydrodynamic considerations were examined in a previous module.
In “Laminar Flow in a Tube”, it was established that Lh L for the given geometry and velocity entrance conditions. Thus, velocity becomes fully developed at a certain Lh. Of interest here is the determination of Lt. If Lt L , the entire tube is in thermal entrance region. If that is the case, we can still find Lt by extending the length of the geometry and resolving the problem.
Assuming that radial temperature distribution is symmetric at each radial cross – section, the problem can be modeled in 2 dimensions. Rectangular geometry is a suitable model for lateral cross – section of the tube.
We will model this problem with constant air properties determined at incoming air temperature Tair. Later, we may also want to model the problem by varying air - 169 -
Temperature Development In Tubes: Uniform Surface Temperature ME433 COMSOL INSTRUCTIONS
properties with respect to temperature. This will enable us to see if there are any differences in entrance lengths when material property variation is introduced. (This is assigned as an extra – credit exercise).
COMSOL can introduce marginal errors near the exit of the tube. To avoid these small errors, we should always make the tube larger in length by 10 cm. Thus, the modeling length of the tube will be 110 cm.
Assignment
1. Use COMSOL to determine the temperature distribution in given tube. Show a 2D colormap of temperature distribution in the tube. 2. Use COMSOL to plot axial temperature T(r, xo) at xo = 5, 10, 25, 75, and 100 cm. 3. Use COMSOL to plot and extract numerical data for local hx ro , x on 0 x L . [Note: In this instruction set, part of this assignment question will be done with MATLAB, but you are free to use any software of your choice] 4. Use COMSOL to plot centerline temperature Tc as a function of x on 0 x L . Does temperature profile become invariant with distance? What observations do you make regarding Tc? 5. Use centerline temperature Tc plot to find the thermal entrance length Lt. If necessary, increase the length of the tube and resolve the problem until you obtain a graph of centerline temperature Tc that enables you to determine Lt. 6. [Extra Credit]: Modify COMSOL model to include air property variations and resolve the problem. Produce plots of centerline velocity uc and temperature Tc. Determine hydrodynamic and thermal entrance lengths. Comment on any changes you see in these values when compared to the entrance lengths computed with constant air properties assumption.
- 170 -
Temperature Development In Tubes: Uniform Surface Temperature ME433 COMSOL INSTRUCTIONS
Modeling with COMSOL Multiphysics
Recall that we already solved for the velocity profile in the previous module. This problem asks us to find temperature distribution of air when the walls of the tube are kept at uniform surface temperature Ts. We will proceed by extending our previous module to a Multiphysics model. Prepare the COMSOL file you saved for “Laminar Flow in a Tube” by copying it to your desktop. (Note: The computers in room ST – 213 do not allow you to simply copy and paste a file from one location to Desktop. You can still save your COMSOL file by opening it in COMSOL and choosing the option “Save as” from file menu) OPENING PREVIOUS MODULE
1. Open COMSOL model file (.mph) for “Laminar Flow in a Tube”. The model will load at the point where you last saved it. MODEL NAVIGATOR: ADDING GENERAL HEAT TRANSFER MODE
We are now ready to start applying heat transfer module to create a Multiphysics model. This is done as follows. 1. Select “Model Navigator …” under the “Multiphysics” menu. 2. Click on “Multiphysics” button on the bottom right corner of the window. 3. From the list of application modes select “Heat Transfer Module General Heat Transfer Steady – state analysis”. 4. Click the “Add” button. 5. Click “OK”.
- 171 -
Temperature Development In Tubes: Uniform Surface Temperature ME433 COMSOL INSTRUCTIONS
PHYSICS SETTINGS
Physics settings in COMSOL consist of two parts: (1) Subdomain settings and (2) boundary conditions. The subdomain settings let us specify material types, initial conditions, modes of heat transfer (i.e. conduction and/or convection). The boundary conditions settings are used to specify what is happening at the boundaries of the geometry. In this model, we will have to specify and couple physics settings for the flow of air and heat transfer. Since we’ve specified air flow physics settings before, we only need to add and couple heat transfer physics settings. This is done as follows. General Heat Transfer Subdomain Settings
1. From “Mulptiphysics” menu, select “1 General Heat Transfer (htgh)” mode. 2. From the “Physics” menu, select “Subdomain Settings” (F8). 3. Select “Subdomain 1” in the subdomain selection field. 4. Enter “0.02564”, “1.2042” and “1006” in the k, ρ, and Cp fields, respectively. 5. Switch to “Convection” tab and check “Enable convective heat transfer” option.
6. Type “u” and “v” in the u and v fields, respectively. 7. Click “OK” to close the Subdomain Settings window.
- 172 -
Temperature Development In Tubes: Uniform Surface Temperature ME433 COMSOL INSTRUCTIONS
General Heat Transfer Boundary Conditions
1. From the “Physics” menu open the “Boundary Settings” (F7) dialog box. 2. Apply the following boundary conditions: BOUNDARY
BOUNDARY CONDITION
COMMENTS
1
Temperature
Enter “273.15+20” in T0 field
2, 3
Temperature
Enter “273.15+200” in T0 field
4
Convective flux
3. Click “OK” to close Boundary Settings window. MESH GENEARATION
The mesh for this model was optimized before in “Laminar Flow in a Tube”. No further modification is necessary. To check that mesh is preserved, click on the “Mesh Mode” button “ ”. Your mesh should be made with quadrilateral elements, as shown here.
We are now ready to compute our solution.
- 173 -
Temperature Development In Tubes: Uniform Surface Temperature ME433 COMSOL INSTRUCTIONS
COMPUTING AND SAVING THE SOLUTION
In this step we define the type of analysis to be performed. We are interested in steady – state analysis here, which we previously selected in the Model Navigator. Therefore, no modifications need to be made. To enable the solver, proceed with the following steps: 1. From the “Solve” menu select “Solve Problem”. (Allow few minutes for solution) 2. Save your work on desktop by choosing “File Save”. Name the file according to the naming convention given in the “Introduction to COMSOL Multiphysics” document. The result that you obtain should resemble the following surface color map:
By default, your immediate result will be given in Kelvin instead of degrees Celsius. (In fact, the first result you will see is the velocity field, not temperature). Furthermore, it will be colored using a “jet” colormap and the velocity field (represented by arrows in the above) will not be shown. We will use distinct colormapping options to represent the air velocity and temperature fields. The next section (Postprocessing and Visualization) will help you in obtaining the above and other diagrams, such as plots of axial temperatures at various xo and a plot of centerline temperature Tc. To determine thermal entrance length Lt, you need to determine whether both entrance and FDT regions or only the entrance region exist in the tube. We will also plot and extract numerical data for local hx ro , x . Answer the extra – credit question to determine the effects on solution when air property variations are included COMSOL analysis.
- 174 -
Temperature Development In Tubes: Uniform Surface Temperature ME433 COMSOL INSTRUCTIONS
POSTPROCESSING AND VISUALIZATION
After solving the problem, we would like to be able to look at the solution. COMSOL offers us a number of different ways to look at our temperature (and other) fields. In this problem we will deal with 2D color maps, velocity (and other) vector fields, extraction of local hx ro , x , and centerline temperature development plot.
Displaying T(r, x) with Velocity Vector Field V(r, x)
Let us first change the unit of temperature to degrees Celsius: 1. From the “Postprocessing” menu, open “Plot Parameters” dialog box (F12). 2. Under the “Surface” tab, change the unit of temperature to degrees Celsius from the drop – down menu in the “Unit” field. 3. Change the “Colormap” type from “jet” to “hsv”. 4. Click “Apply” to refresh main view and keep the “Plot Parameters” window open.
- 175 -
Temperature Development In Tubes: Uniform Surface Temperature ME433 COMSOL INSTRUCTIONS
The 2D temperature distribution will be displayed using the “hsv” colormap type with degrees Celsius as the unit of temperature. Let’s now add the velocity vector field V(r,x). 5. Switch to the “Arrow” tab and enable the “Arrow plot” check box. 6. Choose “Velocity field” from “Predefined quantities”. 7. Enter “20” in the “Number of points” for both “x” and “y” fields. 8. Press the “Color” button and select a color you want the arrows to be displayed in. (Note: choose a color that produces good contrast. Black is a good choice here) 9. Click “Apply” to refresh main view and keep the “Plot Parameters” window open.
At this point, you will see a similar plot as shown on page 174. It is a good idea to save this colormap for future use. Before you do save it, however, experiment with the “Number of points” field in “Plot Parameters” window and adjust the velocity vector field to what seems the best view to you. Put “30” for the “x” field and update your view by pressing “Apply” button. Notice the difference in velocity vector field representation. Try other values. - 176 -
Temperature Development In Tubes: Uniform Surface Temperature ME433 COMSOL INSTRUCTIONS
You may also want to see other quantities as vector fields. Available quantities are: (1) Temperature gradient, (2) Conductive heat flux, (3) Convective heat flux, and (4) Total heat flux. To see these quantities represented by a vector field: 10. Choose the quantity you wish to plot from “Predefined quantities”. 11. Click “Apply”. 12. Click “OK” when you are done displaying these quantities to close the “Plot Parameters” window. Saving Color Maps
After you have selected a view that shows the results clearly, you may want to save it as an image for future discussion. This may be done as follows: 1. Go to the “File” menu and select “Export Image”. This will bring up an “Export Image” window. For a 4” by 6” image, acceptable image quality settings are given in the figure below. If you need higher image quality, increase the DPI value.
2. Change your “Export Image” value settings to the ones in the above figure. 3. Click the “Export” button. 4. Name and save the image.
- 177 -
Temperature Development In Tubes: Uniform Surface Temperature ME433 COMSOL INSTRUCTIONS
Plotting T(r,xo) (or T(r) at xo)
To make axial temperature T(r, xo) plots at specified xo, we simply need to know the end coordinates of axial lines along which T(r, xo) is to be plotted. Vertical axial lines are described by the radius of the tube in y – coordinate (or r coordinate). Let us begin by plotting axial temperature T(r, xo) at xo = 100 cm. 1. Under “Postprocessing” menu, select “Cross – Section Plot Parameters”. 2. Switch to “Line/Extrusion” tab. 3. Type “y” in the “Expression” field under “y – axis data” section of the tab.
4. Under “x – axis data”, use radio button to enable the “Expression” option.
5. Click on “Expression” button. 6. In new “x – axis data” window, type “T” in “Expression” field. 7. Change the “Unit” of temperature to degrees Celsius. 8. Click “OK” to apply and close “x – axis data” window.
9. In “Cross – Section Plot Parameters” window, enter the following coordinates in the “Cross – section line data”: x0 = x1 = 1; y0 = -0.03 and y1 = 0.03. 10. Click “Apply”. - 178 -
Temperature Development In Tubes: Uniform Surface Temperature ME433 COMSOL INSTRUCTIONS
These steps produce a plot of axial temperature as a function of radius at x = 100 cm. Temperature T is plotted on the x – axis in degrees Celsius and y – coordinates are plotted on the y – axis. To save this plot, 1. Click the save “ ” button in your figure with results. This will bring up an “Export Image” window. 2. Follow steps 2 – 4 as instructed on page 177 to finish with exporting the image. To display axial temperature at other x0 values, repeat steps 8 and 9 on page 178. In step 8, change the x0 and x1 coordinates to those given in assignment question 2. You should produce 5 such plots altogether. When you are done with making these plots, click “OK” to close “Cross – Section Plot Parameters” window. [Note: Alternatively, you can save numerical data for temperature and y – coordinates instead of a plot. You can use this data later to recreate the plot in MATLAB (or other software). To save this numerical data, use the “Export current data” button in the plot window. Give the file a descriptive name (do not forget to add .txt extension at the end of file name), use the “Browse” button to navigate to your saving folder, and save the file]. Plotting Local hx ro , x for x0 x L :
To plot hx ro , x for x0 x L using COMSOL, 1. Select “Cross – Section Plot Parameters …” option from “Postprocessing” menu. 2. Switch to the “Line/Extrusion” tab. 3. Type “tflux_htgh/(T-293.15)” in “Expression” field. 4. Change the “x – axis data” to “x”. 5. Enter the following coordinates in the “Cross – section line data”: x0 = x1 = 0; and y0 = -0.03, y1 = 0.03. 6. Click “OK” to close Cross – Section Plot Parameters window. Local surface heat transfer coefficient will be plotted in a new figure.
- 179 -
Temperature Development In Tubes: Uniform Surface Temperature ME433 COMSOL INSTRUCTIONS
As a result of these steps, a new plot will be shown that graphs hx ro , x for x0 x L . Do not close this plot just yet. We are going to extract this data to a text file for comparative analysis with MATLAB. Exporting COMSOL Data to a Data File:
1. Click on “Export Current Plot” button
in the graph created in the previous step.
2. Click “Browse” and navigate to your saving folder (say “Desktop”). 3. Name the file “hx_surface.txt”. (Note: do not forget to type the “.txt” extension in the name of the file). 4. Click “OK” to save the file.
- 180 -
Temperature Development In Tubes: Uniform Surface Temperature ME433 COMSOL INSTRUCTIONS
Plotting Centerline Temperature Tc(ro, x) as a Function of x
Similar to axial temperature plots, we simply need to specify the proper coordinates of a line along which we wish to plot temperature. Tube center line begins at x0 = 0 meters and terminates at x1 = 1. The y – coordinate (or the r coordinate) at the center of the tube stays at zero level as x varies. 1. Under “Postprocessing” menu, select “Cross – Section Plot Parameters”. 2. Switch to “Line/Extrusion” tab. 3. Type “T” in the “Expression” field under “y – axis data” section and change the “Unit” of temperature to degrees Celsius. 4. In “x – axis data” section, switch to upper radio button and select “x” using the drop – down menu. 5. Enter the following coordinates in the “Cross – section line data” section: x0 = 0, x1 = 1; y0 = y1 = 0.
6. Click “OK”. Centerline temperature Tc will be displayed as a function of x on 0 x L . This graph is shown on the next page. It has been re – plotted with MATLAB.
- 181 -
Temperature Development In Tubes: Uniform Surface Temperature ME433 COMSOL INSTRUCTIONS
MATLAB Re – Plot of Centerline Temperature Tc
Does the temperature profile become invariant with distance x ? What observations do you make regarding Tc ? Can you determine thermal entrance length from the above graph?
- 182 -
Temperature Development In Tubes: Uniform Surface Temperature ME433 COMSOL INSTRUCTIONS
COMSOL Results and Hints for Extra – Credit Question
The goal of this question is to determine how varying properties of air affect the solution. The following results for centerline velocity uc and temperature Tc were repotted with MATLAB. The length of the tube was increased to 5 meters.
Notice how varying air properties manifest a dramatic difference in centerline velocity. Can you notice the differences in hydrodynamic and thermal entrance lengths between the solutions? To use varying air properties in COMSOL, follow the steps below, 2. From the “Options” menu select “Expressions Scalar Expressions …” 3. Define the following names and expressions: NAME k_air
EXPRESSION
UNIT
DESCRIPTION
10^(-3.723+0.865*log10(abs(T[1/K])))[W/(m*K)]
W/(m·K)
Air Conductivity
3
rho_air
1.013e5[Pa]*28.8[g/mol]/(8.314[J/(mol*K)]*T)
kg/m
mu_air
6e-6[Pa*s]+4e-8[Pa*s/K]*T
Kg/(m·s)
Air Density Air Viscosity
4. Click “OK”. 5. Use the same names of quantities defined above in “Subdomain Physics Settings” to replace the previously defined constant numerical properties. 6. Resolve the problem. COMSOL automatically determines correct property unit under the “Unit” column. If it does not, you are most likely entering wrong expressions. Carefully check the expression you typed and make corrections, if necessary. The description column is optional and can be left blank. This completes COMSOL modeling procedures for this problem. - 183 -
Temperature Development In Tubes: Uniform Surface Heat Flux
ME433 COMSOL INSTRUCTIONS
TEMPERATURE DEVELOPMENT IN TUBES – Uniform Surface Heat Flux Problem Statement
Room temperature air enters a circular tube with diameter D and length L at a uniform inlet velocity Vi and temperature Ti. The surface wall of the tube is heated by a uniform heat flux qs . Formation of viscous boundary layers establishes a hydrodynamic entrance region of the tube. Air velocity in this region is developing. At and after a certain hydrodynamic length Lh, the velocity distribution is developed and resembles a parabolic profile. This portion of the tube is referred to as fully – developed velocity region (FDVR). Temperature profile is changing at the surface and throughout the tube. Of general interest is to learn how to use COMSOL in obtaining temperature field in a tube. It is desired to obtain qualitative, as well as quantitative perspectives about thermal development from COMSOL solution. Known quantities:
Temperature Development in an Isothermal Tube
Fluid: Air
L = 100 cm Vi = 0.04 m/s D = 6 cm Ti = 20 ºC 2 qs = 1000 W/m Observations
This is a forced convection, internal channel flow problem. The channel considered is a circular tube. Both hydrodynamic and thermal considerations are of interest. Hydrodynamic considerations were examined in a previous module.
Assuming that radial temperature distribution is symmetric at each radial cross – section, the problem can be modeled in 2 dimensions. Rectangular geometry is a suitable model for lateral cross – section of the tube.
We will model this problem with constant air properties determined at incoming air temperature Tair. Later, we may also want to model the problem by varying air properties with respect to temperature. This will enable us to see if there are any differences in solutions when material property variation is introduced. (This is assigned as an extra – credit exercise).
COMSOL can introduce marginal errors near the exit of the tube. To avoid these small errors, we should always make the tube larger in length by 10 cm. Thus, the modeling length of the tube will be 110 cm.
- 185 -
Temperature Development In Tubes: Uniform Surface Heat Flux
ME433 COMSOL INSTRUCTIONS
Assignment
1. Use COMSOL to determine the temperature distribution in given tube. Show a 2D colormap of temperature distribution in the tube. 2. Use COMSOL to plot axial temperature T(r, xo) at xo = 5, 10, 25, 75, and 100 cm. 3. Use COMSOL to plot centerline temperature Tc as a function of x on 0 x L . Does temperature profile become invariant with distance? What observations do you make regarding Tc? 4. Use COMSOL to plot and extract surface temperature Ts as a function of x on 0 x L . Use Newton’s law of cooling and extracted surface temperature Ts to determine COMSOL h(x) for x0 x L . Plot COMSOL h(x). [Note: In this instruction set, part of this assignment question will be done with MATLAB, but you are free to use any software of your choice] 5. [Extra Credit]: Modify COMSOL model to include air property variations and resolve the problem. Produce plots of centerline velocity uc and temperature Tc. Determine hydrodynamic and thermal entrance lengths. Comment on any changes you see in these values when compared to the entrance lengths computed with constant air properties assumption.
- 186 -
Temperature Development In Tubes: Uniform Surface Heat Flux
ME433 COMSOL INSTRUCTIONS
Modeling with COMSOL Multiphysics
Recall that we already solved for the velocity profile in the previous module. This problem asks us to find temperature distribution of air when the walls of the tube are kept at uniform surface flux qs . We will proceed by extending our previous module to a Multiphysics model. Prepare the COMSOL file you saved for “Laminar Flow in a Tube” by copying it to your desktop. (Note: The computers in room ST – 213 do not allow you to simply copy and paste a file from one location to Desktop. You can still save your COMSOL file by opening it in COMSOL and choosing the option “Save as” from file menu) OPENING PREVIOUS MODULE
1. Open COMSOL model file (.mph) for “Laminar Flow in a Tube”. The model will load at the point where you last saved it. MODEL NAVIGATOR: CONVECTION & CONDUCTION HEAT TRANSFER MODE
We are now ready to start applying heat transfer module to create a Multiphysics model. This is done as follows. 1. Select “Model Navigator …” under the “Multiphysics” menu. 2. Click on “Multiphysics” button on the bottom right corner of the window. 3. From the list of application modes select “COMSOL Multiphysics Heat Transfer Convection and Conduction Steady – state analysis”. 4. Click the “Add” button. 5. Click “OK”.
- 187 -
Temperature Development In Tubes: Uniform Surface Heat Flux
ME433 COMSOL INSTRUCTIONS
PHYSICS SETTINGS
Physics settings in COMSOL consist of two parts: (1) Subdomain settings and (2) boundary conditions. The subdomain settings let us specify material types, initial conditions, modes of heat transfer (i.e. conduction and/or convection). The boundary conditions settings are used to specify what is happening at the boundaries of the geometry. In this model, we will have to specify and couple physics settings for the flow of air and heat transfer. Since we’ve specified air flow physics settings before, we only need to add and couple heat transfer physics settings. This is done as follows. Convection and Conduction (cc) Subdomain Settings:
1. From “Mulptiphysics” menu, select “2 Convection and Conduction (cc)” mode. 2. From the “Physics” menu, select “Subdomain Settings” (F8). 3. Select “Subdomain 1” in the subdomain selection field. 4. Enter “0.02564”, “1.2042” and “1006” in the k(isotropic), ρ, and Cp fields, respectively. 5. Enter “u” and “v” in the u and v fields, respectively. 6. Click “OK” to close the Subdomain Settings window.
- 188 -
Temperature Development In Tubes: Uniform Surface Heat Flux
ME433 COMSOL INSTRUCTIONS
Convection and Conduction (cc) Boundary Conditions:
1. From the “Physics” menu open the “Boundary Settings” (F7) dialog box. 2. Apply the following boundary conditions: BOUNDARY
BOUNDARY CONDITION
COMMENTS
1
Temperature
Enter “273.15+20” in T0 field
2, 3
Heat Flux
Enter “1000” in q0 field
4
Convective flux
Click “OK” to close Boundary Settings window. MESH GENEARATION
The mesh we created in “Laminar Flow in a Tube” is not quite suitable to handle heat flux boundary conditions. We shall make changes to the mesh as follows: 1. Go to the “Mesh” menu and select “Free Mesh Parameters …” option. 2. From “Predefined mesh sizes” drop – down menu, select “Extremely fine” option. 3. Click “Remesh”, followed by “OK” to close “Free Mesh Parameters” window.
As a result of these steps, you should get the following triangular mesh:
We are now ready to compute our solution.
- 189 -
Temperature Development In Tubes: Uniform Surface Heat Flux
ME433 COMSOL INSTRUCTIONS
COMPUTING AND SAVING THE SOLUTION
In this step we define the type of analysis to be performed. We are interested in steady – state analysis here, which we previously selected in the Model Navigator. Therefore, no modifications need to be made. To enable the solver, proceed with the following steps: 1. From the “Solve” menu select “Solve Problem”. (Allow few minutes for solution) 2. Save your work on desktop by choosing “File Save”. Name the file according to the naming convention given in the “Introduction to COMSOL Multiphysics” document. The result that you obtain should resemble the following surface color map:
By default, your immediate result will be given in Kelvin instead of degrees Celsius. (In fact, the first result you will see is the velocity field, not temperature). Furthermore, it will be colored using a “jet” colormap. We will use distinct colormapping options to represent the air velocity and temperature fields. The next section (Postprocessing and Visualization) will help you in obtaining the above and other diagrams, such as plots of axial temperatures at various xo and a plot of centerline and surface temperatures Tc and Ts, respectively. We will also plot and extract numerical data for Ts and use it to find local hx ro , x . Answer the extra – credit question to determine the effects on solution when air property variations are included COMSOL analysis.
- 190 -
Temperature Development In Tubes: Uniform Surface Heat Flux
ME433 COMSOL INSTRUCTIONS
POSTPROCESSING AND VISUALIZATION
After solving the problem, we would like to be able to look at the solution. COMSOL offers us a number of different ways to look at our temperature (and other) fields. In this problem we will deal with 2D color maps, velocity (and other) vector fields, extraction of Ts, and centerline temperature development plot. Displaying T(r, x) with Velocity Vector Field V(r, x)
Let us first change the unit of temperature to degrees Celsius: 1. From the “Postprocessing” menu, open “Plot Parameters” dialog box (F12). 2. Under the “Surface” tab, change the unit of temperature to degrees Celsius from the drop – down menu in the “Unit” field. 3. Change the “Colormap” type from “jet” to “hsv”. 4. Click “Apply” to refresh main view and keep the “Plot Parameters” window open.
- 191 -
Temperature Development In Tubes: Uniform Surface Heat Flux
ME433 COMSOL INSTRUCTIONS
The 2D temperature distribution will be displayed using the “hsv” colormap type with degrees Celsius as the unit of temperature. Let’s now add the velocity vector field V(r, x). 5. Switch to the “Arrow” tab and enable the “Arrow plot” check box. 6. Choose “Velocity field” from “Predefined quantities”. 7. Enter “20” in the “Number of points” for both “x” and “y” fields. 8. Press the “Color” button and select a color you want the arrows to be displayed in. (Note: choose a color that produces good contrast. Black is a good choice here) 9. Click “Apply” to refresh main view and keep the “Plot Parameters” window open.
At this point, you will see a similar plot as shown on page 190. It is a good idea to save this colormap for future use. Before you do save it, however, experiment with the “Number of points” field in “Plot Parameters” window and adjust the velocity vector field to what seems the best view to you. Put “30” for the “x” field and update your view by pressing “Apply” button. Notice the difference in velocity vector field representation. Try other values. - 192 -
Temperature Development In Tubes: Uniform Surface Heat Flux
ME433 COMSOL INSTRUCTIONS
You may also want to see other quantities as vector fields. Available quantities are: (1) Temperature gradient, (2) Conductive heat flux, (3) Convective heat flux, and (4) Total heat flux. To see these quantities represented by a vector field: 10. Choose the quantity you wish to plot from “Predefined quantities”. 11. Click “Apply”. 12. Click “OK” when you are done displaying these quantities to close the “Plot Parameters” window. Saving Color Maps
After you have selected a view that shows the results clearly, you may want to save it as an image for future discussion. This may be done as follows: 1. Go to the “File” menu and select “Export Image”. This will bring up an “Export Image” window. For a 4” by 6” image, acceptable image quality settings are given in the figure below. If you need higher image quality, increase the DPI value.
2. Change your “Export Image” value settings to the ones in the above figure. 3. Click the “Export” button. 4. Name and save the image.
- 193 -
Temperature Development In Tubes: Uniform Surface Heat Flux
ME433 COMSOL INSTRUCTIONS
Plotting T(r, xo) (or T(r) at xo)
To make axial temperature T(r, xo) plots at specified xo, we simply need to know the end coordinates of axial lines along which T(r, xo) is to be plotted. Vertical axial lines are described by the radius of the tube in y – coordinate (or r coordinate). Let us begin by plotting axial temperature T(r, xo) at xo = 100 cm. 1. Under “Postprocessing” menu, select “Cross – Section Plot Parameters”. 2. Switch to “Line/Extrusion” tab. 3. Type “y” in the “Expression” field under “y – axis data” section of the tab.
4. Under “x – axis data”, use radio button to enable the “Expression” option.
5. Click on “Expression” button. 6. In new “x – axis data” window, type “T” in “Expression” field. 7. Change the “Unit” of temperature to degrees Celsius. 8. Click “OK” to apply and close “x – axis data” window.
9. In “Cross – Section Plot Parameters” window, enter the following coordinates in the “Cross – section line data”: x0 = x1 = 1; y0 = -0.03 and y1 = 0.03. 10. Click “Apply”. - 194 -
Temperature Development In Tubes: Uniform Surface Heat Flux
ME433 COMSOL INSTRUCTIONS
These steps produce a plot of axial temperature as a function of radius at x = 100 cm. Temperature T is plotted on the x – axis in degrees Celsius and y – coordinates are plotted on the y – axis. To save this plot, 1. Click the save “ ” button in your figure with results. This will bring up an “Export Image” window. 2. Follow steps 2 – 4 as instructed on page 193 to finish with exporting the image. To display axial temperature at other x0 values, repeat steps 8 and 9 on page 194. In step 8, change the x0 and x1 coordinates to those given in assignment question 2. You should produce 5 such plots altogether. When you are done with making these plots, click “OK” to close “Cross – Section Plot Parameters” window. [Note: Alternatively, you can save numerical data for temperature and y – coordinates instead of a plot. You can use this data later to recreate the plot in MATLAB (or other software). To save this numerical data, use the “Export current data” button in the plot window. Give the file a descriptive name (do not forget to add .txt extension at the end of file name), use the “Browse” button to navigate to your saving folder, and save the file]. Plotting Surface Temperature Ts
To plot surface temperature Ts for 0 x L using COMSOL, 1. Select “Cross – Section Plot Parameters …” option from “Postprocessing” menu. 2. Switch to the “Line/Extrusion” tab. 3. Type “T” in “Expression” field and change the “Unit” of temperature to degrees Celsius. 4. Change the “x – axis data” to “x”. 5. Enter the following coordinates in the “Cross – section line data”: x0 = 0, x1 = 1; and y0 = y1 = 0.03. 6. Click “OK” to close Cross – Section Plot Parameters window and plot Ts.
- 195 -
Temperature Development In Tubes: Uniform Surface Heat Flux
ME433 COMSOL INSTRUCTIONS
As a result of these steps, a new plot will be shown that graphs surface temperature Ts for 0 x L . Do not close this plot just yet. We are going to extract this data to a text file for comparative analysis with MATLAB. Exporting COMSOL Data to a Data File
1. Click on “Export Current Plot” button in the previous step.
in the Temperature – time graph created
2. Click “Browse” and navigate to your saving folder (say “Desktop”). 3. Name the file “Tx_surface.txt”. (Note: do not forget to type the “.txt” extension in the name of the file). 4. Click “OK” to save the file. The file is saved in the same directory where you first saved COMSOL model file with extension “.mph”.
- 196 -
Temperature Development In Tubes: Uniform Surface Heat Flux
ME433 COMSOL INSTRUCTIONS
Plotting Centerline Temperature Tc(ro, x) as a Function of x
Similar to axial temperature plots, we simply need to specify proper coordinates of a line along which we wish to plot temperature. Tube center line begins at x0 = 0 meters and terminates at x1 = 1. The y – coordinate (or the r coordinate) at the center of the tube stays at zero level as x varies. 1. Under “Postprocessing” menu, select “Cross – Section Plot Parameters”. 2. Switch to “Line/Extrusion” tab. 3. Type “T” in the “Expression” field under “y – axis data” section and change the “Unit” of temperature to degrees Celsius. 4. In “x – axis data” section, switch to upper radio button and select “x” using the drop – down menu. 5. Enter the following coordinates in the “Cross – section line data” section: x0 = 0, x1 = 1; y0 = y1 = 0.
6. Click “OK”. Centerline temperature Tc will be displayed as a function of x on 0 x L . This graph is shown on the next page. It has been re – plotted with MATLAB.
- 197 -
Temperature Development In Tubes: Uniform Surface Heat Flux
ME433 COMSOL INSTRUCTIONS
Modeling with MATLAB
This part of modeling procedures describes how to create graphs of surface heat transfer coefficient h(x) and temperature Ts using MATLAB. Obtain MATLAB script file named “flux_tube.m” from Blackboard prior to following these procedures. Save this file in the same directory as the data file(s) (Tx_surface.txt) from COMSOL. (Note: “flux_tube.m” file is attached to the electronic version of this document as well. To access the file directly from this document, select “View Navigation Panels Attachements” and then save “flux_tube.m” in a proper directory) MATLAB script (flux_tube.m) is programmed to use exported COMSOL data for surface temperature T x, 0 and Newton’s Law of cooling to determine the local heat transfer coefficient h(x) along the surface of the tube. Follow the steps below to complete this problem: 1. Open MATLAB by double clicking its icon on the Desktop. 2. Load “flux_tube.m” file by selecting “File Open Desktop flux_tube.m”. The script responsible for COMSOL data import and data comparison will appear in a new window. 3. Press F5 key to run the script. MATLAB editor will display a warning message. Click “Change Directory” to run the script. COMSOL solutions for h(x) and Ts x will be plotted in Figures 1 and 2. Results plotted with MATLAB
Does the temperature profile become invariant with distance x ? What observations do you make regarding Tc ?
- 198 -
Temperature Development In Tubes: Uniform Surface Heat Flux
ME433 COMSOL INSTRUCTIONS
MATLAB script
If you could not obtain this script from the Blackboard or the PDF file, you may copy it here, then paste it into notepad and save it in the same directory where you saved COMSOL data file(s). You will most likely get hard – to – spot syntax errors if you copy the script this way. It is therefore highly advised that you use the other 2 methods on obtaining this script instead of the copying method. % ######################################################################### % ME 433 - Heat Transfer % Sample MATLAB Script For: % (X) Temperature Development in Tubes - Unifor Surface Heat Flux % IMPORTANT: Save this file in the same directory with % "Tx_surface.txt" file. % ######################################################################### %% Preliminaries clear % Clears variables from memory clc % Clears the UI prompt % %% Constant Quantities Tinf = 20; % Ambient temperature, [degC] qx = 1000; % Applied heat flux, [W/m^2] %% COMSOL Data Import & hx_comsol Computation load Tx_surface.txt; % Imports a 2-column data vector from COMSOL x = Tx_surface(:,1)*100 ; % Tube coordinate vector, [cm] Ts = Tx_surface(:,2); % COMSOL Ts vector, [degC] hx_comsol = qx./(Ts-Tinf); % Heat transf. coeff. from COMSOL %% Plotter and Plot Cosmetics figure1 = figure('InvertHardcopy','off',... %\ 'Colormap',[1 1 1 ],... % | -> Setting up the figure 'Color',[1 1 1]); %/ plot(x,hx_comsol) % Plots COMSOL h box off grid on title('\fontname{Times New Roman} \fontsize{16} \bf Surface Heat Transfer Coefficient') xlabel('x, [cm]') ylabel('h, [W/m^2-\circC]') set(get(gca,'YLabel'),... 'fontsize', 14,... 'FontName','Times New Roman',... 'FontAngle','italic') set(get(gca,'XLabel'),... 'fontsize', 14,... 'FontName','Times New Roman',... 'FontAngle','italic') figure2 = figure('InvertHardcopy','off',... %\ 'Colormap',[1 1 1 ],... % | -> Setting up the figure 'Color',[1 1 1]); %/ plot(x,Ts) % Plots COMSOL Ts box off grid on title('\fontname{Times New Roman} \fontsize{16} \bf Surface Temperature T_s') xlabel('x, [cm]') ylabel('T_s , [\circC]') set(get(gca,'YLabel'),... 'fontsize', 14,... 'FontName','Times New Roman',... 'FontAngle','italic') set(get(gca,'XLabel'),... 'fontsize', 14,... 'FontName','Times New Roman',... 'FontAngle','italic')
This completes MATLAB modeling procedures for this problem.
- 199 -
Temperature Development In Tubes: Uniform Surface Heat Flux
ME433 COMSOL INSTRUCTIONS
COMSOL Results and Hints for Extra – Credit Question
The goal of this question is to determine how varying properties of air affect the solution. The following results for centerline velocity uc and temperature Tc were repotted with MATLAB. The length of the tube was increased to 5 meters.
Notice how varying air properties manifest a dramatic difference in centerline velocity. To use varying air properties in COMSOL, follow the steps below, 7. From the “Options” menu select “Expressions Scalar Expressions …” 8. Define the following names and expressions: EXPRESSION
UNIT
DESCRIPTION
k_air
NAME
10^(-3.723+0.865*log10(abs(T[1/K])))[W/(m*K)]
W/(m·K)
Air Conductivity
rho_air
1.013e5[Pa]*28.8[g/mol]/(8.314[J/(mol*K)]*T)
kg/m
mu_air
6e-6[Pa*s]+4e-8[Pa*s/K]*T
Kg/(m·s)
3
Air Density Air Viscosity
9. Click “OK”. 10. Use the same names of quantities defined above in “Subdomain Physics Settings” to replace the previously defined constant numerical properties. 11. Resolve the problem. COMSOL automatically determines correct property unit under the “Unit” column. If it does not, you are most likely entering wrong expressions. Carefully check the expression you typed and make corrections, if necessary. The description column is optional and can be left blank. This completes COMSOL modeling procedures for this problem.
- 200 -
Free Convection of Air Over an Isothermal Vertical Plate
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
ME433 COMSOL INSTRUCTTIONS
FREE CONVECTION OF AIR OVER AN ISOTHERMAL VERTICAL PLATE Problem Statement
A plate of 10 cm in height held at constant temperature Ts is brought to a room – temperature air environment. Surrounding air temperature T∞ is lower than plate surface temperature Ts. Due to temperature difference between air and the plate, the density of air near the plate starts to decrease. Due to the presence of earth’s gravitational acceleration field, air begins to rise along the surface of the plate forming viscous and thermal boundary layers. Of general interest is to learn how to use COMSOL to generate plots of velocity and temperature boundary layers in free convection over a vertical plate. Known quantities:
Free Convection Modeling Setup
Geometry: vertical plate Fluid: Air
Ts = 100 ºC T∞ = 20 ºC L = 10 cm
Observations
This is a free convection, external flow problem. Considered geometry is a vertical plate. The plate is held at constant temperature Ts.
Velocity and temperature fields are coupled in free convection. Therefore, a multiphysics model involving steady state Navier – Stokes and general heat transfer modes must be setup and coupled in COMSOL. Boussinesq approximation will be used to model air density changes induced by temperature field.
Subject to validation conditions, correlation equations from chapter 8 are applicable. For isothermal vertical plates, local Nusselt number is the quantity sought.
COMSOL may introduce errors in solution at the bottom and upper edges of the plate. Although the bottom edge errors are unavoidable, the upper edge error can be eliminated by extending the height of the plate by a few millimeters. Thus, we will extend the height of the plate by 5 mm at the upper edge (making the y – coordinates of the plate as ybottom = 0.01m and yup = 0.115m, as shown in the figure above).
- 201 -
Free Convection of Air Over an Isothermal Vertical Plate
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
ME433 COMSOL INSTRUCTTIONS
Assignment
1. State the criterion for transition from laminar to turbulent flow for free convection in vertical plates. Determine whether the flow in this problem is laminar or turbulent. 2. Use COMSOL to determine and show 2D colormaps of velocity and temperature fields. Use arrows to represent velocity vector field. 3. Use COMSOL to plot 2D colormap of the density field. 4. Use COMSOL to plot axial velocity u(x,yo) and temperature T(x,yo) at yo = 6 cm. 5. Use COMSOL to plot and extract numerical data local heat flux qy as a function of y on 0 y L . Use Newton’s law of cooling and extracted local heat flux qy to determine COMSOL local heat transfer coefficient h(0,y). Compute and plot experimentally determined h(y) given by the correct correlation equation and COMSOL h(y) on the same graph. [Note: In this instruction set, part of this assignment question will be done with MATLAB, but you are free to use any software of your choice] 6. Calculate and plot the percent error between COMSOL h(y) and h(y) based on correlation equation you chose. Base your error analysis on assumption that correlation – based h(y) is the correct solution. Can you conclude that COMSOL results are valid? [Note: In this instruction set, part of this assignment question will be done with MATLAB, but you are free to use any software of your choice] 7. Compute (analytically) the total heat transfer rate qT for a plate of 50 cm width. 8. [Extra Credit]:
- 202 -
Free Convection of Air Over an Isothermal Vertical Plate
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
ME433 COMSOL INSTRUCTTIONS
Modeling with COMSOL Multiphysics
This model analyzes free convection process outside a vertical plate. The plate is held at a constant temperature Ts, which is higher than the surrounding temperature T∞. As warm plate heats air near its surface, air starts rising due to changes in its density. This is called a “free convection” or “natural convection” process. When modeling this process, consider a rectangular subdomain that consists of air. The 10 cm plate is located on the left vertical wall. See the diagram in “Problem Statement” for this modeling geometry. The lift force responsible for natural convection process can be expressed in terms of local density change of air as fy = (ρ∞ – ρ)g. The term ρ∞ is the density far away from the plate where warm plate has no influence on the air, g is gravitational acceleration constant and ρ represents variable density. Boussinesq approximation can be used satisfactorily in this model to represent variable density field. We will compute ρ according to: ρ = ρ∞[1 – (T – T∞)/T∞] With these assumptions and approximations, we are now ready to begin the modeling procedure. MODEL NAVIGATOR
To start working on this problem, we first need to enable two application modes in the model navigator to create a Multiphysics model. The correct application modes are: (1) General Heat Transfer, and (2) Weakly Compressible Navier – Stokes. These modes will be responsible for setting up and calculating temperature and velocity distribution fields, respectively. For this setup: 1. Start “COMSOL Multiphysics”. 2. From the list of application modes, select “Heat Transfer Module General Heat Transfer Steady – state analysis”. 3. Click the “Multiphysics” button. 4. Click the “Add” button. 5. From the list of application modes, select “Heat Transfer Module Weakly Compressible Navier – Stokes Steady – state analysis”. 6. Click the “Add” button. 7. Click “OK”.
- 203 -
Free Convection of Air Over an Isothermal Vertical Plate
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
ME433 COMSOL INSTRUCTTIONS
OPTIONS AND SETTINGS: DEFINING CONSTANTS
Continue by creating a small database of constants the model will use. 1. From the “Options” menu select “Constants”. 2. Define the following names and expressions: NAME
EXPRESSION
VALUE
Tinf
273.15+20 [K]
293.15[K]
dT
10[K]
10[K]
rho0
DESCRIPTION Temperature Far Away Temperature Step
3
1.2042[kg/m^3]
1.2042[kg/m ]
mu_air
18.17e-6[kg/(s*m)]
(1.817e-5)[kg/(m·s)]
Air Dynamic Viscosity (20ºC)
k_air
0.02564[W/(m*degC)]
0.02564[W/(m·K)]
Air Conductivity (20ºC)
Cp_air
1006.1[J/(kg*degC)]
1006.1[J/(kg·K)]
Air Heat Capacity (20ºC)
g
9.81[m/s^2]
2
9.81[m/s ]
Air Density (20ºC)
Acc. Due to Gravity
3. Click “OK”. COMSOL automatically determines correct units under the “Value” column. If it does not, you are most likely entering wrong expressions. Carefully check the expression you typed and make corrections, if necessary. The description column is optional and can be left blank. It is presented here to give a short description of the constants.
- 204 -
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
Free Convection of Air Over an Isothermal Vertical Plate
ME433 COMSOL INSTRUCTTIONS
GEOMETRY MODELING
In this step, we will create a 2 – dimensional geometry that will be used as a model in our problem. According to problem statement, we will need to create a rectangle with partitioned left wall. This is done as follows. 1. In the “Draw” menu, select “Specify Objects Rectangle …” 2. Enter following rectangle dimensions for “R1”. R1 WIDTH
0.105
HEIGHT
0.13
3. Click “OK” to close “Rectangle” definition window. 4. Click on “Zoom Extents” button geometry.
in the main toolbar to zoom into the
5. In the “Draw” menu, select “Specify Objects Point …” 6. Start by entering following point coordinates for point “P1”. COORDINATES
P1
P2
X
0
0
Y
0.01
0.115
7. When done with step 6, click “OK” and repeat step 6 for point “P2”. 8. Click “OK” to close “Point” definition window. You should see your finished modeling geometry now in the main program window. The left wall of the rectangle should be partitioned into 3 parts by 2 points.
- 205 -
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
Free Convection of Air Over an Isothermal Vertical Plate
ME433 COMSOL INSTRUCTTIONS
PHYSICS SETTINGS
Physics settings in COMSOL consist of two parts: (1) Subdomain settings and (2) boundary conditions. The subdomain settings let us specify material types, initial conditions, modes of heat transfer (i.e. conduction and/or convection). The boundary conditions settings are used to specify what is happening at the boundaries of the geometry. In this model, we will have to specify and couple physics settings for the flow of air and heat transfer. Let us begin by specifying Boussinesq approximation to model air density – temperature dependence. We use Boussinesq approximation to achieve this as follows: 1. In “Options” menu, select “Expressions Subdomain Expressions”. 2. Select subdomain 1 in the “Subdomain selection” section. 3. Type “rho” in the “Name” field and “rho0*(1-(T-Tinf)/Tinf)” in the expression field. NAME
EXPRESSION
UNIT
rho
rho0*(1-(T-Tinf)/Tinf)
[kg/m ]
3
4. Click “OK” to close “Subdomain Expressions” setup window. COMSOL automatically determines correct units under the “Unit” column. If it does not, you are most likely entering wrong expression. Carefully check the expression you typed and make corrections, if necessary. Let us now proceed with setup of subdomain and boundary settings for flow field and heat transfer. Weakly Compressible Navier – Stokes Subdomain Settings
1. From the “Physics” menu select “Subdomain Settings” (equivalently, press F8). 2. Select subdomain 1 in the “Subdomain selection” section. 3. Type “rho” and “mu_air” in the fields for density ρ and dynamic viscosity η. 4. Type “g*(rho0-rho)” in the “Fy” field. 5. Click “OK”.
- 206 -
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
Free Convection of Air Over an Isothermal Vertical Plate
ME433 COMSOL INSTRUCTTIONS
Notice that the buoyant force Fy is set up in accordance with the condition described on page 203. This force setup (and density field variation) is responsible for driving the warm air up and making free convection possible. If the plate was in an environment where g ≈ 0, (such as inside the International Space Station), the air would not rise. Incidentally, this might be part of the reason why astronauts and cosmonauts do not have conventional cookware in space. Weakly Compressible Navier – Stokes Boundary Settings
1. From the “Physics” menu open the “Boundary Settings” (F7) dialog box. 2. Apply the following boundary conditions: BOUNDARY TYPE
BOUNDARY CONDITION
1, 3, 4
Wall
No Slip
2, 5, 6
Open boundary
Normal Stress
BOUNDARIES
COMMENTS Verify that field “f0” is set to “0”
3. Click “OK” to close the boundary settings window. The “no – slip” condition applied to boundaries 1, 3, and 4 assumes that velocity is zero at the wall. The remaining boundaries all have the “open” boundary condition, meaning that no forces act on the fluid. The “open” boundary condition defines the assumption that computational domain extends to infinity.
- 207 -
Free Convection of Air Over an Isothermal Vertical Plate
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
ME433 COMSOL INSTRUCTTIONS
General Heat Transfer Subdomain Settings
1. From “Mulptiphysics” menu, select “1 General Heat Transfer (htgh)” mode. 2. From the “Physics” menu, select “Subdomain Settings” (F8). 3. Select “Subdomain 1” in the subdomain selection section. 4. Enter “k_air”, “rho” and “Cp_air” in the k, ρ, and Cp fields, respectively. 5. Switch to “Convection” tab and check “Enable convective heat transfer” option.
6. Type “u” and “v” in the u and v fields, respectively. 7. Click “OK” to close the Subdomain Settings window.
- 208 -
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
Free Convection of Air Over an Isothermal Vertical Plate
ME433 COMSOL INSTRUCTTIONS
General Heat Transfer Boundary Conditions:
1. From the “Physics” menu open the “Boundary Settings” (F7) dialog box. 2. Apply the following boundary conditions: BOUNDARY
BOUNDARY CONDITION
COMMENTS
1, 4
Insulation/Symmetry
2, 6
Temperature
Enter “Tinf” in T0 field
3
Temperature
Enter “Tinf+dT” in T0 field
5
Convective flux
3. Click “OK” to close Boundary Settings window. The model keeps hot plate (boundary 3) at a constant temperature Ts (we will slowly raise temperature step dT with parametric solver to 80ºC so that solver is able to converge system of nonlinear equations. Note that when dT = 80ºC, temperature at the plate (boundary 3) is 100ºC, as given in the problem statement). The short boundaries below and above the vertical plate (1 and 4) are thermally insulated so that no conduction or convection occurs normal to the boundaries. Ideally you would not include the insulated parts, but they are needed to smoothen out air flow near the hot plate edges. On the bottom and the right boundaries (2 and 6), the model sets temperature equal to room temperature T∞. Air rises upwards through the upper horizontal boundary (5). Application of “Convective Flux” boundary condition assumes that convection dominates the transport of heat at this boundary. MESH GENERATION
The following steps describe how to generate a mesh that properly resolves the velocity field near the wall without using an overly dense mesh in the far field. 1. In the “Mesh” menu, select “Free Mesh Parameters” (F9). 2. Switch to “Boundary” tab 3. Select boundaries 1, 3, and 4 in the boundary selection section while holding the “Control (ctrl)” key on your keyboard. 4. Enter “3e-4” in the “Maximum element size” edit field. 5. Switch to the “Point” tab.
- 209 -
Free Convection of Air Over an Isothermal Vertical Plate
6. Select point 2. 7. Enter “2e-5” in the “Maximum element size” edit field. 8. Click “Remesh”. 9. Click “OK” to close “Free Mesh Parameters” window.
You should get a mesh that looks like the one below:
We are now ready to compute our solution.
- 210 -
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
ME433 COMSOL INSTRUCTTIONS
Free Convection of Air Over an Isothermal Vertical Plate
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
ME433 COMSOL INSTRUCTTIONS
COMPUTING AND SAVING THE SOLUTION
In this step we define the type of analysis to be performed. We are interested in stationary analysis here, which we previously selected in the Model Navigator. However, the problem is highly non – linear. Several solver settings must be changed for successful convergence. To easily find an initial guess for the solution, start by solving the problem for a higher viscosity than the true value for air. Then decrease the viscosity until you reach the true value for air. Make the transition from the start value to the true value using the parametric solver in the following way: 1. In “Solve” menu, select “Solver Parameters” (F11). 2. Switch to “Parametric” solver. 3. Enter “mu_air” in the field for “Name of parameter”. 4. Enter “1e-4
1.817e-5”
in the “List of parameter values” edit field.
5. Switch to “Stationary” tab and enable “Highly nonlinear problem” check box.
6. Switch to “Advanced” tab and select “None” from the “Type of scaling” list.
- 211 -
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
Free Convection of Air Over an Isothermal Vertical Plate
ME433 COMSOL INSTRUCTTIONS
7. Click “OK” to close Solver Parameters window. 8. From the “Solve” menu select “Solve Problem”. (Allow few minutes for solution) This solution serves as the initial value for solving the model with higher plate temperatures, which you perform with these steps: 9. From the “Solve” menu select the “Solver Manager”. 10. Click “Store Solution” button
on the bottom of the window.
11. Select “1.817e-5” as the “Parameter value” for solution to store. 12. Click “OK”.
13. In the “Initial value” area click the “Stored solution” radio button.
14. Click “OK” to close the Solver Manager. 15. From the “Solve” menu choose “Solver Parameters” (F11). 16. Enter “dT” in the field for “Name of parameter”. 17. Enter “10:10:80” in the “List of parameter values” edit field.
18. Switch to “Stationary” tab. 19. Disable “Highly nonlinear problem” check box.
- 212 -
Free Convection of Air Over an Isothermal Vertical Plate
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
ME433 COMSOL INSTRUCTTIONS
20. Click “OK” to close Solver parameters window. We will now use the initial value solution to find solutions to higher plate temperatures. 21. From the “Solve” menu select the “Solver Manager”. (Allow few minutes for solution) 22. Save your work on desktop by choosing “File Save”. Name the file according to the naming convention given in the “Introduction to COMSOL Multiphysics” document. The result that you obtain should resemble the following surface color maps. By default, temperature field is shown for the case when plate surface temperature is 100ºC, as asked in problem statement.
By default, your immediate result will be given in Kelvin instead of degrees Celsius for temperature field. Furthermore, it will be colored using a “jet” colormap and the velocity field (represented by arrows in the above) will not be shown. We will use distinct colormap options to represent the air velocity and temperature fields. The next section (Postprocessing and Visualization) will help you in obtaining the above and other diagrams, such as 2D colormap of air density field, plots of axial velocity u(x, yo) and temperature T(x, yo) at yo = 6 cm, and a plot of qy on 0 y L . We will then use MATALB to compute and plot local heat transfer coefficient h(y) from COMSOL qy data and verify this result with an appropriate correlation equation. A sample MATLAB script for COMSOL results verification is given in appendix.
- 213 -
Free Convection of Air Over an Isothermal Vertical Plate
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
ME433 COMSOL INSTRUCTTIONS
POSTPROCESSING AND VISUALIZATION
After solving the problem, we would like to be able to look at the solution. COMSOL offers us a number of different ways to look at our temperature (and other) fields. In this problem we will deal with 2D color maps, velocity (and other) vector fields, computation of local qy and 1D temperature distribution plot. You will then address the questions of COMSOL solution validity and compare the results to correlation equation mainly by using MATLAB. Displaying T(x, y) and Vector Field V(x, y)
Let us first change the unit of temperature to degrees Celsius: 1. From the “Postprocessing” menu, open “Plot Parameters” dialog box (F12). 2. Under the “Surface” tab, change the unit of temperature to degrees Celsius from the drop – down menu in the “Unit” field. 3. Change the “Colormap” type from “jet” to “hot”. 4. Click “Apply” to refresh main view and keep the “Plot Parameters” window open.
- 214 -
Free Convection of Air Over an Isothermal Vertical Plate
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
ME433 COMSOL INSTRUCTTIONS
The 2D temperature distribution will be displayed using the “hot” colormap type with degrees Celsius as the unit of temperature. Let’s now add the velocity vector field V(x, y). 5. Switch to the “Arrow” tab and enable the “Arrow plot” check box. 6. Choose “Velocity field” from “Predefined quantities”. 7. Enter “20” in the “Number of points” for both “x” and “y” fields. 8. Press the “Color” button and select a color you want the arrows to be displayed in. (Note: choose a color that produces good contrast. Green is a good choice here.) 9. Click “Apply” to refresh main view and keep the “Plot Parameters” window open.
At this point, you will see a similar plot as shown on page 213. It is a good idea to save this colormap for future use. Before you do save it, however, experiment with the “Number of points” field in “Plot Parameters” window and adjust the velocity vector field to what seems the best view to you. Put “30” for the “x” field and update your view by pressing “Apply” button. Notice the difference in velocity vector field representation. Try other values. - 215 -
Free Convection of Air Over an Isothermal Vertical Plate
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
ME433 COMSOL INSTRUCTTIONS
You may also want to see other quantities as vector fields. Available quantities are: (1) Temperature gradient, (2) Conductive heat flux, (3) Convective heat flux, and (4) Total heat flux. To see these quantities represented by a vector field: 10. Change the color of the arrow (see step 8). 11. Choose the quantity you wish to plot from “Predefined quantities”. 12. Click “Apply”. 13. Click “OK” when you are done displaying these quantities to close the “Plot Parameters” window. Saving Color Maps:
After you have selected a view that shows the results clearly, you may want to save it as an image for future discussion. This may be done as follows: 1. Go to the “File” menu and select “Export Image”. This will bring up an “Export Image” window. For a 4” by 6” image, acceptable image quality settings are given in the figure below. If you need higher image quality, increase the DPI value.
2. Change your “Export Image” value settings to the ones in the above figure. 3. Click the “Export” button. 4. Name and save the image.
- 216 -
Free Convection of Air Over an Isothermal Vertical Plate
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
ME433 COMSOL INSTRUCTTIONS
Displaying V(x, y) as a Colormap:
1. From the “Postprocessing” menu, open “Plot Parameters” dialog box (F12). 2. Under the “Arrow” tab, disable the “Arrow plot” checkbox 3. Switch to “Surface” tab.
4. From “Predefined quantities”, select “Velocity field”. 5. Change the “Colormap” type from “hot” to “jet”. 6. Click “Apply” to refresh main view and keep the “Plot Parameters” window open. The 2D Velocity distribution will be displayed using the “jet” colormap. Displaying Air Density Field Colormap:
With the “Plot Parameters” window open, ensure that you are under the “Surface” tab, 7. Type “rho” in “Expression” field (without quotation marks).
8. Click “Apply”. (Note: The unit will change automatically) These steps produce a colormap that displays variations in air’s density ρ. Note the values on the color scale and compare them with Appendix C of your textbook.
- 217 -
Free Convection of Air Over an Isothermal Vertical Plate
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
ME433 COMSOL INSTRUCTTIONS
Plotting Axial Temperature T(x, yo) at yo = 6 cm
1. From “Postprocessing” menu select “Cross – Section Plot Parameters” option. 2. Under “General” tab, select “80” as the only “Solution to use” option.
3. Switch to the “Line/Extrusion” tab. 4. Change the “Unit” of temperature to degrees Celsius. 5. Change the “x – axis data” from “arc – length” to “x”. 6. Enter the following coordinates in the “Cross – section line data”: x0 = 0, x1 = 0.105; y0 = y1 = 0.06. 7. Click “Apply”.
- 218 -
Free Convection of Air Over an Isothermal Vertical Plate
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
ME433 COMSOL INSTRUCTTIONS
These steps produce a plot of T(x) at y = 6 cm, from x = 0 cm (plate surface) to x = 10.5 cm (ambient environment conditions). Temperature T is plotted on the y – axis and x – coordinates are plotted on the x – axis. To save this plot, 8. Click the save “ ” button in your figure with results. This will bring up an “Export Image” window. 9. Follow steps 2 – 4 as instructed on page 216 to finish with exporting the image. Plotting Axial Velocity u(x, yo) at yo = 6 cm
With “Cross – Section Plot Parameters” window open, ensure that you are under the “Line/Extrusion” tab, 10. Type “U_chns” in “Expression” field (without quotation marks).
11. Click “OK”. (Note: The unit will change automatically) These steps produce a plot of u(x) at y = 6 cm, from x = 0 cm (plate surface) to x = 10.5 cm (ambient environment conditions). Axial velocity u is plotted on the y – axis and x – coordinates are plotted on the x – axis. To save this plot, 12. Click the save “ ” button in your figure with results. This will bring up an “Export Image” window. 13. Follow steps 2 – 4 as instructed on page 216 to finish with exporting the image. Plotting Local qy for 0 y L
To plot qy for 0 y L using COMSOL, 1. Select “Cross – Section Plot Parameters …” option from “Postprocessing” menu. 2. Switch to the “Line/Extrusion” tab. 3. From “Predefined quantities”, select “Total heat flux”.
- 219 -
Free Convection of Air Over an Isothermal Vertical Plate
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
ME433 COMSOL INSTRUCTTIONS
4. Change the “x – axis data” from “x” to “y”. 5. Enter the following coordinates in the “Cross – section line data”: x0 = x1 = 0; y0 = 0.01, and y1 = 0.11. 6. Click “OK” to close Cross – Section Plot Parameters window.
As a result of these steps, a new plot will be shown that graphs qy for 0 y L . Do not close this plot just yet. We are going to extract this data to a text file for comparative analysis with MATLAB.
Exporting COMSOL Data to a Data File 1. Click on “Export Current Plot” button in the previous step.
in the Temperature – time graph created
2. Click “Browse” and navigate to your saving folder (say “Desktop”). 3. Name the file “qy.txt”. (Note: do not forget to type the “.txt” extension in the name of the file). 4. Click “OK” to save the file. This completes COMSOL modeling procedures for this problem. - 220 -
Free Convection of Air Over an Isothermal Vertical Plate
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
ME433 COMSOL INSTRUCTTIONS
Modeling with MATLAB
This part of modeling procedures describes how to create comparative graphs of local heat transfer coefficient h(y) using MATLAB. Obtain MATLAB script file named “isothermal_vplate.m” from Blackboard prior to following these procedures. Save this file in the same directory as the data file(s) (qy.txt) from COMSOL. (Note: “isothermal_vplate.m” file is attached to the electronic version of this document as well. To access the file directly from this document, select “View Navigation Panels Attachements” and then save “isothermal_vplate.m” in a proper directory)
Comparing COMSOL Solution to Correlation Solution MATLAB script (isothermal_vplate.m) is programmed to use exported COMSOL data for heat flux qy and Newton’s Law of cooling to determine the local heat transfer coefficient h(y) along the plate. The script is also programmed to calculate experimental local heat transfer coefficient h(y) according to a correlation equation. The script will ultimately produce comparative graphs that will plot both solutions. Follow the steps below to complete this problem: 1. Open MATLAB by double clicking its icon on the Desktop. 2. Load “isothermal_vplate.m” file by selecting “File Open Desktop isothermal_vplate.m”. The script responsible for COMSOL data import and data comparison will appear in a new window. 3. Press F5 key to run the script. MATLAB editor will display a warning message. Click “Change Directory” to run the script. Correlation equation and COMSOL solutions will be plotted in Figure 1. Figure 2 plots the percent error between local heat transfer coefficients according to the equation printed on the figure. These results are shown below.
Results Plotted with MATLAB:
- 221 -
Free Convection of Air Over an Isothermal Vertical Plate
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
ME433 COMSOL INSTRUCTTIONS
While in MATLAB, you may zoom into the left plot to notice departures in results based on the solution methods. Error analysis shows that most of the error is concentrated at the bottom edge of the plate. It is therefore reasonable to zoom into this area to better notice departures in results based on the solution methods. This is shown in the figure below.
The following 2 graphs show axial velocity and temperature at yo = 6 cm. These graphs were previously obtained in COMSOL. They have been repotted with MATLAB.
Armed with these results, you are in a position to answer most of the assigned questions.
- 222 -
Free Convection of Air Over an Isothermal Vertical Plate
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
ME433 COMSOL INSTRUCTTIONS
APPENDIX
MATLAB script If you could not obtain this script from the Blackboard or the PDF file, you may copy it here, then paste it into notepad and save it in the same directory where you saved COMSOL data file(s). You will most likely get hard – to – spot syntax errors if you copy the script this way. It is therefore highly advised that you use the other 2 methods on obtaining this script instead of the copying method. % % % % % % % %
######################################################################### ME 433 - Heat Transfer Sample MATLAB Script For: (X) Free Convection of Air over an Isothermal Vertical Plate IMPORTANT: Save this file in the same directory with "qy.txt" file. #########################################################################
%% Preliminaries clear % Clears variables from memory clc % Clears the UI prompt %% Constant Quantities Tinf = 20; % Ambient temperature, [degC] Ts = 100; % Plate temperature, [degC] Tf = 0.5*(Tinf + Ts); % Film temperature, [degC] g = 9.81; % acc. due to gravity, [m/s^2] Cp = 1008; % at Tf rho = 1.0596; %% at Tf mu = 20.03e-6; % at Tf eta = 18.9e-6; % at Tf k = 0.02852; % at Tf Pr = 0.708; % at Tf alpha = eta/Pr; % at Tf beta = 1/(Tf + 273.15); % in Kelvin^(-1) %% Heat Flux Data Import from COMSOL Multiphysics: load qy.txt; % Loads q"(0,y) as a 2 column vector y = 0:0.000501:0.1'; % y - coords vector, [m] yflux = qy(:,2)'; % flux, [W/m^2] hy_comsol = yflux./(Ts - Tinf); % COMSOL h(y), [W/(m^2-C)] %% Correlation Equation For Nusselt Number Ray = beta*g*(Ts - Tinf)*y.^(3)/(eta*alpha); Nuy = 3/4*(Pr/(2.435 + 4.884*sqrt(Pr)... + 4.953*Pr))^(1/4)*Ray.^(1/4); % Local Nusselt number hy_analyt = (k./y).*Nuy; % Correlation Local Heat Transfer Coefficient %% Error Analysis in h(y) errh = (hy_comsol - hy_analyt)./hy_analyt*100; %% Plotter figure1 = figure('InvertHardcopy','off',... %\ 'Colormap',[1 1 1 ],... % | -> Setting up the figure 'Color',[1 1 1]); %/ plot(y,hy_comsol,'k',y,hy_analyt,'k--'); % Plotting grid on box off title('\fontname{Times New Roman} \fontsize{16} \bf Local Heat Transfer Coefficient h_y') xlabel('\fontname{Times New Roman} \fontsize{14} \it \bf y, [m]') ylabel('\fontname{Times New Roman} \fontsize{14} \it \bf h_y , [W/m^2-\circC]') legend('COMSOL Solution','Correlation Solution','location','northeast') % % figure2 = figure('InvertHardcopy','off',... %\
- 223 -
Free Convection of Air Over an Isothermal Vertical Plate
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
ME433 COMSOL INSTRUCTTIONS
'Colormap',[1 1 1 ],... % | -> Setting up the figure 'Color',[1 1 1]); %/ plot(y,errh,'k'); % Plotting grid on box off title('\fontname{Times New Roman} \fontsize{16} \bf Error Analysis') xlabel('\fontname{Times New Roman} \fontsize{14} \it \bf y, [m]') ylabel('\fontname{Times New Roman} \fontsize{14} \it \bf Error in h_y , [%]') str1(1) = {'$${\%err={h_{y_{comsol}}-h_{y_{correlation}}\over h_{y_{correlation}}}\times 100} $$'}; text('units','normalized', 'position',[.33 .9], ... 'fontsize',14,... 'FontName', 'Times New Roman',... 'FontAngle', 'italic', ... 'BackgroundColor',[1 1 1],... 'interpreter','latex',... 'string', str1); %% COMSOL u(x,y0) and T(x,y0) Replots % ######################################################################### % Unsuppress this portion only if you wich to replot COMSOL u(x,y0) and % T(x,y0). Prior to reploting, make sure to extract numerical data for % velocity and temperature to text files. You must name the files as: % "velfields.txt" and "tempfield.txt" for velocity and remperature fields, % respectively and place then in the same directory as this script. % ######################################################################### % load velfield.txt; % Loads u(x,y0) as a 2 column vector % load tempfield.txt; % Loads T(x,y0) as a 2 column vector % y1 = velfield(:,1)*100; % y - coords, [cm] % u1 = velfield(:,2); % u(x), [m/s] % t1 = tempfield(:,2); % T(x), [degC] % % figure3 = figure('InvertHardcopy','off',... %\ % 'Colormap',[1 1 1 ],... % | -> Setting up the figure % 'Color',[1 1 1]); %/ % plot(y1,u1,'k--'); % Plotting % grid on % box off % title('\fontname{Times New Roman} \fontsize{16} \bf Axial velocity u at y_o = 6 cm') % xlabel('\fontname{Times New Roman} \fontsize{14} \it \bf y, [cm]') % ylabel('\fontname{Times New Roman} \fontsize{14} \it \bf u (x, y_o) , [m/s]') % % figure4 = figure('InvertHardcopy','off',... %\ % 'Colormap',[1 1 1 ],... % | -> Setting up the figure % 'Color',[1 1 1]); %/ % plot(y1,t1,'k--'); % Plotting % grid on % box off % title('\fontname{Times New Roman} \fontsize{16} \bf Axial temperature T at y_o = 6 cm') % xlabel('\fontname{Times New Roman} \fontsize{14} \it \bf y, [cm]') % ylabel('\fontname{Times New Roman} \fontsize{14} \it \bf T (x, y_o) , [\circC]') %
This completes MATLAB modeling procedures for this problem.
- 224 -
Free Convection of Air Over a Heated Vertical Plate
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
ME433 COMSOL INSTRUCTTIONS
FREE CONVECTION OF AIR OVER A HEATED VERTICAL PLATE Problem Statement
A plate of 10 cm in height heated with constant heat flux qy is brought to a room – temperature air environment. Due to temperature difference between air and the plate, the density of air near the plate starts to decrease. In presence of earth’s gravitational acceleration field, air begins to rise near the surface of the plate forming viscous and thermal boundary layers. Of general interest is to learn how to use COMSOL to generate plots of velocity and temperature boundary layers in free convection over a vertical plate. Known quantities:
Free Convection Modeling Setup
Geometry: vertical plate Fluid: Air
qy = 1000 W/m2 T∞ = 20 ºC L = 10 cm
Observations
This is a free convection, external flow problem. Considered geometry is a vertical plate. The plate is heated by constant heat flux qy .
Velocity and temperature fields are coupled in free convection. Therefore, a multiphysics model involving steady state Navier – Stokes and heat transfer modes must be set up and coupled in COMSOL. Boussinesq approximation will be used to model air density changes induced by temperature field.
Subject to validation conditions, correlation equations from chapter 8 may be applicable. For heated vertical plates, plate surface temperature is the quantity sought.
COMSOL may introduce errors in solution at the bottom and upper edges of the plate. Although the bottom edge errors are unavoidable, the upper edge error can be eliminated by extending the height of the plate by a few millimeters. Thus, we will extend the height of the plate by 5 mm at the upper edge (making the y – coordinates of the plate as ybottom = 0.01m and yup = 0.115m, as shown in the figure above).
- 225 -
Free Convection of Air Over a Heated Vertical Plate
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
ME433 COMSOL INSTRUCTTIONS
Assignment
1. Use COMSOL to determine and show 2D colormaps of velocity and temperature fields. Use arrows to represent velocity vector field. 2. Use COMSOL to plot 2D colormap of the density field. 3. Use COMSOL to plot axial velocity u(x,yo) and temperature T(x,yo) at yo = 6 cm. 4. Use COMSOL to plot and extract numerical data for plate surface temperature Ts as a function of y on 0 y L . Compute and plot analytic Ts given by correlation 8.29a and COMSOL Ts on the same graph. [Note: In this instruction set, part of this assignment question will be done with MATLAB, but you are free to use any software of your choice] 5. Calculate and plot the percent error between COMSOL Ts and Ts based on correlation 8.29a. Base your error analysis on assumption that correlation – based Ts is the correct solution. Can you conclude that COMSOL results are valid? [Note: In this instruction set, part of this assignment question will be done with MATLAB, but you are free to use any software of your choice] 6. State the criterion for transition from laminar to turbulent flow for free convection in vertical plates. Determine whether the flow in this problem is laminar or turbulent [Hint: use COMSOL solution for temperature field to determine film temperature]. Determine whether of correlation 8.29a is applicable. 7. [Extra Credit]: Compare 2D colormaps of velocity and temperature fields from parametric solver for the following values of surface flux stepping “dq”: (a) 100 W/m2, and (b) 1000 W/m2. [Hint: Use available “Parameter value:” options under “General” tab of “Plot Parameters” window]. Explain why thermal boundary layer is larger for smaller flux (a) than for the larger flux (b). Present sufficient numerical evidence to support your answer. Intuitively speaking, would you expect this to take place prior to comparing COMSOL solutions for velocity and temperature fields?
- 226 -
Free Convection of Air Over a Heated Vertical Plate
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
ME433 COMSOL INSTRUCTTIONS
Modeling with COMSOL Multiphysics
This model analyzes free convection process outside a vertical plate. The plate is heated with constant heat flux qy . As warm plate heats air near its surface, air starts rising due to changes in its density. This is called a “free convection” or “natural convection” process. When modeling this process, consider a rectangular subdomain that consists of air. The 10 cm plate is located on the left vertical wall. See the diagram in “Problem Statement” for this modeling geometry. The lift force responsible for natural convection process can be expressed in terms of local density change of air as fy = (ρ∞ – ρ)g. The term ρ∞ is the density far away from the plate where the hot plate has no influence on air, g is gravitational acceleration constant and ρ represents variable density. Boussinesq approximation can be used satisfactorily in this model to represent variable density field. We will compute ρ according to: ρ = ρ∞[1 – (T – T∞)/T∞] With these assumptions and approximations, we are now ready to begin the modeling procedure. MODEL NAVIGATOR
To start working on this problem, we first need to enable two application modes in the model navigator to create a Multiphysics model. The correct application modes are located under COMSOL Multiphysics Fluid Dynamics and Heat Transfer sections. These modes will be responsible for setting up and calculating temperature and velocity distribution fields, respectively. For this setup: 1. Start “COMSOL Multiphysics”. 2. From the list of application modes, select “COMSOL Multyphysics Fluid Dynamics Incompressible Navier – Stokes Steady – state analysis”. 3. Click the “Multiphysics” button. 4. Click the “Add” button. 5. From the list of application modes, select “COMSOL Multyphysics Heat Transfer Convection and Conduction Steady – state analysis”. 6. Click the “Add” button. 7. Click “OK”.
- 227 -
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
Free Convection of Air Over a Heated Vertical Plate
ME433 COMSOL INSTRUCTTIONS
OPTIONS AND SETTINGS: DEFINING CONSTANTS
Continue by creating a small database of constants the model will use. 1. From the “Options” menu select “Constants”. 2. Define the following names and expressions: NAME
EXPRESSION
VALUE
Tinf
273.15+20[K]
293.15[K]
dq
100[W/m^2]
100[W/m ]
rho0
DESCRIPTION Temperature Far Away
2
Heat Flux Stepping 3
1.2042[kg/m^3]
1.2042[kg/m ]
mu_air
18.17e-6[kg/(s*m)]
(1.817e-5)[kg/(m·s)]
Air Dynamic Viscosity (20ºC)
k_air
0.02564[W/(m*degC)]
0.02564[W/(m·K)]
Air Conductivity (20ºC)
Cp_air
1006.1[J/(kg*degC)]
1006.1[J/(kg·K)]
Air Heat Capacity (20ºC)
g
9.81[m/s^2]
2
9.81[m/s ]
Air Density (20ºC)
Acc. Due to Gravity
3. Click “OK”. COMSOL automatically determines correct units under the “Value” column. If it does not, you are most likely entering wrong expressions. Carefully check the expression you typed and make corrections, if necessary. The description column is optional and can be left blank. It is presented here to give a short description of the constants.
- 228 -
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
Free Convection of Air Over a Heated Vertical Plate
ME433 COMSOL INSTRUCTTIONS
GEOMETRY MODELING
In this step, we will create a 2 – dimensional geometry that will be used as a model in our problem. According to problem statement, we will need to create a rectangle with partitioned left wall. This is done as follows. 1. In the “Draw” menu, select “Specify Objects Rectangle …” 2. Enter following rectangle dimensions for “R1”. R1 WIDTH
0.105
HEIGHT
0.13
3. Click “OK” to close “Rectangle” definition window. 4. Click on “Zoom Extents” button geometry.
in the main toolbar to zoom into the
5. In the “Draw” menu, select “Specify Objects Point …” 6. Start by entering following point coordinates for point “P1”. COORDINATES
P1
P2
X
0
0
Y
0.01
0.115
7. When done with step 6, click “OK” and repeat step 6 for point “P2”. 8. Click “OK” to close “Point” definition window. You should see your finished modeling geometry now in the main program window. The left wall of the rectangle should be partitioned into 3 parts by 2 points.
- 229 -
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
Free Convection of Air Over a Heated Vertical Plate
ME433 COMSOL INSTRUCTTIONS
PHYSICS SETTINGS
Physics settings in COMSOL consist of two parts: (1) Subdomain settings and (2) boundary conditions. The subdomain settings let us specify material types, initial conditions, modes of heat transfer (i.e. conduction and/or convection). The boundary conditions settings are used to specify what is happening at the boundaries of the geometry. In this model, we will have to specify and couple physics settings for the flow of air and heat transfer. Let us begin by specifying Boussinesq approximation to model air density – temperature dependence. We use Boussinesq approximation to achieve this as follows: 1. In “Options” menu, select “Expressions Subdomain Expressions”. 2. Select subdomain 1 in the “Subdomain selection” section. 3. Type “rho” in the “Name” field and “rho0*(1-(T-Tinf)/Tinf)” in the expression field. NAME
EXPRESSION
UNIT
rho
rho0*(1-(T-Tinf)/Tinf)
[kg/m ]
3
4. Click “OK” to close “Subdomain Expressions” setup window. COMSOL automatically determines correct units under the “Unit” column. If it does not, you are most likely entering wrong expression. Carefully check the expression you typed and make corrections, if necessary. Let us now proceed with setup of subdomain and boundary settings for flow field and heat transfer.
Incompressible Navier – Stokes Subdomain Settings 1. From “Mulptiphysics” menu, select “1 Incompressible Navier – Stokes (ns)” mode. 2. From the “Physics” menu select “Subdomain Settings” (equivalently, press F8). 3. Select subdomain 1 in the “Subdomain selection” section. 4. Type “rho” and “mu_air” in the fields for density ρ and dynamic viscosity η. 5. Type “g*(rho0-rho)” in the “Fy” field. 6. Click “OK”.
- 230 -
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
Free Convection of Air Over a Heated Vertical Plate
ME433 COMSOL INSTRUCTTIONS
Notice that the buoyant force Fy is set up in accordance with the condition described on page 227. This force setup (and density field variation) is responsible for driving the warm air up and making free convection possible. If the plate was in an environment where g ≈ 0, (such as inside the International Space Station), the air would not rise. Incidentally, this might be part of the reason why astronauts and cosmonauts do not have conventional cookware in space.
Incompressible Navier – Stokes Boundary Settings 1. From the “Physics” menu open the “Boundary Settings” (F7) dialog box. 2. Apply the following boundary conditions: BOUNDARIES
BOUNDARY TYPE
BOUNDARY CONDITION
1, 3, 4
Wall
No Slip
2, 5, 6
Open boundary
Normal Stress
COMMENTS
Verify that field “f0” is set to “0”
3. Click “OK” to close the boundary settings window. The “no – slip” condition applied to boundaries 1, 3, and 4 assumes that velocity is zero at the wall. The remaining boundaries all have the “open” boundary condition, meaning that no forces act on the fluid. The “open” boundary condition defines the assumption that computational domain extends to infinity.
- 231 -
Free Convection of Air Over a Heated Vertical Plate
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
ME433 COMSOL INSTRUCTTIONS
Convection and Conduction Subdomain Settings 1. From “Mulptiphysics” menu, select “2 Convection and Conduction (cc)” mode. 2. From the “Physics” menu, select “Subdomain Settings” (F8). 3. Select “Subdomain 1” in the subdomain selection section. 4. Enter “k_air”, “rho” and “Cp_air” in the k, ρ, and Cp fields, respectively. 5. Type “u” and “v” in the u and v fields, respectively.
6. Switch to “Init” tab. 7. Type “Tinf” in “T(t0)” field.
8. Click “OK” to close the Subdomain Settings window.
- 232 -
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
Free Convection of Air Over a Heated Vertical Plate
ME433 COMSOL INSTRUCTTIONS
Convection and Conduction Boundary Conditions: 1. From the “Physics” menu open the “Boundary Settings” (F7) dialog box. 2. Apply the following boundary conditions: BOUNDARY
BOUNDARY CONDITION
COMMENTS
1, 4
Thermal Insulation
2, 6
Temperature
Enter “Tinf” in T0 field
3
Heat Flux
Enter “dq” in q0 field
5
Convective flux
3. Click “OK” to close Boundary Settings window. The model keeps hot plate (boundary 3) at a constant heat flux qy (we will slowly raise heat flux step dq with parametric solver to 1000 W/m2 so that solver is able to converge system of nonlinear equations. The short boundaries below and above the vertical plate (1 and 4) are thermally insulated so that no conduction or convection occurs normal to the boundaries. Ideally you would not include the insulated parts, but they are needed to smoothen out air flow near the hot plate edges. On the bottom and the right boundaries (2 and 6), the model sets temperature equal to room temperature T∞. Air rises upwards through the upper horizontal boundary (5). Application of “Convective Flux” boundary condition assumes that convection dominates the transport of heat at this boundary. MESH GENERATION
The following steps describe how to generate a mesh that properly resolves the velocity field near the wall without using an overly dense mesh in the far field. 1. In the “Mesh” menu, select “Free Mesh Parameters” (F9). 2. Switch to “Boundary” tab 3. Select boundaries 1, 3, and 4 in the boundary selection section while holding the “Control (ctrl)” key on your keyboard. 4. Enter “3e-4” in the “Maximum element size” edit field. 5. Switch to the “Point” tab.
- 233 -
Free Convection of Air Over a Heated Vertical Plate
6. Select point 2. 7. Enter “2e-5” in the “Maximum element size” edit field. 8. Click “Remesh”. 9. Click “OK” to close “Free Mesh Parameters” window.
You should get the following triangular mesh:
We are now ready to compute our solution.
- 234 -
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
ME433 COMSOL INSTRUCTTIONS
Free Convection of Air Over a Heated Vertical Plate
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
ME433 COMSOL INSTRUCTTIONS
COMPUTING AND SAVING THE SOLUTION
In this step we define the type of analysis to be performed. We are interested in stationary analysis here, which we previously selected in the Model Navigator. However, the problem is highly non – linear. Several solver settings must be changed for successful convergence. To easily find an initial guess for the solution, start by solving the problem for a higher viscosity than the true value for air. Then decrease the viscosity until you reach the true value for air. Make the transition from the start value to the true value using the parametric solver in the following way: 1. In “Solve” menu, select “Solver Parameters” (F11). 2. Switch to “Parametric” solver. 3. Enter “mu_air” in the field for “Name of parameter”. 4. Enter “1e-4
1.817e-5”
in the “List of parameter values” edit field.
5. Switch to “Stationary” tab and enable “Highly nonlinear problem” check box.
6. Switch to “Advanced” tab and select “None” from the “Type of scaling” list.
- 235 -
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
Free Convection of Air Over a Heated Vertical Plate
ME433 COMSOL INSTRUCTTIONS
7. Click “OK” to close Solver Parameters window. 8. From the “Solve” menu select “Solve Problem”. (Allow few minutes for solution) This solution serves as the initial value for solving the model with higher plate temperatures, which you perform with these steps: 9. From the “Solve” menu select the “Solver Manager”. 10. Click “Store Solution” button
on the bottom of the window.
11. Select “1.817e-5” as the “Parameter value” for solution to store. 12. Click “OK”.
13. In the “Initial value” area click the “Stored solution” radio button.
14. Click “OK” to close the Solver Manager. 15. From the “Solve” menu choose “Solver Parameters” (F11). 16. Enter “dq” in the field for “Name of parameter”. 17. Enter “100:100:1000” in the “List of parameter values” edit field.
18. Switch to “Stationary” tab. 19. Disable “Highly nonlinear problem” check box. - 236 -
Free Convection of Air Over a Heated Vertical Plate
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
ME433 COMSOL INSTRUCTTIONS
20. Click “OK” to close Solver parameters window. We will now use the initial value solution to find solutions to higher plate temperatures. 21. From the “Solve” menu select the “Solver Manager”. (Allow few minutes for solution) 22. Save your work on desktop by choosing “File Save”. Name the file according to the naming convention given in the “Introduction to COMSOL Multiphysics” document. The result that you obtain should resemble the following surface color maps. By default, temperature field is shown for the case when plate surface heat flux is 1000 W/m2, as asked in problem statement.
By default, your immediate result will be given in Kelvin instead of degrees Celsius for temperature field. Furthermore, it will be colored using a “jet” colormap and the velocity field (represented by arrows in the above) will not be shown. We will use distinct colormap options to represent the air velocity and temperature fields. The next section (Postprocessing and Visualization) will help you in obtaining the above and other diagrams, such as 2D colormap of air density field, plots of axial velocity u(x, yo) and temperature T(x, yo) at yo = 6 cm, and a plot of surface temperature Ts(y) on 0 y L . We will then use MATALB to compute and re – plot COMSOL surface temperature Ts(y) and verify this result against correlation 8.29a. A sample MATLAB script for COMSOL results verification is given in appendix.
- 237 -
Free Convection of Air Over a Heated Vertical Plate
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
ME433 COMSOL INSTRUCTTIONS
POSTPROCESSING AND VISUALIZATION
After solving the problem, we would like to be able to look at the solution. COMSOL offers us a number of different ways to look at our temperature (and other) fields. In this problem we will deal with 2D color maps, velocity (and other) vector fields, plotting and extracting numerical data for surface temperature Ts(y) to a text file, and 1D temperature distribution plots. You will then address the questions of COMSOL solution validity and compare the results to correlation 8.29a mainly by using MATLAB.
Displaying T(x, y) and Vector Field V(x, y) Let us first change the unit of temperature to degrees Celsius: 1. From the “Postprocessing” menu, open “Plot Parameters” dialog box (F12). 2. Under the “Surface” tab, change the unit of temperature to degrees Celsius from the drop – down menu in the “Unit” field. 3. Change the “Colormap” type from “jet” to “hot”. 4. Click “Apply” to refresh main view and keep the “Plot Parameters” window open.
- 238 -
Free Convection of Air Over a Heated Vertical Plate
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
ME433 COMSOL INSTRUCTTIONS
The 2D temperature distribution will be displayed using the “hot” colormap type with degrees Celsius as the unit of temperature. Let’s now add the velocity vector field V(x, y). 5. Switch to the “Arrow” tab and enable the “Arrow plot” check box. 6. Choose “Velocity field” from “Predefined quantities”. 7. Enter “20” in the “Number of points” for both “x” and “y” fields. 8. Press the “Color” button and select a color you want the arrows to be displayed in. (Note: choose a color that produces good contrast. Green is a good choice here.) 9. Click “Apply” to refresh main view and keep the “Plot Parameters” window open.
At this point, you will see a similar plot as shown on page 237. It is a good idea to save this colormap for future use. Before you do save it, however, experiment with the “Number of points” field in “Plot Parameters” window and adjust the velocity vector field to what seems the best view to you. Put “30” for the “x” field and update your view by pressing “Apply” button. Notice the difference in velocity vector field representation. Try other values. - 239 -
Free Convection of Air Over a Heated Vertical Plate
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
ME433 COMSOL INSTRUCTTIONS
You may also want to see other quantities as vector fields. Available quantities are: (1) Temperature gradient, (2) Conductive heat flux, (3) Convective heat flux, and (4) Total heat flux. To see these quantities represented by a vector field: 10. Change the color of the arrow (see step 8). 11. Choose the quantity you wish to plot from “Predefined quantities”. 12. Click “Apply”. 13. Click “OK” when you are done displaying these quantities to close the “Plot Parameters” window.
Saving Color Maps After you have selected a view that shows the results clearly, you may want to save it as an image for future discussion. This may be done as follows: 1. Go to the “File” menu and select “Export Image”. This will bring up an “Export Image” window. For a 4” by 6” image, acceptable image quality settings are given in the figure below. If you need higher image quality, increase the DPI value.
2. Change your “Export Image” value settings to the ones in the above figure. 3. Click the “Export” button. 4. Name and save the image.
- 240 -
Free Convection of Air Over a Heated Vertical Plate
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
ME433 COMSOL INSTRUCTTIONS
Displaying V(x, y) as a Colormap 1. From the “Postprocessing” menu, open “Plot Parameters” dialog box (F12). 2. Under the “Arrow” tab, disable the “Arrow plot” checkbox 3. Switch to “Surface” tab.
4. From “Predefined quantities”, select “Velocity field”. 5. Change the “Colormap” type from “hot” to “jet”. 6. Click “Apply” to refresh main view and keep the “Plot Parameters” window open. The 2D Velocity distribution will be displayed using the “jet” colormap.
Displaying Air Density Field Colormap With the “Plot Parameters” window open, ensure that you are under the “Surface” tab, 7. Type “rho” in “Expression” field (without quotation marks).
8. Click “Apply”. (Note: The unit will change automatically) These steps produce a colormap that displays variations in air’s density ρ. Note the values on the color scale and compare them with Appendix C of your textbook. - 241 -
Free Convection of Air Over a Heated Vertical Plate
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
ME433 COMSOL INSTRUCTTIONS
Plotting Axial Temperature T(x, yo) at yo = 6 cm 1. From “Postprocessing” menu select “Cross – Section Plot Parameters” option. 2. Under “General” tab, select “1000” as the only “Solution to use” option.
3. Switch to the “Line/Extrusion” tab. 4. Change the “Unit” of temperature to degrees Celsius. 5. Change the “x – axis data” from “arc – length” to “x”. 6. Enter the following coordinates in the “Cross – section line data”: x0 = 0, x1 = 0.105; y0 = y1 = 0.06. 7. Click “Apply”.
- 242 -
Free Convection of Air Over a Heated Vertical Plate
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
ME433 COMSOL INSTRUCTTIONS
These steps produce a plot of T(x) at y = 6 cm, from x = 0 cm (plate surface) to x = 10.5 cm (ambient environment conditions). Temperature T is plotted on the y – axis and x – coordinates are plotted on the x – axis. To save this plot, 8. Click the save “ ” button in your figure with results. This will bring up an “Export Image” window. 9. Follow steps 2 – 4 as instructed on page 240 to finish with exporting the image.
Plotting Axial Velocity u(x, yo) at yo = 6 cm With “Cross – Section Plot Parameters” window open, ensure that you are under the “Line/Extrusion” tab, 10. Type “U_ns” in “Expression” field (without quotation marks).
11. Click “OK”. (Note: The unit will change automatically) These steps produce a plot of u(x) at y = 6 cm, from x = 0 cm (plate surface) to x = 10.5 cm (ambient environment conditions). Axial velocity u is plotted on the y – axis and x – coordinates are plotted on the x – axis. To save this plot, 12. Click the save “ ” button in your figure with results. This will bring up an “Export Image” window. 13. Follow steps 2 – 4 as instructed on page 240 to finish with exporting the image.
Plotting Surface Temperature Ts(y) on 0 y L To plot Ts(y) on 0 y L using COMSOL, 1. Select “Cross – Section Plot Parameters …” option from “Postprocessing” menu. 2. Switch to the “Line/Extrusion” tab. 3. From “Predefined quantities”, select “Temperature”. 4. Change the “Unit” of temperature to degrees Celsius. - 243 -
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
Free Convection of Air Over a Heated Vertical Plate
ME433 COMSOL INSTRUCTTIONS
5. Change the “x – axis data” from “x” to “y”. 6. Enter the following coordinates in the “Cross – section line data”: x0 = x1 = 0; y0 = 0.01, and y1 = 0.11. 7. Click “OK” to close Cross – Section Plot Parameters window.
As a result of these steps, a new plot will be shown that graphs Ts(y) on 0 y L . Do not close this plot just yet. We are going to extract this data to a text file for comparative analysis with MATLAB.
Exporting COMSOL Data to a Data File 1. Click on “Export Current Plot” button in the previous step.
in the Temperature – time graph created
2. Click “Browse” and navigate to your saving folder (say “Desktop”). 3. Name the file “ts.txt”. (Note: do not forget to type the “.txt” extension in the name of the file). 4. Click “OK” to save the file. This completes COMSOL modeling procedures for this problem. - 244 -
Free Convection of Air Over a Heated Vertical Plate
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
ME433 COMSOL INSTRUCTTIONS
Modeling with MATLAB
This part of modeling procedures describes how to create comparative graphs of plate surface temperature Ts(y) using MATLAB. Obtain MATLAB script file named “heated_vplate.m” from Blackboard prior to following these procedures. Save this file in the same directory as the data file(s) (ts.txt) from COMSOL. (Note: “heated_vplate.m” file is attached to the electronic version of this document as well. To access the file directly from this document, select “View Navigation Panels Attachements” and then save “heated_vplate.m” in a proper directory)
Comparing COMSOL Solution with Correlation Solution MATLAB script (heated_vplate.m) is programmed to re – plot exported COMSOL data for plate surface temperature Ts(y). The script is also programmed to calculate analytic plate surface temperature Ts(y) according to correlation 8.29a (even though one of its criteria is not strictly satisfied!) The script will ultimately produce comparative graphs that will plot both solutions. Follow the steps below to complete this problem: 1. Open MATLAB by double clicking its icon on the Desktop. 2. Load “heated_vplate.m” file by selecting “File Open Desktop heated_vplate.m”. The script responsible for COMSOL data import and data comparison will appear in a new window. 3. Press F5 key to run the script. MATLAB editor will display a warning message. Click “Change Directory” to run the script. COMSOL and correlation – based solutions will be plotted in Figure 1. Figure 2 plots the percent error between plate surface temperatures Ts(y) according to the equation printed on the figure. These results are shown below.
Results plotted with MATLAB:
- 245 -
Free Convection of Air Over a Heated Vertical Plate
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
ME433 COMSOL INSTRUCTTIONS
While in MATLAB, you may zoom into the left plot to notice departures in results based on the solution methods. Error analysis shows that most of the error is concentrated at the bottom edge of the plate. Correlation 8.29a suggests that at y = 0, plate surface temperature should reach ambient temperature T∞. COMSOL solution gives temperature of nearly 48 degrees Celsius at y = 0. In practice, what do you think is closer to the truth? The following 2 graphs show axial velocity and temperature at yo = 6 cm. These graphs were previously obtained in COMSOL. They have been repotted with MATLAB. The range for abscissa was reduced to about 1.6 cm and 2.5 cm for velocity and temperature graphs, respectively, so that region of activity near the plate can be better examined.
Armed with these results, you are in a position to answer most of the assigned questions.
- 246 -
Free Convection of Air Over a Heated Vertical Plate
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
ME433 COMSOL INSTRUCTTIONS
APPENDIX
MATLAB script If you could not obtain this script from the Blackboard or the PDF file, you may copy it here, then paste it into notepad and save it in the same directory where you saved COMSOL data file(s). You will most likely get hard – to – spot syntax errors if you copy the script this way. It is therefore highly advised that you use the other 2 methods on obtaining this script instead of the copying method. % ######################################################################### % ME 433 - Heat Transfer % Sample MATLAB Script For: % (X) Free Convection of Air over a Heated Vertical Plate % IMPORTANT: Save this file in the same directory with % "ts.txt" file. % ######################################################################### % %% Preliminaries clear % Clears variables from memory clc % Clears the UI prompt %% Constant Quantities Tinf = 20; % Ambient temperature, [degC] Tf = 90; % Film temperature, [degC] g = 9.81; % acc. due to gravity, [m/s^2] Cp = 1010.3; % at Tf rho = 0.9721; %% at Tf mu = 21.35e-6; % at Tf eta = 21.96e-6; % at Tf k = 0.03059; % at Tf Pr = 0.705; % at Tf alpha = eta/Pr; % at Tf beta = 1/(Tf + 273.15); % in Kelvin^(-1) qs = 1000; % Applied heat flux, [W/m^2] %% Temperature Data Import from COMSOL Multiphysics: load ts.txt; % Loads T(0,y) as a 2 column vector y = ts(:,1); % y - coords vector, [m] Ts = ts(:,2); % COMSOL plate surface temperature, [degC] y = y - min(y); % y - coord shift (necessary for correlation eq.!), [m] %% Correlation 8.29a Ta = Tinf + ... ((4+9*Pr^(1/2)+10*Pr)/Pr^2*(eta^2/(beta*g))*(qs/k)^4*y).^(1/5);%[degC] %% Error Analysis in h(y) errT = abs(Ts - Ta)./Ta*100; % Error in Ts, [%] %% y[m]-->y[cm] y = y*100; % y - coord [m]-->[cm] conversion, [cm] %% Plotter figure1 = figure('InvertHardcopy','off',... %\ 'Colormap',[1 1 1 ],... % | -> Setting up the figure 'Color',[1 1 1]); %/ plot(y,Ts,'k',y,Ta,'k--'); % Plotting grid on box off title('\fontname{Times New Roman} \fontsize{16} \bf Plate Surface Temperature T_s') xlabel('\fontname{Times New Roman} \fontsize{14} \it \bf y, [cm]') ylabel('\fontname{Times New Roman} \fontsize{14} \it \bf T_s , [\circC]') legend('COMSOL Solution','Correlation 8.29a','location','southeast') % % figure2 = figure('InvertHardcopy','off',... %\
- 247 -
Free Convection of Air Over a Heated Vertical Plate
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
ME433 COMSOL INSTRUCTTIONS
'Colormap',[1 1 1 ],... % | -> Setting up the figure 'Color',[1 1 1]); %/ plot(y,errT,'k'); % Plotting grid on box off title('\fontname{Times New Roman} \fontsize{16} \bf Error Analysis') xlabel('\fontname{Times New Roman} \fontsize{14} \it \bf y, [cm]') ylabel('\fontname{Times New Roman} \fontsize{14} \it \bf Error in T_s , [%]') str1(1) = {'$${\%err={T_{s_{comsol}}-T_{s_{8.29a}}\over T_{s_{8.29a}}}\times 100} $$'}; text('units','normalized', 'position',[.32 .9], ... 'fontsize',14,... 'FontName', 'Times New Roman',... 'FontAngle', 'italic', ... 'BackgroundColor',[1 1 1],... 'interpreter','latex',... 'string', str1); %% COMSOL u(x,y0) and T(x,y0) Re-plots % ######################################################################### % Unsuppress this portion only if you wich to re-plot COMSOL u(x,y0) and % T(x,y0). Prior to reploting, make sure to extract numerical data for % velocity and temperature to text files. You must name the files as: % "velfield.txt" and "tempfield.txt" for velocity and remperature fields, % respectively and place then in the same directory as this script. % ######################################################################### % load velfield.txt; % Loads u(x,y0) as a 2 column vector % load tempfield.txt; % Loads T(x,y0) as a 2 column vector % y1 = velfield(:,1)*100; % y - coords, [cm] % u1 = velfield(:,2); % u(x), [m/s] % t1 = tempfield(:,2); % T(x), [degC] % % figure3 = figure('InvertHardcopy','off',... %\ % 'Colormap',[1 1 1 ],... % | -> Setting up the figure % 'Color',[1 1 1]); %/ % plot(y1,u1,'k--'); % Plotting % grid on % box off % title('\fontname{Times New Roman} \fontsize{16} \bf Axial velocity u at y_o = 6 cm') % xlabel('\fontname{Times New Roman} \fontsize{14} \it \bf y, [cm]') % ylabel('\fontname{Times New Roman} \fontsize{14} \it \bf u (x, y_o) , [m/s]') % % figure4 = figure('InvertHardcopy','off',... %\ % 'Colormap',[1 1 1 ],... % | -> Setting up the figure % 'Color',[1 1 1]); %/ % plot(y1,t1,'k--'); % Plotting % grid on % box off % title('\fontname{Times New Roman} \fontsize{16} \bf Axial temperature T at y_o = 6 cm') % xlabel('\fontname{Times New Roman} \fontsize{14} \it \bf y, [cm]') % ylabel('\fontname{Times New Roman} \fontsize{14} \it \bf T (x, y_o) , [\circC]')
This completes MATLAB modeling procedures for this problem.
- 248 -
Free Convection of Air Over an Isothermal Cylinder
ME433 COMSOL INSTRUCTTIONS
FREE CONVECTION OF AIR OVER AN ISOTHERMAL CYLINDER Problem Statement
A solid horizontal cylinder 4 cm in diameter held at constant temperature Ts is brought to a room – temperature air environment. Surrounding air temperature T∞ is lower than plate surface temperature Ts. Due to temperature difference between air and the cylinder, the density of air near the cylinder starts to decrease. Due to the presence of earth’s gravitational acceleration field, air begins to rise near the surface of the cylinder forming convection currents. Of general interest is to learn how to use COMSOL to generate plots of velocity and temperature in free convection over a horizontal cylinder. Known quantities:
Free Convection over a Horizontal Cylinder Setup
Geometry: horizontal cylinder Fluid: Air
Ts = 100 ºC T∞ = 20 ºC D = 4 cm
Observations
This is a free convection, external flow problem. Considered geometry is a horizontal cylinder. The cylinder is held at constant temperature Ts.
Velocity and temperature fields are coupled in free convection. Therefore, a multiphysics model involving steady state Navier – Stokes and general heat transfer modes must be setup and coupled in COMSOL. Boussinesq approximation will be used to model air density changes induced by temperature field.
Subject to validation conditions, correlation equations from chapter 8 are applicable. For isothermal horizontal cylinders, local and average Nusselt numbers are the quantities sought.
The problem is symmetric about a vertical line that goes through the center of the cylinder. This fact will be utilized by solving the problem for half of the geometry.
- 249 -
Free Convection of Air Over an Isothermal Cylinder
ME433 COMSOL INSTRUCTTIONS
Assignment
1. Verify applicability of equation 8.35a for this problem. Calculate average heat transfer coefficient using this correlation. 2. Use COMSOL to determine and show 2D colormaps of velocity and temperature fields. Use arrows to represent velocity vector field. 3. Use COMSOL to plot 2D colormap of the density field. 4. Use COMSOL to plot vertical velocity u(xo, y) and temperature T(xo, y) on 0.055 y 0.16 at xo = 0 . 5. Use COMSOL to plot and extract numerical data for cylinder surface heat flux qs ro , on 90 90 . Use Newton’s law of cooling and extracted temperature data to determine COMSOL local surface heat transfer coefficient h(ro, θ). [Note: In this instruction set, part of this assignment question will be done with MATLAB, but you are free to use any software of your choice] 6. Use COMSOL to compute average heat transfer coefficient for the cylinder. Compare this value with analytical results from question 1. 7. [Extra Credit]:
- 250 -
Free Convection of Air Over an Isothermal Cylinder
ME433 COMSOL INSTRUCTTIONS
Modeling with COMSOL Multiphysics
This model analyzes free convection process outside a horizontal cylinder. The cylinder is held at a constant temperature Ts, which is higher than the surrounding temperature T∞. As the hot cylinder heats air near its surface, air starts rising due to changes in its density. This is called a “free convection” or “natural convection” process. When modeling this process, consider a rectangular subdomain that consists of air. The 4 cm diameter cylinder is located on the left vertical wall. This wall is a symmetry line. See the diagram in “Problem Statement” for this modeling geometry. The lift force responsible for natural convection process can be expressed in terms of local density change of air as fy = (ρ∞ – ρ)g. The term ρ∞ is the density far away from hot cylinder where the cylinder has no influence on the air, g is gravitational acceleration constant and ρ represents variable density. Boussinesq approximation can be used satisfactorily in this model to represent variable density field. We will compute ρ according to: ρ = ρ∞[1 – (T – T∞)/T∞] With these assumptions and approximations, we are now ready to begin the modeling procedure. MODEL NAVIGATOR
To start working on this problem, we first need to enable two application modes in the model navigator to create a Multiphysics model. The correct application modes are: (1) General Heat Transfer, and (2) Weakly Compressible Navier – Stokes. These modes will be responsible for setting up and calculating temperature and velocity distribution fields, respectively. For this setup: 1. Start “COMSOL Multiphysics”. 2. From the list of application modes, select “Heat Transfer Module General Heat Transfer Steady – state analysis”. 3. Click the “Multiphysics” button. 4. Click the “Add” button. 5. From the list of application modes, select “Heat Transfer Module Weakly Compressible Navier – Stokes Steady – state analysis”. 6. Click the “Add” button. 7. Click “OK”. - 251 -
Free Convection of Air Over an Isothermal Cylinder
ME433 COMSOL INSTRUCTTIONS
OPTIONS AND SETTINGS: DEFINING CONSTANTS
Continue by creating a small database of constants the model will use. 1. From the “Options” menu select “Constants”. 2. Define the following names and expressions: NAME
EXPRESSION
VALUE
DESCRIPTION
Tinf
273.15+20[K]
293.15[K]
Temperature Far Away
dT
10[K]
10[K]
rho0
1.2042[kg/m^3]
1.2042[kg/m ]
Air Density (20ºC)
mu_air
18.17e-6[kg/(s*m)]
(1.817e-5)[kg/(m·s)]
Air Dynamic Viscosity (20ºC)
k_air
0.02564[W/(m*degC)]
0.02564[W/(m·K)]
Air Conductivity (20ºC)
Cp_air
1006.1[J/(kg*degC)]
1006.1[J/(kg·K)]
Air Heat Capacity (20ºC)
g
9.81[m/s^2]
9.81[m/s ]
Temperature Step 3
2
Acc. Due to Gravity
3. Click “OK”. COMSOL automatically determines correct units under the “Value” column. If it does not, you are most likely entering wrong expressions. Carefully check the expression you typed and make corrections, if necessary. The description column is optional and can be left blank. It is presented here to give a short description of the constants.
- 252 -
Free Convection of Air Over an Isothermal Cylinder
ME433 COMSOL INSTRUCTTIONS
GEOMETRY MODELING
In this step, we will create a 2 – dimensional geometry that will be used as a model in our problem. According to problem statement, we will need to create a rectangle with a semi – circular cut on the left wall. The cut will represent half of the horizontal cylinder. The entire geometry must be positioned so that the origin coincides with the center of the cut. This composite geometry is made as follows, 1. In the “Draw” menu, select “Specify Objects Rectangle …” 2. Enter following rectangle dimensions for “R1”. R1 WIDTH
0.1
HEIGHT
0.215
BASE
Corner
X
0
Y
-0.055
3. Click “OK” to close “Rectangle” definition window. 4. Click on “Zoom Extents” button geometry.
in the main toolbar to zoom into the
5. In the “Draw” menu, select “Specify Objects Circle …” 6. In circle setup window, enter the radius of “0.02” and click “OK”. 7. Select “Draw Create Composite Object” option. 8. In the “Set formula” field, type “R1–C1” (w/o quotation marks) and click “OK”.
You should see your finished modeling geometry now in the main program window. The left wall should have a semi – circular cut. The composite geometry should also be positioned so that the origin coincides with the center of the cut, as shown here.
- 253 -
Free Convection of Air Over an Isothermal Cylinder
ME433 COMSOL INSTRUCTTIONS
PHYSICS SETTINGS
Physics settings in COMSOL consist of two parts: (1) Subdomain settings and (2) boundary conditions. The subdomain settings let us specify material properties, initial conditions, modes of heat transfer (i.e. conduction and/or convection). The boundary conditions settings are used to specify what is happening at the boundaries of the geometry. In this model, we will have to specify and couple physics settings for the flow of air and heat transfer. Let us begin by specifying Boussinesq approximation to model air density – temperature dependence. We use Boussinesq approximation to achieve this as follows: 1. In “Options” menu, select “Expressions Subdomain Expressions”. 2. Select subdomain 1 in the “Subdomain selection” section. 3. Type “rho” in the “Name” field and “rho0*(1-(T-Tinf)/Tinf)” in the expression field. NAME
EXPRESSION
UNIT
rho
rho0*(1-(T-Tinf)/Tinf)
[kg/m ]
3
4. Click “OK” to close “Subdomain Expressions” setup window. COMSOL automatically determines correct units under the “Unit” column. If it does not, you are most likely entering wrong expression. Carefully check the expression you typed and make corrections, if necessary. Let us now proceed with setup of subdomain and boundary settings for flow field and heat transfer.
Weakly Compressible Navier – Stokes Subdomain Settings 1. From the “Physics” menu select “Subdomain Settings” (equivalently, press F8). 2. Select subdomain 1 in the “Subdomain selection” section. 3. Type “rho” and “mu_air” in the fields for density ρ and dynamic viscosity η. 4. Type “g*(rho0-rho)” in the “Fy” field. 5. Click “OK”.
- 254 -
Free Convection of Air Over an Isothermal Cylinder
ME433 COMSOL INSTRUCTTIONS
Notice that the buoyant force Fy is set up in accordance with the condition described on page 251. This force setup (and density field variation) is responsible for driving the warm air up and making free convection possible. If the plate was in an environment where g ≈ 0, (such as inside the International Space Station), the air would not rise. Incidentally, this might be part of the reason why astronauts and cosmonauts do not have conventional cookware in space.
Weakly Compressible Navier – Stokes Boundary Settings 1. From the “Physics” menu open the “Boundary Settings” (F7) dialog box. 2. Apply the following boundary conditions: BOUNDARIES
BOUNDARY TYPE
BOUNDARY CONDITION
1, 6, 7
Wall
No Slip
2, 4, 5
Open boundary
Normal Stress
3
Symmetry boundary
COMMENTS Verify that field “f0” is set to “0”
3. Click “OK” to close the boundary settings window. The “no – slip” condition applied to boundaries 1, 6, and 7 assumes that velocity is zero at the wall of the cylinder. The short vertical boundary below the cylinder is set to “no – slip” condition for the reasons of successful convergence. Symmetry boundary signifies that an identical process takes place to the left outside the model space. The remaining boundaries have the “open” boundary condition, meaning that no forces act on the fluid. The “open” boundary condition defines the assumption that computational domain extends to infinity. - 255 -
Free Convection of Air Over an Isothermal Cylinder
ME433 COMSOL INSTRUCTTIONS
General Heat Transfer Subdomain Settings 1. From “Mulptiphysics” menu, select “1 General Heat Transfer (htgh)” mode. 2. From the “Physics” menu, select “Subdomain Settings” (F8). 3. Select “Subdomain 1” in the subdomain selection section. 4. Enter “k_air”, “rho” and “Cp_air” in the k, ρ, and Cp fields, respectively. 5. Switch to “Convection” tab and check “Enable convective heat transfer” option.
6. Type “u” and “v” in the u and v fields, respectively. 7. Click “OK” to close the Subdomain Settings window.
- 256 -
Free Convection of Air Over an Isothermal Cylinder
ME433 COMSOL INSTRUCTTIONS
General Heat Transfer Boundary Conditions: 1. From the “Physics” menu open the “Boundary Settings” (F7) dialog box. 2. Apply the following boundary conditions: BOUNDARY
BOUNDARY CONDITION
COMMENTS
1, 3
Insulation/Symmetry
2, 5
Temperature
Enter “Tinf” in T0 field
6, 7
Temperature
Enter “Tinf+dT” in T0 field
4
Convective flux
3. Click “OK” to close Boundary Settings window. The model keeps hot cylinder (boundaries 6, 7) at a constant temperature Ts (we will slowly raise temperature step dT with parametric solver to 80ºC so that solver is able to converge system of nonlinear equations. Note that when dT = 80ºC, temperature at the cylinder is 100ºC, as given in the problem statement). The short boundaries below and above the vertical plate (1 and 3) are thermally insulated so that no conduction or convection occurs normal to the boundaries. On the bottom and the right boundaries (2 and 5), the model sets temperature equal to room temperature T∞. Air rises upwards through the upper horizontal boundary (5). Application of “Convective Flux” boundary condition assumes that convection dominates the transport of heat at this boundary. MESH GENERATION
The following steps describe how to generate a mesh that properly resolves the velocity field near the cylinder and symmetry boundaries without using an overly dense mesh in the far field. 1. In the “Mesh” menu, select “Free Mesh Parameters” (F9). 2. Switch to “Boundary” tab 3. Select boundaries 1, 3, 6, and 7 in the boundary selection section while holding the “Control (ctrl)” key on your keyboard. 4. Enter “1e-3” in the “Maximum element size” edit field. 5. Switch to the “Point” tab.
- 257 -
Free Convection of Air Over an Isothermal Cylinder
ME433 COMSOL INSTRUCTTIONS
6. Select point 2. 7. Enter “2e-5” in the “Maximum element size” edit field. 8. Click “Remesh”. 9. Click “OK” to close “Free Mesh Parameters” window.
You should get the following triangular mesh: We are now ready to compute our solution.
- 258 -
Free Convection of Air Over an Isothermal Cylinder
ME433 COMSOL INSTRUCTTIONS
COMPUTING AND SAVING THE SOLUTION
In this step we define the type of analysis to be performed. We are interested in stationary analysis here, which we previously selected in the Model Navigator. However, the problem is highly non – linear. Several solver settings must be changed for successful convergence. To easily find an initial guess for the solution, start by solving the problem for a higher viscosity than the true value for air. Then decrease the viscosity until you reach the true value for air. Make the transition from the start value to the true value using the parametric solver in the following way: 1. In “Solve” menu, select “Solver Parameters” (F11). 2. Switch to “Parametric” solver. 3. Enter “mu_air” in the field for “Name of parameter”. 4. Enter “1e-4
1.817e-5”
in the “List of parameter values” edit field.
5. Switch to “Stationary” tab and enable “Highly nonlinear problem” check box.
6. Switch to “Advanced” tab and select “None” from the “Type of scaling” list.
- 259 -
Free Convection of Air Over an Isothermal Cylinder
ME433 COMSOL INSTRUCTTIONS
7. Click “OK” to close Solver Parameters window. 8. From the “Solve” menu select “Solve Problem”. (Allow few minutes for solution) This solution serves as the initial value for solving the model with higher plate temperatures, which you perform with these steps: 9. From the “Solve” menu select the “Solver Manager”. 10. Click “Store Solution” button
on the bottom of the window.
11. Select “1.817e-5” as the “Parameter value” for solution to store. 12. Click “OK”.
13. In the “Initial value” section click the “Stored solution” radio button.
14. Click “OK” to close the Solver Manager. 15. From the “Solve” menu choose “Solver Parameters” (F11). 16. Enter “dT” in the field for “Name of parameter”. 17. Enter “10:10:80” in the “List of parameter values” edit field.
18. Switch to “Stationary” tab. 19. Disable “Highly nonlinear problem” check box. 20. Click “OK” to close Solver parameters window.
- 260 -
Free Convection of Air Over an Isothermal Cylinder
ME433 COMSOL INSTRUCTTIONS
Now we can use the initial value solution to find solutions to higher surface temperatures. 21. From the “Solve” menu select the “Solver Manager”. (Allow few minutes for solution) 22. Save your work on desktop by choosing “File Save”. Name the file according to the naming convention given in the “Introduction to COMSOL Multiphysics” document. The result that you obtain should resemble the following surface color maps. By default, temperature field is shown for the case when cylinder surface temperature is 100ºC, as asked in problem statement.
By default, your immediate result will be given in Kelvin instead of degrees Celsius for temperature field. Furthermore, it will be colored using a “jet” colormap and the velocity field (represented by arrows in the above) will not be shown. We will use distinct colormap options to represent air velocity and temperature fields. The next section (Postprocessing and Visualization) will help you in determining and plotting quantities asked for in the assignment questions. We will then use MATALB to compute and plot local heat transfer coefficient h(ro, θ) from COMSOL surface heat flux data.
- 261 -
Free Convection of Air Over an Isothermal Cylinder
ME433 COMSOL INSTRUCTTIONS
POSTPROCESSING AND VISUALIZATION
After solving the problem, we would like to be able to look at the solution. COMSOL offers us a number of different ways to look at our temperature (and other) fields. In this problem we will deal with 2D color maps, velocity (and other) vector fields, and plotting and extracting numerical data for surface heat flux qs ro , . We will also use COMSOL to compute the average heat transfer coefficient for the cylinder. You will then use MATLAB and COMSOL data to determine and plot local surface heat transfer coefficient h(ro, θ).
Displaying T(x, y) and Vector Field V(x, y) Let us first change the unit of temperature to degrees Celsius: 1. From the “Postprocessing” menu, open “Plot Parameters” dialog box (F12). 2. Under the “Surface” tab, change the unit of temperature to degrees Celsius from the drop – down menu in the “Unit” field. 3. Change the “Colormap” type from “jet” to “hot”. 4. Click “Apply” to refresh main view and keep the “Plot Parameters” window open.
- 262 -
Free Convection of Air Over an Isothermal Cylinder
ME433 COMSOL INSTRUCTTIONS
The 2D temperature distribution will be displayed using the “hot” colormap type with degrees Celsius as the unit of temperature. Let’s now add the velocity vector field V(x,y). 5. Switch to the “Arrow” tab and enable the “Arrow plot” check box. 6. Choose “Velocity field” from “Predefined quantities”. 7. Enter “20” in the “Number of points” for both “x” and “y” fields. 8. Press the “Color” button and select a color you want the arrows to be displayed in. (Note: choose a color that produces good contrast. Green is a good choice here.) 9. Click “Apply” to refresh main view and keep the “Plot Parameters” window open.
At this point, you will see a similar plot as shown on page 261. It is a good idea to save this colormap for future use. Before you do save it, however, experiment with the “Number of points” field in “Plot Parameters” window and adjust the velocity vector field to what seems the best view to you. Put “40” for the “x” field and update your view by pressing “Apply” button. Notice the difference in velocity vector field representation. Try other values. - 263 -
Free Convection of Air Over an Isothermal Cylinder
ME433 COMSOL INSTRUCTTIONS
You may also want to see other quantities as vector fields. Available quantities are: (1) Temperature gradient, (2) Conductive heat flux, (3) Convective heat flux, and (4) Total heat flux. To see these quantities represented by a vector field: 10. Choose the quantity you wish to plot from “Predefined quantities”. 11. Click “Apply”. 12. Click “OK” when you are done displaying these quantities to close the “Plot Parameters” window.
Saving Color Maps After you have selected a view that shows the results clearly, you may want to save it as an image for future discussion. This may be done as follows: 1. Go to the “File” menu and select “Export Image”. This will bring up an “Export Image” window. For a 4” by 6” image, acceptable image quality settings are given in the figure below. If you need higher image quality, increase the DPI value.
2. Change your “Export Image” value settings to the ones in the above figure. 3. Click the “Export” button. 4. Name and save the image.
- 264 -
Free Convection of Air Over an Isothermal Cylinder
ME433 COMSOL INSTRUCTTIONS
Displaying Velocity as a Colormap 1. From the “Postprocessing” menu, open “Plot Parameters” dialog box (F12). 2. Under the “Arrow” tab, disable the “Arrow plot” checkbox. 3. Switch to “Surface” tab.
4. From “Predefined quantities”, select “Velocity field”. 5. Change the “Colormap” type from “hot” to “jet”. 6. Click “Apply” to refresh main view and keep the “Plot Parameters” window open. The 2D Velocity distribution will be displayed using the “jet” colormap.
Displaying Air Density Field Colormap With the “Plot Parameters” window open, ensure that you are under the “Surface” tab, 7. Type “rho” in “Expression” field (without quotation marks).
8. Click “Apply”. (Note: The unit will change automatically) These steps produce a colormap that displays variations in air’s density ρ. Note the values on the color scale and compare them with Appendix C of your textbook. - 265 -
Free Convection of Air Over an Isothermal Cylinder
ME433 COMSOL INSTRUCTTIONS
Plotting u(xo, y) and T(xo, y) on 0.055 y 0.16 at xo = 0 Let us plot vertical temperature T(xo, y) development first, 1. From “Postprocessing” menu select “Cross – Section Plot Parameters” option. 2. Under “General” tab, select “80” as the only “Solution to use” option.
3. Switch to the “Line/Extrusion” tab. 4. Change the “Unit” of temperature to degrees Celsius. 5. Change the “x – axis data” from “Arc – length” to “y”. 6. Enter the following coordinates in the “Cross – section line data”: x0 = x1 =0; y0 = –0.055, and y1 = 0.16. 7. Click “Apply”.
- 266 -
Free Convection of Air Over an Isothermal Cylinder
ME433 COMSOL INSTRUCTTIONS
These steps produce a plot of T(y) at xo = 0, from y = –0.055 m (ambient air below the cylinder) to y = 0.16 m (upper edge of modeling space, developing convection current). Temperature T is plotted on the y – axis and y – coordinates are plotted on the x – axis. To save this plot, 8. Click the save “ ” button in your figure with results. This will bring up an “Export Image” window. 9. Follow steps 2 – 4 as instructed on page 264 to finish with exporting the image. Alternatively, you may save this data to a text file if you wish to re – plot this figure with other software (such as MATLAB). Data from this plot can be saved as follows.
Exporting COMSOL Data to a Data File 1. Click on “Export Current Plot” button previous steps.
in the Temperature plot created in the
2. Click “Browse” and navigate to your saving folder (say “Desktop”). 3. Name the file “t0.txt”. (Note: do not forget to type the “.txt” extension in the name of the file). 4. Click “OK” to save the file. To plot vertical velocity u(xo, y) development, 5. Type “U_chns” in the “Expression” field. 6. Click “OK” to plot velocity and close the “Cross – Section Plot Parameters” window. These steps produce a plot of u(y) at xo = 0, from y = –0.055 m to y = 0.16 m. Velocity is plotted on the y – axis and y – coordinates are plotted on the x – axis. Save the plot as an image and/or export the velocity data to a text file for MATLAB re – plot. If you choose to save the data, name the file “u0.txt”.
- 267 -
Free Convection of Air Over an Isothermal Cylinder
ME433 COMSOL INSTRUCTTIONS
Plotting Local Surface Heat Flux qs ro , On 90 90 To plot qs ro , for 90 90 using COMSOL, 1. Select “Domain Plot Parameters …” option from “Postprocessing” menu. 2. Under “General” tab, select “80” as the only “Solution to use” option. 3. Switch to the “Line/Extrusion” tab. 4. From “Predefined quantities”, select “Normal total heat flux”. 5. Change the “x – axis data” from “Arc – length” to “y”. 6. Select boundaries 6 and 7 in the boundary selection section while holding the “Control (ctrl)” key on your keyboard. 7. Click “OK”.
As a result of these steps, a new plot will be shown that graphs qs ro , for 90 90 . Notice that the x – axis plots y – coordinates for semicircle (not the values of θ, as desired). We will use MATBAL to convert from y – coordinates to degrees. Do not close this plot just yet. Export the data to a text file as instructed on page 267. Be sure to name this file “flux.txt”.
- 268 -
Free Convection of Air Over an Isothermal Cylinder
ME433 COMSOL INSTRUCTTIONS
Computing Average Surface Heat Transfer Coefficient To compute the average heat transfer coefficient with COMSOL, 1. From the “Postprocessing” menu, open “Boundary Integration” option. 2. Select boundaries 6 and 7 in the boundary selection section while holding the “Control (ctrl)” key on your keyboard. 3. Type “-ntflux_htgh/((T-Tinf)*pi*0.02[m])”, in the “Expression” field. 4. Click “OK”. The value of the integral (solution) is displayed at program’s prompt on the bottom. Average surface heat transfer coefficient determined in this way should be about 7.1 W/m2–ºC.
This completes COMSOL modeling procedures for this problem.
- 269 -
Free Convection of Air Over an Isothermal Cylinder
ME433 COMSOL INSTRUCTTIONS
Modeling with MATLAB This part of modeling procedures describes how to create graphs of local surface heat transfer coefficient h(ro, θ) using MATLAB. Obtain MATLAB script file named “isothermal_hcyl.m” from Blackboard prior to following these procedures. Save this file in the same directory as the data file(s) ("t0.txt", "u0.txt", and "flux.txt") from COMSOL. (Note: “isothermal_hcyl.m” file is attached to the electronic version of this document as well. To access the file directly from this document, select “View Navigation Panels Attachements” and then save “isothermal_hcyl.m” in a proper directory)
Computing and Plotting COMSOL Local Surface Heat Transfer Coefficient MATLAB script (isothermal_hcyl.m) is programmed to use exported COMSOL data for heat flux qs ro , and Newton’s Law of cooling to determine the local heat transfer coefficient h ro , along the surface of the cylinder. The script is also programmed to calculate experimental average heat transfer coefficient h according to correlation 8.35a. Follow the steps below to complete this problem: 1. Open MATLAB by double clicking its icon on the Desktop. 2. Load “isothermal_hcyl.m” file by selecting “File Open Desktop isothermal_hcyl.m”. The script responsible for COMSOL data import and data computation will appear in a new window. 3. Press F5 key to run the script. MATLAB editor will display a warning message. Click “Change Directory” to run the script. COMSOL h ro , will be plotted in Figure 1. Average h will be displayed in MATLAB’s main window. If you chose to unsuppress the bottom portion of the script, you will get 2 additional figures plotting vertical velocity and temperature development. These results are shown below.
Results plotted with MATLAB:
- 270 -
Free Convection of Air Over an Isothermal Cylinder
ME433 COMSOL INSTRUCTTIONS
Notice that y – coordinate of the modeling space is plotted on abscissa in the above graphs. The cylinder is centered at y = 0. This is the reason why there is no data in the region 0.02 y 0.02 (we know the results in this region a priori). Velocity development graph shows that velocity is zero everywhere below the cylinder. This is the result of “no – slip” condition we applied for convergence reasons. Do you think that below the hot cylinder, velocity should be zero everywhere, as shown in the above plot? The figure below shows the plot of COMSOL local surface heat transfer coefficient h ro , on 90 90 .
Armed with these results, you are in a position to answer most of the assigned questions.
- 271 -
Free Convection of Air Over an Isothermal Cylinder
ME433 COMSOL INSTRUCTTIONS
APPENDIX
MATLAB script If you could not obtain this script from the Blackboard or the PDF file, you may copy it here, then paste it into notepad and save it in the same directory where you saved COMSOL data file(s). You will most likely get hard – to – spot syntax errors if you copy the script this way. It is therefore highly advised that you use the other 2 methods on obtaining this script instead of the copying method. % ######################################################################### % ME 433 - Heat Transfer % Sample MATLAB Script For: % (X) Free Convection of Air over an Isothermal Horizontal Cylinder % IMPORTANT: Save this file in the same directory with % "flux.txt" file. % ######################################################################### % %% Preliminaries clear % Clears variables from memory clc % Clears the UI prompt %% Constant Quantities r0 = 0.04/2; % Cylinder radius, [m] Tinf = 20; % Ambient temperature, [degC] Ts = 100; % Clyinder surface temperature, [degC] Tf = 0.5*(Ts - Tinf); % Film temperature, [degC] g = 9.81; % acc. due to gravity, [m/s^2] Cp = 1008.0; % at Tf rho = 1.0596; %% at Tf mu = 20.03e-6; % at Tf eta = 18.90e-6; % at Tf k = 0.02852; % at Tf Pr = 0.708; % at Tf alpha = eta/Pr; % at Tf beta = 1/(Tf + 273.15); % in Kelvin^(-1) %% Heat Flux Data Import from COMSOL Multiphysics: load flux.txt; % Loads q"(0,y) as a 2 column vector y = flux(:,1); % y - coords vector, [m] q = (-1)*flux(:,2); % flux, [W/m^2] h = q./(Ts - Tinf); % theta1 = asin(y./r0)*180/pi; % [y - coords]-->[degrees, theta] %% Correlation Equation For Average Nusselt Number RaD = beta*g*(Ts - Tinf)*(2*r0)^3/(eta*alpha); NuD = (0.6 + 0.387*RaD^(1/6)/(1 + (0.559/Pr)^(9/16))^(8/27))^2; h_ave = NuD*k/(2*r0); disp('Average h [W/m2-C] according to eq. 8.35a = '); disp(h_ave) %% Plotter 1 figure1 = figure('InvertHardcopy','off',... %\ 'Colormap',[1 1 1 ],... % | -> Setting up the figure 'Color',[1 1 1]); %/ plot(theta1,h,'MarkerSize',2,'Marker','*','LineStyle','none','Color',[0 0 0]);% Plotting grid on box off %xlim([-90 90]); title('\fontname{Times New Roman} \fontsize{16} \bf Surface Heat Transfer Coefficient') xlabel('\fontname{Times New Roman} \fontsize{14} \it \bf \theta, [ \circ ]') ylabel('\fontname{Times New Roman} \fontsize{14} \it \bf h (r_o ,\theta ) , [W/m^2\circC]') %% COMSOL u(x,y0) and T(x,y0) Re-plots % #########################################################################
- 272 -
Free Convection of Air Over an Isothermal Cylinder
% % % % % %
ME433 COMSOL INSTRUCTTIONS
Unsuppress this portion only if you wich to re-plot COMSOL u(x0,y) and T(x0,y). Prior to reploting, make sure to extract numerical data for velocity and temperature to text files. You must name the files as: "u0.txt" and "t0.txt" for velocity and temperature fields, respectively and place then in the same directory as this script. #########################################################################
% load u0.txt; % Loads u(x0,y) as a 2 column vector % load t0.txt; % Loads T(x0,y) as a 2 column vector % y1 = u0(:,1); % y - coords, [m] % u1 = u0(:,2); % u(y), [m/s] % t1 = t0(:,2); % T(y), [degC] % % % clear flux u0 t0 % Variable clean up % % %% Plotter 2 % figure2 = figure('InvertHardcopy','off',... %\ % 'Colormap',[1 1 1 ],... % | -> Setting up the figure % 'Color',[1 1 1]); %/ % plot(y1,u1,'k.'); % Plotting % grid on % box off % xlim([-0.055 0.16]) % title('\fontname{Times New Roman} \fontsize{16} \bf Velocity Development') % xlabel('\fontname{Times New Roman} \fontsize{14} \it \bf y - coordinate, [m]') % ylabel('\fontname{Times New Roman} \fontsize{14} \it \bf u (x_o, y) at x_o = 0 , [m/s]') % % figure3 = figure('InvertHardcopy','off',... %\ % 'Colormap',[1 1 1 ],... % | -> Setting up the figure % 'Color',[1 1 1]); %/ % plot(y1,t1,'k.'); % Plotting % grid on % box off % xlim([-0.055 0.16]) % title('\fontname{Times New Roman} \fontsize{16} \bf Temperature Development') % xlabel('\fontname{Times New Roman} \fontsize{14} \it \bf y - coordinate, [m]') % ylabel('\fontname{Times New Roman} \fontsize{14} \it \bf T (x_o, y) at x_o = 0, [\circC]') %
This completes MATLAB modeling procedures for this problem.
- 273 -
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
Radiation In a Triangular Cavity
ME433 COMSOL INSTRUCTTIONS
RADIATION IN A TRIANGULAR CAVITY Problem Statement Three rectangular plates with lengths of 3, 4, and 5 meters form a triangular cavity. The plates have a width of 1 meter and are made out of copper. The vertical and inclined plates are subjected to heat fluxes q2 and q3 on their outer boundaries, respectively. Horizontal plate is subjected to ambient temperature T∞ on its outer boundary. The three inner boundaries that form the cavity can exchange heat only by means of surface – to – surface radiation. All other outer boundaries are kept insulated. The plates themselves, however, transfer heat internally by conduction. Of general interest is to learn how to use COMSOL to model radiation heat transfer and determine the steady state of the cavity’s interior boundaries. Specifically, knowing the value of the heat flux on the inclined and vertical boundaries, the sought quantity is the temperature along these boundaries. Conversely, knowing the temperature of the bottom boundary of the horizontal plate, the sought quantity is the heat flux that leaves through it. Radiation Cavity Setup Known quantities: Material: copper q2 2000 W/m 2 q3 1000 W/m 2
L = 3, 4, 5 m (as shown) W=1m
T 300 K
1 0.4 2 0.6 3 0.8 Observations
This is a radiation and a conduction problem. Conduction takes place inside the plates. Surface – to – surface radiation occurs at the inner boundaries of the triangular cavity. Conditions at the outer boundaries are specified by heat fluxes, ambient temperature, and thermal insulation.
The problem can be tackled analytically by omitting conduction and considering a 3 – 4 – 5 triangle that forms the cavity. Same heat flux boundary conditions apply. Because of radiation effects, temperature condition on the bottom plate should be set somewhat higher than ambient temperature. COMSOL solution can be used first to obtain this temperature.
A 2 – dimensional model setup is appropriate to solve this problem in COMSOL. In COMSOL, the inner corners of the plates must be offset to ensure that the plates do not touch. This prevents heat being exchanged between the plates by conduction.
- 275 -
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
Radiation In a Triangular Cavity
ME433 COMSOL INSTRUCTTIONS
Assignment 1. Use COMSOL to determine temperature distribution in the plates. Show a 2D temperature colormap of the entire cavity in one plot. 2. Use COMSOL to show 2D temperature distributions for individual plates on separate plots. 3. Use COMSOL to plot temperature distribution along the inner boundaries of all plates. Based on these results, can you conclude that surface temperature is uniform? 4. Use COMSOL to plot radiosity along the inner boundary of the inclined plate. 5. Use COMSOL to determine total heat per unit length q1 through horizontal plate. 6. Use COMSOL to determine average temperature of the inner boundaries of inclined and vertical plates. 7. [Extra Credit]: Verify COMSOL results you obtained in questions 4 and 6 analytically.
- 276 -
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
Radiation In a Triangular Cavity
ME433 COMSOL INSTRUCTTIONS
Modeling with COMSOL Multiphysics MODEL NAVIGATOR
This is our starting point in the model where you define the very basics of the problem, such as the number of dimensions, type of coordinate system, and most importantly, the application mode which agrees with the physical phenomena of the problem. General heat transfer mode can handle conduction, convection, and radiation heat transfer. We will use it in setting up our conduction and radiation heat transfer model. For this setup: 1. Start “COMSOL Multiphysics”. 2. In the “Space dimension” list select 2D (under the “New” Tab). 3. From the list of application modes select “Heat Transfer Module General Heat Transfer Steady – State Analysis” 4. Click “OK”.
- 277 -
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
Radiation In a Triangular Cavity
ME433 COMSOL INSTRUCTTIONS
GEOMETRY MODELING
In this step, we will create a 2 – dimensional geometry that will be used as a model in our problem. According to problem statement, we will need to create 3 rectangles that form a cavity. To ensure that their corners do not touch, we will offset the rectangles by a very small amount to prevent them from exchanging heat by conduction. This is done as follows. 1. In the “Draw” menu, select “Specify Objects Rectangle”. 2. Start by entering information for “RECTANGLE 1” from the following table. RECTANGLE 1
RECTANGLE 2
RECTANGLE 3
WIDTH
4
1
5
HEIGHT
1
3
1
ROTATION ANGLE α
0
0
180/pi*atan(3/4)
X
0
4.001
-0.001
Y
-1.001
0
0.001
3. When done with step 2, click “OK” and repeat steps 1 to 3 for the other 2 rectangles. 4. Click on “Zoom Extents” button geometry.
in the main toolbar to zoom into the
You should see your completed geometry in the main program window. Try to investigate the geometry you just made. In particular, try to explore what the “Geometric as you select parts of the geometry. See how the function of Properties” button does: . this button changes as you switch the program mode with these buttons:
- 278 -
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
Radiation In a Triangular Cavity
ME433 COMSOL INSTRUCTTIONS
PHYSICS SETTINGS
Physics settings in COMSOL consist of two parts: (1) Subdomain settings and (2) boundary conditions. The subdomain settings let us specify material types, initial conditions and modes of heat transfer (i.e. conduction, convection and/or radiation). The boundary conditions settings are used to specify what is happening at the boundaries of the geometry.
General Heat Transfer Subdomain Settings By default, COMSOL Multiphysics is set to use thermal properties of copper. Since our problem involves plates that are also made out of copper, we simply need to verify and make slight adjustments to default subdomain settings. 1. From the “Physics” menu, select “Subdomain Settings” (equivalently, press F8). 2. Hold the “Shift” key on your keyboard and select subdomains 1, 2, and 3. 3. Enter “402” in the field for thermal conductivity k. 4. Click “OK” to close the subdomain settings window.
- 279 -
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
Radiation In a Triangular Cavity
ME433 COMSOL INSTRUCTTIONS
General Heat Transfer Boundary Settings 1. From the “Physics” menu open the “Boundary Settings” (F7) dialog box. 2. Apply the following boundary conditions: BOUNDARY
BOUNDARY CONDITION
RADIATION TYPE
COMMENTS
2
Heat Flux
-
Enter “1000” in q0 field
12
Heat Flux
-
Enter “2000” in q0 field
5
Temperature
-
Enter “300” in T0 field
3
Heat Flux
Surface – to – surface
6
Heat Flux
Surface – to – surface
9
Heat Flux
Surface – to – surface
1, 4, 7, 8, 10, 11
Insulation/Symmetry
-
Enter “0.8” in ε field Enter “300” in Tamb field Enter “0.4” in ε field Enter “300” in Tamb field Enter “0.6” in ε field Enter “300” in Tamb field
3. Click “OK” to close the boundary settings window. MESH GENERATION
To minimize the computational time without compromising much accuracy of the solution, we must change the default meshing parameters. To do this, 1. Go to the “Mesh” menu and select “Free Mesh Parameters …” option. 2. Switch to “Boundary” tab. 3. Select boundaries 3, 6, and 9 in the boundary selection section while holding the “Control (ctrl)” key on your keyboard. 4. Enter “5e-2” in the “Maximum element size” edit field. 5. Switch to the “Point” tab.
- 280 -
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
Radiation In a Triangular Cavity
ME433 COMSOL INSTRUCTTIONS
6. Select points 2, 4, 6, 8, 9 and 10 in the point selection section while holding the “Control (ctrl)” key on your keyboard. 7. Enter “1e-2” in the “Maximum element size” edit field. 8. Click “Remesh”. 9. Click “OK” to close “Free Mesh Parameters” window.
You should get the following triangular mesh:
We are now ready to compute our solution.
- 281 -
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
Radiation In a Triangular Cavity
ME433 COMSOL INSTRUCTTIONS
COMPUTING AND SAVING THE SOLUTION
In this step we define the type of analysis to be performed. We are interested in stationary analysis here, which we previously selected in the Model Navigator. Therefore, no modifications need to be made. To enable the solver, proceed with the following steps: 1. From the “Solve” menu select “Solve Problem”. (Allow few seconds for solution) 2. Save your work on desktop by choosing “File Save”. Name the file according to the naming convention given in the “Introduction to COMSOL Multiphysics” document. The result that you obtain should resemble the following surface color map:
By default, your immediate result will be given in Kelvin. It is convenient in radiation problems to keep temperature field in absolute scale. The next section (Postprocessing and Visualization) will help you in determining and plotting quantities asked for in the assignment questions.
- 282 -
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
Radiation In a Triangular Cavity
ME433 COMSOL INSTRUCTTIONS
POSTPROCESSING AND VISUALIZATION
After solving the problem, we would like to be able to look at the solution. The default temperature view already answers the first assigned question and may thus be saved as an image. Further, we need to produce the following plots: temperature colormaps of individual plates, temperature distribution along inner boundaries of the plates, and radiosity along the inner boundary of the inclined plate. Finally, we will use COMSOL to compute heat per unit length q that goes through horizontal plate and average temperatures of the inner boundaries of vertical and inclines plates.
Displaying T(x, y) for Individual Plates 1. From the “Postprocessing” menu, select “Domain Plot Parameters …” (F12). 2. Switch to “Surface” tab. 3. Select subdomain 1. This subdomain corresponds to the inclined plate. 4. Click “Apply”.
The 2D temperature distribution for the inclined plate will be displayed in a new window. To plot temperature distribution for the other 2 plates, repeat the above steps and select subdomains 2 and 3 in step 3. Subdomains 2 and 3 correspond to horizontal and vertical plates, respectively. Do not close “Domain Plot Parameters” window yet. We will need it to create temperature distribution along the inner boundaries of the plates.
- 283 -
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
Radiation In a Triangular Cavity
ME433 COMSOL INSTRUCTTIONS
Saving Color Maps As you create temperature distribution colormaps for individual plates, you may want to save the results as an image for future discussion. This may be done as follows: 1. Click the save “ ” button in your figure with results. This will bring up an “Export Image” window. For a 4” by 6” image, acceptable image quality settings are given in the figure below. If you need higher image quality, increase the DPI value.
2. Change your “Export Image” value settings to the ones in the above figure. 3. Click the “Export” button. 4. Name and save the image.
Plotting Temperature Distribution along the Inner Boundaries of the Plates With “Domain Plot Parameters” window open, 1. Switch to “Line/Extrusion” tab. 2. From “Predefined quantities”, select “Temperature”.
- 284 -
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
Radiation In a Triangular Cavity
ME433 COMSOL INSTRUCTTIONS
3. Select boundary 3. This boundary number corresponds to the inner boundary of the inclined plate. 4. Click “Apply”.
Temperature distribution along the inner boundary of the inclined plate will be plotted in a new window. It is a good idea to save this plot as an image for future discussion. Alternatively, you may save this data to a text file if you wish to re – plot this figure with other software (such as MATLAB). Data from this plot can be saved as follows.
Exporting COMSOL Data to a Data File: 5. Click on “Export Current Plot” button previous steps.
in the Temperature plot created in the
6. Click “Browse” and navigate to your saving folder (say “Desktop”). 7. Name the files “t_incl.txt”. (Note: do not forget to type the “.txt” extension in the name of the file). 8. Click “OK” to save the file. To view temperature distribution plots of inner boundaries for horizontal and vertical plates, redo steps 1 – 4 above. In step 3, select boundaries 6, then 9 for horizontal and vertical plates, respectively. (Note: if you chose to export data for these plots as well, name them “t_horz.txt”, and “t_vert.txt”, for horizontal and vertical plates, respectively. Save the data in the same manner as instructed in steps 5 – 8 above). - 285 -
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
Radiation In a Triangular Cavity
ME433 COMSOL INSTRUCTTIONS
Plotting Radiosity along the Inner Surface of Inclined Plate With “Domain Plot Parameters” window open, 1. From “Predefined quantities”, select “Surface radiosity expression”. 2. Select boundary 3. 3. Click “OK” Surface radiosity along the inner boundary of the inclined plate will be plotted in a new window. Save the figure as an image for future discussion or export radiosity data to a text file. If you choose to export data to a text file, name it “rad_incl.txt”. You will need to re – plot it later with another program (such as MATLAB).
Computing Total Heat per Unit Length q1 through Horizontal Plate To compute heat transfer rate per unit length using COMSOL, 1. Select “Boundary Integration …” option from “Postprocessing” menu. 2. Select boundary 6 in the “Boundary selection” field. 3. Change “Predefined Quantities” setting to “Normal conductive heat flux”. 4. Click “Apply”.
The value of the integral (solution) is displayed at program’s prompt on the bottom. For this model, q1 = – 10,966 W/m.
- 286 -
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
Radiation In a Triangular Cavity
ME433 COMSOL INSTRUCTTIONS
Computing Average (Mean) Surface Temperature In previous steps, you have seen that temperature varies at the boundaries of the plates. The variations, however, are only a few degrees in range. We can therefore compute the mean and assume a uniform temperature (given by the mean) at the surfaces. To compute the average surface temperature using COMSOL, with “Domain Plot Parameters” window open, 1. Select boundary 9 in the “Boundary selection” field. This corresponds to the inner boundary of the vertical plate. 2. Enter “T/3” in the “Expression” field. (Note: Division by 3 meters corresponds to boundary length). 3. Click “Apply”. The value of the integral (average temperature) is displayed at program’s prompt on the bottom. For this boundary, the average temperature should be close to 645 K. (Note: ignore the units in which COMSOL displays the solution. The numerical value of solution is correct, and the units are in absolute degrees or Kelvin). In the same manner, determine average temperature for the inclined surface. 4. Select boundary 3 in the “Boundary selection” field. This corresponds to the inner boundary of the inclined plate. 5. Enter “T/5” in the “Expression” field. (Note: Division by 5 meters corresponds to boundary length). 6. Click “OK”. The value of the integral (average temperature) is displayed at program’s prompt on the bottom. For this boundary, the average temperature should be close to 601 K. The mean temperature for the inner boundary of the horizontal plate is close to 307 K. This value can be used to solve problem analytically and verify COMSOL results. This completes COMSOL modeling procedures for this problem.
- 287 -
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
Radiation In a Triangular Cavity
ME433 COMSOL INSTRUCTTIONS
Modeling with MATLAB This part of modeling procedures describes how to re – plot temperature distribution along inner boundaries of the plates, and radiosity along the inner boundary of the inclined plate using MATLAB. Obtain MATLAB script file named “rad_cavity.m” from Blackboard prior to following these procedures. Save this file in the same directory as the data file(s) ("t_horz.txt", "t_vert.txt", "t_incl.txt", and "rad_incl.txt") from COMSOL. (Note: “rad_cavity.m” file is attached to the electronic version of this document as well. To access the file directly from this document, select “View Navigation Panels Attachements” and then save “rad_cavity.m” in a proper directory)
Re – Plotting COMSOL Solution in MATLAB MATLAB script (rad_cavity.m) is programmed to use exported COMSOL temperature and radiosity data to simply re – plot it. Follow the steps below to complete this problem: 1. Open MATLAB by double clicking its icon on the Desktop. 2. Load “rad_cavity.m” file by selecting “File Open Desktop rad_cavity.m”. The script responsible for COMSOL data import and data comparison will appear in a new window. 3. Press F5 key to run the script. MATLAB editor will display a warning message. Click “Change Directory” to run the script. COMSOL plate surface temperature will be plotted in figures 1, 2, and 3. Figure 4 plots radiosity for the inclined plate. These results are shown below.
Results plotted with MATLAB:
- 288 -
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
Radiation In a Triangular Cavity
ME433 COMSOL INSTRUCTTIONS
Armed with these results, you are in a position to answer most of the assigned questions.
- 289 -
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
Radiation In a Triangular Cavity
ME433 COMSOL INSTRUCTTIONS
APPENDIX
MATLAB script If you could not obtain this script from the Blackboard or the PDF file, you may copy it here, then paste it into notepad and save it in the same directory where you saved COMSOL data file(s). You will most likely get hard – to – spot syntax errors if you copy the script this way. It is therefore highly advised that you use the other 2 methods on obtaining this script instead of the copying method. % ######################################################################### % ME 433 - Heat Transfer % Sample MATLAB Script For: % (X) Radiation in a Triangular Cavity % IMPORTANT: Save this file in the same directory with the following files: % "t_horz.txt", "t_vert.txt", "t_incl.txt", and "rad_incl.txt". % ######################################################################### % %% Preliminaries clear % Clears variables from memory clc % Clears the UI prompt %% Temperature/Radiosity Data Import from COMSOL Multiphysics: load t_horz.txt; % Loads temperature data along horizontal plate load t_vert.txt; % Loads temperature data along vertical plate load t_incl.txt; % Loads temperature data along inclined plate xh = t_horz(:,1); % Horizontal plate arc-length vector, [m] xv = t_vert(:,1); % Vertical plate arc-length vector, [m] xi = t_incl(:,1); % Inclined plate arc-length vector, [m] th = t_horz(:,2); % Horizontal plate temperature, [K] tv = t_vert(:,2); % Vertical plate temperature, [K] ti = t_incl(:,2); % Inlcined plate temperature, [K] % Radiosity load rad_incl.txt; % Loads radiosity data along inclined plate xr = rad_incl(:,1); % Inclined plate arc-length vector, [m] yr = rad_incl(:,2); % Inlcined plate radiosity, [W/m^2] % clear t_horz t_vert t_incl rad_incl; % Variable clean up;
%% Plotter figure1 = figure('InvertHardcopy','off',... %\ 'Colormap',[1 1 1 ],... % | -> Setting up the figure 'Color',[1 1 1]); %/ plot(xh,th,'k.'); % Plotting grid on box off title('\fontname{Times New Roman} \fontsize{16} \bf Horizontal Plate Surface Temperature') xlabel('\fontname{Times New Roman} \fontsize{14} \it \bf Plate Arc - Length, [m]') ylabel('\fontname{Times New Roman} \fontsize{14} \it \bf T_s , [K]') % figure2 = figure('InvertHardcopy','off',... %\ 'Colormap',[1 1 1 ],... % | -> Setting up the figure 'Color',[1 1 1]); %/ plot(xv,tv,'k.'); % Plotting grid on box off title('\fontname{Times New Roman} \fontsize{16} \bf Vertical Plate Surface Temperature') xlabel('\fontname{Times New Roman} \fontsize{14} \it \bf Plate Arc - Length, [m]') ylabel('\fontname{Times New Roman} \fontsize{14} \it \bf T_s , [K]') % figure3 = figure('InvertHardcopy','off',... %\ 'Colormap',[1 1 1 ],... % | -> Setting up the figure 'Color',[1 1 1]); %/ plot(xi,ti,'k.'); % Plotting
- 290 -
ADOPTED FROM COMSOL HEAT TRANSFER MODULE USER GUIDE
Radiation In a Triangular Cavity
ME433 COMSOL INSTRUCTTIONS
grid on box off title('\fontname{Times New Roman} \fontsize{16} \bf Inclined Plate Surface Temperature') xlabel('\fontname{Times New Roman} \fontsize{14} \it \bf Plate Arc - Length, [m]') ylabel('\fontname{Times New Roman} \fontsize{14} \it \bf T_s , [K]') % figure4 = figure('InvertHardcopy','off',... %\ 'Colormap',[1 1 1 ],... % | -> Setting up the figure 'Color',[1 1 1]); %/ plot(xr,yr,'k.'); % Plotting grid on box off title('\fontname{Times New Roman} \fontsize{16} \bf Surface Radiosity of Inclined Plate') xlabel('\fontname{Times New Roman} \fontsize{14} \it \bf Plate Arc - Length, [m]') ylabel('\fontname{Times New Roman} \fontsize{14} \it \bf J , [W/m^2]')
This completes MATLAB modeling procedures for this problem.
- 291 -