OpenFOAM/C3/Importing-mesh-file-in-OpenFOAM/English

From Script | Spoken-Tutorial
Revision as of 15:34, 22 December 2014 by Rahuljoshi (Talk | contribs)

Jump to: navigation, search
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.

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
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