EG501V/EG503G Computational Fluid Dynamics
Practical 1: CFD modeling of laminar flow using ANSYS Fluent
1 Introduction
This practical shows how to solve the basic laminar fluid flow problems using ANSYS Fluent.
Two laminar flow scenarios are considered: (1) laminar flow in a pipe and (2) start-up flow between to parallel plates. The learning outcomes of this tutorial cover four key elements involving CFD simulation and analysis using ANSYS Fluent:
1. Creating the model Geometry;
2. Mesh generation;
3. Performing the Fluent analysis, and
4. Post-processing of results.
This tutorial will guide you step-by-step through these four procedures.
2 Laminar pipe flow
Consider a fluid flowing through a circular pipe of diameter D and length L as sketched below. The pipe diameter is D = 0.3m and the length of the pipe is L = 6m. The inlet velocity is constant over the cross-section and is equal to U = 1m/s. The fluid density is ρ = 1kg/m3 and the fluid viscosity is µ = 1.5 × 10−3 kg/ms. Note that these properties result in a Reynolds number of Re = ρUD/µ = 200 which means the flow is laminar. The outlet pressure po is equal to 1 atmosphere (standard pressure).
Solve this flow problem using ANSYS Fluent and present the following results:
● velocity vectors
● velocity magnitude contours
● velocity profiles
● skin friction coefficient along the pipe wall
Note that the physical problem of flow in a pipe is a 3D problem, however because the flow across any plane passing through the centreline of the pipe is identical we can model the flow in 2 Dimensions. Moreover because in this “slice” of dimensions D × L the flow is symmetrical around the centreline we only need to simulate the flow in one half of the plane of dimensions R × L (where R is the pipe radius). Flows which are symmetrical around a centreline are also called axisymmetric flows and by modelling it in 2D we save considerable computational resources compared to full 3D simulations.
2.1 Starting ANSYS workbench
Prior to opening ANSYS, create a folder (e.g. FluentCFD) on your H:drive (particularly if you use the VDI or campus-based machines) or your local harddrive. This folder will be used to store the files created during this session, and allows you to reopen them at a later stage. You will need approximately 10MB of free space for this tutorial, so make sure this space is available on your H:drive or local drive.
On your PC go to the ANSYS folder and and open the Workbench, e.g. if you use ANSYS v2023 R2 the workbench shortcut will be called Workbench 2023 R2. When opened, you should see a window as in the figure below.
This is the ANSYS workbench which consists primarily of the Toolbox area (left column) and the Project schematic in the main area. Above these areas you can find the usual toolbar and the menu bar. The main way to work in the workbench is to drag an item from you toolbox to a desired location in the Project schematic. Alternatively you can double-click any item in the Toolbox area and it will appear in the Project schematic, although you do not have any control over its location this way (it will appear on the next line). The Analysis Systems menu within the toolbox area contains all the necessary components to simulate a specific problem. So in the case of Fluid Flow (Fluent) (double-click) it contains the following collection of components to complete the fluid flow simulation: Geometry, Mesh, Setup, Simulation, Results. The components are automatically linked and you would normally work through these components from top to bottom (i.e. you cannot work on the Mesh before the Geometry is completed etc.). An example of this is object A in the project schematic in the figure below. Here we are going to set-up our simulation from the individual components in the Component Systems menu and establish the links between components ourselves. This gives us greater flexibility at later stages to link, for example, the same geometry to different meshes or to link the same mesh to different simulation set-ups. An example is shown in the figure below, where in the bottom part of the project schematic the geometry component B is linked to mesh components C and F, and mesh component F in turn is linked to Fluent setups G and I (do not create this now!).
2.2 Geometry (using DesignModeller)
2.2.1 Make a sketch
Now click the symbol in the Component Systems menu and drag the Geometry component to the Project schematic. Right click the (Geometry ? ) cell and select Properties. Change the value of Analysis type from the default value 3D into 2D as indicated below.
Right-click (Geometry ? ) again and select the second option New DesignModeler Geometry.
Note that we do not choose the default SpaceClaim option to make our geometry, SpaceClaim is ANSYS’s inbuild CAD software (similar to SolidWorks) which can be used to make very complex geometries, but, similar to SolidWorks, also requires more time to learn. Because in this course we will only use very simple geometries and because learning another CAD package is not the aim of this course, we are going to use the more basic DesignModeler.
The DesignModeler window will now have appeared. The main areas and toolbars that you will be using are displayed in the image below. We will use these expressions (i.e Tree outline, Details View etc.), to guide you trough the rest of the geometry section.
You will now create a sketch in the XY-plane. First select the XYplane in the Tree Outline on the left hand side of your window and click the New Sketch symbol in the sketch toolbar. Sketch1 should now appear under the XYPlane in your Tree Outline as shown below.
Next, in the Graphics Window in the coordinate system on the bottom right click on the Z-axis to obtain a 2-dimensional view of the XYPlane. Now go to the Sketching tab in the Tree Outline, select Rectangle and draw a rectangle in the Graphics Window by clicking first on the origin (a “P” will appear if you hover the mouse over the origin, this P indicates your mouse pointer is at a point of intersection, similarly a “C” will appear of your pointer is on a line - note that the P might be difficult to distinguish in this case since it is overlapped by both axes, the origin and your mouse pointer!). The dimensions of the rectangle (our “pipe”) do not matter at this stage - we will specify the dimensions in the next step.
2.2.2 Setting the dimensions
Now we will specify the dimensions of the rectangle, which only consist of a horizontal and vertical dimension. Select the Dimensions menu in the Sketching tab and select Vertical. In the Graphics window click once on the upper boundary of your rectangle and once on the lower boundary, then drag “V1” outside the left side of the rectangle and click once more. Note, the label ”V1” denotes the ”vertical1” where the number 1 indicates the sequence number in your dimensioning (so this would be 2 if you had decided to dimension the horizontal dimensions first). Repeat the procedure for the horizontal dimension by selecting Horizontal in the Dimensions menu and selecting the left and right boundaries of your rectangle.
Set the dimensions in the Details View table, located in the lower left corner. Remember that the flow is axisymmetric therefore we only needed to model a plane of height R = D/2 = 0.15m, therefore V1=0.15m, and length L = 6m, therefore H2=6m. Note that you can tidy up your dimensions labels if you select Move in the Dimensions menu and then reposition the labels closer to the edges with the mouse.
2.2.3 Creating the surface
Select the Sketch1 in the modelling tab of the Tree Outline, the four lines of your created rectangle should turn yellow. Now select Concept in the menu bar and select Surfaces from Sketches as shown below.
Click Apply in the Details View table in the lower left corner and click the Generate, button in the Feature Toolbar. Your created geometry should now look as follows
Now, we only need to tell the software that the surface we have created is part of the Fluid domain, and not the solid domain which it assumes by default. In the Tree Outline, select the 田 symbol next to 1 Part, 1 Body and select the Surface Body that was created. In the details view below change the domain to Fluid as shown below.
2.2.4 Save the project
Now that you have successfully created your pipe geometry you can close the DesignModeler window and return to your Workbench window. Note how a √ symbol has appeared in the Geometry cell, indicating that you have completed a geometry (if you had only drawn a single line the √ symbol would still have appeared, so it does not necessarily mean you have drawn a valid geometry!).
In the workbench you can save the project by clicking Save or Save As.., give your project a sensible name, e.g. LamPipeFlow and save it in your working directory on your H:drive. Note that not only the file LamPipeFlow.wbpj, is created within your working directory, but also the folder LamePipeFlow files. In order to open your project at a future occasion you will need both the *.wbpj file and the accompanying folder with its contents.
2.3 Geometry (using SpaceClaim)
2.3.1 Make a sketch
Now click the symbol in the Component Systems menu and drag the Geometry component to the Project schematic. Right click the Geometry cell and select Properties. Change the value of Analysis type from the default value 3D into 2D as indicated below.
Right-click Geometry again and select the second option New SpaceClaim Geometry.
To start a sketch in the XY-plane, click Select New Sketch Plane at the bottom of the main window.
Next, in the graphics area click somewhere in the area defined by the positive x- and y- axes.
To orient the view face-on to the XY-plane, click Z on the orientation axes in the bottom left of the window. To sketch a rectangle, in the toolbar above, go to Sketch→ Create→ Rectangle, click on the origin, drag in the positive x- and y-directions to make a rectangle, and click again:
2.3.2 Setting the dimensions
To dimension the rectangle, goto Sketch→ Constraints→ Dimension, single-click the left side of the rectangle, then place the dimension somewhere outside your rectangle with another single- click. Double click the dimension value and change the value to 0.15m (recall that the flow is axisymmetric, therefore we only needed to model a cross-section of height R = D/2 = 0.15m.). Repeat the same procedure to dimension the horizontal dimension to 6m. Once you have dimensioned both sides of the rectangle click End Sketch Editing. The sketch will automatically be converted to a surface which can be used to create your mesh.
2.3.3 Save the project
Now that you have successfully created your pipe geometry you can close the SpaceClaim window and return to your Workbench window. Note how a √ symbol has appeared in the Geometry cell, indicating that you have completed a geometry (if you had only drawn a single line the √ symbol would still have appeared, so it does not necessarily mean you have drawn a valid geometry!).
In the workbench you can save the project by clicking Save or Save As.., give your project a sensible name, e.g. LamPipeFlow and save it in your working directory on your H:drive. Note that not only the file LamPipeFlow.wbpj, is created within your working directory, but also the folder LamePipeFlow files. In order to open your project at a future occasion you will need both the *.wbpj file and the accompanying folder with its contents.
2.4 Mesh generation
2.4.1 Launching the meshing window
Drag the Mesh component from the Component Systems menu to the Project Schematic. Estab- lish a link between the geometry and mesh, by dragging the Geometry cell from your Geometry component table,to Geometry in the Mesh component table. A line will be established between the two and the √ symbol will appear next to Geometry in the Mesh component box. Now the Mesh needs to be made aware of the added geometry: right-click the Mesh cell and select Refresh, after about 5-10s the refreshing procedure is complete and a lightning bolt symbol will appear next to the Mesh.
Now right-click Mesh and select Edit (or double-click Mesh), this will open the Meshing window. Note that toolbar outline of the Mesher is slightly different from that of DesignModeller which you used to create your geometry. Instead of displaying all the toolbars in your main screen, the various toolbars now appear as tabs in the menu bar from which you can select them. Commonly used toolbars (display/rotation/select) are still shown at the top of the graphics window. Below the geometry you will now also see a messages window which displays any error messages that might result from your actions (keep an eye out for error messages!).
2.4.2 Creating named selection
Before we generate the mesh we will first give names to the four edges of our geometry. This will allow us to recognise the edges more easily and assign boundary conditions in the Fluent solver later on.
Click the edge tool symbol in the selection toolbar and click on the left edge of your geometry in the Geometry Window. Right-click on the green highlighted line and select Create Named Selection as shown below. Note that you can zoom in and change the view of your geometry using the various magnifying glass tools in the rotation mode toolbar at the top of your window. To restore the view of your entire geometry click the zoom to fit symbol .
Give the boundary the name Inlet in the Selection name window that appears. Repeat the procedure to name the upper (Pipewall), right (Outlet) and lower (Centreline) boundaries. Your four named boundaries should now have appeared under the Named Selections item in the Tree Outline. Finally, we are also going to name the interior part of our domain: click on the named selection in the Project Tree and then choose the face select tool , click on the geometry such that it highlights green, now you can rightclick on the surface and rename it to flow domain by selecting Create Named Selection. . . .
You can display the named selections in your geometry by clicking Named Selections and chang- ing the Show Annotations to “yes” in the Details View table as shown below.
2.4.3 Creating a uniform structured Mesh
Before we do anything to the mesh we first want to tell the Meshing software that we are dealing with a CFD problem, since by default it assumes (again) that we are solving a mechanical problem. Select mesh in the Tree Outline, then in the Details View below set the Physics Preference to CFD. Note that the solver preference will automatically be set to Fluent.
Now we are going to create a structured or grid style mesh on a selected face, in this case our pipe. Right-click Mesh in the Tree Outline, select Insert and then select Face Meshing from the drop-down menu, as shown below (alternatively, you can select Face Meshing from the Mesh Control toolbar indicated below).
After clicking face meshing you will see in the Details View that the Geometry box is highlighted in yellow and indicates “No selection”, this means that we still have to indicate to which surface we need to apply the Face Mesh. In our case the Geometry will be the pipe surface, so therefore click on the pipe face in the Geometry Window, the surface should should highlight green. Now go to the Details View of the face meshing menu and click on no selection in the yellow Geometry cell, then click Apply. The Geometry cell should now list 1 Face and our pipe surface selected face should have turned blue in colour.
Now that the mesh is specified we still need to generate the mesh: right-click Mesh in the Tree Outline, and select Generate Mesh. Great, we have now created our default mesh, which can be seen if you select Mesh in the Tree Outline. The mesh should look as shown below. The squares are called “elements” in ANSYS, or often they are referred to as (computational) “cells”, and the corners of the cells are called the “nodes” . The cells are essentially our Control Volumes whereby the unknowns (for velocity, pressure, energy etc.) are calculated at the cell centres.
2.4.4 Edge sizing
Our default mesh consists of 20 elements or cells and 42 nodes (this can be seen in the Details View of “Mesh” by double-clicking on statistics Statistics - note that you may have a different number of cells and nodes, this doesn’t matter). This is a rather coarse mesh, in particular in the vertical (radial) direction where we only have one cell. Therefore let’s increase the mesh to say 600 elements, 8 in the vertical and 75 in the horizontal. We can achieve this by specifying the number of divisions on the edges of our geometry. We will start by specifying the number of divisions at the Pipewall and the Centreline. Click Mesh in the mesh toolbar and select Sizing highlighted in red box below:
Now, make sure that you have the edge tool selected, then hold down the Ctrl-key and select the top and bottom edge of your geometry, which should highlight green, then click Apply in the Details View table as follows:
By clicking Type from default Element Size to Number of Divisions and clicking Behaviour from default soft to hard, then Change the cells in the Details View table as follows:
Click the update button in the mesh toolbar to update your mesh. Now repeat the pro-
cess to apply 8 divisions to the left (inlet) and right (outlet) boundaries of your pipe.
Select Mesh in the Tree Outline to view your created mesh, which should look as below. Verify in the Details of Mesh table that your mesh contains the required 600 elements. (Note that by changing the sizing behaviour from soft to hard has forced the divisions along an edge to be of equal size. At this stage you can check yourself what effect the behaviour setting has on your mesh ).
NOTES: If hard vs. soft behaviour for mesh sizing isn’t available, you first must change Capture Curvature from Yes to No. This makes the Behaviour box appear.
Save your project and close the Meshing window, then in your Workbench click the button and make sure to save your project once more.