This action might not be possible to undo. Are you sure you want to continue?

# Laminar Flow in a Tube ME433 COMSOL INSTRUCTIONS

- 1 -

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 V

i

. 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 L

h

, 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.

Known quantities:

Fluid: Air

V

i

= 0.04 m/s

Tair = 20 ºC

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

h

L L < , fully – developed flow region will form in the tube as

well. If

h

L 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 T

air

.

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.

Velocity Development in a Tube

L = 100 cm

D = 6 cm

Laminar Flow in a Tube ME433 COMSOL INSTRUCTIONS

- 2 -

Assignment

1. State the experimental criterion which permits analyzing flow in a tube as

d a

of

. Use COMSOL to solve for velocity distribution in the given tube. [Note: Please

ve

3. Use COMSOL to graph a vector field showing the development of velocity

4. Use COMSOL to plot axial velocity u(r, x

o

) at x

o

= 5, 10, 25, 75, and 100.

5. Use COMSOL to plot centerline velocity uc as a function of x on

laminar. Determine D

e

for a circular tube of diameter d. Use table 7.2 to fin

correct C

h

for a circular tube. Rearrange equation 7.43a to solve for Re in terms

L

h

, C

h

, and hydraulic diameter for a circular tube.

2

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 ha

COMSOL velocity solution].

profile. Show a 2D colormap of velocity distribution.

0 x L s s . Does

6. Use the plot of centerline velocity uc to find the hydrodynamic entrance length L

h

.

7. Use the results of questions 1 and 6 to calculate the Reynold’s number based on

8. [Extra Credit]: Compute velocity profile in FDVR according to equation 7.48.

9. [Extra Credit]: Compute mean velocity

the velocity profile become invariant with distance? What observations do you

make regarding uc?

hydrodynamic entrance length L

h

. State whether the flow is laminar or turbulent.

Compare this result with axial velocity u(r, x

o

) at x

o

that is in FDVR from

COMSOL solution. Comment on COMSOL solution validity.

u in FDVR. [Hint: Recall from fluid

mechanics that velocity distribution in fully developed velocity region is given by

( )

2

1

c o

u u r r

(

= ÷ . Compare this equation with equation 7.48 and use COMSOL

xial velocity u(r, x

o

) at x

o

that is in FDVR to compute

¸ ¸

solution to a 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.

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”.

- 3 -

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 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.

- 4 -

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 “U

0

” field

(Normal Inflow velocity)

2, 3 Wall No Slip

4

Open

boundary

Normal stress Verify that field “f

0

” is set to “0”

3. Click “OK” to close the “Boundary Settings” window.

- 5 -

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”.

- 6 -

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 x

o

, and a plot of centerline velocity u

c

. With these

results available, you should be able to determine the hydrodynamic entrance length L

h

and a corresponding Reynolds number. Furthermore, you will be able to determine

whether the flow is laminar or turbulent. With hydrodynamic entrance length L

h

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.

- 7 -

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 7 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

- 8 -

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.

- 9 -

Laminar Flow in a Tube ME433 COMSOL INSTRUCTIONS

Plotting Axial Velocity as a Function of Radius at Specified x

o

Values

To make axial velocity u(r, x

o

) plots at specified x

o

, we simply need to know the end

coordinates of axial lines along which u(r, x

o

) 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, x

o

) at x

o

= 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

- 10 -

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 9 to finish with exporting the image.

To display axial velocity at other x

0

values, repeat steps 8 and 9 on page 10. 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”.

- 11 -

Laminar Flow in a Tube ME433 COMSOL INSTRUCTIONS

Centerline velocity u

c

will be displayed as a function of x on0 x L s s . 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.

- 12 -

Laminar Flow in a Tube ME433 COMSOL INSTRUCTIONS

- 13 -

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 Import from COMSOL Multiphysics:

load uc.txt; % Loads u(0,x) as a 2 column vector

x = uc(:,1)*100; % x - coordinate, [cm]

u = uc(:,2); % 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.

2.Laminar Flow in a Tube ME433 COMSOL INSTRUCTIONS Assignment 1.2 to find a correct Ch for a circular tube. Use COMSOL to solve for velocity distribution in the given tube. -2- . Comment on COMSOL solution validity. Use the plot of centerline velocity uc to find the hydrodynamic entrance length Lh.01 m/s to 1. [Extra Credit]: Perform parametric study in COMSOL that solves the problem for multiple input velocities. Ch. 5. 10. State the experimental criterion which permits analyzing flow in a tube as laminar. Compare this result with axial velocity u(r. Use table 7. [Extra Credit]: Compute velocity profile in FDVR according to equation 7. Show a 2D colormap of velocity distribution. [Note: Please save this COMSOL model in . 9. Does the velocity profile become invariant with distance? What observations do you make regarding uc? 6. 7.43a to solve for Re in terms of Lh. Thermal considerations will be done as a separate problem and it will require you to have COMSOL velocity solution]. xo) at xo = 5. Use COMSOL to graph a vector field showing the development of velocity profile. xo) at xo that is in FDVR to compute u ]. State whether the flow is laminar or turbulent. Use COMSOL to plot centerline velocity uc as a function of x on 0 x L .48. Use COMSOL to plot axial velocity u(r. Use an increment of 0. 25. [Extra Credit]: Compute mean velocity u in FDVR. 75. 10. 4. [Hint: Recall from fluid mechanics that velocity distribution in fully developed velocity region is given by 2 u uc 1 r ro . 3. 8. xo) at xo that is in FDVR from COMSOL solution. Compare this equation with equation 7.01 m/s. Use the results of questions 1 and 6 to calculate the Reynold’s number based on hydrodynamic entrance length Lh.0 m/s. and 100. Solve the problem in the rage of 0. Rearrange equation 7.mph file for future thermal modeling. Determine De for a circular tube of diameter d.48 and use COMSOL solution to axial velocity u(r. and hydraulic diameter for a circular tube.

this is not a multi – coupled PDE system. For this setup: 1. Temperature. Click “OK”. -3- .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. Start “COMSOL Multiphysics”. 3. From the list of application modes select “Heat Transfer Module Weakly Compressible Navier – Stokes Steady – state analysis”. etc). Pressure. 2. Since no other field of interest is asked for (ex. and thus requires only Non – Isothermal Flow application mode.

Click on “Zoom Extents” button geometry. 2. select “Specify Objects Rectangle”. Let us therefore begin by creating a rectangle. modes of heat transfer (i. Click “OK”. A rectangular geometry is adequate to model this problem. in the main toolbar to zoom into the Your geometry should now be complete and highlighted in red. In this model. 5. -4- . 1. as it saves computation time and is physically symmetric to any other lateral cross – section.06” as the “Width” and “Height” of the rectangle. as shown below. Let us begin with the air flow physics settings. initial conditions. PHYSICS SETTINGS Physics settings in COMSOL consist of two parts: (1) Subdomain settings and (2) boundary conditions.Laminar Flow in a Tube ME433 COMSOL INSTRUCTIONS GEOMETRY MODELING We will model tube’s lateral cross – section only. conduction and/or convection). Enter “1.1” and “0. 3.03” as the base position “y” coordinate. (Without quotation marks). The boundary conditions settings are used to specify what is happening at the boundaries of the geometry. we will have to specify and couple physics settings for the flow of air and heat transfer. respectively.e. The subdomain settings let us specify material types. 4. From the “Draw” menu. Enter “-0.

3 4 BOUNDARY TYPE Inlet Wall Open boundary BOUNDARY CONDITION Velocity No Slip Normal stress Verify that field “f0” is set to “0” COMMENTS Enter “0. Enter “1. 3. Boundary Conditions: 1. 2. From the “Physics” menu open the “Boundary Settings” (F7) dialog box. -5- . respectively. From the “Physics” menu select “Subdomain Settings” (F8). and “η” fields.Laminar Flow in a Tube ME433 COMSOL INSTRUCTIONS Subdomain Settings: 1.17e-6” in the “ρ”. Apply the following boundary conditions: BOUNDARY 1 2.04” in “U0” field (Normal Inflow velocity) 3. Click “OK” to close the “Boundary Settings” window.2042” and “18. 4. Click “OK” to apply and close the Subdomain Settings window. 2. Select “Subdomain 1” in the subdomain selection field.

8. -6- . Enter “150” in the “Number of edge elements” field. 1. Enable “Constrained edge element distribution” option. 5. 2. Go to the “Mesh” menu and select “Mapped Mesh Parameters …” option. Enter “5” in the “Element ratio:” field and switch the “Distribution method” from “Linear” to “Exponential”. Enter “20” in the “Element ratio:” field and switch the “Distribution method” from “Linear” to “Exponential”. Switch to “Boundary” tab.Laminar Flow in a Tube ME433 COMSOL INSTRUCTIONS MESH GENERATION To minimize the computational time without compromising much accuracy of the solution. Enable the “Symmetric” check box option. 7. 9. 4. 10. 3. 11. Select boundaries 1 and 4 in the “Boundary selection” field while holding the “Control (ctrl)” key on your keyboard. Select boundaries 2 and 3 in the “Boundary selection” field while holding the “Control (ctrl)” key on your keyboard. we must change the default meshing parameters. Enter “25” in the “Number of edge elements” field. To do this. 6. Enable “Constrained edge element distribution” option.

such as 2D velocity vector field. 13. With hydrodynamic entrance length Lh known. We are interested in steady – state analysis here. In addition to this qualitative solution representation. and a plot of centerline velocity uc. no modifications need to be made. With these results available. you can determine and see whether both entrance and FDV regions or only the entrance region exist in the tube. -7- . you will be able to determine whether the flow is laminar or turbulent. Click “OK” button to close “Mapped Mesh Parameters” window. you should get the following quadrilateral mesh: We are now ready to compute our solution. (Allow few minutes for solution) 2. Name the file according to the naming convention given in the “Introduction to COMSOL Multiphysics” document. proceed with the following steps: 1. Answer the extra – credit questions to verify COMSOL results. Save your work on desktop by choosing “File Save”. which we previously selected in the Model Navigator. COMPUTING AND SAVING THE SOLUTION In this step we define the type of analysis to be performed. your immediate result will be given as shown in velocity colormap above. the next section (Postprocessing and Visualization) will help you in obtaining other diagrams. Therefore. To enable the solver. Furthermore. Click “Remesh” button. The result that you obtain should resemble the following surface color map: By default. From the “Solve” menu select “Solve Problem”. As a result of these steps. you should be able to determine the hydrodynamic entrance length Lh and a corresponding Reynolds number. plots of axial velocities at various xo.Laminar Flow in a Tube ME433 COMSOL INSTRUCTIONS 12.

you will see a similar plot as shown on page 7 with an additional velocity vector field represented by arrows. Switch to the “Arrow” tab and enable the “Arrow plot” check box. Press the “Color” button and select a color you want the arrows to be displayed in. open “Plot Parameters” dialog box (F12). Before you do save it. 1. It is a good idea to save this colormap for future use. 4. This can be done as follows. Enter “20” in the “Number of points” for both “x” and “y” fields. 2. 3. Put “30” for the “x” field and update your view by pressing “Apply” button. From the “Postprocessing” menu. Black and white are good choices here) 5. however. (Note: choose a color that produces good contrast. Click “Apply” to refresh main view and keep the “Plot Parameters” window open.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. Notice -8- . At this point. 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.

Laminar Flow in a Tube ME433 COMSOL INSTRUCTIONS the difference in velocity vector field representation. increase the DPI value. Name and save the image. Change your “Export Image” value settings to the ones in the above figure. you may want to save it as an image for future discussion. Saving Color Maps: After you have selected a view that shows the results clearly. Click the “Export” button. 4. 3. For a 4” by 6” image. acceptable image quality settings are given in the figure below. This will bring up an “Export Image” window. Go to the “File” menu and select “Export Image”. Try other values. 2. Click “OK” when you are done displaying these quantities to close the “Plot Parameters” window. If you need higher image quality. -9- . This may be done as follows: 1.

Click “Apply”. xo) is to be plotted. Type “y” in the “Expression” field under “y – axis data” section of the tab. xo) plots at specified xo. 6. use radio button to enable the “Expression” option. 3. 4. Click on “Expression” button. These steps produce a plot of axial velocity as a function of radius at x = 100 cm. To . 2. Under “Postprocessing” menu. 9. 5. Vertical axial lines are described by the radius of the tube in y – coordinate (or r coordinate). 7. Click “OK” to apply and close “x – axis data” window. 1. Velocity u is plotted on the x – axis and y – coordinates are plotted on the y – axis. select “Cross – Section Plot Parameters”. type “u” in “Expression” field.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) at xo = 100 cm. Let us begin by plotting axial velocity u(r. we simply need to know the end coordinates of axial lines along which u(r.10 - . Switch to “Line/Extrusion” tab. 8. In “Cross – Section Plot Parameters” window. Under “x – axis data”. In new “x – axis data” window. enter the following coordinates in the “Cross – section line data”: x0 = x1 = 1. y0 = -3e-2 and y1 = 3e-2.

switch to upper radio button and select “x” using the drop – down menu. Give the file a descriptive name (do not forget to add . you can save numerical data for velocity and y – coordinates instead of a plot. The y – coordinate (or the r coordinate) at the center of the tube stays at zero level. y0 = y1 = 0. You can use this data later to recreate the plot in MATLAB (or other software). Plotting Centerline Velocity uc as a Function of x Similar to axial velocity plots. Enter the following coordinates in the “Cross – section line data” section: x0 = 0. Follow steps 2 – 4 as instructed on page 9 to finish with exporting the image. Under “Postprocessing” menu. 4. When you are done with making these plots. [Note: Alternatively. To display axial velocity at other x0 values. repeat steps 8 and 9 on page 10. Tube center line begins at x0 = 0 meters and terminates at x1 = 1. . use the “Browse” button to navigate to your saving folder. Switch to “Line/Extrusion” tab. click “OK” to close “Cross – Section Plot Parameters” window.txt extension at the end of file name). To save this numerical data. In step 8. You should produce 5 such plots altogether. 3. 5. and save the file]. x1 = 1. 2. This will bring up an “Export Image” window. select “Cross – Section Plot Parameters”. 1.11 - . In “x – axis data” section. change the x0 and x1 coordinates to those given in assignment question 4. Click the save “ ” button in your figure with results. 1.Laminar Flow in a Tube ME433 COMSOL INSTRUCTIONS save this plot. we simply need to specify the proper coordinates of a line along which we wish to plot velocity. use the “Export current data” button in the plot window. Click “OK”. 6. Type “u” in the “Expression” field under “y – axis data” section. 2.

Laminar Flow in a Tube ME433 COMSOL INSTRUCTIONS Centerline velocity uc will be displayed as a function of x on 0 x L . MATLAB Re – Plot of Centerline Velocity uc This completes COMSOL modeling procedures for this problem.12 - . . This graph is shown below. It has been re – plotted with MATLAB.

% Plotting grid on box off title(. %/ plot(x.Laminar Flow in a Tube ME433 COMSOL INSTRUCTIONS APPENDIX MATLAB script The following MATLAB script re – produces the centerline velocity plot. [m/s]') This completes MATLAB modeling procedures for this problem..m script file.1)*100..[1 1 1]).'off'. [m/s] %% Plotter figure1 = figure('InvertHardcopy'.x) as a 2 column vector % x .. [cm]') ylabel('\fontname{Times New Roman} \fontsize{14} \it \bf u_c . '\fontname{Times New Roman} \fontsize{16} \bf Centerline Velocity u_c') xlabel('\fontname{Times New Roman} \fontsize{14} \it \bf x.coordinate.u..txt” and place it in the same directory with MATLAB’s . %% Preliminaries clear % Clears the UI prompt clc % Clears variables from memory %% Velocity Data load uc.. . Make sure to use COMSOL first to export the centerline velocity data to an external text file..txt. [cm] % velocity. % | -> Setting up the figure 'Color'. u = uc(:. Import from COMSOL Multiphysics: % Loads u(0. x = uc(:.. Name the file as “uc.2).13 - .. %\ 'Colormap'.[1 1 1 ].'k').