OpenFOAM-version-7/C2/Creating-2D-Channel-Geometry-and-Mesh-in-OpenFOAM/English-timed

From Script | Spoken-Tutorial
Jump to: navigation, search
Time Narration
00:01 Hello and welcome to this tutorial on Creating 2D Channel Geometry and Mesh in OpenFOAM.
00:08 In this tutorial, we will learn to:

Create a 2D channel geometry using blockMeshDict

00:17 Mesh a geometry
00:20 Label the boundary patches, and View the mesh in ParaView
00:27 To record this tutorial, I am using,

Ubuntu Linux OS version 18.04

00:36 OpenFOAM version 7
00:39 ParaView version 5.6.0, and gedit Text Editor
00:47 You may use any other editor of your choice.
00:51 The files used in this tutorial are available in the Code Files link on this tutorial page
00:59 Please download and extract them
01:02 Make a copy and then use them while practising
01:07 The problem description of 2D flow in a channel is as shown in the diagram.
01:14 This is the geometry for 2D flow in a channel.
01:19 The faces of the geometry are: Inlet and outlet
01:25 Bottom and top walls
01:28 Back face, and Front face
01:32 Open the terminal by pressing Ctrl, Alt & T keys.
01:38 At the prompt, type the following command to go to the RUN directory.
01:45 Here onwards, please remember to press the Enter key after typing each command in the terminal.
01:52 Let us now copy the case of flow in a channel from the TUTORIALS directory into the RUN directory.
02:00 Type the following command to do so.
02:05 We will only be creating and meshing the geometry.
02:09 Hence, we do not need the boundary conditions folder.
02:13 Type the following command to delete the boundary conditions folder.
02:18 The blockMeshDict file is located in the system folder.
02:23 Let us open it in any text editor.
02:27 I am doing it in gedit Text Editor.
02:31 We can now see the blockMeshDict file.
02:35 Select the contents of the file from vertices to the end of the document, as shown.
02:42 We don’t need the selected content as we will be entering the input parameters.

Hence, delete the selected section.

02:52 The remaining content is common for all blockMeshDict files.
02:57 The unit of the coordinates entered in the blockMesh dictionary needs to be specified.
03:04 It is defined using the keyword convertToMeters.
03:09 The value 1 indicates that the values of all the coordinates are in meters.
03:17 Open the channel.txt file, that you had downloaded, in a text editor.
03:23 Copy the entire content of the text file.
03:27 Let me switch back to the blockMeshDict file.
03:32 Paste the copied contents into the blockMeshDict file as shown.
03:40 The vertices of the channel geometry are numbered as indicated.
03:46 The vertex numbering starts from 0.
03:50 The coordinates of the vertices are entered as shown.
03:55 Note that the vertices are entered in the ascending order of their vertex numbers.
04:01 Vertex 0 is located at the origin.
04:05 Its coordinates are entered as shown.
04:09 The x, y and z coordinates of vertex 1 are 4, 0 and 0 respectively.
04:18 Its coordinates are entered as shown.
04:22 Similarly, the coordinates of vertex 2 and 3 are entered as shown.
04:29 The z coordinate of all the points on the front face is 2.
04:35 The coordinates of front face vertices 4, 5, 6 and 7 are entered as shown.
04:44 For meshing, OpenFOAM requires 3-dimensional blocks to be defined.
04:51 The blocks are specified using the vertices that define them.
04:57 We use a single block in our geometry.
05:01 The block is defined as shown.
05:05 We use hexahedral blocks for meshing.
05:10 The order in which the vertices are specified, define the block.
05:16 We first enter the vertices of the lower xy-plane, in this case, the back face.
05:24 We start from the origin and enter the vertices of the face.
05:29 When viewed along the negative z-direction, the vertices should be ordered counterclockwise.
05:37 The vertices of the back face are defined as shown.
05:41 The vertices of the front face are entered in the same order as that of the back face.
05:48 Let us start defining the meshing parameters of the block.
05:53 We first define the number of cells in each direction of the block.
05:59 The number of cells in each direction is defined as shown.
06:04 This indicates that there are 40 cells in x direction and 25 cells in y direction.
06:13 There is only one cell along z direction indicating that the simulation is 2D in xy-plane.
06:22 Next, let us define how the mesh is graded.
06:27 We use simpleGrading as the cells have uniform expansion in all directions.
06:34 Let us now define the expansion ratios in each direction.
06:39 Expansion ratio along a direction is the ratio of width of the end cell to that of the start cell in that direction.
06:50 Since the cell width is uniform in all directions, the expansion ratio is 1.
06:57 Please refer to the "Additional Reading Material" on this tutorial page for details.

It has more details on defining a block.

07:07 Now, let us define the edges.
07:11 Edges are used to define arc or spline edges.
07:17 Since all the edges of channel geometry are straight lines, we leave it empty.
07:23 Let us label the boundary patches.
07:26 The labels are used to impose boundary conditions on the respective faces.
07:32 Boundary labels are defined using the boundary list.
07:37 The bottom face of the geometry is named bottomWall.
07:42 The patch type of the boundary is defined using the keyword type.
07:48 The bottom face resembles the characteristics of a solid wall.

Hence, the face is of the type wall.

07:57 Vertices define a face.
08:00 The vertices and their order for a face, is defined using the keyword faces.
08:07 Since the block face is a quadrilateral, it is defined by 4 vertices.
08:14 When viewed from inside the block, the vertices of the face should be ordered clockwise.
08:21 Keeping this in mind, the vertices of the bottom wall are ordered as shown.
08:28 Following the same convention, the top face is named topWall and is defined as shown.
08:36 We are creating the geometry for a 2D simulation in xy-plane.
08:42 We do not need to solve in the z direction.

Hence, we keep the front and back faces empty.

08:51 The back and front faces are defined as shown.
08:56 The inlet and outlet faces need the application of boundary condition.
09:02 Since they do not contain any geometric or topological information, a generic label would suffice.
09:10 Such generic boundaries are labelled using the keyword patch.
09:16 The inlet and outlet faces are defined as shown.
09:21 We have finished labelling all the boundary patches.
09:25 Next, we merge faces using the mergePatchPairs field.
09:31 We merge faces when a patch face from one block is connected to a patch face of another block.
09:39 Our geometry has only one block and there are no patches to merge.
09:45 Therefore, we leave the mergePatchPairs field empty.
09:51 We have entered all the necessary fields.

Save and close the file.

09:58 In the terminal, type cd (space) channel395.
10:05 Let us mesh the geometry.
10:08 Type blockMesh and press Enter to do so.
10:13 The meshing is complete.
10:16 To view the mesh in ParaView, type paraFoam and press Enter.
10:24 Click on the green coloured Apply on the left side of your window in the Properties tab.
10:31 Click on Surface available in the Representation Toolbar and change it to Surface with Edges.
10:40 You can now see the mesh structure of the front face.
10:45 Close the ParaView window.
10:48 With this we have come to the end of the tutorial.

Let us summarize.

10:55 In this tutorial, we have learnt to: Create a 2D channel geometry using blockMeshDict
11:03 Mesh a geometry

Label the boundary patches, and

11:08 View the mesh in ParaView
11:11 As an assignment: Create a geometry having dimensions 5 metres, 4 metres and 3 metres along x, y and z axis
11:24 Mesh the geometry such that it has 50, 40 and 1 cell along x, y and z axis, and
11:35 View the mesh in ParaView
11:38 The video at the following link summarises the Spoken Tutorial project.

Please download and watch it.

11:46 We conduct workshops using spoken tutorials and give certificates.

Please contact us.

11:54 Please post your timed queries in this forum.
11:59 Do you have any general/technical questions?

Please visit the forum given in this link.

12:07 The FOSSEE team coordinates solving feasible CFD problems of reasonable complexity using OpenFOAM.
12:16 We give honorarium and certificates to those who do this.

For more details, please visit these sites.

12:25 The Spoken Tutorial project is supported by MHRD, Govt. of India.

The script for this tutorial is contributed by Ashley Melvin.

12:36 And this is Swetha Sridhar from IIT Bombay signing off.

Thank you for joining.

Contributors and Content Editors

PoojaMoolya