CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[Other] ...converting PLOT3D mesh files by NASA?

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes
  • 1 Post By alexeym
  • 1 Post By alexeym
  • 3 Post By Flowkersma

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 5, 2011, 09:44
Default ...converting PLOT3D mesh files by NASA?
  #1
Member
 
AleDR's Avatar
 
Alessandro
Join Date: May 2009
Location: Genova
Posts: 47
Rep Power: 16
AleDR is on a distinguished road
Hi FOAMers!

I have some problems with mesh file conversion!!
I'm trying to import NASA grid for the flat plate test case in OpenFOAM... but I don't know how to!!
I am puzzled by the file extension... .p3dmft ? It should be a PLOT3D file format, but I couldn't handle it in ParaView.

I tried the plot3dToFoam but I got this error:

Create time

--> FOAM FATAL IO ERROR:
Attempt to get back from bad stream

file: flatplate_clust2_4levelsdown_35x25.p3dmft at line 1.

From function void Istream::getBack(token&)
in file db/IOstreams/IOstreams/Istream.C at line 38.

FOAM exiting

Can anybody help me? Thanks!
AleDR is offline   Reply With Quote

Old   January 18, 2014, 05:29
Default
  #2
Member
 
Ye Zhang
Join Date: Dec 2009
Location: Delft,Netherland
Posts: 92
Rep Power: 16
kiddmax is on a distinguished road
Hey Alessandro

Did you solve the problem?

Best
Ye
kiddmax is offline   Reply With Quote

Old   January 27, 2015, 09:38
Default
  #3
New Member
 
Vincent HUBER
Join Date: Jan 2015
Location: Strasbourg - France
Posts: 2
Rep Power: 0
VincentHUBER is on a distinguished road
I'm highly interested in the issue ! Have you successfully converted the mesh ?
VincentHUBER is offline   Reply With Quote

Old   January 27, 2015, 14:14
Default
  #4
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

I was not successful in converting meshes with OpenFOAM's plot3dToFoam (and any way there is not much sense in converting just geometry), so I have created Python script for conversion from Plot3D to Gmsh (https://github.com/mrklein/p3d2gmsh) then you can use gmshToFoam to convert mesh into OpenFOAM's format.

In general you will need geometry file (*.p3dfmt) and Neutral Map File with description of boundary conditions. I have tested the script on verification cases from http://turbmodels.larc.nasa.gov, it seems to be converting the meshes and BCs correctly.
chegdan likes this.
alexeym is offline   Reply With Quote

Old   January 27, 2015, 16:31
Default
  #5
New Member
 
Vincent HUBER
Join Date: Jan 2015
Location: Strasbourg - France
Posts: 2
Rep Power: 0
VincentHUBER is on a distinguished road
Wonderfull ! (Actually, I was planning to get Gmsh mesh files :-) )

Bonus questioon
- do you know a way to get the 3D gmsh mesh in 2D (cut along a plane) ?
OR
- can your script (that I ran successfully) be applied to p2dfmt ... without the neutral map file ?
VincentHUBER is offline   Reply With Quote

Old   January 28, 2015, 03:22
Default
  #6
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
No, I don't know the way to flatten mesh in Gmsh. In OpenFOAM there us flattenMesh utility, though its output is a point field, i.e. there will be no information about edges, boundaries, etc. Also there is Gmsh plugins like CutPlane, but again it will lose boundary information.

Initially I started with p2dfmt files but then realized there is no information on boundary conditions, so I've abandoned the idea.
alexeym is offline   Reply With Quote

Old   April 27, 2016, 14:33
Default error when run ./p3d2gmsh.py
  #7
New Member
 
adhi makayasa
Join Date: Apr 2015
Posts: 20
Rep Power: 11
makayasa is on a distinguished road
hi alexym, after seraching how to convet plot3dtoFoam finally I find this forum. But i get error message when running sript p3d2gmsh.py. How do fix this?


Can't open [-o. Skipping.
Can't open naca0012]. Skipping.
Can't open [-m. Skipping.
Can't open n0012]. Skipping.
makayasa is offline   Reply With Quote

Old   April 29, 2016, 04:34
Default
  #8
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

Your output suggests that you have decided to copy command line with brackets (i.e. [-o naca0012] instead of just -o naca0012), while command should be something like:

Code:
./p3d2gmsh.py -o naca0012.msh -m naca0012.nmf naca0012.p3d
This is just a guess and could be irrelevant, since your post lacks information on the way you have got the error.
alexeym is offline   Reply With Quote

Old   April 29, 2016, 11:22
Default
  #9
New Member
 
adhi makayasa
Join Date: Apr 2015
Posts: 20
Rep Power: 11
makayasa is on a distinguished road
Thanks for reply alexym.
After run command ./p3d2gmsh.py -o naca0012.msh -m naca0012.nmf naca0012.p3d
I am get error message :

Traceback (most recent call last):
File "./p3d2gmsh.py", line 585, in <module>
main()
File "./p3d2gmsh.py", line 577, in main
nmf = NeutralMapFile(mapfile)
File "./p3d2gmsh.py", line 90, in __init__
fp = open(filename, 'r')
TypeError: coercing to Unicode: need string or buffer, list found


even tried the files in the folder test, but I still get the same error message. How to fix this?
Thank you
makayasa is offline   Reply With Quote

Old   April 29, 2016, 12:33
Default
  #10
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

There was a bug (guess I have never really tested -o and -m flags). I have pushed fix to repository, so you need to re-download p3d2gmsh.py script.
lpz456 likes this.
alexeym is offline   Reply With Quote

Old   April 30, 2016, 15:15
Default
  #11
New Member
 
adhi makayasa
Join Date: Apr 2015
Posts: 20
Rep Power: 11
makayasa is on a distinguished road
Its work
So, I went on the next stage of the run command gmshToFoam but I get the following message

#0 Foam::error:rintStack(Foam::Ostream&) in "/home/xxx/OpenFOAM/OpenFOAM-1.7.1/lib/linuxGccDPOpt/libOpenFOAM.so"
#1 Foam::sigSegv::sigSegvHandler(int) in "/home/xxx/OpenFOAM/OpenFOAM-1.7.1/lib/linuxGccDPOpt/libOpenFOAM.so"
#2 Uninterpreted:
#3
in "/home/xxx/OpenFOAM/OpenFOAM-1.7.1/applications/bin/linuxGccDPOpt/gmshToFoam"
#4 __libc_start_main in "/lib/i386-linux-gnu/libc.so.6"
#5
in "/home/xxx/OpenFOAM/OpenFOAM-1.7.1/applications/bin/linuxGccDPOpt/gmshToFoam"
Segmentation fault (core dumped)

Thank you
makayasa is offline   Reply With Quote

Old   April 30, 2016, 17:01
Default
  #12
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
This time I can not guess what went wrong, since I have never used version 1.7.1 (well, except certain portions of foam-extent 3.1, which turned your to be OpenFOAM 1.7.x) and you did not show the way to reproduce your error.
alexeym is offline   Reply With Quote

Old   May 1, 2016, 02:21
Default
  #13
New Member
 
adhi makayasa
Join Date: Apr 2015
Posts: 20
Rep Power: 11
makayasa is on a distinguished road
The way that I use :
1.from (http://turbmodels.larc.nasa.gov/naca0012_grids.html) i get file to convert msh file
2. I used a python script from ( https://github.com/mrklein/p3d2gmsh ) to convert msh file
3. I moved the msh file to folder $ FOAM_RUN
4. then use the command gmshToFoam . And I got a message as I have mentioned
whether there are less of these steps ? please correction

Last edited by makayasa; May 1, 2016 at 04:36.
makayasa is offline   Reply With Quote

Old   May 1, 2016, 05:51
Default
  #14
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
I can not reproduce the error neither with OpenFOAM 2.4.x, nor with 3.0.x. So I guess, it is specific to 1.7.1 and I do not know how to fix it.
alexeym is offline   Reply With Quote

Old   May 1, 2016, 06:04
Default
  #15
New Member
 
adhi makayasa
Join Date: Apr 2015
Posts: 20
Rep Power: 11
makayasa is on a distinguished road
Thank you so much for your help. Maybe I 'll try openfoam 2.4.0
makayasa is offline   Reply With Quote

Old   July 22, 2016, 03:34
Default
  #16
Senior Member
 
Mikko
Join Date: Jul 2014
Location: The Hague, The Netherlands
Posts: 243
Rep Power: 12
Flowkersma is on a distinguished road
Hi,

Just for record. I have successfully converted the meshes from NASA page with plot3dToFoam converter by adding -noBlank parameter. For example:

2D mesh
Code:
plot3dToFoam naca0012.p2dfmt -2D 1 -noBlank
3D mesh
Code:
plot3dToFoam naca0012.p3dfmt -noBlank
I had also problems on converting the p3d meshes created by Construct2D.
I solved it by adding a line with 1 in the beginning of the p3d file. For boundary conditions, I use autoPatch and createPatch utilities.

Regards,
Mikko
arvindpj, geth03 and karamaltak like this.
Flowkersma is offline   Reply With Quote

Old   December 13, 2016, 06:16
Default PLOT3D meshes to ansys fluent
  #17
Member
 
Join Date: Aug 2016
Posts: 43
Rep Power: 9
aero_cfd is on a distinguished road
Quote:
Originally Posted by alexeym View Post
Hi,

I was not successful in converting meshes with OpenFOAM's plot3dToFoam (and any way there is not much sense in converting just geometry), so I have created Python script for conversion from Plot3D to Gmsh (https://github.com/mrklein/p3d2gmsh) then you can use gmshToFoam to convert mesh into OpenFOAM's format.

In general you will need geometry file (*.p3dfmt) and Neutral Map File with description of boundary conditions. I have tested the script on verification cases from http://turbmodels.larc.nasa.gov, it seems to be converting the meshes and BCs correctly.
HI,
Thanks for this script , I am trying to use the PLOT3D meshes in ansys and therefore I want to convert them, I execute the script but it takes sometime and still nothing, does it usually take long to convert ?

Thanks
aero_cfd is offline   Reply With Quote

Old   December 31, 2019, 19:16
Default
  #18
New Member
 
TheOneBird
Join Date: Apr 2016
Posts: 8
Rep Power: 10
TheOneBird is on a distinguished road
Thank you heaps for your script. It works great. Firstly, apologies for commenting on such an old thread however I thought this was the best place to post this.

I am having issues setting up one of the NASA cases. 9https://turbmodels.larc.nasa.gov/jetsubsonic_grids.html). The problem I am facing is that the internal faces, between the blocks, appear as boundary conditions in the FOAM file format. It appears that when I run the case, it does not recognise them as internal faces and the solution has discontinuities at each interface. I have set the face type in "boundaries" to "empty", however this has not helped.

Is it possible for someone to share a case directory where they have successfully run one of the NACA cases please? Or could someone direct me in the correct direction for fixing this. Thanks!
TheOneBird is offline   Reply With Quote

Old   October 1, 2023, 02:35
Exclamation Error while importing mesh from Plot3D
  #19
New Member
 
Lakshmi siva kumar
Join Date: Aug 2023
Posts: 3
Rep Power: 2
mlsk is on a distinguished road
Hi guy, i want in import the Plot3Dmesh file(raetaf.x.fmt) to openFoam.
I have tried all the commands i amaware of from the documentation and this Forum.I am facing this issue:

FOAM FATAL IO ERROR:
wrong token type - expected int32_t, found on line 2 the doubleScalar 27.00003

file: raetaf.x.fmt at line 2.

From function Foam::Istream& Foam:perator>>(Foam::Istream&, int32_t&)
in file primitives/ints/int32/int32IO.C at line 62.

It would veryhelpful if anyone can give me way out of this.

Thanks in advance.
mlsk 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
[Salome] Script for converting a mesh from Salome-Platform to OpenFOAM nsf OpenFOAM Meshing & Mesh Conversion 86 February 8, 2023 10:30
sliding mesh problem in CFX Saima CFX 46 September 11, 2021 07:38
Ansys CFX problem: unexpected very high temperatures in premix laminar combustion faizan_habib7 CFX 4 February 1, 2016 17:00
[snappyHexMesh] No layers in a small gap bobburnquist OpenFOAM Meshing & Mesh Conversion 6 August 26, 2015 09:38
[Gmsh] 2D Mesh Generation Tutorial for GMSH aeroslacker OpenFOAM Meshing & Mesh Conversion 12 January 19, 2012 03:52


All times are GMT -4. The time now is 00:27.