CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ...

How to convert a .msh file to open Foam?

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree21Likes

Reply
 
LinkBack Thread Tools Display Modes
Old   September 29, 2011, 02:48
Smile How to convert a .msh file to open Foam?
  #1
Member
 
Evangelos
Join Date: Sep 2011
Posts: 67
Rep Power: 5
Danath is on a distinguished road
Hi

i have created a .msh file from gambit and i want to convert the .msh file to an OF file in order to run the file with OF

My problem is how can i convert the file?

i must create a new case. ok and then? what files this case must enclose ?

and where i can find these files ?

What solver i must choose;

i am not a programmer....

thanks a lot!
Danath is offline   Reply With Quote

Old   September 29, 2011, 05:45
Default
  #2
Super Moderator
 
-mAx-'s Avatar
 
Maxime Perelli
Join Date: Mar 2009
Location: Switzerland
Posts: 2,961
Rep Power: 30
-mAx- will become famous soon enough
it depends on what you want to solve
Choose and copy a tutorial from OF folder (tutorials are sorted with solver).
Then if your mesh is full hexa, you can use following command to import your mesh
>fluentMeshToFoam your_mesh.msh
If your mesh constains any hanging nodes (typical with tetra-hexcore), you need to use the tpoly conversion within fluent, and then in OF use following command:
>fluent3DMeshToFoam your_mesh.msh

Once your mesh is well imported (use checkMesh to be sure everything is ok), you can modify the boundary files in /0 folder
zaynah04 likes this.
__________________
In memory of my friend Hervé: CFD engineer & freerider
-mAx- is offline   Reply With Quote

Old   September 30, 2011, 11:21
Default
  #3
Member
 
Evangelos
Join Date: Sep 2011
Posts: 67
Rep Power: 5
Danath is on a distinguished road
Hi and thanks for the reply

i create a file and i copy the icofoam file inside.
In the cavity folder i paste my "fuel cell.msh" file

and i take the following results (see pictures)

i think that i pass the mesh in openFoam is it right or wrong ?

thanks a lot
Attached Images
File Type: jpg fuel cell 1.jpg (58.8 KB, 146 views)
File Type: jpg fuel cell 2.jpg (60.7 KB, 87 views)
File Type: jpg fuel cell 3.jpg (65.5 KB, 53 views)
File Type: jpg fuel cell 4.jpg (51.3 KB, 50 views)
Danath is offline   Reply With Quote

Old   September 30, 2011, 11:32
Default
  #4
Super Moderator
 
-mAx-'s Avatar
 
Maxime Perelli
Join Date: Mar 2009
Location: Switzerland
Posts: 2,961
Rep Power: 30
-mAx- will become famous soon enough
you just paste your file in the folder...
Now you need to conver it, use one of following commands
fluentMeshToFoam your_mesh.msh
or
fluent3DMeshToFoam your_mesh.msh
__________________
In memory of my friend Hervé: CFD engineer & freerider
-mAx- is offline   Reply With Quote

Old   September 30, 2011, 13:54
Default
  #5
Member
 
Evangelos
Join Date: Sep 2011
Posts: 67
Rep Power: 5
Danath is on a distinguished road
hello again sorry but its my first time so i have problems

i open openFoam console and after c:\cfd...\cavity> i write >FluentMeshToFoam ....

my .msh file is fuel cell swlhnakia.msh can you tell me exactly what i must write because i make mistakes

thanks a lot and sorry
Danath is offline   Reply With Quote

Old   September 30, 2011, 14:00
Default
  #6
Super Moderator
 
-mAx-'s Avatar
 
Maxime Perelli
Join Date: Mar 2009
Location: Switzerland
Posts: 2,961
Rep Power: 30
-mAx- will become famous soon enough
Quote:
Originally Posted by Danath View Post
i open openFoam console and after c:\cfd...\cavity> i write >FluentMeshToFoam ....
when you give the command FluentMeshToFoam what is the error message?
your c:\cfd...\cavity> sounds like you are under windows.
As far as I know you cannot run OF under windows (not directly):
http://www.openfoam.com/resources/windows.php
__________________
In memory of my friend Hervé: CFD engineer & freerider
-mAx- is offline   Reply With Quote

Old   October 7, 2011, 04:32
Default
  #7
Member
 
Evangelos
Join Date: Sep 2011
Posts: 67
Rep Power: 5
Danath is on a distinguished road
hi!

i finally pass the mesh to openfoam.
The terminal tells that

Writing mesh to "/home/danath1985/OpenFOAM/danath1985-2.0.1/run/tutorials/incompressible/Fuelcell/cavity/constant/region0"

i search for the File " region0"

but i can't find the file !
(when i open paraview all its ok and i can see the mesh)

where can i find the file? in order to save because every time i make the same things...

i have copy a tutorial (icofoam)
if i find the file can i rename it as blockmeshdict in order to replace this file with the file that already exists;
Danath is offline   Reply With Quote

Old   October 7, 2011, 04:42
Default
  #8
Super Moderator
 
-mAx-'s Avatar
 
Maxime Perelli
Join Date: Mar 2009
Location: Switzerland
Posts: 2,961
Rep Power: 30
-mAx- will become famous soon enough
in fact it writes all the info in the polyMesh folder
__________________
In memory of my friend Hervé: CFD engineer & freerider
-mAx- is offline   Reply With Quote

Old   October 9, 2011, 05:21
Default
  #9
Member
 
Evangelos
Join Date: Sep 2011
Posts: 67
Rep Power: 5
Danath is on a distinguished road
Hi!
I run the code and i have some troubles...

after solving p. i take time step continuity errors

i change deltaT but the problem remains

can you tell me what is wrong;


Time = 0.0005
Courant Number mean: 8.81961e-07 max: 0.00267262
DILUPBiCG: Solving for Ux, Initial residual = 0, Final residual = 0, No Iterations 0
DILUPBiCG: Solving for Uy, Initial residual = 0, Final residual = 0, No Iterations 0
DILUPBiCG: Solving for Uz, Initial residual = 1, Final residual = 1.44421e-06, No Iterations 1
DICPCG: Solving for p, Initial residual = 1, Final residual = 1.30066e+07, No Iterations 1001
time step continuity errors : sum local = 22.9905, global = 0.0673409, cumulative = 0.0673409
DICPCG: Solving for p, Initial residual = 1.43669e-08, Final residual = 1.43669e-08, No Iterations 0
time step continuity errors : sum local = 23.0278, global = 0.0673409, cumulative = 0.134682
ExecutionTime = 48.5 s ClockTime = 50 s



Time = 0.001



Courant Number mean: 53.0198 max: 5172.46
DILUPBiCG: Solving for Ux, Initial residual = 0.986577, Final residual = 11.6942, No Iterations 1001
DILUPBiCG: Solving for Uy, Initial residual = 0.99304, Final residual = 67784, No Iterations 1001
DILUPBiCG: Solving for Uz, Initial residual = 0.996546, Final residual = 7.40566e+06, No Iterations 1001
DICPCG: Solving for p, Initial residual = 0.995109, Final residual = 5.2908, No Iterations 1001
time step continuity errors : sum local = 7.06186e+09, global = 151003, cumulative = 151003
DICPCG: Solving for p, Initial residual = 0.975242, Final residual = 2.10525, No Iterations 1001
time step continuity errors : sum local = 5.68733e+11, global = 6.33381e+07, cumulative = 6.34891e+07
ExecutionTime = 353.47 s ClockTime = 360 s
Danath is offline   Reply With Quote

Old   October 10, 2011, 01:06
Default
  #10
Super Moderator
 
-mAx-'s Avatar
 
Maxime Perelli
Join Date: Mar 2009
Location: Switzerland
Posts: 2,961
Rep Power: 30
-mAx- will become famous soon enough
"time step continuity errors " aren't error as you think.
>> http://www.openfoam.com/docs/user/monitoring-jobs.php

Very very coarse approach to numerics: exact mathematics equation A=B will be treatead as A-B=epsilon, with epsilon very small.
The smaller epsilon will be, the more accurate your A=B equation will be solved.
epsilon is your error

But I agree you have an error: your Courant Number C is too high (C<0.5).
Reduce your deltat
__________________
In memory of my friend Hervé: CFD engineer & freerider
-mAx- is offline   Reply With Quote

Old   October 15, 2011, 13:00
Default
  #11
Member
 
Evangelos
Join Date: Sep 2011
Posts: 67
Rep Power: 5
Danath is on a distinguished road
Hi

i have troubles when i run the case. i run icoFoam

i pass the mesh from Gambit to openFoam.I use checkMesh and all its ok !

i try to decrease deltaT

when i run the code the first pass is ok and the courant number is very low
From the second pass the courant number rises a lot so after some passes the case stops

i attach some pictures... Can you tell me what is wrong ?
Attached Images
File Type: jpg checkmesh3.jpg (59.7 KB, 35 views)
File Type: jpg Control.jpg (30.0 KB, 27 views)
File Type: jpg p.jpg (38.3 KB, 20 views)
File Type: jpg u.jpg (39.9 KB, 15 views)
File Type: jpg floating point.jpg (77.1 KB, 24 views)
Danath is offline   Reply With Quote

Old   October 17, 2011, 01:25
Default
  #12
Super Moderator
 
-mAx-'s Avatar
 
Maxime Perelli
Join Date: Mar 2009
Location: Switzerland
Posts: 2,961
Rep Power: 30
-mAx- will become famous soon enough
Courant Number (Co) is your problem.
How did you define your dt?
Danath likes this.
__________________
In memory of my friend Hervé: CFD engineer & freerider
-mAx- is offline   Reply With Quote

Old   October 17, 2011, 03:52
Default
  #13
Member
 
Evangelos
Join Date: Sep 2011
Posts: 67
Rep Power: 5
Danath is on a distinguished road
i have create a tube and i unite this tube with square

the lenght of the tube is 3cm and the lenght of the square is 1 cm

δχ=0.04/40=0.001

n= 40 (10 cell/cm)

δt = 1 * 0.001/0.1=0.01

U=0.1

Co = 1
Attached Images
File Type: jpg fuelcell.jpg (78.2 KB, 40 views)
Danath is offline   Reply With Quote

Old   October 17, 2011, 04:02
Default
  #14
Super Moderator
 
-mAx-'s Avatar
 
Maxime Perelli
Join Date: Mar 2009
Location: Switzerland
Posts: 2,961
Rep Power: 30
-mAx- will become famous soon enough
Basically you need to get your dt from your maximal expected velocity on your smallest cell, and then take factor 0.5 >> dt # 0.5 x min-cell/max-U

But in your case, did you scale your domain?
In your checkMesh I see a bounding box from (0 0 0) to (16 16 4)..... meters
Danath likes this.
__________________
In memory of my friend Hervé: CFD engineer & freerider
-mAx- is offline   Reply With Quote

Old   October 17, 2011, 05:20
Default
  #15
Member
 
Evangelos
Join Date: Sep 2011
Posts: 67
Rep Power: 5
Danath is on a distinguished road
What do you recomend ?

Is there an error in design ?
Danath is offline   Reply With Quote

Old   October 17, 2011, 05:28
Default
  #16
Super Moderator
 
-mAx-'s Avatar
 
Maxime Perelli
Join Date: Mar 2009
Location: Switzerland
Posts: 2,961
Rep Power: 30
-mAx- will become famous soon enough
in the bounding box, the (16 16 4) agrees what you mentionned:"the lenght of the tube is 3cm and the lenght of the square is 1 cm" (3+1)
That means you created your geometry in Gambit with cm-scale (although there is no scale in Gambit)
So now you need to scale your domain.
Once you imported it with fluentMeshToFoam ***.msh , you need to scale it with:
> transformPoints -scale (0.01 0.01 0.01)
Danath likes this.
__________________
In memory of my friend Hervé: CFD engineer & freerider
-mAx- is offline   Reply With Quote

Old   October 21, 2011, 09:38
Default
  #17
Member
 
Evangelos
Join Date: Sep 2011
Posts: 67
Rep Power: 5
Danath is on a distinguished road
thanks for the reply the case work but in the end (paraview.pic)

what is wrong;

i drew the model with Gambit (create real brick) and i put the volumes to the right place after i connect the faces of the volumes!

i specify the boundary conditions walls,Vin(red) oulet (blue)

i specify all the model as fluid!

what can i do?

i cannot see the flow in my model (only in Vin and outlet)
Attached Images
File Type: jpg paraview.jpg (25.3 KB, 32 views)
Danath is offline   Reply With Quote

Old   October 21, 2011, 09:49
Default
  #18
Super Moderator
 
-mAx-'s Avatar
 
Maxime Perelli
Join Date: Mar 2009
Location: Switzerland
Posts: 2,961
Rep Power: 30
-mAx- will become famous soon enough
IN paraview, basically available are boundary surfaces and fluid-domain.
By openingany boundary surface, you can display any variable on this surface.
If you want to see something in your model, then you have to "open" the fluid domain,and do some slice or clip.
if you used foamToVTK utility, then in the VTK folder, you have folders containing boundary surfaces results. In the VTK folder you also have one (steady) or many (unsteady) files. Those one are results for entire model.
Danath likes this.
__________________
In memory of my friend Hervé: CFD engineer & freerider
-mAx- is offline   Reply With Quote

Old   October 21, 2011, 10:04
Default
  #19
Member
 
Evangelos
Join Date: Sep 2011
Posts: 67
Rep Power: 5
Danath is on a distinguished road
thanks a lot!you are my hero!
Danath is offline   Reply With Quote

Old   October 21, 2011, 16:00
Default
  #20
Member
 
Evangelos
Join Date: Sep 2011
Posts: 67
Rep Power: 5
Danath is on a distinguished road
hi again!

i think i have a problem with my mesh!


the flow stops!!!!at the end of the blue

what is wrong i created with create real brick and i put the volumes to the right place.

why the flow stops ?
Attached Images
File Type: jpg paraview 1.jpg (54.7 KB, 31 views)
Danath is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
GroovyBC the dynamic cousin of funkySetFields that lives on the suburb of the mesh gschaider OpenFOAM 300 October 29, 2014 19:00
OpenFOAM 1.7.1 installation on LINUX UBUNTU 10.10 electrosin OpenFOAM Installation 39 July 1, 2014 07:55
Installation of OpenFOAM-1.6 on Ubuntu 9.10 marval OpenFOAM Installation 2 March 17, 2010 09:33
Version 15 on Mac OS X gschaider OpenFOAM Installation 120 December 2, 2009 11:23
Import gmsh msh to Foam adorean Open Source Meshers: Gmsh, Netgen, CGNS, ... 24 April 27, 2005 08:19


All times are GMT -4. The time now is 14:02.