Difference between revisions of "OpenFOAM/C3/Importing-mesh-file-in-OpenFOAM/English"
Rahuljoshi (Talk | contribs) |
Nancyvarkey (Talk | contribs) |
||
(16 intermediate revisions by one other user not shown) | |||
Line 10: | Line 10: | ||
|| '''Slide 2''' : '''Learning Objectives''' | || '''Slide 2''' : '''Learning Objectives''' | ||
− | || In this tutorial, you will learn | + | || In this tutorial, you will learn to: |
− | * import Mesh files | + | * import '''Mesh files''' |
* from a meshing software | * from a meshing software | ||
− | * in OpenFOAM. | + | * in '''OpenFOAM'''. |
|- | |- | ||
− | || '''Slide 3 ''' : ''' | + | || '''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. |
|- | |- | ||
− | || Point to the | + | ||Slide 7 : Geometry for the case |
− | || | + | Point over the square cylinder |
− | The | + | 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'''m by '''60'''m | ||
+ | |||
+ | *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 | ||
+ | |||
+ | |||
|- | |- | ||
|} | |} |
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:
|
Slide 3: System Requirement | To record this tutorial I am using
|
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: |
|
Slide 6: |
|
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
|
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.
|
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.
This brings us to the end of the tutorial. |
Slide : | As an assignment
|
Slide : Summary | In this tutorial we learnt :
|
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
|