Difference between revisions of "OpenFOAM/C3/Importing-mesh-file-in-OpenFOAM/English"

From Script | Spoken-Tutorial
Jump to: navigation, search
 
(One intermediate revision by one other user not shown)
Line 10: Line 10:
 
|| '''Slide 2''' : '''Learning Objectives'''
 
|| '''Slide 2''' : '''Learning Objectives'''
  
|| In this tutorial, you will learn how to:
+
|| In this tutorial, you will learn to:
 
* import '''Mesh files'''
 
* import '''Mesh files'''
 
* from a meshing software
 
* from a meshing software
Line 16: Line 16:
  
 
|-
 
|-
|| '''Slide 3 ''' : '''Pre-requisite'''
+
|| '''Slide 3''': '''System Requirement'''
 
+
|| As a pre-requisite, the user should know how to generate a Mesh in software
+
like -'''Gambit, Ansys ICEM , CFX, Salome etc'''.
+
 
+
 
+
|-
+
|| '''Slide 4''': '''System Requirement'''
+
  
 
|| To record this tutorial I am using
 
|| To record this tutorial I am using
Line 31: Line 24:
  
 
|-
 
|-
|| Slide 5:.
+
|| '''Slide 4 ''' : '''Pre-requisite'''
  
|| Using '''blockMesh''', we can easily make '''simple''' geometries.
+
|| As a pre-requisite, the user should know how to generate a Mesh in software like -
For example- '''pipe, box,''' etc.
+
 
 +
'''Gambit, Ansys ICEM , CFX, Salome etc'''.
  
 
|-
 
|-
||Narration, no visual cue
+
|| Slide 5:
  
||It is difficult to create complex geometries using '''blockMesh'''.
+
||  
 +
*Using '''blockMesh''', we can easily make '''simple''' geometries.
  
But '''OpenFOAM''' supports importing '''mesh''' from third party meshing
+
*For example- '''box, pipe''' etc.
software.
+
 
 +
*It is difficult to create complex geometries using '''blockMesh'''.
  
 
|-
 
|-
 +
||Slide 6:
 
||
 
||
 +
*But '''OpenFOAM''' supports importing '''mesh''' from third party '''meshing''' software.
  
||There are '''commands''' available in '''OpenFOAM''', to import these mesh files.
+
*There are '''commands''' available in '''OpenFOAM''', to import these '''mesh''' files.
  
We will now learn how to '''import''' these files
+
|-
 +
||
 +
||We will now learn to '''import''' these files.
  
 
|-
 
|-
||Slide 7 : geometry for the case
+
||Slide 7 : Geometry for the case
 
  Point over the square cylinder
 
  Point over the square cylinder
 
  point over its length and height
 
  point over its length and height
Line 67: Line 67:
 
*We are solving this for a '''Reynolds Number (Re)''' = 100
 
*We are solving this for a '''Reynolds Number (Re)''' = 100
  
*The '''domain''' chosen is '''40''' by '''60'''
+
*The '''domain''' chosen is '''40'''m by '''60'''m
  
 
*The '''Boundary conditions are as shown in the diagram'''
 
*The '''Boundary conditions are as shown in the diagram'''
Line 74: Line 74:
 
||Slide 8 :
 
||Slide 8 :
  
||This is the '''mesh''' file generated in a '''meshing''' software
+
||This is the '''mesh''' file generated in a '''meshing''' software.
  
 
|-
 
|-
Line 81: Line 81:
 
>icoFoam
 
>icoFoam
  
||In your '''OpenFOAM working directory''',
+
||In your '''OpenFOAM working directory''', go to the '''icoFoam solver''' and click on it.
 
+
go to the '''icoFoam solver''' and click on it
+
  
 
|-
 
|-
Line 93: Line 91:
 
||Type cd (space) ..
 
||Type cd (space) ..
  
||Go one level back
+
||Now go to the '''cavity case'''.
  
 
|-
 
|-
Line 99: Line 97:
 
cavity folder in icoFoam
 
cavity folder in icoFoam
  
||Copy the '''0 and system''' folders from the cavity case.
+
||Copy the '''0 and system''' folders from the '''cavity''' case.
  
 
|-
 
|-
||Paste it in cylinder folder
+
||Paste it in '''cylinder''' folder
  
||Then paste it inside the '''cylinder''' folder.
+
||Paste it inside the '''cylinder''' folder.
  
 
|-
 
|-
 
||No constant folder
 
||No constant folder
  
||Note that you do not need the '''constant''' folder.
+
||Note that, you do not need the '''constant''' folder.
  
 
|-
 
|-
||Point over the .msh file on the
+
||Point over the '''.msh''' file on the desktop
desktop
+
  
||On my '''desktop''', I have a '''Fluent mesh file''' with a '''.(dot) msh''' extension
+
||On my '''desktop''', I have a '''Fluent mesh file''' with a '''.(dot) msh''' extension.
  
 
It is named as '''cylmesh.msh'''
 
It is named as '''cylmesh.msh'''
Line 122: Line 119:
 
||Copy-and-paste >> cylinder folder.
 
||Copy-and-paste >> cylinder folder.
  
||Copy-and-paste this file in the '''cylinder''' folder in icoFoam.
+
||Copy-and-paste this file in the '''cylinder''' folder in '''icoFoam'''.
Our setup is now ready
+
 
 +
 
 +
Our setup is now ready.
  
 
|-
 
|-
 
||Ctrl+Alt+t keys simultaneously
 
||Ctrl+Alt+t keys simultaneously
  
||Open a '''command terminal''' and press '''Enter'''.
+
||Open the '''command terminal'''.
  
 
|-
 
|-
Line 136: Line 135:
  
 
|-
 
|-
||Type Incompressible and press
+
||
 +
||Type '''cd tutorials'''; press '''Enter'''.
 +
 
 +
|-
 +
||Type incompressible and press
 
Enter
 
Enter
  
||Type '''Incompressible''' and press '''Enter'''
+
||Type '''cd incompressible'''; press '''Enter'''
  
 
|-
 
|-
 
|| Type '''icoFoam''' and press '''Enter'''
 
|| Type '''icoFoam''' and press '''Enter'''
  
||Type '''icoFoam''' and press '''Enter'''
+
||Type '''cd icoFoam'''; press '''Enter'''
  
 
|-
 
|-
 
||Type cylinder and press Enter
 
||Type cylinder and press Enter
  
|| Type '''cylinder''' and press '''Enter'''.
+
|| Type '''cd cylinder''' and press '''Enter'''.
  
 
|-
 
|-
Line 157: Line 160:
  
 
|| For a '''Fluent mesh''' file, in the '''command terminal''' we need to type
 
|| For a '''Fluent mesh''' file, in the '''command terminal''' we need to type
'''fluentMeshToFoam''' ( space ) '''cylmesh.msh'''
+
 
 +
'''fluentMeshToFoam (space) cylmesh.msh'''
  
 
and press '''Enter'''
 
and press '''Enter'''
Line 165: Line 169:
 
the conversion
 
the conversion
  
||On the '''terminal''' you will see that the '''mesh file''' is converted to '''openfoam
+
||On the '''terminal''' you will see that the '''mesh file''' is converted to '''openfoam data file'''
data file'''
+
  
 
|-
 
|-
 
||Click on cylinder folder
 
||Click on cylinder folder
  
||Go to the '''cylinder''' folder
+
||Now go back to the '''cylinder''' folder
  
 
|-
 
|-
Line 185: Line 188:
 
||Point showing no transport property file.
 
||Point showing no transport property file.
  
||'''Transport Property''' file is missing from the constant folder
+
||'''Transport Property''' file is missing from the '''constant''' folder
  
 
|-
 
|-
Line 192: Line 195:
 
property file
 
property file
  
||Go two levels back and copy '''transport property''' from '''cavity case'''
+
||Go two levels back and copy the '''transport property''' from the '''constant folder''' of the '''cavity case'''.
  
 
|-
 
|-
||Paste inside the constant folder of cylinder
+
||Paste inside the constant folder of cylinder >> do not change the viscosity
  
do not change the viscosity
+
||Paste it inside the '''constant''' folder of '''cylinder''' which we created just now.
  
||Paste it inside the '''constant''' folder of '''cylinder''' which we created just now
+
We will keep the default '''viscosity'''.
 
+
We will keep the default '''viscosity'''
+
  
 
|-
 
|-
Line 221: Line 222:
 
||From the command terminal go to the boudary file
 
||From the command terminal go to the boudary file
  
||Go to '''Constant > polyMesh > boundary file'''.
+
||Go to '''Constant > polyMesh'''.
 +
 
 +
Type '''ls'''.
 +
 
 +
You will see the '''boundary''' file.
  
 
|-
 
|-
Line 236: Line 241:
 
||In case of boundary name error check this file  
 
||In case of boundary name error check this file  
  
||In case of any error with '''boundary names''', you can refer to the '''boundary
+
||In case of any error with the '''boundary names''', you can refer to '''boundary file'''
file'''
+
  
 
|-
 
|-
 
||polyMesh >> constant >> 0 folder
 
||polyMesh >> constant >> 0 folder
  
||Go two levels back and go to the '''0''' folder.
+
||In the '''terminal''', go two levels back and go to the '''0''' folder.
  
 
|-
 
|-
 
||Open the ' p ' file  
 
||Open the ' p ' file  
  
||Now, open the '''0 folder''' and then open the '''pressure file''' in an editor
+
||Open the '''pressure file''' in the '''0 folder'''.
  
 
|-
 
|-
Line 258: Line 262:
 
Change them if needed.
 
Change them if needed.
  
Close this
+
Close this file.
  
 
|-
 
|-
 
||' p '>> 0 >> system folder  
 
||' p '>> 0 >> system folder  
  
||Now go two levels back and go to the''' system '''folder
+
||Go one level back and go to the''' system '''folder.
  
 
|-
 
|-
||Make changes in the system folder
+
||Open the '''controlDict''' file.
 +
 
 +
||Open the '''controlDict''' file.
  
||We can make some changes in the files of ''''system''' folder
 
  
 
|-
 
|-
 
||Edit the '''control dict''' file  
 
||Edit the '''control dict''' file  
  
||We will change the end time of '''controlDict''' file in our case
+
||We will change the end time of '''controlDict''' file.
  
Open the file in a editor
+
Close this.
  
 
|-
 
|-
||Edit and change end time from 5 to 100
+
||
 
+
||Change it from 5 to 100 and close it.
+
 
+
|-
+
||Go to the cylinder folder in terminal
+
  
||Close this and go two levels back
+
|| Go one level back.
  
 
|-
 
|-
 
||Type icoFoam and press enter
 
||Type icoFoam and press enter
  
|| To start the '''iterations''', type '''icoFoam''' and press Enter
+
|| To start the '''iterations''', type '''icoFoam''' and press '''Enter'''
  
 
|-
 
|-
||Iterations running in terminal
+
||Iterations running in terminal window
window
+
  
||'''Iterations''' will be seen running in the '''terminal'''
+
||'''Iterations''' running will be seen in the '''terminal'''.
  
 
|-
 
|-
 
||Open paraview  
 
||Open paraview  
  
||To view the '''geometry''', type '''paraFoam''' and press Enter
+
||To view the '''geometry''', type '''paraFoam''' and press '''Enter'''.
  
 
|-
 
|-
 
||Click on Apply button  
 
||Click on Apply button  
  
||In the '''paraFoam window''', click on the '''Apply''' button in the '''object inspector''' menu
+
||In the '''paraFoam window''', click on the '''Apply''' button in the '''object inspector''' menu.
  
 
|-
 
|-
 
||Point over the geometry  
 
||Point over the geometry  
  
||You can see the '''geometry'''
+
||You can see the '''geometry'''.
  
 
|-
 
|-
Line 322: Line 321:
 
||Point over the velocity condition  
 
||Point over the velocity condition  
  
||The initial '''velocity''' condition is seen here
+
||The initial '''velocity''' condition is seen here.
  
 
|-
 
|-
Line 328: Line 327:
 
controls  
 
controls  
  
||Click on the '''play''' button of the '''VCR menu''' on the top right hand side
+
||Click on the '''play''' button of the '''VCR menu''' on the top right-hand side.
  
 
|-
 
|-
 
||Point over the geometry  
 
||Point over the geometry  
  
||We can see the '''velocity contours''' with the passage of time
+
||We can see the '''velocity contours''' with the passage of time.
  
 
|-
 
|-
 
||Close paraview  
 
||Close paraview  
  
||Close the ''' paraview '''window
+
||Close the ''' paraview '''window.
 
+
|-
+
||
+
 
+
||Let me switch back to the '''slides '''
+
  
 
|-
 
|-
Line 351: Line 345:
  
 
||Here is a list of command to''' import geometry''' from other '''meshing software'''.
 
||Here is a list of command to''' import geometry''' from other '''meshing software'''.
'''* ANSYS : ansysMeshToFoam space <name of the file>'''
+
* '''ANSYS : ansysMeshToFoam space <filename>'''
'''* CFX : cfxToFoam space <name of the file>'''
+
*'''CFX : cfxToFoam space <filename>'''
'''* IDEAS : ideasTofoam space <name of the file>'''
+
*'''IDEAS : ideasTofoam space <filename>'''
'''* SALOME : ideasUnvToFoam space <name of the file>'''
+
*'''SALOME : ideasUnvToFoam space <filename>'''
  
This brings us to the end of the '''tutorial'''
+
This brings us to the end of the tutorial.
  
 
|-
 
|-
Line 362: Line 356:
  
 
||As an '''assignment'''
 
||As an '''assignment'''
* Try '''importing the mesh''' file of circular cylinder.
+
* Try importing the '''mesh''' file of circular cylinder.
* Mesh file by the name '''circcyl.msh''' provided with this '''tutorial'''
+
* '''Mesh''' file by the name '''circcyl.msh''' provided with this tutorial.
* Solve it using the '''icoFoam solver'''
+
* Solve it using the '''icoFoam solver'''.
  
 
|-
 
|-
Line 371: Line 365:
 
||In this tutorial we learnt :
 
||In this tutorial we learnt :
  
'''Importing mesh''' files from third party software into '''OpenFOAM'''.
+
*Importing geometry from other '''meshing''' software.
  
 
|-
 
|-

Latest revision as of 05:50, 23 December 2014

Visual Cue Narration
Slide 1 Hello and welcome to the spoken tutorial on Importing Mesh files in OpenFOAM
Slide 2 : Learning Objectives In this tutorial, you will learn to:
  • import Mesh files
  • from a meshing software
  • in OpenFOAM.
Slide 3: System Requirement To record this tutorial I am using
  • Linux Operating system Ubuntu version 12.04.
  • OpenFOAM version 2.1.1
  • ParaView version 3.12.0
Slide 4  : Pre-requisite As a pre-requisite, the user should know how to generate a Mesh in software like -

Gambit, Ansys ICEM , CFX, Salome etc.

Slide 5:
  • Using blockMesh, we can easily make simple geometries.
  • For example- box, pipe etc.
  • It is difficult to create complex geometries using blockMesh.
Slide 6:
  • But OpenFOAM supports importing mesh from third party meshing software.
  • There are commands available in OpenFOAM, to import these mesh files.
We will now learn to import these files.
Slide 7 : Geometry for the case
Point over the square cylinder
point over its length and height
point on inlet velocity


Here is the geometry of our case.

We have a square cylinder

  • length 1m and height 1m.
  • Inlet velocity is 1 m/s
  • We are solving this for a Reynolds Number (Re) = 100
  • The domain chosen is 40m by 60m
  • The Boundary conditions are as shown in the diagram
Slide 8 : This is the mesh file generated in a meshing software.
Go to the OpenFOAM > xyz-

2.1.1>run>tutorials>incompressible >icoFoam

In your OpenFOAM working directory, go to the icoFoam solver and click on it.
Create a folder : cylinder Create a folder by the name cylinder
Type cd (space) .. Now go to the cavity case.
Copy 0 and system folder from

cavity folder in icoFoam

Copy the 0 and system folders from the cavity case.
Paste it in cylinder folder Paste it inside the cylinder folder.
No constant folder Note that, you do not need the constant folder.
Point over the .msh file on the desktop On my desktop, I have a Fluent mesh file with a .(dot) msh extension.

It is named as cylmesh.msh

Copy-and-paste >> cylinder folder. Copy-and-paste this file in the cylinder folder in icoFoam.


Our setup is now ready.

Ctrl+Alt+t keys simultaneously Open the command terminal.
In the terminal window >> type run >> press Enter. Type run and press Enter.
Type cd tutorials; press Enter.
Type incompressible and press

Enter

Type cd incompressible; press Enter
Type icoFoam and press Enter Type cd icoFoam; press Enter
Type cylinder and press Enter Type cd cylinder and press Enter.
On the terminal >> type fluentMeshToFoam cylmesh.msh

>>Enter

For a Fluent mesh file, in the command terminal we need to type

fluentMeshToFoam (space) cylmesh.msh

and press Enter

The command terminal will show

the conversion

On the terminal you will see that the mesh file is converted to openfoam data file
Click on cylinder folder Now go back to the cylinder folder
Point to the constant folder

Click on constant folder

The constant folder has been generated

Click on the constant folder to open it.

Point showing no transport property file. Transport Property file is missing from the constant folder
constant >> cylinder >> cavity >>

constant – copy the transport property file

Go two levels back and copy the transport property from the constant folder of the cavity case.
Paste inside the constant folder of cylinder >> do not change the viscosity Paste it inside the constant folder of cylinder which we created just now.

We will keep the default viscosity.

Command Terminal Switch back to the terminal.
Do not run blockMesh command Note that we do not run blockMesh command here.
Boundary conditions in the mesh file To view the boundary conditions in the mesh file
From the command terminal go to the boudary file Go to Constant > polyMesh.

Type ls.

You will see the boundary file.

Open the file in the text editor Open it in any editor of your choice.
Names are same as sown in the geometry slide The boundary condition names are same as seen in the geometry slide.
In case of boundary name error check this file In case of any error with the boundary names, you can refer to boundary file
polyMesh >> constant >> 0 folder In the terminal, go two levels back and go to the 0 folder.
Open the ' p ' file Open the pressure file in the 0 folder.
Point over the boundary name and

change it to the ones shown in the boundary file

Note that the boundary names should exactly match with the boundary file.

Change them if needed.

Close this file.

' p '>> 0 >> system folder Go one level back and go to the system folder.
Open the controlDict file. Open the controlDict file.


Edit the control dict file We will change the end time of controlDict file.

Close this.

Go one level back.
Type icoFoam and press enter To start the iterations, type icoFoam and press Enter
Iterations running in terminal window Iterations running will be seen in the terminal.
Open paraview To view the geometry, type paraFoam and press Enter.
Click on Apply button In the paraFoam window, click on the Apply button in the object inspector menu.
Point over the geometry You can see the geometry.
Point over the solid color and

change it to U

In the Active variable control menu, change from solid color to U velocity
Point over the velocity condition The initial velocity condition is seen here.
Click on the play button of VCR

controls

Click on the play button of the VCR menu on the top right-hand side.
Point over the geometry We can see the velocity contours with the passage of time.
Close paraview Close the paraview window.
Slide :

List of commands to import mesh files

Here is a list of command to import geometry from other meshing software.
  • ANSYS : ansysMeshToFoam space <filename>
  • CFX : cfxToFoam space <filename>
  • IDEAS : ideasTofoam space <filename>
  • SALOME : ideasUnvToFoam space <filename>

This brings us to the end of the tutorial.

Slide : As an assignment
  • Try importing the mesh file of circular cylinder.
  • Mesh file by the name circcyl.msh provided with this tutorial.
  • Solve it using the icoFoam solver.
Slide : Summary In this tutorial we learnt :
  • Importing geometry from other meshing software.
Slide 11 :

About Spoken tutorials

Watch the video available at this URL:

http://spoken-tutorial.org/What_is_a_Spoken_Tutorial It summarizes the Spoken Tutorial project. If you do not have good bandwidth, you can download and watch it

Slide 12:

About Spoken tutorials

The Spoken Tutorial Project Team

-Conducts workshops using spoken tutorials -Gives certificates to those who pass an online test -For more details, please write to contact@spoken-tutorial.org

Slide 13:

Acknowledgement

Spoken Tutorials are part of Talk to a Teacher project,

It is supported by the National Mission on Education through ICT, MHRD, Government of India. This project is coordinated by http://spoken-tutorial More information on the same is available at the following URL link http://spoken-tutorial.org/NMEICT-Intro

About the contributor This is Rahul Joshi from IIT BOMBAY signing off.

Thanks for joining


Contributors and Content Editors

Nancyvarkey, Rahuljoshi