OpenFOAM-version-7/C2/Creating-2D-Channel-Geometry-and-Mesh-in-OpenFOAM/English
Title of the script: Creating 2D Channel Geometry and Mesh in OpenFOAM
Author: Ashley Melvin
Keywords: OpenFOAM, ParaView, channel flow, blockMesh, meshing, structured mesh, graded mesh, pre-processing, video tutorial
Visual Cue | Narration |
Slide: Opening Slide | Hello and welcome to this tutorial on Creating 2D Channel Geometry and Mesh in OpenFOAM. |
Slide: Learning Objective | In this tutorial, we will learn to:
|
Slide: System Specifications | To record this tutorial, I am using,
You may use any other editor of your choice. |
Slide: Code Files |
|
Slide: 2D Channel Flow | The problem description of 2D flow in a channel is as shown in the diagram. |
Slide: Channel Geometry | This is the geometry for 2D flow in a channel. |
Slide: Faces | The faces of the geometry are:
|
CTRL + ALT + T | Open the terminal by pressing Ctrl, Alt & T keys. |
[Terminal] Type:
|
At the prompt, type the following command to go to the RUN directory. |
Only Narration | Here onwards, please remember to press the Enter key after typing each command in the terminal. |
[Terminal] Type:
|
Let us now copy the case of flow in a channel from the TUTORIALS directory into the RUN directory.
|
[Terminal] Type:
|
We will only be creating and meshing the geometry.
|
[Terminal] Type:
|
The blockMeshDict file is located in the system folder.
|
[gedit - blockMeshDict] | We can now see the blockMeshDict file. |
[gedit - blockMeshDict] Highlight
|
Select the contents of the file from vertices to the end of the document, as shown.
|
[gedit - blockMeshDict] Highlight
|
The unit of the coordinates entered in the blockMesh dictionary needs to be specified.
|
[gedit - channel] | Open the channel.txt file, that you had downloaded, in a text editor. |
[gedit - channel] Highlight
|
Copy the entire content of the text file. |
[gedit - blockMeshDict] | Let me switch back to the blockMeshDict file. |
[gedit - blockMeshDict]
Paste |
Paste the copied contents into the blockMeshDict file as shown. |
Slide: Vertices | The vertices of the channel geometry are numbered as indicated.
|
[gedit - blockMeshDict] Highlight
|
The coordinates of the vertices are entered as shown.
|
[gedit - blockMeshDict] Highlight:
|
Vertex 0 is located at the origin.
|
[gedit - blockMeshDict] Highlight:
|
The x, y and z coordinates of vertex 1 are 4, 0 and 0 respectively.
|
[gedit - blockMeshDict] Highlight
|
Similarly, the coordinates of vertex 2 and 3 are entered as shown. |
Only Narration | The z coordinate of all the points on the front face is 2. |
[gedit - blockMeshDict] Highlight
|
The coordinates of front face vertices 4, 5, 6 and 7 are entered as shown. |
Only Narration | For meshing, OpenFOAM requires 3-dimensional blocks to be defined.
|
[gedit - blockMeshDict] Highlight:
|
We use a single block in our geometry.
|
[gedit - blockMeshDict] Highlight:
|
We use hexahedral blocks for meshing. |
Only Narration | The order in which the vertices are specified, define the block.
|
[gedit - blockMeshDict] Highlight:
|
The vertices of the back face are defined as shown. |
[gedit - blockMeshDict] Highlight:
|
The vertices of the front face are entered in the same order as that of the back face. |
Only Narration | Let us start defining the meshing parameters of the block.
|
[gedit - blockM, eshDict] Highlight:
|
The number of cells in each direction is defined as shown.
|
[gedit - blockMeshDict] Highlight:
|
There is only one cell along z direction indicating that the simulation is 2D in xy-plane. |
[gedit - blockMeshDict] Highlight:
|
Next, let us define how the mesh is graded.
|
[gedit - blockMeshDict] Highlight:
|
Let us now define the expansion ratios in each direction.
|
Narration only. | Please refer to the "Additional Reading Material" on this tutorial page for details.
It has more details on defining a block. |
Only Narration | Now, let us define the edges.
|
[gedit - blockMeshDict] Highlight:
|
Since all the edges of channel geometry are straight lines, we leave it empty. |
Only Narration | Let us label the boundary patches.
|
[gedit - blockMeshDict] Highlight:
|
Boundary labels are defined using the boundary list. |
[gedit - blockMeshDict] Highlight:
|
The bottom face of the geometry is named bottomWall. |
[gedit - blockMeshDict] Highlight:
|
The patch type of the boundary is defined using the keyword type. |
[gedit - blockMeshDict] Highlight:
|
The bottom face resembles the characteristics of a solid wall.
|
[gedit - blockMeshDict] Highlight:
|
Vertices define a face.
|
Slide: Bottom Wall | Since the block face is a quadrilateral, it is defined by 4 vertices.
|
[gedit - blockMeshDict] Highlight:
|
Keeping this in mind, the vertices of the bottom wall are ordered as shown. |
[gedit - blockMeshDict] Highlight:
|
Following the same convention, the top face is named topWall and is defined as shown. |
Only Narration | We are creating the geometry for a 2D simulation in xy-plane.
|
[gedit - blockMeshDict] Highlight:
|
The back and front faces are defined as shown. |
Only Narration | The inlet and outlet faces need the application of boundary condition.
|
[gedit - blockMeshDict] Highlight:
|
Such generic boundaries are labelled using the keyword patch. |
[gedit - blockMeshDict] Highlight:
|
The inlet and outlet faces are defined as shown. |
Only Narration | We have finished labelling all the boundary patches. |
[gedit - blockMeshDict] Highlight:
|
Next, we merge faces using the mergePatchPairs field.
|
[gedit - blockMeshDict] Highlight:
|
Our geometry has only one block and there are no patches to merge.
|
[gedit - blockMeshDict]
|
We have entered all the necessary fields.
|
[Terminal] Type:
|
In the terminal, type cd (space) channel395. |
[Terminal] Type:
|
Let us mesh the geometry.
|
[Terminal] Highlight: End | The meshing is complete. |
[Terminal] Type:
|
To view the mesh in ParaView, type paraFoam and press Enter. |
[ParaView]
|
Click on the green coloured Apply on the left side of your window in the Properties tab. |
[ParaView]
|
Click on Surface available in the Representation Toolbar and change it to Surface with Edges.
|
[ParaView] Close the window | Close the ParaView window. |
Only narration | With this we have come to the end of the tutorial.
|
Slide: Summary | In this tutorial, we have learnt to:
|
Slide: Assignment | As an assignment:
|
Slide: About the Spoken Tutorial Project | The video at the following link summarises the Spoken Tutorial project.
|
Slide: Spoken Tutorial Workshops | We conduct workshops using spoken tutorials and give certificates.
|
Slide: Spoken Tutorial Forum | Please post your timed queries in this forum. |
Slide: FOSSEE Forum |
|
Slide: FOSSEE Case Study Project |
|
Slide: Spoken Tutorial | The Spoken Tutorial project is supported by MHRD, Govt. of India.
|