CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (https://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   [Commercial meshers] Extension of fluentMeshToFoam internal cells and faces (https://www.cfd-online.com/Forums/openfoam-meshing/61711-extension-fluentmeshtofoam-internal-cells-faces.html)

gschaider March 24, 2005 08:23

Extension of fluentMeshToFoam internal cells and faces
 
For some of my simulations I need the information about the interior BCs that are assigned by Gambit (to calculate surface integrals on them during postprocessing).

I adapted the fluentMeshToFoam-convertor to write out this information: it writes out faceSets, but doesn't modify the grid in any other way.

I also did a similar thing for cellSets (to assign different material properties for different domains).

My question:
- Are these changes of general interest?
- If yes: where do I send them to, so that they can be inserted in the regular OpenFOAM-distribution (writing of the sets is optional)

The other question is the following: if I understood it correctly face and cellSets are just a collection of face/cell-numbers. Some of the mesh-utilities cause the cells to be reordered. Would I have to rewrite these too?

hjasak March 24, 2005 08:29

Heya, 1) Yes, having things
 
Heya,

1) Yes, having things zoned up in Gambit may come in handy

2) send it to OpenCFD and it will end up in the next release

3) It is the mesh that enforces the ordering and zones are passive. You may wish to orient the face zones to have front and back (otherwise there may be problems with orientation) but apart from that there's nothing to worry about.

Thanks for the effort, much appreciated,

Hrv

mattijs March 24, 2005 08:34

Ad 2) send it to me and I'll h
 
Ad 2) send it to me and I'll have a look at it. Address is m.janssens at opencfd.co.uk

A small testcase would be nice as well - we don't have Gamibt over here.

Mattijs

ali March 26, 2005 11:17

From what I tried, foam does n
 
From what I tried, foam does not recognize the boundaries at all. So, the 'boundary' file has nothing in it although 'cells', 'points', and 'faces' are all created correctly using fluentMeshToFoam.

So, what should I do to set boundaries? In other codes, one can select the desired faces (using GUI) and set it as a special boundary condition.

However, in foam, the only thing I can think of is than I should state the name and type of boundary and state 'nFaces' and 'startFace', right?

If this is the way to do it, I don't know how to determine the face numbers.

hjasak March 26, 2005 11:24

Heya, You've messed somethi
 
Heya,

You've messed something up: fluentMeshToFoam does indeed read boundary data - have a look at:
OpenFOAM-1.1/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshT oFoam.L
line 1088 onwards: patch types, names and faces are read from the fluent file and re-assembled on line 1229.

Also, you can see the mapping for various fluent-to-foam patch types in lines 1134-1206.

The nice thing is that now you've got full source you can find out and tell me what has actually happened! :-)

Looking forward to any bug fixes,

Hrv

gschaider March 30, 2005 08:38

The gambitMeshToFoam converter
 
The gambitMeshToFoam converter has been extended to write faceSets and cellSets for interior boundaries and regions that were defined in Gambit.

Mattijs has inserted it into the next release (>1.1)

Should anyone need this feature before that release is released, contact me and I'll send it to you.

helmut April 27, 2005 10:47

I'd like to take up your offer
 
I'd like to take up your offer of getting this feature now, before the next release. Thanks very much for making it available.

Regards,
Helmut

gschaider April 28, 2005 04:16

I have attached the tar-file:
 
I have attached the tar-file:

http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif fluentMeshToFoamWithInternals.tar.gz

helmut August 17, 2005 16:00

Hi, Is there also an extend
 
Hi,

Is there also an extended mesh object with read and access functions for the face and cell sets? Once again, I'd be interested ...

Regards,
Helmut

gschaider August 22, 2005 07:56

With read&access you mean some
 
With read&access you mean something like

filter[cellSet]=filterID;

to set the value of filter for all the cells in the cellSet to filterID? I don't think so. (At least I didn't find anything like that).

The way I'm doing this is:

cellSet filterSet(mesh,filterName,IOobject::MUST_READ,IOob ject::NO_WRITE);

for(cellSet::iterator cell=filterSet.begin();cell!=filterSet.end();cell+ +)
filter[cell.key()]=filterID;


helmut August 29, 2005 09:45

Thanks, this looks very helpfu
 
Thanks, this looks very helpful.

gschaider September 5, 2005 14:02

Just wanted to say, that the u
 
Just wanted to say, that the utility posted to this thread on the 28th of April is obsolete, because it's functionality has been incorporated into the 1.2 release.

ghanshyam September 6, 2005 00:52

That is a great news. Thanks f
 
That is a great news. Thanks for the info. How do we see those internal faces? We tried but could not see those internal faces. Where might be the mistake from our side?

Regards
GS

gschaider September 6, 2005 08:23

With "see" you mean "display i
 
With "see" you mean "display in paraFoam"?

If yes: Unfortunately paraFoam can't display these sets.

What you should see is in the polyMesh-dictionary an additional dictionary named "sets". In this dictionary are files that are named like the cellSets and faceSets.

To display them in a postprocessor you can convert the Geometry with foamToVTK (there is an option for faceSets and cellSets) and display the geometry with the normal paraview.

For examples how to access the resulting sets from a program see my response in this thread or this utility on the wiki http://openfoamwiki.net/index.php/Contrib_calcMas sFlow
(there may be other more elegant way)

hani September 20, 2005 07:05

I'm having troubles converting
 
I'm having troubles converting a Fluent mesh to OpenFoam using FluentMeshToFoam. I get the following messages:
Found unknown block
Embedded blocks in comment or unknown
Found end of section in unknown

The mesh has internal patches, which might cause the problem.

The mesh is available at
http://www.sirius.luth.se/strl/Turbine-99/Mesh/t99_hex_unstr_1m_yp50.fluent6.bin .zip
if someone would be kind enough to help me have a look at it.

I am aiming at using the internal patches for post-processing. I simply want to output the velocity and pressure fields on those patches. Maybe someone can tell me how to do that.

Håkan.

gschaider September 20, 2005 07:50

Hello Hakan. I noticed, tha
 
Hello Hakan.

I noticed, that your mesh has a "Binary Section". The meshes I've had experience with were only pure ASCII-texts (to be honest I even don't know how to produce that binary output).

My guess (and the funny characters in the output back that up) is that the converter can't handle meshes that are output as binary (looking at the source-code I'd be surprised if it did)

Try writing the mesh as pure ASCII(text) and convert that.

hani September 20, 2005 08:28

Thanks for your quick reply!
 
Thanks for your quick reply!

I converted the mesh to ASCII using ICEM (find it at http://www.tfd.chalmers.se/~hani/outgoing/t99_hex_unstr_1m_yp50.fluent6.ascii.ms h)
(Note that I did not generate the grid myself, I got it in the binary format.)

Then I got the following error message, which you might be able to help me interpret:

--> FOAM FATAL ERROR : Cannot find match for face 3.
Model: hex model face: 4(3 7 6 2) Mesh faces:
6
(
4(891900 891902 891901 891899)
4(891902 891900 532724 532726)
4(891902 532726 532725 891901)
4(532723 532725 532726 532724)
4(532725 891901 891899 532723)
4(891899 891900 532724 532723)
)
Matched points: 8(532723 532724 891900 891899 891902 532726 -1 891901)

From function create3DCellShape(const label cellIndex, const labelList& faceLabels, const labelListList& faces, const labelList& owner, const labelList& neighbour, const label fluentCellModelID)
in file create3DCellShape.C at line 281.

FOAM aborting

Håkan.

mattijs September 20, 2005 10:25

Hi Håkan, does it convert i
 
Hi Håkan,

does it convert if you remove the internal patches? Does the mesh have any 'split' hexes? Did you have any luck with 'normal' cellShapes?

gschaider September 20, 2005 11:31

I tried it by editing all the
 
I tried it by editing all the internal patches (wall_right, wall_left, wall_sides, wall_cyl, cs4b and symmetry) from type ''wall'' to type ''internal''. This doesn't help.

If I import the mesh to Gambit and export it again the exported mesh can be converted (if the interior patches are set correctly).
Don't know whether these meshes are identical, but fluentMeshToFoam reports the same number of points/cells/faces during importing (for the second mesh it reports them in the order points/faces/cells - don't know if this has any importance)

@Mattijs: removed the interior patches as proposed. This doesn't help either.

mattijs September 20, 2005 13:28

> reports them in the order po
 
> reports them in the order points/faces/cells
No importance, just inconsistency.

You convert successfully from Gambit with gambitToFoam? Or does Gambit again write Fluent format?

From the original message it seems it has not matched all of the points of a hex.

Anything special about the mesh? Does it work if you put all outside faces in one patch (and have no internal patches and/or gaps in the mesh)?

gschaider September 20, 2005 15:46

@converting: I take the mesh a
 
@converting: I take the mesh as provided by Hakan import it into Gambit as a Fluent-mesh and without further manipulation export it again as a Fluent mesh (the points seem to be renumbere mesh)

The mesh seems to be a pure Hex mesh. Nothing special. But maybe Hakan can tell us more.

@all patches in one: I could only do that in Gambit (or maybe with Emacs, if I knew the format well enough), but then the error goes away as explained above.

hjasak September 21, 2005 03:28

Re the original Gambit convert
 
Re the original Gambit converter message from Ghanshyam Singh: the cell numbering in FOAM and Gambit will be identical, so you can find out which cells the problem face is between and with that got back to Gambit/TGrid and find out what's going on with the two cells.

Enjoy,

Hrv

hani September 22, 2005 06:15

I've been away for one day, so
 
I've been away for one day, so that's why I didn't answer any of your messages. I'll try to do it now:

I have tried to remove the internal patches with ICEM, without success in the conversion.

There are only Hex cells.

I have imported and exported the mesh with Gambit as proposed by Bernhard. First of all, the boundary conditions were all mixed for some reason. The names do not correspond to the original names, that's why some walls are "internal". If I just exported it to Fluent format I still had the same problem. If I change the internal patches to internal in Gambit before exporting to Fluent format it can be converted using fluenMeshToFoam, and the internal patches are put in constant/polyMesh/sets. I tried this procedure before, but then the mesh was in binary format and Gambit wouldn't read it.

I have also tried just changing the internal patches to "internal" in the file, and it does of course not work for me either. I tried both changing the original names for the internal patches to "internal" and also the same as Bernhard described.

I can't make any sense out of this - I guess that I will have to use ICEM to convert binary to ascii and then update the boundary conditions with Gambit before I use fluentMeshToFoam.

Now, How can I use the internal patches that is defined in constant/polyMesh/sets to write out the results at those planes?

Håkan

mattijs September 22, 2005 12:35

- you can make them (faceSets)
 
- you can make them (faceSets) into external patches using the splitMesh utility (discussed before)

- create a cellSet from the cells on one/both sides of the faceSet using the cellSet utility. Visualize the results on the cells with foamToVTK

gschaider September 29, 2005 10:36

Hi Hakan. If you want to do
 
Hi Hakan.

If you want to do calculations on the surfaces defined by the faceSets you can do so by using the concept described in

http://openfoamwiki.net/index.php/Snip_access_cel lset_data

olivier October 3, 2005 15:52

hi I have 2 zones of fluid,
 
hi
I have 2 zones of fluid, separated by wall.
when I do this in blockMesh I have
------------------------------------------
FOAM FATAL ERROR : Trying to specify a boundary face 4(8 10 11 9) on the face on cell 0 which is either an internal face or already belongs to some other patch.
This is face 3 of patch 1 named fixedWalls.
-----------------------------------------------
can someone tell me how can I do this?
thanks a lot
convertToMeters 0.1;
------------------------
vertices
(
(0 0 0)
(1 0 0)
(1 1 0)
(0 1 0)
(0 0 0.1)
(1 0 0.1)
(1 1 0.1)
(0 1 0.1)
(0 0.5 0)
(1 0.5 0)
(0 0.5 0.1)
(1 0.5 0.1)
);

blocks
(
hex (0 1 9 8 4 5 11 10) (20 20 2) simpleGrading (1 1 1)
hex (8 9 2 3 10 11 6 7) (20 20 2) simpleGrading (1 1 1)
);

edges
(
);

patches
(
wall movingWall
(
(3 7 6 2)
)
wall fixedWalls
(
(0 4 10 8)
(2 6 11 9)
(1 5 4 0)
(8 10 11 9 )
)
empty frontAndBack
(
(0 8 9 1)
(8 3 2 9)
(4 5 11 10)
(10 11 6 7)
)
);

mergePatchPairs
(
);

mayank June 12, 2007 04:52

hello, I am trying to conve
 
hello,

I am trying to convert a mesh with internal faces on openFoam 1.4 .The original fluentMeshtoFOam utility does not wirte polymesh/sets or faceSets, so I compiled fluentMeshtoFoamWithInternals but I get the following error:

SOURCE=fluentMeshToFoamWithInternals.L ; flex++ -f $SOURCE ; mv lex.yy.cc Make/linux64Gcc4DPOpt/fluentMeshToFoamWithInternals.C ; g++ -m64 -Dlinux64 -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -march=opteron -O3 -DNoRepository -ftemplate-depth-40 -I/home/mgo/OpenFOAM/OpenFOAM-1.4/src/meshTools/lnInclude -IlnInclude -I. -I/home/mgo/OpenFOAM/OpenFOAM-1.4/src/OpenFOAM/lnInclude -fPIC -c Make/linux64Gcc4DPOpt/fluentMeshToFoamWithInternals.C -o Make/linux64Gcc4DPOpt/fluentMeshToFoamWithInternals.o
/bin/sh: flex++: command not found
mv: cannot stat `lex.yy.cc': No such file or directory
g++: Make/linux64Gcc4DPOpt/fluentMeshToFoamWithInternals.C: No such file or directory
g++: no input files
make: *** [Make/linux64Gcc4DPOpt/fluentMeshToFoamWithInternals.o] Error 1

Can anybody help me with this error.

Mayank.

msrinath80 June 12, 2007 05:04

flex++ needs to be installed.
 
flex++ needs to be installed. Search for the flex++ package on yum/yast2/synaptic etc. depending on which GNU/Linux distro you use. Also install the corresponding devel package to be safe.

mayank June 12, 2007 07:58

thanks for your reply.i instal
 
thanks for your reply.i installed flex++ but still there is error:

Making dependency list for source file extrudedTriangleCellShape.C
Making dependency list for source file extrudedQuadCellShape.C
Making dependency list for source file create3DCellShape.C
Making dependency list for source file fluentMeshToFoamWithInternals.L
SOURCE=extrudedTriangleCellShape.C ; g++ -m64 -Dlinux64 -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -march=opteron -O3 -DNoRepository -ftemplate-depth-40 -I/home/mgo/OpenFOAM/OpenFOAM-1.4/src/meshTools/lnInclude -IlnInclude -I. -I/home/mgo/OpenFOAM/OpenFOAM-1.4/src/OpenFOAM/lnInclude -fPIC -c $SOURCE -o Make/linux64Gcc4DPOpt/extrudedTriangleCellShape.o
SOURCE=extrudedQuadCellShape.C ; g++ -m64 -Dlinux64 -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -march=opteron -O3 -DNoRepository -ftemplate-depth-40 -I/home/mgo/OpenFOAM/OpenFOAM-1.4/src/meshTools/lnInclude -IlnInclude -I. -I/home/mgo/OpenFOAM/OpenFOAM-1.4/src/OpenFOAM/lnInclude -fPIC -c $SOURCE -o Make/linux64Gcc4DPOpt/extrudedQuadCellShape.o
SOURCE=create3DCellShape.C ; g++ -m64 -Dlinux64 -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -march=opteron -O3 -DNoRepository -ftemplate-depth-40 -I/home/mgo/OpenFOAM/OpenFOAM-1.4/src/meshTools/lnInclude -IlnInclude -I. -I/home/mgo/OpenFOAM/OpenFOAM-1.4/src/OpenFOAM/lnInclude -fPIC -c $SOURCE -o Make/linux64Gcc4DPOpt/create3DCellShape.o
SOURCE=fluentMeshToFoamWithInternals.L ; flex++ -f $SOURCE ; mv lex.yy.cc Make/linux64Gcc4DPOpt/fluentMeshToFoamWithInternals.C ; g++ -m64 -Dlinux64 -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -march=opteron -O3 -DNoRepository -ftemplate-depth-40 -I/home/mgo/OpenFOAM/OpenFOAM-1.4/src/meshTools/lnInclude -IlnInclude -I. -I/home/mgo/OpenFOAM/OpenFOAM-1.4/src/OpenFOAM/lnInclude -fPIC -c Make/linux64Gcc4DPOpt/fluentMeshToFoamWithInternals.C -o Make/linux64Gcc4DPOpt/fluentMeshToFoamWithInternals.o
stdin:14911: m4: Warning: Excess arguments to built-in `m4_ifdef' ignored
lex.yy.cc: In member function 'virtual int yyFlexLexer::yylex()':
lex.yy.cc:12072: warning: use of old-style cast
lex.yy.cc:12072: warning: use of old-style cast
lex.yy.cc:12088: warning: use of old-style cast
lex.yy.cc:12906: warning: use of old-style cast
lex.yy.cc: In member function 'int yyFlexLexer::yy_get_next_buffer()':
lex.yy.cc:13154: warning: use of old-style cast
lex.yy.cc:13177: warning: use of old-style cast
lex.yy.cc:13190: warning: use of old-style cast
lex.yy.cc:13190: warning: use of old-style cast
lex.yy.cc:13211: warning: use of old-style cast
lex.yy.cc: In member function 'yy_state_type yyFlexLexer::yy_get_previous_state()':
lex.yy.cc:13258: warning: use of old-style cast
lex.yy.cc:13258: warning: use of old-style cast
lex.yy.cc: In member function 'void yyFlexLexer::yyunput(int, char*)':
lex.yy.cc:13318: warning: use of old-style cast
lex.yy.cc:13319: warning: use of old-style cast
lex.yy.cc:13327: warning: use of old-style cast
lex.yy.cc: In member function 'int yyFlexLexer::yyinput()':
lex.yy.cc:13394: warning: use of old-style cast
lex.yy.cc: In member function 'virtual yy_buffer_state* yyFlexLexer::yy_create_buffer(std::istream*, int)':
lex.yy.cc:13472: warning: use of old-style cast
lex.yy.cc:13481: warning: use of old-style cast
lex.yy.cc: In member function 'virtual void yyFlexLexer::yy_delete_buffer(yy_buffer_state*)':
lex.yy.cc:13503: warning: use of old-style cast
lex.yy.cc:13506: warning: use of old-style cast
lex.yy.cc:13508: warning: use of old-style cast
lex.yy.cc: In member function 'void yyFlexLexer::yyensure_buffer_stack()':
lex.yy.cc:13635: warning: use of old-style cast
lex.yy.cc:13653: warning: use of old-style cast
lex.yy.cc: In member function 'void yyFlexLexer::yy_push_state(int)':
lex.yy.cc:13671: warning: use of old-style cast
lex.yy.cc:13674: warning: use of old-style cast
lex.yy.cc:13674: warning: use of old-style cast
lex.yy.cc: In function 'void* yyalloc(yy_size_t)':
lex.yy.cc:13754: warning: use of old-style cast
lex.yy.cc: In function 'void* yyrealloc(void*, yy_size_t)':
lex.yy.cc:13766: warning: use of old-style cast
lex.yy.cc:13766: warning: use of old-style cast
lex.yy.cc: In function 'void yyfree(void*)':
lex.yy.cc:13771: warning: use of old-style cast
g++ -m64 -Dlinux64 -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -march=opteron -O3 -DNoRepository -ftemplate-depth-40 -I/home/mgo/OpenFOAM/OpenFOAM-1.4/src/meshTools/lnInclude -IlnInclude -I. -I/home/mgo/OpenFOAM/OpenFOAM-1.4/src/OpenFOAM/lnInclude -fPIC Make/linux64Gcc4DPOpt/extrudedTriangleCellShape.o Make/linux64Gcc4DPOpt/extrudedQuadCellShape.o Make/linux64Gcc4DPOpt/create3DCellShape.o Make/linux64Gcc4DPOpt/fluentMeshToFoamWithInternals.o -L/home/mgo/OpenFOAM/OpenFOAM-1.4/lib/linux64Gcc4DPOpt \
-lmeshTools -lOpenFOAM -liberty -ldl -lm -o /home/mgo/OpenFOAM/mgo-1.4/applications/bin/linux64Gcc4DPOpt/fluentMeshToFoamWit hInternals
/usr/lib/../lib64/crt1.o: In function `_start':
init.chttp://www.cfd-online.com/OpenFOAM_D...lipart/sad.gif.text+0x20): undefined reference to `main'
collect2: ld returned 1 exit status
make: *** [/home/mgo/OpenFOAM/mgo-1.4/applications/bin/linux64Gcc4DPOpt/fluentMeshToFoamWi thInternals] Error 1

helmut June 12, 2007 08:20

Hi, I think the capability
 
Hi,

I think the capability of fluentMeshToFoamWithInternals was added to fluentMeshToFoam in the 1.1 release. See the message above from Bernhard Gschaider on Wednesday, March 30, 2005

connclark June 12, 2007 12:04

Mayank, This seems to be re
 
Mayank,

This seems to be related to the problem I had

http://www.cfd-online.com/cgi-bin/Op...how.cgi?1/4610

mabey its an issue with the newer version of flex

connclark June 14, 2007 12:45

Mayank, I may have a fix fo
 
Mayank,

I may have a fix for you.

edit the fluentMeshToFoamWithInternals.L and change all occurrences of "]]" to "] ]"

mayank June 25, 2007 08:54

Hello conn, thanks for your
 
Hello conn,

thanks for your help ,it worked but i think fluentMeshtoFoamWithInternals is obsolete as mentioned earlier.
I still have problems converting meshes from fluent with internal wall.The following message is dispayed, that is no error is there but internal faces are not written in polymesh/sets/faceSets.

Building boundary and internal patches.
Creating patch 0 for zone: 10 start: 1 end: 1596 type: interior name: int_INTERNAL
Creating patch 1 for zone: 11 start: 1597 end: 8760 type: interior name: int_FLUID
Creating patch 2 for zone: 12 start: 8761 end: 9864 type: wall name: WALL
Creating patch 3 for zone: 13 start: 9865 end: 10008 type: wall name: INLET
Creating patch 4 for zone: 14 start: 10009 end: 10152 type: wall name: OUTLET
Creating patch 5 for zone: 15 start: 10153 end: 10632 type: wall name: INTERNAL
Patch int_INTERNAL is internal to the mesh and is not being added to the boundary.
Patch int_FLUID is internal to the mesh and is not being added to the boundary.
Adding new patch WALL of type wall as patch 0
Adding new patch INLET of type wall as patch 1
Adding new patch OUTLET of type wall as patch 2
Patch INTERNAL is internal to the mesh and is not being added to the boundary.

Default patch type set to empty

Checking mesh...done.


Writing mesh... to "constant/polyMesh" done.

Internal walls just disappear.How to write internal faces to sets dir. ?

gascortado January 2, 2011 09:57

Ali's questions
 
wrong post sorry

gascortado January 2, 2011 10:01

Ali's comments
 
does anyone have the answer to Ali's questions above? I have the same problem. Thanks


All times are GMT -4. The time now is 05:50.