-
Laminar Forced Convection Over a Heated Flat Plate ME433 COMSOL
INSTRUCTIONS
- 1 -
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 sq . 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 ,0sq x 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.
nown quK antities:
luid: Air F
= 0.1 m/s V
T = 20 C sq = 1000 W/m2
b
n external flow, forced convection problem. Both fluid and
temperature
elt
e of the
ng the thickness of the plate, the flow and heat transfer
processes can be
O
servations
This is afields 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 Pohlhausens solution does not apply directly due to a
lack of plate temperature knowledge, it still can be used to
develop equations for local Nussnumber 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. Somkey 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.
Neglecti
modeled with a simple rectangular geometry. However, plate
boundary must thenbe split into two separate but connected
boundaries in order to allow the correct boundary condition
setup.
Flow over an Isothermal Flat Plate with an Insulated Leading
Section
L = 10 cm x0 = 2 cm
-
Laminar Forced Convection Over a Heated Flat Plate ME433 COMSOL
INSTRUCTIONS
- 2 -
Assignment
1. State and calculate the conditions under which the flow field
in this problem can .
2. Use COMSOL to solve for and save 2D color distributions of
velocity and
3. Use COMSOL to solve for and save 2D color distributions of
key air properties.
4. Use COMSOL to plot and save T(0.08,y).
5. Use COMSOL to plot and extract surface temperature data
be considered laminar and that the concept of boundary layer
flow can be applied
temperature fields.
Use your textbooks Appendix C to examine whether or not these
properties wereaccurately determined by COMSOL.
,0T x . Use this data
lid? [Note:
6. Use COMSOL data for
to compare it with surface temperature reference equations given
in Postprocessing and Visualization section. Are COMSOL results
vaIn this instruction set, part of this assignment question will be
done with MATLAB, but you are free to use any software of your
choice]
,0T x on 0x x L and Newtons law of cooling to
determine COMSOL h(x) for 0x x L . Compute and plot analytically
determined local h(x) given by a reference equation and COMSOL h(x)
osame graph. [Note: In this instruction set, part of this
assignment question will 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
n the be
h(x). .
MATLAB to graph on the same plot
Base your error analysis on assumption that COMSOL h(x) is the
correct solutionCan 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
theoretical and COMSOL determined boundary layer . Comment on
differences in the solutions you notice. Which results would you
trust? Thinstructions for COMSOL boundary layer data extraction and
sample MATLscripts that will plot
e AB
are given separately in the appendix.
9. [Extra Credit]: Determine wall shear o induced by the flow on
the plate and friction coefficient Cf.
-
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.
- 3 -
-
Laminar Forced Convection Over a Heated Flat Plate ME433 COMSOL
INSTRUCTIONS
- 4 -
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 20C to
350C. 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.
pC k Pr EVALUATED AT T 1006.1 1.2042 18.17x10-6 0.02564 0.713
EVALUATED AT 350C 1056.8 0.5665 31.07x10-6 0.04692 ~ 0.7
% DIFFERENCE (based on 20C) 5.04 53 71 83 1.86
Based on these calculations, it is now clear that for air in
this temperature range, , , and strongly depend on temperature
while p and r are weakly dependent propertieswith respect to
temperature. Therefore, and will be set as constants while
k CPr
P
pC , , and k will be modeled as varying properties. The
following equations will be used to calculate air properties that
vary strongly with temperature:
10
30
3.723 0.865log
6 8
, [kg/m ]
10 , [W/m K]6 10 4 10 , [Pa s]
w
T
P MRT
kT
ng[Ref.: J.M. Coulson and J.F. Richardson, Chemical E ineering,
Vol. 1, Pergamon Press, 1990, appendix]
Where,
0 (atmospheric pressure) 101.3 kPa,(molecular weight of air)
0.0288 kg mol,
(universal gas constant) 8.314 J/mol Kw
PMR
-
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 DESCRIPTION
k_air 10^(-3.723+0.865*log10(abs(T[1/K])))[W/(m*K)] W/(mK) Air
Conductivity
rho_air 1.013e5[Pa]*28.8[g/mol]/(8.314[J/(mol*K)]*T) kg/m3 Air
Density
mu_air 6e-6[Pa*s]+4e-8[Pa*s/K]*T Kg/(ms) 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 Prandtls number is essential, it is a
composite property that is defined by , pC , and k , most of which
have now been defined. The only constant property that needs to be
defined as well is . We will define and apply it to geometry in
Subdomain Settings section.
pC
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.
- 5 -
-
Laminar Forced Convection Over a Heated Flat Plate ME433 COMSOL
INSTRUCTIONS
We now must scale the geometry down to centimeters. (Recall that
COMSOLs 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 in the main toolbar to zoom into
the
geometry. 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.
- 6 -
-
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.
- 7 -
-
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 Enter 1000 in q0 field 5 Convective flux
3. Click OK to close Boundary Settings window.
- 8 -
-
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.
- 9 -
-
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.
- 10 -
-
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 ,0xq x for 0x x L . We will also show how to
use COMSOL to compute the total heat transfer rate per unit length,
Tq and use MATLAB to determine h(x) from COMSOL ,0xq x data and
analytically.
- 11 -
-
Laminar Forced Convection Over a Heated Flat Plate ME433 COMSOL
INSTRUCTIONS
- 12 -
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
, 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.
,0T x
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.
-
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. Lets
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 11.
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.
- 13 -
-
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.
- 14 -
-
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 airs thermal
conductivity k. Note the values on the color scale and compare them
with Appendix C of your textbook.
- 15 -
-
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 Prandtls 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
Reynolds number. For Reynolds 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 Reynolds 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.
- 16 -
-
Laminar Forced Convection Over a Heated Flat Plate ME433 COMSOL
INSTRUCTIONS
- 17 -
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 14 to finish with
exporting the image.
Plotting Plate Surface Temperature 0T x, For 0 x x L To plot for
,0T x 0x 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
,0T x for
0x 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.
-
Laminar Forced Convection Over a Heated Flat Plate ME433 COMSOL
INSTRUCTIONS
- 18 -
Exporting COMSOL Data to a Data File:
1. Click on Export Current Plot button in the graph created in
the previous s
tep.
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
4. Click OK to save the file.
his completes COMSOL modeling procedures for this problem.
extension in the name of the file).
T
-
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:
13
1 13 2
13
1 13 2
0
0
0.417 1 Pr Re
2.396 1Pr Re
xx
ss
h x xNuk x
q x xT x Tk x
MATLAB script (heated_plate.m) is programmed to use exported
COMSOL data for surface temperature and Newtons 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:
,0T x
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
Pohlhausens and COMSOL solutions for h(x) and sT 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.
- 19 -
-
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 Prandtls number,
conductivity k, and kinematic viscosity along heated portion of the
surface of the plate. Refer to steps 1 7 on page 17 and 1 4 on page
18 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
- 20 -
-
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.
- 21 -
-
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; % Ambient temperature, [degC]
Vinf = 0.1; % Velocity at the inlet, [m/s] k_air = 0.03525; % Air
conductivity at Tfilm, [W/m-K] Pr_air = 0.701; % Air Prandtl number
at Tfilm, [1] eta_air = 29.75e-6; % Air viscosity at Tfilm, [m^2/s]
x0 = 0.02; % A speical plate coordinate!, [m] qs = 1000; % 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); %| -> Simple % Error
errorh = deltah./hx_comsol*100; %| -> calculation for h
- 22 -
-
Laminar Forced Convection Over a Heated Flat Plate ME433 COMSOL
INSTRUCTIONS
deltaT = abs(Ts_comsol - Ts_analyt); %| -> Simple % Error
errorT = deltaT./Ts_comsol*100; %| -> calculation for T %% h(x)
Plot Begins Here: figure1 = figure('InvertHardcopy','off',... %\
'Colormap',[1 1 1 ],... % | -> Setting up the figure 'Color',[1
1 1]); %/ plot(x,hx_comsol,'b',x,hx_analyt,'r--') % 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
],... % | -> Setting up the figure 'Color',[1 1 1]); %/
plot(x,errorh) % 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,...
- 23 -
-
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 ],... % |
-> Setting up the figure 'Color',[1 1 1]); %/ plot(x,errorT) %
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} $$'};
- 24 -
-
Laminar Forced Convection Over a Heated Flat Plate ME433 COMSOL
INSTRUCTIONS
- 25 -
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
be 0.994, from which, with the use of table 7.1, equation 7.11
is derived. We could have taken as close to unity as we wish and
equation 7.11 would therefore change.
layer, since it implies t V . The number 0.994, however, is
special because it corresponds to a Prandtls r of 1.0 on
Pohlhausens solution given in figure 7.2From figure 7.2 and
equation 7.19, it follows that for air (Pr = 0.7), / 1t
u V/u V
Physically, the closer /u Vhat u
nu
is to unity, the better the distinction in the viscous
boundary
.
mbe , since
6.5t .
e therefore need to program MATLAB with the following analytical
equation foW r :
5.2Rex
x
To compute Rex , properties at Tfilm must be found. This is
easily done since both temperature extremes are now known. Variable
x ranges between 0 0.1x meters. In COMSOL, we have to use Contour
plot type to single out velocity iso curve that orrespond to
condition. To extract boundary layerc / 0.994u V from COMSOL,
ckbox on the top left portion of the window.
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 che
5. Type u in the Expression field. (without quotation marks)
-
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 / 0.994u V 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 will
be
shown in a new plot figure. / 0.994u V
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.
- 26 -
-
Laminar Forced Convection Over a Heated Flat Plate ME433 COMSOL
INSTRUCTIONS
- 27 -
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; % Clears the UI
prompt clear; % Clears variables from memory %% Constant Quantities
Vinf = 0.1; % Velocity at the inlet, [m/s] k_air = 0.03525; %
Conductivity at Tf, [W/m-K] rho_air = 0.8150; % Density at Tf,
[kg/m^3] Pr_air = 0.701; % Prandtl number at Tfilm, [1] mu_air =
24.24e-6; % Viscosity at Tf, [m^2/s] eta_air = mu_air/rho_air; %
Specific viscosity at Tf, [m^2/s] %% COMSOL Data Import load
fluid_blayer.txt; xcomsol = fluid_blayer(:,1); ycomsol =
fluid_blayer(:,2); %