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/)
-   -   Problems converting a Fluent case file (http://www.cfd-online.com/Forums/openfoam-meshing-other/117995-problems-converting-fluent-case-file.html)

McFly May 19, 2013 03:37

Problems converting a Fluent case file
 
Hello,

I have been trying to convert a Fluent .cas file (saved in ASCII) for use in OpenFOAM 2.1.1. The mesh has been adapted in Fluent and has hanging nodes, so there is no mesh file. I'm not sure if this is the problem.

The first error message when converting the case file is usually something like:
Code:

--> FOAM FATAL ERROR:
Do not understand characters: |
    on line 4337

    From function fluentMeshToFoam::lexer
    in file fluent3DMeshToFoam.L at line 748.

FOAM exiting

So the file was edited with a text editor (EditPadLite7, as the ASCII file is 1GB size) to remove the offending characters (the | symbol). This could be done as these were not part of the mesh data. The conversion process then gets a bit further until this error:
Code:

--> FOAM FATAL ERROR:
15 not found in table.  Valid entries:
13
(
1
2
3
4
5
6
7
8
9
10
11
12
14
)

Looking at the case file there are 14 zones specified. I can add at 15th, such as is done in this thread. This means finding the area in the .cas file:
Code:

(39 (14 interior default-interior 1)(
 (is-not-a-rans-les-interface . #t)
))

And adding another zone:
Code:

(39 (14 interior default-interior 1)(
 (is-not-a-rans-les-interface . #t)
))
(39 (15 interior bananas 1)(
 (is-not-a-rans-les-interface . #t)
))

With this modification fluent3DMeshToFoam runs, and completes without further errors. However, running checkMesh on this case fails with a bunch of errors that look like this:
Code:

Checking topology...
    Boundary definition OK.
--> FOAM Serious Error :
    From function bool zone::checkDefinition(const label maxSize, const bool report) const
    in file meshes/polyMesh/zones/zone/zone.C at line 211
    Zone bananas contains invalid index label 1009794

... <SNIP> ...

--> FOAM FATAL ERROR:
Too many errors

If, instead of adding zones in the .cas file, one merely changes the last zone to 15:
Code:

(39 (15 interior default-interior 1)(
 (is-not-a-rans-les-interface . #t)
))

then errors such as this occur:
Code:

Zipping mesh to remove hanging nodes
--> FOAM Warning :
    From function void polyMeshZipUpCells(polyMesh& mesh)
    in file polyMeshZipUpCells/polyMeshZipUpCells.C at line 697
    Duplicate point found in the new face.
Point: 39132 face: 8(31989 31543 31542 34169 31542 51478 39132 51483)

Does anyone have any thoughts as to why this cannot be converted? Is it just the hanging node issue?

McFly May 19, 2013 10:11

A work-around
 
Hello again,

I'm still not sure why the error occurs however this work-around appears to have fixed it.

Going with the extra zone (bananas) from above:
Code:

(39 (15 interior bananas 1)(
 (is-not-a-rans-les-interface . #t)
))

fluent3DMeshToFoam produces corresponding zone:
Code:

Creating cellZone 0 name: fluid type: fluid
Creating cellZone 1 name: bananas type: interior

This extra cellZone causes a bunch of problems. However, it can be found within the <case>/control/polyMesh/cellZones file. The top of the file looks like this:
Code:

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

2            //There are two zones in this file (my comment)
(
fluid
{
    type cellZone;
cellLabels      List<label>
4496302
(
0
1
2
...

Indicating two zones. Change the 2 to a 1.

Then, further down the file, I find my new zone:

Code:

bananas
{
    type cellZone;
cellLabels      List<label>
615228
(
4496302
4496303
4496304
...
5111529
5111530
)
;
}

... and all the data for this zone is deleted.

Now checkMesh gives an "OK" result - which is a sight for sore eyes after spending many, many hours trying to get around this issue.

This mesh has been run in a simulation with icoFoam without issues, so I think it's okay. The next test will be trying the same work-around out on the larger mesh with double adaption and seeing if the same process works.

I'm still curious why fluent3DMeshToFoam needs an extra zone to run. If I get time I will have a look through the source code to try and understand what I'm doing wrong.

Any thoughts on this would be appreciated.

wyldckat May 19, 2013 13:43

Greetings Martin,

I only managed to give a quick read to your posts. I think you can find part of the answer here: http://www.cfd-online.com/Forums/ope...tml#post412947 - post #4

I think the missing part of the answer is due to Fluent's format: it uses fixed codes for each field and mesh type. This would explain why it required you to add the 15th code.

Best regards,
Bruno

nisha May 30, 2013 08:10

Could you please tell how to save Fluent .cas files in ASCII format ?

McFly May 30, 2013 21:29

It probably depends on the version of fluent.

In v14.5 it's simple:

File menu > Write > Case ... then in the Select File dialogue box uncheck the box labelled Write Binary Files.

The file saved will be in ASCII format and about twice the size of the binary file.

When you open a binary file something like this will appear in the log:

Code:

248908 hexahedral cells, zone  1, binary.
When it's an ASCII file the 'binary' tag will disappear.

For other versions of Fluent and for queries off the topic of this thread (converting case files) you'd be better served searching the forums or starting a new thread.

nisha May 31, 2013 01:33

McFly,

Thanks, it worked. I'm using Fluent v13. As you pointed out, the file size is much higher in ASCII format.

McFly July 31, 2013 09:28

Just to follow up on my above post.

Firstly, thank you Bruno for your response - I haven't had time to look into it further yet, but maybe someone else will when they have the same problem.

Secondly, two weeks ago I tried the same work-around with a mesh of almost 7M cells and it seems to have worked without issues (the mesh was then decomposed and ran on 256 processors fine) so this is a viable solution for now.

Thanks,


McFly

HHOS July 31, 2013 09:59

Hello!

Just one question that might be stupid, but I am completely new with OpenFOAM... When you transform the mesh using a .cas file instead of a .msh file, you get the whole case set up into OpenFoam? or just the mesh, as if it was a simple .msh file?

I ask this, because what I now do is to import the .msh file and then set up the case with HelyxOS, so I don't need to go through so many code files.

Thank you :)

Lieven July 31, 2013 10:23

OpenFoam is not capable of interpreting fluent case setups. So if you manage to load the .cas-file, I guess you will only have the mesh (but I have to admit, I wouldn't know how you would convert the .cas-file in openfoam).

Cheers,

L

HHOS July 31, 2013 10:38

OK, then... So the good way to do things is to transform just the .msh file...

I get no problems with that... :)

McFly August 1, 2013 21:41

Hello,

As Lieven said, you are only converting the mesh information.

The software can extract a mesh from a case file. This is useful in certain circumstances, such as my case given above.

Regards,


McFly


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