Basic CFD Simulations with
COMSOL Multiphysics
By
Okocha Marvellous
+2349064550993, okochamarvellous123@[Link]
&
Engr. Dr. Patrick U. Akpan
+2348102475639; [Link]@[Link]
CASE STUDIES
1 -2D modeling of a Venturi Tube 2 - 2D modeling of an obstructed duct
What is a Venturi tube?
A Venturi tube is a device used in fluid mechanics to measure the flow rate of a fluid
through a pipe. It works on the principle of the Venturi effect, which comes from
Bernoulli’s equation and has three sections: the converging section, the throat, and the
diverging section.
Stimulation Outline: Steps
A typical simulation in COMSOL will follow the steps similar to the one outlined below:
1 Opening and setting the COMSOL Environment.
2 Geometry: Creating the Venturi Geometry
3 Adding Materials: Material Selection (water)
4 Adding Physics: Setting the Physics, Boundaries, and their conditions
5 Meshing and Running the Study
6 Results and Postprocessing
Opening and setting up the COMSOL Environment.
Open COMSOL Multiphysics > Select Model Wizard
Select > 2D Space Dimension
Opening and setting up the COMSOL Environment.
For the physics, select the Fluid Flow twistie for the drop
down and proceed as such:
Fluid Flow > Single Phase flow > Turbulent Flow, k-𝜀 (spf)
Click > add and then click > Study button
Next, select Stationary study > Click Done
The Physics interface in COMSOL is chosen based on what
you want to study and the domain of your problem (fluids,
heat, structures, electromagnetics, etc.). Each interface
comes with built-in assumptions and the relevant
governing equations. For instance, the Fluid Flow physics
solves the continuity equation (mass conservation), the
Navier–Stokes equations (momentum conservation), and
the energy equation (if heat transfer is included).
Case Study 1 - 2D modeling of a Venturi Tube
Geometry: Creating the Venturi Geometry
We want to create this shape:
The modeler can approach this in many ways. But, in this case,
we will be using parameters. This is to demonstrate how
parameters are created and can be used in COMSOL.
To create the parameters:
right-click > Global Definitions > select Parameters.
To the right, the model will see the parameter’s window. You
can create parameters there, write down their Expression, and
Description (Optional). (When inserting expressions, you will
have to click on your Enter key before moving on.)
Geometry: Creating the Venturi Geometry
In creating the venturi, we will create 3 squares and then
proceed to create the trapezoids using the line tool (Bezier
Polygon).
We will use the following parameters:
➢ Diameter of pipe, inlet and outlet (D) = 30[mm] {Height}
➢ Length of pipe, inlet (L_in) = 180[mm] {Width}
➢ Length of pipe, outlet (L_out) = 110[mm] {width}
➢ Diameter of Throat (D_t) = 15[mm] {Height}
➢ Length of Throat (L_t) = 40[mm] {Width}
➢ Inlet velocity (U) = 0.001[m/s]
And for the positions of the rectangles (x,y) in mm:
➢ The first rectangle (x0, y0) = (0, 0)
➢ The throat (also a rectangle) (xt, yt) = (220, 7.5) L_in L_t L_out
➢ The second rectangle [outlet] (y1, x1) = (300, 0).
U D
Geometry: Creating the Venturi Geometry
Now, to create the shapes.
Right-click > Geometry in the Model Builder
select > rectangle tool
In the settings window, you will fill in the
appropriate parameters for the inlet
pipe, the throat, and the outlet pipe
(Rectangles 1, 2, and 3—refer to the
previous slide for the details): Width,
Height, and Position1. Once done, for
each case, you will click on Build
Selected to create the shape2. You will
get the image as shown:
Figures showing the setting window for the inlet pipe and throat
1When creating the shapes, click on Zoom Extents to clearly view the objects in the graphics shapes.
2For the rectangles, their labels can be adjusted to represent the various parts: Rectangle 1, Rectangle 2, and Rectangle 3 can be changed
to Inlet pipe, throat, and outlet pipe.
Geometry: Creating the Venturi Geometry
To complete the pipe, Trapezoids would be included using the line
tool.
Click > Geometry tab on the menu bar > select > Line tool.
Draw as shown in Figure a and right-click for the shape to form
[Figure b]. The same process will be repeated for the other side
[Figure c], giving:
[a]
[b]
[c]
Next, click > Booleans and Partitions on the menu tab
Select Union > option in the tools tab.
This will enable us to combine the shapes we’ve created into a
whole.
Geometry: Creating the Venturi Geometry
After Union is selected, with the input objects
active, proceed by selecting the individual
shapes on the Graphics window and unchecking
the ‘keep interior boundaries’ option.
Click > Build Selected.
The final result should be the shape below:
Adding Materials: Material Selection (water)
Water will be assigned as the material to the
domain of the geometry (venturi) we
created.
Click on the Add Materials window located
at the right, then follow these steps:
Click > Liquid and Gases twistie > Liquid >
Water.
Once you locate water, double-click on it to
add it. It will appear under Materials in the
Model Builder. Automatically, our geometry
will be selected1. Also, because the property
already existed in COMSOL and had the
properties required, no user input was
required2.
1Note: Geometries with multiple components and parts, consisting of multiple materials, will require manual selection and deselection of parts.
2This may not always be the case, and the modeler may need to find the required properties. Furthermore, materials not found in the COMSOL Library can
be created and added to the user’s library.
Adding Physics: Setting the Physics, Boundaries, and their conditions
We want to set some boundary conditions (BC) in the Turbulent Flow
(k-ε) interface for the inlet and outlet of the pipes. It already has a wall
boundary condition—No slip1—but we will be adding the Inlet and
outlet BC.
To add the inlet boundary and to place conditions, in the Model
Builder window
right-click > Turbulent Flow (k-ε) > select Inlet.
With Inlet selected, select the inlet boundary in the Graphics window
and then place the value for initial/input velocity, which is the
parameter U in this case.
1From Fluid Mechanics, the no-slip condition is when a fluid's velocity at a solid boundary is equal
to the boundary's velocity i.e. the velocity of the fluid at the boundary = 0
Adding Physics: Setting the Physics, Boundaries, and their conditions
Next, place the outlet boundary, just like it was done for the inlet boundary. Here, no changes need to be
made. The default conditions will suffice. Below are figures showing the inlet and outlet boundary selection.
Meshing and Running the Study
Click > Mesh 1
With physics-controlled sequence type and the element size set to Normal1, the Modeler should click > Build All
Next, Click > Study 1 > Compute
1Differentelement size can be used when meshing, but and the finer the mesh, the more accurate
the simulation. The drawback is an increase in simulation time.
Results and Postprocessing
After the simulation has been run, the modeler can
view the results (Velocity (spf) and pressure (spf) ).
The modeler can also add Contours and Velocity
streamlines.
To add Velocity Contours, go to the Model Builder
window
Right-click > Velocity (spf) > select Contour
Velocity > Right-click Surface > select Disable.
The same can be done to view Pressure Contours and
Velocity streamlines. Though, for streamlines, a
Rainbow Colour Expression will be added:
Right-click on the created streamline > select Color
Expression > in Coloring and Style, select > Rainbow in
Color table > select Plot
Results and Postprocessing
There are two basic results that we are interested in:
Velocity. Pressure.
[Where is the flow fast? Where is it slow? Is it recirculating?] [How forces are distributed in the fluid]
a. Contour [speed magnitude at boundaries. a. Surface
Important for identifying high-velocity regions b. Contour
(erosion risk, flow constriction) or low-velocity [They Show static pressure distribution inside
zones (stagnation, fouling, poor mixing). the fluid and on boundaries. Important for:
b. Surface [for showing the flow field.] evaluating pressure drop]
c. Streamlines [the paths that fluid particles
would follow. Important for: visualizing flow
patterns, vortices, separation zones, or
recirculation. ]
d. Arrow Surface [direction and magnitude of
velocity at selected surfaces. Important for:
quick understanding of flow orientation, e.g.,
in ducts, inlets/outlets, or near walls.]
Results and Postprocessing
Velocity Surface
Results and Postprocessing
Velocity Contours
Results and Postprocessing
Velocity Streamlines
For streamlines, go to Streamline Positioning and Select > Start point controlled with 20 points.
Results and Postprocessing
Pressure Surface
Results and Postprocessing
Pressure Contours
Case Study 2 - 2D modeling of an obstructed duct
2D modeling of an obstructed duct
Here, the modeler will be guided on how to build the geometry for the second simulation. Aside from the difference in
geometry, the same steps apply. Also, in addition to displaying streamlines and contours, the steps for surface arrows
are included.
The venturi is made of 4 simple shapes: a Large rectangle, two smaller rectangles of different sizes (the plate and
triangular base), and a triangle (the triangle will be made using the line tool [Bezier’s
ư polygon]).
Go to Model Builder > right-click Global Definitions > select parameters.
We will use the following parameters:
➢ Diameter of pipe (D) = 30[mm] {Height}
➢ Length of pipe, inlet (L) = 180[mm] {Width}
➢ Plate’s height (plate_L) = 110[mm] {Height}
➢ Plate’s width (plate_w) = 15[mm] {Width}
➢ Triangle base’s height (t_b_h) = 40[mm] {Height}
➢ Triangle base (t_b) = 40[mm] {Width}
➢ Inlet velocity (U) = 0.001[m/s]
And for the positions of the rectangles (x,y) in mm:
➢ The pipe [Large triangle] (x0, y0) = (0, 0)
➢ The plate (xp, yp) = (230, D – plate_L)
➢ The triangle’s base [also a rectangle] (y1, x1) = (200, 0)
2D modeling of an obstructed duct
Now, to create the shapes.
Right-click > Geometry in the Model Builder
Select > Rectangle tool
In the settings window, you will fill in the
appropriate parameters for the pipe, the
Plate, and the triangle’s base (Rectangles
1, 2, and 3—refer to the previous slide
for the details): Width, Height, and
Position. Once done, for each case, you
will click on Build Selected to create the
shapes. You will get the image as shown
below:
Figures showing the setting window for the pipe and plate.
2D modeling of an obstructed duct
To add the triangle, we will be using the line tool [Bezier
ư Polygon]
Click > Geometry tab on the menu bar > select > Line tool.
Draw a line from the top-left of the base to an arbitrary height, click, and then draw
another from that point to the top-right of the base, then right-click1.
To adjust the triangle to an appropriate size, we will adjust Segment 1 and Segment 2
as shown:
Click > Bezier
ư Polygon > Polygon Segments > Segment 1 (linear) | Segment 2 (linear)
1You can zoom in by using the Zoom to Selection tool in the Graphics window.
2D modeling of an obstructed duct
Next, we will use Union from the Boolean and Partitions tool to combine the base and triangle [Bezier
ư Polygon].
(Check page 8 to review steps.) Select the Polygon and Rectangle 3, and with Keep interior boundaries unchecked
click on Build Selected in the Union Settings window.
Next, we will use the Difference tool also gotten from Boolean and Partitions. In
Objects to add select the larger rectangle (r1) and in Objects to subtract, select the
plate and the created union shape. Then select Build Selected.
2D modeling of an obstructed duct: Results
With this done, the modeler can follow the same steps as the one from
Venturi – 1. The following results should be achieved
Velocity Surface
2D modeling of an obstructed duct: Results
Velocity Countors Surface
2D modeling of an obstructed duct: Results
Velocity Streamline
For streamlines, go to Streamline Positioning and Select Magnitude controlled with density value
of 60
2D modeling of an obstructed duct: Results
Pressure Surface
2D modeling of an obstructed duct: Results
For the Arrow Surface, Right-click> Velocity (spf) > select Arrow Surface
Locate the Arrow surface 1 in the Velocity (spf) twistie > Right-click on Arrow Surface 1 >
select Color Expression
In Color Expression in the Arrow positioning located in the Arrow Surface Settings
window, place 500 and 20 in the X and Y grid points, respectively.
Tasks to be completed
Case 1 - Positioning: Start-Point controlled, points – 20
Groups Velocity (m/s) Diameter (m)
1 0.03 0.06
2 0.018 0.054
3 0.026 0.048
4 0.011 0.042
5 0.022 0.057
6 0.02 0.052
7 0.018 0.047
8 0.032 0.045
9 0.025 0.043
Tasks to be completed
Case 2 - Streamline Positioning: Magnitude controlled, Density 60
Groups Diameter (mm) Velocity (m/s)
1 78 5.3
2 74 5
3 75 5
4 80 5
5 77 5
6 83 4.5
7 75 5
8 81 5
9 84 5