CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

ANSYS Fluent Polyhedral mesh to OpenFOAM

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 2 Post By AtoHM
  • 1 Post By esma

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 5, 2023, 00:20
Default ANSYS Fluent Polyhedral mesh to OpenFOAM
  #1
Member
 
Join Date: May 2016
Posts: 35
Rep Power: 9
esma is on a distinguished road
Hi All,

I have been struggling to import .msh files from fluent to OpenFOAM.
please note this is different from the mesh generated in the ANSYS Workbench mesh module.

The reason is Workbench mesh doesn't have Polyhedral. So I produce the mesh via Fluent and write it from fluent mesh in msh file. When imported in OpenFOAM and applying the fluent3DMeshToFoam command, I get the following message. Has anyone else faced the same problem?

--> FOAM FATAL ERROR: (openfoam-2206)
Do not understand characters: �
on line 1

From virtual int yyFlexLexer::yylex()
in file fluent3DMeshToFoam.L at line 765.

FOAM exiting


I copy a simple mesh file attached if you could check will be appreciated to see if you get the same message.

Thanks in advance
esma is offline   Reply With Quote

Old   January 5, 2023, 01:14
Default
  #2
Senior Member
 
M
Join Date: Dec 2017
Posts: 642
Rep Power: 12
AtoHM is on a distinguished road
Had a similar problem once, does dos2unix on the .msh file help?
Also make sure to not zip the meshing file when exporting from Fluent.
esma and saeed jamshidi like this.
AtoHM is offline   Reply With Quote

Old   January 5, 2023, 02:16
Default
  #3
Member
 
Join Date: May 2016
Posts: 35
Rep Power: 9
esma is on a distinguished road
Much appreciated for the tip, you are my savior. Yes it appears to be working now.

procedures for the future

- once you generated your mesh in WB => open fluent file and read the mesh and convert to Polyhedral mesh within fluent => save a case file *.cas

- now launch Fluent from windows (not in WB), and select its Meshing module (not the solution)
- file-->write -->mesh ... Un-tick the "write binary file" box to ensure your file will be in ASCII format. and per AtoHM guides above, don't select the type as compressed file. in the version I have it's called CFF Mesh Files (*.msh.h5).

- import the {name}.msh file into OpenFOAM
- type command dos2unix {name}.msh
(in case you don't have that command run sudo apt install dos2unix)

now your mesh is ready for fluent3DMeshToFoam {name}.msh
saeed jamshidi likes this.
esma is offline   Reply With Quote

Old   October 18, 2023, 12:29
Default
  #4
Senior Member
 
Saeed Jamshidi
Join Date: Aug 2019
Posts: 214
Rep Power: 7
saeed jamshidi is on a distinguished road
Hi,
I'm going to import fluent mesh to openfoam like yours.
I'm following your steps, but I have come up with the below error!
whoud you please tell me how can I fix it?
Thanks.

Code:
myfoam@DESKTOP-TK3D7CI:~$ cd $FOAM_RUN/tutorials/incompressible/pimpleFoam/laminar/cylinder2D/
myfoam@DESKTOP-TK3D7CI:~/OpenFOAM/myfoam-v2112/run/tutorials/incompressible/pimpleFoam/laminar/cylinder2D$ ls
0.orig  clean  constant  ff.msh.h5  foam.foam  run  system
myfoam@DESKTOP-TK3D7CI:~/OpenFOAM/myfoam-v2112/run/tutorials/incompressible/pimpleFoam/laminar/cylinder2D$ dos2unix ff.msh.h5
dos2unix: Binary symbol 0x1A found at line 2
dos2unix: Skipping binary file ff.msh.h5
myfoam@DESKTOP-TK3D7CI:~/OpenFOAM/myfoam-v2112/run/tutorials/incompressible/pimpleFoam/laminar/cylinder2D$ fluent3DMeshToFoam ff.msh
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2112                                  |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : _6e1fca0e-20220610 OPENFOAM=2112 patch=220610 version=2112
Arch   : "LSB;label=32;scalar=64"
Exec   : fluent3DMeshToFoam ff.msh
Date   : Oct 18 2023
Time   : 19:49:32
Host   : DESKTOP-TK3D7CI
PID    : 1671
I/O    : uncollated
Case   : /home/myfoam/OpenFOAM/myfoam-v2112/run/tutorials/incompressible/pimpleFoam/laminar/cylinder2D
nProcs : 1
trapFpe: Floating point exception trapping enabled (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 5, maxFileModificationPolls 20)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

--> FOAM Warning :
    From void* Foam::dlLibraryTable::openLibrary(const Foam::fileName&, bool)
    in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 188
    Could not load "libadaptiveFvMesh.so"
libadaptiveFvMesh.so: cannot open shared object file: No such file or directory


--> FOAM FATAL ERROR: (openfoam-2112 patch=220610)
: file "ff.msh" not found

    From int main(int, char**)
    in file fluent3DMeshToFoam.L at line 844.

FOAM exiting

myfoam@DESKTOP-TK3D7CI:~/OpenFOAM/myfoam-v2112/run/tutorials/incompressible/pimpleFoam/laminar/cylinder2D$
Attached Images
File Type: jpg Screenshot (154).jpg (115.5 KB, 27 views)
saeed jamshidi is offline   Reply With Quote

Old   October 18, 2023, 13:17
Default
  #5
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,674
Rep Power: 66
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
OpenFOAM can't find a common library. You have an installation error. Check all your environmental variables.
LuckyTran is offline   Reply With Quote

Old   October 18, 2023, 13:29
Default
  #6
Senior Member
 
Saeed Jamshidi
Join Date: Aug 2019
Posts: 214
Rep Power: 7
saeed jamshidi is on a distinguished road
Dear LuckyTran, thanks for reply.
Do you mean there is a problem with installation of dos2unix or other?
Because I can run through current library with blockmesh!
saeed jamshidi is offline   Reply With Quote

Old   October 18, 2023, 15:22
Default
  #7
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,674
Rep Power: 66
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
Well it is true that you do have an openfoam installation error but it may be unrelated. You may run into more errors one day depending on which tools you use.

You have a binary .msh file and it needs to be ascii to work.
LuckyTran is offline   Reply With Quote

Old   October 19, 2023, 02:07
Default
  #8
Senior Member
 
Saeed Jamshidi
Join Date: Aug 2019
Posts: 214
Rep Power: 7
saeed jamshidi is on a distinguished road
The key point is in preference/Default format for I/O must be Legacy, and when we want to export mesh we should follow as below:

Mesh file: mesh.msh

files of type: *.msh.h5


Then copy mesh.msh into your openfoam library and execute fluent3DMeshToFoam mesh.msh.

you will come up with the error:
Code:
--> FOAM FATAL ERROR: (openfoam-2112 patch=220610)
Do not understand characters: [
    on line 431473

    From virtual int yyFlexLexer::yylex()
    in file fluent3DMeshToFoam.L at line 764.

FOAM exiting
open mesh file with edditor and find "[" and delete it. If you execute fluent3DMeshToFoam mesh.msh again it will work properly.
Attached Images
File Type: jpg Screenshot (156).jpg (95.9 KB, 41 views)
File Type: jpg Screenshot (155).jpg (154.7 KB, 45 views)
saeed jamshidi is offline   Reply With Quote

Old   February 26, 2024, 16:09
Exclamation Surface mesh
  #9
New Member
 
Shiva Sudhan R
Join Date: Dec 2022
Location: Bengaluru, India
Posts: 1
Rep Power: 0
rockerboy is on a distinguished road
It seems to me as if the surface mesh is also imported, which is visible in Paraview. How can I fix this? It overlaps with the volume mesh.
rockerboy is offline   Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Other] [Request] OpenFOAM mesh to 2D Ansys fluent mesh anon_q OpenFOAM Community Contributions 6 July 3, 2023 05:24
Error: WorkBench Error: Could not handle event: SolutionStatusUpdate Kieyo Fluent Multiphase 0 November 9, 2022 23:58
[Other] OpenFoam Mesh to Fluent Mesh, 2D lordvon ANSYS Meshing & Geometry 1 January 14, 2022 12:20
[ANSYS Meshing] polyhedral mesh which is generated directly in Workbench Poly Meshing for Fluent teguhtf ANSYS Meshing & Geometry 0 January 24, 2019 22:04
[Commercial meshers] OpenFoam Mesh to Fluent Mesh in parallel case DominicTNC OpenFOAM Meshing & Mesh Conversion 3 November 22, 2017 09:19


All times are GMT -4. The time now is 08:16.