CHEG 3128 – Heat, Mass, & Kinetics Laboratory
Diffusion in Laminar Flow Regimes Modeling and COMSOL Tutorial Tutorial by Andrea Kadilak
Introduction
COMSOL is a computer modeling software package that will allow you to model heat transfer, pressure-driven flow, diffusion, and other physical phenomena occurring in various chemical
engineering applications. COMSOL has a graphic user interface where you can define the governing physics and/or chemistry for a user-defined 2- or 3-dimensional geometry, define initial and boundary conditions, and perform a fine element model without writing any code. Take some time and look through the COMSOL web site, including the model gallery, animations, and tutorials for relevant models: http://www.comsol.com.
For the specific example we will be doing in class, see the following video tutorial: http://www.comsol.com/products/tutorials/Microfluidics_Simulation_of_an_H-Cell/
In this lab, we will be performing a simple exercise together to help you become more familiar with how to use COMSOL in a microfluidics application. The software is available to you free in UTEB 269, the four SOE computer labs, or on your own computer with UConn vPC through the SOE: http://vpc.uconn.edu/
In this demonstration, we will be modeling fluid flow and diffusion in a microfluidic H-cell. In this example, we will be using simple materials, but the material library (which contains all pertinent parameters e.g. heat transfer coefficients, density, etc..) for COMSOL is extensive.
Step-by-Step Modeling Instructions A) Define the Type of Model
1. In the window of “Select Space Dimension”, select 3D for a 3D model. Hit the blue arrow at upper right.
2. Add Physics—click on “Fluid Flow.” In the drop down list, click “Single-Phase Flow” and then double click “Laminar Flow (spf)”. Next, click on “Chemical Species Transport” and double
click “Transport of Diluted Species (chds)” (aka Fickian diffusion). Hit the blue arrow for next step.
3. Select Study Type—“Stationary” for steady state (you can try “Time Dependent” another time if you’re interested in the unsteady state solution). Hit the checkered flag.
B) Define System Geometry
1. A Settings tab labeled “Geometry” should automatically pop up and select μm for the length unit.
2. Right click on “Geometry 1”. Choose the geometry that you want, e.g. Rectangle. 3. Define the coordinates and size of your object. To model transport in the whole object,
select “Solid” as Object Type. Enter the following dimensions: Width = 200 , Height = 20. Select “Center” as “Base”. Hit the blue “build selected” building icon at upper right of the window. Your object will show in the right window. Click the green arrow icon (“zoom extents”) above the right window and the “default 3- D view” icon to the right of it to get the view below.
4. Next, make another rectangle by again right clicking on “Geometry 1” and selecting “Rectangle”. This rectangle will have Width =10, Height =150, and make sure to select “Corner” as base, with x=-100 and y=-70. Hit the blue “build selected” button.
5. Next, we are going to mirror this second rectangle to form an H-shape by right clicking “Geometry 1”, hovering over “Transforms” and selecting “Mirror” as shown on the next page.
6. Left click then right click on Rectangle 2 in order to add it to the “Input Objects” (it should now appear blue). Make sure to check the box for “Keep input objects” and then keep all other set points the same and “build selected”.
7. Next, we need to delete the inner boundaries of our shape. Right click “Geometry 1” again, hover over “Boolean Transforms”, and select “Union”.
8. Add all of your rectangles to the Input Objects (by left clicking then right clicking). Make sure both the “Keep input objects” and “Keep interior boundaries” boxes are NOT selected. Build all.
C) Define Materials and Object Domains
1. Again, under the Model Builder tab, under “Model 1,” right click on “Materials”, select “Open material browser.” Click “Built-In,” then right-click on “Water, liquid” and then left-click on “Add Material to Browser” as shown on the next page.
2. Highlight the “1” and hit the blue plus button to add material to model. To view properties of the material, click on “Properties”.
D) Define Modeling Conditions
1. Laminar Flow: Define initial and boundary conditions
a) Click “Laminar Flow” and first of all select “Incompressible Flow” from the drop down menu under “Compressibility” (to make it a less complicated problem for the model for now). Also make sure to check “Use shallow channel approximation” and enter in “10e-6” (10μm).
b) Now we need to set the inlet flows coming into the H-cell. Right click “Laminar Flow” and select “Inlet”. Left, then right click the two sides of the channels on the far ends of the left rectangle (sides 2 and 5).
c) For ease of use, under the “Boundary condition” drop down menu, select “Pressure, no viscous stress” and enter p0 = 3 Pa. You can also select a velocity or volumetric flow rate
d) Next, we will select the outlet conditions. Right click “Laminar Flow” and select “Outlet”. Select the two faces on the opposite rectangle on the right (faces 11 and 13) and leave the boundary condition at “Pressure, no viscous stress” and p0= 0 Pa.
2. Transport of Diluted Solutes: Define initial and boundary conditions
a) Click on “Transport of Diluted Species” and make sure that the “Convection” box is checked. Next, click on “Convection and Diffusion” under “Transport of Diluted Species.” For model inputs, make sure you select “Velocity field”, NOT “User defined”. Your model will not be able to calculate both physics together if this box is not checked and the velocity field connected to the flow regime from your other physics (learn from my mistake)!
b) Note that below is your diffusion coefficient for our hypothetical material, which is automatically entered as 1e-9 m2/s. Change the diffusion 1e-11 m2/s. Leave it as this value
for now, but we will be changing this around later on.
c) Now, we will be setting the inflow concentrations of your species. Right click “Transport of Diluted Species” and select “Inflow”. Select face 2 of your left-hand rectangle and select a concentration of 1 mol/m3. Repeat this for the other face of the left rectangle (face 5) and
d) To set up the outflows, right click “Transport of Diluted Species” and select “Outflow”. Select faces 11 and 13 of the right-hand rectangle.
E) Create Mesh and Compute Model
1. Click on “Mesh 1”. Leave under “physics-controlled mesh.” Under element size, select “fine”, then click on build selected.
2. Right click on “Study 1”, select “Compute”. This may take several minutes depending mostly on the number of nodes in mesh and number of time steps of computing.
F) Model Analysis
1. You can view concentration profile at different time by clicking“Results” → “2-D Plot Group 1” → ”Surface”. Change Data set in the middle window to “Solution 1”, then click the green and orange arrows to change the displayed expression to “Velocity magnitude”, which can be found under “Laminar flow”. Click the Plot button (looks like a pencil with colored lines coming out of it). The plot should look like the picture below.
2. Now, we will plot the diffusion results. Right click on “Results” and select “2-D Plot Group”. Right click on “2-D Plot Group 2” in the Model Builder tab and select “Surface”. Make sure the data set being used is “Solution 1” and make sure the expression is for c in units of mol/m3. To
change, do the same as in step 1, but select “Transport of Dilutes Species” → “Species c” → “Concentration (c)”. You plot should look like the picture below.
3. To view any calculated variable at defined coordinates, right click on “Data Sets.” Select “Cut Point 2D”. Enter the desired coordinate. Right click on “Derived Values”. Select “Point Evaluation”. Select the point you want to evaluate in “Data set”. Choose either the variable you’d like as “Expression”. Hit the orange “Evaluate” (equal sign) button at upper right. G) Modeling a Time-Dependent Solution
1. Right click on “Study 1” and hover your cursor over “Study Steps” and click “Time Dependent.”
2. Under times, enter in “range(0,1,100),” for the (start,step,stop) times in seconds (you can change this around later if you want).
3. Leave everything else as-is.
4. Right click and “Disable” the Stationary Step
5. Right click on “Study 1” and click “Compute” (green equals sign)
6. To view a profile at defined coordinates and time, right click on “Derived
Values”. Select “Point Evaluation”. Select the point you want to evaluate in “Data set”. Choose Expression and Time Selection should be “From list.” Highlight the time points that you want to evaluate in “Times”. Hit the orange “Evaluate” button at upper right.
7. You can also view the surface temperature over the slab at various times now. Click on “2D Plot 1” → “Surface.” Make sure “Solution 1” is selected as the Data Set.
8. Select the time that you are interested in using the drop down menu and click the “Plot” icon in the upper right of the window.
9. To generate a movie, select the player button on the upper right hand of the main menu icons. Select 2D Plot Group 2 (for diffusion) and select 0-50 for the times. Click the “Generate Frames” icon on the upper right of the tab, and then you can press play and watch your movie. This can also be exported so you can put the animation in a presentation.