OpenFOAM-version-7/C2/Creating-3D-Pipe-Geometry-and-Mesh-in-OpenFOAM/English

From Script | Spoken-Tutorial
Revision as of 15:23, 21 July 2020 by Nancyvarkey (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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:
  • Create a 3D geometry using blockMeshDict
  • Mesh a 3D geometry
  • Label the boundary patches
  • Check the mesh results using checkMesh command and
  • View the 3D geometry and mesh in ParaView
Slide: System Specifications To record this tutorial, I am using,
  • Ubuntu Linux OS version 18.04
  • OpenFOAM version 7
  • ParaView version 5.6.0 and
  • gedit Text editor

You may use any other editor of your choice.

Slide: Prerequisites As a prerequisite:
  • You should be familiar with creation of a basic geometry using the blockMesh utility.
  • If you are not, please go through the prerequisite OpenFOAM tutorial on this website.
Slide: Code Files
  • The files used in this tutorial are available in the Code Files link on this tutorial page
  • Please download and extract them
  • Make a copy and then use them while practising
Slide: Hagen Poiseuille flow through a pipe
  • In this tutorial, we will learn to create the geometry for Hagen Poiseuille flow through a pipe.
  • The problem description of Hagen Poiseuille flow through a pipe is shown in the diagram.
Slide: Pipe Geometry
  • This is the diagram of the geometry for Hagen Poiseuille flow through a pipe.
  • The left and right faces are the inlet and outlet respectively.
  • The cylindrical face of the geometry is a wall.
  • The diameter of the pipe is 1 centimeter and its length is 30 centimeters.
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
  • Vertices are shown in the slide.
  • Here we are going to use 18 vertices to define the geometry of a pipe.
  • For example, two reference points 0 and 17 are on (0 0 0) and (0 0 30) respectively.
[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
  • Here we will use 5 hexahedral blocks to define the pipe geometry.
  • As you can see, the center hexahedral block is separately shown in the figure on the right.
  • To define this block, we need to type the back plane’s vertices first.
  • The vertices should be ordered anti-clockwise when viewed along the negative z-axis.
  • The front plane’s vertices should also follow the same order.
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:
  • 8 cells in X direction,
  • 8 cells in Y direction and
  • 80 cells in Z direction.
[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
  • There are a total of 16 arcs that we need to define.
  • The arcs and the intermediate points are shown in the slide.
  • Note that I have used the midpoint of the arc as the intermediate point.
  • However, any other point through which the arc passes is acceptable.
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.



Overall domain bounding box

Here we can see:
  • Skewness
  • Orthogonality
  • Aspect ratio
  • Negative volume values if they are present

In our case, no negative volume is present.

  • Bounding box coordinates and
[Terminal] Highlight

Overall number of cells of each type:

hexahedra: 25600

prisms: 0

wedges: 0

pyramids: 0

tet wedges:0

tetrahedra:0

polyhedra: 0

  • Number of cells with their types.
[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 >> SolidColor

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,
  • Create a 3D geometry using blockMeshDict
  • Mesh a 3D geometry
  • Label the boundary patches
  • Check the mesh results using checkMesh command and
  • View the 3D geometry and mesh in ParaView
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
  • Do you have any general/technical questions?
  • Please visit the forum given in this link.
Slide: FOSSEE Case Study Project
  • The FOSSEE team coordinates solving feasible CFD problems of reasonable complexity using OpenFOAM.
  • We give honorarium and certificates to those who do this.
  • For more details, please visit these sites.
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.

Contributors and Content Editors

Divyesh7, Nancyvarkey