CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... (http://www.cfd-online.com/Forums/openfoam-meshing-other/)
-   -   How to convert a .msh file to open Foam? (http://www.cfd-online.com/Forums/openfoam-meshing-other/92915-how-convert-msh-file-open-foam.html)

Danath September 29, 2011 02:48

How to convert a .msh file to open Foam?
 
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!

-mAx- September 29, 2011 05:45

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

Danath September 30, 2011 11:21

4 Attachment(s)
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

-mAx- September 30, 2011 11:32

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

Danath September 30, 2011 13:54

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

-mAx- September 30, 2011 14:00

Quote:

Originally Posted by Danath (Post 326288)
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

Danath October 7, 2011 04:32

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;

-mAx- October 7, 2011 04:42

in fact it writes all the info in the polyMesh folder

Danath October 9, 2011 05:21

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

-mAx- October 10, 2011 01:06

"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

Danath October 15, 2011 13:00

5 Attachment(s)
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 ?

-mAx- October 17, 2011 01:25

Courant Number (Co) is your problem.
How did you define your dt?

Danath October 17, 2011 03:52

1 Attachment(s)
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

-mAx- October 17, 2011 04:02

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 October 17, 2011 05:20

What do you recomend ?

Is there an error in design ?

-mAx- October 17, 2011 05:28

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 October 21, 2011 09:38

1 Attachment(s)
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)

-mAx- October 21, 2011 09:49

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 October 21, 2011 10:04

thanks a lot!you are my hero!

Danath October 21, 2011 16:00

1 Attachment(s)
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 ?


All times are GMT -4. The time now is 01:09.