OpenFOAM-version-7/C2/Creating-3D-Pipe-Geometry-and-Mesh-in-OpenFOAM/English
Title of the script: Creating 3D Pipe Geometry and Mesh in OpenFOAM
Author: Divyesh Variya
Keywords: OpenFOAM, 3D-Geometry, Pipe, Meshing, ParaView, Pre-Processing, Video-Tutorial, blockMesh
Visual Cue | Narration |
Slide: Opening slide | Welcome to this tutorial on Creating 3D Pipe 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: Prerequisites
|
As a prerequisite:
|
Slide: Code Files |
|
Slide: Hagen Poiseuille flow through a pipe |
|
Slide: Pipe Geometry |
|
CTRL + ALT + T | Open the terminal by pressing Ctrl, Alt & T keys. |
[Terminal] Type:
cd $FOAM_RUN |
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. |
[Terminal] Type:
cp -r $FOAM_TUTORIALS/incompressible/icoFoam/cavity/cavity pipe |
Let us now copy the cavity case from the icoFoam TUTORIAL directory to the RUN directory.
Type the following command to do so. |
[Terminal] Highlight: pipe | Note that the cavity case is copied to the pipe directory. |
[Terminal] Type:
mv pipe/0 pipe/0.Orig |
In this tutorial we don’t need to define initial and boundary conditions in 0 time.
Type this command to rename 0 folder to 0 dot O r i g |
[Terminal] Type:
gedit pipe/system/blockMeshDict |
The blockMeshDict file is located in the system folder.
Open this file in a text editor. I am doing it in the gedit text editor. |
[gedit - blockMeshDict] | Now we can see the blockMeshDict file in the text editor. |
[gedit - blockMeshDict] Highlight
Selection in the Text Editor >> Delete |
Delete the lines from convertToMeters to the end of the file as shown here.
The remaining content is common for all blockMeshDict files. |
[gedit - pipe] | Next, open the pipe.txt file that you had downloaded in the text editor. |
[gedit - blockMeshDict] Highlight
Selection in the Text Editor >> Copy |
Copy the entire content of the text file. |
[gedit - blockMeshDict] | Now switch back to the blockMeshDict file. |
[gedit - blockMeshDict]
Paste |
And paste the copied contents into the blockMeshDict file as shown. |
[gedit - blockMeshDict] Highlight
0.01 |
Note that all the dimensions will be in centimeters. |
Slide: Vertices Detail |
|
[gedit - blockMeshDict] Highlight
Selection in the Text Editor >> vertices |
All 18 points are defined in the vertices section, in the blockMeshDict file as shown. |
Only Narration | Now let me switch back to the Slides. |
Slide: Block Detail |
|
Slide: Block Detail
Highlight: hex (1 2 3 4 9 10 11 12) (8 8 80) simpleGrading (1 1 1) |
An example is shown in the slide.
The same block can be defined correctly in more than one way. |
Slide: Block Detail
Highlight: (8 8 80) |
To generate 3D mesh we are using:
|
[gedit - blockMeshDict] Highlight
Selection in the Text Editor >> blocks |
Other four blocks are defined in the blockMeshDict file as shown. |
Slide: Geometry Arc Detail | For the curved geometry, we need to define the edges. |
Slide: Geometry Arc Detail |
|
Slide: Geometry Arc Detail
Highlight: arc 5 6 (0 0.5 0) |
For example, the edge from point number 5 to 6 is passing through (0 0.5 0). |
[gedit - blockMeshDict] Highlight
Selection in the Text Editor >> edges |
All 16 arcs are defined in the edges section in the blockMeshDict file as shown. |
[gedit - blockMeshDict] Highlight
arc 5 6 (0 0.5 0) |
The curved edge connecting points 5 and 6 is defined as shown. |
[gedit - blockMeshDict] Highlight
arc |
The edge is an arc. |
[gedit - blockMeshDict] Highlight
5 6 |
Its two end points are 5 and 6. |
[gedit - blockMeshDict] Highlight
(0 0.5 0) |
The coordinates of the point through which the arc passes through is 0, 0.5, 0 |
Only Narration | Let’s label the boundary patches.
The boundary faces should be labelled appropriately. The labels are used to impose boundary conditions on the respective faces. |
[gedit - blockMeshDict] Highlight
Selection in the Text Editor >> inlet |
The inlet boundary is defined as shown. |
[gedit - blockMeshDict] Highlight
Selection in the Text Editor >> |
The inlet boundary has 5 faces.
These faces are defined as shown. |
[gedit - blockMeshDict] Highlight
Selection in the Text Editor >> outlet and wall |
The outlet and wall boundary is defined as shown. |
Only Narration | Note that all boundaries have more than one face. |
[gedit - blockMeshDict] Highlight
Selection in the Text Editor >> mergePatchPairs |
We do not have any patches or internal faces to merge.
Therefore, we leave the mergePatchPairs field empty. |
CTRL+S >> Close Text Editor | Now, save the blockMeshDict file and close the text editor. |
[Terminal] Type:
cd pipe |
Now, go to the terminal and navigate to the pipe directory. |
[Terminal] Type:
blockMesh |
Type blockMesh command and press Enter. |
[Terminal] Highlight
End |
The meshing is now complete. |
[Terminal] Highlight
Patches section |
As we can see in terminal results, three patches are created. |
[Terminal] Type:
checkMesh |
Now, let’s check mesh results and quality.
To do that type checkMesh in the terminal and press Enter. Note that M in checkMesh is capital. |
Only Narration | We get the results printed of the mesh we created. |
[Terminal] Highlight
Max skewness = 0.6954 OK. Non-orthogonality check OK. Max aspect ratio = 30.3404 OK.
|
Here we can see:
In our case, no negative volume is present.
|
[Terminal] Highlight
Overall number of cells of each type: hexahedra: 25600 prisms: 0 wedges: 0 pyramids: 0 tet wedges:0 tetrahedra:0 polyhedra: 0 |
|
[Terminal] Type paraFoam | To view mesh in paraview type paraFoam and press Enter. |
[ParaView] Click
Apply |
Click on Apply on the left side of your window in the Properties tab.
Now you can see pipe geometry in the Layout window. |
[ParaView] Rotate geometry | You can rotate geometry in the Layout window by pressing the left mouse button and dragging. |
[ParaView]
Click on Surface >> Click on Surface with Edges |
Click on Surface available in the Active Variable Controls.
Then change it to Surface with Edges. |
[ParaView]
|
Click on vtkBlockColors available in the Active Variable Controls.
And change it to SolidColor. You can now see the mesh structure of pipe geometry that we created. |
[ParaView] Close ParaView | You can close the ParaView window. |
Only Narration | With this we have come to the end of the tutorial. |
Slide: Summary | To summarize, in this tutorial we have learnt to,
|
Slide: About the Spoken Tutorial Project | The video at the following link summarises the Spoken Tutorial project.
Please download and watch it. |
Slide: Spoken Tutorial Workshops | We conduct workshops using Spoken Tutorials and give certificates.
Please contact us. |
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.
The script for this tutorial is contributed by Divyesh Variya. And this is Swetha Sridhar from IIT Bombay signing off. Thank you for joining. |