CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Pre-Processing

Converting mesh from gmsh

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

Reply
 
LinkBack Thread Tools Display Modes
Old   March 30, 2006, 10:43
Default Hello! I want to creata a m
  #1
newbee
Guest
 
Posts: n/a
Hello!

I want to creata a mesh that is described by a area (lets say in x-y plane) and then extruded in the z direction because it is uniform in with hight.

I have created the 2D mesh in gmsh (.msh ending) and I'm presently trying to transfer it to OpenFOAM. I dont know whether I should extrude it first with the Openfoam command or if I have to convert it first with gmshToFoam command and then try to extrude it.

Either way I get Error messages.

Does anyone have an idea of how to create a mesh in this manner?

Thanks
/Erik
  Reply With Quote

Old   March 31, 2006, 04:45
Default You probably want to do the ex
  #2
Super Moderator
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,416
Rep Power: 15
mattijs is on a distinguished road
You probably want to do the extrusion in gmsh itself. The gmshToFoam converter only converts 3D meshes.
mattijs is offline   Reply With Quote

Old   March 31, 2006, 05:02
Default Thanks for the hint! When I
  #3
newbee
Guest
 
Posts: n/a
Thanks for the hint!

When I try to extrude my 2D mesh in gmsh I want to form prism and hexahedral cells, but it wont extrude the mesh, only the "geometrical configuration".

/Erik
  Reply With Quote

Old   March 31, 2006, 05:05
Default Do you know if I can convert m
  #4
newbee
Guest
 
Posts: n/a
Do you know if I can convert my 2D mesh to OpenFOAM- format and then extrude it as an alternative method?

/Erik
  Reply With Quote

Old   March 31, 2006, 05:09
Default Use extrudeMesh on an existing
  #5
Super Moderator
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,416
Rep Power: 15
mattijs is on a distinguished road
Use extrudeMesh on an existing mesh with the -sourcePatch -sourceRoot -sourceCase arguments. Check the surface file it writes. Is a very simple format you can easily write a converter to from another meshing program. Then use extrudeMesh with the -surface option to extrude from that surface file.

Would be nice if you could post your steps & solution over here.
mattijs is offline   Reply With Quote

Old   April 3, 2006, 06:41
Default Thank you Ok I will do that
  #6
newbee
Guest
 
Posts: n/a
Thank you

Ok I will do that once I get it to work.

Im trying to extrude icoFoam/cavity, but since the command extrudeMesh only expects 4 arguments I can only write:

target root
target case
number of layers
overall thickness

And with the execution of only this arguments it complaints about the missing root, case and patch ofcourse.

A second question concerning this is how the sourcePatch should be defined in the case above with openfoam. Should it perhaps be named:
"empty FrontAndBack"
  Reply With Quote

Old   April 3, 2006, 09:12
Default Is this a question? The error
  #7
Super Moderator
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,416
Rep Power: 15
mattijs is on a distinguished road
Is this a question? The error message I get is

--> FOAM FATAL ERROR : Need to specify either -sourceRoot/Case/Patch or -surface option to specify the source of the patch to extrude

and if I type 'extrudeMesh' without any arguments to see all possibilities I see it has -sourceRoot, -sourceCase and -sourcePatch arguments which is exactly all the data it requires (root+case gives a mesh, patch gives the faces to extrude). The source root/case does not have to be the same as the destination root/case.
mattijs is offline   Reply With Quote

Old   April 3, 2006, 09:53
Default I managed to get past that pro
  #8
newbee
Guest
 
Posts: n/a
I managed to get past that problem.

The way I got it go work was by having the source and destination root/cases diferent from eachother.

I tried first to handle the problem in FoamX but got an error message as soon as I entered the -sourceCase.
It said something like rootAndCase file can not be split up to root directory and case file.

But now Im past that.

Thank You!
  Reply With Quote

Old   April 4, 2006, 05:22
Default Hello! Ive managed to get t
  #9
newbee
Guest
 
Posts: n/a
Hello!

Ive managed to get the format in which OpenFOAM describes an meshed surface as explained to me above. Now im trying to extrude a 2D mesh surface of my own choosing with this format.

I use the etrude command with arguments:
-layers
-thickness
-surface to be extruded(with .sMesh ending)

When using this arguments I get the following error message:

Exec : extrudeMesh /home/erik/OpenFOAM/erik-1.3/run/tutorials/icoFoam cavity 3 5.0 -surface surface.sMesh
Date : Apr 04 2006
Time : 10:14:29
Host : compadre
PID : 8496
Root :
Case :
Nprocs : 1
Target: "/home/erik/OpenFOAM/erik-1.3/run/tutorials/icoFoam" "cavity"
Extruding layers:
number of layers 3
overall thickness 5

Create time

Extruding surfaceMesh read from file "surface.sMesh"

Read patch from file "surface.sMesh":
points : 82
faces : 108



--> FOAM FATAL ERROR : Error in face ordering: mixed used and unused faces at the end of face list.
Number of used faces: 842 and face 874 is owned by cell 88

From function void polyMesh::initMesh(cellList& c) const
in file meshes/polyMesh/polyMeshCalcFaceCells.C at line 266.

FOAM aborting

Foam::error::printStack(Foam:stream&)
Foam::error::abort()
Foam::polyMesh::initMesh(Foam::List<foam::cell>&)
Foam::polyMesh::polyMesh(Foam::IOobject const&, Foam::Field<foam::vector<double> > const&, Foam::List<foam::face> const&, Foam::List<foam::cell> const&)
extrudeMesh [0x805ce57]
Foam::polyMesh::readUpdate()
__libc_start_main
__gxx_personality_v0


Could anybody please tell me what to do to correct this error.

Thanks
/Erik
  Reply With Quote

Old   April 4, 2006, 05:44
Default Sorry for my frequent messagin
  #10
newbee
Guest
 
Posts: n/a
Sorry for my frequent messaging.

I had a mesh (surface.sMesh) consisting of elements with both 2 and 4 nods.

Since 2 nods cant make up an element I tried to delete these. I got rid of the error message but the figure in paraview looks vary messed up and nothing in resemblance with the mesh I made in gmsh.

question:
Was the 2 nod elements necessary, or what should I do to extrude my 2D mesh correctly?

/Erik
  Reply With Quote

Old   April 4, 2006, 06:01
Default You've tried the extruding fro
  #11
Super Moderator
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,416
Rep Power: 15
mattijs is on a distinguished road
You've tried the extruding from a patch I assume ? (-sourceXXX options).

Can you use the .sMesh file this writes as a -surface argument correctly? (i.e. does extrudeMesh work)

My guess is that the sMesh file has to have the vertices numbered compactly so starting from 0 and no gaps. Maybe gmsh has options for what to export?
mattijs is offline   Reply With Quote

Old   April 4, 2006, 06:22
Default I chose to extrude the movingW
  #12
newbee
Guest
 
Posts: n/a
I chose to extrude the movingWall patch in the cavity case with the source- arguments entered.

Then I got a file caled movingWall.sMesh which looks like this:

42
(
(0 0.1 0)
(0.005 0.1 0)
(0.01 0.1 0)
....and so on...
)


20
(
4(0 21 22 1)
4(1 22 23 2)
4(2 23 24 3)
....and so on...
)

This should be nodes (42) and elements (20) probably in correct order but without indexnumbers.

I altered my 2D mesh to have this format (thru spread sheet program) and removing 2 nod elements. After that I extruded it using the surface- argument (.sMesh ending). This gave a totaly messed up picture in parafoam.

I will now look into what you said about certain orderig of nodes and elements
  Reply With Quote

Old   April 4, 2006, 06:30
Default And yes, the movingWall looked
  #13
newbee
Guest
 
Posts: n/a
And yes, the movingWall looked ok when I extruded it using surface argument
  Reply With Quote

Old   April 5, 2006, 04:56
Default Thank you Mattijs for all your
  #14
newbee
Guest
 
Posts: n/a
Thank you Mattijs for all your help trying to convert the 2D mesh from gmsh.

I have now found a way to extrude both the geometry and my mesh simultaneous im gmsh. So now Im on the road again.

I still dont know what I did wrong when trying to extrude the 2D mesh from gmsh (when alterd in same format as in openfoam)

But Im leaving that subject now.

Thanks
/Erik
  Reply With Quote

Old   April 5, 2006, 05:02
Default Shame that you did not find a
  #15
Super Moderator
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,416
Rep Power: 15
mattijs is on a distinguished road
Shame that you did not find a way to do the extrusion in OF. Could you post your gmsh solution?
mattijs is offline   Reply With Quote

Old   April 5, 2006, 05:25
Default =) It was an easy solution.
  #16
newbee
Guest
 
Posts: n/a
=)

It was an easy solution. The function extrude had two extra (alternative) argument i.e. -Layers and -Recombine-

If only Surface is difined below then only the geometry will be extruded. The Recombine argument recombines the cells in the direction of the extrudsion, so that thay have the same cross section area at their topp as their bottom i.e. rods not pyramids.

my entre of the command extrude:

Extrude {0,0,50} {
Surface{19}; Layers{ {1}, {1}, {1} }; Recombine;
}
---------------------------------------
entry explanation:


Extrude { expression-list } { extrude-list layers }
Extrudes both the geometry and the mesh using a translation (see section 3.1.5 Extrusions). The layers option determines how the mesh is extruded and has the following syntax:

layers:
Layers { { expression-list }, <{>
{ expression-list } } | Recombine; ...

The first expression-list defines how many elements should be created in each extruded layer. The (optional) second expression-list assigns a region number to each layer, which, if non-zero, overrides the elementary entity number of the extruded entity. This is useful when there is more than one layer, as the elements in each layer can then be identified in a unique way. If the region number is set to zero, or if the expression-list is omitted, the elements are associated with the automatically created elementary geometrical entity (line, surface or volume) created during the extrusion. The last expression-list gives the normalized height of each layer (the list should contain a sequence of n numbers 0 < h1 < h2 < ... < hn <= 1). See 7.3 `t3.geo', for an example.

For line extrusions, the Recombine option will recombine triangles into quadrangles when possible. For surface extrusions, the Recombine option will recombine tetrahedra into prisms, hexahedra or pyramids.

---------------------------------------
This was maybe a bit to thorough.

/Erik
  Reply With Quote

Old   November 7, 2006, 10:41
Default Hi, I am tring play with tu
  #17
mss
Guest
 
Posts: n/a
Hi,

I am tring play with tutorial (cavity). When I started paraFoam I get this error:

--> FOAM FATAL ERROR : Cannot find file "points" in directory "constant/polyMesh"

Could you help me?

Best regards,
Margarita
  Reply With Quote

Old   November 7, 2006, 15:05
Default You have to run blockMesh firs
  #18
Senior Member
 
dmoroian's Avatar
 
Dragos
Join Date: Mar 2009
Posts: 646
Rep Power: 10
dmoroian is on a distinguished road
You have to run blockMesh first! This will generate the actual mesh, including the "points" file.

Dragos
dmoroian is offline   Reply With Quote

Old   July 21, 2008, 17:58
Default I successfully imported a "vir
  #19
Senior Member
 
louisgag's Avatar
 
Louis Gagnon
Join Date: Mar 2009
Location: Québec, QC, Canada
Posts: 178
Rep Power: 7
louisgag is on a distinguished road
Send a message via ICQ to louisgag
I successfully imported a "virtual 2D" mesh using gmshToFoam into OpenFOAM 1.5. The trick I had to perform was to use the Layers and Recombine options of the extrude function in Gmsh (see Gmsh documentation). I was also able to choose between extruded rectangle or triangle meshes; both successfully ran into OF icoFoam and Paraview.
louisgag is offline   Reply With Quote

Old   November 7, 2009, 03:57
Default Thanks for gmsh command help
  #20
New Member
 
David Blyth
Join Date: Nov 2009
Posts: 1
Rep Power: 0
kawikablyth is on a distinguished road
Hey thanks to "newbee" up there for the insight on the gmsh extrude command. Big help with my 2D case.
kawikablyth 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
Problem converting fluent mesh vinz OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 20 November 17, 2012 11:54
Converting a mesh with splitted cells using fluentMeshToFoam jlpelerin OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 4 April 25, 2011 17:56
Gmsh, a free Mesh Generator, Volunteers needed Ahmed Main CFD Forum 0 December 6, 2006 06:26
Error Converting ICEM Structured Mesh to CFX Chebeba CFX 11 October 5, 2006 09:05
Converting 2D mesh to 3D Farooq FLUENT 1 August 7, 2003 06:03


All times are GMT -4. The time now is 04:46.