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

From Script | Spoken-Tutorial
Jump to: navigation, search
Line 11: Line 11:
  
 
|| In this tutorial, you will learn how to:
 
|| In this tutorial, you will learn how to:
* import Mesh files
+
* import '''Mesh files'''
 
* from a meshing software
 
* from a meshing software
* in OpenFOAM.
+
* in '''OpenFOAM'''.
  
 
|-
 
|-
Line 26: Line 26:
  
 
|| To record this tutorial I am using
 
|| To record this tutorial I am using
* Linux Operating system Ubuntu version 12.04.
+
* '''Linux''' Operating system '''Ubuntu''' version 12.04.
* OpenFOAM version 2.1.1
+
* '''OpenFOAM''' version 2.1.1
* ParaView version 3.12.0
+
* '''ParaView''' version 3.12.0
  
 
|-
 
|-
 
|| Slide 5:.
 
|| Slide 5:.
  
|| Using blockMesh, we can easily make simple geometries.
+
|| Using '''blockMesh''', we can easily make '''simple''' geometries.
For example- pipe, box, etc.
+
For example- '''pipe, box,''' etc.
  
 
|-
 
|-
 
||Narration, no visual cue
 
||Narration, no visual cue
  
||It is difficult to create complex geometries using blockMesh.
+
||It is difficult to create complex geometries using '''blockMesh'''.
But OpenFOAM supports importing mesh from third party meshing
+
 
 +
But '''OpenFOAM''' supports importing '''mesh''' from third party meshing
 
software.
 
software.
  
Line 46: Line 47:
 
||
 
||
  
||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 how to '''import''' these files
  
 
|-
 
|-
Line 57: Line 59:
  
 
||Here is the geometry of our case.
 
||Here is the geometry of our case.
We have a square cylinder
+
We have a '''square cylinder'''
  
 
*length 1m and height 1m.
 
*length 1m and height 1m.
  
*Inlet velocity is 1 m/s
+
*'''Inlet velocity''' is 1 m/s
  
*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''' by '''60'''
  
*The Boundary conditions are as shown in the diagram
+
*The '''Boundary conditions are as shown in the diagram'''
  
 
|-
 
|-
 
||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 79: 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
  
 
|-
 
|-
 
||Create a folder : cylinder
 
||Create a folder : cylinder
  
||Create a folder by the name cylinder
+
||Create a folder by the name '''cylinder'''
  
 
|-
 
|-
Line 97: Line 99:
 
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.
+
||Then 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.
  
 
|-
 
|-
Line 113: Line 115:
 
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'''
  
 
|-
 
|-
 
||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
  
Line 125: Line 128:
 
||Ctrl+Alt+t keys simultaneously
 
||Ctrl+Alt+t keys simultaneously
  
||Open a command terminal and press Enter.
+
||Open a '''command terminal''' and press '''Enter'''.
  
 
|-
 
|-
 
||In the terminal window >> type run >> press Enter.
 
||In the terminal window >> type run >> press Enter.
  
||Type run and press Enter.
+
||Type '''run''' and press '''Enter'''.
  
 
|-
 
|-
Line 136: Line 139:
 
Enter
 
Enter
  
||Type Incompressible and press Enter
+
||Type '''Incompressible''' and press '''Enter'''
  
 
|-
 
|-
|| Type icoFoam and press Enter
+
|| Type '''icoFoam''' and press '''Enter'''
  
||Type icoFoam and press Enter
+
||Type '''icoFoam''' and press '''Enter'''
  
 
|-
 
|-
 
||Type cylinder and press Enter
 
||Type cylinder and press Enter
  
|| Type cylinder and press Enter.
+
|| Type '''cylinder''' and press '''Enter'''.
  
 
|-
 
|-
Line 153: Line 156:
 
>>Enter
 
>>Enter
  
|| 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 162: Line 165:
 
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
+
||Go to the '''cylinder''' folder
  
 
|-
 
|-
Line 175: Line 178:
 
Click on constant folder  
 
Click on constant folder  
  
||The constant folder has been generated
+
||The '''constant''' folder has been generated
 +
 
 +
Click on the '''constant''' folder to open it.
 +
 
 +
|-
 +
||Point showing no transport property file.
  
Click on the constant folder to open it.
+
||'''Transport Property''' file is missing from the constant folder
  
 
|-
 
|-
Line 184: Line 192:
 
property file
 
property file
  
||Go two levels back and copy transport property from cavity case
+
||Go two levels back and copy '''transport property''' from '''cavity case'''
  
 
|-
 
|-
Line 191: Line 199:
 
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'''
  
 
|-
 
|-
 
||Command Terminal
 
||Command Terminal
  
||Switch back to the terminal.
+
||Switch back to the '''terminal'''.
  
 
|-
 
|-
||Do not run blockMesh command  
+
||Do not run '''blockMesh''' command  
  
||Note that we do not run blockMesh command here.
+
||'''Note that''' we do not run '''blockMesh''' command here.
  
 
|-
 
|-
 
||Boundary conditions in the mesh file  
 
||Boundary conditions in the mesh file  
  
||To view the boundary conditions in the mesh file
+
||To view the '''boundary conditions''' in the '''mesh''' file
  
 
|-
 
|-
 
||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 > boundary file'''.
  
 
|-
 
|-
 
||Open the file in the text editor  
 
||Open the file in the text editor  
  
||Open it in any editor of your choice.
+
||Open it in any '''editor''' of your choice.
  
 
|-
 
|-
 
||Names are same as sown in the geometry slide  
 
||Names are same as sown in the geometry slide  
  
||The boundary condition names are same as seen 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 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 '''boundary names''', you can refer to the '''boundary
file
+
file'''
  
 
|-
 
|-
 
||polyMesh >> constant >> 0 folder
 
||polyMesh >> constant >> 0 folder
  
||Go two levels back and go to the 0 folder.
+
||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
+
||Now, open the '''0 folder''' and then open the '''pressure file''' in an editor
  
 
|-
 
|-
Line 246: Line 254:
 
boundary file
 
boundary file
  
||Note that the boundary names should exactly match with the boundary file.
+
||Note that the '''boundary''' names should exactly match with the '''boundary file'''.
  
 
Change them if needed.
 
Change them if needed.
Line 255: Line 263:
 
||' p '>> 0 >> system folder  
 
||' p '>> 0 >> system folder  
  
||Now go two levels back and go to the system folder
+
||Now go two levels back and go to the''' system '''folder
  
 
|-
 
|-
 
||Make changes in the system folder  
 
||Make changes in the system folder  
  
||We can make some changes in the files of system folder
+
||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 in our case
  
 
Open the file in a editor
 
Open the file in a editor
Line 282: Line 290:
 
||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
  
 
|-
 
|-
Line 288: Line 296:
 
window
 
window
  
||Iterations will be seen running in the terminal
+
||'''Iterations''' will be seen running 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
+
||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 309: Line 317:
 
change it to U  
 
change it to U  
  
||In the Active variable control menu, change from solid color to U velocity
+
||In the '''Active variable control''' menu, change from '''solid color''' to '''U velocity'''
  
 
|-
 
|-
 
||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 320: Line 328:
 
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  
+
||Let me switch back to the '''slides '''
  
 
|-
 
|-
Line 342: Line 350:
 
files
 
files
  
||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 <name of the file>'''
* CFX : cfxToFoam space <name of the file>
+
'''* CFX : cfxToFoam space <name of the file>'''
* IDEAS : ideasTofoam space <name of the file>
+
'''* IDEAS : ideasTofoam space <name of the file>'''
* SALOME : ideasUnvToFoam space <name of the file>
+
'''* SALOME : ideasUnvToFoam space <name of the file>'''
  
This brings us to the end of the tutorial
+
This brings us to the end of the '''tutorial'''
  
 
|-
 
|-
 
||Slide :
 
||Slide :
  
||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 363: Line 371:
 
||In this tutorial we learnt :
 
||In this tutorial we learnt :
  
Importing mesh files from third party software into OpenFOAM.
+
'''Importing mesh''' files from third party software into '''OpenFOAM'''.
  
 
|-
 
|-

Revision as of 15:54, 22 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 how to:
  • import Mesh files
  • from a meshing software
  • in OpenFOAM.
Slide 3  : 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 4: 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 5:. Using blockMesh, we can easily make simple geometries.

For example- pipe, box, etc.

Narration, no visual cue It is difficult to create complex geometries using blockMesh.

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 how 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 40 by 60
  • 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) .. Go one level back
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 Then 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 a command terminal and press Enter.
In the terminal window >> type run >> press Enter. Type run and press Enter.
Type Incompressible and press

Enter

Type Incompressible and press Enter
Type icoFoam and press Enter Type icoFoam and press Enter
Type cylinder and press Enter Type 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 Go 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 transport property from 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 > 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 boundary names, you can refer to the boundary

file

polyMesh >> constant >> 0 folder Go two levels back and go to the 0 folder.
Open the ' p ' file Now, open the 0 folder and then open the pressure file in an editor
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

' p '>> 0 >> system folder Now go two levels back and go to the system folder
Make changes in the system folder We can make some changes in the files of 'system folder
Edit the control dict file We will change the end time of controlDict file in our case

Open the file in a editor

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
Type icoFoam and press enter To start the iterations, type icoFoam and press Enter
Iterations running in terminal

window

Iterations will be seen running 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
Let me switch back to the slides
Slide :

List of commands to import mesh files

Here is a list of command to import geometry from other meshing software.

* ANSYS : ansysMeshToFoam space <name of the file> * CFX : cfxToFoam space <name of the file> * IDEAS : ideasTofoam space <name of the file> * SALOME : ideasUnvToFoam space <name of the file>

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 mesh files from third party software into OpenFOAM.

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