Escolar Documentos
Profissional Documentos
Cultura Documentos
Observations
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).
-1-
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 Newtons 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]:
-2-
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.
-3-
EXPRESSION
VALUE
Tinf
273.15+20 [K]
293.15[K]
dT
10[K]
10[K]
rho0
DESCRIPTION
Temperature Far Away
Temperature Step
1.2042[kg/m^3]
1.2042[kg/m ]
mu_air
18.17e-6[kg/(s*m)]
(1.817e-5)[kg/(ms)]
k_air
0.02564[W/(m*degC)]
0.02564[W/(mK)]
Cp_air
1006.1[J/(kg*degC)]
1006.1[J/(kgK)]
9.81[m/s^2]
9.81[m/s ]
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.
-4-
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
P1
P2
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.
-5-
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 ]
-6-
Notice that the buoyant force Fy is set up in accordance with the condition described
on page 3. 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
-7-
-8-
BOUNDARY CONDITION
COMMENTS
1, 4
Insulation/Symmetry
2, 6
Temperature
Temperature
Convective flux
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.
-9-
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:
- 10 -
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
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.
- 11 -
13. In the Initial value area click the Stored solution radio button.
- 12 -
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.
- 13 -
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.
- 14 -
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 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 13. 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.
- 15 -
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.
- 16 -
- 17 -
- 18 -
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 16 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).
- 19 -
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.
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)
- 21 -
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.
- 22 -
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',...
%\
- 23 -
'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]')
%
- 24 -